-# Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 4)
-SET(${PROJECT_NAME_UC}_PATCH_VERSION 1)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 7)
+SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
SET(${PROJECT_NAME_UC}_VERSION
${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
IF(EXISTS ${GUI_ROOT_DIR})
LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
FIND_PACKAGE(SalomeGUI)
- FULL_GUI(TRUE) #check whether GUI builded in full mode and with CORBA
+ SALOME_GUI_WITH_CORBA() #check whether GUI builded with CORBA
+ SALOME_GUI_MODE(SALOME_USE_OCCVIEWER SALOME_USE_VTKVIEWER SALOME_USE_SALOMEOBJECT
+ OPTIONAL SALOME_USE_PLOT2DVIEWER SALOME_USE_GRAPHICSVIEW SALOME_USE_PYCONSOLE)
ADD_DEFINITIONS(${GUI_DEFINITIONS})
INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
ELSE(EXISTS ${GUI_ROOT_DIR})
# Qt4
FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml)
-
- # Optional prerequisites for GUI
- IF(SALOME_USE_GLVIEWER)
- FIND_PACKAGE(SalomeOpenGL)
- SALOME_LOG_OPTIONAL_PACKAGE(OpenGL SALOME_USE_GLVIEWER)
- ENDIF()
ENDIF(SALOME_BUILD_GUI)
##
LIST(APPEND _${PROJECT_NAME}_exposed_targets
AdvancedGUI BasicGUI BlocksGUI BooleanGUI BuildGUI DisplayGUI DlgRef CurveCreator EntityGUI GEOMBase
GEOMFiltersSelection GEOM GEOMToolsGUI GenerationGUI GroupGUI Material MeasureGUI GEOMObject
- OperationGUI PrimitiveGUI RepairGUI TransformationGUI DependencyTree
+ OperationGUI PrimitiveGUI RepairGUI TransformationGUI
STLPluginGUI BREPPluginGUI STEPPluginGUI IGESPluginGUI XAOPluginGUI VTKPluginGUI
)
+ IF(SALOME_USE_GRAPHICSVIEW)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets DependencyTree)
+ ENDIF(SALOME_USE_GRAPHICSVIEW)
ENDIF(SALOME_BUILD_GUI)
IF(SALOME_GEOM_USE_OPENCV)
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#
# !! Please read the generic detection procedure in SalomeMacros.cmake !!
#
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(OpenCV OpenCV_DIR 2)
+SET(UpCount 2)
+
+IF (WIN32)
+ SET(UpCount 0)
+ENDIF (WIN32)
+
+SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(OpenCV OpenCV_DIR ${UpCount})
+
#MARK_AS_ADVANCED()
IF(OpenCV_FOUND)
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-dnl Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+dnl Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
dnl
dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-dnl Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+dnl Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
-dnl Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+dnl Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#
import os, sys, string
-from salome_utils import getTmpDir, generateFileName, uniteFiles
+from salome_utils import getLogDir, generateFileName, uniteFiles
from setenv import add_path, get_lib_dir, salome_subdir
# -----------------------------------------------------------------------------
"""Add to the PATH-variables modules specific paths"""
psep = os.pathsep
python_version="python%d.%d" % sys.version_info[0:2]
-
- tmp_dir = getTmpDir()
+
+ tmp_dir = getLogDir()
env_dir = generateFileName( tmp_dir, prefix="env", with_port=True )
res_dir = os.path.join( os.getenv( "GEOM_ROOT_DIR" ), "share", salome_subdir, "resources", "geom" )
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#
SET(BAD_TESTS
- repairing_operations_ex09.py
+ repairing_operations_ex09.py
)
SET(GOOD_TESTS
- 3dsketcher.py
- advanced_geom_objs_ex01.py
- advanced_geom_objs_ex02.py
- advanced_geom_objs_ex03.py
- angle.py
- arranging_study_objects.py
- basic_geom_objs_ex01.py
- basic_geom_objs_ex02.py
- basic_geom_objs_ex03.py
- basic_geom_objs_ex04.py
- basic_geom_objs_ex05.py
- basic_geom_objs_ex06.py
- basic_geom_objs_ex07.py
- basic_geom_objs_ex08.py
- basic_geom_objs_ex09.py
- basic_operations_ex01.py
- basic_operations_ex02.py
- basic_operations_ex03.py
- basic_properties.py
- blocks_operations_ex01.py
- blocks_operations_ex02.py
- blocks_operations_ex03.py
- boolean_operations_ex01.py
- boolean_operations_ex02.py
- boolean_operations_ex03.py
- boolean_operations_ex04.py
- bounding_box.py
- building_by_blocks_ex01.py
- building_by_blocks_ex02.py
- center_of_mass.py
- check_compound_of_blocks.py
- check_self_intersections.py
- check_shape.py
- complex_objs_ex01.py
- complex_objs_ex02.py
- complex_objs_ex03.py
- complex_objs_ex04.py
- complex_objs_ex05.py
- complex_objs_ex06.py
- complex_objs_ex07.py
- complex_objs_ex08.py
- complex_objs_ex09.py
- complex_objs_ex10.py
- free_boundaries.py
- free_faces.py
- GEOM_box.py
- get_non_blocks.py
- import_export.py
- inertia.py
- min_distance.py
- normal_face.py
- notebook_geom.py
- point_coordinates.py
- primitives_ex01.py
- primitives_ex02.py
- primitives_ex03.py
- primitives_ex04.py
- primitives_ex05.py
- primitives_ex06.py
- primitives_ex07.py
- repairing_operations_ex01.py
- repairing_operations_ex02.py
- repairing_operations_ex03.py
- repairing_operations_ex04.py
- repairing_operations_ex05.py
- repairing_operations_ex06.py
- repairing_operations_ex07.py
- repairing_operations_ex08.py
- repairing_operations_ex10.py
- repairing_operations_ex11.py
- repairing_operations_ex12.py
- sketcher.py
- tolerance.py
- topological_geom_objs_ex01.py
- topological_geom_objs_ex02.py
- topological_geom_objs_ex03.py
- topological_geom_objs_ex04.py
- topological_geom_objs_ex05.py
- topological_geom_objs_ex06.py
- transformation_operations_ex01.py
- transformation_operations_ex02.py
- transformation_operations_ex03.py
- transformation_operations_ex04.py
- transformation_operations_ex05.py
- transformation_operations_ex06.py
- transformation_operations_ex07.py
- transformation_operations_ex08.py
- transformation_operations_ex09.py
- transformation_operations_ex10.py
- transformation_operations_ex11.py
- transformation_operations_ex12.py
- transformation_operations_ex13.py
- viewing_geom_objs_ex01.py
- viewing_geom_objs_ex02.py
- viewing_geom_objs_ex03.py
- viewing_geom_objs_ex04.py
- whatis.py
- working_with_groups_ex01.py
- working_with_groups_ex02.py
- working_with_groups_ex03.py
- working_with_groups_ex04.py
- working_with_groups_ex05.py
+ 3dsketcher.py
+ advanced_geom_objs_ex01.py
+ advanced_geom_objs_ex02.py
+ advanced_geom_objs_ex03.py
+ angle.py
+ arranging_study_objects.py
+ basic_geom_objs_ex01.py
+ basic_geom_objs_ex02.py
+ basic_geom_objs_ex03.py
+ basic_geom_objs_ex04.py
+ basic_geom_objs_ex05.py
+ basic_geom_objs_ex06.py
+ basic_geom_objs_ex07.py
+ basic_geom_objs_ex08.py
+ basic_geom_objs_ex09.py
+ basic_geom_objs_ex10.py
+ basic_operations_ex01.py
+ basic_operations_ex02.py
+ basic_operations_ex03.py
+ basic_operations_ex04.py
+ basic_properties.py
+ blocks_operations_ex01.py
+ blocks_operations_ex02.py
+ blocks_operations_ex03.py
+ boolean_operations_ex01.py
+ boolean_operations_ex02.py
+ boolean_operations_ex03.py
+ boolean_operations_ex04.py
+ bounding_box.py
+ building_by_blocks_ex01.py
+ building_by_blocks_ex02.py
+ center_of_mass.py
+ check_compound_of_blocks.py
+ check_self_intersections.py
+ check_shape.py
+ complex_objs_ex01.py
+ complex_objs_ex02.py
+ complex_objs_ex03.py
+ complex_objs_ex04.py
+ complex_objs_ex05.py
+ complex_objs_ex06.py
+ complex_objs_ex07.py
+ complex_objs_ex08.py
+ complex_objs_ex09.py
+ complex_objs_ex10.py
+ complex_objs_ex11.py
+ fast_intersection.py
+ free_boundaries.py
+ free_faces.py
+ GEOM_box.py
+ get_non_blocks.py
+ import_export.py
+ inertia.py
+ min_distance.py
+ normal_face.py
+ notebook_geom.py
+ polyline.py
+ point_coordinates.py
+ primitives_ex01.py
+ primitives_ex02.py
+ primitives_ex03.py
+ primitives_ex04.py
+ primitives_ex05.py
+ primitives_ex06.py
+ primitives_ex07.py
+ repairing_operations_ex01.py
+ repairing_operations_ex02.py
+ repairing_operations_ex03.py
+ repairing_operations_ex04.py
+ repairing_operations_ex05.py
+ repairing_operations_ex06.py
+ repairing_operations_ex07.py
+ repairing_operations_ex08.py
+ repairing_operations_ex10.py
+ repairing_operations_ex11.py
+ repairing_operations_ex12.py
+ sketcher.py
+ tolerance.py
+ topological_geom_objs_ex01.py
+ topological_geom_objs_ex02.py
+ topological_geom_objs_ex03.py
+ topological_geom_objs_ex04.py
+ topological_geom_objs_ex05.py
+ topological_geom_objs_ex06.py
+ transformation_operations_ex01.py
+ transformation_operations_ex02.py
+ transformation_operations_ex03.py
+ transformation_operations_ex04.py
+ transformation_operations_ex05.py
+ transformation_operations_ex06.py
+ transformation_operations_ex07.py
+ transformation_operations_ex08.py
+ transformation_operations_ex09.py
+ transformation_operations_ex10.py
+ transformation_operations_ex11.py
+ transformation_operations_ex12.py
+ transformation_operations_ex13.py
+ transformation_operations_ex14.py
+ viewing_geom_objs_ex01.py
+ viewing_geom_objs_ex02.py
+ viewing_geom_objs_ex03.py
+ viewing_geom_objs_ex04.py
+ whatis.py
+ working_with_groups_ex01.py
+ working_with_groups_ex02.py
+ working_with_groups_ex03.py
+ working_with_groups_ex04.py
+ working_with_groups_ex05.py
working_with_groups_ex06.py
)
+IF(CAS_VERSION_STR VERSION_GREATER "6.9.0")
+ LIST(APPEND GOOD_TESTS
+ check_self_intersections_fast.py
+ )
+ENDIF()
SET(EXAMPLES_TESTS ${BAD_TESTS} ${GOOD_TESTS} testme.py)
FOREACH(test ${GOOD_TESTS})
GET_FILENAME_COMPONENT(testname ${test} NAME_WE)
- ADD_TEST(NAME ${testname}
+ ADD_TEST(NAME ${testname}
COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_SOURCE_DIR}/doc/salome/examples/testme.py ${CMAKE_CURRENT_SOURCE_DIR}/${test})
- SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}")
+ SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}")
ENDFOREACH()
# install Python scripts
SALOME_INSTALL_SCRIPTS("${EXAMPLES_TESTS}" ${SALOME_INSTALL_DOC}/examples/GEOM)
+
+# Application tests
+
+SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test)
+INSTALL(FILES ${GOOD_TESTS} DESTINATION ${TEST_INSTALL_DIRECTORY})
+
+INSTALL(FILES CTestTestfileInstall.cmake
+ DESTINATION ${TEST_INSTALL_DIRECTORY}
+ RENAME CTestTestfile.cmake)
--- /dev/null
+# Copyright (C) 2015 CEA/DEN, 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
+#
+
+SET(SALOME_TEST_DRIVER "$ENV{ABSOLUTE_APPLI_PATH}/bin/salome/appliskel/salome_test_driver.py")
+SET(COMPONENT_NAME GEOM)
+SET(TIMEOUT 300)
+
+SET(GOOD_TESTS
+ 3dsketcher
+ advanced_geom_objs_ex01
+ advanced_geom_objs_ex02
+ advanced_geom_objs_ex03
+ angle
+ arranging_study_objects
+ basic_geom_objs_ex01
+ basic_geom_objs_ex02
+ basic_geom_objs_ex03
+ basic_geom_objs_ex04
+ basic_geom_objs_ex05
+ basic_geom_objs_ex06
+ basic_geom_objs_ex07
+ basic_geom_objs_ex08
+ basic_geom_objs_ex09
+ basic_geom_objs_ex10
+ basic_operations_ex01
+ basic_operations_ex02
+ basic_operations_ex03
+ basic_operations_ex04
+ basic_properties
+ blocks_operations_ex01
+ blocks_operations_ex02
+ blocks_operations_ex03
+ boolean_operations_ex01
+ boolean_operations_ex02
+ boolean_operations_ex03
+ boolean_operations_ex04
+ bounding_box
+ building_by_blocks_ex01
+ building_by_blocks_ex02
+ center_of_mass
+ check_compound_of_blocks
+ check_self_intersections
+ check_shape
+ complex_objs_ex01
+ complex_objs_ex02
+ complex_objs_ex03
+ complex_objs_ex04
+ complex_objs_ex05
+ complex_objs_ex06
+ complex_objs_ex07
+ complex_objs_ex08
+ complex_objs_ex09
+ complex_objs_ex10
+ complex_objs_ex11
+ free_boundaries
+ free_faces
+ GEOM_box
+ get_non_blocks
+ import_export
+ inertia
+ min_distance
+ normal_face
+ notebook_geom
+ polyline
+ point_coordinates
+ primitives_ex01
+ primitives_ex02
+ primitives_ex03
+ primitives_ex04
+ primitives_ex05
+ primitives_ex06
+ primitives_ex07
+ repairing_operations_ex01
+ repairing_operations_ex02
+ repairing_operations_ex03
+ repairing_operations_ex04
+ repairing_operations_ex05
+ repairing_operations_ex06
+ repairing_operations_ex07
+ repairing_operations_ex08
+ repairing_operations_ex10
+ repairing_operations_ex11
+ repairing_operations_ex12
+ sketcher
+ tolerance
+ topological_geom_objs_ex01
+ topological_geom_objs_ex02
+ topological_geom_objs_ex03
+ topological_geom_objs_ex04
+ topological_geom_objs_ex05
+ topological_geom_objs_ex06
+ transformation_operations_ex01
+ transformation_operations_ex02
+ transformation_operations_ex03
+ transformation_operations_ex04
+ transformation_operations_ex05
+ transformation_operations_ex06
+ transformation_operations_ex07
+ transformation_operations_ex08
+ transformation_operations_ex09
+ transformation_operations_ex10
+ transformation_operations_ex11
+ transformation_operations_ex12
+ transformation_operations_ex13
+ transformation_operations_ex14
+ viewing_geom_objs_ex01
+ viewing_geom_objs_ex02
+ viewing_geom_objs_ex03
+ viewing_geom_objs_ex04
+ whatis
+ working_with_groups_ex01
+ working_with_groups_ex02
+ working_with_groups_ex03
+ working_with_groups_ex04
+ working_with_groups_ex05
+ working_with_groups_ex06
+)
+# CAS_VERSION > "6.8.0"
+LIST(APPEND GOOD_TESTS fast_intersection)
+
+FOREACH(tfile ${GOOD_TESTS})
+ SET(TEST_NAME GEOM_${tfile})
+ ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile}.py)
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+ENDFOREACH()
--- /dev/null
+# Creation of a Surface From Face
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+import math
+import SALOMEDS
+
+# Create Vertices, Edges, Wire, Face and Disk
+Vertex_1 = geompy.MakeVertex(0, 0, 0)
+Vertex_2 = geompy.MakeVertex(100, 0, 0)
+Vertex_3 = geompy.MakeVertex(50, 100, 0)
+Edge_1 = geompy.MakeEdge(Vertex_1, Vertex_2)
+Edge_2 = geompy.MakeEdge(Vertex_2, Vertex_3)
+Edge_3 = geompy.MakeEdge(Vertex_3, Vertex_1)
+Wire_1 = geompy.MakeWire([Edge_1, Edge_2, Edge_3])
+Face_1 = geompy.MakeFace(Wire_1, True)
+Disk_1 = geompy.MakeDiskR(100, 1)
+
+# Create Surfaces From Faces.
+SurfaceFromFace_1 = geompy.MakeSurfaceFromFace(Face_1)
+SurfaceFromFace_2 = geompy.MakeSurfaceFromFace(Disk_1)
+
+#Add created object to study
+geompy.addToStudy( Vertex_1, "Vertex_1" )
+geompy.addToStudy( Vertex_2, "Vertex_2" )
+geompy.addToStudy( Vertex_3, "Vertex_3" )
+geompy.addToStudy( Edge_1, "Edge_1" )
+geompy.addToStudy( Edge_2, "Edge_2" )
+geompy.addToStudy( Edge_3, "Edge_3" )
+geompy.addToStudy( Wire_1, "Wire_1" )
+geompy.addToStudy( Face_1, "Face_1" )
+geompy.addToStudy( Disk_1, "Disk_1" )
+geompy.addToStudy( SurfaceFromFace_1, "SurfaceFromFace_1" )
+geompy.addToStudy( SurfaceFromFace_2, "SurfaceFromFace_2" )
trimsize = 500.
plane = geompy.MakePlane(pz, vxyz, trimsize)
-# create partition objects
-partition1 = geompy.MakePartition([box], [plane])
-partition2 = geompy.Partition([box], [plane])
-partition3 = geompy.MakeHalfPartition(box, plane)
+# create partition
+partition = geompy.MakePartition([box], [plane])
# add objects in the study
id_box = geompy.addToStudy(box,"Box")
id_plane = geompy.addToStudy(plane,"Plane")
-id_partition1 = geompy.addToStudy(partition1,"MakePartition")
-id_partition2 = geompy.addToStudy(partition2,"Partition")
-id_partition3 = geompy.addToStudy(partition3,"MakeHalfPartition")
+id_partition = geompy.addToStudy(partition,"Partition")
# display the partition objects and the plane
gg.createAndDisplayGO(id_box)
gg.setDisplayMode(id_box,1)
gg.createAndDisplayGO(id_plane)
gg.setDisplayMode(id_plane,1)
-gg.createAndDisplayGO(id_partition1)
-gg.createAndDisplayGO(id_partition2)
-gg.createAndDisplayGO(id_partition3)
+gg.createAndDisplayGO(id_partition)
--- /dev/null
+# Get shared sub-shapes
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+import SALOMEDS
+
+# create a box and partigion it by two planes
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+p = geompy.MakeVertex(100, 100, 100)
+v1 = geompy.MakeVectorDXDYDZ(1, 1, 0)
+v2 = geompy.MakeVectorDXDYDZ(1, -1, 0)
+pln1 = geompy.MakePlane(p, v1, 2000)
+pln2 = geompy.MakePlane(p, v2, 2000)
+partition = geompy.MakePartition([box], [pln1, pln2])
+
+# extract solids from result of partition
+solids = geompy.SubShapeAllSorted(partition, geompy.ShapeType['SOLID'])
+
+# get shared shapes from the partition (compound of 4 solids)
+# a) faces that are shared by all 4 solids (0 found)
+pF_T = geompy.GetSharedShapesMulti(partition, geompy.ShapeType['FACE'])
+# b) faces that are shared by any couple of solids (4 found)
+pF_F = geompy.GetSharedShapesMulti(partition, geompy.ShapeType['FACE'], False)
+# c) edges that are shared by all 4 solids (1 found)
+pE_T = geompy.GetSharedShapesMulti(partition, geompy.ShapeType['EDGE'])
+# d) edges that are shared by any couple of solids (13 found)
+pE_F = geompy.GetSharedShapesMulti(partition, geompy.ShapeType['EDGE'], False)
+
+# get shared shapes from the list of solids
+# a) faces that are shared by all 4 solids (0 found)
+sF_T = geompy.GetSharedShapesMulti(solids, geompy.ShapeType['FACE'])
+# b) faces that are shared by 1st/2nd, 1st/3rd and 1st/4th solids (2 found)
+sF_F = geompy.GetSharedShapesMulti(solids, geompy.ShapeType['FACE'], False)
+# c) edges that are shared by all 4 solids (1 found)
+sE_T = geompy.GetSharedShapesMulti(solids, geompy.ShapeType['EDGE'])
+# d) edges that are shared by 1st/2nd, 1st/3rd and 1st/4th solids (7 found)
+sE_F = geompy.GetSharedShapesMulti(solids, geompy.ShapeType['EDGE'], False)
geompy = geomBuilder.New(salome.myStudy)
# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-IsValid = geompy.CheckSelfIntersections(box)
-if IsValid == 0:
- raise RuntimeError, "Box with self-intersections created"
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+# create a cylinder
+cylinder = geompy.MakeCylinderRH(100, 300)
+# make a compound
+compound = geompy.MakeCompound([box, cylinder])
+
+# check self-intersection
+IsValid = geompy.CheckSelfIntersections(compound)
+if not IsValid:
+ print "Shape is self-intersected!"
else:
- print "\nBox is valid"
+ print "No self-intersection detected in a shape"
--- /dev/null
+# Detect Self-intersections fast
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+# create a cylinder
+cylinder = geompy.MakeCylinderRH(100, 300)
+# make a compound
+compound = geompy.MakeCompound([box, cylinder])
+
+# check self-intersection
+IsValid = geompy.CheckSelfIntersectionsFast(compound)
+if not IsValid:
+ print "Shape is self-intersected!"
+else:
+ print "No self-intersection detected in a shape"
box = geompy.MakeBoxDXDYDZ(100,30,100)
(IsValid, err) = geompy.CheckShape(box, 0, 2)
if IsValid == 0:
- geompy.PrintShapeError(box, err)
+ geompy.PrintShapeErrors(box, err)
raise RuntimeError, "Invalid box created"
else:
print "\nBox is valid"
# create an arc from three points
arc = geompy.MakeArc(p1, p2, p3)
-ShapeListCompound = []
-i = 0
-while i <= 3 :
+ContoursList = []
+for i in range(4):
S = geompy.MakeTranslation(arc, i * 50., 0., 0.)
- ShapeListCompound.append(S)
- i = i + 1
+ ContoursList.append(S)
-compound = geompy.MakeCompound(ShapeListCompound)
+compound = geompy.MakeCompound(ContoursList)
# create a filling
filling = geompy.MakeFilling(compound, mindeg, maxdeg, tol3d, tol2d, nbiter)
circles.append(geompy.MakeCircle(vertices[2], edges[2], 30))
circles.append(geompy.MakeCircle(vertices[3], edges[2], 20))
-# create pipe
-Pipe = geompy.MakePipeWithDifferentSections(circles, vertices, Wire_1, 0, 0)
+# create pipes
+Pipe1 = geompy.MakePipeWithDifferentSections(circles, vertices, Wire_1, 0, 0)
+Pipe2 = geompy.MakePipeWithDifferentSectionsBySteps(circles, vertices, Wire_1)
# add objects in the study
geompy.addToStudy(circles[0], "circles1")
geompy.addToStudy(circles[1], "circles2")
geompy.addToStudy(circles[2], "circles3")
geompy.addToStudy(circles[3], "circles4")
-id_wire = geompy.addToStudy(Wire_1, "Path")
-id_pipe = geompy.addToStudy(Pipe, "Pipe")
+id_wire = geompy.addToStudy(Wire_1, "Path")
+id_pipe1 = geompy.addToStudy(Pipe1, "Pipe1")
+id_pipe2 = geompy.addToStudy(Pipe2, "Pipe2")
# display the wire(path) and the pipe
gg.createAndDisplayGO(id_wire)
-gg.createAndDisplayGO(id_pipe)
-gg.setDisplayMode(id_pipe,1)
+gg.createAndDisplayGO(id_pipe1)
+gg.createAndDisplayGO(id_pipe2)
+gg.setDisplayMode(id_pipe1,1)
+gg.setDisplayMode(id_pipe2,1)
--- /dev/null
+# Apply thickness for shell
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+gg = salome.ImportComponentGUI("GEOM")
+
+# create box
+box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+
+# get the list of faces
+faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
+
+# get the list of face IDs
+faceIDs = geompy.SubShapeAllSortedCentresIDs(box, geompy.ShapeType["FACE"])
+
+# make a shell from 3 faces
+shell = geompy.MakeShell([faces[0], faces[1], faces[2]])
+
+# apply thickness
+solid = geompy.MakeThickSolid(shell, 30.)
+
+# create box
+hsolid = geompy.MakeBoxDXDYDZ(100, 100, 100)
+
+# make hollowed solid
+geompy.Thicken(hsolid, 30., [faceIDs[0], faceIDs[1]])
+
+# add objects in the study
+id_shell = geompy.addToStudy(shell, "Shell")
+id_solid = geompy.addToStudy(solid, "Solid")
+id_hsolid = geompy.addToStudy(hsolid, "Hollowed Solid")
+
+# display the shell and the result thicknen solid and hollowed solid
+gg.createAndDisplayGO(id_shell)
+gg.createAndDisplayGO(id_solid)
+gg.createAndDisplayGO(id_hsolid)
--- /dev/null
+# Fast intersection
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+# create a cylinder
+cylinder = geompy.MakeCylinderRH(100, 300)
+
+isOk, res1, res2 = geompy.FastIntersect(box, cylinder)
+if isOk == 0:
+ raise RuntimeError, "No intersection!"
+else:
+ print "\nTwo lists of indexes of sub-shapes localize the intersection:"
+ print res1, res2
+
+# create two boxes with gap
+Ver1 = geompy.MakeVertex(0, 0, 0)
+Ver2 = geompy.MakeVertex(100, 100, 100)
+Ver3 = geompy.MakeVertex(100.1, 0, 0)
+Ver4 = geompy.MakeVertex(200, 200, 200)
+box1 = geompy.MakeBoxTwoPnt(Ver1, Ver2)
+box2 = geompy.MakeBoxTwoPnt(Ver3, Ver4)
+
+isOk1, aRes1, aRes2 = geompy.FastIntersect(box1, box2, 1.)
+if isOk1 == 0:
+ raise RuntimeError, "No gaps!"
+else:
+ print "\nTwo lists of indexes of sub-shapes localize the gap:"
+ print aRes1, aRes2
# Sewing
-import salome
+import salome, math
salome.salome_init()
-import GEOM
from salome.geom import geomBuilder
+
geompy = geomBuilder.New(salome.myStudy)
-import math
-gg = salome.ImportComponentGUI("GEOM")
+gg = salome.ImportComponentGUI("GEOM")
# create base points
px = geompy.MakeVertex(100., 0., 0.)
py = geompy.MakeVertex(0., 100., 0.)
pz = geompy.MakeVertex(0., 0., 100.)
-# create base geometry 2D & 3D
+# create base geometry 2D
vector = geompy.MakeVector(px, py)
-arc = geompy.MakeArc(py, pz, px)
+arc = geompy.MakeArc(py, pz, px)
# create base objects
angle = 45. * math.pi / 180
-WantPlanarFace = 1 #True
-wire = geompy.MakeWire([vector, arc])
-face = geompy.MakeFace(wire, WantPlanarFace)
+WantPlanarFace = True
+wire = geompy.MakeWire([vector, arc])
+face = geompy.MakeFace(wire, WantPlanarFace)
face_rot = geompy.MakeRotation(face, vector, angle)
# make sewing
sewing = geompy.MakeSewing([face, face_rot], precision)
# add objects in the study
-id_face = geompy.addToStudy(face, "Face")
+id_face = geompy.addToStudy(face, "Face")
id_face_rot = geompy.addToStudy(face_rot, "Face rotation")
-id_sewing = geompy.addToStudy(sewing, "Sewing")
+id_sewing = geompy.addToStudy(sewing, "Sewing")
# display the results
gg.createAndDisplayGO(id_face)
gg.setDisplayMode(id_face_rot,1)
gg.createAndDisplayGO(id_sewing)
gg.setDisplayMode(id_sewing,1)
+
+
+# Example 2: make a shell of a multiply translated face
+quad = geompy.MakeFaceHW( 10, 20, 1 )
+quadCompound = geompy.MakeMultiTranslation1D( quad, geompy.MakeVectorDXDYDZ(1,0,0), 10, 3)
+shell = geompy.Sew( quadCompound, 1e-6 )
+
+id_shell = geompy.addToStudy( shell, "3 quads shell")
+gg.createAndDisplayGO(id_shell)
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
+# Variant 1: using DivideEdge()
+
# create vertices
p1 = geompy.MakeVertex(0,0,50)
p2 = geompy.MakeVertex(60,0,50)
for point in edge_points:
geompy.addToStudyInFather(divide, point, "Edge's point after divide")
+
+# Variant 2: using DivideEdgeByPoint()
+
+box = geompy.MakeBox(0,0,0, 10,10,10, theName="box")
+p1 = geompy.MakeVertex( 3, -2, 1, theName="point 1 to project" )
+p2 = geompy.MakeVertex( 7, -2, 1, theName="point 2 to project" )
+edge = geompy.GetEdgeNearPoint( box, p1, theName="edge to split")
+
+div = geompy.DivideEdgeByPoint( box, edge, [p1, p2], theName="box (edge divided)")
+
+
salome.sg.updateObjBrowser(1)
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
class SalomeSession(object):
def __init__(self, script):
import runSalome
- sys.argv = ["runSalome.py"]
+ run_script = "runSalome.py"
+ if sys.platform == 'win32':
+ module_dir = os.getenv("KERNEL_ROOT_DIR")
+ if module_dir: run_script = os.path.join(module_dir, "bin", "salome", run_script)
+ pass
+ sys.argv = [run_script]
sys.argv += ["--terminal"]
sys.argv += ["--modules=GEOM"]
sys.argv += ["%s" % script]
+ if sys.platform == 'win32':
+ main_module_path = sys.modules['__main__'].__file__
+ sys.modules['__main__'].__file__ = ''
clt, d = runSalome.main()
+ if sys.platform == 'win32':
+ sys.modules['__main__'].__file__ = main_module_path
return
def __del__(self):
sketcher3 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
isPlanarFace = 1
+sphere = geompy.MakeSphereR(100)
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+cut = geompy.MakeCutList(sphere, [box], True)
+
# create a face from the wire
face1 = geompy.MakeFace(wire, isPlanarFace)
# create faces from two wires
face2 = geompy.MakeFaceWires([wire, sketcher1],isPlanarFace)
face3 = geompy.MakeFaces([sketcher2, sketcher3],isPlanarFace)
+face4 = geompy.MakeFaceFromSurface(face1, sketcher1)
+
+# create face from edges with constraints
+face5 = geompy.MakeFaceWithConstraints([geompy.GetSubShape(cut, [5]), geompy.GetSubShape(cut, [3]),
+ geompy.GetSubShape(cut, [11]), geompy.GetSubShape(cut, [3]),
+ geompy.GetSubShape(cut, [13]), geompy.GetSubShape(cut, [3])])
# add objects in the study
id_face1 = geompy.addToStudy(face1,"Face1")
id_face2 = geompy.addToStudy(face2,"Face2")
id_face3 = geompy.addToStudy(face3,"Face3")
+id_face4 = geompy.addToStudy(face4,"Face4")
+id_face5 = geompy.addToStudy(face5,"Face5")
# display the faces
gg.createAndDisplayGO(id_face1)
gg.createAndDisplayGO(id_face3)
gg.setDisplayMode(id_face3,1)
gg.setTransparency(id_face3,0.2)
+gg.createAndDisplayGO(id_face4)
+gg.setDisplayMode(id_face4,1)
+gg.setTransparency(id_face4,0.2)
+gg.createAndDisplayGO(id_face5)
+gg.setDisplayMode(id_face5,1)
+gg.setTransparency(id_face5,0.2)
--- /dev/null
+# Creation of a Solid(s) from connected faces
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+
+# make a copy of a box translated by X coordinate
+box_translation = geompy.MakeTranslation(box, 200, 0, 0)
+
+# extract shells from boxes
+box_shell = geompy.SubShapeAllSorted(box, geompy.ShapeType["SHELL"])[0]
+box_translation_shell = geompy.SubShapeAllSorted(box_translation, geompy.ShapeType["SHELL"])[0]
+
+# extract faces from boxes
+box_faces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])
+box_translation_faces = geompy.SubShapeAllSorted(box_translation, geompy.ShapeType["FACE"])
+
+# create solids from shells
+msf_shells_noint = geompy.MakeSolidFromConnectedFaces([box_shell, box_translation_shell],0)
+msf_shells_int = geompy.MakeSolidFromConnectedFaces([box_shell, box_translation_shell], 1)
+
+# create solids from faces
+msf_faces_noint = geompy.MakeSolidFromConnectedFaces(box_faces+box_translation_faces, 0)
+msf_faces_int = geompy.MakeSolidFromConnectedFaces(box_faces+box_translation_faces, 1)
+
+# add objects in the study
+id_solid_shells_noint = geompy.addToStudy(msf_shells_noint,"Solid_from_shells_no_intersect")
+id_solid_shells_int = geompy.addToStudy(msf_shells_int,"Solid_from_shells_intersect")
+id_solid_faces_noint = geompy.addToStudy(msf_faces_noint,"Solid_from_faces_no_intersect")
+id_solid_faces_int = geompy.addToStudy(msf_faces_int,"Solid_from_faces_intersect")
+
+# display the results
+gg.createAndDisplayGO(id_solid_shells_noint)
+gg.setDisplayMode(id_solid_shells_noint,1)
+gg.createAndDisplayGO(id_solid_shells_int)
+gg.setDisplayMode(id_solid_shells_int,1)
+gg.createAndDisplayGO(id_solid_faces_noint)
+gg.setDisplayMode(id_solid_faces_noint,1)
+gg.createAndDisplayGO(id_solid_faces_int)
+gg.setDisplayMode(id_solid_faces_int,1)
import salome
salome.salome_init()
-import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
# add objects in the study
geompy.addToStudy(cylinder, "cylinder")
geompy.addToStudyInFather(cylinder, face_cyl, "face_cyl")
-geompy.addToStudy(p1, "p1")
-geompy.addToStudy(p2, "p2")
-geompy.addToStudy(p3, "p3")
-geompy.addToStudy(p4, "p4")
-geompy.addToStudy(p5, "p5")
geompy.addToStudy(curve, "curve")
geompy.addToStudy(projection, "projection")
-#projection of point on wire.
+#projection of point on wire
e1 = geompy.MakeLineTwoPnt(p1, p2)
e2 = geompy.MakeLineTwoPnt(p2, p3)
w1 = geompy.MakeWire([e1, e2], 1.e-7)
v1 = geompy.MakeVertex(300, 40, 100)
-prj = geompy.MakeProjectionOnWire(v1, w1)
-geompy.addToStudy(e1, "e1")
-geompy.addToStudy(e2, "e2")
+prj = geompy.MakeProjection(v1, w1)
geompy.addToStudy(w1, "w1")
geompy.addToStudy(v1, "v1")
-geompy.addToStudy(prj[1], "projOnWire")
+geompy.addToStudy(prj, "projOnWire")
+
+#projection of a wire on cylinder
+pp1 = geompy.MakeVertex(100, 200, 0)
+pp2 = geompy.MakeVertex(100, 200, 80)
+pp3 = geompy.MakeVertex(100, 220, 90)
+pp4 = geompy.MakeVertex(100, 130, 80)
+pp5 = geompy.MakeVertex(100, 90, 80)
+cc1 = geompy.MakeInterpol([pp1, pp2, pp3, pp4, pp5], True, False)
+ww1 = geompy.MakeWire([cc1], 1.e-7)
+vx = geompy.MakeVectorDXDYDZ(100, 0, 0)
+pln1 = geompy.MakePlane(pp1, vx, 200)
+face1 = geompy.MakeFaceFromSurface(pln1, ww1)
+prj_cyl = geompy.MakeProjectionOnCylinder(face1, 100)
+
+geompy.addToStudy(face1, "pln_face")
+geompy.addToStudy(prj_cyl, "projOnCylinder")
--- /dev/null
+# Extend Edge and Face
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p1 = geompy.MakeVertex( 0., 0., 0.)
+p2 = geompy.MakeVertex(100., 100., 0.)
+p3 = geompy.MakeVertex( 0., 100., 0.)
+
+# create edges
+edge1 = geompy.MakeEdge(p1, p2)
+edge2 = geompy.MakeCircleR(100)
+
+# create faces
+face1 = geompy.MakePlaneThreePnt(p1, p2, p3, 200)
+sphere1 = geompy.MakeSpherePntR(p1, 100)
+faces2 = geompy.SubShapeAllSorted(sphere1, GEOM.FACE)
+face2 = faces2[0]
+
+# perform edge extension
+resEdge1 = geompy.ExtendEdge(edge1, 0.2, 0.8)
+resEdge2 = geompy.ExtendEdge(edge1, -0.3, 1.3)
+resEdge3 = geompy.ExtendEdge(edge2, 0.5, 1)
+resEdge4 = geompy.ExtendEdge(edge2, 0.2, 0.5)
+
+# perform face extension
+resFace1 = geompy.ExtendFace(face1, 0.2, 0.8, -0.3, 1.3)
+resFace2 = geompy.ExtendFace(face1, 0, 0.5, 1, 2)
+resFace3 = geompy.ExtendFace(face2, 0.2, 0.8, 0.3, 0.7)
+resFace4 = geompy.ExtendFace(face2, 0.5, 1, 0.5, 1)
+
+# add objects in the study
+id_edge1 = geompy.addToStudy(edge1, "Edge 1")
+id_edge2 = geompy.addToStudy(edge2, "Edge 2")
+id_face1 = geompy.addToStudy(face1, "Face 1")
+id_face2 = geompy.addToStudy(face2, "Face 2")
+id_resEdge1 = geompy.addToStudy(resEdge1, "Extended Edge 1")
+id_resEdge2 = geompy.addToStudy(resEdge2, "Extended Edge 1")
+id_resEdge3 = geompy.addToStudy(resEdge3, "Extended Edge 2")
+id_resEdge4 = geompy.addToStudy(resEdge4, "Extended Edge 3")
+id_resFace1 = geompy.addToStudy(resFace1, "Extended Face 1")
+id_resFace2 = geompy.addToStudy(resFace2, "Extended Face 2")
+id_resFace3 = geompy.addToStudy(resFace3, "Extended Face 3")
+id_resFace4 = geompy.addToStudy(resFace4, "Extended Face 4")
+
+# display the prism and the results of chamfer operation
+gg.createAndDisplayGO(id_edge1)
+gg.setDisplayMode(id_edge1, 1)
+gg.createAndDisplayGO(id_edge2)
+gg.setDisplayMode(id_edge2, 1)
+gg.createAndDisplayGO(id_face1)
+gg.setDisplayMode(id_face1, 1)
+gg.createAndDisplayGO(id_face2)
+gg.setDisplayMode(id_face2, 1)
+gg.createAndDisplayGO(id_resEdge1)
+gg.setDisplayMode(id_resEdge1, 1)
+gg.createAndDisplayGO(id_resEdge2)
+gg.setDisplayMode(id_resEdge2, 1)
+gg.createAndDisplayGO(id_resEdge3)
+gg.setDisplayMode(id_resEdge3, 1)
+gg.createAndDisplayGO(id_resEdge4)
+gg.setDisplayMode(id_resEdge4, 1)
+gg.createAndDisplayGO(id_resFace1)
+gg.setDisplayMode(id_resFace1, 1)
+gg.createAndDisplayGO(id_resFace2)
+gg.setDisplayMode(id_resFace2, 1)
+gg.createAndDisplayGO(id_resFace3)
+gg.setDisplayMode(id_resFace3, 1)
+gg.createAndDisplayGO(id_resFace4)
+gg.setDisplayMode(id_resFace4, 1)
gg.setDisplayMode(fuse_id,1)
gg.setVectorsMode(fuse_id, 1)
gg.setVerticesMode(fuse_id, 1)
+gg.setNameMode(fuse_id, 1)
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
if len( args ) < 1: sys.exit("Plugin name is not specified")
f = open(options.output, "w")
-
+
+ if len(args) > 1:
+ plugins_names = " ".join(args) + " plugins"
+ elif len(args) == 1:
+ plugins_names = args[0] + " plugin"
+ else:
+ plugins_names = ""
output = []
if options.dummygeomhelp:
output.append( "## @package geomBuilder" )
- output.append( "# Documentation of the methods dynamically added by the " + plugin_name + " Geometry plug-in to the geomBuilder class." )
+ output.append( "# Documentation of the methods dynamically added by the " + plugins_names + " to the @b %geomBuilder class." )
# Add dummy Geometry help
# This is supposed to be done when generating documentation for Geometry module plug-ins
output.append( "# @note The documentation below does not provide complete description of class @b %geomBuilder" )
output.append( "# from @b geomBuilder package. This documentation provides only information about" )
- output.append( "# the methods dynamically added to the %geomBuilder class by the " + plugin_name + " plugin" )
+ output.append( "# the methods dynamically added to the %geomBuilder class by the " + plugins_names + "." )
output.append( "# For more details on the %geomBuilder class, please refer to the SALOME %Geometry module" )
output.append( "# documentation." )
pass
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
\n To <b>Add Point on Edge</b> in the <b>Main Menu</b> select
<b>Repair - > Add Point on Edge</b>.
-\n This operation splits an edge in two new edges in accordance with the
-specified mode (by length or by parameter) and a value specifying the
-position of the point on edge (for example val =0.5; mode =
-by length). This operation is available in <b>OCC Viewer</b> only.
-
-\n The \b Result will be a \b GEOM_Object.
-
-\n <b>TUI Command:</b> <em>geompy.DivideEdge(Shape, EdgeID, Value,
-IsByParameter)</em>
-- \em Shape is a shape which contains an edge to be divided
-- \em EdgeID is the ID of the edge to be divided, if it is = -1,
-then \em Shape should be an edge itself
-- \em Value is a value of parameter on edge or length parameter,
-depending on \em IsByParameter.
-- \em IsByParameter is a boolean flag, specifying operation mode:
- - \c True: \em Value is treated as a curve parameter [0..1]
- - \c False: \em Value is treated as a length parameter [0..1]
-
-<b>Arguments:</b> Name + 1 Edge + 1 Value setting the position of
-the point according to one of the selected modes.
-
-The difference between "by parameter" and "by length" modes becomes
-apparent on the edges with irregular parametrization (for example,
-b-splines which usually have irregular density by the length).
-For example, value 0.5 "by length" on such edge will produce the point
-in the middle of this edge (equidistant from both its ends); the same
-0.5 value "by parameter" will result in the point situated closer to
-one of the ends (depending on the actual parametrization).
-
-\image html repair8.png
+This operation splits an edge in two or more new edges.
+This operation is available in <b>OCC Viewer</b> only.
+
+The \b Result will be a \b GEOM_Object.
+
+\n The location of a new vertex on the selected edge can be defined in two ways:
+<ol>
+ <li> By specifying the position (ranging from 0.0 to 1.0) by length or by parameter.
+ <p>
+ <b>TUI Command:</b> <em>geompy.DivideEdge(Shape, EdgeID, Value,
+ IsByParameter)</em>
+ <ul>
+ <li> \em Shape is a shape, which contains an edge to be divided;</li>
+ <li>\em EdgeID is the ID of the edge to be divided, if it is = -1,
+ then \em Shape should be an edge itself;</li>
+ <li> \em Value is a value of parameter on edge or length parameter,
+ depending on \em IsByParameter;</li>
+ <li> \em IsByParameter is a boolean flag, specifying the operation mode:
+ - \c True: \em Value is treated as a curve parameter; [0..1]
+ - \c False: \em Value is treated as a length parameter. [0..1] </li>
+ </ul>
+ \b Arguments: Name + 1 Edge + 1 Value setting the position of
+ the point according to the selected mode.
+
+ The difference between "by parameter" and "by length" modes becomes
+ apparent on the edges with irregular parametrization (for example,
+ b-splines which usually have irregular density by the length).
+ For example, value 0.5 "by length" on such edge will produce the point
+ in the middle of this edge (equidistant from both its ends); the same
+ 0.5 value "by parameter" will result in the point situated closer to
+ one of the ends (depending on the actual parametrization).
+
+ \image html repair8.png
+ \n\n
+ </li>
+ <li> By selecting several points that will be projected to the selected
+ edge to find the location of new vertices.
+ <p>
+ <b>TUI Command:</b> <em>geompy.DivideEdgeByPoint(Shape, Edge, Points):</em>
+ <ul>
+ <li> \em Shape is a shape, which contains an edge to be divided;</li>
+ <li>\em Edge is an edge to be divided (or its ID, if it is = -1,
+ then \em Shape should be an edge itself);</li>
+ <li> \em Points is a list of points to be projected to the \a Edge.</li>
+ </ul>
+ \b Arguments: Name + 1 Edge + 1 or more Points.
+
+ \image html divedgebypoint.png
+
+ </li>
+</ol>
\n <b>Example:</b>
\image html image167.png "The initial edge"
-\image html image168.png "The edge split in two segments"
+\image html image168.png "The edge split in two segments"
-Our <b>TUI Scripts</b> provide you with useful examples of the use of
+Our <b>TUI Scripts</b> provide you with useful examples of the use of
\ref tui_add_point_on_edge "Repairing Operations".
*/
If both objects are <b>vectors</b>, the angle is computed in accordance with their orientations, otherwise the minimum angle is computed.
-\n <b>TUI Command:</b> <em>geompy.GetAngle(shape1, shape2),</em> where
+\note This dialog supports navigation through the selectable objects (in OCC 3D viewer only):
+- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when input focus is
+in the viewer to navigate between selectable objects.
+- Press left mouse button to select an appropriate object to the dialog box.
+.
+For more details, please refer to the \em "Functionality common for OCC and VTK viewers" chapter
+of the GUI module's documentation.
+
+<b>TUI Command:</b> <em>geompy.GetAngle(shape1, shape2),</em> where
Shape1 and Shape2 are shapes between which the angle is computed.
Another TUI command is <em>geompy.GetAngleRadians(shape1,shape2),</em>
which returns the value of angle in radians.
to change the order (ascending / descending) by clicking the corresponding title bar of the objects list.
</li>
-<li>\ref dependency_tree_page "Show dependency tree" - shows dependency tree of selected objects
-in new 2D View Window.</li>
+<li>\ref dependency_tree_page "Show dependency tree" - shows the dependency tree with parents and children of the selected object
+in a new 2D View Window.</li>
-<li>\ref reduce_study_page "Reduce study" - allows to reduce study
-by automatic removing objects according to user's options.</li>
+<li>\ref reduce_study_page "Reduce study" - allows reducing the study by removing objects from it.</li>
</ul>
<h2> Folders </h2>
\image html neo-basicprop.png
-\n<b>TUI Command:</b> <em>geompy.BasicProperties(Shape),</em> where
+\note This dialog supports navigation through the selectable objects (in OCC 3D viewer only):
+- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when input focus is
+in the viewer to navigate between selectable objects.
+- Press left mouse button to select an appropriate object to the dialog box.
+.
+For more details, please refer to the \em "Functionality common for OCC and VTK viewers" chapter
+of the GUI module's documentation.
+
+<b>TUI Command:</b> <em>geompy.BasicProperties(Shape),</em> where
\em Shape is a shape whose properties are inquired.
See also a \ref tui_basic_properties_page "TUI example".
Press \b Apply or <b>Apply and Close</b> button to publish the bounding \b Box in the study.
-\n <b>TUI Commands:</b> <em>[Xmin,Xmax, Ymin,Ymax, Zmin,Zmax] = geompy.BoundingBox(Shape, precise)</em>,
+\note This dialog supports navigation through the selectable objects (in OCC 3D viewer only):
+- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when input focus is
+in the viewer to navigate between selectable objects.
+- Press left mouse button to select an appropriate object to the dialog box.
+.
+For more details, please refer to the \em "Functionality common for OCC and VTK viewers" chapter
+of the GUI module's documentation.
+
+<b>TUI Commands:</b> <em>[Xmin,Xmax, Ymin,Ymax, Zmin,Zmax] = geompy.BoundingBox(Shape, precise)</em>,
<em>BBox = geompy.MakeBoundingBox(Shape, precise)</em>, where \em Shape
is the shape for which the bounding box is computed. \em precise TRUE
for precise computation; FALSE for fast one. Default value is False.
Press \b Apply or <b>Apply and Close</b> button to publish the \b Point in the study.
-\n <b>TUI Command:</b> <em> geompy.MakeCDG(Shape),</em> where \em Shape is
+\note This dialog supports navigation through the selectable objects (in OCC 3D viewer only):
+- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when input focus is
+in the viewer to navigate between selectable objects.
+- Press left mouse button to select an appropriate object to the dialog box.
+.
+For more details, please refer to the \em "Functionality common for OCC and VTK viewers" chapter
+of the GUI module's documentation.
+
+<b>TUI Command:</b> <em> geompy.MakeCDG(Shape),</em> where \em Shape is
the shape for which a center of gravity is computed.
See also a \ref tui_center_of_mass_page "TUI example".
\page check_compound_of_blocks_page Check Compound of Blocks
-This operation checks whether a shape is a compound of glued blocks.
+This operation checks whether a shape is a compound of glued blocks
+and improves the shape to include only valid blocks.
\image html measures10.png
To be considered as a compound of blocks, the given shape must satisfy the
following conditions:
-- Each element of the compound should be a Block (6 faces and 12 edges);
+- Each element of the compound should be a Block, i.e. have 6 quadrangle faces;
+- Each quadrangle face should have one wire with four edges. If there are
+more than four edges in a single wire and C1 continuity mode is switched on,
+a face is quadrangular if it has four bounds with C1 continuity.
- Blocks can be connected only via an entire quadrangle face or an entire edge;
- The compound should be connected;
- Each couple of connecting quadrangle faces should be glued.
In this dialog:
-- \b Object - the checked object. \b Selection button allows picking it in the viewer or in the object browser.
-- \b Errors list informs of possible errors, for example:.
+- \b Object - the checked object. \b Selection button allows picking it in the viewer or in the object browser.
+- <b>Use C1 criterion</b> - option switches on/off the C1 continuity mode.
+- <b>Angular Tolerance</b> - angular tolerance to check C1 continuity between neighbor edges in a wire.
+- \b Errors list informs of possible errors, for example:
- Not a block;
- Not glued;
- Not connected;
- Extra or degenerated edge.
-- <b>Incriminated Sub-shapes</b> field outputs the list of sub-shapes that cause problem. It is possible to select them in the list and publish in the study for further analysis by clicking \b Apply or <b>Apply and Close</b> button.
+- <b>Incriminated Sub-shapes</b> field outputs the list of sub-shapes that cause problem.
+- \b Apply and <b>Apply and Close</b> buttons launch the improvement process
+and publish the result shape, which includes valid blocks only. The
+algorithm tries to:
+ - remove seam and degenerated edges from surfaces of revolution;
+ - re-approximate surfaces to exclude singularities on boundaries;
+ - unite edges and faces;
+ - glue faces.
\n <b>TUI Command:</b>
-<em>geompy.CheckCompoundOfBlocks(Compound).</em> Checks if the shape
+<em>geompy.CheckCompoundOfBlocks(Compound, theIsUseC1 = False, theAngTolerance = 1.e-12).</em> Checks if the shape
is a valid compound of blocks. If it is true, then the validity flag
is returned, and encountered errors are printed in the python console.
See also a \ref tui_check_compound_of_blocks_page "TUI example".
-*/
\ No newline at end of file
+*/
\page check_self_intersections_page Detect Self-intersections
+\n To <b>Detect Self-intersections,</b> select in the <b>Main Menu</b>
+<b>Inspection - > Detect Self-intersections</b>.
+
+There are two ways to check self-intersections.
+
+\anchor check_self_intersections_topological
+<br><h3>Check topological intersections</h3>
+
This operation checks the topology of the selected shape to detect self-intersections.
\image html measures11.png
In this dialog:
-- \b Object - the checked object. \b Selection button allows picking it in the viewer or in the object browser.
-- \b Errors list contains the list of intersections. Select the intersection to show <b>Incriminated Sub-shapes</b> in the field to the right.
-
+- \b Object - the checked object. \b Selection button allows picking it in the viewer or in the object browser.
+- <b>Level of check</b> - combo box allows setting the level of self-interference checking. It defines, which interferences will be checked. The default value is "All interferences".
+- <b>Compute self-intersections</b> button performs the computation.
+- \b Summary section contains the general report about self-intersections of the object and/or errors that occurred during the computation.
+- \b Self-intersections list contains the list of detected self-intersections. Select the intersection to show <b>Sub-shapes</b> in the field to the right.
+- \b Apply and <b>Apply and Close</b> buttons store the interferences selected in the <b>Self-intersections</b> list box in the study for further analysis.
+If no interferences are selected, all of them are published in the study. Each interference is published as a child compound of the source shape and contains a couple of intersecting sub-shapes.
-\note This tool is useful for detection of shapes, not suitable for
+\note This tool is useful for detection of shapes that are not suitable as
arguments of Boolean operations and Partition algorithm.
For more information about Partition and Boolean Operations Algorithms
and their limitations refer to <a href="SALOME_BOA_PA.pdf">this document</a>.
\n <b>Result:</b> Boolean.
-\n <b>TUI Command:</b> <em>geompy.CheckSelfIntersections(theShape),</em>
-where \em theShape is the shape checked for validity.
+\n <b>TUI Command:</b> <em>geompy.CheckSelfIntersections(theShape, theCheckLevel = GEOM.SI_ALL),</em> \n
+where: \n
+\em theShape is the shape checked for validity. \n
+\em theCheckLevel is the level of check. Default value is GEOM.SI_ALL to check all interferences.
See also a \ref tui_check_self_intersections_page "TUI example".
+\anchor check_self_intersections_fast
+<br><h3>Fast intersection</h3>
+
+This operation allows quickly detecting self-interferences of the given shape using the algorithm based on mesh intersections.
+
+The algorithm works on the face level, i.e. it computes only face-to-face intersections. No additional intersection types are computed.
+
+This can be useful to detect all intersections between subshapes of type "surface" in an assembly.
+The result quality will depend on the tesselation quality. However, small deflection values can significantly decrease the performance of the algorithm.
+Nevertheless, the performance of Fast Intersect algorithm is much higher than that of the topological intersection.
+
+\image html measures13.png
+
+In this dialog:
+
+- \b Object - the checked object. \b Selection button allows picking it in the viewer or in the object browser.
+- <b>Deflection coefficient</b> - a linear deflection coefficient that defines the tesselation quality. If theDeflection <= 0, default deflection 0.001 is used.
+- <b>Detect gaps with tolerance</b> specifies the distance between shapes used for detecting gaps:
+ - if theTolerance <= 0, the algorithm detects intersections;
+ - if theTolerance > 0, the algorithm detects gapss.
+- <b>Compute self-intersections</b> button performs the computation.
+- \b Summary section contains the general report about self-intersections of the object and/or errors that occurred during the computation.
+- \b Self-intersections list contains the list of detected self-intersections. Select the intersection to show <b>Sub-shapes</b> in the field to the right.
+- \b Apply and <b>Apply and Close</b> buttons store the interferences selected in the <b>Self-intersections</b> list box in the study for further analysis.
+If no interferences are selected, all of them are published in the study. Each interference is published as a child compound of the source shape and contains a couple of intersecting sub-shapes.
+
+\n <b>Result:</b> Boolean.
+\n <b>TUI Command:</b> <em>geompy.CheckSelfIntersectionsFast(theShape, theDeflection, theTolerance),</em> \n
+where: \n
+\em theShape is the shape checked for validity. \n
+\em theDeflection that specifies the quality of tesselation.
+\em theTolerance Specifies the distance between shapes used for detecting gaps.
+
+See also a \ref tui_check_self_intersections_fast_page "TUI example".
-*/
\ No newline at end of file
+*/
- \b Relative coordinates \b DX, \b DY and \b DZ with respect to the previous applied point,
By <b>Angular coordinates</b>, which include:
-- the \b Length of the segment and an \b Angle in the chosen plane (OXY for example) in \b Relative mode. The angle is then relative to a local coordinate system with the last point of the sketch as origin. </li>
+- the \b Length of the segment and an \b Angle in the chosen plane (OXY for example) in \b Relative mode. The angle is then relative to a local coordinate system with the last point of the sketch as origin.
\image html 3dsketch_angle_rel.png
<li>\subpage create_sketcher_page</li>
<li>\subpage create_3dsketcher_page</li>
<li>\subpage create_polyline_page</li>
+<li>\subpage create_surface_from_face_page</li>
<li>\subpage create_vector_page</li>
<li>\subpage create_plane_page</li>
<li>\subpage create_lcs_page</li>
\page create_complex_obj_page Creating Complex Objects
<b>New entity -> Generation</b> sub-menu allows creating new geometric
-objects by modification and multiplication of the existing objects:
+objects by modification and multiplication of the existing objects:
<ul>
<li>\subpage create_extrusion_page "Extrude" a 2D object by vector,
-creating a 3D object. </li>
+creating a 3D object. </li>
<li>\subpage create_revolution_page "Revolve" an object around an
axis, creating a body of revolution.</li>
<li>\subpage create_filling_page "Create a surface" from a set of edges.</li>
-<li>\subpage create_extrusion_alongpath_page "Extrude an object along a path",
+<li>\subpage create_extrusion_alongpath_page "Extrude an object along a path",
creating a more complex trajectory object.</li>
<li>\subpage create_pipe_path_page "Restore Path" of a pipe-like shape.</li>
+<li>\subpage create_thickness_page "Add thickness" to objects.</li>
+<li>\subpage create_groups_page "Generate Groups" for certain generation operations.</li>
</ul>
<b> New entity -> Advanced </b> sub-menu allows creating new geometric
-objects using advanced algorithms:
+objects using advanced algorithms:
<ul>
<li>\subpage create_smoothingsurface_page "Smoothing surface" from a
\n To create a \b Compound in the <b>Main Menu</b> select <b>New
Entity - > Build - > Compound</b>.
-\n You can create a compound from a list of shells.
+\n You can create a compound from a list of shapes.
\n The \b Result will be a \b GEOM_Object (COMPOUND).
\n <b>TUI Command:</b> <em>geompy.MakeCompound(ListOfShape)</em>
\n Firstly, you can define a \b Cylinder by the <b>Base Point</b> (the central
point of the cylinder base), the \b Vector (the axis of the cylinder),
-and its dimensions: the \b Radius and the \b Height. Also, you can optionally specify
-the \b Angle in order to create a portion of cylinder.
+and its dimensions: the \b Radius and the \b Height. You can optionally specify
+the \b Angle to create a portion of cylinder.
\n <b>TUI Command:</b> <em>geompy.MakeCylinder(Point, Axis, Radius, Height)</em>
\n <b>Arguments:</b> Name + 1 vertex + 1 vector + 2 values
\n Secondly, you can define a \b Cylinder by the given \b Radius and
\b Height at the origin of coordinate system. The axis of the cylinder
will be collinear to the OZ axis of the coordinate system.
-Similarly to first constructor, you can optionally specify the \b Angle
-in order to create a portion of cylinder.
+Similarly to the first constructor, you can optionally specify the \b Angle
+to create a portion of cylinder.
\n <b>TUI Command:</b> <em>geompy.MakeCylinderRH(Radius, Height)</em>
\n <b>Arguments:</b> Name + 2 values (Dimensions at origin: radius and
\page create_explode_page Explode
-\n To \b Explode an object into sub-shapes, in the <b>Main Menu</b>
-select <b>New Entity > Explode</b>.
+To \b Explode an object into sub-shapes, in the <b>Main Menu</b>
+select <b>New Entity > Explode</b>. This operation opens the
+<b>Sub Shapes Selection</b> dialog box.
-\n To create a list of sub-shapes (vertices, edges, wires etc.) of the
+\image html neo-obj1.png
+
+To create a list of sub-shapes (vertices, edges, wires etc.) of the
given shape using the \b Explode operation, you need to define the <b>Main
Object</b>, which will be exploded and the <b>Type of Sub-shapes</b> you wish to
obtain from it.
-\n The \b Result of the operation will be a List of \b GEOM_Objects
+
+The \b Result of the operation will be a List of \b GEOM_Objects
(vertexes, edges, wires, faces, shells or solids).
-\n Using <b>TUI Commands</b> you can perform this operation in a
+The choices available in the <b>Sub Shapes Type</b> combo box depend on the type
+of selected <b>Main Object</b>:
+- \b Compound: to extract compounds;
+- \b Compsolid: to extract compsolids;
+- \b Solid: to extract solids;
+- \b Shell: to extract shells;
+- \b Face: to extract faces;
+- \b Wire: to extract wires;
+- \b Edge: to extract edges;
+- \b Vertex: to extract vertices;
+- \b Shape: to extract top-level contents of the compound shape;
+- \b Flat: to extract "flat" contents of the compound shape.
+
+Note: "flat" contents means that top-level simple-type sub-shapes are extracted from
+the compound object recursively (i.e. there are no compounds in the result).
+
+Let us take, for example, compound C1 that contains solid S1 and another compound C2 that
+contains solids S2 and S3 (see the picture below):
+- Explode operation with \b Shape type given as parameter will return S1 and C2;
+- Explode operation with \b Flat type given as parameter will return S1, S2 and S3.
+
+\image html flat_contents.png
+
+Switching on <b>Select Sub-shapes</b> check box allows manual selection of sub-shapes
+to be extracted from the main object. In this mode it is possible to select sub-shapes
+directly in 3D viewer.
+
+When <b>Select Sub-shapes</b> check box is switched on, additional \b Filter controls
+allow to automatically pick up entities, which satisfy the specified threshold value(s).
+The numerical functor for each sub-shape that is compared with the threshold value(s)
+is computed according to the topological properties of the shape:
+- length for edges and wires;
+- area for faces and shells;
+- volume for solids, compounds and compsolids.
+
+Filtering capabilities are not available for vertices.
+
+To filter out some entities it is necessary to do the following:
+- Activate one or two filtering controls by switching on the corresponding check boxes;
+- Select the required threshold comparator type; the following choices are available:
+ - <b>Less Than</b> or <b>Equal or Less Than</b> for the first comparator;
+ - <b>Greater Than</b> or <b>Equal or Greater Than</b> for the second comparator;
+- Enter the required threshold value (values);
+- Press \b Apply button in the \b Filter group.
+
+The entities, which correspond to the entered filtering parameters, will be automatically highlighted
+in the 3D viewer.
+
+Using <b>TUI Commands</b> you can perform this operation in a
variety of ways:
-<ul>
-<li><em>geompy.ExtractShapes(Shape, Type, isSorted)</em> explodes a
-Shape into sub-shapes of a given Type and returns a List of sub-shapes.
-This method does not return the Shape itself if it matches the
-Type.</li>
-<li><em>geompy.SubShapeAll(Shape, Type)</em> explodes a Shape on
-sub-shapes of a given Type and returns a List of sub-shapes.</li>
-<li><em>geompy.SubShapeAllIDs(Shape, Type)</em> explodes a Shape on
-sub-shapes of a given Type and returns a List of IDs of
-sub-shapes.</li>
-<li><em>geompy.SubShapeAllSortedCentres(Shape, Type)</em> explodes a
-shape on sub-shapes of a given type and sorts them taking into account
-their gravity centers, to provide stable order of sub-shapes.
-It returns a list of sub-shapes.</li>
-<li><em>geompy.SubShapeAllSortedCentresIDs(Shape, Type)</em> explodes
-a shape on sub-shapes of a given type and sorts them taking into
-account their gravity centers, to provide stable order of sub-shapes.
-It returns a List of IDs of sub-shapes.</li>
-<li><em>geompy.SubShape(Shape, Type, ListOfInd)</em> allows to obtain
-a compound of sub-shapes of the Shape, selected by they indices in a
-list of all sub-shapes of the given Type. Each index is in the range
-[1, Nb_Sub-Shapes_Of_Given_Type].</li>
-<li><em>geompy.SubShapeSortedCentres(Shape, Type, ListOfInd)</em>
-allows to obtain a compound of sub-shapes of the Shape, selected by
-they indices in sorted list of all sub-shapes of the given Type. Each
-index is in the range [1, Nb_Sub-Shapes_Of_Given_Type]</li>
-</ul>
-
-\n <b>Arguments: </b>1 SHAPE + 1 type of SubShape.
+- <em>geompy.ExtractShapes(Shape, Type, isSorted)</em> explodes a
+ Shape into sub-shapes of a given Type and returns a List of sub-shapes.
+ This method does not return the Shape itself if it matches the Type.
+- <em>geompy.SubShapeAll(Shape, Type)</em> explodes a Shape into
+ sub-shapes of a given Type and returns a List of sub-shapes.
+- <em>geompy.SubShapeAllIDs(Shape, Type)</em> explodes a Shape into sub-shapes of a given Type and returns a List of IDs of sub-shapes.
+- <em>geompy.SubShapeAllSortedCentres(Shape, Type)</em> explodes a
+ shape into sub-shapes of a given type and sorts them taking into account
+ their gravity centers, to provide a stable order of sub-shapes.
+ It returns a list of sub-shapes.
+- <em>geompy.SubShapeAllSortedCentresIDs(Shape, Type)</em> explodes
+ a shape into sub-shapes of a given type and sorts them taking into
+ account their gravity centers, to provide a stable order of sub-shapes.
+ It returns a List of IDs of sub-shapes.
+- <em>geompy.SubShape(Shape, Type, ListOfInd)</em> allows to obtain
+ a compound of sub-shapes of the Shape, selected by their indexes in a
+ list of all sub-shapes of the given Type. Each index is in the range
+ [1, Nb_Sub-Shapes_Of_Given_Type].
+- <em>geompy.SubShapeSortedCentres(Shape, Type, ListOfInd)</em>
+ allows to obtain a compound of sub-shapes of the Shape, selected by
+ their indexes in a sorted list of all sub-shapes of the given Type. Each
+ index is in the range [1, Nb_Sub-Shapes_Of_Given_Type]
-\image html neo-obj1.png
+<b>Arguments: </b>1 SHAPE + 1 type of SubShape.
<b>Example:</b>
-\image html explode.png "A box, exploded into faces"
+\image html explode.png "A box exploded into faces"
*/
the base shape <b>and the tangent to the path</b> wire remains constant at any point of the
given path.
\n <b>Select unpublished edges</b> checkbox - if checked, allows to select an edge of any other shape as the path object.
+\n <b>Generate groups</b> checkbox - if checked allows to create groups of
+sub-shapes. For more details on groups creation please refer to
+\ref create_groups_page "this description".
\n The \b Result of the operation will be a GEOM_Object (edge, face, shell,
solid or compsolid).
-\n <b>TUI Command:</b> <em>geompy.MakePipe(baseShape, pathShape)</em>
+\n <b>TUI Command:</b> <em>geompy.MakePipe(baseShape, pathShape,
+ IsGenerateGroups=False)</em>
\n <b>Arguments:</b> Name + 1 shape (vertex, edge, planar wire, face or
shell) serving as base object + 1 shape (edge or wire) for
-definition of the path.
+definition of the path + 1 boolean parameter (IsGenerateGroups).
\n <b>Advanced options</b> \ref preview_anchor "Preview"
\image html pipe.png
to preserve the constant <b>angle between the normal vector</b> to the base
shape <b>and the BiNormal vector</b> given as the third argument.
\n <b>Select unpublished edges</b> checkbox - if checked, allows to select an edge of any other shape as the path object.
+\n <b>Generate groups</b> checkbox - if checked allows to create groups of
+sub-shapes. For more details on groups creation please refer to
+\ref create_groups_page "this description".
\n The \b Result of the operation will be a GEOM_Object (edge, face, shell,
solid or compsolid).
-\n <b>TUI Command:</b> <em>geompy.MakePipeBiNormalAlongVector(baseShape, pathShape, binormalShape)</em>
+\n <b>TUI Command:</b> <em>geompy.MakePipeBiNormalAlongVector(baseShape, pathShape, binormalShape,
+ IsGenerateGroups=False)</em>
\n <b>Arguments:</b> Name + 1 shape (edge, planar wire or face)
serving as base object + 1 shape (edge or wire) for
definition of the path + 1 shape (edge or wire) to set a fixed
-BiNormal direction to perform the extrusion.
+BiNormal direction to perform the extrusion + 1 boolean parameter
+(IsGenerateGroups).
\image html pipe2.png
- If <b>With contact</b> is checked, the section is translated in contact with the spine.
- If <b>With correction</b> is checked, the section is rotated to be orthogonal to the spine
tangent in the corresponding point.
+- If <b>Step-by-step generation</b> is checked, the result is created
+step-by-step, i.e. it creates pipes between each pair of neighbor sections and
+fuses them into a single shape.
+\note If <b>Step-by-step generation</b> is checked, <b>With contact</b> and
+<b>With correction</b> controls are disabled as corrections of bases are
+not allowed in step-by-step mode.
+
+<b>Generate groups</b> checkbox - if checked allows to create groups of
+sub-shapes. For more details on groups creation please refer to
+\ref create_groups_page "this description".
\n The \b Result of the operation will be a shell or a solid.
-\n <b>TUI Command:</b> <em>geompy.MakePipeWithDifferentSections(baseShape, locations, pathShape, withContact, withCorrection)</em>
+\n <b>TUI Commands:</b>
+- <em>geompy.MakePipeWithDifferentSections(baseShape, locations, pathShape, withContact, withCorrection,
+ IsGenerateGroups=False)</em>
\n <b>Arguments:</b> Name + list of shapes (edges, planar wires, faces or shells) serving as base object +
list of locations (vertices) on the path corresponding specified list of the shapes +
1 shape (edge or wire) for definition of the path +
-2 Boolean parameters (withContact, withCorrection).
+3 Boolean parameters (withContact, withCorrection, IsGenerateGroups).
+- <em>geompy.MakePipeWithDifferentSectionsBySteps(baseShape, locations, pathShape,
+ IsGenerateGroups=False)</em>
+\n <b>Arguments:</b> Name + list of shapes (edges, planar wires, faces or shells) serving as base object +
+list of locations (vertices) on the path corresponding specified list of the shapes +
+1 shape (edge or wire) for definition of the path +
+Boolean parameter.
+
\n <b>Advanced options</b> \ref preview_anchor "Preview"
\image html pipe3.png
To create a \b Face in the <b>Main Menu</b> select <b>New Entity - >
Build - > Face</b>
-\n To create a \b Face you need to select input shape(s). The list of
-input shapes can include shapes of any type; if the shapes are nor
-wires or edges, the algorithm extracts all edges from
-the input shapes and works on the obtaineed edges.
+There are three algorithms to create a \b Face. In all cases the \b Result
+of the operation will be a GEOM_Object (FACE).
+
+\n Firstly, to create a \b Face you need to select input shape(s). The list of
+input shapes can include shapes of any type except vertices; if the shapes are
+neither wires nor edges, the algorithm extracts all edges from
+the input shapes and works on the obtained edges.
\n The edges and wires do not necessarily have to be closed, the
algorithm automatically builds a wire of maximum length from all
-given edges and wires. If it founds multiple closed wires, it can
-build a face with holes or some separate faces, depending on the
-placement of the wires. If some resulting wires remain open, they will
-be added in the resulting compound "as is".
+given edges and wires. If several closed wires are detected the algorithm tries
+to create a face with holes. It is possible only if there is only one wire
+that can be interpreted as an outer one; other wires can be considered as
+inner ones.
\n Check <b>Try to create a planar face</b> to create a planar
face or nothing if it is impossible.
-\note Please note, that the resulting face can have a huge tolerance, if the initial wire has a big deviation from the plane. If the final tolerance exceeds 1e-06, a warning will be shown, but the face will be created and published in the study in a normal way. Using such faces can lead to failures or unpredictable results in most operations.
+\note Please note, that the resulting face can have a huge tolerance, if
+the initial wire has a big deviation from the plane. If the final tolerance
+exceeds 1e-06, a warning will be shown, but the face will be created
+and published in the study in a normal way. Using such faces can lead to failures
+or unpredictable results in most operations.
-\n The \b Result will be a \b GEOM_Object (FACE).
+\n The \b Result will be a \b GEOM_Object. It can be either a single face or, in specific cases, a compound of faces.
\n <b>TUI Command:</b> <em>geompy.MakeFaceWires([list of Shapes], isPlanarWanted)</em>
\n <b>Arguments:</b> Name + 1 wire.
-\image html neo-obj4.png
+\image html neo-obj4.png "Create face by input shape(s)"
+
+\n Secondly, it is possible to create a face based on another face's surface and bounded by a wire.
+
+\n The \b Result will be a \b GEOM_Object (face).
+
+\n <b>TUI Command:</b> <em>geompy.MakeFaceFromSurface(theFace, theWire)</em>
+\n <b>Arguments:</b> Name + 1 face + 1 wire.
+
+\image html neo-obj4_2.png "Create face by another face's surface"
+
+Thirdly, it is possible to create a \b Face by specifying a set of edges forming a closed wire
+and constraints:
+- Specify an input wire by selecting it in the object browser or in the viewer.
+ The input wire will be exploded on edges which will be shown in the \b Constraints list box.
+- Specify constraints by associating faces with the edges.
+
+\note Please note, that the constraint face must be connected to a reference edge.
+
+\n The \b Result will be a \b GEOM_Object (face).
+
+\n <b>TUI Command:</b> <em>geompy.MakeFaceWithConstraints([List of constraints])</em>
+\n <b>Arguments:</b> Name + List of input edges and constraint faces. If a constraint
+face is missing for some edge, this means that there is no constraint associated to this edge.
+\note Set of edges should form a closed wire.
+
+\image html neo-obj4_3.png "Create face by a wire and its constraints"
\n <b>Example:</b>
\image html facesn3.png "Examples of faces"
-Our <b>TUI Scripts</b> provide you with useful examples of creation of
+Our <b>TUI Scripts</b> provide you with useful examples of creation of
\ref tui_creation_face "Advanced Geometric Objects".
*/
To create a curvilinear face from several edges you need to define the
following parameters:
-\n <b>Input Compound</b> - the list of edges/wires used for creation
-of the surface. To prepare for the filling each wire of the compound
-is converted to an edge created on a BSpline curve built using curves
-from all edges of the wire.
+\n <b>Input Contours</b> - the list of edges/wires to use for creation
+of the surface. You can select either several edges/wires or a
+compound of them. To prepare for the filling, each input wire
+is converted into a single BSpline curve by concatenating its edges.
\n \b Minimum and <b>Maximum Degree</b> of equation of the resulting
-BSpline or Besier curves describing the surface;
+BSpline or Besier curves describing the surface.
\n \b Tolerance for \b 2D and for \b 3D - minimum distance between the
-created surface and the reference edge;
+created surface and the input contours.
\n <b>Number of Iterations</b> - defines the maximum number of iterations. The
iterations are repeated until the required tolerance is reached. So, a
greater number of iterations allows producing a better surface.
\n <b>Method</b> - Kind of method to perform filling operation
-
<ol>
<li>Default - the standard behaviour.</li>
<li>Use edges orientation - the edges orientation is used: if an edge is
minimize the sum of distances between ends points of edges.</li>
</ol>
-\n <b>Approximation</b> - if checked, BSpline curves are generated in
+<b>Approximation</b> - if checked, BSpline curves are generated in
the process of surface construction (using
GeomAPI_PointsToBSplineSurface functionality). By default the surface
is created using Besier curves. The usage of <b>Approximation</b>
\n The \b Result of the operation will be a GEOM_Object (face).
-\n <b>TUI Command:</b> <em>geompy.MakeFilling(Edges, MinDegree, MaxDegree, Tol2D, Tol3D, NbIter)</em>
-\n <b>Arguments:</b> Name + 1 List of edges + 7 Parameters
-(Min. degree, Max. degree, Number of iterations, 2D tolerance, 3D
-tolerance, Number of iterations, Method, Approximation).
-\n <b>Advanced options</b> \ref preview_anchor "Preview"
+\n <b>TUI Command:</b> <em>geompy.MakeFilling(Contours, MinDegree, MaxDegree, Tol2D, Tol3D, NbIter)</em><br>
+<b>Arguments:</b> List/compound of edges/wires + 7 Parameters
+(Min. degree, Max. degree, 2D tolerance, 3D tolerance, Number of
+iterations, Method, Approximation).
+\n <b>Advanced options:</b> \ref preview_anchor "Preview"
\image html filling.png
+\note This dialog supports navigation through the selectable objects (in OCC 3D viewer only):
+- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when input focus is
+in the viewer to navigate between selectable objects.
+- Press left mouse button to select an appropriate object to the dialog box.
+.
+For more details, please refer to the \em "Functionality common for OCC and VTK viewers" chapter
+of the GUI module's documentation.
+
<b>Example:</b>
\image html filling_compoundsn.png "Initial edges"
\image html fillingsn.png "Resulting surface"
-Our <b>TUI Scripts</b> provide you with useful examples of creation of
+Sample <b>TUI Scripts</b> provide you with useful examples of creation of
\ref tui_creation_filling "Complex Geometric Objects".
*/
--- /dev/null
+/*!
+
+\page create_groups_page Generation of Groups
+
+This option is available in some dialogs. To activate it please check
+<b>Generate Groups</b> check box. When it is checked, it is possible to define
+the prefix for generated groups names using <b>Group Names Prefix</b> input
+field.
+
+\image html gen_group_dlg.png "Generate groups option in a dialog"
+
+The groups are created along with the result of the operation when
+\b Apply or <b>Apply and Close</b> button is clicked. Each generated group
+represents a set of sub-shapes of the result that satisfies certain conditions.
+The groups of the following types can be generated:
+ - \b Down - sub-shapes starting the result, e.g. bottom lid
+for the pipe creation operation.
+ - \b Up - sub-shapes ending the result, e.g. top lid
+for the pipe creation operation.
+ - \b Side1, \b Side2 - sub-shapes corresponding to each side
+of the result.
+ - \b Other - faces generated from the bounding edges of
+\b Down group.
+
+The groups are named according to the following naming rule:
+If <b>Group Names Prefix</b> is set <b><Prefix>_<Type></b>, otherwise
+the name is \b <Type>. The following figure shows group names created with
+the prefix \b Group:
+
+\image html gen_group_tree.png "Group_Down, Group_Up, Group_Side1 and Group_Side2 are generated"
+
+
+The general behavior of this functionality is the following:
+<ul>
+<li>If <b>Generate Groups</b> option is not set, the groups are not generated.</li>
+<li>If starting and ending sub-shapes of the result are the same, e.g. if there is
+a closed path for pipe construction, <b>Generate Groups</b> option is disabled
+in the dialog box:</li>
+
+\image html gen_group_disabled.png "Disabled option in the Pipe Construction dialog if the path is closed"
+\n
+<li>Otherwise If the path is not closed edge/wire, the groups are created depending
+on the profile:</li>
+<ul>
+<li>Profile is unclosed edge or wire: \b Down, \b Up, \b Side1, \b Side2:</li>
+
+\image html gen_group_sides.png "Pipe with created groups Down(Red), Up(Green), Side1(Blue) and Side2(Yellow)"
+\n
+<li>Profile is closed edge or wire, face or shell: \b Down, \b Up, \b Other:</li>
+
+\image html gen_group_other.png "Created groups Down(Red), Up(Green) and Other(Yellow)"
+</ul>
+</ul>
+
+\b Down and \b Up groups contain:
+- Edges if the profile is edge or wire;
+- Faces if the profile is face or shell.
+
+\b Side1 and \b Side2 groups contain edges generated from the first and
+last vertices of the profile edge or wire correspondingly. The first and
+last vertices are determined taking into account edge/wire orientation.
+
+\b Other group represents faces generated from the bounding edges of profile.
+
+The behavior in TUI is the following:
+- Each Python function that supports groups generation has a flag
+\b IsGenerateGroups which is equal to \b False by default.
+- If \b IsGenerateGroups is not set the groups are not created; the returned
+value is GEOM_Object that represents a result of the operation.
+- If \b IsGenerateGroups is set the operation returns a list of GEOM_Object.
+Its first element is a result, the remaining ones are the groups in the order:
+\b Down, \b Up, \b Side1, \b Side2 for opened profile or \b Down, \b Up,
+\b Other for closed profile.
+- If \b IsGenerateGroups is set and the path is closed an error occurs.
+
+*/
\page create_isoline_page Isoline
\b Isoline is a 3D curve built on a bounded face limited by <em> [Umin, Umax] </em> and <em> [Vmin, Vmax] </em>
-values of U and V parameters. For all points of the isoline U or V parameter value is constant.
+values of U and V parameters. For all points of the isoline U or V parameter value is constant.
+
+Result of this operation is either a single edge or a compound of edges.
To create an \b Isoline of a face in the <b>Main Menu</b> select <b>New Entity - > Basic - > Isoline</b>.
\n Thirdly, we can define a point by an \b Edge and a \b Parameter
indicating its position on the Edge, ranging from 0.0 to 1.0. For example, 0.5 means that the
point is located in the middle of the edge.
-\n <b>TUI Command:</b> <em>geompy.MakeVertexOnCurve(Edge,Parameter).</em>
+\n <b>TUI Command:</b> <em>geompy.MakeVertexOnCurve(Edge,Parameter,takeOrientationIntoAccount).</em>
\n <b>Arguments:</b> Name + 1 edge + 1 Parameter defining the
-position of the point on the given edge.
+position of the point on the given edge + flag that tells if it is necessary
+to take the edge orientation into account.
\image html point3.png
Alternatively, it is possible to define a point by an \b Edge and a \b Length.
projected point.
\image html point3_2.png
-\n Fourthly, we can define a point by intersection of two \b Lines or \b Wires (or a Wire and a Line).
-If they intersect only once, a point will be created. If there are several intersections, a compound of points will be created. The type of the selected object (Line or Wire) can be changed in the popup menu, after clicking the corresponding selection button.
+\n Fourthly, we can define a point by intersection of two \b Lines or \b Wires (or a Wire and a Line).
+If they intersect only once, a point will be created. If there are several intersections, a compound of points will be created.
\n <b>TUI Command:</b> <em>geompy.MakePointOnLinesIntersection(myLine1,myWire1).</em>
\n <b>Arguments:</b> Name + 2 1D objects
\image html point5_2.png
+\note This dialog supports navigation through the selectable objects (in OCC 3D viewer only):
+- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when input focus is
+in the viewer to navigate between selectable objects.
+- Press left mouse button to select an appropriate object to the dialog box.
+.
+For more details, please refer to the \em "Functionality common for OCC and VTK viewers" chapter
+of the GUI module's documentation.
+
<b>Example:</b>
\image html points.png "Points by edge and parameter and by coordinates"
\image html polyline_dlg.png
A polyline represents a section or a set of sections. Each section is constructed from a sequence of 2D points
-connected either by linear setgments or an interpolation curve. Every section has its own attributes:
+connected by either linear segments or an interpolation curve. Every section has its own attributes:
- \b Name,
- \b Type (Polyline or Spline),
- \b Closed flag.
-A Polyline created represents a shape that lies on the XOY plane. It can have the following types:
+A created Polyline represents a shape that lies on the XOY plane. Its type can be one of the following:
- \b Vertex for a single section with only 1 point.
-- \b Wire for a single section with 2 or more points. A Wire can have multiple edges for more then 2 points if the section type is Polyline.
-A single edge in the result wire is obtained for a Spline or Polyline with 2 points.
+- \b Wire for a single section with 2 or more points. A Wire can have multiple edges for more then 2 points if the section type is Polyline. A single edge in the resulting wire is obtained for a Spline or Polyline with 2 points.
- \b Compound of Wires and/or Vertices if there are several sections.
-For the moment only one reference coordinate system for polyline creation is supported. The XOY plane of the <b>Global coordinate system</b>
-is suggested. Implementation of another reference coordinate system is a subject of further development of this functionality.
-Restore button orientates the viewer correspondingly to the chosen working plane and fits the scene to show all objects.
+For the moment only one reference coordinate system for polyline creation is supported, which is the XOY plane of the <b>Global coordinate system</b>.
+\b Restore button orientates the viewer correspondingly to the chosen working plane and fits the scene to show all objects.
For the moment this button works with only one plane.
-It is possible to import a shape in this dialog using <b>Import polyline</b> selection button. To do it an imported object should satisfy conditions
-for polyline shapes mentioned above. If a valid shape is selected, when dialog is opened, it is initialized by this shape.
-Though the shape can be on any plane, an imported polyline will be defined on XOY plane only due to the limitation.
+It is possible to import a shape in this dialog using <b>Import polyline</b> selection button. An imported object should meet the conditions for polyline shapes mentioned above. If a valid shape is selected, when the dialog is opened, it is initialized by this shape.
+Though the shape can be on any plane, the imported polyline will be defined on XOY plane only due to the limitation.
-The group \b Sections in this dialog represents the Polyline construction framework. Its toolbar has the following operations:
-- \b Undo
-- \b Redo
-- <b>Insert new section</b>
-- <b>Addition mode</b>
-- <b>Modification mode</b> - not implemented
-- <b>Detection mode</b> - not implemented
-- \b Remove
-- <b>Join selected sections</b>
+The group \b Sections in this dialog represents the Polyline construction framework.
-<b>Undo/Redo</b> buttons allows to undo/redo changes of the polyline.
+The buttons <b>Undo</b> and <b>Redo</b> allow to undo or redo the changes of the polyline.
-<b>Insert new section</b> button opens a dialog that allows to add a new section:
+<b>Insert new section</b> button opens the corresponding dialog:
\image html polyline_dlg_add_section.png
In this dialog it is possible to choose:
-- \b Name of section
-- \b Type of section
-- \b Closed flag
+- \b Name of section;
+- \b Type of section;
+- Set \b Closed flag.
-To create a new section \b Add button should be clicked. \b Cancel button is used to cancel this operation.
-After clicking \b Add button a new section is appeared on the list. Its name supplemented by its type and closedness
-information (see icon) and the number of points (equal to 0 after creation).
+To create a new section, click \b Add button. \b Cancel button is used to cancel this operation.
+After clicking \b Add button a new section appears in the list. Its name is generated automatically depending on its type, closed or opened state and the number of points (equal to 0 after creation).
-To modify section parameters it is possible to double-click on a section in the list. In this case the following dialog appears:
+To modify section parameters, double-click on a section in the list. In this case the following dialog appears:
\image html polyline_dlg_edit_section.png
-To apply modifications the button \b Ok should be clicked.
+To apply the modifications, click \b Ok button.
-<b>Addition mode</b> allows to add points to a section. It is necessary to select a particular section in a list of sections
-and make some mouse clicks in the viewer. A section preview is recomputed after each click.
+<b>Addition mode</b> allows adding points to a section. Select a particular section in the list of sections
+and left-click in the viewer to add new nodes to the section. A section preview is recomputed after each click.
<b>Modification mode</b> and <b>Detection mode</b> are not implemented for the moment.
-\b Remove button allows to remove a section. It is available if all modes are deactivated and one section is selected.
+\b Remove button allows removing a section. It is available if all modes are deactivated and one section is selected.
<b>Join selected sections</b> button is available in modification mode if two or more sections are selected. It is used to
-merge several sections into the first one from selection list. Joined section has parameters of the first selected one. Points of
-the other sections are appended at the end of the list of the first section points.
+merge several sections into the first one from the selection list. The points of the merged sections are appended at the end of the list of points of the first section.
-Some actions are available via popup menu by right mouse button click.
+Some actions are available via the context menu activated by right mouse button click.
+- <b>Join all sections</b> - joins all defined sections into the first one.
+- \b Join - joins two or more selected sections.
+- <b>Clear all</b> - removes all selected sections.
+- <b>Set closed</b> - sets \b Closed flag for all selected section.
+- <b>Set open</b> - unset \b Closed flag for all selected sections.
+- <b>Set polyline</b> - sets the type of all selected sections to Polyline.
+- <b>Set spline</b> - set the type of all selected sections to Spline.
-If all modes are deactivated:
-- <b>Join all sections</b> - join all defined sections into the first one.
-- \b Join - join sections. Available if two or more sections are selected.
-
-In <b>Addition mode</b>:
-- <b>Join all sections</b> - join all defined sections into the first one.
-
-In <b>Modification mode</b>:
-- <b>Join all sections</b> - join all defined sections into the first one.
-- \b Join - join sections. Available if two or more sections are selected.
-- <b>Clear all</b> - remove all sections. Available if at least one section is selected.
-- <b>Set closed</b> - set all selected section's Closed flag. Available if at least one section is selected.
-- <b>Set open</b> - reset all selected section's Closed flag. Available if at least one section is selected.
-- <b>Set polyline</b> - set all selected section's type to Polyline. Available if at least one section is selected.
-- <b>Set spline</b> - set all selected section's type to Spline. Available if at least one section is selected.
-
-In <b>Detection mode</b>:
-- <b>Join all sections</b> - join all defined sections into the first one.
-- \b Join - join sections. Available if two or more sections are selected.
+Different actions are available depending on the mode and selection.
<h2>TUI Commands</h2>
-
To create the 2D polyline in TUI Polyline2D interface is used.
<em>pl = geompy.Polyline2D()</em> - returns an instance of Polyline2D interface <i>pl</i>.
See the \ref gsketcher.Polyline2D "Polyline2D" interface documentation for more information.
Our <b>TUI Scripts</b> provide you with useful examples of the use of
-\ref tui_polyline_page "2D Polyline".
+\ref tui_creation_polyline "2D Polyline".
*/
Build - > Shell</b>
\n You can create a \b Shell from a compound of faces or a list of faces or shells.
-\n The \b Result will be a \b GEOM_Object (shell).
+\n The \b Result will be a \b GEOM_Object. It can be either a single shell or, in specific cases, a compound of shells.
\n <b>TUI Command:</b> <em>geompy.MakeShell(ListOfShape)</em>
\n <b>Arguments:</b> Name + Compound of faces or List of faces having connected edges.
- <b>Max BSpline surface degree</b> of the resulting BSpline surface;
- <b>3D tolerance of initial approximation</b>
-\note <b>3D tolerance of initial approximation</b> represents a tolerance of
+\note <b>3D tolerance of the initial approximation</b> represents the tolerance of
initial plate surface approximation. If this parameter is equal to 0 (default),
its value is automatically computed as <em> max(0.0001, 10*error)</em>,
-where <em>error</em> is a 3D tolerance of the surface representing a maximal
-distance between computed plate surface and given points.
+where <em>error</em> is the 3D tolerance of the surface representing the maximal
+distance between the computed plate surface and given points.
<b>Advanced options:</b> \ref preview_anchor "Preview"
- \em thelPoints is a list of points or compounds of points;
- \em theNbMax maximum number of Bezier pieces in the resulting surface;
- \em theDegMax maximum degree;
-- \em theDMax specifies 3D tolerance of initial approximation
+- \em theDMax specifies 3D tolerance of the initial approximation.
Example:
\page create_solid_page Solid
-\n To create a \b Solid in the <b>Main Menu</b> select <b>New Entity - > Build - >
+To create a \b Solid in the <b>Main Menu</b> select <b>New Entity - > Build - >
Solid</b>.
-You can create a \b Solid from a list of shells.
+Firstly, you can create a \b Solid from a list of shells.
The \b Result will be a \b GEOM_Object (SOLID).
-\n <b>TUI Command:</b> <em>geompy.MakeSolid(ListOfShape),</em> where
-ListOfShape is a list of shells from which the solid is constructed.
-\n <b>Arguments:</b> Name + A closed shell or a list of closed shells.
+<b>TUI Command:</b> <em>geompy.MakeSolid(ListOfShape),</em> where
+\c ListOfShape is a list of shells from which the solid is constructed.
+
+<b>Arguments:</b> Name + A closed shell or a list of closed shells.
\image html neo-obj6.png
-\n <b>Example:</b>
+<b>Example:</b>
\image html solidsn.png "Solid"
+Secondly, it is possible to create a \b Solid (or a compound of solids) from a list of
+connected faces or shells.
+
+The \b Result will be a \b GEOM_Object (SOLID or COMPOUND).
+
+<b>TUI Command:</b> <em>geompy.MakeSolidFromConnectedFaces(ListOfShape, isIntersect),</em> where
+\c ListOfShape is a list of faces and/or shells from which the solid is constructed and
+\c isIntersect is a boolean flag which, when set to \c True, forces performing intersection/sewing
+between arguments
+
+<b>Arguments:</b> Name + A set of connected faces and/or shells + Boolean flag.
+
+\image html neo-obj6_2.png
+
Our <b>TUI Scripts</b> provide you with useful examples of creation of
-\ref tui_creation_solid "Advanced Geometric Objects".
+\ref tui_creation_solid "Solid from shell" and
+\ref tui_creation_solid_from_faces "Solid from connected faces".
*/
--- /dev/null
+/*!
+
+\page create_surface_from_face_page Surface From Face
+
+To create a <b>Surface From Face</B> in the <b>Main Menu</b> select <b>New Entity - > Basic - > Surface From Face</b>
+
+\n This function takes a face at input and creates a new
+<b>GEOM_Object</b>, i.e. topological shape by extracting the underlying surface
+of the source face and limiting it by the <b>Umin, Umax, Vmin</b> and <b>Vmax</b>
+parameters of the source face (in the parametric space).
+\n
+\ref restore_presentation_parameters_page "Advanced options".
+
+\n <b>TUI Command:</b> <em>geompy.MakeSurfaceFromFace(theFace)</em>,
+where \em theFace the input face.
+\n <b>Arguments:</b> Name + Object (Face).
+
+\image html surface_from_face1.png "Surface From Face"
+
+\n <b>Example:</b>
+
+\image html surface_from_face_example.png "Original Face (white) and Created Surface"
+
+Our <b>TUI Scripts</b> provide you with useful examples of the use of
+\ref tui_creation_surface "Surface From Face" creation.
+
+*/
--- /dev/null
+/*!
+
+\page create_thickness_page Thickness Construction
+
+To add \b Thickness to a shape in the <b>Main Menu</b> select <b>New Entity - > Generation - > Thickness</b>.
+
+Switch between adding thickness to a Face (Shell) or a Solid using radio buttons.
+
+Firstly, \b Thickness can be applied to a Face or a Shell to create a Solid.
+
+\image html thickness.png
+
+It is necessary to define an \b Object (Face or Shell) and the value of \b Thickness.
+<b>Thicken towards the inside</b> check box allows changing the thickness direction.
+
+<b>Example:</b>
+
+\image html thickness_result.png "Thickness of Shell"
+
+Secondly, the \b Thickness can be applied to a Solid to create a hollowed Solid.
+
+\image html thicksolid.png
+
+It is necessary to define a Solid \b Object \b Faces to be removed from the result and \b Thickness.
+<b>Thicken towards the inside</b> check box allows changing the thickness direction.
+
+<b>Example:</b>
+
+\image html thicksolid_result.png "Thickness of Solid"
+
+\n <b>TUI Commands:</b>
+\n
+<em>geompy.MakeThickSolid(theShape, theThickness, theFacesIDs=[])</em> -
+Makes a thick solid from a shape;
+\n
+<em>geompy.Thicken(theShape, theThickness, theFacesIDs=[])</em> -
+Modifies a shape to make it a thick solid.
+
+<b>Arguments:</b> Name + 1 shape (face, shell or solid) + thickness +
+the list of face IDs.
+\n If the shape is a face or a shell the list of face IDs is not used.
+The thickness can be positive or negative for thickening towards the inside.
+\n\n <b>Advanced options</b> \ref preview_anchor "Preview"
+
+Our <b>TUI Scripts</b> provide you with useful examples of creation of
+\ref tui_creation_thickness "Complex Geometric Objects".
+
+*/
\anchor dependency_tree_general_description_anchor <h2>General description</h2>
-In order to better understand the relations between the %GEOM
-objects in a study the user has a possibility to display the
-ascendants and descendant of the object(s) in a family tree.
-
-User can build the dependency tree by selecting desirable object
-in Object Browser or OCC Viewer and calling "Show dependency tree"
-popup item. It will open a new or clear the existing "Dependency
-Tree" view window (only one view is supported) and display a
-dependency tree for the selected object or objects (multiple
-selection is supported). Also user can rebuild the tree if to select
-some object(s) right in the "Dependency Tree" view and call
-"Rebuild the tree" popup menu item.
+You can display the ascendants and descendants of object(s) in a tree structure to better understand the relations between the %GEOM
+objects in a study .
+
+To build the dependency tree, select the necessary object or objects (multiple
+selection is supported) in the Object Browser or OCC Viewer and call "Show dependency tree" context menu item.
\image html tree_example.png
-User can change all necessary parameters of Dependency Tree Viewer
-in \ref pref_dependency_tree "Preferences".
+
+"Dependency Tree" view window will display the dependency tree for the selected object.
+It is also possible to select an object(s) directly in the "Dependency Tree" view and to rebuild the tree by selecting
+"Rebuild the tree" context menu item.
+
+All necessary parameters of Dependency Tree Viewer can be edited in the \ref pref_dependency_tree "Preferences".
+
+\note This functionality is available only if the GUI module is built with Graphics view (option SALOME_USE_GRAPHICSVIEW is ON when building GUI module).
<hr>
\anchor dependency_tree_nodes_anchor <h2>Nodes</h2>
Tree nodes in the Dependency Viewer are named according to the study
names of the corresponding objects.
-Non-published objects are shown in the tree as "unpublished" and
-colored in special color.
-
-All nodes have the fixed size, so the long names are cut and shown
-with ellipsis; full name of the object can be seen in the tooltip
-if to keep the cursor over the node.
+All nodes have fixed size, so long names are cut; the full object name can be seen in the tool-tip
+when the cursor is hovered over the node.
"Dependency Tree" view supports the following states of nodes:
-<ul><li><b>Main node</b> - node of main object(s), which were selected in Object
-Browser, OCC Viewer or Dependency Tree Viewer in order to build the
-dependency tree;</li></ul>
+<ul><li><b>Main node</b> - corresponds to the main object(s) selected in Object
+Browser, OCC Viewer or Dependency Tree Viewer;</li></ul>
\image html tree_main_node.png
-<ul><li><b>Default node</b> - node of published in study object, which participate in building of
-dependency tree as ascendant or descendant;</li></ul>
+<ul><li><b>Default node</b> - ascendant or descendant node of the dependency tree corresponding to an object published in the study;</li></ul>
\image html tree_default_node.png
-<ul><li><b>Unpublished node</b> - the same as "Default node", but
-corresponding object was not published in study;</li></ul>
+<ul><li><b>Unpublished node</b> - corresponds to an object that was not published in the study;</li></ul>
\image html tree_unpublished_node.png
-<ul><li><b>Highlighted node</b> - the state of node when mouse
-cursor is over it;</li></ul>
+<ul><li><b>Highlighted node</b> - the state of a node when the mouse cursor is hovered over it;</li></ul>
\image html tree_highlighted_node.png
-<ul><li><b>Selected node</b> - the state of node when user
-clicks the left mouse button on node.</li></ul>
+<ul><li><b>Selected node</b> - the state of node when the user clicks the left mouse button it.</li></ul>
\image html tree_selected_node.png
<hr>
\anchor dependency_tree_links_anchor <h2>Links</h2>
Dependency Tree Viewer shows oriented links between nodes to
-represent dependency direction. Viewer supports the following states
-of links:
+represent the dependency direction. The viewer supports the following states of links:
-<ul><li><b>Unidirectional link</b> - shows that A object depends on
-B object;</li></ul>
+<ul><li><b>Unidirectional link</b> - shows that object \b B depends on object \b A;</li></ul>
\image html tree_unidir_link.png
-<ul><li><b>Bidirectional link</b> - shows that A object depends on
-B object and, at the same time, B object depends on
-A object;</li></ul>
+<ul><li><b>Bidirectional link</b> - shows that object \b B depends on
+object \b A and, at the same time, object \b A depends on object \b B;</li></ul>
\image html tree_bidir_link.png
-<ul><li><b>Self-dependency link</b> - shows that object depends on
-itself;</li></ul>
+<ul><li><b>Self-dependency link</b> - shows that an object depends on itself;</li></ul>
\image html tree_selfdep_link.png
-<ul><li><b>Cyclic dependency links</b> - shows cyclic dependency of
-some nodes.</li></ul>
+<ul><li><b>Cyclic dependency links</b> - shows cyclic dependency of some nodes.</li></ul>
\image html tree_cycldep_link.png
<hr>
-\anchor dependency_tree_operations_anchor <h2>Operations</h2>
+\anchor dependency_tree_operations_anchor <h2>Viewer Operations</h2>
The dependency tree of a chosen %GEOM object is displayed in
the dedicated 2D view window.
functionality which can be accessed by locking on them with left
mouse button.
-\image tree_tool_bar
+\image html tree_tool_bar.png
-<b>Dump View</b> - exports an object from the viewer in bmp, png or
-jpeg image format.
+<b>Dump View</b> - exports the current scene in bmp, png or jpeg image format.
\image html tree_view_dump.png
<b>Fit all</b> - scales the presentation so that it could fit within
<ul>
<li>Level 1 corresponds to the parents and children of the selected
object(s);</li>
-<li>Level 2 is Level 1 plus the grand-parents and grand-children
+<li>Level 2 adds the grand-parents and grand-children
of the selected object(s);</li>
<li>etc...</li>
</ul>
-<b>Display ascendants</b> - allows user to control the displaying
-of ascendants.
+<b>Display ascendants</b> - allows showing/hiding the ascendants.
\image html tree_disp_ascendants.png
-<b>Display descendants</b> - allows user to control the displaying
-of descendants.
+<b>Display descendants</b> - allows showing/hiding the descendants.
\image html tree_disp_descendants.png
-<b>Move nodes</b> - enables/disables of moving the nodes.
+<b>Move nodes</b> -if checked, it is possible to move nodes in the viewer.
\image html tree_move_nodes.png
-<b>Update</b> - allows user to update a dependency tree model and the view.
+<b>Update</b> - updates the dependency tree view, reflecting changes introduced in the hierarchy.
\image html tree_button_update.png
<hr>
-\anchor dependency_tree_navigation_anchor <h2>Navigation</h2>
-
-Dependency Tree 2D Viewer supports the following navigation mode:
+\anchor dependency_tree_navigation_anchor <h2>Selection and Shortcuts</h2>
<ul>
-<li>rectangle selection in this mode is performed by the left mouse
-button</li>;
-<li>multiple selection is available when \b Shift button
+<li>It is possible to select multiple nodes in the view by rectangle selection or by clicking nodes when \b Shift button
is pressed.</li>
</ul>
-Also, holding \b Ctrl key with pressed mouse buttons performs
+Holding \b Ctrl key with pressed mouse buttons performs
the following view transformations:
<ul>
<li>Ctrl + left mouse button - zooming;</li>
</ul>
<hr>
-\anchor dependency_tree_popup_menu_anchor <h2>Popup Menu</h2>
+\anchor dependency_tree_popup_menu_anchor <h2>Context Menu</h2>
-After the object has appeared in the Dependency Tree 2D Viewer,
-user can select it with left mouse click to change its presentation
-parameters and get access to other useful options by right-clicking on
-the selected object.
+The following operations are available from the context menu of the selected object.
\image html tree_popup_menu1.png
<ul>
-<li>\b Show - allows to show selected object(s) in OCC 3D Viewer;</li>
-<li><b> Show Only</b> - allows to show only selected object(s)
-in OCC 3D Viewer;</li>
-<li><b> Rebuild the tree</b> - allows to rebuild the dependency tree
+<li>\b Show - shows the selected object(s) in OCC 3D Viewer;</li>
+<li><b> Show Only</b> - shows only the selected object(s) in OCC 3D Viewer;</li>
+<li><b> Rebuild the tree</b> - rebuilds the dependency tree
for selected object(s);</li>
-<li>\ref reduce_study_page "Reduce study" - allows to reduce study.</li>
-</ul>
-
-Some functionalities are available through right-clicking on
-the viewer background:
+<li>\ref reduce_study_page "Reduce study" - allows reducing the study.</li>
\image html tree_popup_menu2.png
-Dependency Tree 2D Viewer background can be customized using the
-"Change background" popup menu command that opens standard
-"Select Color" dialog box:
-
-\image html selectcolor.png
+<li>It is also possible to customize the background of Dependency Tree 2D Viewer using the
+corresponding context menu command.</li>
+</ul>
*/
\n <b>TUI Command:</b> <em>gg.setVectorsMode(ID, Bool)</em>
-\n Also it is possible to show the vertices of the selected
+\n It is possible to show the vertices of the selected
shape. For this, choose in the context menu of the shape
<b>Display mode -> Show Vertices</b>, or apply this
functionality for all objects in the current view via the main menu
\n <b>TUI Command:</b> <em>gg.setVerticesMode(ID, Bool)</em>
+\n To show the name of the selected shape, choose in its context menu
+<b>Display mode -> Show Name</b>, or apply this
+functionality for all objects in the current view via the main menu option
+<b> View -> Display Mode -> Show/Hide Name.</b>
+
+\image html name_mode.png
+<center><em>Name Mode (Show Name)</em></center>
+
+\n <b>TUI Command:</b> <em>gg.setNameMode(ID, Bool)</em>
+
Our <b>TUI Scripts</b> provide you with useful examples of
\ref tui_change_disp_mode "Changing Display Parameters".
--- /dev/null
+/*!
+
+\page extension_operation_page Extension
+
+\n To produce an \b Extension of an Edge or a Face select in the <b>Main Menu</b>
+<b>Operations - > Transformation - > Extension</b>. The type of extension is defined using the radio buttons.
+
+Firstly it is possible to resize an \b Edge by modifying its first
+and last parameters
+
+\image html extension1.png "Edge Extension"
+
+\n <b>TUI Command:</b> <em>geompy.ExtendEdge(theEdge, theMin, theMax)</em>,
+where \em theEdge the input edge to be resized, \em theMin the minimal
+parameter value, \em theMax the maximal parameter value.
+\n <b>Arguments:</b> Name + Object (Edge) + 2 values (Min and Max Parameters).
+
+\n <b>Example:</b>
+
+\image html extend_edge_example.png "Original edge (white) and extended edge"
+
+\note The input Edge parameters range is [0, 1]. If \b theMin parameter is
+ negative, the input Edge is extended, otherwise it is shrinked by
+ \b theMin parameter. If \b theMax is greater than 1, the Edge is
+ extended, otherwise it is shrinked by \b theMax parameter.
+
+Secondly it is possible to resize a \b Face by modifying its
+minimal and maximal U- and V-Parameters.
+
+ \image html extension2.png "Face Extension"
+
+\n <b>TUI Command:</b> <em>geompy.ExtendFace(theFace, theUMin, theUMax,
+theVMin, theVMax)</em>, where \em theFace the input face to be resized,
+\em theUMin the minimal U-Parameter value, \em theUMax the maximal U-Parameter
+value, \em theVMin the minimal V-Parameter value, \em theVMax the maximal
+V-Parameter value.
+\n <b>Arguments:</b> Name + Object (Face) + 4 values (Min and Max U- and
+V-Parameters).
+
+
+\n <b>Example:</b>
+
+\image html extend_face_example.png "The original face (gray) and a result face shrinked along U-Direction and extended along V-Direction"
+
+\note The input Face U- and V-Parameters range is [0, 1]. If \b theUMin
+ parameter is negative, the input Face is extended, otherwise it is
+ shrinked along U-Direction by \b theUMin parameter. If \b theUMax is
+ greater than 1, the Face is extended, otherwise it is shrinked along
+ U-Direction by \b theUMax parameter. The same applies to \b theVMin, \b theVMax
+ and V-Direction of the input Face.
+
+Our <b>TUI Scripts</b> provide you with useful examples of the use of
+\ref tui_extend "Extension Operations".
+
+*/
<ul>
<li>\subpage partition_explanation "What is the difference between partition, compounds and fuse operation ?" </li>
+<li>\subpage size_models_range "What are the valid sizes of models ?" </li>
</ul>
--- /dev/null
+/*!
+\page fast_intersection_page Fast intersection
+
+This operation checks if two selected shapes are overlapped.
+
+This tool is useful for fast detection of intersections and gaps.
+In contrast to Boolean Operations, Partition and Detect Self-intersection
+algorithms that compute topological intersections, this algorithm computes
+intersections by generating tessellation (triangulation) of the source
+shapes and detecting overlapping of resulting meshes. High performance is
+achieved through the use of existing triangulation of faces.
+Due to this fact, the tool is not suitable for computing exact intersection
+of shapes; however, it can be used to quickly find zones where
+intersections can present, and then use these results in further analysis.
+
+\note For more information about Partition and Boolean Operations Algorithms
+and their limitations refer to <a href="SALOME_BOA_PA.pdf">this document</a>.
+
+\image html measures12.png
+
+\note This dialog supports navigation through the selectable objects (in OCC 3D viewer only):
+- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when input focus is
+in the viewer to navigate between selectable objects.
+- Press left mouse button to select an appropriate object to the dialog box.
+.
+For more details, please refer to the \em "Functionality common for OCC and VTK viewers" chapter
+of the GUI module's documentation.
+
+In this dialog:
+
+- <b> Object 1 </b> and <b> Object 2 </b> the checked objects. \b Selection button allows picking them in the viewer or in the object browser.
+- <b>Deflection coefficient</b> specifies the quality of shapes tessellation.
+- <b>Detect gaps</b> - when switched on, allows detecting gaps between shapes.
+- <b>Tolerance</b> - specifies the distance between shapes used for detecting gaps.
+- <b>Compute intersections</b> - press this button to compute interferences.
+- <b>Sub-shapes of Object 1</b> - list of sub-shapes from the first source shape that localize the intersection.
+- <b>Sub-shapes of Object 2</b> - list of sub-shapes from the second source shape that localize the intersection.
+- \b Apply and <b>Apply and Close</b> buttons are used to store selected intersected shapes in the study for
+further analysis (see below).
+
+\note The result quality depends on the quality of triangulation. Changing the value of the deflection coefficient
+parameter can strongly affect the result. However, small values of the deflection coefficient might lead to
+some performance loss of the algorithm, as number of triangles of the tesselation mesh depends on this parameter.
+
+Press <b>Apply and Close</b> or \b Apply button to store the selected sub-shapes in the study for further analysis.
+The selection will be published as a compound containing intersected sub-shapes from both source objects.
+
+<b>TUI Command:</b> <em>geompy.FastIntersect(theShape1, theShape2, theTolerance = 0.0, theDeflection = 0.001),</em> \n
+where:
+- \em theShape1 First shape.
+- \em theShape2 Second shape.
+- \em theTolerance When it is negative or equal to zero, the function detects intersections;
+ when it is positive, the function detects gaps.
+- \em theDeflection Linear deflection for shapes; if deflection <= 0, default deflection 0.001 is used
+
+<b>Result:</b> Boolean + two lists of IDs of sub-shapes (from input shapes) that localize the intersection.
+
+See also a \ref tui_fast_intersection_page "TUI example".
+
+*/
\ No newline at end of file
\image html repair10.png
+Press \b Apply or <b>Apply and Close</b> button to publish the corresponding faces in the study.
+
<b>TUI Command:</b> <em>GetFreeFacesIDs(Shape),</em> where \em Shape is
a shape to be checked.
See also a \ref tui_free_faces_page "TUI example".
-*/
\ No newline at end of file
+*/
\anchor pref_settings <h2>Settings</h2>
-In the \b Geometry module you can set preferences for visualisation of
-geometrical figures, which can be used in later sessions with this module.
-There is also a special group of preferences controlling input
-precision for floating-point data.
+In the \b Geometry module you can set preferences for visualization of
+geometrical figures, which can be used right now or in later sessions
+with this module according to the preferences.
+
\image html pref15.png
vertices.</li>
<li><b>Color of isolines</b> - allows to select default color for
isolines.</li>
+<li><b>Color of labels</b> - allows to select default color for
+labels (textual fields, shape name).</li>
<li><b>Top level color</b> - allows to select default color for objects which
were brought to the viewer foreground.</li>
<li><b>Top level display mode</b> - allows to select default top level display mode between:</li>
<li><b>Shading With Edges</b> - allows to switch display mode to shading with edges mode after
"top-level" operation.</li>
</ul>
-<li><b>Transparency</b> - allows to define default transparency value.</li>
-<li><b>Deflection coefficient</b> - allows to define default deflection
+<li><b>Default transparency</b> - allows to define default transparency value.</li>
+<li><b>Default deflection coefficient</b> - allows to define default deflection
coefficient for lines and surfaces. A smaller coefficient provides
better quality of a shape in the viewer.</li>
<li><b>Show predefined materials in popup menu</b> - allows to customize the displaying of popup menu with list of
predefined materials.</li>
<li><b>Default material</b> - allows to define default material.</li>
<li><b>Subshapes color for editing a group</b> - allows to select default color for subshapes in a group.</li>
-<li><b>Edges width</b> - allows to define default width of the edges.</li>
-<li><b>Isolines width</b> - allows to define default width of the isolines.</li>
+<li><b>Default edges width</b> - allows to define default width of the edges.</li>
+<li><b>Default isolines width</b> - allows to define default width of the isolines.</li>
<li><b>Preview edges width</b> - allows to define width of the edges for preview.</li>
<li><b>Measures line width</b> - allows to define lines width of measurements tools.</li>
<li><b>Step value for spin boxes</b> - allows to define the increment
</ul>
<ul>
-<li><b>Dimensions (Measurements)</b></li>
+<li><b>Dimensions (Measurements)</b> - a group of preferences controlling the presentation of dimensions.</li>
<ul>
<li><b>Color</b> - allows to define color for persistent dimension presentations.</li>
<li><b>Line width</b> - allows to define pixel width of dimension lines.</li>
</ul>
<ul>
-<li><b>Number of isolines</b> - allows to specify the number of isolines along <b>Along U</b> and <b>Along V</b> coordinate axes. They are shown on each selected face. For example:
+<li><b>Default number of isolines</b> - allows to specify the default number of isolines along <b>Along U</b> and <b>Along V</b> coordinate axes. They are shown on each selected face. For example:
\image html isos.png
</ul>
<ul>
-<li><b>Input fields precision</b></li>
+<li><b>Input fields precision</b> - a group of preferences controlling input
+precision for floating-point data.</li>
<ul>
<li><b>Length precision</b> - allows to adjust input precision of coordinates and dimensions.</li>
<li><b>Angular precision</b> - allows to adjust input precision of angles.</li>
</ul>
<ul>
-<li><b>Marker of Points</b></li>
+<li><b>Default marker of points</b></li>
<ul>
-<li><b>Type</b> - allows to select the symbol for representation of
+<li><b>Type</b> - allows to select the default symbol for representation of
points (cross, asterisk, etc.).</li>
-<li><b>Size</b> - allows to define the size of the marker from 1
+<li><b>Size</b> - allows to define the default size of the marker from 1
(smallest) to 7 (largest).</li>
</ul>
</ul>
-<ul>
-<li><b>Origin and base vectors</b></li>
-<ul>
-<li><b>Length of base vectors</b> - allows to define the length
-of base vectors.</li>
-<li><b>Auto create</b> - allows to automatically create a point
-of origin and three base vectors of the rectangular coordinate
-system immediately after the module activation.</li>
-</ul>
-</ul>
-
<ul>
<li><b>Scalar bar for field presentation</b></li>
<ul>
</ul>
</ul>
+<ul>
+<li><b>Origin and base vectors</b></li>
+<ul>
+<li><b>Length of base vectors</b> - allows to define the length
+of base vectors.</li>
+<li><b>Auto create</b> - allows to automatically create a point
+of origin and three base vectors of the rectangular coordinate
+system immediately after the module activation.</li>
+</ul>
+</ul>
<ul>
<li><b>Operations</b></li>
<ul>
<li><b>Preview</b> - allows to customize the displaying preview by default.</li>
+<li><b>Hide input objects from the viewer</b> - allows automatic hiding of input
+shapes from the 3D viewer (OCC and VTK) in all operations of Geometry module.</li>
</ul>
</ul>
\anchor pref_dependency_tree <h2>Dependency Tree</h2>
-Also user can set preferences for visualisation of <b>Dependency Tree</b> in 2D Viewer.
+This tab groups preferences for visualization of <b>Dependency Tree</b> in the 2D Viewer.
\image html pref_dep_tree.png
<ul>
<li><b>General</b></li>
<ul>
-<li><b>Hierarchy type</b> - allows to choose default displaying mode of dependency tree.</li>
-<li><b>Possibility to move nodes</b> - enable/disable the possibility of moving nodes by default.</li>
+<li><b>Hierarchy type</b> - allows to choose the default display mode of the dependency tree.</li>
+<li><b>Possibility to move nodes</b> - enables/disables the possibility of moving nodes by default.</li>
</ul>
</ul>
<ul>
<li><b>Color</b></li>
<ul>
-<li><b>Background color</b> - allows to select default background color.</li>
-<li><b>Default node color</b> - allows to select default node color.</li>
-<li><b>Main node color</b> - allows to select default main node color.</li>
-<li><b>Unpublished node color</b> - allows to select default node color
-for unpublished objects.</li>
-<li><b>Selected node color</b> - allows to select default selected node color.</li>
-<li><b>Default arrow color</b> - allows to select default arrow color.</li>
-<li><b>Highlighted arrow color</b> - allows to select default highlighted
-arrow color.</li>
-<li><b>Selected arrow color</b> - allows to select default selected
-arrow color.</li>
+<li><b>Background color</b> - allows to select the default background color.</li>
+<li><b>Default node color</b> - allows to select the default node color.</li>
+<li><b>Main node color</b> - allows to select the default main node color.</li>
+<li><b>Unpublished node color</b> - allows to select the default node color for unpublished objects.</li>
+<li><b>Selected node color</b> - allows to select the default selected node color.</li>
+<li><b>Default arrow color</b> - allows to select the default arrow color.</li>
+<li><b>Highlighted arrow color</b> - allows to select the default highlighted arrow color.</li>
+<li><b>Selected arrow color</b> - allows to select the default selected arrow color.</li>
</ul>
</ul>
<li>\ref tui_working_with_groups_page</li>
<li>\ref tui_building_by_blocks_page</li>
<li>\ref tui_sketcher_page</li>
+ <li>\ref tui_3dsketcher_page</li>
<li>\ref tui_advanced_geom_objs_page</li>
</ul>
<li>\subpage tui_viewing_geom_objs_page</li>
This operation retrieves all non-block solids and non-quadrangular faces from the selected shape.
-A non-block solid is a solid that does not have 6 faces, or has 6 faces, but some of them are not quadrangular.
+A block solid is a solid that has 6 quadrangular faces.
+
+A quadrangular face is a face that has 1 wire with 4 edges. If there are
+more than 4 edges in a single wire and C1 continuity mode is switched on,
+a face is quadrangular if it has 4 bounds of C1 continuity.
+
+All solids and faces from a shape that do not satisfy these conditions are
+returned by this operation.
\image html measures2.png
-\b Preview option shows non block solids and faces in the viewer.
+It is possible to select an \b Object to be explored, to check or uncheck
+<b>Use C1 criterion</b> option and to set the <b>Angular Tolerance</b>
+to check C1 continuity between neighbor edges in a wire.
-Press \b Apply or <b>Apply and Close</b> button to publish non block solids and faces in the Object
-Browser under the processed object. Solids and faces are published separately in two groups.
+\b Preview option shows non-block solids and non-quadrangular faces in the viewer.
+
+Press \b Apply or <b>Apply and Close</b> button to publish non-block solids
+and non-quadrangular faces in the Object Browser under the processed object.
+Solids and faces are published separately in two groups.
If no bad sub-shapes have been found, the corresponding warning is shown.
\image html measures2a.png
\n <b>TUI Command:</b>
-<em>geompy.GetNonBlocks(Compound).</em> Returns a tuple of two GEOM_Objects.
-
-The first object is a group of all non block solids; the second object is a group of all non
-quadrangular faces.
+<em>geompy.GetNonBlocks(theShape, theIsUseC1 = False, theAngTolerance = 1.e-12).</em> \n
+where \n
+\em theShape is the shape to explore, \n
+\em theIsUseC1 is the flag to check if there are 4 bounds on a face
+ taking into account C1 continuity, \n
+\em theAngTolerance the angular tolerance to check if two neighbor edges are
+ codirectional in the common vertex with this tolerance. This parameter is
+ used only if \em theIsUseC1 is set to True.
+
+This command returns a tuple of two GEOM_Objects.
+
+The first object is a group of all non-block solids; the second object is a group
+of all non-quadrangular faces.
See also a \ref tui_get_non_blocks_page "TUI example".
\n This operation glues edges that are coincident with respect to the
given tolerance value.
-\n <b>Arguments:</b> Name + Compound of shapes + Tolerance value.
+\n <b>Arguments:</b> Name + Shapes + Tolerance value.
\n <b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments".
\n The \b Result will be a \b GEOM_Object.
\image html glue4.png
\n <b>TUI Command:</b>
-\n <em>geompy.MakeGlueEdges(theShape,theTolerance)</em>,
-\n where \em theShape is a compound of shapes to be glued, and \em
- theTolerance is a maximum distance between two faces/edges, which can
- be considered as coincident.
+<p><em>geompy.MakeGlueEdges( theShapes, theTolerance )</em>,
+\n where \em theShapes is a list or compound of shapes to be
+glued, and \em theTolerance is a maximum distance between two
+edges, which can be considered as coincident.
\n It is also possible to manually select the edges that will be
glued - select the shape, specify the tolerance and press \b Detect button.
The selected edges will be marked in white.
\n <b>TUI Command:</b>
-\n <em>geompy.GetGlueEdges(theShape,theTolerance)</em>,
-\n where \em theShape is a compound of shapes to be glued, \em
+<p><em>geompy.GetGlueEdges( theShapes, theTolerance )</em>,
+\n where \em theShape is either a list or compound of shapes to be glued, \em
theTolerance is a maximum distance between two edges, which can
be considered as coincident. The \b Result will be a list of \b
- GEOM_Objects, containing one sub-shape per each detected set of
- coincident sub-shapes.
+ GEOM_Objects (edges), containing one sub-shape per each detected set of
+ coincident sub-shapes. For example, if there are two coincident edges
+in the selected shapes, the result list contains one of the two coincident edges.
-\n <em>geompy.MakeGlueEdgesByList(theShape,theTolerance,theEdges)</em>,
-\n where \em theShape is a compound of shapes to be glued, \em
- theTolerance is a maximum distance between two edges, which can
+<em>geompy.MakeGlueEdgesByList( theShapes, theTolerance, theEdges )</em>,
+\n where \em theShape is a list or compound of shapes to be glued,
+\em theTolerance is a maximum distance between two edges, which can
be considered as coincident, \em theEdges is a list of
- sub-shapes to be glued.
+ edges to be glued.
\n <b>Example:</b>
\image html glue8.png
-<center><em>Box with an edge that can be glued</em></center>
+<center><em>Two boxes with an edge that can be glued</em></center>
Our <b>TUI Scripts</b> provide you with useful examples of the use of
<b>Repairing Operations</b> \ref tui_glue_edges "Glue Edges".
\n This operation glues faces that are coincident with respect to the
given tolerance value.
-\n <b>Arguments:</b> Name + Compound of shapes + Tolerance value.
+\n <b>Arguments:</b> Name + Shapes + Tolerance value.
\n <b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments".
\n The \b Result will be a \b GEOM_Object.
\n <b>TUI Commands:</b>
-\n <em>geompy.MakeGlueFaces(theShape,theTolerance,doKeepNonSolids)</em>,
-\n where \em theShape is a compound of shapes to be glued, \em
+
+<em>geompy.MakeGlueFaces( theShapes, theTolerance, doKeepNonSolids )</em>,
+\n where \em theShapes is either a list or compound of shapes to be glued, \em
theTolerance is a maximum distance between two faces, which can
be considered as coincident. The \em doKeepNonSolids flag allows to
throw away non-solids from the result, if false. The \b Result will
possible to select the faces for gluing in the 3D viewer.
The selected faces will be marked in white.
-\n When the faces are glued their edges are glued as well. By default, other
+When the faces are glued their edges are glued as well. By default, other
edges are not glued. To force gluing of all edges, check <b>Glue all coincident edges</b>
-checkbox.
+check-box.
\n <b>TUI Commands:</b>
-\n <em>geompy.GetGlueFaces(theShape,theTolerance)</em>,
-\n where \em theShape is a compound of shapes to be glued, \em
- theTolerance is a maximum distance between two faces, which can
- be considered as coincident. The \b Result will be a list of \b
- GEOM_Objects, containing one sub-shape per each detected set of
- coincident sub-shapes.
-\n <em>geompy.MakeGlueFacesByList(theShape,theTolerance,theFaces,doKeepNonSolids,doGlueAllEdges)</em>,
-\n where \em theShape is a compound of shapes to be glued, \em
+<em>geompy.GetGlueFaces( theShapes, theTolerance )</em>,
+\n where \em theShapes is a list or compound of shapes to be glued, \em
+theTolerance is a maximum distance between two faces, which can
+be considered as coincident. The \b Result will be a list of \b
+GEOM_Objects (faces), containing one sub-shape per each detected set of
+coincident sub-shapes. For example if there are two coincident faces
+in selected shapes, the result list contains one of the two coincident faces.
+
+<em>geompy.MakeGlueFacesByList( theShapes, theTolerance, theFaces,
+ doKeepNonSolids, doGlueAllEdges )</em>,
+\n where \em theShapes is either a list or compound of shapes to be glued, \em
theTolerance is a maximum distance between two faces, which can
be considered as coincident, \em theFaces is a list of
sub-shapes to be glued. The \em doKeepNonSolids flag allows to throw
<em>To import geometrical objects from a BREP, IGES, STEP or STL file:</em>
\par
-From the \b File menu choose <b>Import/<FormatName></b>, where <b><FormatName></b> is a name
-of desirable format. In the <b>Import <FormatName></b> dialog box select the file to import
+From the \b File menu choose <b>Import/\<FormatName\></b>, where <b>\<FormatName\></b> is a name
+of desirable format. In the <b>Import \<FormatName\></b> dialog box select the file to import
and press \b Open. The file will be imported in the module and its contents (geometrical object)
will be displayed in the <b>Object Browser</b>.
\par
Select the object you wish to export, then from the \b File menu choose
-<b>Export/<FormatName></b>, where <b><FormatName></b> is a name of desirable format.
-In the <b>Export <FormatName></b> dialog box define the name and the location
+<b>Export/\<FormatName\></b>, where <b>\<FormatName\></b> is a name of desirable format.
+In the <b>Export \<FormatName\></b> dialog box define the name and the location
of the file to export and press \b Save.
The dialog box to export the file can provide additional advanced parameters.
- 3*3 matrix of its own moments of inertia (in rows <b> 1:1, 2:1</b> and <b>3:1</b>) and
- the relative moments of inertia (in row <b>IX & IY & IZ</b>)
-\n <b>TUI Command:</b> <em>geompy.Inertia(Shape),</em> where \em Shape is
+\note This dialog supports navigation through the selectable objects (in OCC 3D viewer only):
+- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when input focus is
+in the viewer to navigate between selectable objects.
+- Press left mouse button to select an appropriate object to the dialog box.
+.
+For more details, please refer to the \em "Functionality common for OCC and VTK viewers" chapter
+of the GUI module's documentation.
+
+<b>TUI Command:</b> <em>geompy.Inertia(Shape),</em> where \em Shape is
a shape for which the own matrix of inertia and the relative moments of inertia are
returned.
--- /dev/null
+/*!
+
+\page inspect_object_operation_page Inspect Object
+
+This operation allows browsing the contents of the selected shape.
+
+To <b>Inspect Object</b>, in the <b>Main Menu</b> select <b>Measures - > Inspect Object</b>.
+
+The dialog can be used in two modes. The first one is a tree view mode:
+\image html inspect_object.png "Dialog in the tree view mode"
+
+This is a default mode that allows to inspect an object in the form of tree
+starting from the shape itself. Its children are its direct sub-shapes that
+have they own children as sub-shapes etc. till most very base sub-shapes,
+i.e. vertices.
+
+The second mode is a filtering one. It is activated when the user selects
+<b>Tolerance filter</b> check box:
+\image html inspect_object2.png "Dialog in the filtering mode"
+
+In this mode the user can check the type of sub-shapes to work with using
+the radio-buttons. The type can be either \b Vertex, \b Edge or \b Face.
+Then the user choses a tolerance criterion to be applied to filter out
+sub-shapes. It is possible to chose one of the following values:
+- \b > - greater than (default value)
+- \b >= - greater than or equal to
+- \b < - lower than
+- \b <= - lower than or equal to
+
+The last parameter to be chosen is the tolerance value. The result is the shapes
+of a certain type that satisfy the defined tolerance criterion. E.g. if the user
+chooses \b Face, criterion \b > and tolerance value equal to \b 1.e-6 the faces
+with the tolerance greater than \b 1.e-6 are displayed.
+
+It is possible to set maximal and minimal value of the tolerance using the
+buttons <b>Max value</b> and <b>Min value</b>. These values are displayed in
+the labels <b>Max :</b> and <b>Min :</b>
+
+In this dialog never mind of its mode it is possible to:
+- Click on the "selection" button and select an object to inspect in the Object Browser or in the viewer.
+- Show/hide sub-shape(s) in the 3D viewer, by pressing "eye" icon in the first column of the tree view.
+- Show/hide all sub-shapes in the tree, by pressing "eye" icon in the first column of the tree view header or
+ by pressing <b>Show all</b>/<b>Hide all</b> buttons.
+- Rename the selected sub-shape by double-clicking on the item or pressing <F2> key.
+- Show the selected sub-shape(s) in the 3D viewer by pressing <b>Show Selected</b> button.
+- Show the selected sub-shape(s) in the 3D viewer and erase all currently shown objects by pressing <b>Show Only Selected</b> button.
+- Hide the selected sub-shape(s) from the 3D viewer by pressing <b>Hide Selected</b> button.
+- Publish the selected sub-shapes in the study, by pressing <b>Publish Selected</b> button.
+- Close dialog box, by pressing <b>Close</b> button.
+
+\n <b>TUI Command:</b>
+
+A command to filter sub-shapes is defined:
+
+<em>geompy.GetSubShapesWithTolerance(theShape, theShapeType, theCondition, theTolerance),</em> \n
+where \n
+\em theShape is the shape to be exploded. \n
+\em theShapeType is the type of sub-shapes to be returned. Can have
+ the values \b GEOM.FACE, \b GEOM.EDGE and \b GEOM.VERTEX only.\n
+\em theCondition is the condition type (the value of GEOM.comparison_condition emuneration).\n
+\em theTolerance is the tolerance filter.
+
+See also a \ref swig_GetSubShapesWithTolerance "TUI example".
+
+*/
\r
The buttons to the right of the list provide the following operations:\r
<ul>\r
-<li>"Add" - opens \ref add_dimension_page "Add Dimension" dialog to define a new fly-out.</li>\r
+<li>"Add" - opens "Add Dimension" dialog to define a new fly-out.</li>\r
<li>"Remove" - removes the selected item from the list.</li>\r
<li>"Show All" / "Hide All" - shows/hides all dimensions existing in the list.</li>\r
</ul>\r
Press \b Apply or <b>Apply and Close</b> button to create a set of closest
points, corresponding to all found solutions.
+\note This dialog supports navigation through the selectable objects (in OCC 3D viewer only):
+- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when input focus is
+in the viewer to navigate between selectable objects.
+- Press left mouse button to select an appropriate object to the dialog box.
+.
+For more details, please refer to the \em "Functionality common for OCC and VTK viewers" chapter
+of the GUI module's documentation.
+
<b>TUI Commands:</b>
-\n<em>aDist = geompy.MinDistance(Shape1, Shape2),</em>
-\n<em>[aDist, DX, DY, DZ] = geompy.MinDistanceComponents(Shape1, Shape2),</em>
-\n<em>[nbSols, (x11, y11, z11, x21, y21, z21, ...)] = geompy.ClosestPoints(Shape1, Shape2),</em>
-\n where \em Shape1 and \em Shape2 are the shapes, between which the minimal
+- <em>aDist = geompy.MinDistance(Shape1, Shape2),</em>
+- <em>[aDist, DX, DY, DZ] = geompy.MinDistanceComponents(Shape1, Shape2),</em>
+- <em>[nbSols, (x11, y11, z11, x21, y21, z21, ...)] = geompy.ClosestPoints(Shape1, Shape2),</em>
+.
+where \em Shape1 and \em Shape2 are the shapes, between which the minimal
distance is computed.
See also a \ref tui_min_distance_page "TUI example".
It provides a general review of the Partition and Boolean operations algorithms, describes the usage methodology and highlights
major limitations of these operations.
-Perhaps you also ask yourself : \ref partition_explanation "What's the difference between partition, compounds and fuse operation ?"
+Perhaps you also ask yourself : \ref partition_explanation "What's the difference between partition, compounds and fuse operation?"
-To produce a \b Partition in the <b>Main Menu</b> select <b>Operations - > Partition</b>
+To produce a \b Partition in the <b>Main Menu</b> select <b>Operations -> Partition</b>
-This operation builds a compound by intersection of several shapes
-with a set of tool objects or with a plane.
-The \b Result will be a \b GEOM_Object.
+This operation builds a compound by partitioning a set of input objects by a set of tool objects.
-<br><h2>Intersection of two shapes.</h2>
+The \b Result of the operation is a \b GEOM_Object.
\image html partition1.png
first list will be intersected with the shapes from the second list) +
Resulting Type of shape.
-As far as the intersection of two objects can produce any type of
+As far as the partition of two objects can produce any type of
geometrical objects, <b>Resulting type</b> box allows choosing the
preferable result, i.e. a solid, a shell, a list of faces, etc.
<b>No sub-shapes intersection (Compounds only)</b> check box affects
only input shapes of the Compound type.
- If this option is switched off (default behavior) each input compound will be automatically
-exploded into sub-shapes and the intersection between these shapes will be also computed.
-- If this option is switched on, the intersection between sub-shapes will not be performed.
+exploded into sub-shapes and the partition between these shapes will be also computed.
+- If this option is switched on, the partition between sub-shapes will not be performed.
In this case the Partition algorithm will work faster, but the result might differ from the
default behavior.
\note This algorithm does not find all types of self-intersections. It is tuned
to detect vertex/vertex, vertex/edge, edge/edge, vertex/face and edge/face
- intersections. Face/face intersections detection is switched off as it
+ interferences. Face/face interference detection is switched off as it
is a time-consuming operation that gives an impact on performance. To find
all self-intersections please use \ref check_self_intersections_page
"Detect Self-intersection tool".
- Other parameters are obsolete and kept only for compatibility with
previous versions of SALOME.
-<br><h2>Intersection of a Shape and a Plane.</h2>
-
-\image html partition2.png
-
-<b>Arguments:</b> Name + 1 shape to be intersected + 1 cutting plane.
-
-Activate \ref restore_presentation_parameters_page "Advanced options" if required.
-
-<b>TUI Command:</b>
-
-<em>geompy.MakeHalfPartition(Shape, Plane)</em>, where:
-- \em Shape is a source shape to be intersected by the \em Plane
-- \em Plane is a tool shape, to intersect the \em Shape.
-
<b>Examples:</b>
-\image html partitionsn1.png "Box intersected by a plane"
+\anchor partition_picture_1
+\image html partitionsn1.png "Input data: box intersected by plane"
-\image html partitionsn2.png "Result of intersection"
+\anchor partition_picture_2
+\image html partitionsn2.png "Result: box partitioned by plane"
\anchor partition_picture_3
-\image html partitionsn3.png "Result of intersection of a box and a plane (both as \em Objects, no tools) with the Resulting type \em Solid and checked 'Keep shapes of lower type'"
+\image html partitionsn3.png "Result: partitioned box and plane (both as \em Objects); resulting type is \em Solid; option 'Keep shapes of lower type' is on"
Our <b>TUI Scripts</b> provide you with useful examples of \ref tui_partition "Basic Operations".
--- /dev/null
+/*!
+
+\page projection_on_cylinder_operation_page Projection on Cylinder
+
+\n To produce a <b>Projection on Cylinder</b> in the <b>Main Menu</b> select
+<b>Operations - > Transformation - > Projection on Cylinder</b>
+
+\n This operation makes a projection of a <b>Source planar wire or face</b> on
+a cylinder defined by its radius. The cylinder's coordinate system is
+the same as the global coordinate system. The result represents a wire or
+a face that represents a projection of the source shape onto a cylinder.
+
+To make a projection it is necessary to define:
+- \b Object to be projected. It can be either a planar wire or a face;
+- \b Radius of the cylinder;
+- <b>Starting angle</b> from the cylinder's X axis around Z axis. This is
+the angle of the projection start.
+- <b>Length angle</b> where the total length of
+the wire should be projected. If it is unchecked the projection is not scaled and the natural
+wire length is kept for the projection.
+- <b>Rotation angle</b> the angle between the tangent vector to
+the first curve at the first point of the object projection in 2D space
+and U-direction of the cylinder in 2D space.
+- \ref restore_presentation_parameters_page "Advanced options".
+
+\image html proj_on_cyl_dlg.png
+
+\n The following figure explains the meaning of each input angle:
+
+\image html proj_on_cyl_angles.png "Input angles of projection on the cylinder"
+
+\n <b>Example:</b>
+
+\image html proj_on_cyl_preview.png "The curve (in red) and its projection on the cylinder"
+
+\n <b>TUI Command:</b> <em>geompy.MakeProjectionOnCylinder(theObject, theRadius,
+theStartAngle=0.0, theAngleLength=-1.0, theAngleRotation=0.0),</em>
+where \em theObject is a shape to be projected, \em theRadius
+is a cylinder radius, \em theStartAngle is the starting angle of projection in
+radians, \em theAngleLength the projection length angle in radians,
+\em theAngleRotation projection rotation angle in radians.
+The \em Result will be a \em GEOM_Object.
+
+Our <b>TUI Scripts</b> provide you with useful examples of the use of
+\ref tui_projection "Transformation Operations".
+
+*/
/*!
-\page projection_operation_page Projection on a Face
+\page projection_operation_page Projection
-\n To produce a <b>Projection</b> in the <b>Main Menu</b> select
+To produce a <b>Projection</b> in the <b>Main Menu</b> select
<b>Operations - > Transformation - > Projection</b>
-\n This operation makes normal projection of a <b>Source vertex, edge
- or wire</b> on a given <b>Target face</b>.
-\ref restore_presentation_parameters_page "Advanced options".
+This operation makes normal projection of one shape to another.
+
+There are 3 types of projection different by types of operands.
+
+Firstly, you can project <b>Source vertex, edge or wire</b> on a given <b>Target face</b>.
\image html projection_dlg.png
-\n <b>Example:</b>
+Secondly, you can project <b>Source vertex</b> on a given <b>Target wire</b>.
+
+\image html projection_dlg1.png
+
+Thirdly, you can project <b>Source vertex</b> on a given <b>Target edge</b>.
+
+\image html projection_dlg2.png
+
+\ref restore_presentation_parameters_page "Advanced options".
+
+\note This dialog supports navigation through the selectable objects (in OCC 3D viewer only):
+- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when input focus is
+in the viewer to navigate between selectable objects.
+- Press left mouse button to select an appropriate object to the dialog box.
+.
+For more details, please refer to the \em "Functionality common for OCC and VTK viewers" chapter
+of the GUI module's documentation.
+
+<b>Example:</b>
\image html projection_preview.png "The curve (in red) and its projection on the cylindric surface"
-\n <b>TUI Command:</b> <em>geompy.MakeProjection(Source, Target),</em>
- where \em Source is a shape which has to be projected, \em Target
- is a face, on which the \em Source shape will be projected. The \em
- Result will be a \em GEOM_Object.
+<b>TUI Command:</b> <em>geompy.MakeProjection(Source, Target),</em>
+\n where \em Source is a shape which has to be projected, \em Target
+is a shape, on which the \em Source shape will be projected. The \em
+Result will be a \em GEOM_Object.
Our <b>TUI Scripts</b> provide you with useful examples of the use of
\ref tui_projection "Transformation Operations".
\page reduce_study_page Reduce Study
-The user sometimes needs to keep in the study only some objects that
+It can be sometimes necessary to keep in the study only the objects that
present the final result(s) of the design operations and to delete all
-other objects which do not contribute to these results.
+other objects, which do not contribute to these results.
-The feature is especially useful when the user designs the whole model
-through the GUI and wants to generate simplified "clean" Python dump only
-at the end of the model construction with no "useless" objects in the
-%GEOM module.
+This is especially useful when the model is designed using the GUI
+and it is necessary to generate a simplified "clean" Python dump without "useless" objects
+at the end of the model construction.
-User can open dialog box by selecting desirable object(s) in Object
-Browser or OCC Viewer and calling "Reduce study" popup item.
+This feature can be activated by selecting the desirable object(s) in Object
+Browser or OCC Viewer and calling "Reduce study" context item.
\image html reduce_study_dialog.png
<ul>
<li><b> Objects to be kept</b> - objects that will be kept in the study after
-applying operation of reduce study. The list of objects being selected by
+applying reduce study operation. The objects selected by
the user are highlighted in bold font.</li>
<li><b> Objects to be removed</b> - objects that will be deleted.</li>
-\note Mentioned views provide possibility to show/hide object(s) in
-current Viewer using "eye" icon near each item of tree. Also user can
-show/hide ALL objects in tree by clicking "eye" icon in the head of tree view.
+\note It is possible to show/hide object(s) in the
+current Viewer using "eye" icon next to each tree item.
+ALL objects in the tree can be shown/hidden by clicking the "eye" icon in the head of the tree view.
+
+<li><b> Intermediate objects</b> group box allows choosing what should be done with the objects that are used to produce the selected object(s):
+<li><b> Sub-objects</b> group box allows choosing the same operations for
+sub-objects of the selected object(s).</li>
-<li><b> Intermediate objects</b> group box allows to choose an action
-that will be performed with the objects that took part in the operations
-chain to produce the selected object(s):
<ul>
<li>Keep - object(s) will be kept in the study;</li>
<li>Unpublish - object(s) will be unpublished (hidden) from the study;</li>
<li>Remove - object(s) will be removed from the study. \note Since use of
-this option can lead to the broken Dump Python script, the warning message
-will be shown at the operation commiting to confirm/reject removing
-intermediate objects.</li>
+this option can cause a broken Dump Python script, the warning message
+is shown confirm/reject removing intermediate objects.</li>
</ul>
</li>
-<li><b> Sub-objects</b> group box allows to choose the same operations for
-sub-objects of selected item(s): keep, unpublish or remove.</li>
-<li><b> Remove empty folders</b> - if this option is checked, then all folders,
+<li><b> Remove empty folders</b> - if this option is checked, all folders,
which will become empty after removing unused objects from the study,
will be also removed; otherwise, empty folders will be kept.</li>
-<li><b> Soft removal</b> - if this option is checked, operation will just
-unpublish the redundant objects from the study instead of their hard delete.
-\n Soft removal would keep all the data in the study to give the user a
+<li><b> Soft removal</b> - if this option is checked, the operation will
+unpublish the redundant objects from the study instead of deleting them.
+\n So, soft removal keeps all data in the study to give the user a
chance to revert this operation using \ref publish_hidden_objects
"Publish Objects" dialog box.</li>
\n To <b>Remove internal faces</b> in the <b>Main Menu</b> select
<b>Repair - > Remove internal faces</b>.
-\n This operation removes all shared faces from a compound to obtain
+This operation removes all shared faces from given solids to obtain
one or more bigger solids from a set of smaller solids.
\image html remove_webs.png
-\n <b>Arguments:</b> Name + one shape.
+\n <b>Arguments:</b> Name + one or more shapes containing solids.
\n <b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments".
\note Only shared faces will be removed. Coincident but not shared
-faces will stay as is, use Glue Faces or Partition before
-Remove Internal Faces if you need to remove them.
+faces will stay as is, use \ref glue_faces_operation_page or \ref partition_page before
+<b>Remove Internal Faces</b> if you need to remove them.
-\n <b>TUI Command:</b> <em>geompy.RemoveInternalFaces(theCompound)</em>,
-where <em>theCompound</em> is a compound of solids.
+\n <b>TUI Command:</b> <br>
+<em>geompy.RemoveInternalFaces( theSolids )</em>,<br>
+where <em>theSolids</em> is either a compound or a list of solids.
\n Our <b>TUI Scripts</b> provide you with useful examples of the
\ref tui_remove_webs "Remove Internal Faces" functionality usage.
holes with free boundaries on a selected face.</li>
<li>\subpage sewing_operation_page "Sewing" - sews faces or shells.</li>
<li>\subpage glue_faces_operation_page "Glue faces" - unites
-coincident faces within the given tolerance.</li>
+faces coincident within the given tolerance.</li>
<li>\subpage glue_edges_operation_page "Glue edges" - unites
-coincident edges within the given tolerance.</li>
+edges coincident within the given tolerance.</li>
<li>\subpage limit_tolerance_operation_page "Limit Tolerance" - tries
to set new tolerance value for the given shape.</li>
<li>\subpage add_point_on_edge_operation_page "Add point on edge" -
<li>\subpage change_orientation_operation_page "Change orientation" -
reverses the normals of the selected faces.</li>
<li>\subpage remove_webs_operation_page "Remove internal faces" -
-rebuilds the topology of a compound of solids by removing the faces
+rebuilds the topology of solids by removing the faces
are shared by several solids.</li>
<li>\subpage remove_extra_edges_operation_page "Remove extra edges" -
removes seam and degenerated edges from the given shape.</li>
/*!
-\page section_opeartion_page Section
+\page section_opeartion_page Intersection
-\b Section operation creates an edge or a wire representing the intersection of surfaces of two shapes.
+\b Intersection operation creates a vertex, an edge, a wire or a compound
+of them representing the intersection of two shapes.
-To produce it, select in the main menu <b>Operations - > Boolean - > Section</b>
+To produce it, select in the main menu <b>Operations - > Boolean - > Intersection</b>
-\image html neo-section.png "Section dialog"
+\image html neo-section.png "Intersection dialog"
In this dialog:
- Input or accept the default \b Name of the resulting shape.
- Click the arrow button and select in the Object Browser or in the Viewer the intersecting <b>Objects</b>.
-- Activate the corresponding check-box if you wish to <b> Detect Self-intersections </b>.
+- Activate the corresponding check-box if you wish to <b> Detect Self-intersections</b>. If a self-intersection detected the operation fails.
- Activate \ref restore_presentation_parameters_page "Advanced options" if required.
-- Press "Apply" or "Apply & Close" button to get the result (EDGE or WIRE).
-
-\note This algorithm does not find all types of self-intersections. It is tuned
- to detect vertex/vertex, vertex/edge, edge/edge, vertex/face and edge/face
- intersections. Face/face intersections detection is switched off as it
- is a time-consuming operation that gives an impact on performance. To find
- all self-intersections use \ref check_self_intersections_page
- "Detect Self-intersection tool".
-
+- Press "Apply" or "Apply & Close" button to get the result (VERTEX, EDGE, WIRE or COMPOUND).
+
+\note This dialog supports navigation through the selectable objects (in OCC 3D viewer only):
+- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when input focus is
+in the viewer to navigate between selectable objects.
+- Press left mouse button to select an appropriate object to the dialog box.
+.
+For more details, please refer to the \em "Functionality common for OCC and VTK viewers" chapter
+of the GUI module's documentation.
+
This operation can be performed using a <b>TUI Command:</b>
<em>geompy.MakeSection(s1, s2, checkSelfInte)</em>
\page sewing_operation_page Sewing
+\b Sewing operation allows uniting several faces (possibly contained
+in a shell, solid or compound) into one shell. Geometrically
+coincident (within a specified tolerance) edges (or parts of edges) of
+different faces are replaced by one edge thus producing a shell of
+faces with shared boundaries.<p>
+This operation is similar to <b>New Entity - > Build - > Shell</b>
+operation, the difference is that with \b Sewing you can specify the
+tolerance and get a non-manifold result. <p>
+The possibility to create a non-manifold shell can be used e.g. to create a
+shell forming several closed domains and then to create several solids
+with shared boundaries from this shell.
+
+\note Geometrically coincident faces (or parts of faces) will not be
+replaced by one face during \b Sewing.
+
To produce a \b Sewing operation in the <b>Main Menu</b> select <b>Repair - > Sewing</b>.
-The \b Result will be a \b GEOM_Object.
+The \b Result will be a \b GEOM_Object (shell).
\image html repair6.png
possible face size.</li>
</ul>
<li><b>Drop Small Edges</b> (DropSmallEdges) - removes edges, which
-merge with neighbouring edges.</li>
+merge with neighboring edges.</li>
<ul>
<li><b>3D Tolerance</b> (DropSmallEdges.Tolerance3d) - defines minimum
possible distance between two parallel edges.</li>
</ul>
+<li><b>Drop Small Solids</b> (DropSmallSolids) - removes small
+ solids or merges them with neighboring ones.</li>
+<ul>
+<li><b>Width factor tol.</b> (DropSmallSolids.WidthFactorThreshold) -
+ defines the maximum value of <em>2V/S</em> of a solid, which is
+ considered small, where \a V is the volume and \a S is the surface area of
+ the solid.</li>
+<li><b>Volume tol.</b> (DropSmallSolids.VolumeThreshold) - defines
+ the maximum volume of a solid, which is considered small.</li>
+<li><b>To merge solids</b> (DropSmallSolids.MergeSolids) - if
+ activated, small solids are removed, else small solids are merged to
+ adjacent non-small solids or left untouched if they cannot be merged.
+</li>
+</ul>
+If the both tolerances are activated a solid is considered small if
+it meets both criteria.
<li><b>Split Angle</b> (SplitAngle) - splits faces based on conical
surfaces, surfaces of revolution and cylindrical surfaces in segments
using a certain angle.</li>
--- /dev/null
+/*!
+
+\page shape_statistics_operation_page Shape Statistics
+
+This operation allows plotting a distribution histogram for the numerical parameters and creating the corresponding geometrical groups of the given shape.
+
+To call <b>Shape Statistics</b> dialog box, in the <b>Main Menu</b> select <b>Inspection - > Shape Statistics</b>.
+
+\image html shape_statistics.png
+
+In this dialog:
+- "Selected objects" standard selection box allows selecting one or more geometrical objects.
+
+- "Type" combo-box with the following items: "Edges length", "Faces area", "Solids volume".
+\note "Type" combo-box includes only parameters applied to the currently selected shape (e.g. "Solids volume" will not be available for a selected face or shell); multiple selection is processed correspondingly (i.e. only types applicable for all selected shapes will be available).
+
+- "Number of intervals" spin box is used to specify number of distribution histogram ranges.
+
+- "Scalar range" checkable group box, when switched ON, allows specifying custom values range used for plotting and creating groups.
+\note By default, "Scalar range" controls are empty; pressing "Compute" button allows automatically computing the initial range of the chosen parameter. This is necessary as the computation of the parameters range can be time-consuming for large or complex models. In case of multiple selection, the scalar range is computed for all selected shapes.
+
+- "Plot" button opens or uses an opened Plot2d viewer and plots the distribution histogram for the selected shape(s).
+
+- "Create groups" button allows creating groups according to the currently specified parameters. The group names will include numerical values of the range, e.g. "Edges_length_0-20", "Edges_length_20-40", etc. Empty groups are not created.
+
+- Close dialog box, by pressing <b>Close</b> button.
+
+\note This functionality is available only if GUI module is built with Plot 2D Viewer (option SALOME_USE_PLOT2DVIEWER is ON when building GUI module).
+
+*/
This operation is a special case of <b>Explode</b> operation. It
produces sub-shapes of the exploded shape (the first shape in the list
-of argument shapes), which are shared with all other shapes in the
-arguments.
+of argument shapes), which are shared with other shapes in the
+arguments. The argument shapes can also be contained in a compound or
+group.
To use this operation, select in the Main Menu <b>Operations -> Get
Shared Shapes.</b> The following dialog box will appear.
\image html shared_shapes.png
-<ul>
-<li> <b>Name</b> is the base name of the resulting shapes; </li>
-<li> <b>Shapes</b> are the shapes to fing shared sub-shapes of; </li>
-<li> <b>Sub-shapes Type</b> is the type of required sub-shapes; </li>
-</ul>
+In this dialog:
+- <b>Name</b> is the base name of the resulting shapes.
+- <b>Shapes</b> are the shapes whose shared sub-shapes should be found.
+- <b>Sub-shapes Type</b> is the type of required sub-shapes.
+- <b>Shared by all</b> option specifies what type of shared sub-shapes should be checked:
+ - \b On: searches for sub-shapes from the first input shape shared with all other input shapes;
+ - \b Off: searches for sub-shapes shared between couples of input shapes.
-\n <b>Advanced options</b> \ref preview_anchor "Preview"
+\note For the case when "Shared by all" option is switched off - if an input list of shapes
+contains a single compound, the sub-shapes shared between all possible couples of its top-level shapes
+are searched for; otherwise, only sub-shapes that are shared between the first input shape and
+all other input shapes are searched.
-\n <b>TUI Command:</b> <em> geompy.GetSharedShapesMulti(Shapes,
-Type),</em> where \em Shapes is a list of shapes to fing shared sub-
-shapes of and \em Type is the type of required sub-shapes.
+<b>Advanced options:</b> \ref preview_anchor "Preview"
+
+<b>TUI Command:</b> <em> geompy.GetSharedShapesMulti( Shapes, Type ),</em>
+<br> where \em Shapes is a list or compound of shapes, whose shared sub-
+shapes should be found and \em Type is the type of required sub-shapes.
Our <b>TUI Scripts</b> provide you with useful examples of the use of
-\ref swig_GetSharedShapes "Get Shared Shapes" functionality.
+Get Shared Shapes functionality:
+- \ref tui_shared_shapes "Example 1"
+- \ref swig_GetSharedShapes "Example 2"
*/
--- /dev/null
+/*!
+
+\page size_models_range Sizes of Models in Salome
+
+\tableofcontents
+
+In Salome and Open CASCADE Technology (OCCT), which is a modeling core
+of Salome %GEOM module, any model has its location in the 3D-space and size.
+
+This document defines the range of values (tolerances, locations
+and sizes) that should be taken into account for any 3D model design.
+
+It is not obligatory to create models within this range,
+however, algorithms can fail or return unexpected results if the
+recommendations are not followed.
+
+\section sec1 Maximal Size of the Model
+
+The Maximal Size of the model corresponds to the maximal diameter of
+enclosed sphere built for the model. In OCCT any model has a location defined
+relatively to the absolute origin. Thus the maximal diameter should be built
+taking into account the model itself and its location.
+
+In OCCT there are two tolerances: Tolerance Confusion (TolC)
+and Tolerance Angular (TolA) (see OCCT Precision package for more details).
+These values are used for geometric comparisons. However, they are not used inside
+low-level algorithms (e.g. intersection), where more precise values are
+used instead. The value TolC guarantees that the error associated with
+the computations for a given geometric entity is not greater than TolC.
+
+- TolC - precision value used to check the coincidence of two points
+ [by default 1.e-7];
+- TolA - precision value used to check the equality of two angles
+ [by default 1.e-12].
+
+For more information on tolerance definition please see
+<a href="SALOME_BOA_PA.pdf">Chapter 4 of this document</a>. To see limitations
+that are due to modeling errors or inaccuracies of tolerance usage please
+refer to <a href="SALOME_BOA_PA.pdf">Chapter 9.2.2 of the same document</a>.
+
+To provide robust geometric modeling the computations should be consistent,
+i.e. the one tolerance value should be used for all computations. Thus, the
+TolC and TolA values should be consistent:
+
+<CENTER><B><PRE>Smax = TolC / TolA (1)</PRE></B></CENTER>
+
+\image html tolerances.png "TolC, TolA and Maximal Size Consistency"
+
+In accordance with <B>(1)</B> the Maximal Size for the Model is [by default]:
+
+<CENTER><B><PRE>Smax = 1.e-7 / 1.e-12 = 1.e+5 (2)</PRE></B></CENTER>
+
+\section sec2 Minimal Size of the Model
+
+The Minimal Size of the Model is defined as the maximal diameter of enclosed
+sphere built for the smallest BRep entity of the Model.
+
+All models in OCCT are represented using double precision
+floating point numbers. This representation contains approximately 14-16
+significant digits.
+
+From the experience, it is considered that the last four significant
+digits contain rounding-off errors occurring during the computation. So
+(taking into account the worst cases), there are ten reliable significant digits
+for double precision floating point numbers. Having the estimation it is
+possible to compute the value of the Minimal size of the model:
+
+<CENTER><B><PRE>Smin=Smax / 1.e+10 (3)</PRE></B></CENTER>
+
+In accordance with <B>(2)</B> for the default value it will be [by default]:
+
+<CENTER><B><PRE>Smin=1.e-5. (4)</PRE></B></CENTER>
+
+\section sec3 Full Range of Sizes
+
+The values <B>Smax (2)</B>, <B>Smin (4)</B> are theoretical. Taking into
+account the practical purposes of improving the reliability, the lower limit
+should be restricted by one order. Thus, the full Range of Sizes of the Models
+is:
+
+<CENTER><B><PRE>[Smin, Smax] = [1.e-4, 1.e+5] (5)</PRE></B></CENTER>
+
+*/
The table displays \b Min and \b Max tolerance values for \b Face, \b Edge and \b Vertex tolerance.
-\n <b>TUI Command:</b> <em>geompy.Tolerance(Shape),</em> where \em Shape
+\note This dialog supports navigation through the selectable objects (in OCC 3D viewer only):
+- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when input focus is
+in the viewer to navigate between selectable objects.
+- Press left mouse button to select an appropriate object to the dialog box.
+.
+For more details, please refer to the \em "Functionality common for OCC and VTK viewers" chapter
+of the GUI module's documentation.
+
+<b>TUI Command:</b> <em>geompy.Tolerance(Shape),</em> where \em Shape
is a shape for which minimal and maximal tolerances are returned.
See also a \ref tui_tolerance_page "TUI example".
--- /dev/null
+/*!
+
+\page transfer_data_page Transfer Data
+
+This operation performs copying of non-topological data
+from one shape to another. The topology of the destination object
+will not change, only non-topological data will be transferred
+(if it is present in the source object). It is possible to transfer
+the following data with this operation:
+<ul>
+<li> <b>Names</b></li>
+<li> <b>Materials</b></li>
+</ul>
+
+To use this operation, select in the Main Menu <b>Operations -> Transfer Data</b>.
+The following dialog box will appear.
+
+\image html transfer_data1.png "Transfer Data Dialog"
+
+In this dialog:
+<ul>
+<li> <b>Source Shape</b> is an object that is a source of non-topological data.</li>
+<li> <b>Destination Shape</b> is a data destination object. </li>
+<li> <b>Type of detection operation</b> allows choosing how to search sub-shapes of the
+ <b>Source Shape</b> in the <b>Destination Shape</b>. The data are transferred
+ from these corresponding sub-shapes. The following methods are possible:
+ <ul>
+ <li><b>Get In Place</b> - the current implementation of Get In Place algorithm
+ (default value).</li>
+ <li><b>Get In Place (old)</b> - the old implementation of Get In Place
+ algorithm.</li>
+ <li><b>Get In Place By History</b> - Get In Place By History algorithm.</li>
+ </ul>
+</li>
+</ul>
+
+To copy the data click on \b Apply or <b>Apply and Close</b> button.
+It is possible to see how many names and materials are copied as well as
+the maximum number of names and materials available for copying. This information is
+provided in the following message box:
+
+\image html transfer_data2.png "Transfer Data Information"
+
+<b>TUI Command:</b> <em>geompy.TransferData(ObjectFrom, ObjectTo, FindMethod),</em>
+<br> where \em ObjectFrom is a data source object, \em ObjectTo is a
+destination object and \em FindMethod is a same shape detection method with
+default value \em GEOM.FSM_GetInPlace.
+
+Our <b>TUI Scripts</b> provide you with useful example of the use of
+\ref swig_TransferData "Transfer Data" functionality.
+
+*/
<li>\subpage scale_operation_page "Scale" an object by one or several scale factors.</li>
<li>Create an \subpage offset_operation_page "Offset" of an object.</li>
<li>Create a \subpage projection_operation_page "Projection" of an object on a face.</li>
+<li>Create an \subpage extension_operation_page "Extension" of an edge or a face.</li>
+<li>Create a \subpage projection_on_cylinder_operation_page "Projection on cylinder".</li>
<li>Create a simultaneous \subpage multi_translation_operation_page "Translation in several directions".</li>
<li>Create a simultaneous \subpage multi_rotation_operation_page</li> "Rotation in several directions".</li>
</ul>
special case of \b Explode operation. </li>
<li>\subpage shared_shapes_page "Get shared shapes" operation, a
special case of \b Explode operation. </li>
+<li>\subpage transfer_data_page "Transfer Data" operation, which copies
+non-topological data from one shape to another. </li>
<li>\subpage restore_presentation_parameters_page "Restore presentation parameters".
<br><h2>Creation of a Local Coordinate System</h2>
\tui_script{basic_geom_objs_ex09.py}
+\anchor tui_creation_surface
+<br><h2>Creation of a Surface From Face</h2>
+\tui_script{basic_geom_objs_ex10.py}
+
+\anchor tui_creation_polyline
+<br><h2>Creation of 2D Polyline</h2>
+\tui_script{polyline.py}
+
*/
<br><h2>Restore presentation parameters and sub-shapes</h2>
\tui_script{basic_operations_ex03.py}
+\anchor tui_shared_shapes
+<br><h2>Get shared shapes</h2>
+\tui_script{basic_operations_ex04.py}
+
*/
\tui_script{boolean_operations_ex03.py}
\anchor tui_section
-<br><h2>Section</h2>
+<br><h2>Intersection</h2>
\tui_script{boolean_operations_ex04.py}
*/
--- /dev/null
+/*!
+
+\page tui_check_self_intersections_fast_page Detect Self-intersections fast
+\tui_script{check_self_intersections_fast.py}
+
+*/
<br><h2>Creation of Tangent Plane On Face</h2>
\tui_script{complex_objs_ex10.py}
+\anchor tui_creation_thickness
+<br><h2>Applying a Thickness to Face, Shell or Solid</h2>
+\tui_script{complex_objs_ex11.py}
+
*/
--- /dev/null
+/*!
+
+\page tui_fast_intersection_page Fast intersection
+\tui_script{fast_intersection.py}
+
+*/
<li>\subpage tui_check_compound_of_blocks_page</li>
<li>\subpage tui_get_non_blocks_page</li>
<li>\subpage tui_check_self_intersections_page</li>
+<li>\subpage tui_check_self_intersections_fast_page</li>
+<li>\subpage tui_fast_intersection_page</li>
</ul>
*/
+++ /dev/null
-/*!
-
-\page tui_polyline_page 2D Polyline
-\tui_script{polyline.py}
-
-*/
\until Line3
\anchor swig_all_advanced
-\until MakeSewing
+\until Thicken
\anchor swig_MakeCopy
\until MakeCopy
\until Scale4
\anchor swig_all_trsf_more
-\until MakeOffset
+\until MakeProjectionOnCylinder
\anchor swig_ChangeOrientation
\until ChangeOrientation
+\anchor swig_ExtendFaceEdge
+\until ExtendFace
+
+\anchor swig_SurfaceFromFace
+\until MakeSurfaceFromFace
+
\anchor swig_ExtractShapes
\until prism_edges
+\until IDlist_f
+
\anchor swig_FilletChamfer
\until End of Local operations
\anchor swig_all_patterns
-\until MultiRot2D
+\until MultiRot2Ds
\anchor swig_all_measure
\until "CheckShape(Prism) = "
\until nameS
\anchor swig_all_decompose
+\until geompy.RestoreSubShapes(Partition1)
+
+\anchor swig_GetSubShapeEdgeSorted
+\until geompy.GetSubShapeEdgeSorted(Sketcher3d_2, p3, "OrderedEdges")
+
+\anchor swig_GetSubShapesWithTolerance
\until print "DONE"
*/
\until CheckShape
\anchor swig_CheckShape
-\until MakeCompound
+\until Detect Self-intersections
\anchor swig_CheckSelfIntersections
+\until Detect Self-intersections fast
+
+\anchor swig_CheckSelfIntersectionsFast
+\until Fast intersection
+
+\anchor swig_FastIntersection
\until WhatIs
\anchor swig_WhatIs
\anchor swig_GetSharedShapes
\until "sharedEdge_"
+\anchor swig_TransferData
+\until subBlackWhite[1]
+
\anchor swig_CheckAndImprove
\until "blocksComp"
<br><h2>Creation of a Solid</h2>
\tui_script{topological_geom_objs_ex05.py}
+\anchor tui_creation_solid_from_faces
+<br><h2>Creation of a Solid from the set of connected faces</h2>
+\tui_script{topological_geom_objs_ex07.py}
+
\anchor tui_creation_compound
<br><h2>Creation of a Compound</h2>
\tui_script{topological_geom_objs_ex06.py}
<br><h2>Chamfer</h2>
\tui_script{transformation_operations_ex13.py}
+\anchor tui_extend
+<br><h2>Extend Edge and Face</h2>
+\tui_script{transformation_operations_ex14.py}
+
*/
of a list of objects into an independent object.</li>
<li>\subpage cut_operation_page "Cut" - cuts one shape with
a list of others. </li>
-<li>\subpage section_opeartion_page "Section" - creates a section between two shapes.</li>
+<li>\subpage section_opeartion_page "Intersection" - performs an intersection between two shapes.</li>
</ul>
You can use advanced TUI commands performing these operations
the list of tools for Cut operation;
\par
<em>geompy.MakeSection(Shape1, Shape2, checkSelfInte)</em>, where \em Shape1 is the first
-argument and \em Shape2 is the second argument of Section operation;
+argument and \em Shape2 is the second argument of Intersection operation;
There are several TUI commands that can be used to perform boolean operations
<em>geompy.MakeBoolean(Shape1, Shape2, Operation, checkSelfInte),</em> where \em
Shape1 is the first argument and \em Shape2 is the second argument of
a Boolean operation, \em Operation is the type of a Boolean operation (1
-— Common, 2 — Cut, 3 — Fuse, 4 — Section).
+— Common, 2 — Cut, 3 — Fuse, 4 — Intersection).
Besides, you can use advanced TUI commands performing these operations
<li>\subpage tolerance_page "Tolerance"</li>
<li>\subpage managing_dimensions_page "Dimensions"</li>
<li>\subpage whatis_page "WhatIs"</li>
+<li>\subpage inspect_object_operation_page "Inspect Object"</li>
+<li>\subpage shape_statistics_operation_page "Shape Statistics"</li>
</ul>
\n To check their integrity:
<li>\subpage check_compound_of_blocks_page "Check compound of blocks"</li>
<li>\subpage get_non_blocks_page "Get non blocks"</li>
<li>\subpage check_self_intersections_page "Detect Self-intersections"</li>
+<li>\subpage fast_intersection_page "Fast intersection"</li>
</ul>
\n Our <b>TUI Scripts</b> show how to use
<li><b>Show all dimensions</b> - shows all of the persistent dimensions created for the selected geometrical object.</li>
<li><b>Hide all dimensions</b> - hides all of the persistent dimensions created for the selected geometrical object.</li>
-<li>\subpage dependency_tree_page "Show dependency tree" - shows dependency tree of selected objects
-in new 2D View Window.</li>
-<li>\subpage reduce_study_page "Reduce study" - allows to reduce study
-by automatic removing objects according to user's options.</li>
+<li>\subpage dependency_tree_page "Show dependency tree" - shows the dependency tree with parents and children of the selected object
+in a new 2D View Window.</li>
+<li>\subpage reduce_study_page "Reduce study" - allows reducing the study by removing objects from it.</li>
<li><b>Dump view</b> - exports an object from the viewer in bmp, png,
jpg or jpeg image format.</li>
<li><b>Change background</b> - allows to redefine the background
\page whatis_page What Is ?
-This operation provides the list of types and quantities of all topological entities, composing
-the selected geometrical object.
+This operation provides the list of types and quantities of all topological
+entities, composing the selected geometrical object.
+
+The information about \em COMPOUND or \em COMPSOLID shapes additionally shows
+"flat" content - the number of "simple" top-level shapes enclosed into the compound.
\image html measures8.png
-\n <b>TUI Command:</b> <em>geompy.WhatIs(Shape),</em> where \em Shape is a
+\note This dialog supports navigation through the selectable objects (in OCC 3D viewer only):
+- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when the input focus is
+in the viewer to navigate between selectable objects.
+- Press left mouse button to select an appropriate object to the dialog box.
+.
+For more details, please refer to the \em "Functionality common for OCC and VTK viewers" chapter
+of the GUI module's documentation.
+
+<b>TUI Command:</b> <em>geompy.WhatIs(Shape),</em> where \em Shape is a
shape from which a description is returned.
-\n <b>Kind of Shape</b> field characterizes the
+<b>Kind of Shape</b> field characterizes the
whole shape. If there is no additional information about the
shape, <b>Basic Properties</b> button is disabled, otherwise it
provides information about center and dimensions of the shape.
\image html measures8a.png
-\n <b>TUI Command:</b> <em>geompy.KindOfShape(Shape),</em> where \em Shape is a
+<b>TUI Command:</b> <em>geompy.KindOfShape(Shape),</em> where \em Shape is a
shape from which a description is returned.
See also a \ref tui_whatis_page "TUI example".
To create a group of sub-shapes of a geometrical object in the main
menu select <b>New entity > Group > Create</b>
-\n The following menu will appear:
+\n The following dialog box will appear:
\image html geomcreategroup.png
<li><b>Hide selected</b> - hides the sub-shapes selected in the list box.</li>
<li><b>Show all sub-shapes</b> - displays only the sub-shapes of the Main Shape.</li>
</ul>
-<li> You can select the elements of your group in two ways:
+<li> You can select the elements of your group in several ways:
<ul>
<li>You can select them manually in the 3D Viewer, and add to the
group by clicking the \b Add button (keep down the Shift button on the
group. If the <b>Second Shape</b> is used, the elements are added
according to <b>Main Shape Selection restriction</b> settings. To delete elements
from the list, select them and click \b Remove button.
-</li></ul>
+</li>
+<li>Filtering out some entities according to the specified threshold value or values
+(see below).</li></ul>
</li>
<li>Finally, confirm your selection by clicking <b>Apply and Close
</b> (also closes the Menu) or \b Apply (leaves the Menu open for
\n The Result of the operation will be a \b GEOM_Object.
+The \b Filter controls allow to automatically pick up entities, which satisfy specified
+threshold value(s). The numerical functor for each sub-shape that is compared with
+threshold value(s) is computed according to the shape's topological properties:
+- length for edges and wires;
+- area for faces and shells;
+- volume for solids, compounds, compsolids.
+
+Filtering capabilities are not available for vertices.
+
+In order to filter out some entities:
+- Activate one or two filtering controls by switching on the corresponding check boxes;
+- Select the required threshold comparator type; the following choices are available:
+ - <b>Less Than</b> or <b>Equal or Less Than</b> for the first comparator;
+ - <b>Greater Than</b> or <b>Equal or Greater Than</b> for the second comparator;
+- Enter the required threshold value (values);
+- Press \b Apply button in the \b Filter group.
+
+The entities, which satisfy the entered filtering parameters, will be automatically highlighted
+in the 3D viewer.
+
+\b Plot button gives access
+to the \ref shape_statistics_operation_page "Shape Statistics" functionality with a simplified look-and-feel:
+
+\image html shape_statistics_simple.png
+
\n <b>TUI Command:</b> <em>geompy.CreateGroup(MainShape,
ShapeType),</em> where MainShape is a shape for which the group is
created, ShapeType is a type of shapes in the created group.
<ul>
$navpath
<li class="footer">
- Copyright © 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE<br>
+ Copyright © 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE<br>
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS<br>
</li>
</ul>
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
ADD_CUSTOM_TARGET(dev_docs ${DOXYGEN_EXECUTABLE})
INSTALL(CODE "FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/GEOM)")
-INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/GEOM DESTINATION ${SALOME_INSTALL_DOC}/tui)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/GEOM
+ DESTINATION ${SALOME_INSTALL_DOC}/tui
+ PATTERN "*.md5" EXCLUDE
+ PATTERN "*.map" EXCLUDE)
INSTALL(FILES images/head.png DESTINATION ${SALOME_INSTALL_DOC}/tui/GEOM)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES GEOM)
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
<ul>
$navpath
<li class="footer">
- Copyright © 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE<br>
+ Copyright © 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE<br>
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS<br>
</li>
</ul>
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
*/
enum shape_type
{
- /*! */
+ /*! A collection of arbitrary shapes */
COMPOUND,
/*! A collection of solids */
COMPSOLID,
SOLID,
/*! A collection of faces connected by some edges of their wire boundaries */
SHELL,
- /*! Part of a plane (in 2D geometry) or a surface (in 3D geometry) bounded by a close wire */
+ /*! Part of a plane (in 2D geometry) or a surface (in 3D geometry) bounded by a closed wire */
FACE,
- /*! A sequence of edges connected by their vertices */
+ /*! A sequence of edges connected by their vertices */
WIRE,
/*! Edge, a shape corresponding to a curve, and bound by a vertex at each extremity */
EDGE,
/*! A zero-dimensional shape corresponding to a point in geometry */
VERTEX,
- /*! */
- SHAPE };
+ /*! Arbitrary shape in a Compound (used for processing of Compounds in some operations) */
+ SHAPE,
+ /*! Flat (top-level) contents of a Compound (used for processing of Compounds in some operations) */
+ FLAT
+ };
/*!
* \brief Marker type
* \brief Kind of method to find inside one main shape some sub-shapes,
* corresponding to other given shape (its argument)
*
- * Is used in functions GEOM_Gen.RestoreSubShapesO(), GEOM_Gen.RestoreSubShapesSO()
+ * Is used in functions GEOM_Gen.RestoreSubShapesO(), GEOM_Gen.RestoreSubShapesSO(),
+ * TransferNames()
*/
enum find_shape_method
{
/*! To be used only for multi-transformation result.
* Only this method can be used after multi-transformation.
*/
- FSM_MultiTransformed
+ FSM_MultiTransformed,
+
+ /*! Use old GetInPlace functionality. */
+ FSM_GetInPlace_Old
};
/*!
FDT_String
};
+ /**
+ * This enumeration represents the level of checking shape on
+ * self-interference. It defines which interferferences will be checked.
+ */
+ enum si_check_level
+ {
+ SI_V_V, // only V/V interferences
+ SI_V_E, // V/V and V/E interferences
+ SI_E_E, // V/V, V/E and E/E interferences
+ SI_V_F, // V/V, V/E, E/E and V/F interferences
+ SI_E_F, // V/V, V/E, E/E, V/F and E/F interferences
+ SI_ALL // all interferences
+ };
+
+ /**
+ * This enumeration represents comparison conditions.
+ */
+ enum comparison_condition
+ {
+ CC_GT, ///< Greater then
+ CC_GE, ///< Greater then or equal to
+ CC_LT, ///< Less then
+ CC_LE ///< Less then or equal to
+ };
/*!
* \brief Object creation parameters
struct Parameter
{
string name;
- //any value;
string value;
};
typedef sequence<Parameter> Parameters;
string operationName;
Parameters params;
};
+ typedef sequence<CreationInformation> CreationInformationSeq;
+
+ /*!
+ * \brief Reporting on shape healing
+ */
+ struct ModifInfo
+ {
+ string name; // what changed
+ long count; // how many times
+ };
+ typedef sequence<ModifInfo> ModifStatistics;
typedef sequence<string> string_array;
/*!
* \brief Return name of operation and values of parameters used for object creation
*/
- CreationInformation GetCreationInformation();
+ CreationInformationSeq GetCreationInformation();
};
//# GEOM_Object
*/
shape_type GetMaxShapeType();
+ /*!
+ * \brief Returns a name of a sub-shape if the sub-shape is published in the study
+ * \param subID - sub-shape ID
+ * \return string - the found name or an empty string if the sub-shape does not
+ * exits or is not published in the study
+ *
+ * \note Only sub-shapes directly retrieved (using e.g. ExtractSubShapes() or
+ * via group creation) can be found. Also, as sub-shape can be published in the study
+ * many times, only the first found name is returned.
+ */
+ string GetSubShapeName(in long subID);
+
/*!
* \brief Set color of the object.
*
* Create a point, corresponding to the given parameter on the given curve.
* \param theRefCurve The referenced curve.
* \param theParameter Value of parameter on the referenced curve.
+ * \param takeOrientationIntoAccount flag that tells if it is necessary
+ * to take the curve's orientation into account.
* \return New GEOM_Object, containing the created point.
*/
GEOM_Object MakePointOnCurve (in GEOM_Object theRefCurve,
- in double theParameter);
+ in double theParameter,
+ in boolean takeOrientationIntoAccount);
/*!
* \brief Create a point, corresponding to the given length on the given curve.
* \return theObject.
*/
GEOM_Object RecomputeObject (in GEOM_Object theObject);
+
+ /*!
+ * \brief Compute the projection of a wire or a face on a cylinder.
+ *
+ * This method computes a wire or a face or a compound of faces
+ * that represents a projection of the source shape onto cylinder.
+ * The cylinder's coordinate system is the same as the global coordinate
+ * system.
+ *
+ * \param theObject The object to be projected. It can be either
+ * a planar wire or a face.
+ * \param theRadius The radius of the cylinder.
+ * \param theStartAngle The starting angle from the cylinder's X axis
+ * around Z axis. The angle from which the projection is started.
+ * \param theAngleLength The projection length angle. The angle in which
+ * to project the total length of the wire. If it is negative the
+ * projection is not scaled and natural wire length is kept for
+ * the projection.
+ * \param theAngleRotation the desired angle between the tangent vector
+ * to the first curve at the first point of the theObject's
+ * projection in 2D space and U-direction of cylinder's 2D space.
+ * \return A wire or a face or a compound of faces that represents a
+ * projection of the source shape onto a cylinder.
+ */
+ GEOM_Object MakeProjectionOnCylinder (in GEOM_Object theObject,
+ in double theRadius,
+ in double theStartAngle,
+ in double theAngleLength,
+ in double theAngleRotation);
};
/*!
* \param theHeight Prism dimension along the normal of the face.
* \param theAngle Draft angel in degrees
* \param theFuse If true material is added else material is removed
+ * \param theInvert If true material changes the direction
* \return New GEOM_Object, containing the modified shape
*/
GEOM_Object MakeDraftPrism (in GEOM_Object theInitShape,
in GEOM_Object theBase,
in double theHeight,
in double theAngle,
- in boolean theFuse);
+ in boolean theFuse,
+ in boolean theInvert);
/*!
* \brief Create a shape by extrusion of the base shape along
* the path shape. The path shape can be a wire or an edge.
* \param theBase Base shape to be extruded.
* \param thePath Path shape to extrude the base shape along it.
- * \return New GEOM_Object, containing the created pipe.
+ * \param IsGenerateGroups flag that tells if it is necessary to
+ * return groups (true) or not (false).
+ * \return The list of objects. The first one is a result pipe,
+ * the other ones are the created groups. If \a IsGenerateGroups
+ * is not set the returned list contains a single object, which
+ * is the operation result.
*/
- GEOM_Object MakePipe (in GEOM_Object theBase, in GEOM_Object thePath);
+ ListOfGO MakePipe (in GEOM_Object theBase,
+ in GEOM_Object thePath,
+ in boolean IsGenerateGroups);
/*!
* \brief Create a shape by revolution of the base shape around the axis
in double theAngle);
/*!
- * \brief Create a filling from the given compound of contours.
- * \param theShape Initial shape on which to perform the feature.
- * \param theMinDeg a minimal degree of BSpline surface to create
- * \param theMaxDeg a maximal degree of BSpline surface to create
- * \param theTol2D a 2d tolerance to be reached
- * \param theTol3D a 3d tolerance to be reached
- * \param theNbIter a number of iteration of approximation algorithm
+ * \brief Create a face from a given set of contours.
+ * \param theContours either a list or a compound of edges/wires.
+ * \param theMinDeg a minimal degree of BSpline surface to create.
+ * \param theMaxDeg a maximal degree of BSpline surface to create.
+ * \param theTol2D a 2d tolerance to be reached.
+ * \param theTol3D a 3d tolerance to be reached.
+ * \param theNbIter a number of iteration of approximation algorithm.
* \param theMethod Kind of method to perform filling operation.
- * \param theApprox Boolean indicating if result should be approximated
- * \return New GEOM_Object, containing the created filling surface.
+ * \param theApprox Boolean indicating if result should be approximated.
+ * \return New GEOM_Object (face), containing the created filling surface.
*/
- GEOM_Object MakeFilling (in GEOM_Object theShape,
+ GEOM_Object MakeFilling (in ListOfGO theContours,
in long theMinDeg, in long theMaxDeg,
in double theTol2D, in double theTol3D,
in long theNbIter,
* should be equal to number of bases or list of locations can be empty.
* \param thePath - Path shape to extrude the base shape along it.
* \param theWithContact - the mode defining that the section is translated to be in
- * contact with the spine.
+ * contact with the spine. Ignored if IsBySteps is set.
* \param theWithCorrection - defining that the section is rotated to be
- * orthogonal to the spine tangent in the correspondent point
- * \return New GEOM_Object, containing the created pipe.
- */
- GEOM_Object MakePipeWithDifferentSections (in ListOfGO theSeqBases,
- in ListOfGO theLocations,
- in GEOM_Object thePath,
- in boolean theWithContact ,
- in boolean theWithCorrection );
+ * orthogonal to the spine tangent in
+ * the correspondent point. Ignored if IsBySteps is set.
+ * \param IsBySteps - flag that tells if the result should be created
+ * step by step or as a whole. If IsBySteps is set no correction
+ * of bases is allowed.
+ * \param IsGenerateGroups flag that tells if it is necessary to
+ * return groups (true) or not (false).
+ * \return The list of objects. The first one is a result pipe,
+ * the other ones are the created groups. If \a IsGenerateGroups
+ * is not set the returned list contains a single object, which
+ * is the operation result.
+ */
+ ListOfGO MakePipeWithDifferentSections (in ListOfGO theSeqBases,
+ in ListOfGO theLocations,
+ in GEOM_Object thePath,
+ in boolean theWithContact ,
+ in boolean theWithCorrection,
+ in boolean IsBySteps,
+ in boolean IsGenerateGroups);
/*!
* \brief Create a shape by extrusion of the profile shape along
* contact with the spine.
* \param theWithCorrection - defining that the section is rotated to be
* orthogonal to the spine tangent in the correspondent point
- * \return New GEOM_Object, containing the created pipe.
- */
- GEOM_Object MakePipeWithShellSections (in ListOfGO theSeqBases,
- in ListOfGO theSeqSubBases,
- in ListOfGO theLocations,
- in GEOM_Object thePath,
- in boolean theWithContact ,
- in boolean theWithCorrection );
+ * \param IsGenerateGroups flag that tells if it is necessary to
+ * return groups (true) or not (false).
+ * \return The list of objects. The first one is a result pipe,
+ * the other ones are the created groups. If \a IsGenerateGroups
+ * is not set the returned list contains a single object, which
+ * is the operation result.
+ */
+ ListOfGO MakePipeWithShellSections (in ListOfGO theSeqBases,
+ in ListOfGO theSeqSubBases,
+ in ListOfGO theLocations,
+ in GEOM_Object thePath,
+ in boolean theWithContact,
+ in boolean theWithCorrection,
+ in boolean IsGenerateGroups);
/*!
* \brief Create solids between given sections
* \param theSeqBases - list of sections (shell or face).
* \param theLocations - list of corresponding vertexes
- * \return New GEOM_Object, containing the created solids.
+ * \param IsGenerateGroups flag that tells if it is necessary to
+ * return groups (true) or not (false).
+ * \return The list of objects. The first one is a result pipe,
+ * the other ones are the created groups. If \a IsGenerateGroups
+ * is not set the returned list contains a single object, which
+ * is the operation result.
*/
- GEOM_Object MakePipeShellsWithoutPath (in ListOfGO theSeqBases,
- in ListOfGO theLocations);
+ ListOfGO MakePipeShellsWithoutPath (in ListOfGO theSeqBases,
+ in ListOfGO theLocations,
+ in boolean IsGenerateGroups);
/*!
* \brief Create a shape by extrusion of the base shape along
* \param theVec Vector defines a constant binormal direction to keep the
* same angle beetween the Direction and the sections
* along the sweep surface.
- * \return New GEOM_Object, containing the created pipe.
- */
- GEOM_Object MakePipeBiNormalAlongVector (in GEOM_Object theBase,
- in GEOM_Object thePath,
- in GEOM_Object theVec);
+ * \param IsGenerateGroups flag that tells if it is necessary to
+ * return groups (true) or not (false).
+ * \return The list of objects. The first one is a result pipe,
+ * the other ones are the created groups. If \a IsGenerateGroups
+ * is not set the returned list contains a single object, which
+ * is the operation result.
+ */
+ ListOfGO MakePipeBiNormalAlongVector (in GEOM_Object theBase,
+ in GEOM_Object thePath,
+ in GEOM_Object theVec,
+ in boolean IsGenerateGroups);
/*!
- * \brief Make a thick solid from a surface shape (face or shell)
- * \param theObject Surface from which the thick solid is made
+ * \brief Make a thick solid from a shape.
+ *
+ * If the input is a surface shape (face or shell) the result is
+ * a thick solid. If an input shape is a solid the result is a hollowed
+ * solid with removed faces.
+ * \param theObject face or shell to get thick solid or solid to get
+ * hollowed solid.
+ * \param theFacesIDs the list of face IDs to be removed from the result.
+ * It can be empty.
* \param theThickness Value of the thickness
- * \param isCopy To make a copy of \a theObject ot to modify \a theObject.
+ * \param isCopy To make a copy of \a theObject or to modify \a theObject
+ * \param isInside If true the thickness is applied towards inside
* \return New GEOM_Object, containing the created pipe if isCopy = true
* or the modified object if isCopy = false
*/
GEOM_Object MakeThickening (in GEOM_Object theObject,
- in double theThickness,
- in boolean isCopy);
+ in ListOfLong theFacesIDs,
+ in double theThickness,
+ in boolean isCopy,
+ in boolean isInside);
/*!
*/
GEOM_Object MakeFaceWires (in ListOfGO theWires, in boolean isPlanarWanted);
+ /**
+ * \brief Create a face based on surface of theFace limited by theWire.
+ * \param theFace the face whose surface is used to create a new face.
+ * \param theWire closed Wire build the face.
+ * \return New GEOM_Object, containing the created face.
+ */
+ GEOM_Object MakeFaceFromSurface(in GEOM_Object theFace,
+ in GEOM_Object theWire);
+
+ /*!
+ * \brief Create a face from a set of edges with the given constraints.
+ * \param theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples):
+ * - edges should form a closed wire;
+ * - for each edge, constraint face is optional: if a constraint face is missing
+ * for some edge, this means that there no constraint associated with this edge.
+ * \return New GEOM_Object, containing the created face.
+ */
+ GEOM_Object MakeFaceWithConstraints(in ListOfGO theConstraints);
+
/*!
* \brief Create a shell from the set of faces and shells.
* \param theFacesAndShells List of faces and/or shells.
GEOM_Object MakeCompound (in ListOfGO theShapes);
/*!
- * \brief Replace coincident faces in theShape by one face.
- * \param theShape Initial shape.
+ * \brief Make a solid (or solids) from connected set of faces and/or shells.
+ * \param theFacesOrShells List of faces and/or shells.
+ * \param isIntersect If TRUE, forces performing intersections between arguments.
+ *
+ * \return New GEOM_Object, containing the created solid (or compound of solids).
+ */
+ GEOM_Object MakeSolidFromConnectedFaces (in ListOfGO theFacesOrShells, in boolean isIntersect);
+
+ /*!
+ * \brief Replace coincident faces in \a theShapes by one face.
+ * \param theShapes Initial shapes.
* \param theTolerance Maximum distance between faces, which can be considered as coincident.
* \param doKeepNonSolids If FALSE, only solids will present in the result, otherwise all initial shapes.
- * \return New GEOM_Object, containing a copy of theShape without coincident faces.
+ * \return New GEOM_Object containing copies of theShapes without coincident faces.
*/
- GEOM_Object MakeGlueFaces (in GEOM_Object theShape, in double theTolerance, in boolean doKeepNonSolids);
+ GEOM_Object MakeGlueFaces (in ListOfGO theShapes, in double theTolerance, in boolean doKeepNonSolids);
/*!
- * Find coincident faces in theShape for possible gluing.
- * \param theShape Initial shape.
+ * Find coincident faces in theShapes for possible gluing.
+ * \param theShapes Initial shapes.
* \param theTolerance Maximum distance between faces, which can be considered as coincident.
* \return ListOfGO
*/
- ListOfGO GetGlueFaces (in GEOM_Object theShape, in double theTolerance);
+ ListOfGO GetGlueFaces (in ListOfGO theShapes, in double theTolerance);
/*!
- * \brief Replace coincident faces in theShape by one face
- * in compliance with given list of faces
- * \param theShape Initial shape.
+ * \brief Replace coincident faces in \a theShapes by one face
+ * in compliance with given list of faces
+ * \param theShapes Initial shapes.
* \param theTolerance Maximum distance between faces, which can be considered as coincident.
* \param theFaces List of faces for gluing.
* \param doKeepNonSolids If FALSE, only solids will present in the result, otherwise all initial shapes.
* \param doGlueAllEdges If TRUE, all coincident edges of <VAR>theShape</VAR>
* will be glued, otherwise only the edges,
* belonging to <VAR>theFaces</VAR>.
- * \return New GEOM_Object, containing a copy of theShape without some faces.
+ * \return New GEOM_Object containing copies of theShapes without coincident faces.
*/
- GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance,
- in ListOfGO theFaces, in boolean doKeepNonSolids,
+ GEOM_Object MakeGlueFacesByList (in ListOfGO theShapes, in double theTolerance,
+ in ListOfGO theFaces, in boolean doKeepNonSolids,
in boolean doGlueAllEdges);
/*!
- * \brief Replace coincident edges in theShape by one edge.
- * \param theShape Initial shape.
+ * \brief Replace coincident edges in \a theShapes by one edge.
+ * \param theShapes Initial shapes.
* \param theTolerance Maximum distance between edges, which can be considered as coincident.
- * \return New GEOM_Object, containing a copy of theShape without coincident edges.
+ * \return New GEOM_Object containing copies of theShapes without coincident edges.
*/
- GEOM_Object MakeGlueEdges (in GEOM_Object theShape, in double theTolerance);
+ GEOM_Object MakeGlueEdges (in ListOfGO theShapes, in double theTolerance);
/*!
- * Find coincident edges in theShape for possible gluing.
- * \param theShape Initial shape.
+ * Find coincident edges in \a theShapes for possible gluing.
+ * \param theShapes Initial shapes.
* \param theTolerance Maximum distance between edges, which can be considered as coincident.
* \return ListOfGO
*/
- ListOfGO GetGlueEdges (in GEOM_Object theShape, in double theTolerance);
+ ListOfGO GetGlueEdges (in ListOfGO theShapes, in double theTolerance);
/*!
- * \brief Replace coincident edges in theShape by one edge
- * in compliance with given list of edges
- * \param theShape Initial shape.
+ * \brief Replace coincident edges in \a theShapes by one edge
+ * in compliance with given list of edges
+ * \param theShapes Initial shapes.
* \param theTolerance Maximum distance between edges, which can be considered as coincident.
* \param theEdges List of edges for gluing.
- * \return New GEOM_Object, containing a copy of theShape without some edges.
+ * \return New GEOM_Object containing copies of theShapes without some edges.
*/
- GEOM_Object MakeGlueEdgesByList (in GEOM_Object theShape,
- in double theTolerance,
+ GEOM_Object MakeGlueEdgesByList (in ListOfGO theShapes,
+ in double theTolerance,
in ListOfGO theEdges);
/*!
*/
string GetShapeTypeString (in GEOM_Object theShape);
+ /*!
+ * \brief Check if the object is a sub-object of another GEOM object.
+ *
+ * \param theSubObject Checked sub-object (or its parent object, in case if
+ * \a theSubObjectIndex is non-zero).
+ * \param theSubObjectIndex When non-zero, specifies a sub-shape index that
+ * identifies a sub-object within its parent specified via \a theSubObject.
+ * \param theObject An object that is checked for ownership (or its parent object,
+ * in case if \a theObjectIndex is non-zero).
+ * \param theObjectIndex When non-zero, specifies a sub-shape index that
+ * identifies an object within its parent specified via \a theObject.
+ * \return TRUE, if the given object contains sub-object.
+ */
+ boolean IsSubShapeBelongsTo( in GEOM_Object theSubObject,
+ in long theSubObjectIndex,
+ in GEOM_Object theObject,
+ in long theObjectIndex);
/*!
* \brief Count number of faces in the given shape.
* \param theShape Shape to count faces in.
in long theShapeType);
/*!
- * \brief Get all sub-shapes, shared by all shapes in the list \a theShapes.
+ * \brief Get sub-shapes, shared by input shapes.
* \param theShapes Shapes to find common sub-shapes of.
* \param theShapeType Type of sub-shapes to be retrieved.
- * \return List of objects, that are sub-shapes of all given shapes.
+ * \param theMultiShare Specifies what type of shares should be checked:
+ * - \c TRUE: search sub-shapes from 1st input shape shared with all other input shapes;
+ * - \c FALSE: causes to search sub-shapes shared between couples of input shapes.
+ * \note If \a theShapes contains single compound, the shares between all possible couples of
+ * its top-level shapes are returned; otherwise, only shares between 1st input shape
+ * and all rest input shapes are returned.
+ *
+ * \return List of all found sub-shapes.
*/
ListOfGO GetSharedShapesMulti (in ListOfGO theShapes,
- in long theShapeType);
+ in long theShapeType,
+ in boolean theMultiShare);
/*!
* \brief Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
ListOfLong GetSameIDs (in GEOM_Object theShapeWhere,
in GEOM_Object theShapeWhat);
+ /*!
+ * \brief Resize the input edge with the new Min and Max parameters.
+ * The input edge parameters range is [0, 1]. If theMin parameter is
+ * negative, the input edge is extended, otherwise it is shrinked by
+ * theMin parameter. If theMax is greater than 1, the edge is extended,
+ * otherwise it is shrinked by theMax parameter.
+ * \param theEdge the input edge to be resized.
+ * \param theMin the minimal parameter value.
+ * \param theMax the maximal parameter value.
+ * \return a newly created edge.
+ */
+ GEOM_Object ExtendEdge(in GEOM_Object theEdge,
+ in double theMin,
+ in double theMax);
+
+ /*!
+ * \brief Resize the input face with the new UMin, UMax, VMin and VMax
+ * parameters. The input face U and V parameters range is [0, 1]. If
+ * theUMin parameter is negative, the input face is extended, otherwise
+ * it is shrinked along U direction by theUMin parameter. If theUMax is
+ * greater than 1, the face is extended, otherwise it is shrinked along
+ * U direction by theUMax parameter. So as for theVMin, theVMax and
+ * V direction of the input face.
+ * \param theFace the input face to be resized.
+ * \param theUMin the minimal U parameter value.
+ * \param theUMax the maximal U parameter value.
+ * \param theVMin the minimal V parameter value.
+ * \param theVMax the maximal V parameter value.
+ * \return a newly created face.
+ */
+ GEOM_Object ExtendFace(in GEOM_Object theFace,
+ in double theUMin,
+ in double theUMax,
+ in double theVMin,
+ in double theVMax);
+
+ /*!
+ * \brief Make a surface from a face. This function takes some face as
+ * input parameter and creates new GEOM_Object, i.e. topological shape
+ * by extracting underlying surface of the source face and limiting it
+ * by the Umin, Umax, Vmin, Vmax parameters of the source face (in the
+ * parametrical space).
+ * \param theFace the input face.
+ * \return a newly created face.
+ */
+ GEOM_Object MakeSurfaceFromFace(in GEOM_Object theFace);
+
+ /*!
+ * \brief Explode a shape into edges sorted in a row from a starting point.
+ * \param theShape - the shape to be exploded on edges.
+ * \param theStartPoint - the starting point.
+ * \return Ordered list of edges sorted in a row from a starting point.
+ */
+ ListOfGO GetSubShapeEdgeSorted (in GEOM_Object theShape,
+ in GEOM_Object theStartPoint);
+
+ /*!
+ * \brief Return the list of subshapes that satisfies a certain tolerance
+ * criterion. The user defines the type of shapes to be returned, the
+ * condition and the tolerance value. The operation is defined for
+ * faces, edges and vertices only. E.g. for theShapeType FACE, theCondition
+ * CC_GT and theTolerance 1.e-7 this method returns all faces of theShape
+ * that have tolerances greater then 1.e7.
+ *
+ * \param theShape the shape to be exploded
+ * \param theShapeType the type of shapes to be returned. Can have the
+ * values FACE, EDGE and VERTEX only.
+ * \param theCondition the condition type.
+ * \param theTolerance the tolerance filter.
+ * \return the list of shapes that satisfy the conditions.
+ */
+ ListOfGO GetSubShapesWithTolerance(in GEOM_Object theShape,
+ in short theShapeType,
+ in comparison_condition theCondition,
+ in double theTolerance);
+
};
// # GEOM_IBlocksOperations:
* - The glue between two quadrangle faces should be applied.
* \note Single block is also accepted as a valid compound of blocks.
* \param theCompound The compound to check.
+ * \param theToleranceC1 the tolerance to check if two neighbor edges are
+ * collinear in the common vertex with this tolerance. Negative
+ * value means that C1 criterion is not used (old implementation).
* \param theErrors Structure, containing discovered errors and incriminated sub-shapes.
* \return TRUE, if the given shape is a compound of blocks.
*/
boolean CheckCompoundOfBlocks (in GEOM_Object theCompound,
+ in double theToleranceC1,
out BCErrors theErrors);
/*!
* \brief Retrieve all non blocks solids and faces from a shape.
*
* \param theShape The shape to explore.
+ * \param theToleranceC1 the tolerance to check if two neighbor edges are
+ * collinear in the common vertex with this tolerance. Negative
+ * value means that C1 criterion is not used (old implementation).
* \param theNonQuads Output parameter. Group of all non quadrangular faces.
*
* \return Group of all non block solids (= not 6 faces, or with 6
* faces, but with the presence of non-quadrangular faces).
*/
- GEOM_Object GetNonBlocks (in GEOM_Object theShape, out GEOM_Object theNonQuads);
+ GEOM_Object GetNonBlocks (in GEOM_Object theShape,
+ in double theToleranceC1,
+ out GEOM_Object theNonQuads);
/*!
* \brief Remove all seam and degenerated edges from \a theShape.
* \param theShape Shape to be intersected.
* \param thePlane Tool shape, to intersect theShape.
* \return New GEOM_Object, containing the result shape.
+ *
+ * \note This operation is a shortcut to the more general \ref MakePartition
+ * operation, where \a theShape specifies single "object" (shape being partitioned)
+ * and \a thePlane specifies single "tool" (intersector shape). Other parameters of
+ * \ref MakePartition operation have default values:
+ * - \a theLimit: GEOM::SHAPE (shape limit corresponds to the type of \a theShape)
+ * - \a theKeepNonlimitShapes: 0
+ * - \a theKeepInside, \a theRemoveInside, \a theRemoveWebs,
+ * \a theMaterials (obsolete parameters): empty
+ *
+ * \sa MakePartition, MakePartitionNonSelfIntersectedShape
*/
GEOM_Object MakeHalfPartition (in GEOM_Object theShape,
in GEOM_Object thePlane);
/*!
* Sewing of the given object.
- * \param theObject Shape to be processed.
+ * \param theObjects Shapes to be processed.
* \param theTolerance Required tolerance value.
* \return New GEOM_Object, containing processed shape.
*/
- GEOM_Object Sew (in GEOM_Object theObject, in double theTolerance);
+ GEOM_Object Sew (in ListOfGO theObjects, in double theTolerance);
/*!
* Sewing of the given object. Allows non-manifold sewing.
- * \param theObject Shape to be processed.
+ * \param theObjects Shapes to be processed.
* \param theTolerance Required tolerance value.
* \return New GEOM_Object, containing processed shape.
*/
- GEOM_Object SewAllowNonManifold(in GEOM_Object theObject, in double theTolerance);
+ GEOM_Object SewAllowNonManifold(in ListOfGO theObjects, in double theTolerance);
/*!
- * Rebuild the topology of theCompound of solids by removing
- * of the faces that are shared by several solids.
- * \param theCompound Shape to be processed.
+ * Rebuild the topology of theSolids by removing
+ * the faces that are shared by several solids.
+ * \param theSolids A list of shapes containing solids to be processed.
* \return New GEOM_Object, containing processed shape.
*/
- GEOM_Object RemoveInternalFaces (in GEOM_Object theCompound);
+ GEOM_Object RemoveInternalFaces (in ListOfGO theSolids);
/*!
- * \brief Addition of a point to a given edge object.
+ * \brief Addition of a point to a given edge of \a theObject.
* \param theObject Shape to be processed.
* \param theEdgeIndex Index of edge to be divided within theObject's shape,
* if -1, then theObject itself is the edge.
* depending on \a isByParameter.
* \param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1],
* if FALSE : \a theValue is treated as a length parameter [0..1]
- * \return New GEOM_Object, containing processed shape.
+ * \return New GEOM_Object, containing the processed shape.
*/
GEOM_Object DivideEdge (in GEOM_Object theObject, in short theEdgeIndex,
in double theValue, in boolean isByParameter);
+ /*!
+ * \brief Addition of points to a given edge of \a theObject by projecting
+ * other points to the given edge.
+ * \param theObject Shape to be processed.
+ * \param theEdgeIndex Index of edge to be divided within theObject's shape,
+ * if -1, then theObject itself is the edge.
+ * \param thePoints Points to project to theEdgeIndex-th edge.
+ * \return New GEOM_Object, containing the processed shape.
+ */
+ GEOM_Object DivideEdgeByPoint (in GEOM_Object theObject,
+ in short theEdgeIndex,
+ in ListOfGO thePoints);
+
/*!
* \brief Suppress the vertices in the wire in case if adjacent edges are C1 continuous.
* \param theWire Wire to minimize the number of C1 continuous edges in.
/*!
* \brief Get a list of wires (wrapped in GEOM_Object-s),
- * that constitute a free boundary of the given shape.
- * \param theObject Shape to get free boundary of.
+ * that constitute a free boundary of the given shapes.
+ * \param theObjects Shapes to get free boundary of.
* \param theClosedWires Output. Closed wires on the free boundary of the given shape.
* \param theOpenWires Output. Open wires on the free boundary of the given shape.
* \return FALSE, if an error(s) occured during the method execution.
*/
- boolean GetFreeBoundary (in GEOM_Object theObject,
+ boolean GetFreeBoundary (in ListOfGO theObjects,
out ListOfGO theClosedWires,
out ListOfGO theOpenWires);
*/
GEOM_Object LimitTolerance (in GEOM_Object theObject, in double theTolerance);
+
+ /*!
+ * \brief Return information on what has been done by the last called healing method.
+ * \return ModifStatistics, information container.
+ */
+ ModifStatistics GetStatistics();
};
// # GEOM_IInsertOperations:
GEOM_Object MakeCopy (in GEOM_Object theOriginal);
/*!
- * \brief Deprecated method. Use Export<FormatName> (from the
- * corresponding plugin) instead; here <FormatName> is a name of format.
+ * \brief Deprecated method. Use Export\<FormatName\> (from the
+ * corresponding plugin) instead; here \<FormatName\> is a name of format.
*
* \brief Export the given shape into a file with given name.
* \param theObject Shape to be stored in the file.
void Export (in GEOM_Object theObject, in string theFileName, in string theFormatName);
/*!
- * \brief Deprecated method. Use Import<FormatName> (from the
- * corresponding plugin) instead; here <FormatName> is a name of format.
+ * \brief Deprecated method. Use Import\<FormatName\> (from the
+ * corresponding plugin) instead; here \<FormatName\> is a name of format.
*
* \brief Import a shape from the STL, BREP, IGES or STEP file
* (depends on given format) with given name.
* \return list of all texture IDs avaiable for the current study
*/
ListOfLong GetAllTextures();
-
+
+ /*!
+ * \brief Non-topological information transfer datum.
+ */
+ struct TransferDatum
+ {
+ string myName;
+ long myNumber;
+ long myMaxNumber;
+ };
+
+ /*!
+ * \brief Sequence of non-topological information tranfer data.
+ */
+ typedef sequence<TransferDatum> ListOfTransferDatum;
+
+ /*!
+ * \brief Transfer non-topological data from one object to another
+ * \param theObjectFrom the source object of non-topological data
+ * \param theObjectTo the destination object of non-topological data
+ * \param theFindMethod method to search sub-shapes of theObjectFrom
+ * in shape theObjectTo. Possible values are: GEOM::FSM_GetInPlace,
+ * GEOM::FSM_GetInPlaceByHistory and GEOM::FSM_GetInPlace_Old.
+ * Other values of GEOM::find_shape_method are not supported.
+ * \param theResult statistics of the operation. Output parameter. It
+ * represents a sequence of Transfer Datum. A datum has the type
+ * (string code), the total number of items of this type and
+ * the number of transfered items.
+ * \return true in case of success; otherwise false.
+ */
+ boolean TransferData(in GEOM_Object theObjectFrom,
+ in GEOM_Object theObjectTo,
+ in find_shape_method theFindMethod,
+ out ListOfTransferDatum theResult);
+
};
// # GEOM_IKindOfShape:
// VERTEX
VERTEX,
// ADVANCED shapes
+ LCS,
/*! all advanced shapes (temporary implementation) */
ADVANCED
};
/*!
* \brief Check a topology of the given shape on self-intersections presence.
* \param theShape Shape to check validity of.
+ * \param theCheckLevel the level of self-interference check.
* \param theIntersections Output. List of intersected sub-shapes IDs, it contains pairs of IDs.
* \return TRUE, if the shape does not have any self-intersections.
*/
boolean CheckSelfIntersections (in GEOM_Object theShape,
+ in long theCheckLevel,
out ListOfLong theIntersections);
+ /*!
+ * \brief Detect self-intersections of the given shape with algorithm based on mesh intersections.
+ * \param theShape Shape to check validity of.
+ * \param theDeflection Linear deflection coefficient that specifies quality of tesselation.
+ * \param theTolerance Specifies a distance between sub-shapes used for detecting gaps:
+ * - if \a theTolerance <= 0, algorithm detects intersections
+ * - if \a theTolerance > 0, algorithm detects gaps
+ * \param theIntersections Output. List of intersected sub-shapes IDs, it contains pairs of IDs.
+ * \return TRUE, if the shape does not have any self-intersections.
+ */
+ boolean CheckSelfIntersectionsFast (in GEOM_Object theShape,
+ in float theDeflection,
+ in double theTolerance,
+ out ListOfLong theIntersections);
+
+ /*!
+ * \brief Detect intersections of the given shapes with algorithm based on mesh intersections.
+ * \param theShape1 First source object
+ * \param theShape2 Second source object
+ * \param theTolerance Specifies a distance between shapes used for detecting gaps:
+ * - if \a theTolerance <= 0, algorithm detects intersections
+ * - if \a theTolerance > 0, algorithm detects gaps
+ * \param theDeflection Linear deflection coefficient that specifies quality of tesselation:
+ * - if \a theDeflection <= 0, default deflection 0.001 is used
+ * \param theIntersections1 Output: contains list of sub-shapes IDs from 1st shape that localize intersection
+ * \param theIntersections2 Output: contains list of sub-shapes IDs from 2nd shape that localize intersection
+ * \return TRUE, if the are intersections (gaps) between source shapes
+ */
+ boolean FastIntersect (in GEOM_Object theShape1,
+ in GEOM_Object theShape2,
+ in double theTolerance,
+ in float theDeflection,
+ out ListOfLong theIntersections1,
+ out ListOfLong theIntersections2);
+
/*!
* \brief Check if the given shape can be an argument for MakeSolid operation
* \param theShape Shape to be described.
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
in boolean isPlanarWanted) ;
GEOM_Object MakeFaceWires (in GEOM_List theWires,
in boolean isPlanarWanted) ;
+ GEOM_Object MakeFaceWithConstraints(in GEOM_List theConstraints);
GEOM_Object MakeShell (in GEOM_List theFacesAndShells) ;
GEOM_Object MakeSolidShell (in GEOM_Object theShell) ;
GEOM_Object MakeSolidShells (in GEOM_List theShells) ;
GEOM_Object MakeCompound (in GEOM_List theShapes) ;
+ GEOM_Object MakeSolidFromConnectedFaces (in GEOM_List theFacesOrShells,
+ in boolean isIntersect);
GEOM_Object MakeGlueFaces (in GEOM_Object theShape,
in double theTolerance,
in boolean doKeepNonSolids);
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
module GEOM
{
+ /*!
+ * \brief Units of length
+ */
+ enum length_unit
+ {
+ LU_INCH,
+ LU_MILLIMETER,
+ LU_FOOT,
+ LU_MILE,
+ LU_METER,
+ LU_KILOMETER,
+ LU_MILLIINCH,
+ LU_MICROMETER,
+ LU_CENTIMETER,
+ LU_MICROINCH
+ };
+
/*!
* \brief Interface for STEPPlugin modeling functions.
*/
*
* \param theObject Shape to be stored in the file.
* \param theFileName Name of the file to store the given shape in.
+ * \param theUnit the length unit.
*/
void ExportSTEP( in GEOM::GEOM_Object theObject,
- in string theFileName );
+ in string theFileName,
+ in GEOM::length_unit theUnit);
/*!
* \brief Import a shape from the STEP file.
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
<!--
- Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+ Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
<!--
- Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+ Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
GEOM.config
GEOMDS_Resources
ShHealing
+ Y14.5M-2009.ttf
3dsketch.png
isoline.png
isoline_v.png
build_edge_wire.png
build_edge_curve.png
build_face.png
+ build_face_surface.png
+ build_face_constraints.png
build_shell.png
build_solid.png
build_wire.png
displayonly.png
displayall.png
draft.png
+ edgeextension.png
erase.png
eraseall.png
extruded_boss.png
extruded_cut.png
+ facetosurface.png
+ faceextension.png
face_hw.png
face_vechw.png
feature_detect.png
fuse_collinear_edges.png
geometry.png
import_picture.png
+ import.png
limit_tolerance.png
line.png
line2points.png
normale.png
offset.png
projection.png
+ projection_on_edge.png
+ projection_on_wire.png
+ proj_on_cyl.png
origin_and_vectors.png
partition.png
partitionkeep.png
planeworkingorigin.png
point2.png
pointonedge.png
+ pointonedgebypoint.png
pointonface.png
point_line_intersection.png
polyline.png
shapesonshape.png
shared_shapes.png
sketch.png
+ solid_from_faces.png
sphere.png
spheredxyz.png
spherepoint.png
supressHolesOnFaceShell.png
supressface.png
supresshole.png
+ thickness.png
+ thickness2.png
tolerance.png
torus.png
torusdxyz.png
toruspointvector.png
+ transfer_data.png
translationDxyz.png
translationPoints.png
translationVector.png
check_blocks_compound.png
get_non_blocks.png
check_self_intersections.png
+ fast_intersect.png
free_faces.png
propagate.png
redo.png
<?xml version='1.0' encoding='us-ascii' ?>
<!--
- Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+ Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
<!-- Geom data types -->
<type-list>
<!-- From GEOM_Gen.idl -->
+ <objref name="CORBA/Object" id="" />
<objref name="GEOM/GEOM_Gen" id="IDL:GEOM/GEOM_Gen:1.0" />
<objref name="GEOM/GEOM_BaseObject" id="IDL:GEOM/GEOM_BaseObject:1.0" />
<objref name="GEOM/GEOM_Object" id="IDL:GEOM/GEOM_Object:1.0">
<member name="error" type="GEOM/ShapeErrorType" />
<member name="incriminated" type="GEOM/ListOfLong" />
</struct>
- <sequence name="GEOM/ShapeError" content="GEOM/ShapeErrors" />
+ <sequence name="GEOM/ShapeErrors" content="GEOM/ShapeError" />
<!-- From GEOM_Superv.idl -->
<objref name="GEOM/GEOM_Superv" id="IDL:GEOM/GEOM_Superv:1.0" />
</inParameter>
<inParameter>
<inParameter-name>theObject</inParameter-name>
- <inParameter-type>Object</inParameter-type>
+ <inParameter-type>CORBA/Object</inParameter-type>
<inParameter-comment>unknown</inParameter-comment>
</inParameter>
</inParameter-list>
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
+ <component-service>
+ <service-name>MakeFaceWithConstraints</service-name>
+ <service-author>SALOME team</service-author>
+ <service-version>@SALOMEGEOM_VERSION@</service-version>
+ <service-comment>unknown</service-comment>
+ <service-by-default>0</service-by-default>
+ <inParameter-list>
+ <inParameter>
+ <inParameter-name>theConstraints</inParameter-name>
+ <inParameter-type>GEOM/GEOM_List</inParameter-type>
+ <inParameter-comment>unknown</inParameter-comment>
+ </inParameter>
+ </inParameter-list>
+ <outParameter-list>
+ <outParameter>
+ <outParameter-name>return</outParameter-name>
+ <outParameter-type>GEOM/GEOM_Object</outParameter-type>
+ <outParameter-comment>unknown</outParameter-comment>
+ </outParameter>
+ </outParameter-list>
+ <DataStream-list></DataStream-list>
+ </component-service>
<component-service>
<service-name>MakeSolidShell</service-name>
<service-author>SALOME team</service-author>
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
+ <component-service>
+ <service-name>MakeSolidFromConnectedFaces</service-name>
+ <service-author>SALOME team</service-author>
+ <service-version>@SALOMEGEOM_VERSION@</service-version>
+ <service-comment>unknown</service-comment>
+ <service-by-default>0</service-by-default>
+ <inParameter-list>
+ <inParameter>
+ <inParameter-name>theFacesOrShells</inParameter-name>
+ <inParameter-type>GEOM/GEOM_List</inParameter-type>
+ <inParameter-comment>unknown</inParameter-comment>
+ </inParameter>
+ <inParameter>
+ <inParameter-name>isIntersect</inParameter-name>
+ <inParameter-type>boolean</inParameter-type>
+ <inParameter-comment>unknown</inParameter-comment>
+ </inParameter>
+ </inParameter-list>
+ <outParameter-list>
+ <outParameter>
+ <outParameter-name>return</outParameter-name>
+ <outParameter-type>GEOM/GEOM_Object</outParameter-type>
+ <outParameter-comment>unknown</outParameter-comment>
+ </outParameter>
+ </outParameter-list>
+ <DataStream-list></DataStream-list>
+ </component-service>
<component-service>
<service-name>MakeCompound</service-name>
<service-author>SALOME team</service-author>
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE application PUBLIC "" "desktop.dtd">
<!--
- Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+ Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE application PUBLIC "" "desktop.dtd">
<!--
- Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+ Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
<!--
- Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+ Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
<!--
- Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+ Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
<!--
- Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+ Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+ Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
<parameter name="line_color" value="255, 0, 0" />
<parameter name="point_color" value="#ff7700" />
<parameter name="isos_color" value="200, 200, 200" />
+ <parameter name="label_color" value="255, 255, 255" />
<parameter name="toplevel_color" value="170, 85, 0" />
<parameter name="toplevel_dm" value="0" />
<parameter name="editgroup_color" value="170, 85, 0" />
<parameter name="base_vectors_length" value="1" />
<parameter name="marker_scale" value="3" />
<parameter name="geom_preview" value="true" />
+ <parameter name="hide_input_object" value="true" />
<parameter name="material" value="[ Default ]" />
<parameter name="predef_materials" value="true" />
<parameter name="edge_width" value="1" />
<!-- Dimension presentation properties -->
<parameter name="dimensions_color" value="#ffffff" />
<parameter name="dimensions_line_width" value="1" />
- <parameter name="dimensions_font_height" value="10" />
+ <parameter name="dimensions_font" value="Y14.5M-2009,14" />
<parameter name="dimensions_arrow_length" value="5" />
<parameter name="dimensions_show_units" value="0" />
<parameter name="dimensions_length_units" value="m" />
<parameter name="dimensions_angle_units" value="deg" />
- <parameter name="dimensions_default_flyout" value="20" />
+ <parameter name="dimensions_default_flyout" value="20" />
+ <parameter name="dimensions_use_text3d" value="0" />
<!-- Scalar bar for field step presentation -->
<parameter name="scalar_bar_x_position" value="0.05" />
ShapeProcess.DropSmallEdges.Tolerance3d : 0.05
+ShapeProcess.DropSmallSolids.WidthFactorThreshold : 1
+ShapeProcess.DropSmallSolids.VolumeThreshold : 1000
+ShapeProcess.DropSmallSolids.MergeSolids : 1
+
ShapeProcess.BSplineRestriction.SurfaceMode : 1
ShapeProcess.BSplineRestriction.Curve3dMode : 1
ShapeProcess.BSplineRestriction.Curve2dMode : 1
! DropSmallEdges : Eliminate small edges by removing or merging with neighbour
! DropSmallEdges.Tolerance3d : Tolerance (3d)
+! DropSmallSolids : Eliminate small solids by a) removing them or b) absorbing them by adjacent larger solids.
+! DropSmallSolids.WidthFactorThreshold : Maximum value of 2V/S of a solid where V is volume and S is surface area of the solid.
+! DropSmallSolids.VolumeThreshold : Maximum volume of a solid.
+! DropSmallSolids.MergeSolids : If false, solids are removed; otherwise, solids are merged to adjacent larger solids.
+
! FixShape.Tolerance3d : Tolerance (3d) for fixing of shape.
! FixShape.MaxTolerance3d : Maximal possible value of increasing of tolerance during fixing.
! FixShape.MinTolerance3d : Minimal value of tolerance.
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
<!--
- Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+ Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
<!--
- Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+ Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "GEOM_Function.hxx"
#include "GEOM_PythonDump.hxx"
#include "GEOMUtils.hxx"
+#include "GEOMAlgo_ClsfSurf.hxx"
+#include "GEOMAlgo_FinderShapeOn2.hxx"
#include "GEOMAlgo_Splitter.hxx"
-#include "GEOMAlgo_FinderShapeOn1.hxx"
#include "GEOMImpl_Gen.hxx"
#include "GEOMImpl_Types.hxx"
#define FIND_GROUPS_BY_POINTS 1
+// Undefine below macro to enable workaround about fillet problem in MakePipeTShapeFillet
+// VSR 30/12/2014: macro enabled
+#define FILLET_FIX_TOLERANCE
+
//=============================================================================
/*!
* Constructor
*/
//=============================================================================
gp_Trsf AdvancedEngine_IOperations::GetPositionTrsf(double theL1, double theL2,
- Handle(GEOM_Object) theP1,
- Handle(GEOM_Object) theP2,
- Handle(GEOM_Object) theP3)
+ Handle(GEOM_Object) theP1,
+ Handle(GEOM_Object) theP2,
+ Handle(GEOM_Object) theP3)
{
// Old Local Coordinates System oldLCS
gp_Pnt P0(0, 0, 0);
*/
//=============================================================================
bool AdvancedEngine_IOperations::CheckCompatiblePosition(double& theL1, double& theL2,
- Handle(GEOM_Object) theP1,
- Handle(GEOM_Object) theP2,
- Handle(GEOM_Object) theP3,
- double theTolerance)
+ Handle(GEOM_Object) theP1,
+ Handle(GEOM_Object) theP2,
+ Handle(GEOM_Object) theP3,
+ double theTolerance)
{
SetErrorCode(KO);
gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(theP1->GetValue()));
*/
//=============================================================================
bool AdvancedEngine_IOperations::MakeGroups(Handle(GEOM_Object) theShape, int shapeType,
- double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theH, double theW, double theRF,
- Handle(TColStd_HSequenceOfTransient) theSeq,
- gp_Trsf aTrsf)
+ double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theH, double theW, double theRF,
+ Handle(TColStd_HSequenceOfTransient) theSeq,
+ gp_Trsf aTrsf)
{
SetErrorCode(KO);
const Standard_Real theTolerance,
TopTools_ListOfShape &theFaces)
{
- GEOMAlgo_FinderShapeOn1 aFinder;
+ GEOMAlgo_FinderShapeOn2 aFinder;
+ Handle(GEOMAlgo_ClsfSurf) aClsfSurf = new GEOMAlgo_ClsfSurf;
+ aClsfSurf->SetSurface(theSurface);
aFinder.SetShape(theShape);
aFinder.SetTolerance(theTolerance);
- aFinder.SetSurface(theSurface);
+ aFinder.SetClsf(aClsfSurf);
aFinder.SetShapeType(TopAbs_FACE);
aFinder.SetState(GEOMAlgo_ST_ON);
// Interprete results
Standard_Integer iErr = aFinder.ErrorStatus();
- // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of error codes is in GEOMAlgo_FinderShapeOn2.cxx
if (iErr) {
MESSAGE(" iErr : " << iErr);
TCollection_AsciiString aMsg (" iErr : ");
return false;
}
Standard_Integer iWrn = aFinder.WarningStatus();
- // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn2.cxx
if (iWrn) {
MESSAGE(" *** iWrn : " << iWrn);
}
}
bool AdvancedEngine_IOperations::MakePipeTShapePartition(Handle(GEOM_Object) theShape,
- double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theH, double theW,
- double theRF, bool isNormal)
+ double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theH, double theW,
+ double theRF, bool isNormal)
{
SetErrorCode(KO);
if (Abs(aP.X()) <= Precision::Confusion()) {
if (Abs(aP.Y()) < d1min) {
vi1 = v;
- d1min = Abs(aP.Y());
- }
+ d1min = Abs(aP.Y());
+ }
} else if (Abs(aP.Y()) <= Precision::Confusion()) {
- if (Abs(aP.X()) < d2min) {
- vi2 = v;
- d2min = Abs(aP.X());
+ if (Abs(aP.X()) < d2min) {
+ vi2 = v;
+ d2min = Abs(aP.X());
}
}
}
if (Abs(aP.X()) <= Precision::Confusion()) {
if (Abs(aP.Y()) > d1max) {
ve1 = v;
- vertex1 = aVertex;
- d1max = Abs(aP.Y());
+ vertex1 = aVertex;
+ d1max = Abs(aP.Y());
}
} else if (Abs(aP.Y()) <= Precision::Confusion()) {
if (Abs(aP.X()) > d2max) {
ve2 = v;
- vertex2 = aVertex;
- d2max = Abs(aP.X());
+ vertex2 = aVertex;
+ d2max = Abs(aP.X());
}
}
}
for (int i=1; i<=edges_e->Length();i++) {
Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_e->Value(i));
anObj->GetLastFunction()->SetDescription("");
- TopoDS_Edge anEdge = TopoDS::Edge(anObj->GetValue());
- if ( !anEdge.IsNull() &&
- (sae.FirstVertex(anEdge).IsSame(vertex1) || sae.LastVertex(anEdge).IsSame(vertex1)) &&
- (sae.FirstVertex(anEdge).IsSame(vertex2) || sae.LastVertex(anEdge).IsSame(vertex2))) {
- arete_intersect_ext = anObj;
- }
+ TopoDS_Edge anEdge = TopoDS::Edge(anObj->GetValue());
+ if ( !anEdge.IsNull() &&
+ (sae.FirstVertex(anEdge).IsSame(vertex1) || sae.LastVertex(anEdge).IsSame(vertex1)) &&
+ (sae.FirstVertex(anEdge).IsSame(vertex2) || sae.LastVertex(anEdge).IsSame(vertex2))) {
+ arete_intersect_ext = anObj;
+ }
}
edge_e1 = myBasicOperations->MakeLineTwoPnt(ve1, vi1);
face_t->GetLastFunction()->SetDescription("");
theShapes.push_back(face_t);
- gp_Pnt aP2 = BRep_Tool::Pnt(TopoDS::Vertex(P2->GetValue()));
- gp_Pnt aP5 = BRep_Tool::Pnt(TopoDS::Vertex(vi1->GetValue()));
- double deltaZ = aP2.Z() - aP5.Z();
- // std::cerr << "Creating new point from vi1 with deltaZ = " << deltaZ << std::endl;
- Handle(GEOM_Object) P5bis = myTransformOperations->TranslateDXDYDZCopy(vi1, 0, 0, deltaZ);
- if (P5bis.IsNull()) {
- SetErrorCode("Impossible to translate vertex");
- return false;
- }
- P5bis->GetLastFunction()->SetDescription("");
-
- gp_Pnt aP4 = BRep_Tool::Pnt(TopoDS::Vertex(P4->GetValue()));
- gp_Pnt aP6 = BRep_Tool::Pnt(TopoDS::Vertex(vi2->GetValue()));
- deltaZ = aP4.Z() - aP6.Z();
- // std::cerr << "Creating new point from vi2 with deltaZ = " << deltaZ << std::endl;
- Handle(GEOM_Object) P6bis = myTransformOperations->TranslateDXDYDZCopy(vi2, 0, 0, deltaZ);
- if (P6bis.IsNull()) {
- SetErrorCode("Impossible to translate vertex");
- return false;
- }
- P6bis->GetLastFunction()->SetDescription("");
+ // Create a prism from edge_chan_inc
+ Handle(GEOM_Object) aPrismDir = myBasicOperations->MakeVectorDXDYDZ(1., 1., 0.);
- // std::cerr << "Creating new line 1 from 2 previous points" << std::endl;
- Handle(GEOM_Object) Cote_3 = myBasicOperations->MakeLineTwoPnt(P5bis, P2);
- if (Cote_3.IsNull()) {
- SetErrorCode("Impossible to build edge in thickness");
+ if (aPrismDir.IsNull()) {
+ SetErrorCode("Impossible to build Prism direction");
return false;
}
- Cote_3->GetLastFunction()->SetDescription("");
+ aPrismDir->GetLastFunction()->SetDescription("");
+ face_t2 = my3DPrimOperations->MakePrismVecH(edge_chan_inc, aPrismDir, theR2 + theW2);
- // std::cerr << "Creating new line 2 from 2 previous points" << std::endl;
- Handle(GEOM_Object) Cote_4 = myBasicOperations->MakeLineTwoPnt(P6bis, P4);
- if (Cote_4.IsNull()) {
- SetErrorCode("Impossible to build edge in thickness");
- return false;
- }
- Cote_4->GetLastFunction()->SetDescription("");
-
- // std::cerr << "Creating new line 3 from 2 previous points" << std::endl;
- Handle(GEOM_Object) Cote_5 = myBasicOperations->MakeLineTwoPnt(P5bis, P6bis);
- if (Cote_4.IsNull()) {
- SetErrorCode("Impossible to build edge in thickness");
- return false;
- }
- Cote_5->GetLastFunction()->SetDescription("");
-
- //std::list<Handle(GEOM_Object)> edgeList2;
- //edgeList2.push_back(edge_chan_inc);
- //edgeList2.push_back(Cote_3);
- //edgeList2.push_back(Cote_5);
- //edgeList2.push_back(Cote_4);
- // std::cerr << "Creating wire 2" << std::endl;
- //wire_t2 = myShapesOperations->MakeWire(edgeList2, 1e-7);
- //if (wire_t2.IsNull()) {
- // SetErrorCode("Impossible to build wire");
- // return false;
- //}
- //wire_t2->GetLastFunction()->SetDescription("");
- // std::cerr << "Creating face 2" << std::endl;
- //face_t2 = myShapesOperations->MakeFace(wire_t2, false);
-
- // Mantis issue 0021682
- face_t2 = my3DPrimOperations->MakePrismVecH(edge_chan_inc, Cote_4, - (theR2 + theW2));
- //face_t2 = my3DPrimOperations->MakePrismVecH(edge_chan_inc, Cote_4, - 2.0*theR2);
if (face_t2.IsNull()) {
SetErrorCode("Impossible to build face");
return false;
// Last verification: result should be a block
std::list<GEOMImpl_IBlocksOperations::BCError> errList;
- if (!myBlocksOperations->CheckCompoundOfBlocks(Te3,errList)) {
+ if (!myBlocksOperations->CheckCompoundOfBlocks(Te3, -1, errList)) {
SetErrorCode("TShape is not a compound of block");
return false;
}
// Mirror and glue faces
bool AdvancedEngine_IOperations::MakePipeTShapeMirrorAndGlue(Handle(GEOM_Object) theShape,
- double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2)
+ double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2)
{
SetErrorCode(KO);
TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
TNaming_CopyShape::CopyTool(Te7->GetValue(), aMapTShapes, aShapeCopy);
- Handle(GEOM_Object) Te8 = myShapesOperations->MakeGlueFaces(Te7, 1e-7, true);
+ std::list<Handle(GEOM_Object)> Te7list( 1, Te7 );
+ Handle(GEOM_Object) Te8 = myShapesOperations->MakeGlueFaces(Te7list, 1e-7, true);
if (Te8.IsNull()) {
SetErrorCode("Impossible to glue faces of TShape");
return false;
// Perform gluing
Te7->GetLastFunction()->SetValue(aShapeCopy);
- Te8 = myShapesOperations->MakeGlueFaces(Te7, aTolMax, true);
+ Te8 = myShapesOperations->MakeGlueFaces(Te7list, aTolMax, true);
if (Te8.IsNull()) {
SetErrorCode("Impossible to glue faces of TShape");
//purpose : Static method. Create one thickness reduction element.
//=======================================================================
TopoDS_Shape AdvancedEngine_IOperations::MakeThicknessReduction (gp_Ax2 theAxes,
- const double R, const double W,
- const double Rthin, const double Wthin,
- const double Ltrans, const double Lthin,
- bool fuse)
+ const double R, const double W,
+ const double Rthin, const double Wthin,
+ const double Ltrans, const double Lthin,
+ bool fuse)
{
double aTol = Precision::Confusion();
if (Rthin < aTol || Wthin < aTol || Ltrans < aTol) {
//=============================================================================
Handle(TColStd_HSequenceOfTransient)
AdvancedEngine_IOperations::MakePipeTShape(double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theRL, double theWL, double theLtransL, double theLthinL,
- double theRR, double theWR, double theLtransR, double theLthinR,
- double theRI, double theWI, double theLtransI, double theLthinI,
- bool theHexMesh)
+ double theR2, double theW2, double theL2,
+ double theRL, double theWL, double theLtransL, double theLthinL,
+ double theRR, double theWR, double theLtransR, double theLthinR,
+ double theRI, double theWI, double theLtransI, double theLthinI,
+ bool theHexMesh)
{
MESSAGE("AdvancedEngine_IOperations::MakePipeTShape");
SetErrorCode(KO);
aFillet->GetLastFunction()->SetDescription("");
TopoDS_Shape aFilletShape = aFillet->GetValue();
+
+#ifdef FILLET_FIX_TOLERANCE
+ // VSR: 30/12/2014: temporary workaround about Fillet problem
+ if (theHexMesh) {
+ GEOMUtils::FixShapeTolerance(aFilletShape, TopAbs_FACE);
+ }
+ else {
+ GEOMUtils::FixShapeCurves(aFilletShape);
+ }
+#endif
+
aFunction->SetValue(aFilletShape);
// END of fillet
aFillet->GetLastFunction()->SetDescription("");
TopoDS_Shape aFilletShape = aFillet->GetValue();
+
+#ifdef FILLET_FIX_TOLERANCE
+ // VSR: 30/12/2014: temporary workaround about Fillet problem
+ if (theHexMesh) {
+ GEOMUtils::FixShapeTolerance(aFilletShape, TopAbs_FACE);
+ }
+ else {
+ GEOMUtils::FixShapeCurves(aFilletShape);
+ }
+#endif
+
aFunction->SetValue(aFilletShape);
// END of fillet
*/
//=============================================================================
Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedDisk (double theR, double theRatio,
- int theOrientation, int thePattern)
+ int theOrientation, int thePattern)
{
SetErrorCode(KO);
*/
//=============================================================================
Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedDiskPntVecR (Handle(GEOM_Object) thePnt,
- Handle(GEOM_Object) theVec,
- double theR,
- double theRatio,
- int thePattern)
+ Handle(GEOM_Object) theVec,
+ double theR,
+ double theRatio,
+ int thePattern)
{
SetErrorCode(KO);
*/
//=============================================================================
Handle(GEOM_Object) AdvancedEngine_IOperations::MakeDividedCylinder (double theR,
- double theH,
- int thePattern)
+ double theH,
+ int thePattern)
{
SetErrorCode(KO);
*/
//=============================================================================
Handle(GEOM_Object) AdvancedEngine_IOperations::MakeSmoothingSurface (std::list<Handle(GEOM_Object)> thelPoints,
- int theNbMax,
- int theDegMax,
- double theDMax)
+ int theNbMax,
+ int theDegMax,
+ double theDMax)
{
SetErrorCode(KO);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "GEOM_Function.hxx"
#include "GEOM_IOperations.hxx"
#include "GEOMUtils.hxx"
-#include "GEOMAlgo_FinderShapeOn1.hxx"
#include "GEOMAlgo_FinderShapeOn2.hxx"
#include "GEOMAlgo_ClsfBox.hxx"
+#include "GEOMAlgo_ClsfSurf.hxx"
#include "GEOMAlgo_Splitter.hxx"
#include "Geom_CylindricalSurface.hxx"
#include <vector>
+// Undefine below macro to enable workaround about problem with wrong
+// tolerances of intersection curves in MakePipeTShape and MakeQuarterPipeTShape
+// VSR 30/12/2014: macro enabled
+#define FIX_CURVES_TOLERANCES
+
//=======================================================================
//function : GetID
//purpose :
// Interprete results
Standard_Integer iErr = aFinder.ErrorStatus();
- // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of error codes is in GEOMAlgo_FinderShapeOn2.cxx
if (iErr) {
TCollection_AsciiString aMsg (" iErr : ");
aMsg += TCollection_AsciiString(iErr);
}
// Call algo
- GEOMAlgo_FinderShapeOn1 aFinder;
- Standard_Real aTol = 1e-6;
+ GEOMAlgo_FinderShapeOn2 aFinder;
+ Handle(GEOMAlgo_ClsfSurf) aClsfSurf = new GEOMAlgo_ClsfSurf;
+ Standard_Real aTol = 1e-6;
+ aClsfSurf->SetSurface(theSurface);
aFinder.SetShape(theShape);
aFinder.SetTolerance(aTol);
- aFinder.SetSurface(theSurface);
+ aFinder.SetClsf(aClsfSurf);
aFinder.SetShapeType(theShapeType);
aFinder.SetState(theState);
// Interprete results
Standard_Integer iErr = aFinder.ErrorStatus();
- // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of error codes is in GEOMAlgo_FinderShapeOn2.cxx
if (iErr) {
// MESSAGE(" iErr : " << iErr);
TCollection_AsciiString aMsg (" iErr : ");
return aSeqOfIDs;
}
// Standard_Integer iWrn = aFinder.WarningStatus();
- // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn2.cxx
// if (iWrn) {
// MESSAGE(" *** iWrn : " << iWrn);
// }
//purpose :
//=======================================================================
TopoDS_Shape AdvancedEngine_PipeTShapeDriver::MakePipeTShape (const double r1, const double w1, const double l1,
- const double r2, const double w2, const double l2) const
+ const double r2, const double w2, const double l2) const
{
double r1Ext = r1 + w1;
double r2Ext = r2 + w2;
StdFail_NotDone::Raise("Coudn't cut cylinders");
}
- return Te.Shape();
+ TopoDS_Shape aShape = Te.Shape();
+
+ // VSR: 30/12/2014: temporary workaround about intersection curves problem
+#ifdef FIX_CURVES_TOLERANCES
+ GEOMUtils::FixShapeCurves(aShape);
+#endif
+
+ return aShape;
}
//=======================================================================
//purpose :
//=======================================================================
TopoDS_Shape AdvancedEngine_PipeTShapeDriver::MakeQuarterPipeTShape (const double r1, const double w1, const double l1,
- const double r2, const double w2, const double l2) const
+ const double r2, const double w2, const double l2) const
{
TopoDS_Shape Te = MakePipeTShape(r1, w1, l1, r2, w2, l2);
if (Te.IsNull())
StdFail_NotDone::Raise("Couldn't cut Pipe Tshape with box");
}
+ TopoDS_Shape aShape = Te4.Shape();
+
+ // VSR: 30/12/2014: temporary workaround about intersection curves problem
+#ifdef FIX_CURVES_TOLERANCES
+ GEOMUtils::FixShapeCurves(aShape);
+#endif
+
return Te4.Shape();
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
</message>
<message>
<source>GEOM_DIVIDEDDISK</source>
- <translation>Divided_Disk</translation>
+ <translation>分割ディスク</translation>
</message>
<message>
<source>GEOM_DIVIDEDDISK_TITLE</source>
</message>
<message>
<source>GEOM_DIVIDEDCYLINDER</source>
- <translation>Divided_Cylinder</translation>
+ <translation>分割シリンダー</translation>
</message>
<message>
<source>GEOM_DIVIDEDCYLINDER_TITLE</source>
</message>
<message>
<source>JUNCTION_FACE_1</source>
- <translation>Junction 1</translation>
+ <translation>継手面1</translation>
</message>
<message>
<source>JUNCTION_FACE_2</source>
- <translation>Junction 2</translation>
+ <translation>継手面2</translation>
</message>
<message>
<source>JUNCTION_FACE_3</source>
- <translation>Junction 3</translation>
+ <translation>継手面3</translation>
</message>
<message>
<source>INTERNAL_FACES</source>
- <translation>å\86\85é\83¨ã\81®é¡\94</translation>
+ <translation>å\86\85é\83¨ã\81®é\9d¢</translation>
</message>
</context>
<context>
</message>
<message>
<source>GEOM_PIPE_TSHAPE</source>
- <translation>PipeTShape</translation>
+ <translation>T型パイプ</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_MPIPE</source>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_POSITION_LBL_L1</source>
- <translation>New L1</translation>
+ <translation>T型パイプの位置 L1</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_POSITION_LBL_L2</source>
- <translation>New L2</translation>
+ <translation>T型パイプの位置 L2</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_LEFT_TR</source>
</message>
<message>
<source>GEOM_PIPETSHAPE_ERR_EQUAL_RADII_L</source>
- <translation type="unfinished">メインパイプの半径は、左側薄型化(rL)と等しくすることはできません!</translation>
+ <translation>メインパイプの半径は、左側薄型化(rL)と等しくすることはできません!</translation>
</message>
<message>
<source>GEOM_PIPETSHAPE_ERR_EQUAL_EXT_RADII_L</source>
- <translation type="unfinished">メインパイプの外半径(半径+幅)は、左側薄型化外半径(rL+wL)と等しくすることはできません!</translation>
+ <translation>メインパイプの外半径(半径+幅)は、左側薄型化外半径(rL+wL)と等しくすることはできません!</translation>
</message>
<message>
<source>GEOM_PIPETSHAPE_ERR_EQUAL_RADII_R</source>
- <translation type="unfinished">メインパイプの半径は、右側薄型化半径(rR)と同じにすることはできません!</translation>
+ <translation>メインパイプの半径は、右側薄型化半径(rR)と同じにすることはできません!</translation>
</message>
<message>
<source>GEOM_PIPETSHAPE_ERR_EQUAL_EXT_RADII_R</source>
- <translation type="unfinished">メインパイプの外半径(半径+幅)は、右側薄型化外半径(rR+wR)と等しくすることはできません!</translation>
+ <translation>メインパイプの外半径(半径+幅)は、右側薄型化外半径(rR+wR)と等しくすることはできません!</translation>
</message>
<message>
<source>GEOM_PIPETSHAPE_ERR_EQUAL_RADII_I</source>
- <translation type="unfinished">インシデントパイプの半径は、インシデントパイプ薄肉化半径(rl)と等しくすることはできません!</translation>
+ <translation>インシデントパイプの半径は、インシデントパイプ薄肉化半径(rl)と等しくすることはできません!</translation>
</message>
<message>
<source>GEOM_PIPETSHAPE_ERR_EQUAL_EXT_RADII_I</source>
- <translation type="unfinished">インシデントパイプの外半径(半径+厚さ)は、インシデントパイプの薄肉化外半径(rI+wI)と等しくすることはできません!</translation>
+ <translation>インシデントパイプの外半径(半径+厚さ)は、インシデントパイプの薄肉化外半径(rI+wI)と等しくすることはできません!</translation>
</message>
</context>
<context>
</message>
<message>
<source>GEOM_SMOOTHINGSURFACE_ARG_NB_MAX</source>
- <translation>ベジェパッチの最大数</translation>
+ <translation>ベジェパッチの最大数<</translation>
</message>
<message>
<source>GEOM_SMOOTHINGSURFACE_ARG_DEG_MAX</source>
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
if (myEditCurrentArgument == GroupPntVecR->LineEdit2) {
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
else {
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
return res;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> AdvancedGUI_DividedDiskDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myPoint << myDir;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
//globalSelection(GEOM_POINT);
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
}
erasePreview(true);
}
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> AdvancedGUI_PipeTShapeDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr1(myPoint1), aGeomObjPtr2(myPoint2), aGeomObjPtr3(myPoint3);
+ res << aGeomObjPtr1 << aGeomObjPtr2 << aGeomObjPtr3;
+ return res;
+}
+
//=================================================================================
// function : AdvancedGUI_4Spin
// purpose :
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
showOnlyPreviewControl();
+ globalSelection();
+ localSelection( TopAbs_VERTEX );
//@@ initialize dialog box widgets here @@//
// Signal/slot connections
return false;
initName();
-
+ globalSelection();
+ localSelection( TopAbs_VERTEX );
return true;
}
void AdvancedGUI_SmoothingSurfaceDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
+ globalSelection();
+ localSelection( TopAbs_VERTEX );
//displayPreview();
}
return res;
}
+//=================================================================================
+// function : addSubshapesToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void AdvancedGUI_SmoothingSurfaceDlg::addSubshapesToStudy()
+{
+ for ( int i = 0; i < myPoints.count(); i++ )
+ GEOMBase::PublishSubObject( myPoints[i].get() );
+}
+
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> AdvancedGUI_SmoothingSurfaceDlg::getSourceObjects()
+{
+ return myPoints;
+}
+
//=================================================================================
// function : getNbPoints()
// purpose : Returns the number of points in myPoints list.
if ( sender() == GroupPoints->PushButton1 )
myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setFocus();
+ globalSelection();
+ localSelection( TopAbs_VERTEX );
SelectionIntoArgument();
}
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "GEOM_Operation.h"
#include "GEOMBase.h"
#include "GEOM_Displayer.h"
+#include "GEOM_GenericObjPtr.h"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(BREPPlugin)
+typedef GEOM::GenericObjPtr<GEOM::IBREPOperations> BREPOpPtr;
+
//=======================================================================
// function : BREPPlugin_GUI()
// purpose : Constructor
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "BREPPluginEngine" );
- GEOM::IBREPOperations_var brepOp = GEOM::IBREPOperations::_narrow( op );
- if ( CORBA::is_nil( brepOp ) ) return false;
+ BREPOpPtr brepOp = GEOM::IBREPOperations::_narrow( op );
+ if ( brepOp.isNull() ) return false;
QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""),
tr( "BREP_FILES" ),
foreach( QString fileName, fileNames )
{
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, brepOp.in() );
+ GEOM_Operation transaction( app, brepOp.get() );
try
{
entryList.append( so->GetID() );
transaction.commit();
GEOM_Displayer( study ).Display( main.in() );
+ main->UnRegister();
}
else
{
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "BREPPluginEngine" );
- GEOM::IBREPOperations_var brepOp = GEOM::IBREPOperations::_narrow( op );
- if ( CORBA::is_nil( brepOp ) ) return false;
+ BREPOpPtr brepOp = GEOM::IBREPOperations::_narrow( op );
+ if ( brepOp.isNull() ) return false;
LightApp_SelectionMgr* sm = app->selectionMgr();
if ( !sm ) return false;
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, brepOp.in() );
+ GEOM_Operation transaction( app, brepOp.get() );
try
{
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="ja" sourcelanguage="en">
-<context>
+ <context>
<name>@default</name>
<message>
- <source>MEN_EXPORTBREP</source>
- <translation type="unfinished">BREP</translation>
+ <source>MEN_EXPORTBREP</source>
+ <translation>BREPエキスポート</translation>
</message>
<message>
- <source>TOP_EXPORTBREP</source>
- <translation type="unfinished">Export BREP</translation>
+ <source>TOP_EXPORTBREP</source>
+ <translation>BREPエキスポート</translation>
</message>
<message>
- <source>STB_EXPORTBREP</source>
- <translation type="unfinished">Export BREP</translation>
+ <source>STB_EXPORTBREP</source>
+ <translation>BREPエキスポート</translation>
</message>
<message>
- <source>MEN_IMPORTBREP</source>
- <translation type="unfinished">BREP</translation>
+ <source>MEN_IMPORTBREP</source>
+ <translation>BREPインポート</translation>
</message>
<message>
- <source>TOP_IMPORTBREP</source>
- <translation type="unfinished">Import BREP</translation>
+ <source>TOP_IMPORTBREP</source>
+ <translation>BREPインポート</translation>
</message>
<message>
- <source>STB_IMPORTBREP</source>
- <translation type="unfinished">Import BREP</translation>
+ <source>STB_IMPORTBREP</source>
+ <translation>BREPインポート</translation>
</message>
-</context>
-<context>
+ </context>
+ <context>
<name>BREPPlugin_GUI</name>
<message>
- <source>BREP_FILES</source>
- <translation type="unfinished">BREP files( *.brep )</translation>
+ <source>BREP_FILES</source>
+ <translation>BREP ファイル ( *.brep )</translation>
</message>
<message>
- <source>EXPORT_TITLE</source>
- <translation type="unfinished">Export BREP</translation>
+ <source>EXPORT_TITLE</source>
+ <translation>BREPエキスポート</translation>
</message>
<message>
- <source>IMPORT_TITLE</source>
- <translation type="unfinished">Import BREP</translation>
+ <source>IMPORT_TITLE</source>
+ <translation>BREPインポート</translation>
</message>
-</context>
+ </context>
</TS>
-# Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
void BasicGUI_ArcDlg::SetEditCurrentArgument()
{
globalSelection(); // close local selection to clear it
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
QPushButton* send = (QPushButton*)sender();
switch ( getConstructorId() ) {
}
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
+ localSelection( TopAbs_VERTEX ); //Select Vertex on All Shapes
qApp->processEvents();
updateGeometry();
break;
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BasicGUI_ArcDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myPoint1 << myPoint2 << myPoint3;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <SUIT_Session.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
+#include "utilities.h"
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS_Shape.hxx>
myEditCurrentArgument->setFocus();
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ),
this, SLOT( SelectionIntoArgument() ) );
TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) ?
TopAbs_EDGE : TopAbs_VERTEX;
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
+ localSelection( aNeedType );
myEditCurrentArgument->setFocus();
// SelectionIntoArgument();
break;
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BasicGUI_CircleDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myPoint << myDir << myPoint1 << myPoint2 << myPoint3
+ << myPoint4 << myPoint5 << myPoint6;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
-
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
if (sender() == myGroupPoints->PushButton1) {
myEditCurrentArgument = myGroupPoints->LineEdit1;
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
else if (sender() == myPushBtnV1) {
myEditCurrentArgument = myLineEditV1;
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
else if (sender() == myPushBtnV2) {
myEditCurrentArgument = myLineEditV2;
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
myEditCurrentArgument->setFocus();
GEOMBase::PublishSubObject( myPoints[i].get() );
}
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BasicGUI_CurveDlg::getSourceObjects()
+{
+ return myPoints;
+}
//=================================================================================
// function : CreationModeChanged
// purpose :
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
initName( tr( "GEOM_ELLIPSE" ) );
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
resize( minimumSizeHint() );
SelectionIntoArgument();
myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
displayPreview(true);
return true;
myEditCurrentArgument == GroupPoints->LineEdit3 ) ?
TopAbs_EDGE : TopAbs_VERTEX;
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
+ localSelection( aNeedType );
myEditCurrentArgument->setFocus();
//SelectionIntoArgument();
myDir.nullify();
//globalSelection( GEOM_POINT );
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
}
//=================================================================================
GEOMBase::PublishSubObject( myDir.get() );
GEOMBase::PublishSubObject( myMajor.get() );
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BasicGUI_EllipseDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myPoint << myDir << myMajor;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
myEditCurrentArgument == GroupFaces->LineEdit2 ) ?
TopAbs_FACE : TopAbs_VERTEX;
globalSelection(); // close local selection to clear it
- localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
+ localSelection( aNeedType );
qApp->processEvents();
updateGeometry();
myEditCurrentArgument == GroupFaces->LineEdit2 ) ?
TopAbs_FACE : TopAbs_VERTEX;
globalSelection(); // close local selection to clear it
- localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
+ localSelection( aNeedType );
myEditCurrentArgument->setFocus();
// SelectionIntoArgument();
break;
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BasicGUI_LineDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myPoint1 << myPoint2 << myFace1 << myFace2;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
-
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
+
private:
void Init();
void enterEvent( QEvent* );
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
{
if ( myConstructorId == constructorId && myConstructorId == 0 ) {
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
activate( GEOM_MARKER );
return;
}
Group2->hide();
aMainGrp->show();
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
activate( GEOM_MARKER );
break;
}
Group2->PushButton2->setDown( false );
Group2->PushButton3->setDown( false );
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
myEditCurrentArgument = Group2->LineEdit1;
Group2->LineEdit1->setText( "" );
Group2->LineEdit2->setText( "" );
}
else if ( send == Group2->PushButton1 ) {
myEditCurrentArgument = Group2->LineEdit1;
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
Group2->PushButton2->setDown( false );
Group2->PushButton3->setDown( false );
Group2->LineEdit1->setEnabled( true );
}
else if ( send == Group2->PushButton2 ) {
myEditCurrentArgument = Group2->LineEdit2;
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
Group2->PushButton1->setDown( false );
Group2->PushButton3->setDown( false );
Group2->LineEdit1->setEnabled( false );
}
else if ( send == Group2->PushButton3 ) {
myEditCurrentArgument = Group2->LineEdit3;
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
Group2->PushButton1->setDown( false );
Group2->PushButton2->setDown( false );
Group2->LineEdit1->setEnabled( false );
default:
break;
}
+}
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BasicGUI_MarkerDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myShape << myPoint << myVectorX << myVectorY;
+ return res;
}
//=================================================================================
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
typedef QMap< int, SalomeApp_DoubleSpinBox* > DataMap;
public:
- BasicGUI_MarkerDlg( GeometryGUI*, QWidget* );
- virtual ~BasicGUI_MarkerDlg();
- void Init();
+ BasicGUI_MarkerDlg( GeometryGUI*, QWidget* );
+ virtual ~BasicGUI_MarkerDlg();
+ void Init();
protected:
- virtual GEOM::GEOM_IOperations_ptr createOperation();
- virtual bool isValid( QString& );
- virtual bool execute( ObjectList& );
- virtual void displayPreview ( const bool = false,
- const bool = true,
- const bool = true,
- const double = -1 );
- virtual void addSubshapesToStudy();
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid( QString& );
+ virtual bool execute( ObjectList& );
+ virtual void displayPreview ( const bool = false,
+ const bool = true,
+ const bool = true,
+ const double = -1 );
+ virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
- void enterEvent( QEvent* );
- void onSelectionDone0();
+ void enterEvent( QEvent* );
+ void onSelectionDone0();
- GEOM::GeomObjPtr myShape;
- GEOM::GeomObjPtr myPoint;
- GEOM::GeomObjPtr myVectorX;
- GEOM::GeomObjPtr myVectorY;
+ GEOM::GeomObjPtr myShape;
+ GEOM::GeomObjPtr myPoint;
+ GEOM::GeomObjPtr myVectorX;
+ GEOM::GeomObjPtr myVectorY;
private slots:
- void onOk();
- bool onApply();
- void onActivate();
- void onDeactivate();
- void onSelectionDone();
- void onValueChanged( double );
- void ConstructorsClicked( int );
- void SetEditCurrentArgument();
+ void onOk();
+ bool onApply();
+ void onActivate();
+ void onDeactivate();
+ void onSelectionDone();
+ void onValueChanged( double );
+ void ConstructorsClicked( int );
+ void SetEditCurrentArgument();
private:
- DataMap myData;
- int myConstructorId;
- int myBlockPreview;
+ DataMap myData;
+ int myConstructorId;
+ int myBlockPreview;
- QFrame* aMainGrp;
- DlgRef_1Sel* Group1;
- DlgRef_3Sel* Group2;
+ QFrame* aMainGrp;
+ DlgRef_1Sel* Group1;
+ DlgRef_3Sel* Group2;
};
#endif // BASICGUI_MARKERDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
/* for the first argument */
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
break;
}
case 1: /* plane from 3 points */
/* for the first argument */
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
break;
}
case 2: /* plane from a planar face */
GroupFace->PushButton1->setDown( true );
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
+ localSelection( TopAbs_FACE );
break;
}
case 3: /* plane from a 2 Vectors */
Group2Vec->PushButton1->setDown( true );
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
break;
}
case 4: /* plane from a LCS */
if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ||
myEditCurrentArgument == Group2Vec->LineEdit1 ||
myEditCurrentArgument == Group2Vec->LineEdit2 ) {
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
} else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) {
TColStd_MapOfInteger aMap;
aMap.Add( GEOM_PLANE );
globalSelection( GEOM_MARKER );
}
else { // 3 Pnts
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
}
// SelectionIntoArgument();
break;
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BasicGUI_PlaneDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myPoint << myDir << myPoint1 << myPoint2 << myPoint3
+ << myFace << myVec1 << myVec2 << myLCS;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <QRadioButton>
#include <QMenu>
#include <QTimer>
+#include <QList>
#include <gp_Pnt.hxx>
#include <TopoDS_Shape.hxx>
#define SPACING 6
#define MARGIN 9
-enum { SelectEdge, SelectWire };
-
//=================================================================================
// class : BasicGUI_PointDlg()
// purpose : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the
GroupXYZ->TextLabel2->setText(tr("GEOM_Y"));
GroupXYZ->TextLabel3->setText(tr("GEOM_Z"));
- GroupOnCurve = new DlgRef_2Sel1Spin(centralWidget());
+ GroupOnCurve = new DlgRef_2Sel1Spin2Check(centralWidget());
GroupOnCurve->GroupBox1->setTitle(tr("GEOM_POINT_ON_EDGE"));
GroupOnCurve->TextLabel1->setText(tr("GEOM_EDGE"));
GroupOnCurve->TextLabel2->setText(tr("GEOM_START_POINT"));
GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER"));
GroupOnCurve->PushButton1->setIcon(image2);
GroupOnCurve->PushButton2->setIcon(image2);
+ GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER"));
+ GroupOnCurve->CheckButton1->setText(tr("GEOM_TAKE_ORIENTATION_INTO_ACCOUNT"));
+ GroupOnCurve->CheckButton2->setAttribute( Qt::WA_DeleteOnClose );
+ GroupOnCurve->CheckButton2->close();
GroupOnSurface = new DlgRef_1Sel2Spin(centralWidget());
GroupOnSurface->GroupBox1->setTitle(tr("GEOM_POINT_ON_FACE"));
GroupRefPoint->TextLabel4->setText(tr("GEOM_DZ"));
/* popup menu for line intersect buttons */
- myBtnPopup = new QMenu(this);
QIcon ico_line = QIcon(image6);
QIcon ico_wire = QIcon(image7);
- myActions[myBtnPopup->addAction(ico_line, tr("GEOM_EDGE"))] = SelectEdge;
- myActions[myBtnPopup->addAction(ico_wire, tr("GEOM_WIRE"))] = SelectWire;
GroupLineIntersection = new DlgRef_2Sel(centralWidget());
GroupLineIntersection->GroupBox1->setTitle(tr("GEOM_LINE_INTERSECTION"));
GroupLineIntersection->TextLabel1->setText(tr("GEOM_LINE1"));
GroupLineIntersection->TextLabel2->setText(tr("GEOM_LINE2"));
GroupLineIntersection->PushButton1->setIcon(image2);
- GroupLineIntersection->PushButton1->setMenu(myBtnPopup);
GroupLineIntersection->PushButton2->setIcon(image2);
- GroupLineIntersection->PushButton2->setMenu(myBtnPopup);
GroupLineIntersection->LineEdit2->setEnabled(false);
myCoordGrp = new QGroupBox(tr("GEOM_COORDINATES_RES"), centralWidget());
initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., step, "parametric_precision");
GroupOnCurve->SpinBox_DX->setValue(0.5);
+ GroupOnCurve->CheckButton1->setChecked(true);
initSpinBox(GroupOnSurface->SpinBox_DX, 0., 1., step, "parametric_precision");
GroupOnSurface->SpinBox_DX->setValue(0.5);
connect(myParamCoord, SIGNAL(buttonClicked(int)), this, SLOT(ClickParamCoord(int)));
+ connect(GroupOnCurve->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CheckBoxClicked()));
+
connect(GroupOnCurve->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupOnCurve->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupOnSurface->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupLineIntersection->PushButton1, SIGNAL(pressed()), this, SLOT(SetEditCurrentArgument()));
connect(GroupLineIntersection->PushButton2, SIGNAL(pressed()), this, SLOT(SetEditCurrentArgument()));
-
- connect(myBtnPopup, SIGNAL(triggered(QAction*)), this, SLOT(onBtnPopup(QAction*)));
-
+
connect(GroupOnCurve->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupOnSurface->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupOnSurface->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_VERTEX;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
GroupRefPoint->hide();
GroupOnCurve->hide();
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_VERTEX;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
myEditCurrentArgument = GroupRefPoint->LineEdit1;
myEditCurrentArgument->setText("");
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_EDGE;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
myEditCurrentArgument = GroupOnCurve->LineEdit1;
myEditCurrentArgument->setText("");
case GEOM_POINT_INTINT:
{
globalSelection(); // close local contexts, if any
- myNeedType = TopAbs_EDGE;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ std::list<int> needTypes;
+ needTypes.push_back( TopAbs_EDGE ), needTypes.push_back( TopAbs_WIRE );
+ localSelection(needTypes );
myEditCurrentArgument = GroupLineIntersection->LineEdit1;
GroupLineIntersection->LineEdit1->setText("");
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_FACE;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
myEditCurrentArgument = GroupOnSurface->LineEdit1;
myEditCurrentArgument->setText("");
myLine2.nullify();
}
- GEOM::GeomObjPtr aSelectedObject = getSelected(myNeedType);
+ GEOM::GeomObjPtr aSelectedObject;
+ if (id == GEOM_POINT_INTINT) {
+ QList<TopAbs_ShapeEnum> needTypes;
+ needTypes << TopAbs_EDGE, needTypes << TopAbs_WIRE;
+ aSelectedObject= getSelected(needTypes);
+ }
+ else
+ aSelectedObject= getSelected(myNeedType);
TopoDS_Shape aShape;
if (aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) && !aShape.IsNull()) {
QString aName = GEOMBase::GetName(aSelectedObject.get());
if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) {
myLine1 = aSelectedObject;
if (myLine1 && !myLine2) {
- GroupLineIntersection->PushButton2->setMenu(0);
GroupLineIntersection->PushButton2->click();
- GroupLineIntersection->PushButton2->setDown(true);
- GroupLineIntersection->PushButton2->setMenu(myBtnPopup);
}
}
else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) {
myLine2 = aSelectedObject;
if (myLine2 && !myLine1) {
- GroupLineIntersection->PushButton1->setMenu(0);
GroupLineIntersection->PushButton1->click();
- GroupLineIntersection->PushButton1->setDown(true);
- GroupLineIntersection->PushButton1->setMenu(myBtnPopup);
}
}
}
GroupRefPoint->LineEdit1->setFocus();
myEditCurrentArgument = GroupRefPoint->LineEdit1;
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
else if (send == GroupOnCurve->PushButton1) {
GroupOnCurve->LineEdit1->setFocus();
myEditCurrentArgument = GroupOnCurve->LineEdit1;
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_EDGE;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
GroupOnCurve->PushButton2->setDown(false);
GroupOnCurve->LineEdit1->setEnabled(true);
GroupOnCurve->LineEdit2->setEnabled(false);
myEditCurrentArgument = GroupOnCurve->LineEdit2;
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_VERTEX;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
GroupOnCurve->PushButton1->setDown(false);
GroupOnCurve->LineEdit2->setEnabled(true);
GroupOnCurve->LineEdit1->setEnabled(false);
GroupOnSurface->LineEdit1->setFocus();
myEditCurrentArgument = GroupOnSurface->LineEdit1;
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE);
+ localSelection(TopAbs_FACE);
}
else if (send == GroupLineIntersection->PushButton1) {
GroupLineIntersection->LineEdit1->setFocus();
}
send->setDown(true);
- if ((send == GroupLineIntersection->PushButton1 ||
- send == GroupLineIntersection->PushButton2) && !myBusy)
- SelectionIntoArgument();
+ // if ((send == GroupLineIntersection->PushButton1 ||
+ // send == GroupLineIntersection->PushButton2) && !myBusy)
+ // SelectionIntoArgument();
}
// function : CheckBoxClicked()
// purpose : Check Boxes Management
//=================================================================================
-void BasicGUI_PointDlg::CheckBoxClicked(int State)
+void BasicGUI_PointDlg::CheckBoxClicked()
{
displayPreview(true);
}
case GEOM_POINT_EDGE :
{
if (myParamCoord->checkedId() == PARAM_VALUE) {
- anObj = anOper->MakePointOnCurve(myEdge.get(), getParameter());
+ bool isUseOrientation = GroupOnCurve->CheckButton1->isChecked();
+
+ anObj = anOper->MakePointOnCurve(myEdge.get(), getParameter(), isUseOrientation);
aParameters<<GroupOnCurve->SpinBox_DX->text();
}
else if (myParamCoord->checkedId() == LENGTH_VALUE) {
}
}
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BasicGUI_PointDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myRefPoint << myEdge << myLine1 << myLine2 << myFace;
+ return res;
+}
+
//=================================================================================
// function : ClickParamCoord()
// purpose :
GroupOnCurve->LineEdit2->setVisible(isLength);
GroupOnCurve->TextLabel3->setVisible(isParam || isLength);
GroupOnCurve->SpinBox_DX->setVisible(isParam || isLength);
+ GroupOnCurve->CheckButton1->setVisible(isParam);
if (isParam){
initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., 0.1, "parametric_precision");
GroupOnCurve->SpinBox_DX->setValue(0.5);
QTimer::singleShot(50, this, SLOT(updateSize()));
}
-//=================================================================================
-// function : onBtnPopup()
-// purpose :
-//=================================================================================
-void BasicGUI_PointDlg::onBtnPopup(QAction* a)
-{
- globalSelection(); // close local contexts, if any
- myNeedType = myActions[a] == SelectEdge ? TopAbs_EDGE : TopAbs_WIRE;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
-}
-
//=================================================================================
// function : updateSize
// purpose : adjust dialog size to minimum
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GEOM_GenericObjPtr.h"
#include <QMap>
-class DlgRef_2Sel1Spin;
+class DlgRef_2Sel1Spin2Check;
class DlgRef_3Spin;
class DlgRef_2Sel;
class DlgRef_1Sel3Spin;
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
DlgRef_3Spin* GroupXYZ;
DlgRef_1Sel3Spin* GroupRefPoint;
- DlgRef_2Sel1Spin* GroupOnCurve;
+ DlgRef_2Sel1Spin2Check* GroupOnCurve;
DlgRef_2Sel* GroupLineIntersection;
DlgRef_1Sel2Spin* GroupOnSurface;
QGroupBox* myParamGroup;
QButtonGroup* myParamCoord;
- QMenu* myBtnPopup;
QMap<QAction*, int> myActions;
TopAbs_ShapeEnum myNeedType;
void ValueChangedInSpinBox( double );
void SetDoubleSpinBoxStep( double );
void ClickParamCoord( int );
- void CheckBoxClicked( int );
- void onBtnPopup( QAction* );
+ void CheckBoxClicked();
void updateSize();
};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
GroupPoints->LineEdit2->setEnabled( false );
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
break;
myEditCurrentArgument->setFocus();
// SelectionIntoArgument();
globalSelection(); // close local selection to clear it
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
send->setDown(true);
displayPreview(true);
}
GEOMBase::PublishSubObject( myPoint2.get() );
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BasicGUI_VectorDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myPoint1 << myPoint2;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <BRep_Tool.hxx>
+#include <Geom_Curve.hxx>
+
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
BlockFix_CheckTool::BlockFix_CheckTool( )
{
myHasCheck = Standard_False;
+ myAngTolerance = -1.;
myPossibleBlocks.Clear();
}
myPossibleBlocks.Clear();
}
+//=======================================================================
+//function : SetAngTolerance
+//purpose :
+//=======================================================================
+void BlockFix_CheckTool::SetAngTolerance(const Standard_Real theTolerance)
+{
+ myHasCheck = Standard_False;
+ myAngTolerance = theTolerance;
+ myPossibleBlocks.Clear();
+}
+
//=======================================================================
//function : Perform
//purpose :
if (nbe < 12)
IsBlock = Standard_False;
if (nbe > 12) {
- IsBlock = Standard_False;
// check edges unification
// creating map of edge faces
TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
Standard_Integer i = 1;
for (; i <= aMapFacesEdges.Extent(); i++) {
const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i);
- if (ListEdges.Extent() > 1) break;
+ if (ListEdges.Extent() > 1) {
+ if (myAngTolerance < 0.) {
+ break;
+ }
+
+ // Check if edges have C1 continuity.
+ if (!isC1(ListEdges)) {
+ break;
+ }
+ }
}
if (i <= aMapFacesEdges.Extent()) {
+ IsBlock = Standard_False;
MayBeUE = Standard_True;
break;
}
S<<" number of impossible blocks = "<<nbtmp<<endl;
}
}
+
+//=======================================================================
+//function : isC1
+//purpose :
+//=======================================================================
+Standard_Boolean BlockFix_CheckTool::isC1
+ (const TopTools_ListOfShape &theEdges) const
+{
+ // Fill the map vertex - list of ancestor edges
+ TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
+ TopTools_ListIteratorOfListOfShape anIter(theEdges);
+ TopTools_MapOfShape aMapFence;
+ Standard_Integer i;
+ Standard_Integer aNbVtx;
+
+ for (; anIter.More(); anIter.Next()) {
+ TopTools_IndexedMapOfShape aMapVtx;
+ const TopoDS_Shape &anEdge = anIter.Value();
+
+ if (aMapFence.Add(anEdge)) {
+ TopExp::MapShapes(anEdge, TopAbs_VERTEX, aMapVtx);
+ aNbVtx = aMapVtx.Extent();
+
+ for (i = 1; i <= aNbVtx; ++i) {
+ const TopoDS_Shape &aVtx = aMapVtx.FindKey(i);
+
+ if (!aMapVE.Contains(aVtx)) {
+ aMapVE.Add(aVtx, TopTools_ListOfShape());
+ }
+
+ aMapVE.ChangeFromKey(aVtx).Append(anEdge);
+ }
+ }
+ }
+
+ // Check C1 continuity.
+ Standard_Integer aNbEnds = 0;
+
+ for (i = 1, aNbVtx = aMapVE.Extent(); i <= aNbVtx; ++i) {
+ const TopTools_ListOfShape &anEdges = aMapVE.FindFromIndex(i);
+ Standard_Integer aNbEdges = anEdges.Extent();
+
+ if (aNbEdges == 1) {
+ ++aNbEnds;
+ } else if (aNbEdges == 2) {
+ TopoDS_Vertex aCommonVtx = TopoDS::Vertex(aMapVE.FindKey(i));
+ TopoDS_Edge anEdge1 = TopoDS::Edge(anEdges.First());
+ TopoDS_Edge anEdge2 = TopoDS::Edge(anEdges.Last());
+ Standard_Real aParam1 = BRep_Tool::Parameter(aCommonVtx, anEdge1);
+ Standard_Real aParam2 = BRep_Tool::Parameter(aCommonVtx, anEdge2);
+ Standard_Real aPar[2];
+ Handle(Geom_Curve) aCurve1 =
+ BRep_Tool::Curve(anEdge1, aPar[0], aPar[1]);
+ Handle(Geom_Curve) aCurve2 =
+ BRep_Tool::Curve(anEdge2, aPar[0], aPar[1]);
+ gp_Pnt aPnt;
+ gp_Vec aVec1;
+ gp_Vec aVec2;
+
+ aCurve1->D1(aParam1, aPnt, aVec1);
+ aCurve2->D1(aParam2, aPnt, aVec2);
+
+ if (anEdge1.Orientation() != anEdge2.Orientation()) {
+ // Orientations are different. One vector should be reversed.
+ aVec1.Reverse();
+ }
+
+ const Standard_Real anAngle = aVec1.Angle(aVec2);
+
+ if (anAngle > myAngTolerance) {
+ // There is no C1 continuity.
+ break;
+ }
+ } else {
+ // Non-manifold case.
+ break;
+ }
+ }
+
+ return (i > aNbVtx && aNbEnds == 2);
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <Standard_OStream.hxx>
class TopoDS_Shape;
+class TopTools_ListOfShape;
#include <Standard.hxx>
#include <Standard_Macro.hxx>
public:
Standard_EXPORT BlockFix_CheckTool();
- Standard_EXPORT void SetShape(const TopoDS_Shape& aShape) ;
+ Standard_EXPORT void SetShape(const TopoDS_Shape& aShape);
+ Standard_EXPORT void SetAngTolerance(const Standard_Real theTolerance);
Standard_EXPORT void Perform() ;
Standard_EXPORT Standard_Integer NbPossibleBlocks() const;
Standard_EXPORT TopoDS_Shape PossibleBlock(const Standard_Integer num) const;
Standard_EXPORT void DumpCheckResult(Standard_OStream& S) const;
private:
- TopoDS_Shape myShape;
+
+ Standard_Boolean isC1(const TopTools_ListOfShape &theEdges) const;
+
+private:
+ TopoDS_Shape myShape;
+ Standard_Real myAngTolerance;
Standard_Boolean myHasCheck;
Standard_Integer myNbSolids;
Standard_Integer myNbBlocks;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "utilities.h"
+//=======================================================================
+//function : IsToMerge
+//purpose : This method return Standard_True if two edges have common
+// vertex. This vertex is returned by output parameter. The
+// difference with the method TopExp::CommonVertex is only in
+// the case if there are two common vertices. In this case
+// this method returns the last vertex of theEdge1, not the first
+// one that TopExp::CommonVertex does.
+//=======================================================================
+static Standard_Boolean GetCommonVertex(const TopoDS_Edge &theEdge1,
+ const TopoDS_Edge &theEdge2,
+ TopoDS_Vertex &theCommon)
+{
+ Standard_Boolean isFound = Standard_True;
+ ShapeAnalysis_Edge aSae;
+ TopoDS_Vertex aVF1 = aSae.FirstVertex(theEdge1);
+ TopoDS_Vertex aVL1 = aSae.LastVertex(theEdge1);
+ TopoDS_Vertex aVF2 = aSae.FirstVertex(theEdge2);
+ TopoDS_Vertex aVL2 = aSae.LastVertex(theEdge2);
+
+ if (aVL1.IsSame(aVF2) || aVL1.IsSame(aVL2)) {
+ theCommon = aVL1;
+ } else if (aVF1.IsSame(aVL2) || aVF1.IsSame(aVF2)) {
+ theCommon = aVF1;
+ } else {
+ theCommon.Nullify();
+ isFound = Standard_False;
+ }
+
+ return isFound;
+}
//=======================================================================
//function : IsToMerge
// be merged. The edges can be merged if:
// 1. They belong to same faces.
// 2. They either both seam or both not seam on each face.
-// 3. They are based on coincident lines, or:
-// 4. They are based on coincident circles, or:
-// 5. They are based on either Bezier of BSplines.
+// 3. There are no another edges (e.g. seam) on each common face
+// that are connected to the common vertex of two edges.
+// 4. They are based on coincident lines, or:
+// 5. They are based on coincident circles, or:
+// 6. They are based on either Bezier of BSplines.
//=======================================================================
static Standard_Boolean IsToMerge
(const TopoDS_Edge &theEdge1,
Standard_Boolean aResult = Standard_False;
Standard_Boolean isDegen1 = BRep_Tool::Degenerated(theEdge1);
Standard_Boolean isDegen2 = BRep_Tool::Degenerated(theEdge2);
- Standard_Boolean isCompareGeom = Standard_False;
if (isDegen1 && isDegen2) {
// Both of edges are degenerated.
isSame = Standard_True;
- for (; anIter1.More(); anIter1.Next()) {
+ for (; anIter1.More() && isSame; anIter1.Next()) {
TopoDS_Face aFace1 = TopoDS::Face(anIter1.Value());
TopTools_ListIteratorOfListOfShape anIter2(aLst2);
Standard_Boolean isSeam2 = BRep_Tool::IsClosed(theEdge2, aFace1);
isSame = (isSeam1 && isSeam2) || (isSeam1 == isSeam2);
+
+ if (isSame) {
+ // Check if there are no other edges (e.g. seam) on this face
+ // that are connected to the common vertex.
+ TopoDS_Vertex aVCommon;
+
+ if (GetCommonVertex(theEdge1, theEdge2, aVCommon)) {
+ TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
+
+ TopExp::MapShapesAndAncestors
+ (aFace1, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
+
+ if (aMapVE.Contains(aVCommon)) {
+ TopTools_ListIteratorOfListOfShape
+ anItE(aMapVE.FindFromKey(aVCommon));
+
+ for (; anItE.More(); anItE.Next()) {
+ const TopoDS_Shape &anEdge = anItE.Value();
+
+ if (!theEdge1.IsSame(anEdge) &&
+ !theEdge2.IsSame(anEdge)) {
+ // There is another edge that shares the common vertex.
+ // Nothing to merge.
+ isSame = Standard_False;
+ break;
+ }
+ }
+ } else {
+ // Common vertex doesn't belong to the face.
+ // Nothing to merge. NEVERREACHED.
+ isSame = Standard_False;
+ }
+ } else {
+ // No common vertex. Nothing to merge. NEVERREACHED.
+ isSame = Standard_False;
+ }
+ }
+
break;
}
}
if (i > 1)
{
- TopExp::CommonVertex(PrevEdge, anEdge, CV);
+ GetCommonVertex(PrevEdge, anEdge, CV);
Standard_Real Tol = BRep_Tool::Tolerance(CV);
tabtolvertex(i-2) = Tol;
}
if (C.IsNull()) {
// jfa for Mantis issue 0020228
if (PV1.Distance(PV2) > Precision::Confusion()) continue;
- // closed chain
- if (edge1.Orientation() == TopAbs_FORWARD) {
- C = C1;
- } else {
- C = Handle(Geom_Circle)::DownCast(C1->Reversed());
+ // closed chain. Make a closed circular edge starting from V1.
+ gp_Ax1 anAxis = C1->Axis();
+
+ if (edge1.Orientation() == TopAbs_REVERSED) {
+ anAxis.Reverse();
}
+ const gp_Pnt &aP0 = anAxis.Location();
+ gp_Dir aDX(PV1.XYZ().Subtracted(aP0.XYZ()));
+ gp_Ax2 aNewAxis(aP0, anAxis.Direction(), aDX);
+
+ C = new Geom_Circle(aNewAxis, C1->Radius());
+
B.MakeEdge (E,C,Precision::Confusion());
B.Add(E,V1);
B.Add(E,V2);
+ B.UpdateVertex(V1, 0., E, 0.);
+ B.UpdateVertex(V2, 2.*M_PI, E, 0.);
}
else {
gp_Pnt P0 = C->Location();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
{
//map of edges
TopTools_MapOfShape aNewEdges;
+ TopExp_Explorer exp(aShape,TopAbs_EDGE);
//add edges without seams
- for(TopExp_Explorer exp(aShape,TopAbs_EDGE); exp.More(); exp.Next()) {
+ for(; exp.More(); exp.Next()) {
TopoDS_Shape edge = exp.Current();
if(aNewEdges.Contains(edge))
aNewEdges.Remove(edge);
}
}
- //add edges to the sequemce
- for(TopTools_MapIteratorOfMapOfShape anIter(aNewEdges); anIter.More(); anIter.Next())
- edges.Append(anIter.Key());
+ //add edges to the sequence
+ for(exp.ReInit(); exp.More(); exp.Next()) {
+ const TopoDS_Shape &anEdge = exp.Current();
+
+ if (aNewEdges.Contains(anEdge)) {
+ edges.Append(anEdge);
+ }
+ }
return isDropped;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
aSender->setDown(true);
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); //Select Faces on All Shapes
+ localSelection(TopAbs_FACE); //Select Faces on All Shapes
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
}
{
GEOMBase_Skeleton::ActivateThisDialog();
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); //Select Faces on All Shapes
+ localSelection(TopAbs_FACE); //Select Faces on All Shapes
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
displayPreview(true);
break;
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BlocksGUI_BlockDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myFace1 << myFace2 << myFace3
+ << myFace4 << myFace5 << myFace6;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// purpose : Constructs a BlocksGUI_ExplodeDlg which is a child of 'parent'.
//=================================================================================
BlocksGUI_ExplodeDlg::BlocksGUI_ExplodeDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
- : GEOMBase_Skeleton( theGeometryGUI, parent )
+ : GEOMBase_Skeleton( theGeometryGUI, parent ), myNbBlocks( 0 )
{
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_EXPLODE" ) ) );
QPixmap imageS( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
}
}
- if ( !onAccept() )
+ if ( !onAccept( true, true, false ) )
return false;
activateSelection();
//=================================================================================
bool BlocksGUI_ExplodeDlg::isAllSubShapes() const
{
- return !myGrp1->CheckBox1->isChecked() || !myGrp1->CheckBox1->isEnabled();
+ return !(myGrp1->CheckBox1->isEnabled() && myGrp1->CheckBox1->isChecked());
}
//=================================================================================
{
return QString::null;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BlocksGUI_ExplodeDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myObject);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
virtual QString getNewObjectName (int CurrObj = -1) const;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
{
return myObject;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BlocksGUI_PropagateDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myObject);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private slots:
void ClickOnOk();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
myEditCurrentArgument == mySelName[Vertex3] ||
myEditCurrentArgument == mySelName[Vertex4])
{
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertices on All Shapes
+ localSelection(TopAbs_VERTEX); //Select Vertices on All Shapes
}
else
{
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); //Select Edges on All Shapes
+ localSelection(TopAbs_EDGE); //Select Edges on All Shapes
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
break;
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BlocksGUI_QuadFaceDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myShape1 << myShape2 << myShape3 << myShape4;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//=================================================================================
void BlocksGUI_TrsfDlg::SelectionIntoArgument()
{
- erasePreview();
myEditCurrentArgument->setText("");
// Get index of current selection focus
}
myEditCurrentArgument->setText(aName);
myFaces[aCurrFocus] = anIndex;
- processPreview();
}
switch (aCurrFocus) {
default:
break;
}
+
+ processPreview();
}
//=================================================================================
aSender->setDown(true);
activateSelection();
+
+ processPreview();
}
//=================================================================================
return res;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BlocksGUI_TrsfDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myShape);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
}
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()), Qt::UniqueConnection);
initName(mainFrame()->GroupConstructors->title());
mainFrame()->RadioButton1->setFocus();
globalSelection(GEOM_ALLSHAPES);
-
+ //localSelection(TopAbs_SHAPE); // VSR 24/09/2015: dectivate local selection in BOP (CoTech decision)
+
myGroup->PushButton1->click();
- SelectionIntoArgument();
resize(100,100);
}
//=================================================================================
void BooleanGUI_Dialog::reset()
{
- myObjects = new GEOM::ListOfGO;
- myObjects->length( 0 );
+ myObjects.clear();
}
//=================================================================================
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
myGeomGUI->getApp()->selectionMgr()->clearSelected();
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
- this, SLOT(SelectionIntoArgument()));
+ this, SLOT(SelectionIntoArgument()), Qt::UniqueConnection);
if (myEditCurrentArgument == myGroup->LineEdit1) {
myObject1 = aSelectedObject;
- if (!myGroup->PushButton2->isHidden() && !myObjects->length())
+ if (!myGroup->PushButton2->isHidden() && !myObjects.count())
myGroup->PushButton2->click();
}
else if (myEditCurrentArgument == myGroup->LineEdit2) {
- myObjects->length(1);
- myObjects[0] = aSelectedObject.get();
+ myObjects.clear();
+ myObjects << aSelectedObject;
if (!myObject1)
myGroup->PushButton1->click();
}
myEditCurrentArgument->setText( "" );
reset();
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
- myObjects->length(aSelList.Extent());
-
- int i = 0;
- for (SALOME_ListIteratorOfListIO anIt (aSelList); anIt.More(); anIt.Next()) {
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value() );
-
- if ( !CORBA::is_nil( aSelectedObject ) ) {
- myObjects[i++] = aSelectedObject;
- }
- }
+ myObjects = getSelected( TopAbs_SHAPE, -1 );
- myObjects->length( i );
+ int i = myObjects.count();
if ( i == 1 ) {
- myEditCurrentArgument->setText( GEOMBase::GetName( myObjects[0] ) );
+ myEditCurrentArgument->setText( GEOMBase::GetName( myObjects.first().get() ) );
} else if ( i > 0 ) {
myEditCurrentArgument->setText( QString::number( i ) + "_" + tr( "GEOM_OBJECTS" ) );
}
//=================================================================================
void BooleanGUI_Dialog::SelectionIntoArgument()
{
+ myEditCurrentArgument->setText("");
if ( myOperation == BooleanGUI::SECTION ||
(myOperation == BooleanGUI::CUT &&
myEditCurrentArgument == myGroup->LineEdit1)) {
myGroup->LineEdit1->setEnabled(false);
}
+ globalSelection(GEOM_ALLSHAPES);
+ //localSelection(TopAbs_SHAPE); // VSR 24/09/2015: dectivate local selection in BOP (CoTech decision)
+
// enable line edit
myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
// after setFocus(), because it will be setDown(false) when loses focus
send->setDown(true);
+
+ SelectionIntoArgument();
}
//=================================================================================
GEOMBase_Skeleton::ActivateThisDialog();
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) );
+ this, SLOT( SelectionIntoArgument() ), Qt::UniqueConnection );
processPreview();
}
switch (myOperation) {
case BooleanGUI::FUSE:
case BooleanGUI::COMMON:
- isOK = myObjects->length() > 1;
+ isOK = myObjects.count() > 1;
break;
case BooleanGUI::CUT:
- isOK = myObject1 && myObjects->length();
+ isOK = myObject1 && myObjects.count();
break;
case BooleanGUI::SECTION:
- isOK = myObject1 && (myObjects->length() == 1);
+ isOK = myObject1 && (myObjects.count() == 1);
break;
default:
break;
GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
const bool isCheckSelfInte = myGroup->CheckBox1->isChecked();
+ GEOM::ListOfGO_var anObjects = new GEOM::ListOfGO();
+ anObjects->length( myObjects.count() );
+ for ( int i = 0; i < myObjects.count(); i++ )
+ anObjects[i] = myObjects[i].copy();
+
switch (myOperation) {
case BooleanGUI::FUSE:
{
const bool isRmExtraEdges = myGroup->CheckBox2->isChecked();
anObj = anOper->MakeFuseList
- (myObjects, isCheckSelfInte, isRmExtraEdges);
+ (anObjects, isCheckSelfInte, isRmExtraEdges);
}
break;
case BooleanGUI::COMMON:
- anObj = anOper->MakeCommonList(myObjects, isCheckSelfInte);
+ anObj = anOper->MakeCommonList(anObjects, isCheckSelfInte);
break;
case BooleanGUI::CUT:
anObj =
- anOper->MakeCutList(myObject1.get(), myObjects, isCheckSelfInte);
+ anOper->MakeCutList(myObject1.get(), anObjects, isCheckSelfInte);
break;
case BooleanGUI::SECTION:
anObj = anOper->MakeBoolean
- (myObject1.get(), myObjects[0], myOperation, isCheckSelfInte);
+ (myObject1.get(), anObjects[0], myOperation, isCheckSelfInte);
break;
default:
break;
mainFrame()->CheckBoxAddPrefix->isChecked()); // ? false
}
}
+
+//=================================================================================
+// function : addSubshapesToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BooleanGUI_Dialog::addSubshapesToStudy()
+{
+ GEOMBase::PublishSubObject( myObject1.get() );
+ for ( int i = 0; i < myObjects.count(); i++ )
+ GEOMBase::PublishSubObject( myObjects[i].get() );
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BooleanGUI_Dialog::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myObjects);
+ res << myObject1;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
+ virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
int myOperation;
GEOM::GeomObjPtr myObject1;
- GEOM::ListOfGO_var myObjects;
+ QList<GEOM::GeomObjPtr> myObjects;
DlgRef_2Sel2Spin3Check* myGroup;
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
mainFrame()->CheckBoxAddPrefix->isChecked() );
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BuildGUI_CompoundDlg::getSourceObjects()
+{
+ return myShapes;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->PushButton1->setDown(true);
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
// signals and slots connections
connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
case 0:
{
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText("");
case 1:
{
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_WIRE);
+ localSelection(TopAbs_WIRE);
myEditCurrentArgument = GroupWire->LineEdit1;
GroupWire->LineEdit1->setText("");
case 2:
{
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
myEditCurrentArgument = GroupOnCurve->LineEdit1;
GroupOnCurve->LineEdit1->setText("");
myEditCurrentArgument->setText(aName);
globalSelection();
- localSelection(GEOM::GEOM_Object::_nil(), aNeedType);
+ localSelection(aNeedType);
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
myPoint1 = aSelectedObject;
GroupOnCurve->LineEdit2->setEnabled(false);
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
else if (send == GroupOnCurve->PushButton2) {
myEditCurrentArgument = GroupOnCurve->LineEdit2;
GroupOnCurve->LineEdit1->setEnabled(false);
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
// enable line edit
break;
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BuildGUI_EdgeDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myPoint1 << myPoint2 << myWire << myCurve << myStartPoint;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>
+#include <QTreeWidget>
+
+//=================================================================================
+// class : BuildGUI_TreeWidgetItem
+// purpose : class for constraint(Edge-Face) creation
+//=================================================================================
+class BuildGUI_FaceDlg::TreeWidgetItem : public QTreeWidgetItem
+{
+public:
+ TreeWidgetItem( QTreeWidget*, const GEOM::GeomObjPtr, int = Type );
+ TreeWidgetItem( QTreeWidgetItem*, const GEOM::GeomObjPtr, int = Type );
+ ~TreeWidgetItem();
+ void setFace( const GEOM::GeomObjPtr );
+ GEOM::GeomObjPtr getFace() const;
+ GEOM::GeomObjPtr getEdge() const;
+private:
+ GEOM::GeomObjPtr myEdge;
+ GEOM::GeomObjPtr myFace;
+};
+
+BuildGUI_FaceDlg::TreeWidgetItem::TreeWidgetItem( QTreeWidget* view, const GEOM::GeomObjPtr edge, int type )
+:QTreeWidgetItem( view, QStringList()<<GEOMBase::GetName( edge.get() ), type ),
+ myEdge( edge ),
+ myFace( 0 )
+{
+}
+
+BuildGUI_FaceDlg::TreeWidgetItem::TreeWidgetItem( QTreeWidgetItem* parent, const GEOM::GeomObjPtr edge, int type )
+:QTreeWidgetItem( parent, QStringList()<<GEOMBase::GetName( edge.get() ), type ),
+ myEdge( edge ),
+ myFace( 0 )
+{
+}
+
+BuildGUI_FaceDlg::TreeWidgetItem::~TreeWidgetItem()
+{
+}
+
+void BuildGUI_FaceDlg::TreeWidgetItem::setFace( const GEOM::GeomObjPtr face )
+{
+ QString aName = GEOMBase::GetName( face.get() );
+ setText( 1, aName );
+ treeWidget()->resizeColumnToContents(1);
+ myFace = face;
+}
+
+GEOM::GeomObjPtr BuildGUI_FaceDlg::TreeWidgetItem::getFace() const
+{
+ return myFace;
+}
+
+GEOM::GeomObjPtr BuildGUI_FaceDlg::TreeWidgetItem::getEdge() const
+{
+ return myEdge;
+}
+
//=================================================================================
// class : BuildGUI_FaceDlg()
// purpose : Constructs a BuildGUI_FaceDlg which is a child of 'parent', with the
// TRUE to construct a modal dialog.
//=================================================================================
BuildGUI_FaceDlg::BuildGUI_FaceDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
- : GEOMBase_Skeleton( theGeometryGUI, parent )
+ : GEOMBase_Skeleton( theGeometryGUI, parent ),
+ myGroupWire(0),
+ myGroupSurf(0),
+ myGroupWireConstraints(0)
{
- QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BUILD_FACE" ) ) );
- QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BUILD_FACE" ) ) );
+ QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BUILD_FACE_SURFACE" ) ) );
+ QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BUILD_FACE_CONSTRAINTS" ) ) );
setWindowTitle( tr( "GEOM_FACE_TITLE" ) );
/***************************************************************/
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_FACE" ) );
- mainFrame()->RadioButton1->setIcon( image0 );
- mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
- mainFrame()->RadioButton2->close();
- mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
- mainFrame()->RadioButton3->close();
+ mainFrame()->RadioButton1->setIcon( image1 );
+ mainFrame()->RadioButton2->setIcon( image2 );
+ mainFrame()->RadioButton3->setIcon( image3 );
+
+ // Face creation from wires and/or edges
- GroupWire = new DlgRef_1Sel1Check( centralWidget() );
+ myGroupWire = new DlgRef_1Sel1Check( centralWidget() );
- GroupWire->GroupBox1->setTitle( tr( "GEOM_FACE_FFW" ) );
- GroupWire->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
- GroupWire->CheckButton1->setText( tr( "GEOM_FACE_OPT" ) );
- GroupWire->PushButton1->setIcon( image1 );
+ myGroupWire->GroupBox1->setTitle( tr( "GEOM_FACE_FFW" ) );
+ myGroupWire->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
+ myGroupWire->CheckButton1->setText( tr( "GEOM_FACE_OPT" ) );
+ myGroupWire->PushButton1->setIcon( image0 );
+
+ // Face creation from surface
+
+ myGroupSurf = new DlgRef_2Sel(centralWidget());
+
+ myGroupSurf->GroupBox1->setTitle(tr("GEOM_FACE_FROM_SURFACE" ) );
+ myGroupSurf->TextLabel1->setText(tr("GEOM_FACE"));
+ myGroupSurf->TextLabel2->setText(tr("GEOM_WIRE"));
+ myGroupSurf->PushButton1->setIcon(image0);
+ myGroupSurf->PushButton2->setIcon(image0);
+
+ // Face creation from wire and constraints
+
+ myGroupWireConstraints = new DlgRef_1SelExt( centralWidget() );
+ myGroupWireConstraints->GroupBox1->setTitle( tr( "GEOM_FACE_FFWC" ) );
+ myGroupWireConstraints->TextLabel1->setText( tr( "GEOM_WIRE" ) );
+ myGroupWireConstraints->PushButton1->setIcon( image0 );
+
+ QLabel* aLabel = new QLabel( tr( "GEOM_CONSTRAINTS" ) );
+ myTreeConstraints = new QTreeWidget( myGroupWireConstraints->Box );
+ myTreeConstraints->setColumnCount(2);
+ QStringList columnNames;
+ columnNames.append( tr( "GEOM_EDGE" ));
+ columnNames.append( tr( "GEOM_FACE_CONSTRAINT" ) );
+ myTreeConstraints->setHeaderLabels( columnNames );
+ myTreeConstraints->header()->setMovable( false );
+ myTreeConstraints->header()->setResizeMode( QHeaderView::ResizeToContents );
+ myTreeConstraints->setMinimumHeight( 140 );
+
+ QHBoxLayout* l = new QHBoxLayout( myGroupWireConstraints->Box );
+ l->setMargin( 0 ); l->setSpacing( 6 );
+ l->addWidget( aLabel);
+ l->addWidget( myTreeConstraints );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
- layout->addWidget( GroupWire );
+ layout->addWidget( myGroupWire );
+ layout->addWidget( myGroupSurf );
+ layout->addWidget( myGroupWireConstraints );
/***************************************************************/
setHelpFileName("create_face_page.html");
void BuildGUI_FaceDlg::Init()
{
/* init variables */
- myEditCurrentArgument = GroupWire->LineEdit1;
- GroupWire->LineEdit1->setReadOnly( true );
+ myEditCurrentArgument = myGroupWire->LineEdit1;
+ myGroupWire->LineEdit1->setReadOnly( true );
+ myGroupSurf->LineEdit1->setReadOnly( true );
+ myGroupSurf->LineEdit2->setReadOnly( true );
+ myGroupWireConstraints->LineEdit1->setReadOnly( true );
- GroupWire->CheckButton1->setChecked( true );
+ myGroupWire->CheckButton1->setChecked( true );
myWires.clear();
-
- TColStd_MapOfInteger aMap;
- aMap.Add( GEOM_EDGE );
- aMap.Add( GEOM_WIRE );
- globalSelection( aMap );
+ myFace.nullify();
+ myWire.nullify();
+ myCurrentItem = 0;
/* signals and slots connections */
+ connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+ connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+
+ connect(this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
+
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
- connect( GroupWire->LineEdit1, SIGNAL( returnPressed()), this, SLOT( LineEditReturnPressed() ) );
- connect( GroupWire->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect( myGroupWire->LineEdit1, SIGNAL( returnPressed()), this, SLOT( LineEditReturnPressed() ) );
+ connect( myGroupWire->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect( myGroupSurf->LineEdit1, SIGNAL( returnPressed()), this, SLOT( LineEditReturnPressed() ) );
+ connect( myGroupSurf->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect( myGroupSurf->LineEdit2, SIGNAL( returnPressed()), this, SLOT( LineEditReturnPressed() ) );
+ connect( myGroupSurf->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect( myGroupWireConstraints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+ connect( myGroupWireConstraints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ connect( myTreeConstraints, SIGNAL( itemClicked( QTreeWidgetItem*, int) ), this, SLOT( onItemClicked( QTreeWidgetItem*, int ) ) );
+
initName( tr( "GEOM_FACE" ) );
+
+ ConstructorsClicked(0);
+}
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void BuildGUI_FaceDlg::ConstructorsClicked(int constructorId)
+{
+ switch (constructorId) {
+ case 0:
+ {
+ TColStd_MapOfInteger aMap;
+
+ aMap.Add(GEOM_EDGE);
+ aMap.Add(GEOM_WIRE);
+ aMap.Add(GEOM_FACE);
+ aMap.Add(GEOM_SHELL);
+ aMap.Add(GEOM_SOLID);
+ aMap.Add(GEOM_COMPOUND);
+ globalSelection(aMap);
+
+ myEditCurrentArgument = myGroupWire->LineEdit1;
+ myGroupWire->LineEdit1->setText("");
+ myGroupWire->show();
+ myGroupSurf->hide();
+ myGroupWireConstraints->hide();
+ break;
+ }
+ case 1:
+ {
+ globalSelection(GEOM_FACE); // For the first element.
+ localSelection( TopAbs_FACE );
+
+ myEditCurrentArgument = myGroupSurf->LineEdit1;
+ myGroupSurf->LineEdit1->setText("");
+ myGroupSurf->PushButton1->setDown(true);
+ myGroupSurf->PushButton2->setDown(false);
+ myGroupWire->hide();
+ myGroupSurf->show();
+ myGroupWireConstraints->hide();
+ break;
+ }
+ case 2:
+ {
+ globalSelection();
+ localSelection( TopAbs_WIRE );
+
+ myTreeConstraints->clear();
+ myCurrentItem = 0;
+ myEditCurrentArgument = myGroupWireConstraints->LineEdit1;
+ myGroupWireConstraints->LineEdit1->setText("");
+ myGroupWireConstraints->LineEdit1->setEnabled(true);
+ myGroupWire->hide();
+ myGroupSurf->hide();
+ myGroupWireConstraints->show();
+ break;
+ }
+ }
+
+ myWires.clear();
+ myFace.nullify();
+ myWire.nullify();
+ qApp->processEvents();
+ updateGeometry();
+ resize(minimumSizeHint());
SelectionIntoArgument();
}
+//=================================================================================
+// function : updateConstraintsTree
+// purpose :
+//=================================================================================
+void BuildGUI_FaceDlg::updateConstraintsTree()
+{
+ if ( myEditCurrentArgument != myGroupWireConstraints->LineEdit1 || myWire.isNull() )
+ return;
+
+ myTreeConstraints->clear();
+
+ GEOM::GEOM_IShapesOperations_ptr anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
+ GEOM::ListOfGO_var aList = anOper->ExtractSubShapes( myWire.get(), TopAbs_EDGE, false );
+ if ( !aList->length() )
+ return;
+
+ for ( int i = 0, n = aList->length(); i < n; i++ ) {
+ TreeWidgetItem* item = new TreeWidgetItem( myTreeConstraints,
+ GEOM::GeomObjPtr( aList[i] ) );
+ }
+
+ myEditCurrentArgument->setEnabled(false);
+ globalSelection();
+ localSelection( TopAbs_FACE );
+
+ myTreeConstraints->resizeColumnToContents(0);
+ QTreeWidgetItem* firstItem = myTreeConstraints->topLevelItem(0);
+ firstItem->setSelected( true );
+ onItemClicked( firstItem, 0 );
+}
+
+//=================================================================================
+// function : findEmptyTreeItem()
+// purpose :
+//=================================================================================
+void BuildGUI_FaceDlg::findEmptyTreeItem()
+{
+ if ( isTreeFull() )
+ return;
+
+ QTreeWidgetItem* nextItem = 0;
+ QTreeWidgetItem* item;
+ for ( item = myTreeConstraints->itemBelow( myCurrentItem );
+ item && !nextItem;
+ item = myTreeConstraints->itemBelow( item ) ) {
+ if ( (dynamic_cast<TreeWidgetItem*>(item))->getFace().isNull() )
+ nextItem = item;
+ }
+ for ( item = myTreeConstraints->topLevelItem(0);
+ item && item != myCurrentItem && !nextItem;
+ item = myTreeConstraints->itemBelow( item ) ) {
+ if ( (dynamic_cast<TreeWidgetItem*>(item))->getFace().isNull() )
+ nextItem = item;
+ }
+
+ if ( nextItem && nextItem != myCurrentItem ) {
+ myCurrentItem->setSelected( false );
+ nextItem->setSelected( true );
+ onItemClicked( nextItem, 0 );
+ }
+}
+
+//=================================================================================
+// function : isTreeFull()
+// purpose :
+//=================================================================================
+bool BuildGUI_FaceDlg::isTreeFull()
+{
+ bool ok = true;
+ QTreeWidgetItem* item;
+ for ( item = myTreeConstraints->topLevelItem(0);
+ item && ok;
+ item = myTreeConstraints->itemBelow( item ) ) {
+ ok = !(dynamic_cast<TreeWidgetItem*>(item))->getFace().isNull();
+ }
+ return ok;
+}
//=================================================================================
// function : ClickOnOk()
return false;
initName();
+
+ myEditCurrentArgument->setText("");
+ ConstructorsClicked( getConstructorId() );
return true;
}
//=================================================================================
void BuildGUI_FaceDlg::SelectionIntoArgument()
{
- myEditCurrentArgument->setText( "" );
-
- QList<TopAbs_ShapeEnum> types;
- types << TopAbs_EDGE << TopAbs_WIRE;
- myWires = getSelected( types, -1 );
+ erasePreview();
+ if ( myEditCurrentArgument == myGroupWire->LineEdit1 ) {
+ myEditCurrentArgument->setText( "" );
+
+ QList<TopAbs_ShapeEnum> types;
+ types << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE
+ << TopAbs_SHELL << TopAbs_SOLID << TopAbs_COMPOUND;
+ myWires = getSelected( types, -1 );
+
+ if ( !myWires.isEmpty() ) {
+ QString aName = myWires.count() > 1 ? QString( "%1_objects").arg( myWires.count() ) : GEOMBase::GetName( myWires[0].get() );
+ myEditCurrentArgument->setText( aName );
+ }
+ }
+ else if (myEditCurrentArgument == myGroupSurf->LineEdit1 ||
+ myEditCurrentArgument == myGroupSurf->LineEdit2) {
+ const bool isEditFace = myEditCurrentArgument == myGroupSurf->LineEdit1;
+ const TopAbs_ShapeEnum aType = isEditFace ? TopAbs_FACE : TopAbs_WIRE;
+ GEOM::GeomObjPtr aSelectedObject = getSelected(aType);
+ GEOM::GeomObjPtr &anObj = isEditFace ? myFace : myWire;
+
+ if (aSelectedObject) {
+ myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject.get()));
+ anObj = aSelectedObject;
+ } else {
+ myEditCurrentArgument->setText("");
+ anObj.nullify();
+ }
- if ( !myWires.isEmpty() ) {
- QString aName = myWires.count() > 1 ? QString( "%1_objects").arg( myWires.count() ) : GEOMBase::GetName( myWires[0].get() );
- myEditCurrentArgument->setText( aName );
+ if (isEditFace) {
+ if (myFace && !myWire) {
+ myGroupSurf->PushButton2->click();
+ }
+ } else {
+ if (!myFace && myWire) {
+ myGroupSurf->PushButton1->click();
+ }
+ }
}
+ else if ( myEditCurrentArgument == myGroupWireConstraints->LineEdit1 ) {
+ if ( myCurrentItem ) {
+ GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_FACE );
+ TopoDS_Shape aFaceShape;
+ GEOM::GEOM_IShapesOperations_ptr anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
+ if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aFaceShape ) && !aFaceShape.IsNull()
+ && anOper->IsSubShapeBelongsTo( myCurrentItem->getEdge().get(), 0, aSelectedObject.get(), 0 ) ) {
+ myCurrentItem->setFace( aSelectedObject );
+ findEmptyTreeItem();
+ }
+ else {
+ myCurrentItem->setFace( 0 );
+ displayPreview( myCurrentItem->getEdge().get(), true, false, true, 5, -1, Quantity_NOC_RED );
+ }
+ }
+ else {
+ myWire.nullify();
+ myEditCurrentArgument->setText( "" );
+ GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_WIRE );
+ TopoDS_Shape aWireShape;
+ if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aWireShape ) && !aWireShape.IsNull() ) {
+ QString aName = GEOMBase::GetName( aSelectedObject.get() );
+ myEditCurrentArgument->setText( aName );
+ myWire = aSelectedObject;
+ updateConstraintsTree();
+ }
+ else {
+ myTreeConstraints->clear();
+ erasePreview( true );
+ }
+ }
+ }
+ displayPreview( true, false, true, true, -1, -1, -1, true );
}
void BuildGUI_FaceDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
- if ( send != GroupWire->PushButton1 )
- return;
+ if ( send == myGroupWire->PushButton1 ) {
+ TColStd_MapOfInteger aMap;
- TColStd_MapOfInteger aMap;
- aMap.Add( GEOM_EDGE );
- aMap.Add( GEOM_WIRE );
- globalSelection( aMap );
-
- myEditCurrentArgument = GroupWire->LineEdit1;
+ aMap.Add(GEOM_EDGE);
+ aMap.Add(GEOM_WIRE);
+ aMap.Add(GEOM_FACE);
+ aMap.Add(GEOM_SHELL);
+ aMap.Add(GEOM_SOLID);
+ aMap.Add(GEOM_COMPOUND);
+ globalSelection(aMap);
+ myEditCurrentArgument = myGroupWire->LineEdit1;
+ }
+ else if (send == myGroupSurf->PushButton1) {
+ globalSelection(GEOM_FACE);
+ localSelection( TopAbs_FACE );
+ myEditCurrentArgument = myGroupSurf->LineEdit1;
+ myGroupSurf->PushButton2->setDown(false);
+ myGroupSurf->LineEdit2->setEnabled(false);
+ }
+ else if (send == myGroupSurf->PushButton2) {
+ globalSelection(GEOM_WIRE);
+ localSelection( TopAbs_WIRE );
+ myEditCurrentArgument = myGroupSurf->LineEdit2;
+ myGroupSurf->PushButton1->setDown(false);
+ myGroupSurf->LineEdit1->setEnabled(false);
+ }
+ else if (send == myGroupWireConstraints->PushButton1) {
+ globalSelection();
+ localSelection( TopAbs_WIRE );
+ myEditCurrentArgument = myGroupWireConstraints->LineEdit1;
+ myCurrentItem = 0;
+ }
+ // enable line edit
+ myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
}
GEOMBase_Skeleton::ActivateThisDialog();
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- TColStd_MapOfInteger aMap;
- aMap.Add( GEOM_EDGE );
- aMap.Add( GEOM_WIRE );
- globalSelection( aMap );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ ConstructorsClicked(getConstructorId());
}
+//=================================================================================
+// function : onItemClicked()
+// purpose : called when tree item was clicked
+//=================================================================================
+void BuildGUI_FaceDlg::onItemClicked( QTreeWidgetItem* theItem, int theColumn )
+{
+ if ( !theItem || !( theItem->flags() & Qt::ItemIsSelectable ) )
+ return;
+
+ myCurrentItem = dynamic_cast<TreeWidgetItem*>( theItem );
+ displayPreview( true );
+ displayPreview( myCurrentItem->getEdge().get(), true, false, true, 5, -1, Quantity_NOC_RED );
+}
//=================================================================================
// function : enterEvent()
//=================================================================================
bool BuildGUI_FaceDlg::isValid( QString& )
{
- return !myWires.isEmpty();
+ bool ok = false;
+
+ switch (getConstructorId()) {
+ case 0:
+ ok = !myWires.isEmpty();
+ break;
+ case 1:
+ ok = myFace && myWire;
+ break;
+ case 2:
+ ok = myWire;
+ break;
+ default:
+ break;
+ }
+
+ return ok;
}
//=================================================================================
//=================================================================================
bool BuildGUI_FaceDlg::execute( ObjectList& objects )
{
+ bool res = false;
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
+ GEOM::GEOM_Object_var anObj;
- GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
- objlist->length( myWires.count() );
- for ( int i = 0; i < myWires.count(); i++ )
- objlist[i] = myWires[i].copy();
+ switch (getConstructorId()) {
+ case 0:
+ {
+ GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
+
+ objlist->length( myWires.count() );
- GEOM::GEOM_Object_var anObj = anOper->MakeFaceWires( objlist.in(), GroupWire->CheckButton1->isChecked() );
+ for ( int i = 0; i < myWires.count(); i++ ) {
+ objlist[i] = myWires[i].copy();
+ }
+
+ anObj = anOper->MakeFaceWires( objlist.in(), myGroupWire->CheckButton1->isChecked() );
+ res = true;
+ }
+ break;
+ case 1:
+ anObj = anOper->MakeFaceFromSurface(myFace.get(), myWire.get());
+ res = true;
+ break;
+ case 2:
+ {
+ int numberOfItems = myTreeConstraints->topLevelItemCount();
+ GEOM::ListOfGO_var constraints = new GEOM::ListOfGO();
+ constraints->length( 2 * numberOfItems );
+ int j = 0;
+ for ( int i = 0; i < numberOfItems; i++ ) {
+ TreeWidgetItem* item = dynamic_cast<TreeWidgetItem*>( myTreeConstraints->topLevelItem(i) );
+ constraints[j++] = item->getEdge().copy();
+ if ( item->getFace() )
+ constraints[j++] = item->getFace().copy();
+ }
+ constraints->length(j);
+ anObj = anOper->MakeFaceWithConstraints( constraints.in() );
+ res = true;
+ }
+ break;
+ default:
+ break;
+ }
if (!anObj->_is_nil()) {
+ if ( !anOper->IsDone() && QString(anOper->GetErrorCode()) == "MAKE_FACE_TOLERANCE_TOO_BIG") {
+ if ( !IsPreview() ) {
+ SUIT_OverrideCursor wc;
+ wc.suspend();
+ QString msgw = QObject::tr(anOper->GetErrorCode());
+ SUIT_MessageBox::warning(this, tr("WRN_WARNING"), msgw, tr("BUT_OK"));
+ }
+ anOper->SetErrorCode("PAL_NO_ERROR");
+ }
+ else if ( anObj->GetShapeType() == GEOM::COMPOUND ) {
+ if ( !IsPreview() ) {
+ SUIT_MessageBox::warning(this,
+ QObject::tr("GEOM_WRN_WARNING"),
+ QObject::tr("GEOM_WRN_FACES_NOT_FACE"));
+ }
+ }
objects.push_back(anObj._retn());
+ }
- if (!anOper->IsDone() && QString(anOper->GetErrorCode()) == "MAKE_FACE_TOLERANCE_TOO_BIG") {
- SUIT_OverrideCursor wc;
- wc.suspend();
- QString msgw = QObject::tr(anOper->GetErrorCode());
- SUIT_MessageBox::warning(this, tr("WRN_WARNING"), msgw, tr("BUT_OK"));
- anOper->SetErrorCode("PAL_NO_ERROR");
+ return res;
+}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BuildGUI_FaceDlg::addSubshapesToStudy()
+{
+ switch (getConstructorId()) {
+ case 0:
+ break;
+ case 1:
+ break;
+ case 2:
+ for( int i = 0; i < myTreeConstraints->topLevelItemCount(); i++ ) {
+ TreeWidgetItem* item = dynamic_cast<TreeWidgetItem*>( myTreeConstraints->topLevelItem(i) );
+ if ( item->getFace().get() )
+ GEOMBase::PublishSubObject( item->getFace().get() );
+ GEOMBase::PublishSubObject( myWire.get() );
}
+ break;
+ default:
+ break;
}
+}
- return true;
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BuildGUI_FaceDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myWires);
+ res << myFace << myWire;
+ return res;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GEOM_GenericObjPtr.h"
class DlgRef_1Sel1Check;
+class DlgRef_2Sel;
+class DlgRef_1SelExt;
+class QTreeWidget;
+class QTreeWidgetItem;
//=================================================================================
// class : BuildGUI_FaceDlg
{
Q_OBJECT
+ class TreeWidgetItem;
+
public:
BuildGUI_FaceDlg( GeometryGUI*, QWidget* = 0 );
~BuildGUI_FaceDlg();
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
void enterEvent( QEvent* );
+ void updateConstraintsTree();
+ void findEmptyTreeItem();
+ bool isTreeFull();
private:
QList<GEOM::GeomObjPtr> myWires;
+ GEOM::GeomObjPtr myFace;
+ GEOM::GeomObjPtr myWire;
- DlgRef_1Sel1Check* GroupWire;
+ DlgRef_1Sel1Check* myGroupWire;
+ DlgRef_2Sel* myGroupSurf;
+ DlgRef_1SelExt* myGroupWireConstraints;
+
+ QTreeWidget* myTreeConstraints;
+ TreeWidgetItem* myCurrentItem;
private slots:
+ void ConstructorsClicked( int );
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void SelectionIntoArgument();
void SetEditCurrentArgument();
+ void onItemClicked( QTreeWidgetItem*, int );
};
#endif // BUILDGUI_FACEDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
GEOM::GEOM_Object_var anObj = anOper->MakeShell( objlist.in() );
if ( !anObj->_is_nil() ) {
- TopoDS_Shape aShell;
- GEOMBase::GetShape(anObj, aShell, TopAbs_SHELL);
-
- if (aShell.IsNull()) {
+ if (anObj->GetShapeType() == GEOM::COMPOUND) {
SUIT_MessageBox::warning(this,
QObject::tr("GEOM_WRN_WARNING"),
QObject::tr("GEOM_WRN_FACES_NOT_SHELL"));
return true;
}
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BuildGUI_ShellDlg::getSourceObjects()
+{
+ return myFacesAndShells;
+}
+
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
BuildGUI_SolidDlg::BuildGUI_SolidDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton( theGeometryGUI, parent )
{
- QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BUILD_SOLID" ) ) );
- QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BUILD_SOLID" ) ) );
+ QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SOLID_FROM_FACES" ) ) );
setWindowTitle( tr( "GEOM_SOLID_TITLE" ) );
/***************************************************************/
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SOLID" ) );
- mainFrame()->RadioButton1->setIcon( image0 );
- mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
- mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton1->setIcon( image1 );
+ mainFrame()->RadioButton2->setIcon( image2 );
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupSolid = new DlgRef_1Sel1Check( centralWidget() );
-
- GroupSolid->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
+ GroupSolid->GroupBox1->setTitle( tr( "GEOM_SOLID_SHELLS" ) );
GroupSolid->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
GroupSolid->CheckButton1->setText( tr( "GEOM_CREATE_SINGLE_SOLID" ) );
- GroupSolid->PushButton1->setIcon( image1 );
+ GroupSolid->PushButton1->setIcon( image0 );
GroupSolid->LineEdit1->setReadOnly( true );
+ GroupFaces = new DlgRef_1Sel1Check( centralWidget() );
+ GroupFaces->GroupBox1->setTitle( tr( "GEOM_SOLID_FACES" ) );
+ GroupFaces->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
+ GroupFaces->CheckButton1->setText( tr( "GEOM_SOLID_FROM_FACE_OPT" ) );
+ GroupFaces->PushButton1->setIcon( image0 );
+ GroupFaces->LineEdit1->setReadOnly( true );
+
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupSolid );
+ layout->addWidget( GroupFaces );
/***************************************************************/
setHelpFileName("create_solid_page.html");
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+ connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
+
connect( GroupSolid->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect( GroupFaces->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupSolid->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( EnableNameField( bool ) ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
initName( tr( "GEOM_SOLID" ) );
SelectionIntoArgument();
+
+ ConstructorsClicked(0);
}
return false;
initName();
+
+ myEditCurrentArgument->setText("");
+ ConstructorsClicked(getConstructorId());
+
return true;
}
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void BuildGUI_SolidDlg::ConstructorsClicked(int constructorId)
+{
+ switch (constructorId) {
+ case 0:
+ {
+ globalSelection();
+ GroupFaces->hide();
+ GroupSolid->show();
+ myEditCurrentArgument = GroupSolid->LineEdit1;
+ GroupSolid->LineEdit1->setText("");
+ break;
+ }
+ case 1:
+ {
+ globalSelection();
+ GroupSolid->hide();
+ GroupFaces->show();
+ myEditCurrentArgument = GroupFaces->LineEdit1;
+ GroupFaces->LineEdit1->setText("");
+ break;
+ }
+ }
+
+ qApp->processEvents();
+ updateGeometry();
+ resize(minimumSizeHint());
+ SelectionIntoArgument();
+}
//=================================================================================
// function : SelectionIntoArgument()
//myShells = getSelected( TopAbs_SHELL, -1 );
QList<TopAbs_ShapeEnum> types;
+ if (myEditCurrentArgument == GroupSolid->LineEdit1)
types << TopAbs_SHELL << TopAbs_COMPOUND;
+ else if (myEditCurrentArgument == GroupFaces->LineEdit1)
+ types << TopAbs_FACE << TopAbs_SHELL << TopAbs_COMPOUND;
myShells = getSelected( types, -1 );
if ( !myShells.isEmpty() ) {
void BuildGUI_SolidDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
- if ( send != GroupSolid->PushButton1 )
- return;
- //globalSelection( GEOM_SHELL );
TColStd_MapOfInteger aMap;
- aMap.Add( GEOM_SHELL );
- aMap.Add( GEOM_COMPOUNDFILTER );
QList<int> aSubShapes;
- aSubShapes.append( GEOM_SHELL );
- globalSelection( aMap, aSubShapes );
+ aMap.Add( GEOM_COMPOUNDFILTER );
- myEditCurrentArgument = GroupSolid->LineEdit1;
+ if (send == GroupSolid->PushButton1) {
+ aMap.Add( GEOM_SHELL );
+ aSubShapes.append( GEOM_SHELL );
+ globalSelection( aMap, aSubShapes );
+ myEditCurrentArgument = GroupSolid->LineEdit1;
+ }
+ else if (send == GroupFaces->PushButton1) {
+ aMap.Add( GEOM_SHELL );
+ aMap.Add( GEOM_FACE );
+ aSubShapes.append( GEOM_SHELL );
+ aSubShapes.append( GEOM_FACE );
+ globalSelection( aMap, aSubShapes );
+ myEditCurrentArgument = GroupFaces->LineEdit1;
+ }
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
void BuildGUI_SolidDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
- //globalSelection( GEOM_SHELL );
- TColStd_MapOfInteger aMap;
- aMap.Add( GEOM_SHELL );
- aMap.Add( GEOM_COMPOUNDFILTER );
- QList<int> aSubShapes;
- aSubShapes.append( GEOM_SHELL );
- globalSelection( aMap, aSubShapes );
+ ConstructorsClicked(getConstructorId());
}
GEOM::MeasureOpPtr anOp;
anOp.take(myGeomGUI->GetGeomGen()->GetIMeasureOperations(getStudyId()));
-
- if (!GroupSolid->CheckButton1->isChecked() || myShells.count() == 1) {
- for (int i = 0, n = myShells.count(); i < n && ok; i++) {
- CORBA::String_var aRes = anOp->IsGoodForSolid(myShells[i].get());
- if (strlen(aRes.in())) {
- msg = QObject::tr(aRes.in()).arg(GEOMBase::GetName(myShells[i].get()));
- ok = false;
- }
- }
+ if (getConstructorId() == 0 && (!GroupSolid->CheckButton1->isChecked() || myShells.count() == 1)) {
+ for (int i = 0, n = myShells.count(); i < n && ok; i++) {
+ CORBA::String_var aRes = anOp->IsGoodForSolid(myShells[i].get());
+ if (strlen(aRes.in())) {
+ msg = QObject::tr(aRes.in()).arg(GEOMBase::GetName(myShells[i].get()));
+ ok = false;
+ }
+ }
}
return ok;
}
bool BuildGUI_SolidDlg::execute( ObjectList& objects )
{
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
+ GEOM::GEOM_Object_var anObj;
+
+ switch (getConstructorId()) {
+ case 0:
+ {
+ if ( GroupSolid->CheckButton1->isChecked() ) {
+ GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
+ objlist->length( myShells.count() );
+ for ( int i = 0; i < myShells.count(); i++ )
+ objlist[i] = myShells[i].copy();
+
+ anObj = anOper->MakeSolidShells( objlist.in() );
+
+ if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() );
+ }
+ else {
+ for ( int i = 0, n = myShells.count(); i< n; i++ ){
+ anObj = anOper->MakeSolidShell( myShells[ i ].get() );
+
+ if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() );
+ }
+ }
+ break;
+ }
+ case 1:
+ {
+ GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
+ objlist->length( myShells.count() );
+ for ( int i = 0; i < myShells.count(); i++ )
+ objlist[i] = myShells[i].copy();
- if ( GroupSolid->CheckButton1->isChecked() ) {
- GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
- objlist->length( myShells.count() );
- for ( int i = 0; i < myShells.count(); i++ )
- objlist[i] = myShells[i].copy();
-
- GEOM::GEOM_Object_var anObj = anOper->MakeSolidShells( objlist.in() );
-
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
- }
- else {
- for ( int i = 0, n = myShells.count(); i< n; i++ ) {
- GEOM::GEOM_Object_var anObj = anOper->MakeSolidShell( myShells[ i ].get() );
+ anObj = anOper->MakeSolidFromConnectedFaces( objlist.in(), GroupFaces->CheckButton1->isChecked() );
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
+ if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() );
+ break;
}
}
return true;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BuildGUI_SolidDlg::getSourceObjects()
+{
+ return myShells;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
- virtual bool execute( ObjectList& );
+ virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
QList<GEOM::GeomObjPtr> myShells;
DlgRef_1Sel1Check* GroupSolid;
+ DlgRef_1Sel1Check* GroupFaces;
private slots:
void ClickOnOk();
bool ClickOnApply();
void SetEditCurrentArgument();
void SelectionIntoArgument();
+ void ConstructorsClicked( int );
void ActivateThisDialog();
void EnableNameField( bool );
};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
myEdgesAndWires.clear();
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
/* signals and slots connections */
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
{
if ( GroupType->RadioButton1->isChecked() ) {
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
GroupArgs->TextLabel1->setText( tr( "GEOM_EDGE" ) );
}
else if ( GroupType->RadioButton2->isChecked() ) {
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_WIRE );
+ localSelection( TopAbs_WIRE );
GroupArgs->TextLabel1->setText( tr( "GEOM_WIRE" ) );
}
SelectionIntoArgument();
for ( int i = 0; i < myEdgesAndWires.count(); i++ )
GEOMBase::PublishSubObject( myEdgesAndWires[i].get() );
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BuildGUI_WireDlg::getSourceObjects()
+{
+ return myEdgesAndWires;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
IF(SALOME_BUILD_GUI)
SET(SUBDIRS_GUI
OBJECT DlgRef GEOMFiltersSelection Material GEOMGUI
- GEOMBase DependencyTree GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI
- CurveCreator EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI
- RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI
+ GEOMBase GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI
+ CurveCreator MeasureGUI EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI
+ RepairGUI GroupGUI BlocksGUI AdvancedGUI
GEOM_SWIG_WITHIHM
)
+ IF(SALOME_USE_GRAPHICSVIEW)
+ LIST(APPEND SUBDIRS_GUI DependencyTree)
+ ENDIF()
ENDIF()
SET(SUBDIRS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
CurveCreator_Diff.cxx
CurveCreator_Displayer.cxx
CurveCreator_Operation.cxx
+ CurveCreator_Section.cxx
CurveCreator_Utils.cxx
CurveCreator_UtilsICurve.cxx
)
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
namespace CurveCreator
{
//! Points coordinates
- typedef float TypeCoord;
+ typedef double TypeCoord;
/** List of coordinates in format depends on section dimension:
* 2D: [x1, y1, x2, y2, x3, y3, ..]
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
std::string aName(aBuffer);
int j;
for( j = 0 ; j < mySections.size() ; j++ ){
- aSection = getSection( j );
+ aSection = (CurveCreator_Section*)getSection( j );
if ( aSection && aSection->myName == aName )
break;
}
int aMovedSectionId = theISection >= 0 ? theISection : mySections.size()-1;
if (aMovedSectionId != theNewIndex) {
- CurveCreator_Section* aSection = getSection( aMovedSectionId );
+ CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( aMovedSectionId );
// Remove section
CurveCreator::Sections::iterator anIter = mySections.begin() + aMovedSectionId;
CurveCreator_Section* aSection;
for (; i < aNbSections; i++) {
- aSection = getSection( i );
+ aSection = (CurveCreator_Section*)getSection( i );
if ( aSection )
delete aSection;
}
return res;
int anISectionMain = theSections.front();
- CurveCreator_Section* aSectionMain = getSection( anISectionMain );
+ CurveCreator_Section* aSectionMain =
+ (CurveCreator_Section*)getSection( anISectionMain );
std::list <int> aSectionsToJoin = theSections;
aSectionsToJoin.erase( aSectionsToJoin.begin() ); // skip the main section
std::list<int>::const_iterator anIt = aSectionsToJoin.begin(), aLast = aSectionsToJoin.end();
CurveCreator_Section* aSection;
for (; anIt != aLast; anIt++) {
- aSection = getSection( *anIt );
+ aSection = (CurveCreator_Section*)getSection( *anIt );
aSectionMain->myPoints.insert(aSectionMain->myPoints.end(), aSection->myPoints.begin(),
aSection->myPoints.end());
res = removeSectionInternal(*anIt);
const int aNbSections = getNbSections();
for (; i < aNbSections; i++) {
- aSection = getSection( i );
+ aSection = (CurveCreator_Section*)getSection( i );
if ( aSection )
aNbCoords += aSection->myPoints.size();
}
} else {
- aSection = getSection( theISection );
+ aSection = (CurveCreator_Section*)getSection( theISection );
if ( aSection )
aNbCoords = aSection->myPoints.size();
}
//! Get "closed" flag of the specified section
bool CurveCreator_Curve::isClosed( const int theISection ) const
{
- CurveCreator_Section* aSection = getSection( theISection );
+ const CurveCreator_Section* aSection =
+ (CurveCreator_Section*)getSection( theISection );
return aSection ? aSection->myIsClosed : false;
}
int i;
for (i = 0; i < aSize; i++) {
- aSection = getSection( i );
+ aSection = (CurveCreator_Section*)getSection( i );
if( aSection ) {
aSection->myIsClosed = theIsClosed;
redisplayCurve();
}
}
} else {
- aSection = getSection( theISection );
+ aSection = (CurveCreator_Section*)getSection( theISection );
if ( aSection ) {
aSection->myIsClosed = theIsClosed;
redisplayCurve();
//! Returns specified section name
std::string CurveCreator_Curve::getSectionName( const int theISection ) const
{
- CurveCreator_Section* aSection = getSection( theISection );
+ CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
return aSection ? aSection->myName : "";
}
const std::string& theName )
{
bool res = false;
- CurveCreator_Section* aSection = getSection( theISection );
+ CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
if( aSection ) {
aSection->myName = theName;
res = true;
CurveCreator::SectionType CurveCreator_Curve::getSectionType
( const int theISection ) const
{
- CurveCreator_Section* aSection = getSection( theISection );
+ CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
return aSection ? aSection->myType : CurveCreator::Polyline;
}
const int aNbSections = getNbSections();
for (; i < aNbSections; i++) {
- aSection = getSection( i );
+ aSection = (CurveCreator_Section*)getSection( i );
if ( aSection )
aSection->myType = theType;
}
redisplayCurve();
} else {
- aSection = getSection( theISection );
+ aSection = (CurveCreator_Section*)getSection( theISection );
if ( aSection && aSection->myType != theType ){
aSection->myType = theType;
redisplayCurve();
CurveCreator_Section *aSection = 0;
for ( ; anIt != theSectionsMap.end(); anIt++ ) {
int anISection = anIt->first;
- aSection = getSection( anISection );
+ aSection = (CurveCreator_Section*)getSection( anISection );
if( aSection ) {
CurveCreator::PosPointsList aSectionPoints = anIt->second;
CurveCreator::PosPointsList::const_iterator aPntIt = aSectionPoints.begin();
CurveCreator_Section *aSection = 0;
for ( ; anIt != theSectionsMap.end(); anIt++ ) {
int anISection = anIt->first;
- aSection = getSection( anISection );
+ aSection = (CurveCreator_Section*)getSection( anISection );
if( aSection ) {
CurveCreator::PosPointsList aSectionPoints = anIt->second;
CurveCreator::PosPointsList::const_iterator aPntIt = aSectionPoints.begin();
CurveCreator::Coordinates CurveCreator_Curve::getPoint( const int theISection,
const int theIPnt) const
{
- CurveCreator_Section* aSection = getSection( theISection );
+ CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
CurveCreator::Coordinates::const_iterator
anIter = aSection->myPoints.begin() + toICoord(theIPnt);
CurveCreator::Coordinates aResult(anIter, anIter + myDimension);
//=======================================================================
CurveCreator::Coordinates CurveCreator_Curve::getPoints( const int theISection ) const
{
- CurveCreator_Section* aSection = getSection( theISection );
+ CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
return aSection ? aSection->myPoints : CurveCreator::Coordinates();
}
myAISShape = new AIS_Shape( aShape );
}
-CurveCreator_Section* CurveCreator_Curve::getSection( const int theSectionId ) const
-{
- CurveCreator_Section *aSection = 0;
- if ( theSectionId >= 0 && theSectionId < mySections.size() )
- aSection = mySections.at( theSectionId );
-
- return aSection;
-}
-
Handle(AIS_InteractiveObject) CurveCreator_Curve::getAISObject( const bool theNeedToBuild ) const
{
if ( !myAISShape && theNeedToBuild ) {
{
bool aRes = false;
- CurveCreator_Section* aSection = getSection( theSectionId );
+ CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theSectionId );
if ( !aSection )
return aRes;
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
virtual bool setSectionType( const int theISection,
const CurveCreator::SectionType theType );
+ //! A virtual method.
+ const CurveCreator_ISection* getSection(const int theSectionIndex) const
+ {
+ if (theSectionIndex >= 0 && theSectionIndex < mySections.size())
+ {
+ return (CurveCreator_ISection*)mySections[theSectionIndex];
+ }
+ return NULL;
+ }
+
+ //! A virtual method.
+ CurveCreator_ISection* getSection(const int theSectionIndex)
+ {
+ return (CurveCreator_ISection*)mySections[theSectionIndex];
+ }
/***********************************************/
/*** Point methods ***/
protected:
virtual void constructAISObject();
- /**
- * Returns the section by the section index or NULL if the index is out of the section
- * list range
- * \param theSectionId the section index
- */
- CurveCreator_Section* getSection( const int theSectionId ) const;
protected:
bool mySkipSorting;
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 "CurveCreator_Displayer.hxx"
CurveCreator_Displayer::CurveCreator_Displayer( Handle_AIS_InteractiveContext theContext,
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 CURVECREATOR_DISPLAYER_H
#define CURVECREATOR_DISPLAYER_H
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
#ifndef _CurveCreator_ICurve_HeaderFile
#define _CurveCreator_ICurve_HeaderFile
+#include "CurveCreator.hxx"
#include "CurveCreator_Macro.hxx"
+
+#include <TColgp_HArray1OfPnt.hxx>
+
#include <deque>
#include <vector>
#include <string>
};
+//! The type represents the interface to the curve section.
+struct CURVECREATOR_EXPORT CurveCreator_ISection
+{
+ //! The destructor.
+ virtual ~CurveCreator_ISection() {}
+
+ //! Calculates the different points of the section.
+ virtual void GetDifferentPoints(
+ const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const = 0;
+};
+
/**
* The CurveCreator_ICurve object is represented as one or more sets of
* connected points; thus CurveCreator_ICurve object can contain several
typedef std::pair<int,int> SectionToPoint;
typedef std::deque<SectionToPoint> SectionToPointList;
- typedef std::deque< std::pair< SectionToPoint,std::deque< float > > > SectionToPointCoordsList;
+ typedef std::deque< std::pair< SectionToPoint, CurveCreator::Coordinates > > SectionToPointCoordsList;
public:
/***********************************************/
/*** Undo/Redo methods ***/
/***********************************************/
+ //! The destructor.
+ virtual ~CurveCreator_ICurve() {}
+
//! Get number of available undo operations
virtual int getNbUndo() const = 0;
virtual bool setSectionType( const int theISection,
const CurveCreator::SectionType theType ) = 0;
+ //! Returns the curve section with the index.
+ virtual const CurveCreator_ISection* getSection(
+ const int theSectionIndex) const = 0;
+
+ //! Returns the curve section with the index.
+ virtual CurveCreator_ISection* getSection(const int theSectionIndex) = 0;
+
/***********************************************/
/*** Point methods ***/
* Insert one or several points to the specified section starting from the given theIPnt index
* (or add these at the end of section points if \a theIPnt is -1).
*/
- virtual bool addPoints( const std::deque<float>& theCoords,
+ virtual bool addPoints( const CurveCreator::Coordinates& theCoords,
const int theISection,
const int theIPnt = -1 ) = 0;
//! Set coordinates of specified point
virtual bool setPoint( const int theISection,
const int theIPnt,
- const std::deque<float>& theNewCoords ) = 0;
+ const CurveCreator::Coordinates& theNewCoords ) = 0;
//! Set coordinates of specified points from different sections
virtual bool setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords,
virtual bool removeSeveralPoints( const SectionToPointList &theSectionToPntIDs) = 0;
//! Get coordinates of specified point
- virtual std::deque<float> getPoint( const int theISection,
+ virtual CurveCreator::Coordinates getPoint( const int theISection,
const int theIPnt ) const = 0;
/**
* Get points of a section (the total points in Curve if theISection is equal to -1)..
*/
- virtual std::deque<float> getPoints( const int theISection = -1 ) const = 0;
+ virtual CurveCreator::Coordinates getPoints( const int theISection = -1 ) const = 0;
/**
* Get number of points in specified section or (the total number of points
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
int nbPoints = pInt[0];
int nbCoords = pInt[1];
- int nbParams = 3+nbCoords;
+ int nbParams = 3+nbCoords*sizeof(double)/sizeof(int);
for (int i = 0; i < nbPoints*nbParams; i=i+nbParams) {
aCoords.clear();
aPoints.clear();
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
--- /dev/null
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+// File: CurveCreator_Section.cxx
+// Author: Aleksandr BOBKOV
+
+#include "CurveCreator_Section.hxx"
+
+#include <vector>
+
+const double POINT_CONFUSION = 1e-4;
+
+//=======================================================================
+// function: GetDifferentPoints
+// purpose:
+//=======================================================================
+void CurveCreator_Section::GetDifferentPoints(
+ const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const
+{
+ std::vector<gp_Pnt> aTmpPoints;
+ CurveCreator::Coordinates::const_iterator aPIt = myPoints.begin();
+ CurveCreator::Coordinates::const_iterator aPItLast = myPoints.end();
+ const gp_Pnt aFirstPoint(
+ *aPIt, *(aPIt + 1), (theDimension == 2) ? 0 : *(aPIt + 2));
+ gp_Pnt aPoint = aFirstPoint;
+ aTmpPoints.push_back(aPoint);
+
+ for (; aPIt != aPItLast; aPIt += theDimension)
+ {
+ const gp_Pnt aPoint2(
+ *aPIt, *(aPIt + 1), (theDimension == 2) ? 0 : *(aPIt + 2));
+ if (!aPoint.IsEqual(aPoint2, POINT_CONFUSION))
+ {
+ aPoint = aPoint2;
+ aTmpPoints.push_back(aPoint);
+ }
+ }
+
+ int aPointCount = aTmpPoints.size();
+ if (myIsClosed)
+ {
+ while (aPointCount > 1 &&
+ aFirstPoint.IsEqual(aTmpPoints[aPointCount - 1], POINT_CONFUSION))
+ {
+ --aPointCount;
+ }
+ }
+
+ thePoints = new TColgp_HArray1OfPnt(1, aPointCount);
+ for (int aPI = 0; aPI < aPointCount; ++aPI)
+ {
+ thePoints->SetValue(aPI + 1, aTmpPoints[aPI]);
+ }
+}
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
#define _CurveCreator_Section_HeaderFile
#include "CurveCreator.hxx"
+#include "CurveCreator_ICurve.hxx"
#include <string>
//! Structure to store sections representing the CurveCreator_Curve object
-struct CurveCreator_Section
+struct CURVECREATOR_EXPORT CurveCreator_Section :
+ public CurveCreator_ISection
{
//! Constructor. Initializes object with default values.
CurveCreator_Section() : myName("Section"),myType(CurveCreator::Polyline), myIsClosed(false)
CurveCreator::SectionType myType; //!< type of the section
bool myIsClosed; //!< closed or not
+ //! A virtual method.
+ void GetDifferentPoints(const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const;
};
#endif
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
#include <QTableWidget>
#include <QTableWidgetItem>
+#include <QHeaderView>
#include <QtxDoubleSpinBox.h>
//aLabels << tr( "SECTION_LABEL" ) << tr( "IDENTIFIER_LABEL" ) << aCoord1 << aCoord2;
aLabels << tr( "TABLE_SECTION" ) << tr("TABLE_INDEX") << aCoord1 << aCoord2;
setHorizontalHeaderLabels( aLabels );
+
+ connect( horizontalHeader(), SIGNAL( sectionClicked( int ) ), this, SLOT( OnHeaderClick( int ) ) );
}
void CurveCreator_TableView::setCurve( CurveCreator_ICurve* theCurve )
QTableWidgetItem* anItem;
anItem = new QTableWidgetItem( myCurve->getSectionName( anISection ).c_str() );
- anItem->setFlags( anItem->flags() & ~Qt::ItemIsEnabled );
+ anItem->setFlags( anItem->flags() & ~Qt::ItemIsEditable );
anItem->setData( Qt::UserRole, anISection );
setItem( aRowId, 0, anItem );
anItem = new QTableWidgetItem( QString::number( anIPoint + 1 ) );
anItem->setFlags( anItem->flags() & ~Qt::ItemIsEnabled );
anItem->setData( Qt::UserRole, anIPoint );
+ anItem->setData( Qt::DisplayRole, anIPoint );
setItem( aRowId, 1, anItem );
gp_Pnt aPoint;
setItem( aRowId, 2, anItem );
}
anItem->setData( Qt::UserRole, aPoint.X() );
- anItem->setData( Qt::DisplayRole, QString::number( aPoint.X(), 'f', 2 ) );
+ anItem->setData( Qt::DisplayRole, QString::number( aPoint.X(), 'f', 2 ).toDouble() );
anItem = item( aRowId, 3 );
if ( !anItem ) {
setItem( aRowId, 3, anItem );
}
anItem->setData( Qt::UserRole, aPoint.Y() );
- anItem->setData( Qt::DisplayRole, QString::number( aPoint.Y(), 'f', 2 ) );
+ anItem->setData( Qt::DisplayRole, QString::number( aPoint.Y(), 'f', 2 ).toDouble() );
aRowId++;
}
{
return item( theRowId, 1 )->data( Qt::UserRole ).toInt();
}
+
+void CurveCreator_TableView::OnHeaderClick( int theLogicalId )
+{
+ sortByColumn( theLogicalId, Qt::AscendingOrder );
+}
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
class CurveCreator_TableView : public QTableWidget
{
+ Q_OBJECT
+
public:
CurveCreator_TableView( CurveCreator_ICurve* theCurve, QWidget* theParent = 0,
const QStringList& theCoordTitles = QStringList() );
*/
int getPointId( const int theRowId ) const;
+private slots:
+ void OnHeaderClick( int );
+
private:
CurveCreator_ICurve* myCurve;
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
#include "CurveCreator_Utils.hxx"
#include "CurveCreator.hxx"
#include "CurveCreator_Curve.hxx"
+#include "CurveCreator_Section.hxx"
#include "CurveCreator_UtilsICurve.hxx"
+#include <Basics_OCCTVersion.hxx>
+
#include <GEOMUtils.hxx>
#include <gp_Pln.hxx>
return ResultPoint;
}
-void CurveCreator_Utils::constructShape( const CurveCreator_ICurve* theCurve,
- TopoDS_Shape& theShape )
+//=======================================================================
+// function : constructBSpline
+// purpose :
+//=======================================================================
+bool CurveCreator_Utils::constructBSpline(
+ const Handle(TColgp_HArray1OfPnt)& thePoints,
+ const Standard_Boolean theIsClosed,
+ Handle(Geom_BSplineCurve)& theBSpline)
{
- BRep_Builder aBuilder;
- TopoDS_Compound aComp;
- aBuilder.MakeCompound( aComp );
- for( int iSection = 0 ; iSection < theCurve->getNbSections() ; iSection++ )
+ const int aPointCount = thePoints->Length();
+ if (aPointCount <= 1)
{
- int theISection = iSection;
+ return false;
+ }
- CurveCreator::SectionType aSectType = theCurve->getSectionType( theISection );
- int aPointSize = theCurve->getNbPoints( theISection );
- if ( aPointSize == 0 )
- continue;
+ // Calculate the tangents.
+ TColgp_Array1OfVec aTangents(1, aPointCount);
+ Handle(TColStd_HArray1OfBoolean) aTangentFlags =
+ new TColStd_HArray1OfBoolean(1, aPointCount);
+ GeomAPI_Interpolate aInterpolator(thePoints, theIsClosed, 0);
+ if (aPointCount == 2)
+ {
+ aTangentFlags->SetValue(1, Standard_False);
+ aTangentFlags->SetValue(2, Standard_False);
+ }
+ else
+ {
+ for (Standard_Integer aPN = 1; aPN <= aPointCount; ++aPN)
+ {
+ gp_Vec aTangent;
+ if (aPN != 1 || theIsClosed)
+ {
+ const Standard_Integer aPN1 = (aPN != 1) ? (aPN - 1) : aPointCount;
+ aTangent = gp_Vec(thePoints->Value(aPN1),
+ thePoints->Value(aPN)).Normalized();
+ }
+ if (aPN < aPointCount || theIsClosed)
+ {
+ const Standard_Integer aPN2 = (aPN != aPointCount) ? (aPN + 1) : 1;
+ const gp_Vec aTangent2 = aTangent +
+ gp_Vec(thePoints->Value(aPN), thePoints->Value(aPN2)).Normalized();
+ if (aTangent2.SquareMagnitude() >= Precision::SquareConfusion())
+ {
+ aTangent = aTangent2.Normalized();
+ }
+ else
+ {
+ aTangent = -aTangent;
+ }
+ }
+ aTangents.SetValue(aPN, aTangent);
+ aTangentFlags->SetValue(aPN, Standard_True);
+ }
+ }
- bool aSectIsClosed = theCurve->isClosed( theISection );
- bool isPolyline = aSectType == CurveCreator::Polyline;
-
- int iPoint = 0;
- gp_Pnt aPrevPoint, aPoint;
- // filters the curve points to skip equal points
- std::vector<gp_Pnt> aPoints;
- CurveCreator_UtilsICurve::getPoint( theCurve, theISection, iPoint, aPoint );
- aPoints.push_back( aPoint );
- aPrevPoint = aPoint;
- iPoint++;
- for( ; iPoint < aPointSize; iPoint++ ) {
- CurveCreator_UtilsICurve::getPoint( theCurve, theISection, iPoint, aPoint );
- if ( !isEqualPoints( aPrevPoint, aPoint ) )
- aPoints.push_back( aPoint );
- aPrevPoint = aPoint;
+ // Interpolate.
+ aInterpolator.Load(aTangents, aTangentFlags, Standard_False);
+ aInterpolator.Perform();
+ const bool aResult = (aInterpolator.IsDone() == Standard_True);
+ if (aResult)
+ {
+ theBSpline = aInterpolator.Curve();
+ }
+ return aResult;
+}
+
+//=======================================================================
+// function : constructWire
+// purpose :
+//=======================================================================
+TopoDS_Wire CurveCreator_Utils::ConstructWire(
+ Handle(TColgp_HArray1OfPnt) thePoints,
+ const bool theIsPolyline,
+ const bool theIsClosed)
+{
+ TopoDS_Wire aWire;
+ BRep_Builder aBuilder;
+ aBuilder.MakeWire(aWire);
+ const int aPointCount = thePoints->Length();
+ if (theIsPolyline)
+ {
+ const TopoDS_Vertex aFirstVertex =
+ BRepBuilderAPI_MakeVertex(thePoints->Value(1));
+ TopoDS_Vertex aVertex = aFirstVertex;
+ for (Standard_Integer aPN = 1; aPN < aPointCount; ++aPN)
+ {
+ const TopoDS_Vertex aVertex2 =
+ BRepBuilderAPI_MakeVertex(thePoints->Value(aPN + 1));
+ aBuilder.Add(aWire, BRepBuilderAPI_MakeEdge(aVertex, aVertex2));
+ aVertex = aVertex2;
+ }
+ if (theIsClosed && aPointCount > 1)
+ {
+ aBuilder.Add(aWire, BRepBuilderAPI_MakeEdge(aVertex, aFirstVertex));
+ }
+ }
+ else
+ {
+ Handle(Geom_BSplineCurve) aBSpline;
+ if (constructBSpline(thePoints, theIsClosed, aBSpline))
+ {
+ aBuilder.Add(aWire, BRepBuilderAPI_MakeEdge(aBSpline));
}
- int aNbPoints = aPoints.size();
+ }
+ return aWire;
+}
- if ( aNbPoints == 1 ) {
- aPoint = aPoints.front();
- TopoDS_Vertex aVertex = BRepBuilderAPI_MakeVertex( aPoint ).Vertex();
- aBuilder.Add( aComp, aVertex );
+//=======================================================================
+// function : constructShape
+// purpose :
+//=======================================================================
+void CurveCreator_Utils::constructShape(
+ const CurveCreator_ICurve* theCurve, TopoDS_Shape& theShape)
+{
+ BRep_Builder aBuilder;
+ TopoDS_Compound aShape;
+ aBuilder.MakeCompound(aShape);
+ const int aSectionCount = theCurve->getNbSections();
+ for (int aSectionI = 0; aSectionI < aSectionCount; ++aSectionI)
+ {
+ const int aTmpPointCount = theCurve->getNbPoints(aSectionI);
+ if (aTmpPointCount == 0)
+ {
+ continue;
}
- else if ( aNbPoints > 1 ) {
- Handle(TColgp_HArray1OfPnt) aHCurvePoints = new TColgp_HArray1OfPnt(1, aNbPoints);
- TColgp_Array1OfVec aTangents(1, aNbPoints);
- Handle(TColStd_HArray1OfBoolean) aTangentFlags = new TColStd_HArray1OfBoolean(1, aNbPoints);
- gp_Vec aNullVec(0, 0, 0);
-
- TopoDS_Edge aPointEdge;
- TopoDS_Vertex aVertex;
-
- std::vector<gp_Pnt>::const_iterator aPointIt = aPoints.begin(), aPointLast = aPoints.end();
- aPoint = *aPointIt;
-
- int aHIndex = 1;
- aVertex = BRepBuilderAPI_MakeVertex( aPoint ).Vertex();
- aBuilder.Add( aComp, aVertex );
- if ( !isPolyline ) {
- aHCurvePoints->SetValue( aHIndex, aPoint );
- aTangents.SetValue( aHIndex, aNullVec );
- aTangentFlags->SetValue( aHIndex, Standard_False );
- aHIndex++;
- }
- aPrevPoint = aPoint;
- aPointIt++;
- for( ; aPointIt != aPointLast; aPointIt++ ) {
- aPoint = *aPointIt;
- aVertex = BRepBuilderAPI_MakeVertex( aPoint ).Vertex();
- aBuilder.Add( aComp, aVertex );
- if ( isPolyline ) {
- TopoDS_Edge aPointEdge = BRepBuilderAPI_MakeEdge( aPrevPoint, aPoint ).Edge();
- aBuilder.Add( aComp, aPointEdge );
- }
- else {
- aHCurvePoints->SetValue( aHIndex, aPoint );
- aTangents.SetValue( aHIndex, aNullVec );
- aTangentFlags->SetValue( aHIndex, Standard_False );
- aHIndex++;
- }
- aPrevPoint = aPoint;
- }
- if( aSectIsClosed && ( aNbPoints > 2 ) ) {
- aPoint = aPoints.front();
- aVertex = BRepBuilderAPI_MakeVertex( aPoint ).Vertex();
- aBuilder.Add( aComp, aVertex );
- if ( isPolyline ) {
- aPointEdge = BRepBuilderAPI_MakeEdge( aPrevPoint, aPoint ).Edge();
- aBuilder.Add( aComp, aPointEdge );
- }
- }
- if( !isPolyline ) {
- // compute BSpline
- Handle(Geom_BSplineCurve) aBSplineCurve;
- GeomAPI_Interpolate aGBC(aHCurvePoints, aSectIsClosed, gp::Resolution());
- // correct the spline degree to be as 3 for non-periodic spline if number of points
- // less than 3. It is need to have a knot in each spline point. This knots are used
- // to found a neighbour points when a new point is inserted between two existing.
- if (!aSectIsClosed ) {
- if (aHCurvePoints->Length() == 3)
- aGBC.Load(aTangents, aTangentFlags);
- }
+ // Get the different points.
+ const CurveCreator_ISection* aSection = theCurve->getSection(aSectionI);
+ Handle(TColgp_HArray1OfPnt) aPoints;
+ aSection->GetDifferentPoints(theCurve->getDimension(), aPoints);
+ const int aPointCount = aPoints->Length();
+ const bool isClosed = theCurve->isClosed(aSectionI);
- aGBC.Perform();
- if ( aGBC.IsDone() )
- aBSplineCurve = aGBC.Curve();
- TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aBSplineCurve ).Edge();
- TopoDS_Wire aWire = BRepBuilderAPI_MakeWire( anEdge ).Wire();
- aBuilder.Add( aComp, aWire );
- }
+ // Add the vertices to the shape.
+ for (Standard_Integer aPN = 1; aPN <= aPointCount; ++aPN)
+ {
+ aBuilder.Add(aShape, BRepBuilderAPI_MakeVertex(aPoints->Value(aPN)));
+ }
+
+ // Add the wire to the shape.
+ const bool isPolyline =
+ (theCurve->getSectionType(aSectionI) == CurveCreator::Polyline);
+ const TopoDS_Wire aWire = ConstructWire(aPoints, isPolyline, isClosed);
+ if (!aWire.IsNull())
+ {
+ aBuilder.Add(aShape, aWire);
}
}
- theShape = aComp;
+ theShape = aShape;
}
/**
{
thePoints.clear();
- std::list<float> aSelectedPoints;
+ std::list<double> aSelectedPoints;
gp_Pnt aPnt;
std::map<CompareSectionToPoint, int> aPointsMap;
Handle_SelectMgr_Selection aSelection = anAISShape->Selection( AIS_Shape::SelectionMode( TopAbs_VERTEX ) );
for( aSelection->Init(); aSelection->More(); aSelection->Next() )
- {
+ {
+#if OCC_VERSION_LARGE > 0x06080100
+ const Handle(SelectMgr_SensitiveEntity) aHSenEntity = aSelection->Sensitive();
+ if( aHSenEntity.IsNull() )
+ continue;
+ Handle_SelectBasics_SensitiveEntity aSenEntity = aHSenEntity->BaseSensitive();
+#else
Handle_SelectBasics_SensitiveEntity aSenEntity = aSelection->Sensitive();
+#endif
+
Handle_Select3D_SensitivePoint aSenPnt = Handle_Select3D_SensitivePoint::DownCast( aSenEntity );
gp_Pnt anOwnerPnt = aSenPnt->Point();
anExp.Next();
- if (IsBSpline) {
+ if (IsBSpline)
+ {
// There should be a single BSpline curve in the wire.
if (anExp.More()) {
return aResult;
IsClosed = aV[0].IsSame(aV[1]) ? true : false;
- const Standard_Integer aNbPoints = aBSplCurve->NbKnots();
- TColStd_Array1OfReal aKnots(1, aNbPoints);
-
+ Standard_Integer aNbPoints = aBSplCurve->NbKnots();
+ TColStd_Array1OfReal aKnots(1, aNbPoints);
aBSplCurve->Knots(aKnots);
- aResult = new TColgp_HArray1OfPnt(1, aBSplCurve->NbKnots());
- for (i = aKnots.Lower(); i <= aKnots.Upper(); ++i) {
- aResult->SetValue(i, aBSplCurve->Value(aKnots.Value(i)));
- }
- } else {
+ // Don't consider the last point as it coincides with the first
+ if (IsClosed)
+ --aNbPoints;
+
+ aResult = new TColgp_HArray1OfPnt(1, aNbPoints);
+ for (i = 1; i <= aNbPoints; ++i)
+ aResult->SetValue(i, aBSplCurve->Value( aKnots.Value(i) ));
+ }
+ else
+ {
// This is a polyline.
TopTools_ListOfShape aVertices;
Standard_Integer aNbVtx = 1;
IsClosed = aFirstVtx.IsSame(aLastVtx) ? true : false;
+ // Store a last vertex
+ if (!IsClosed)
+ {
+ aVertices.Append(aLastVtx);
+ aNbVtx++;
+ }
+
// Fill the array of points.
aResult = new TColgp_HArray1OfPnt(1, aNbVtx);
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
#include <gp_Pnt.hxx>
#include <Geom_Curve.hxx>
#include <TopoDS_Shape.hxx>
+#include <TopoDS_Wire.hxx>
#include <TColgp_HArray1OfPnt.hxx>
+#include <Geom_BSplineCurve.hxx>
#include <list>
#include <vector> // TODO: remove
gp_Pnt& thePoint, gp_Pnt& thePoint1,
gp_Pnt& thePoint2 );
+ /**
+ * The algorithm builds the cubic B-spline passing through the points that the
+ * tangent vector in each given point P is calculated by the following way:
+ * if point P is preceded by a point A and is followed by a point B then
+ * the tangent vector is equal to (P - A) / |P - A| + (B - P) / |B - P|;
+ * if point P is preceded by a point A but is not followed by any point then
+ * the tangent vector is equal to P - A;
+ * if point P is followed by a point B but is not preceded by any point then
+ * the tangent vector is equal to B - P.
+ */
+ CURVECREATOR_EXPORT static bool constructBSpline( const Handle(TColgp_HArray1OfPnt)& thePoints,
+ const Standard_Boolean theIsClosed,
+ Handle(Geom_BSplineCurve)& theBSpline );
+
+ /**
+ * Constructs the wire corresponding to the section.
+ */
+ CURVECREATOR_EXPORT static TopoDS_Wire ConstructWire(
+ Handle(TColgp_HArray1OfPnt) thePoints,
+ const bool theIsPolyline,
+ const bool theIsClosed);
+
protected:
/*
* Returns whether the clicked point belong to the curve or has a very near projection
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
const double LOCAL_SELECTION_TOLERANCE = 0.0001;
int CurveCreator_UtilsICurve::findLocalPointIndex( const CurveCreator_ICurve* theCurve,
- int theSectionId, float theX, float theY )
+ int theSectionId, double theX, double theY )
{
int aPntIndex = -1;
if ( !theCurve )
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
* \param theY the Y coordinate of the point
*/
CURVECREATOR_EXPORT static int findLocalPointIndex( const CurveCreator_ICurve* theCurve,
- int theSectionId, float theX, float theY );
+ int theSectionId, double theX, double theY );
CURVECREATOR_EXPORT static void findSectionsToPoints( const CurveCreator_ICurve* theCurve,
const double theX, const double theY,
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
//=======================================================================
void CurveCreator_Widget::reset()
{
+ stopActionMode();
}
void CurveCreator_Widget::setCurve( CurveCreator_ICurve* theCurve )
mySectionView->sectionChanged(mySection);
updateUndoRedo();
onCancelSection();
-
- emit curveModified();
}
void CurveCreator_Widget::onJoin()
if( aNewSectSize != aMainSectSize )
mySectionView->pointsAdded( aMainSect, aMainSectSize, aNewSectSize-aMainSectSize );*/
updateUndoRedo();
-
- emit curveModified();
}
void CurveCreator_Widget::onRemove()
mySectionView->reset();
updateActionsStates();
updateUndoRedo();
-
- emit curveModified();
}
void CurveCreator_Widget::onJoinAll()
mySectionView->reset();
updateActionsStates();
updateUndoRedo();
-
- emit curveModified();
}
void CurveCreator_Widget::onUndoSettings()
mySectionView->sectionChanged(aSelSections[i]);
}
updateUndoRedo();
-
- emit curveModified();
}
void CurveCreator_Widget::onSetPolyline()
mySectionView->sectionChanged( aSelSections[i] );
}
updateUndoRedo();
-
- emit curveModified();
}
void CurveCreator_Widget::onCloseSections()
mySectionView->sectionChanged(aSelSections[i]);
}
updateUndoRedo();
-
- emit curveModified();
}
void CurveCreator_Widget::onUncloseSections()
mySectionView->sectionChanged(aSelSections[i]);
}
updateUndoRedo();
-
- emit curveModified();
}
void CurveCreator_Widget::onUndo()
myCurve->undo();
finishCurveModification();
mySectionView->reset();
-
- emit curveModified();
}
void CurveCreator_Widget::onRedo()
myCurve->redo();
finishCurveModification();
mySectionView->reset();
-
- emit curveModified();
}
void CurveCreator_Widget::updateUndoRedo()
return;
gp_Pnt aPnt;
+ OCCViewer_ViewPort3d* vp = getViewPort();
- ic->InitSelected();
- if ( pe->modifiers() == Qt::ShiftModifier )
- ic->ShiftSelect(); // Append selection
- else
- ic->Select(); // New selection
+ aPnt = CurveCreator_Utils::ConvertClickToPoint( pe->x(), pe->y(), vp->getView() );
- {
- OCCViewer_ViewPort3d* vp = getViewPort();
- aPnt = CurveCreator_Utils::ConvertClickToPoint( pe->x(), pe->y(), vp->getView() );
- }
// set the coordinates into dialog
CurveCreator::Coordinates aCoords;
aCoords.push_back( aPnt.X() );
if ( theEvent->button() != Qt::LeftButton )
return;
- myPressedX = theEvent->x();
- myPressedY = theEvent->y();
+ // Initialize the starting point
+ myStartPoint.setX( theEvent->x() );
+ myStartPoint.setY( theEvent->y() );
switch( getActionMode() ) {
case ModificationMode: {
* \param theWindow an owner of the signal
* \param theEvent a mouse event
*/
-void CurveCreator_Widget::onMouseRelease( SUIT_ViewWindow*, QMouseEvent* theEvent )
+void CurveCreator_Widget::onMouseRelease( SUIT_ViewWindow* theWindow, QMouseEvent* theEvent )
{
- if ( getActionMode() != ModificationMode )
+ ActionMode aMode = getActionMode();
+ if ( aMode != ModificationMode )
+ {
+ // Emit selectionChanged() signal
+ getOCCViewer()->performSelectionChanged();
+
+ if ( aMode == AdditionMode )
+ {
+ Handle(AIS_InteractiveContext) aCtx = getAISContext();
+ if ( !aCtx.IsNull() )
+ aCtx->ClearSelected();
+ }
return;
+ }
+ if (theEvent->button() != Qt::LeftButton) return;
+ if (!theWindow->inherits("OCCViewer_ViewWindow")) return;
+
+ // Initialize the ending point
+ myEndPoint.setX( theEvent->x() );
+ myEndPoint.setY( theEvent->y() );
+
+ bool aHasShift = ( theEvent->modifiers() & Qt::ShiftModifier );
+
+ // Highlight detected objects
+ Handle(AIS_InteractiveContext) aCtx = getAISContext();
+ if ( !aCtx.IsNull() )
+ {
+ OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*) theWindow;
+ if (!aView)
+ return;
+
+ if (!aHasShift)
+ aCtx->ClearCurrents( false );
+
+ Handle(V3d_View) aView3d = aView->getViewPort()->getView();
+ if ( !aView3d.IsNull() )
+ {
+ // Initialize the single selection if start and end points are equal,
+ // otherwise a rectangular selection.
+ if ( myStartPoint == myEndPoint )
+ {
+ aCtx->MoveTo( myEndPoint.x(), myEndPoint.y(), aView3d );
+ if ( aHasShift )
+ aCtx->ShiftSelect();
+ else
+ aCtx->Select();
+ }
+ else
+ {
+ if ( aHasShift )
+ aCtx->ShiftSelect( myStartPoint.x(), myStartPoint.y(), myEndPoint.x(), myEndPoint.y(),
+ aView3d, Standard_False );
+ else
+ aCtx->Select( myStartPoint.x(), myStartPoint.y(), myEndPoint.x(), myEndPoint.y(),
+ aView3d, Standard_False );
+ }
+ }
+ }
if ( myDragStarted ) {
bool isDragged = myDragged;
CurveCreator_ICurve::SectionToPointList aDraggedPoints;
- QMap<CurveCreator_ICurve::SectionToPoint, std::deque< float > > anInitialDragPointsCoords;
+ QMap<CurveCreator_ICurve::SectionToPoint, CurveCreator::Coordinates > anInitialDragPointsCoords;
if ( myDragged ) {
aDraggedPoints = myDragPoints;
anInitialDragPointsCoords = myInitialDragPointsCoords;
for ( ; anIt != aLast; anIt++ ) {
int aSectionId = anIt->first;
int aPointId = anIt->second;
- std::deque<float> aPos = myCurve->getPoint( aSectionId, aPointId );
+ CurveCreator::Coordinates aPos = myCurve->getPoint( aSectionId, aPointId );
aCoordList.push_back(
std::make_pair( std::make_pair( aSectionId, aPointId ), aPos ) );
}
else // check whether the segment is clicked an a new point should be added to the segment
{
- int aReleasedX = theEvent->x();
- int aReleasedY = theEvent->y();
- if ( myPressedX == aReleasedX && myPressedY == aReleasedY )
- insertPointToSelectedSegment( aReleasedX, aReleasedY );
+ if ( myStartPoint.x() == myEndPoint.x() && myStartPoint.y() == myEndPoint.y() )
+ insertPointToSelectedSegment( myEndPoint.x(), myStartPoint.y() );
}
// updates the input panel table to show the selected point coordinates
updateLocalPointView();
updateUndoRedo();
-
- emit curveModified();
}
/**
double aX = myLocalPointView->item( theRow, 2 )->data( Qt::UserRole ).toDouble();
double anY = myLocalPointView->item( theRow, 3 )->data( Qt::UserRole ).toDouble();
- std::deque<float> aChangedPos;
+ CurveCreator::Coordinates aChangedPos;
aChangedPos.push_back( aX );
aChangedPos.push_back( anY );
myCurve->setPoint( aCurrSect, aPntIndex, aChangedPos );
finishCurveModification( aSelPoints );
-
- emit curveModified();
}
/**
}
mySectionView->clearSelection();
updateUndoRedo();
-
- emit curveModified();
}
/**
myCurve->removeSeveralPoints( aPoints );
finishCurveModification( CurveCreator_ICurve::SectionToPointList() );
mySectionView->reset();
-
- emit curveModified();
}
void CurveCreator_Widget::addNewPoint(const CurveCreator::Coordinates& theCoords)
mySectionView->pointsAdded( aSection, myCurve->getNbPoints( aSection ) );
updateActionsStates();
updateUndoRedo();
-
- emit curveModified();
}
void CurveCreator_Widget::insertPointToSelectedSegment( const int theX,
finishCurveModification( aSelPoints );
setSelectedPoints();
-
- emit curveModified();
}
void CurveCreator_Widget::moveSelectedPoints( const int theXPosition,
double anYDelta = aStartPnt.Y() - anEndPnt.Y();
CurveCreator_ICurve::SectionToPointCoordsList aCoordList;
- std::deque<float> aChangedPos;
+ CurveCreator::Coordinates aChangedPos;
CurveCreator_ICurve::SectionToPointList::const_iterator anIt = myDragPoints.begin(),
aLast = myDragPoints.end();
for ( ; anIt != aLast; anIt++ ) {
myDragged = true;
finishCurveModification( myDragPoints );
-
- emit curveModified();
}
void CurveCreator_Widget::updateLocalPointView()
* \param theX the X coordinate of the point
* \param theY the Y coordinate of the point
*/
-int CurveCreator_Widget::findLocalPointIndex( int theSectionId, float theX, float theY )
+int CurveCreator_Widget::findLocalPointIndex( int theSectionId, double theX, double theY )
{
return CurveCreator_UtilsICurve::findLocalPointIndex( myCurve, theSectionId, theX, theY );
}
-// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
+// 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
void selectionChanged();
void subOperationStarted( QWidget*, bool );
void subOperationFinished( QWidget* );
- void curveModified();
public slots:
CurveCreator_ICurve::SectionToPointList() );
// curve algorithm
- int findLocalPointIndex( int theSectionId, float theX, float theY );
+ int findLocalPointIndex( int theSectionId, double theX, double theY );
void findSectionsToPoints( const double theX, const double theY,
CurveCreator_ICurve::SectionToPointList& thePoints );
void convert( const CurveCreator_ICurve::SectionToPointList& thePoints,
bool contains( const CurveCreator_ICurve::SectionToPointList& theList,
const CurveCreator_ICurve::SectionToPoint& theValue ) const;
+protected:
+ // Boundary points of mouse to select the points
+ QPoint myStartPoint;
+ QPoint myEndPoint;
+
private:
QMap<ActionId, QAction*> myActionMap;
CurveCreator_ICurve* myCurve;
QMap<CurveCreator_ICurve::SectionToPoint, CurveCreator::Coordinates> myInitialDragPointsCoords;
bool myDragged;
QByteArray myGuiState;
- int myPressedX;
- int myPressedY;
OCCViewer_ViewWindow::Mode2dType myOld2DMode;
};
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
updateModel( true, false );
}
+//=================================================================================
+// function : resizeEvent()
+// purpose : reimplemented from QGraphicsView::resizeEvent()
+//=================================================================================
+void DependencyTree_View::resizeEvent(QResizeEvent *event)
+{
+ QPointF aCenter = mapToScene( event->oldSize().width()/2,
+ event->oldSize().height()/2 );
+ QGraphicsView::resizeEvent( event );
+ centerOn( aCenter.x(),aCenter.y() );
+}
+
//=================================================================================
// function : onUpdateModel()
// purpose : slot for updating tree model for main objects in viewer
GEOMUtils::LevelInfo::const_iterator node;
for( node = Levelup.begin(); node != Levelup.end(); node++ ) {
DependencyTree_Object* object = myTreeMap[ node->first ];
- addArrow( Main_object, object );
+ addArrow( object, Main_object );
}
}
parseTreeWardArrow( i->second.first );
for( int link = 0; link < Links.size(); link++ ) {
DependencyTree_Object* LinkObject = myTreeMap[ Links[ link ] ];
if( object && LinkObject )
- addArrow( object, LinkObject );
+ addArrow( LinkObject, object );
}
}
}
for( node = Levelup.begin(); node != Levelup.end(); node++ ) {
DependencyTree_Object* object = myTreeMap[ node->first ];
DependencyTree_Arrow* arrow =
- myArrows[ std::pair<DependencyTree_Object*,DependencyTree_Object*>( Main_object, object )];
+ myArrows[ std::pair<DependencyTree_Object*,DependencyTree_Object*>( object, Main_object )];
if( arrow && !isItemAdded( arrow ) )
addItem( arrow );
}
for( int link = 0; link < Links.size(); link++ ) {
DependencyTree_Object* LinkObject = myTreeMap[ Links[ link ] ];
if( isItemAdded( object ) && isItemAdded( LinkObject ) ) {
- DependencyTree_Arrow* arrow = myArrows[ std::pair<DependencyTree_Object*,DependencyTree_Object*>( object, LinkObject ) ];
+ DependencyTree_Arrow* arrow = myArrows[ std::pair<DependencyTree_Object*,DependencyTree_Object*>( LinkObject, object ) ];
if( arrow && !isItemAdded( arrow ) )
addItem( arrow );
}
return;
drawTree();
- fitAll();
+ fitWindow();
}
//=================================================================================
}
}
+//=================================================================================
+// function : fitWindow()
+// purpose : scale the window considering a size of scene
+//=================================================================================
+void DependencyTree_View::fitWindow()
+{
+ int sizeFactor = 4;
+ if( objectsBoundingRect(true).width() > sizeFactor*size().width() ||
+ objectsBoundingRect(true).height() > sizeFactor*size().width() ) {
+ QRectF aRect = QRectF( -sizeFactor*size().width()/2, -sizeFactor*size().height()/2,
+ sizeFactor*size().width(), sizeFactor*size().height() );
+ fitInView( aRect, Qt::KeepAspectRatio );
+ }
+ else
+ fitAll();
+}
+
//=================================================================================
// function : getNewTreeModel()
// purpose : get dependency tree model from engine
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
void onRebuildModel();
+protected:
+
+ void resizeEvent( QResizeEvent *event );
+
private slots:
void onUpdateModel();
void updateView();
void clearView( bool );
+ void fitWindow();
+
int checkMaxLevelsNumber();
void getNewTreeModel( bool = true, bool = true );
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
<!DOCTYPE TS>
<TS version="2.0" language="fr_FR">
<context>
- <name>DependencyTree_View</name>
+ <name>DependencyTree_View</name>
<message>
- <source>DEPENDENCY_TREE</source>
- <translation type="unfinished">Dependency Tree</translation>
+ <source>DEPENDENCY_TREE</source>
+ <translation>Arbre des dépendances</translation>
</message>
<message>
- <source>MOVE_NODES</source>
- <translation type="unfinished">Move nodes</translation>
+ <source>MOVE_NODES</source>
+ <translation>Déplacer les noeuds</translation>
</message>
<message>
- <source>HIERARCHY_DEPTH</source>
- <translation type="unfinished">Hierarchy depth </translation>
+ <source>HIERARCHY_DEPTH</source>
+ <translation>Niveau hiérarchique</translation>
</message>
<message>
- <source>DISPLAY_ASCENDANTS</source>
- <translation type="unfinished">Display ascendants</translation>
+ <source>DISPLAY_ASCENDANTS</source>
+ <translation>Montrer les liens ascendants</translation>
</message>
<message>
- <source>DISPLAY_DESCENDANTS</source>
- <translation type="unfinished">Display descendants</translation>
+ <source>DISPLAY_DESCENDANTS</source>
+ <translation>Montrer les liens descendants</translation>
</message>
<message>
- <source>SHOW_ALL</source>
- <translation type="unfinished">Show all</translation>
+ <source>SHOW_ALL</source>
+ <translation>Montrer tout</translation>
</message>
<message>
- <source>UPDATE</source>
- <translation type="unfinished">Update</translation>
+ <source>UPDATE</source>
+ <translation>Mise à jour</translation>
</message>
- <name>DependencyTree_ViewModel</name>
+ <name>DependencyTree_ViewModel</name>
<message>
- <source>MEN_REBUILD_THE_TREE</source>
- <translation type="unfinished">Rebuild the tree</translation>
+ <source>MEN_REBUILD_THE_TREE</source>
+ <translation>Reconstruire l'arbre</translation>
</message>
<message>
- <source>MEN_REDUCE_STUDY</source>
- <translation type="unfinished">Reduce study</translation>
+ <source>MEN_REDUCE_STUDY</source>
+ <translation>Réduire l'étude</translation>
</message>
</context>
</TS>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS>
-<context>
- <name>DependencyTree_View</name>
+<TS version="2.0" language="ja" sourcelanguage="en">
+ <context>
+ <name>DependencyTree_View</name>
<message>
<source>DEPENDENCY_TREE</source>
- <translation type="unfinished">Dependency Tree</translation>
+ <translation>依存関係ツリー</translation>
</message>
<message>
<source>MOVE_NODES</source>
- <translation type="unfinished">Move nodes</translation>
+ <translation>ノードの移動</translation>
</message>
<message>
<source>HIERARCHY_DEPTH</source>
- <translation type="unfinished">Hierarchy depth </translation>
+ <translation>階層の深さ</translation>
</message>
<message>
<source>DISPLAY_ASCENDANTS</source>
- <translation type="unfinished">Display ascendants</translation>
+ <translation>上位の表示</translation>
</message>
<message>
<source>DISPLAY_DESCENDANTS</source>
- <translation type="unfinished">Display descendants</translation>
+ <translation>下位の表示</translation>
</message>
<message>
<source>SHOW_ALL</source>
- <translation type="unfinished">Show all</translation>
+ <translation>すべてを表示</translation>
</message>
<message>
<source>UPDATE</source>
- <translation type="unfinished">Update</translation>
+ <translation>更新</translation>
</message>
- <name>DependencyTree_ViewModel</name>
+ <name>DependencyTree_ViewModel</name>
<message>
<source>MEN_REBUILD_THE_TREE</source>
- <translation type="unfinished">Rebuild the tree</translation>
+ <translation>ツリーの再構築</translation>
</message>
<message>
<source>MEN_REDUCE_STUDY</source>
- <translation type="unfinished">Reduce study</translation>
+ <translation>スタディの削減</translation>
</message>
-</context>
-</TS>
\ No newline at end of file
+ </context>
+</TS>
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
( GetVerticesMode() ? tr("MEN_VERTICES_MODE_ON") : tr( "MEN_VERTICES_MODE_OFF" ) );
getGeometryGUI()->menuMgr()->update();
break;
+ case GEOMOp::OpSwitchName: // MENU VIEW - DISPLAY MODE - SHOW/HIDE NAME
+ SetNameMode(!GetNameMode());
+ getGeometryGUI()->action( GEOMOp::OpSwitchName )->setText
+ ( GetNameMode() ? tr("MEN_NAME_MODE_ON") : tr( "MEN_NAME_MODE_OFF" ) );
+ getGeometryGUI()->menuMgr()->update();
+ break;
case GEOMOp::OpWireframe: // POPUP MENU - DISPLAY MODE - WIREFRAME
ChangeDisplayMode( 0 );
break;
case GEOMOp::OpTexture: // POPUP MENU - DISPLAY MODE - TEXTURE
ChangeDisplayMode( 3 );
break;
- case GEOMOp::OpVectors: // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION
+ case GEOMOp::OpVectors: // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION
ChangeDisplayMode( 4 );
break;
- case GEOMOp::OpVertices: // POPUP MENU - DISPLAY MODE - SHOW VERTICES
+ case GEOMOp::OpVertices: // POPUP MENU - DISPLAY MODE - SHOW VERTICES
ChangeDisplayMode( 5 );
break;
+ case GEOMOp::OpShowName: // POPUP MENU - DISPLAY MODE - SHOW NAME
+ ChangeDisplayMode( 6 );
+ break;
default:
app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break;
_PTR(ChildIterator) anIter ( aStudy->NewChildIterator( SC ) );
anIter->InitEx( true );
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
while( anIter->More() ) {
_PTR(SObject) valSO ( anIter->Value() );
//=====================================================================================
void DisplayGUI::EraseAll()
{
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
SUIT_Application* app = getGeometryGUI()->getApp();
if ( app ) {
aSelMgr->selectedObjects(aList, "ObjectBrowser", false);
SALOME_ListIteratorOfListIO It (aList);
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
for (; It.More(); It.Next()) {
Handle(SALOME_InteractiveObject) anIObject = It.Value();
aSelMgr->selectedObjects( aList );
SALOME_ListIteratorOfListIO It( aList );
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
for( ;It.More();It.Next() ) {
Handle(SALOME_InteractiveObject) anIObject = It.Value();
aSelMgr->selectedObjects( aList );
SALOME_ListIteratorOfListIO It( aList );
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
for( ; It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) anIObject = It.Value();
//=====================================================================================
void DisplayGUI::SetDisplayMode( const int mode, SUIT_ViewWindow* viewWindow )
{
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
SalomeApp_Application* app = getGeometryGUI()->getApp();
if ( !app ) return;
int mgrId = viewWindow->getViewManager()->getGlobalId();
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
+
SALOME_ListIO anIOlst;
- displayer.GetActiveView()->GetVisible( anIOlst );
+ window->GetVisible( anIOlst );
for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
Handle( SALOME_InteractiveObject ) io = It.Value();
//=====================================================================================
void DisplayGUI::SetVectorMode( const bool mode, SUIT_ViewWindow* viewWindow )
{
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
SalomeApp_Application* app = getGeometryGUI()->getApp();
if ( !app ) return;
int aMgrId = viewWindow->getViewManager()->getGlobalId();
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
+
SALOME_ListIO anIOlst;
- displayer.GetActiveView()->GetVisible( anIOlst );
+ window->GetVisible( anIOlst );
for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
Handle( SALOME_InteractiveObject ) io = It.Value();
//=====================================================================================
void DisplayGUI::SetVerticesMode( const bool mode, SUIT_ViewWindow* viewWindow )
{
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
SalomeApp_Application* app = getGeometryGUI()->getApp();
if ( !app ) return;
int aMgrId = viewWindow->getViewManager()->getGlobalId();
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
+
SALOME_ListIO anIOlst;
- displayer.GetActiveView()->GetVisible( anIOlst );
+ window->GetVisible( anIOlst );
for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
Handle( SALOME_InteractiveObject ) io = It.Value();
return viewWindow->property( "VerticesMode" ).toBool();
}
+//=====================================================================================
+// function : DisplayGUI::SetNameMode()
+// purpose : Set name mode for the viewer
+//=====================================================================================
+void DisplayGUI::SetNameMode( const bool mode, SUIT_ViewWindow* viewWindow )
+{
+ SUIT_OverrideCursor();
+
+ SalomeApp_Application* app = getGeometryGUI()->getApp();
+ if ( !app ) return;
+
+ SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+ if ( !aStudy ) return;
+
+ if ( !viewWindow )
+ viewWindow = app->desktop()->activeWindow();
+
+ viewWindow->setProperty( "NameMode", mode );
+
+ GEOM_Displayer displayer( aStudy );
+
+ int aMgrId = viewWindow->getViewManager()->getGlobalId();
+
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
+
+ SALOME_ListIO anIOlst;
+ window->GetVisible( anIOlst );
+
+ for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
+ Handle( SALOME_InteractiveObject ) io = It.Value();
+ aStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::ShowName ), mode );
+ displayer.Redisplay( io, false );
+ }
+ displayer.UpdateViewer();
+ GeometryGUI::Modified();
+}
+
+//=====================================================================================
+// function : DisplayGUI::GetNameMode()
+// purpose : Get the "show name" mode of the viewer
+//=====================================================================================
+int DisplayGUI::GetNameMode( SUIT_ViewWindow* viewWindow )
+{
+ if ( !viewWindow )
+ viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
+ return viewWindow->property( "NameMode" ).toBool();
+}
+
//=====================================================================================
// function : DisplayGUI::ChangeDisplayMode()
// purpose : Set display mode for selected objects in the viewer given
SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
if ( !aStudy ) return;
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
SALOME_ListIO selected;
aSelMgr->selectedObjects( selected );
bool vectorMode = v.isValid() ? !v.toBool() : false;
v = aStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Vertices ), QVariant() );
bool verticesMode = v.isValid() ? !v.toBool() : false;
+ v = aStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::ShowName ), QVariant() );
+ bool nameMode = v.isValid() ? !v.toBool() : false;
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Handle( SALOME_InteractiveObject ) io = It.Value();
else if ( mode == 5 ) {
aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::Vertices ), verticesMode );
}
+ else if ( mode == 6 ) {
+ aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::ShowName ), nameMode );
+ }
displayer.Redisplay( io, false );
}
displayer.UpdateViewer();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Get vertices mode of the viewer
int GetVerticesMode( SUIT_ViewWindow* = 0 );
+ // NAME MODE methods
+ // Set name mode for the viewer
+ void SetNameMode( const bool, SUIT_ViewWindow* = 0 );
+ // Get name mode of the viewer
+ int GetNameMode( SUIT_ViewWindow* = 0 );
+
// Set display mode for selected objects in the viewer given
// (current viewer if <viewWindow> = 0 )
void ChangeDisplayMode( const int, SUIT_ViewWindow* = 0 );
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
${PROJECT_SOURCE_DIR}/src/GEOMImpl
${PROJECT_SOURCE_DIR}/src/GEOMGUI
${PROJECT_SOURCE_DIR}/src/GEOMBase
+ ${PROJECT_SOURCE_DIR}/src/MeasureGUI
${PROJECT_SOURCE_DIR}/src/SKETCHER
${PROJECT_SOURCE_DIR}/src/CurveCreator
${PROJECT_SOURCE_DIR}/src/ShapeRecognition
DlgRef
GEOMSketcher
CurveCreator
+ MeasureGUI
)
# optional sources
EntityGUI_PolylineDlg.h
EntityGUI_3DSketcherDlg.h
EntityGUI_IsolineDlg.h
+ EntityGUI_SurfFromFaceDlg.h
EntityGUI_SubShapeDlg.h
EntityGUI_FeatureDetectorDlg.h
EntityGUI_PictureImportDlg.h
EntityGUI_PolylineDlg.h
EntityGUI_3DSketcherDlg.h
EntityGUI_IsolineDlg.h
+ EntityGUI_SurfFromFaceDlg.h
EntityGUI_SubShapeDlg.h
EntityGUI_PictureImportDlg.h
${FeatureDetectorDlg_moc_h}
EntityGUI_PolylineDlg.cxx
EntityGUI_3DSketcherDlg.cxx
EntityGUI_IsolineDlg.cxx
+ EntityGUI_SurfFromFaceDlg.cxx
EntityGUI_SubShapeDlg.cxx
EntityGUI_PictureImportDlg.cxx
${FeatureDetectorDlg_Sources}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <SUIT_ViewWindow.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
+#include "utilities.h"
#include <TopoDS_Shape.hxx>
#include <TopoDS.hxx>
#include "EntityGUI_SketcherDlg.h" // Sketcher
#include "EntityGUI_3DSketcherDlg.h" // Sketcher
#include "EntityGUI_IsolineDlg.h" // Isoline
+#include "EntityGUI_SurfFromFaceDlg.h" // Surface From Face
#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE
#include "EntityGUI_FeatureDetectorDlg.h" // Feature Detection
#include "EntityGUI_PictureImportDlg.h" // Import Picture in viewer
case GEOMOp::OpIsoline: // ISOLINE
aDlg = new EntityGUI_IsolineDlg( getGeometryGUI(), parent );
break;
+ case GEOMOp::OpSurfaceFromFace: // SURFACE FROM FACE
+ aDlg = new EntityGUI_SurfFromFaceDlg( getGeometryGUI(), parent );
+ break;
case GEOMOp::OpExplode: // EXPLODE
aDlg = new EntityGUI_SubShapeDlg( getGeometryGUI(), parent );
break;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <AIS_Trihedron.hxx>
#include <AIS_AngleDimension.hxx>
#include <AIS_LengthDimension.hxx>
-#include <AIS_Drawer.hxx>
#include <Geom_Axis2Placement.hxx>
#include <Geom_Plane.hxx>
#include <SelectMgr_Selection.hxx>
myLengthPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
myTextPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
/* Get setting of step value from file configuration */
double step = SUIT_Session::session()->resourceMgr()->doubleValue("Geometry", "SettingsGeomStep", 100.0);
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// SALOME includes
#include "EntityGUI_FeatureDetectorDlg.h"
-#include <ShapeRec_FeatureDetector.hxx>
+#include "ShapeRec_FeatureDetector.hxx"
+#include "GEOM_Constants.h"
#include <OCCViewer_ViewWindow.h>
#include <OCCViewer_ViewManager.h>
// TODO supprimer les lignes qui ne servent à rien le cas échéant
SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow();
- std::map< std::string , std::vector<Handle(AIS_InteractiveObject)> >::iterator AISit;
SOCC_Viewer* soccViewer = (SOCC_Viewer*)(theViewWindow->getViewManager()->getViewModel());
if (!myEditCurrentArgument->isEnabled())
if ( myEditCurrentArgument == mySelectionGroup->LineEdit1 ) {
myFace = aSelectedObject;
- AISit = soccViewer->entry2aisobjects.find(myFaceEntry.toStdString());
- if (AISit == soccViewer->entry2aisobjects.end())
+
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+ if ( !study ) return;
+ LightApp_Application* app = ::qobject_cast<LightApp_Application*>( study->application() );
+ if ( !app ) return;
+ SUIT_ViewManager* vm = app->activeViewManager();
+ if ( !vm ) return;
+ PropMap propMap = study->getObjectProperties( vm->getGlobalId(), myFaceEntry );
+ QString theImgFileName = propMap.value( GEOM::propertyName( GEOM::Texture ) ).toString();
+ if ( theImgFileName.isEmpty() )
return;
-
- Handle(AIS_InteractiveObject) myAIS = (*AISit).second[0];
- Handle(GEOM_AISShape) myAISShape;
- if( myAIS->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) {
- myAISShape = Handle(GEOM_AISShape)::DownCast( myAIS );
- }
- else
- return ;
-
- std::string theImgFileName = myAISShape->TextureFile();
- if ( theImgFileName == "" )
- return ;
// Setting the image caracteristics
- myDetector->SetPath( theImgFileName );
+ myDetector->SetPath( theImgFileName.toStdString() );
height = myDetector->GetImgHeight();
width = myDetector->GetImgWidth();
pictureLeft = -0.5 * width; // X coordinate of the top left corner of the background image in the view
return res;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> EntityGUI_FeatureDetectorDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myFace;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
return true;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> EntityGUI_FieldDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myField->GetShape());
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid (QString&);
virtual bool execute ();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private slots:
void ClickOnOk();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
{
displayPreview(true);
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> EntityGUI_IsolineDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myFace;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
+
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <SUIT_Session.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
+#include "utilities.h"
#include <TopoDS_Shape.hxx>
#include <TopoDS.hxx>
delete pixmap;
GEOM::GEOM_Object_var P1 = aBasicOperations->MakePointXYZ( -0.5*width, -0.5*height, 0 );
- GEOM::GEOM_Object_var P2 = aBasicOperations->MakePointXYZ( -0.5*width, 0.5*height, 0 );
+ GEOM::GEOM_Object_var P2 = aBasicOperations->MakePointXYZ( 0.5*width, -0.5*height, 0 );
GEOM::GEOM_Object_var P3 = aBasicOperations->MakePointXYZ( 0.5*width, 0.5*height, 0 );
- GEOM::GEOM_Object_var P4 = aBasicOperations->MakePointXYZ( 0.5*width, -0.5*height, 0 );
+ GEOM::GEOM_Object_var P4 = aBasicOperations->MakePointXYZ( -0.5*width, 0.5*height, 0 );
GEOM::GEOM_Object_var aFace = aBlocksOperations->MakeQuad4Vertices(P1,P2,P3,P4);
getDisplayer()->SetDisplayMode(3);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// 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.
+// 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
#include "EntityGUI_PolylineDlg.h"
#include <CurveCreator_Curve.hxx>
+#include <CurveCreator_Displayer.hxx>
#include <CurveCreator_Utils.hxx>
#include <CurveCreator_Widget.h>
#include <DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
+#include "utilities.h"
+
#include <OCCViewer_ViewManager.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Application.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
+#include "utilities.h"
#include <BRep_Tool.hxx>
#include <Geom_Surface.hxx>
#include <GeomLib_IsPlanarSurface.hxx>
+#include <Prs3d_LineAspect.hxx>
#include <TopoDS.hxx>
#include <QGroupBox>
myWPlaneLineEdit (0),
myPolylineSelButton (0),
myPolylineEdit (0),
- myEditCurrentArgument (0)
+ myEditCurrentArgument (0),
+ myPreviewManager(0),
+ myPreviewZLayer(-1)
{
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_CC_POLYLINE")));
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
- QGroupBox *aGroupBox1 = new QGroupBox(tr("GEOM_CS"), this);
+ QGroupBox *aGroupBox1 = new QGroupBox(this);
QGridLayout *aPlaneLayout = new QGridLayout(aGroupBox1);
aPlaneLayout->setSpacing(6);
myPlnButton->setText( tr( "GEOM_SKETCHER_RESTORE" ) );
aPlaneLayout->addWidget(myPlnButton, 0, 3);
+ bool isCS = false;
+#ifdef SET_PLANE
+ isCS = true;
+#endif
+ myPlnComboBox->setVisible( isCS );
+ myPlnButton->setVisible( isCS );
+
#ifdef SET_PLANE
QLabel *aPlaneLbl = new QLabel(tr("GEOM_PLANE"), aGroupBox1);
myPolylineSelButton = new QPushButton (aGroupBox1);
myPolylineSelButton->setIcon(image1);
+ myPolylineSelButton->setCheckable(true);
myPolylineEdit = new QLineEdit (aGroupBox1);
myPolylineEdit->setReadOnly(true);
setHelpFileName( "create_polyline_page.html" );
- /* Initialisations */
+ /* Initializations */
Init();
}
//=================================================================================
EntityGUI_PolylineDlg::~EntityGUI_PolylineDlg()
{
- delete myCurve;
+ erasePreview();
+ myEditorWidget->SetViewer2DMode(false);
}
//=================================================================================
LightApp_SelectionMgr *aSelMgr = myGeomGUI->getApp()->selectionMgr();
myEditorWidget->setOCCViewer(aViewManager ? aViewManager->getOCCViewer() : 0);
+ setPreviewManager( aViewManager );
// Init the list of local coordinate system
gp_Pnt aPnt(0., 0., 0.);
myWPlaneList.push_back(GEOM::GeomObjPtr());
myLCSList.push_back(aLCS);
- connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
- connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
-
#ifdef SET_PLANE
- connect(myPlnSelButton, SIGNAL(clicked()),
- this, SLOT(SetEditCurrentArgument()));
+ connect( myPlnSelButton, SIGNAL(toggled(bool)),
+ this, SLOT(SetEditCurrentArgument(bool)) );
#endif
- connect(myPolylineSelButton, SIGNAL(clicked()),
- this, SLOT(SetEditCurrentArgument()));
- connect(aSelMgr, SIGNAL(currentSelectionChanged()),
- this, SLOT(SelectionIntoArgument()));
- connect(myEditorWidget, SIGNAL(subOperationStarted(QWidget*, bool)),
- this, SLOT(processStartedSubOperation(QWidget*, bool)));
- connect(myEditorWidget, SIGNAL(subOperationFinished(QWidget*)),
- this, SLOT(processFinishedSubOperation(QWidget*)));
- connect(myEditorWidget, SIGNAL(curveModified()),
- this, SLOT(onUpdatePreview()));
+ connect( myPolylineSelButton, SIGNAL(toggled(bool)),
+ this, SLOT(SetEditCurrentArgument(bool)) );
+ connect( aSelMgr, SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()) );
+ connect( myEditorWidget, SIGNAL(subOperationStarted(QWidget*, bool)),
+ this, SLOT(processStartedSubOperation(QWidget*, bool)) );
+ connect( myEditorWidget, SIGNAL(subOperationFinished(QWidget*)),
+ this, SLOT(processFinishedSubOperation(QWidget*)) );
#ifdef SET_PLANE
- connect(myPlnComboBox, SIGNAL(activated(int)),
- this, SLOT(ActivateLocalCS()));
- connect(myPlnButton, SIGNAL(clicked()),
- this, SLOT(ActivateLocalCS()));
+ connect( myPlnComboBox, SIGNAL(activated(int)),
+ this, SLOT(ActivateLocalCS()) );
+ connect( myPlnButton, SIGNAL(clicked()),
+ this, SLOT(ActivateLocalCS()) );
#endif
- connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
- connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect( buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()) );
+ connect( buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()) );
myAddElementBox->hide();
- myPolylineSelButton->click();
- SelectionIntoArgument();
+
+ // Processing of the selected object
+ myPolylineSelButton->setChecked( true );
+ SelectionIntoArgument( true );
}
//=================================================================================
initName();
- return true;
-}
+ // Reset actions
+ myEditorWidget->reset();
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void EntityGUI_PolylineDlg::ClickOnCancel()
-{
- myEditorWidget->SetViewer2DMode(false);
- GEOMBase_Skeleton::ClickOnCancel();
+ return true;
}
//=================================================================================
// function : SelectionIntoArgument
// purpose : Called when selection is changed
//=================================================================================
-void EntityGUI_PolylineDlg::SelectionIntoArgument()
+void EntityGUI_PolylineDlg::SelectionIntoArgument( bool isForced )
{
- bool isModified = false;
+ bool isModified = isForced;
GEOM::GeomObjPtr aSelectedObject = getSelected(TopAbs_SHAPE);
TopoDS_Shape aShape;
if (aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) &&
- !aShape.IsNull()) {
+ !aShape.IsNull())
+ {
QString aName = GEOMBase::GetName(aSelectedObject.get());
- if (myEditCurrentArgument == myPolylineEdit) {
+ if ( myEditCurrentArgument == myPolylineEdit && isCheckToSelect() )
+ {
// Import a curve
CurveCreator_Curve *aNewCurve =
new CurveCreator_Curve(CurveCreator::Dim2d);
#ifdef SET_PLANE
AddLocalCS(aSelectedObject.get(), false, aLocalCS);
myWPlaneLineEdit->clear();
- myPlnSelButton->setDown(false);
+ myPlnSelButton->setChecked(false);
#endif
- myPolylineSelButton->setDown(true);
+ myPolylineSelButton->setChecked(false);
+
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ myGeomGUI->getApp()->selectionMgr()->clearSelected();
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
} else {
// Does nothing, just clears selection.
delete aNewCurve;
}
+ }
#ifdef SET_PLANE
- } else if (myEditCurrentArgument == myWPlaneLineEdit) {
+ else if ( myEditCurrentArgument == myWPlaneLineEdit && isCheckToSelect() )
+ {
// Import planar face.
if (aShape.ShapeType() == TopAbs_FACE) {
// Check if the face is planar
AddLocalCS(aSelectedObject.get(), true,
WPlaneToLCS(aSelectedObject.get()));
isModified = true;
- myPlnSelButton->setDown(true);
- myPolylineSelButton->setDown(false);
+ myPlnSelButton->setChecked(false);
+ myPolylineSelButton->setChecked(false);
}
}
if (!isModified) {
myEditCurrentArgument->setText(tr("GEOM_SKETCHER_WPLANE"));
}
+ }
+#endif
+ }
+ else
+ {
+ if (isForced)
+ {
+#ifdef SET_PLANE
+ myPlnSelButton->setChecked(false);
#endif
+ myPolylineSelButton->setChecked(false);
}
}
- if (!isModified) {
+ if (!isModified)
+ {
// Does nothing, just clears selection.
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
myGeomGUI->getApp()->selectionMgr()->clearSelected();
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
}
+ else
+ displayPreview();
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
-void EntityGUI_PolylineDlg::SetEditCurrentArgument()
+void EntityGUI_PolylineDlg::SetEditCurrentArgument( bool isChecked )
{
- if (sender() == myPlnSelButton) {
+ if (sender() == myPlnSelButton)
+ {
#ifdef SET_PLANE
myEditCurrentArgument = myWPlaneLineEdit;
myEditCurrentArgument->setFocus();
- myPlnSelButton->setDown(true);
- myPolylineSelButton->setDown(false);
+ myPolylineSelButton->blockSignals(true);
+ myPolylineSelButton->setChecked(false);
+ myPolylineSelButton->blockSignals(false);
#endif
- } else if (sender() == myPolylineSelButton) {
+ }
+ else if (sender() == myPolylineSelButton)
+ {
myEditCurrentArgument = myPolylineEdit;
myEditCurrentArgument->setFocus();
#ifdef SET_PLANE
- myPlnSelButton->setDown(false);
+ myPlnSelButton->blockSignals(true);
+ myPlnSelButton->setChecked(false);
+ myPlnSelButton->blockSignals(false);
#endif
- myPolylineSelButton->setDown(true);
}
}
ActivateThisDialog();
}
-//=================================================================================
-// function : onUpdatePreview
-// purpose :
-//=================================================================================
-void EntityGUI_PolylineDlg::onUpdatePreview()
-{
- displayPreview(true);
-}
-
//=================================================================================
// function : ActivateLocalCS
// purpose : Activate & Fit Working plane
return aLCS;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> EntityGUI_PolylineDlg::getSourceObjects()
+{
+ return myWPlaneList;
+}
+
+//=================================================================================
+// function : setPreviewManager ( OCCViewer_ViewManager )
+// purpose : Sets view manager to control the displayed objects.
+//=================================================================================
+void EntityGUI_PolylineDlg::setPreviewManager( OCCViewer_ViewManager* theManager )
+{
+ myPreviewManager = theManager;
+
+ if ( getPreviewManager() )
+ {
+ if( OCCViewer_Viewer* aViewer = getPreviewManager()->getOCCViewer() )
+ {
+ Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
+ if( !aCtx.IsNull() )
+ {
+ // Add Z layer to show temporary objects
+ int aZLayer = -1;
+ aViewer->getViewer3d()->AddZLayer( aZLayer );
+ setPreviewZLayer( aZLayer );
+ }
+ }
+ }
+}
+
+//=================================================================================
+// function : getPreviewManager()
+// purpose :
+//=================================================================================
+OCCViewer_ViewManager* EntityGUI_PolylineDlg::getPreviewManager()
+{
+ return myPreviewManager;
+}
+
+//=================================================================================
+// function : setPreviewZLayer( theZLayer )
+// purpose : Sets Z layer to show temporary objects.
+//=================================================================================
+void EntityGUI_PolylineDlg::setPreviewZLayer( int theZLayer )
+{
+ if ( theZLayer != myPreviewZLayer )
+ myPreviewZLayer = theZLayer;
+}
+
+//=================================================================================
+// function : getPreviewZLayer()
+// purpose :
+//=================================================================================
+int EntityGUI_PolylineDlg::getPreviewZLayer() const
+{
+ return myPreviewZLayer;
+}
+
+//=================================================================================
+// function : displayPreview()
+// purpose :
+//=================================================================================
+void EntityGUI_PolylineDlg::displayPreview()
+{
+ if ( getPreviewManager() )
+ {
+ if ( OCCViewer_Viewer* aViewer = getPreviewManager()->getOCCViewer() )
+ {
+ // Disable changing of OCCViewer's selection to use vertex of curve selection
+ disconnect(getPreviewManager(), SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)),
+ aViewer, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
+
+ Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
+ if ( !aCtx.IsNull() )
+ {
+ CurveCreator_Displayer* aDisplayer = new CurveCreator_Displayer( aCtx, getPreviewZLayer() );
+ myCurve->setDisplayer( aDisplayer );
+
+ Handle(AIS_InteractiveObject) anAISObj = myCurve->getAISObject( true );
+ aDisplayer->display( anAISObj, true );
+
+ // Set color for temporary AIS_InteractiveObject
+ anAISObj->Attributes()->WireAspect()->SetColor( Quantity_NOC_VIOLET );
+ aCtx->Redisplay( anAISObj );
+ }
+ }
+ }
+}
+
+//=================================================================================
+// function : erasePreview()
+// purpose :
+//=================================================================================
+void EntityGUI_PolylineDlg::erasePreview()
+{
+ CurveCreator_Displayer* aDisplayer = myCurve ? myCurve->getDisplayer() : 0;
+ if( getPreviewManager() )
+ {
+ if( OCCViewer_Viewer* aViewer = getPreviewManager()->getOCCViewer() )
+ {
+ Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
+ if( !aCtx.IsNull() && aDisplayer )
+ aDisplayer->eraseAll( true );
+
+ // Enable changing of OCCViewer's selection
+ connect(getPreviewManager(), SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)),
+ aViewer, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
+ }
+ }
+
+ setPreviewManager( NULL );
+ if ( myCurve )
+ {
+ delete myCurve;
+ myCurve = NULL;
+ }
+}
+
+//=================================================================================
+// function : isCheckToSelect()
+// purpose :
+//=================================================================================
+bool EntityGUI_PolylineDlg::isCheckToSelect()
+{
+#ifdef SET_PLANE
+ return myPlnSelButton->isChecked();
+#endif
+ return myPolylineSelButton->isChecked();
+}
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// 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.
+// 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
#ifndef ENTITYGUI_POLYLINEDLG_H
#define ENTITYGUI_POLYLINEDLG_H
-
#include <GEOMBase_Skeleton.h>
class CurveCreator_Curve;
class CurveCreator_Widget;
+class OCCViewer_ViewManager;
class QGroupBox;
class QComboBox;
-
//=================================================================================
// class : EntityGUI_PolylineDlg
// purpose :
void deleteSelected();
bool deleteEnabled();
+ void setPreviewZLayer( int theLayer );
+ int getPreviewZLayer() const;
+
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
-
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
+
+ /**
+ * This method sets/gets the view manager to control the temporary
+ * displayed objects on Z layer.
+ * \param theManager the view manager.
+ */
+ void setPreviewManager( OCCViewer_ViewManager* theManager );
+ OCCViewer_ViewManager* getPreviewManager();
+
+ /**
+ * This method defines a state of selection button.
+ * \return true if selection button is checked, otherwise false.
+ */
+ bool isCheckToSelect();
+
private:
void Init();
* This method add a local coordinate system of the selected object.
*
* \param theSelectedObject the selected object. It can be a planar face
- * or an inported polyline.
+ * or an imported polyline.
* \param IsPlane true for planar face; false for imported polyline.
* \param theLCS the local coordinate system.
*/
*/
gp_Ax3 WPlaneToLCS(GEOM::GeomObjPtr theGeomObj);
+ /**
+ * This method displays the AIS_InteractiveObject(s) to preview
+ * on the Z layer and sets VIOLET color.
+ */
+ void displayPreview();
+
+ /**
+ * This method erases AIS_InteractiveObject(s) from
+ * AIS_InteractiveContext and release memory.
+ */
+ void erasePreview();
+
protected slots:
void ClickOnOk();
bool ClickOnApply();
- void ClickOnCancel();
void processStartedSubOperation( QWidget*, bool );
void processFinishedSubOperation( QWidget* );
- void SetEditCurrentArgument();
- void SelectionIntoArgument();
+ void SetEditCurrentArgument( bool );
+ void SelectionIntoArgument( bool isForced = false );
void ActivateThisDialog();
- void onUpdatePreview();
void ActivateLocalCS();
private:
QLineEdit *myEditCurrentArgument; /* Current LineEdit */
QList<gp_Ax3> myLCSList;
QList<GEOM::GeomObjPtr> myWPlaneList;
+ OCCViewer_ViewManager* myPreviewManager;
+ int myPreviewZLayer;
};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <SalomeApp_Application.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
+#include "utilities.h"
#include <DlgRef.h>
#include <SalomeApp_Study.h>
#include <SalomeApp_Tools.h>
+#include "utilities.h"
#include <gp_Pln.hxx>
Group4Spin->hide();
GroupRect->hide();
globalSelection(); // close local selection to clear it
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
}
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
GroupRect->show();
-
+
myX1=0;
- myX2=10;
- myY1=0;
- myY2=10;
-
GroupRect->SpinBox_DX1->setValue(myX1);
+ myY1=0;
GroupRect->SpinBox_DY1->setValue(myY1);
+ myX2=10;
GroupRect->SpinBox_DX2->setValue(myX2);
+ myY2=10;
GroupRect->SpinBox_DY2->setValue(myY2);
resize( minimumSizeHint() );
selButton->setDown(true);
}
globalSelection(); // close local selection to clear it
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection( myNeedType );
}
+ ":TT " + QString::number( myX2, Format, DigNum) + " " + QString::number( myY1, Format, DigNum)
+ ":WW";
- theParameters = myX1Str + ":" + myY1Str + ":" + myX2Str + ":" + myY2Str ;
+ theParameters = myX1Str + ":" + myY1Str + ":" + myX1Str + ":" + myY2Str + ":" + myX2Str + ":" + myY2Str + ":" + myX2Str + ":" + myY1Str;
}
return myNewCommand;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
+#include <GEOMUtils.hxx>
+#ifndef DISABLE_PLOT2DVIEWER
+ #include <MeasureGUI_ShapeStatisticsDlg.h>
+#endif
#include <OCCViewer_ViewModel.h>
#include <SVTK_ViewModel.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SALOME_ListIO.hxx>
+#include <SUIT_MessageBox.h>
#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
#include <TColStd_IndexedMapOfInteger.hxx>
-#include <QMessageBox>
-
#include <GEOMImpl_Types.hxx>
+namespace
+{
+ const char* const ShapeTypes [] = {
+ "Compound",
+ "Compsolid",
+ "Solid",
+ "Shell",
+ "Face",
+ "Wire",
+ "Edge",
+ "Vertex",
+ "Shape",
+ "Flat"
+ };
+
+ enum { Filter_LT, Filter_LE, Filter_GT, Filter_GE };
+
+ unsigned int NumberOfSubShapes(const TopoDS_Shape& S, const int shapeType, TopTools_MapOfShape& M)
+ {
+ unsigned int index = 0;
+
+ if (!S.IsNull()) {
+ if (S.ShapeType() == TopAbs_COMPOUND &&
+ (shapeType == TopAbs_SHAPE || shapeType == TopAbs_FLAT || shapeType == TopAbs_COMPOUND)) {
+ TopoDS_Iterator It(S, Standard_True, Standard_True);
+ for (; It.More(); It.Next()) {
+ TopoDS_Shape SS = It.Value();
+ if (M.Add(SS)) {
+ if (shapeType == TopAbs_FLAT) {
+ if (SS.ShapeType() != TopAbs_COMPOUND)
+ index++;
+ else
+ index += NumberOfSubShapes(SS, shapeType, M);
+ }
+ else if (shapeType == TopAbs_SHAPE || shapeType == SS.ShapeType()) {
+ index++;
+ }
+ }
+ }
+ }
+ else {
+ TopExp_Explorer Exp (S, TopAbs_ShapeEnum(shapeType));
+ for (; Exp.More(); Exp.Next()) {
+ if (M.Add(Exp.Current())) {
+ index++;
+ }
+ }
+ }
+ }
+ return index;
+ }
+ unsigned int NumberOfSubShapes(const TopoDS_Shape& S, const int shapeType)
+ {
+ TopTools_MapOfShape M;
+ return NumberOfSubShapes(S, shapeType, M);
+ }
+}
+
//=================================================================================
// class : EntityGUI_SubShapeDlg
// purpose : Constructs a EntityGUI_SubShapeDlg which is a child of 'parent', with the
bool modal, Qt::WindowFlags fl)
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
myDmMode( -1 ),
- myWithShape(true),
myIsHiddenMain(false)
{
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SUBSHAPE")));
GroupPoints->PushButton4->setText(tr("SHOW_ALL_SUB_SHAPES"));
GroupPoints->LineEdit1->setReadOnly(true);
+ //filter group
+
+ myFilterGrp = new QGroupBox(tr("GEOM_FILTER"), centralWidget());
+ myLessFilterCheck = new QCheckBox(myFilterGrp);
+ myLessFilterCombo = new QComboBox(myFilterGrp);
+ myLessFilterCombo->addItem( tr("GEOM_LESS_THAN"), Filter_LT );
+ myLessFilterCombo->addItem( tr("GEOM_LESSOREQUAL_THAN"), Filter_LE );
+ myGreaterFilterCheck = new QCheckBox(myFilterGrp);
+ myGreaterFilterCombo = new QComboBox(myFilterGrp);
+ myGreaterFilterCombo->addItem( tr("GEOM_GREAT_THAN"), Filter_GT );
+ myGreaterFilterCombo->addItem( tr("GEOM_GREATOREQUAL_THAN"), Filter_GE );
+ myLessFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp);
+ myGreaterFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp);
+ myApplyFilterButton = new QPushButton(tr("GEOM_BUT_APPLY"), myFilterGrp);
+#ifndef DISABLE_PLOT2DVIEWER
+ myPlotDistributionButton = new QPushButton(tr("GEOM_PLOT_DISTRIBUTION"), myFilterGrp);
+#endif
+
+ QGridLayout* filterLayout = new QGridLayout(myFilterGrp);
+ filterLayout->addWidget(myLessFilterCheck, 0, 0);
+ filterLayout->addWidget(myLessFilterCombo, 0, 1);
+ filterLayout->addWidget(myLessFilterSpin, 0, 2);
+ filterLayout->addWidget(myGreaterFilterCheck, 1, 0);
+ filterLayout->addWidget(myGreaterFilterCombo, 1, 1);
+ filterLayout->addWidget(myGreaterFilterSpin, 1, 2);
+ filterLayout->addWidget(myApplyFilterButton, 0, 3);
+#ifndef DISABLE_PLOT2DVIEWER
+ filterLayout->addWidget(myPlotDistributionButton, 1, 3);
+#endif
+
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupPoints);
+ layout->addWidget(myFilterGrp);
/***************************************************************/
setIsOptimizedBrowsing(true);
//=================================================================================
void EntityGUI_SubShapeDlg::Init()
{
+ // Get setting of step value from file configuration
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
+
+ // min, max, step and decimals for spin boxes
+ initSpinBox(myLessFilterSpin, 0., COORD_MAX, step, "length_precision" );
+ initSpinBox(myGreaterFilterSpin, 0., COORD_MAX, step, "length_precision" );
+ myLessFilterSpin->setValue( 0. );
+ myGreaterFilterSpin->setValue( 0. );
+
/* init variables */
myDmMode = -1;
myEditCurrentArgument = GroupPoints->LineEdit1;
myObject = GEOM::GEOM_Object::_nil();
- myWithShape = true;
-
/* type for sub-shape selection */
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Compound");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Compsolid");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Solid");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Shell");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Face");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Wire");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Edge");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Vertex");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Shape");
+ for ( int i = 0; i <= (int)GEOM::FLAT; i++ )
+ GroupPoints->ComboBox1->addItem(ShapeTypes[i], i);
if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
!= OCCViewer_Viewer::Type())
connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
+ connect(myApplyFilterButton, SIGNAL(clicked()), this, SLOT(ClickOnOkFilter()));
+#ifndef DISABLE_PLOT2DVIEWER
+ connect(myPlotDistributionButton, SIGNAL(clicked()), this, SLOT(ClickOnPlot()));
+#endif
+ connect(myLessFilterCheck, SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled()));
+ connect(myGreaterFilterCheck, SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled()));
+
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
updateButtonState();
resize(100,100);
SelectionIntoArgument();
+ SubShapeToggled();
+ MeasureToggled();
}
//=================================================================================
/* More than 30 sub-shapes : ask confirmation */
unsigned int nb = NumberOfSubShapes(myShape, shapeType());
if (nb > 30) {
- const QString caption = tr("GEOM_CONFIRM");
- const QString text = tr("GEOM_CONFIRM_INFO").arg(nb);
- const QString button0 = tr("GEOM_BUT_EXPLODE");
- const QString button1 = tr("GEOM_BUT_CANCEL");
-
- if (QMessageBox::warning(this, caption, text, button0, button1) != 0)
+ if (SUIT_MessageBox::question( this,
+ tr("GEOM_CONFIRM"),
+ tr("GEOM_CONFIRM_INFO").arg(nb),
+ tr("GEOM_BUT_EXPLODE"),
+ tr("GEOM_BUT_CANCEL") ) != 0 )
isOk = false; /* aborted */
}
}
if (isOk)
- isOk = onAccept();
+ isOk = onAccept( true, true, false );
if (isOk)
ClickOnCancel();
/* More than 30 sub-shapes : ask confirmation */
unsigned int nb = NumberOfSubShapes(myShape, shapeType());
if (nb > 30) {
- const QString caption = tr("GEOM_CONFIRM");
- const QString text = tr("GEOM_CONFIRM_INFO").arg(nb);
- const QString button0 = tr("GEOM_BUT_EXPLODE");
- const QString button1 = tr("GEOM_BUT_CANCEL");
-
- if (QMessageBox::warning(this, caption, text, button0, button1) != 0)
+ if (SUIT_MessageBox::question( this,
+ tr("GEOM_CONFIRM"),
+ tr("GEOM_CONFIRM_INFO").arg(nb),
+ tr("GEOM_BUT_EXPLODE"),
+ tr("GEOM_BUT_CANCEL") ) != 0 )
return false; /* aborted */
}
}
if (!isAllSubShapes())
return;
+ int currentType = GroupPoints->ComboBox1->itemData( GroupPoints->ComboBox1->currentIndex() ).toInt();
+
ResetStateOfDialog();
QString aString = ""; /* name of selection */
aSelMgr->selectedObjects(aSelList);
int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
- if (nbSel != 1)
- return;
-
- Handle(SALOME_InteractiveObject) IO = aSelList.First();
- if (!IO->hasEntry()) {
- SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
- updateButtonState();
- return;
- }
-
- if (myIsHiddenMain) {
- GEOM_Displayer* aDisplayer = getDisplayer();
- aDisplayer->Display(myObject);
- myIsHiddenMain = false;
- }
-
- TopoDS_Shape S = GEOMBase::GetTopoFromSelection(aSelList);
- if (S.IsNull() || S.ShapeType() == TopAbs_VERTEX) {
- myObject = GEOM::GEOM_Object::_nil();
- updateButtonState();
- return;
- }
-
- myObject = GEOMBase::ConvertIOinGEOMObject(IO);
- if (myObject->_is_nil()) {
- updateButtonState();
- return;
- }
-
- myShape = S;
- GroupPoints->LineEdit1->setText(aString);
-
- int SelectedShapeType = GroupPoints->ComboBox1->currentIndex();
- int count = GroupPoints->ComboBox1->count();
-
- if (myWithShape)
- count = count - 1;
-
- int i = 0;
- // Solving PAL5590
- if (myShape.ShapeType() == TopAbs_COMPOUND) {
- unsigned int nb = NumberOfSubShapes(myShape, TopAbs_COMPOUND);
- if (nb > 0)
- i++;
- }
- while (i <= myShape.ShapeType()) {
- GroupPoints->ComboBox1->removeItem(0);
- i++;
- }
-
- if (myShape.ShapeType() == TopAbs_COMPOUND) {
- if (myWithShape == false) {
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Shape");
- myWithShape = true;
- }
- }
- else {
- if (myWithShape == true) {
- GroupPoints->ComboBox1->removeItem(GroupPoints->ComboBox1->count() - 1);
- myWithShape = false;
+ if (nbSel == 1) {
+ Handle(SALOME_InteractiveObject) IO = aSelList.First();
+ if (!IO->hasEntry()) {
+ SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
}
- }
-
- int count1 = GroupPoints->ComboBox1->count();
- if (myWithShape)
- count1 = count1 - 1;
-
- if (SelectedShapeType > myShape.ShapeType()) {
- if (SelectedShapeType == 8) {
- if (myShape.ShapeType() != TopAbs_COMPOUND) {
- GroupPoints->ComboBox1->setCurrentIndex(0);
- ComboTextChanged();
+ else {
+ TopoDS_Shape S = GEOMBase::GetTopoFromSelection(aSelList);
+ if (S.IsNull() || S.ShapeType() == TopAbs_VERTEX) {
+ myObject = GEOM::GEOM_Object::_nil();
}
- }
- else
- GroupPoints->ComboBox1->setCurrentIndex(count1 - count + SelectedShapeType);
- }
- else {
- GroupPoints->ComboBox1->setCurrentIndex(0);
- ComboTextChanged();
- }
+ else {
+ myObject = GEOMBase::ConvertIOinGEOMObject(IO);
+ if (!CORBA::is_nil(myObject)) {
+ myShape = S;
+ GroupPoints->LineEdit1->setText(aString);
+ int i = 0;
+ // Solving PAL5590
+ if (myShape.ShapeType() == TopAbs_COMPOUND) {
+ unsigned int nb = NumberOfSubShapes(myShape, TopAbs_COMPOUND);
+ if (nb > 0)
+ i++;
+ }
+ while (i <= myShape.ShapeType()) {
+ GroupPoints->ComboBox1->removeItem(0);
+ i++;
+ }
+ // remove Shape and Flat types for non-compound shapes
+ if (myShape.ShapeType() != TopAbs_COMPOUND) {
+ int idx = GroupPoints->ComboBox1->findData( (int)GEOM::SHAPE );
+ if ( idx != -1 ) GroupPoints->ComboBox1->removeItem( idx );
+ idx = GroupPoints->ComboBox1->findData( (int)GEOM::FLAT );
+ if ( idx != -1 ) GroupPoints->ComboBox1->removeItem( idx );
+ } // if (myShape.ShapeType() != TopAbs_COMPOUND)
+ } // if (!CORBA::is_nil(myObject))
+ } // if (S.IsNull() || S.ShapeType() == TopAbs_VERTEX)
+ } // if (!IO->hasEntry()) ... else
+ } // if (nbSel == 1)
+
+ int idx = GroupPoints->ComboBox1->findData( currentType );
+ if ( idx != -1 )
+ GroupPoints->ComboBox1->setCurrentIndex( idx );
updateButtonState();
}
myShape.Nullify();
myEditCurrentArgument->setText("");
- int SelectedShapeType = GroupPoints->ComboBox1->currentIndex();
- int count = GroupPoints->ComboBox1->count();
- if (myWithShape)
- count = count - 1;
-
/* type for sub-shape selection */
GroupPoints->ComboBox1->clear();
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Compound");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Compsolid");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Solid");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Shell");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Face");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Wire");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Edge");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Vertex");
- GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Shape");
-
- myWithShape = true;
-
- GroupPoints->ComboBox1->setCurrentIndex(8 - count + SelectedShapeType);
-
- // to avoid recursion: SelectionIntoArgument->ResetStateOfDialog->ComboTextChanged->SubShapeToggled->activateSelection->(currentSelectionChanged)->SelectionIntoArgument
- //ComboTextChanged();
+ for ( int i = 0; i <= (int)GEOM::FLAT; i++ )
+ GroupPoints->ComboBox1->addItem(ShapeTypes[i], i);
updateButtonState();
}
GroupPoints->PushButton2->setEnabled(!isAllSubShapes());
GroupPoints->PushButton3->setEnabled(!isAllSubShapes());
GroupPoints->PushButton4->setEnabled(!isAllSubShapes());
+ myFilterGrp->setEnabled(GroupPoints->CheckButton1->isEnabled() &&
+ GroupPoints->CheckButton1->isChecked() &&
+ shapeType() < GEOM::VERTEX);
+
+#ifndef DISABLE_PLOT2DVIEWER
+ myPlotDistributionButton->setEnabled( myFilterGrp->isEnabled() &&
+ ( shapeType() == TopAbs_EDGE ||
+ shapeType() == TopAbs_FACE ||
+ shapeType() == TopAbs_SOLID ) );
+#endif
activateSelection();
}
}
//=================================================================================
-// function : NumberOfSubShapes()
+// function : updateButtonState
// purpose :
//=================================================================================
-unsigned int EntityGUI_SubShapeDlg::NumberOfSubShapes(const TopoDS_Shape& S,
- const int shapeType) const
+void EntityGUI_SubShapeDlg::updateButtonState()
{
- if (S.IsNull())
- return 0;
+ bool viewOk = SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() == OCCViewer_Viewer::Type();
+ bool shapeTypeOk = shapeType() != TopAbs_SHAPE && shapeType() != TopAbs_FLAT && shapeType() != TopAbs_COMPOUND;
+ bool objectOK = !CORBA::is_nil( myObject );
- unsigned int index = 0;
- TopTools_MapOfShape M;
-
- if (S.ShapeType() == TopAbs_COMPOUND &&
- (TopAbs_ShapeEnum(shapeType) == TopAbs_SHAPE ||
- TopAbs_ShapeEnum(shapeType) == TopAbs_COMPSOLID ||
- TopAbs_ShapeEnum(shapeType) == TopAbs_COMPOUND)) {
- TopoDS_Iterator It(S, Standard_True, Standard_True);
- for (; It.More(); It.Next()) {
- if (M.Add(It.Value())) {
- if (TopAbs_ShapeEnum(shapeType) == TopAbs_SHAPE ||
- TopAbs_ShapeEnum(shapeType) == It.Value().ShapeType()) {
- index++;
- }
- }
- }
+ if ( viewOk && objectOK && shapeTypeOk ) {
+ GroupPoints->CheckButton1->setEnabled( true );
}
else {
- TopExp_Explorer Exp (S, TopAbs_ShapeEnum(shapeType));
- for (; Exp.More(); Exp.Next()) {
- if (M.Add(Exp.Current())) {
- index++;
- }
- }
- }
-
- M.Clear();
- return index;
-}
-
-//=================================================================================
-// function : updateButtonState
-// purpose :
-//=================================================================================
-void EntityGUI_SubShapeDlg::updateButtonState()
-{
- if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() != OCCViewer_Viewer::Type() ||
- myObject->_is_nil() || shapeType() == TopAbs_SHAPE || shapeType() == TopAbs_COMPOUND) {
- GroupPoints->CheckButton1->setChecked(false);
- GroupPoints->CheckButton1->setEnabled(false);
+ GroupPoints->CheckButton1->setChecked( false );
+ GroupPoints->CheckButton1->setEnabled( false );
}
- else
- GroupPoints->CheckButton1->setEnabled(true);
+ myFilterGrp->setEnabled(GroupPoints->CheckButton1->isEnabled() && GroupPoints->CheckButton1->isChecked());
}
//=================================================================================
//=================================================================================
bool EntityGUI_SubShapeDlg::isAllSubShapes() const
{
- return !GroupPoints->CheckButton1->isChecked() || !GroupPoints->CheckButton1->isEnabled();
+ return !GroupPoints->CheckButton1->isEnabled() || !GroupPoints->CheckButton1->isChecked();
}
//=================================================================================
//=================================================================================
int EntityGUI_SubShapeDlg::shapeType() const
{
- int type = GroupPoints->ComboBox1->currentIndex();
-
- if (myObject->_is_nil())
- return type;
-
- // Solving PAL5590
- type += myShape.ShapeType() + 1;
- if (myShape.ShapeType() == TopAbs_COMPOUND &&
- NumberOfSubShapes(myShape, TopAbs_COMPOUND) > 0) {
- type--;
- }
-
- return type;
+ return GroupPoints->ComboBox1->itemData(GroupPoints->ComboBox1->currentIndex()).toInt();
}
//=================================================================================
{
return QString::null;
}
+
+//=================================================================================
+// function : ClickOnOkFilter()
+// purpose : highlight and select entities which parameters (length, area or volume) are less than the value specified by the user
+//=================================================================================
+void EntityGUI_SubShapeDlg::ClickOnOkFilter()
+{
+ if (CORBA::is_nil(myObject) || isAllSubShapes() || shapeType() >= GEOM::VERTEX)
+ return;
+
+ TopTools_IndexedMapOfShape aSubShapesMap;
+ TopExp::MapShapes(myShape, aSubShapesMap);
+ SALOME_View* view = GEOM_Displayer::GetActiveView();
+ getDisplayer()->Erase(myObject, false, false);
+ CORBA::String_var aMainEntry = myObject->GetStudyEntry();
+ QString anEntryBase = aMainEntry.in();
+
+ SALOME_ListIO toSelect;
+
+ TopExp_Explorer anExp (myShape, (TopAbs_ShapeEnum)shapeType());
+ for (; anExp.More(); anExp.Next())
+ {
+ TopoDS_Shape aSubShape = anExp.Current();
+ int index = aSubShapesMap.FindIndex(aSubShape);
+ QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
+ if ( !getDisplayer()->IsDisplayed( anEntry ) )
+ continue;
+
+ double factor = GEOMUtils::ShapeToDouble(aSubShape).second;
+ double v1 = myLessFilterSpin->value();
+ double v2 = myGreaterFilterSpin->value();
+ bool isLess = myLessFilterCombo->itemData(myLessFilterCombo->currentIndex()).toInt() == Filter_LT ? factor < v1 : factor <= v1;
+ bool isGreater = myGreaterFilterCombo->itemData(myGreaterFilterCombo->currentIndex()).toInt() == Filter_GT ? factor > v2 : factor >= v2;
+ if ( ( myLessFilterCheck->isChecked() && myGreaterFilterCheck->isChecked() && isLess && isGreater ) ||
+ ( myLessFilterCheck->isChecked() && !myGreaterFilterCheck->isChecked() && isLess ) ||
+ ( myGreaterFilterCheck->isChecked() && !myLessFilterCheck->isChecked() && isGreater ) ) {
+ Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject();
+ io->setEntry( anEntry.toLatin1().constData() );
+ io->setName( myObject->GetName() );
+ toSelect.Append(io);
+ }
+ }
+ if ( toSelect.Extent() > 0 ) {
+ myGeomGUI->getApp()->selectionMgr()->setSelectedObjects(toSelect);
+ SUIT_MessageBox::information( this,
+ tr( "INF_INFO" ),
+ tr( "GEOM_SOME_SHAPES_SELECTED").arg( toSelect.Extent() ),
+ tr( "BUT_OK" ) );
+ }
+ else {
+ SUIT_MessageBox::information( this,
+ tr( "INF_INFO" ),
+ tr( "GEOM_NO_SHAPES_SELECTED" ),
+ tr( "BUT_OK" ) );
+ }
+ updateButtonState();
+}
+
+#ifndef DISABLE_PLOT2DVIEWER
+//=================================================================================
+// function : ClickOnPlot()
+// purpose : opens "Shape Statistics" dialog box in order to plot sub-shapes distribution.
+//=================================================================================
+void EntityGUI_SubShapeDlg::ClickOnPlot()
+{
+ QDialog* dlg = new MeasureGUI_ShapeStatisticsDlg( this, myShape, (TopAbs_ShapeEnum)shapeType() );
+ if ( dlg ) {
+ dlg->show();
+ }
+}
+#endif
+
+//=================================================================================
+// function : MeasureToggled()
+// purpose :
+// : Called when 'myLessFilterCheck' or 'myGreaterFilterCheck' state change
+//=================================================================================
+void EntityGUI_SubShapeDlg::MeasureToggled()
+{
+ myLessFilterSpin->setEnabled(myLessFilterCheck->isChecked());
+ myLessFilterCombo->setEnabled(myLessFilterCheck->isChecked());
+ myGreaterFilterSpin->setEnabled(myGreaterFilterCheck->isChecked());
+ myGreaterFilterCombo->setEnabled(myGreaterFilterCheck->isChecked());
+ myApplyFilterButton->setEnabled(myLessFilterCheck->isChecked() || myGreaterFilterCheck->isChecked());
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> EntityGUI_SubShapeDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myObject);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TColStd_IndexedMapOfInteger.hxx>
+class QCheckBox;
+class QComboBox;
+class QGroupBox;
+class QPushButton;
+class SalomeApp_DoubleSpinBox;
class DlgRef_1Sel1List1Check3Btn;
//=================================================================================
virtual bool execute (ObjectList&);
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
virtual QString getNewObjectName (int CurrObj = -1) const;
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
void closeEvent (QCloseEvent*);
void ComboTextChanged();
void showOnlySelected();
+ void ClickOnOkFilter();
+#ifndef DISABLE_PLOT2DVIEWER
+ void ClickOnPlot();
+#endif
+ void MeasureToggled();
private:
void Init();
void ResetStateOfDialog();
- unsigned int NumberOfSubShapes (const TopoDS_Shape&,
- const int) const;
-
void activateSelection();
int getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex);
void updateButtonState();
GEOM::GEOM_Object_var myObject;
int myDmMode;
- bool myWithShape;
-
bool myIsHiddenMain;
DlgRef_1Sel1List1Check3Btn* GroupPoints;
+ QCheckBox* myLessFilterCheck;
+ QCheckBox* myGreaterFilterCheck;
+ QComboBox* myLessFilterCombo;
+ QComboBox* myGreaterFilterCombo;
+ SalomeApp_DoubleSpinBox* myLessFilterSpin;
+ SalomeApp_DoubleSpinBox* myGreaterFilterSpin;
+ QPushButton* myApplyFilterButton;
+ QPushButton* myPlotDistributionButton;
+ QGroupBox* myFilterGrp;
};
#endif // ENTITYGUI_SUBSHAPEDLG_H
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : EntityGUI_SurfFromFaceDlg.cxx
+
+#include "EntityGUI_SurfFromFaceDlg.h"
+#include <GeometryGUI.h>
+#include <DlgRef.h>
+#include <GEOMBase.h>
+
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SalomeApp_Application.h>
+#include <LightApp_SelectionMgr.h>
+
+
+//=================================================================================
+// class : EntityGUI_SurfFromFaceDlg
+// purpose :
+//=================================================================================
+EntityGUI_SurfFromFaceDlg::EntityGUI_SurfFromFaceDlg
+ (GeometryGUI *theGeometryGUI,
+ QWidget *parent,
+ bool modal,
+ Qt::WindowFlags fl)
+ : GEOMBase_Skeleton (theGeometryGUI, parent, modal, fl),
+ myGroup (0)
+{
+ QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SURFACE_FROM_FACE")));
+ QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
+
+ setWindowTitle(tr("GEOM_SURF_FROM_FACE_TITLE"));
+
+ /***************************************************************/
+
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_SURF_FROM_FACE"));
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton3->close();
+
+ // Construct a group.
+ myGroup = new DlgRef_1Sel(centralWidget());
+ myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+ myGroup->TextLabel1->setText(tr("GEOM_FACE"));
+ myGroup->PushButton1->setIcon(image1);
+ myGroup->LineEdit1->setReadOnly(true);
+
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ layout->setMargin(0); layout->setSpacing(6);
+ layout->addWidget(myGroup);
+
+ setHelpFileName("create_surface_from_face_page.html");
+
+ Init();
+}
+
+//=================================================================================
+// function : ~EntityGUI_SurfFromFaceDlg()
+// purpose :
+//=================================================================================
+EntityGUI_SurfFromFaceDlg::~EntityGUI_SurfFromFaceDlg()
+{
+}
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void EntityGUI_SurfFromFaceDlg::Init()
+{
+ initName(tr("GEOM_SURF_FROM_FACE_NAME"));
+ showOnlyPreviewControl();
+
+ /* signals and slots connections */
+ connect(myGroup->PushButton1, SIGNAL(clicked()),
+ this, SLOT(SetEditCurrentArgument()));
+ connect(myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()),
+ this, SLOT(DeactivateActiveDialog()));
+ connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()),
+ this, SLOT(ClickOnCancel()));
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+
+ myEditCurrentArgument = myGroup->LineEdit1;
+ myGroup->LineEdit1->setReadOnly(true);
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : SelectionIntoArgument
+// purpose : Called when selection is changed
+//=================================================================================
+void EntityGUI_SurfFromFaceDlg::SelectionIntoArgument()
+{
+ erasePreview();
+ myEditCurrentArgument->setText("");
+ myFace.nullify();
+
+ GEOM::GeomObjPtr aSelectedObject = getSelected(TopAbs_FACE);
+
+ if (aSelectedObject) {
+ myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject.get()));
+ myFace = aSelectedObject;
+ }
+
+ processPreview();
+}
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void EntityGUI_SurfFromFaceDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ if (send == myGroup->PushButton1) {
+ myEditCurrentArgument->setFocus();
+ SelectionIntoArgument();
+ }
+}
+
+//=================================================================================
+// function : ActivateThisDialog
+// purpose :
+//=================================================================================
+void EntityGUI_SurfFromFaceDlg::ActivateThisDialog()
+{
+ GEOMBase_Skeleton::ActivateThisDialog();
+ connect(myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void EntityGUI_SurfFromFaceDlg::enterEvent (QEvent*)
+{
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr EntityGUI_SurfFromFaceDlg::createOperation()
+{
+ return myGeomGUI->GetGeomGen()->GetIShapesOperations(getStudyId());
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool EntityGUI_SurfFromFaceDlg::isValid (QString& msg)
+{
+ return myFace;
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool EntityGUI_SurfFromFaceDlg::execute (ObjectList& objects)
+{
+ GEOM::GEOM_IShapesOperations_var anOper =
+ GEOM::GEOM_IShapesOperations::_narrow(getOperation());
+ GEOM::GEOM_Object_var anObj = anOper->MakeSurfaceFromFace(myFace.get());
+
+ if (!anObj->_is_nil()) {
+ objects.push_back(anObj._retn());
+ }
+
+ return true;
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void EntityGUI_SurfFromFaceDlg::ClickOnOk()
+{
+ setIsApplyAndClose(true);
+
+ if (ClickOnApply())
+ ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool EntityGUI_SurfFromFaceDlg::ClickOnApply()
+{
+ if (!onAccept())
+ return false;
+
+ initName();
+
+ return true;
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> EntityGUI_SurfFromFaceDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myFace;
+ return res;
+}
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : EntityGUI_SurfFromFaceDlg.h
+
+#ifndef ENTITYGUI_SURFFROMFACEDLG_H
+#define ENTITYGUI_SURFFROMFACEDLG_H
+
+
+#include <GEOMBase_Skeleton.h>
+
+class DlgRef_1Sel;
+
+//=================================================================================
+// class : EntityGUI_SurfFromFaceDlg
+// purpose :
+//=================================================================================
+class EntityGUI_SurfFromFaceDlg : public GEOMBase_Skeleton
+{
+ Q_OBJECT
+
+public:
+
+ EntityGUI_SurfFromFaceDlg (GeometryGUI *theGeometryGUI,
+ QWidget *parent = 0,
+ bool modal = false,
+ Qt::WindowFlags fl = 0);
+
+ ~EntityGUI_SurfFromFaceDlg();
+
+protected:
+
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid( QString& );
+ virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
+
+private:
+
+ void Init();
+ void enterEvent( QEvent* );
+
+private:
+
+ DlgRef_1Sel *myGroup;
+ GEOM::GeomObjPtr myFace;
+
+private slots:
+
+ void ClickOnOk();
+ bool ClickOnApply();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
+ void ActivateThisDialog();
+
+};
+
+#endif // ENTITYGUI_SURFFROMFACEDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
*/
//================================================================================
-Handle(TFunction_Driver) GEOM_BaseObject::GetCreationDriver()
+Handle(TFunction_Driver) GEOM_BaseObject::GetCreationDriver(int funNb)
{
- Handle(TFunction_Driver) aDriver;
-
- Handle(GEOM_Function) function = GetFunction(1);
+ Handle(TFunction_Driver) driver;
+ Handle(GEOM_Function) function = GetFunction(funNb);
if ( !function.IsNull() )
{
Standard_GUID aGUID = function->GetDriverGUID();
- if ( TFunction_DriverTable::Get()->FindDriver(aGUID, aDriver))
- aDriver->Init( function->GetEntry() );
+ if ( TFunction_DriverTable::Get()->FindDriver(aGUID, driver ))
+ driver->Init( function->GetEntry() );
}
- return aDriver;
+ return driver;
}
//=============================================================================
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TDF_Label.hxx>
#include <TDataStd_TreeNode.hxx>
+#include <vector>
+
class GEOM_BaseObject;
class Handle(TFunction_Driver);
class GEOM_Engine;
//Returns the dependencies of the last function
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetLastDependency();
- //Returns a driver creator of this object
- Standard_EXPORT Handle(TFunction_Driver) GetCreationDriver();
+ //Returns drivers creators of this object
+ Standard_EXPORT Handle(TFunction_Driver) GetCreationDriver(int funNb);
//###########################################################
// Internal methods
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
typedef std::map< TCollection_AsciiString, TCollection_AsciiString > TSting2StringMap;
typedef std::map< TCollection_AsciiString, TObjectData > TSting2ObjDataMap;
typedef std::map< TCollection_AsciiString, TObjectData* > TSting2ObjDataPtrMap;
+typedef std::map< int, std::list < int > > TIntToListIntMap;
static GEOM_Engine* TheEngine = NULL;
std::set<TCollection_AsciiString>& theIgnoreObjs,
bool& theIsDumpCollected);
+static int GetTag(const TCollection_AsciiString &theEntry);
+
+static void FillMapOfRef(const Handle(GEOM_Function) &theFunction,
+ TIntToListIntMap &theRefMap);
+
void ReplaceVariables(TCollection_AsciiString& theCommand,
const TVariablesList& theVariables);
std::map< int, TCollection_AsciiString >& theEntryToCmdMap,
std::set<TCollection_AsciiString>& theMapOfPublished);
+static TCollection_AsciiString GetPublishCommands
+ (const int theTag,
+ const std::map< int, TCollection_AsciiString > &theEntryToCmdMap,
+ const TIntToListIntMap &theMapRefs,
+ std::set< int > &thePublished);
+
//================================================================================
/*!
* \brief Fix up the name of python variable
// Mantis issue 0020768
Standard_Integer objectCounter = 0;
Resource_DataMapOfAsciiStringAsciiString aNameToEntry;
+ TIntToListIntMap aRefMap;
if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) {
TDataStd_ChildNodeIterator Itr(aRoot);
continue; // aCurScript is already at the end of aFuncScript
aFuncScript += aCurScript;
}
+
+ // Fill the map of references.
+ FillMapOfRef(aFunction, aRefMap);
+
if (isDumpCollected ) {
// Replace entries by the names
ReplaceEntriesByNames( aFuncScript, aEntry2ObjData, isPublished,
aNameToEntry, anEntryToCmdMap, anIgnoreObjMap );
}
// add publishing commands to the script
+ std::set< int > aPublished;
std::map< int, TCollection_AsciiString >::iterator anEntryToCmd = anEntryToCmdMap.begin();
- for ( ; anEntryToCmd != anEntryToCmdMap.end(); ++anEntryToCmd )
- aFuncScript += anEntryToCmd->second;
+
+ for ( ; anEntryToCmd != anEntryToCmdMap.end(); ++anEntryToCmd ) {
+ const TCollection_AsciiString aPublishCmds =
+ GetPublishCommands(anEntryToCmd->first, anEntryToCmdMap,
+ aRefMap, aPublished);
+
+ aFuncScript += aPublishCmds;
+ }
// PTv, 0020001 add result objects from RestoreGivenSubShapes into ignore list,
// because they will be published during command execution
aNameToEntry, anEntryToCmdMap, anIgnoreObjMap );
}
// add publishing commands to the script
+ std::set< int > aPublished;
std::map< int, TCollection_AsciiString >::iterator anEntryToCmd = anEntryToCmdMap.begin();
- for ( ; anEntryToCmd != anEntryToCmdMap.end(); ++anEntryToCmd )
- aScript += anEntryToCmd->second;
+
+ for ( ; anEntryToCmd != anEntryToCmdMap.end(); ++anEntryToCmd ) {
+ const TCollection_AsciiString aPublishCmds =
+ GetPublishCommands(anEntryToCmd->first, anEntryToCmdMap,
+ aRefMap, aPublished);
+
+ aScript += aPublishCmds;
+ }
}
//RNV: issue 16219: EDF PAL 469: "RemoveFromStudy" Function
return true;
}
+//=============================================================================
+/*!
+ * GetTag: Returns the tag from entry
+ */
+//=============================================================================
+int GetTag(const TCollection_AsciiString &theEntry)
+{
+ const int aGeomObjDepth = 3;
+ const int aTag = theEntry.Token(":", aGeomObjDepth).IntegerValue();
+
+ return aTag;
+}
+
+//=============================================================================
+/*!
+ * FillMapOfRef: Fill the map of references
+ */
+//=============================================================================
+void FillMapOfRef(const Handle(GEOM_Function) &theFunction,
+ TIntToListIntMap &theRefMap)
+{
+ TDF_LabelSequence aSeq;
+ TCollection_AsciiString anObjEntry;
+ int anObjTag;
+
+ TDF_Tool::Entry(theFunction->GetOwnerEntry(), anObjEntry);
+ anObjTag = GetTag(anObjEntry);
+ theFunction->GetDependency(aSeq);
+
+ const Standard_Integer aLen = aSeq.Length();
+ Standard_Integer i;
+
+ for (i = 1; i <= aLen; i++) {
+ TDF_Label aRefLabel = aSeq.Value(i);
+ Handle(TDF_Reference) aRef;
+
+ if (aRefLabel.FindAttribute(TDF_Reference::GetID(), aRef)) {
+ if (!aRef.IsNull() && !aRef->Get().IsNull()) {
+ Handle(TDataStd_TreeNode) aT;
+
+ if (TDataStd_TreeNode::Find(aRef->Get(), aT)) {
+ TDF_Label aDepLabel = aT->Label();
+ Handle(GEOM_Function) aRefFunct = GEOM_Function::GetFunction(aDepLabel);
+
+ if (!aRefFunct.IsNull()) {
+ // Get entry of the referenced object.
+ TDF_Tool::Entry(aRefFunct->GetOwnerEntry(), anObjEntry);
+
+ const int aRefTag = GetTag(anObjEntry);
+
+ theRefMap[anObjTag].push_back(aRefTag);
+ }
+ }
+ }
+ }
+ }
+}
+
//=============================================================================
/*!
* FindEntries: Returns a sequence of start/end positions of entries in the string
if ( stEntry2DataPtr != theStEntry2ObjDataPtr.end() )
aFatherData = stEntry2DataPtr->second;
- const int geomObjDepth = 3;
-
// treat multiply published object
if ( theObjectData._pyName.IsEmpty() )
{
aCreationCommand += theObjectData._pyName + " = " + data0._pyName;
// store aCreationCommand before publishing commands
- int tag = theObjectData._entry.Token( ":", geomObjDepth ).IntegerValue();
+ int tag = GetTag(theObjectData._entry);
theEntryToCmdMap.insert( std::make_pair( tag + 2*theEntry2ObjData.size(), aCreationCommand ));
}
aCommand += theObjectData._pyName + ", '" + theObjectData._name + "' )";
// bind a command to the study entry
- int tag = theObjectData._entry.Token( ":", geomObjDepth ).IntegerValue();
+ int tag = GetTag(theObjectData._entry);
theEntryToCmdMap.insert( std::make_pair( tag, aCommand ));
theObjectData._studyEntry.Clear(); // not to publish any more
}
+//================================================================================
+/*!
+ * \brief Returns the string of publishing commands. Take into account that
+ * references should be published prior to the objects refer to them.
+ */
+//================================================================================
+TCollection_AsciiString GetPublishCommands
+ (const int theTag,
+ const std::map< int, TCollection_AsciiString > &theEntryToCmdMap,
+ const TIntToListIntMap &theMapRefs,
+ std::set< int > &thePublished)
+{
+ TCollection_AsciiString aResult;
+
+ if (!thePublished.count(theTag)) {
+ // This object is not published yet.
+ std::map< int, TCollection_AsciiString >::const_iterator anIt =
+ theEntryToCmdMap.find(theTag);
+
+ if (anIt != theEntryToCmdMap.end()) {
+ // There is a pubish cmd.
+ TIntToListIntMap::const_iterator aRefIt = theMapRefs.find(theTag);
+
+ if (aRefIt != theMapRefs.end()) {
+ // Recursively publish all references.
+ std::list< int >::const_iterator aRefTagIt = aRefIt->second.begin();
+
+ for(; aRefTagIt != aRefIt->second.end(); ++aRefTagIt) {
+ const TCollection_AsciiString aRefCmd = GetPublishCommands
+ (*aRefTagIt, theEntryToCmdMap, theMapRefs, thePublished);
+
+ aResult += aRefCmd;
+ }
+ }
+
+ // Add the object command.
+ aResult += anIt->second;
+ }
+
+ thePublished.insert(theTag);
+ }
+
+ return aResult;
+}
+
//================================================================================
/*!
* \brief Constructor
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
+#include <cstdlib>
+
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
#define HISTORY_LABEL 4
#define SUBSHAPES_LABEL 5 // 0020756: GetGroups
#define NAMING_LABEL 6 // 0020750: Naming during STEP import
+#define CALLBACK_LABEL 1 // TDataStd_Comment
#ifdef KEEP_ORIENTATION_0021251
#define ORIENTATION_LABEL 7 // 0021251: TNaming_NamedShape doesn't store orientation
*/
//=============================================================================
GEOM_Function::GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType)
-: _label(theEntry)
+ : _label(theEntry), _isCallBackData(false)
{
TFunction_Function::Set(theEntry, theGUID);
TDataStd_Integer::Set(theEntry, theType);
aRoot->Append(aNode);
}
+//================================================================================
+/*!
+ * \brief
+ *
+ *
+ */
+//================================================================================
+
+GEOM_Function::~GEOM_Function()
+{
+ if ( _isCallBackData ) {
+ _label.FindChild( CALLBACK_LABEL ).ForgetAttribute( TDataStd_Comment::GetID() );
+ }
+}
+
//================================================================================
/*!
* \brief Retuns true if this function is the last one in the study
Handle(TDataStd_Comment) aString;
TDF_Label anArgLabel = ARGUMENT(thePosition);
if(!anArgLabel.FindAttribute(TDataStd_Comment::GetID(), aString)) return aRes;
-
+ char *str = new char[aString->Get().LengthOfCString()+1];
+ aString->Get().ToUTF8CString(str);
+ aRes = TCollection_AsciiString(str);
_isDone = true;
- aRes = TCollection_AsciiString(aString->Get());
return aRes;
}
return _label.FindChild(NAMING_LABEL, create);
}
+//================================================================================
+/*!
+ * Save a pointer to a data holder intended to pass temporary data Driver -> Operation.
+ * This method should be called by Operation to set the data holder.
+ * An instance of GEOM_Function that sets the data holder will remove the
+ * corresponding OCAF attribute at it's destruction
+ */
+//================================================================================
+
+void GEOM_Function::SetCallBackData( void* data )
+{
+ std::ostringstream strm;
+ strm << (long long) data;
+ TCollection_ExtendedString string( strm.str().c_str() );
+
+ TDF_Label aChild = _label.FindChild(CALLBACK_LABEL);
+ TDataStd_Comment::Set(aChild, string);
+
+ _isCallBackData = true; // I will remove TDataStd_Comment at destruction
+}
+
+//================================================================================
+/*!
+ * Returns a pointer to a data holder intended to pass data Driver -> Operation.
+ * This method should be called by Driver to get the data holder to fill it in.
+ * Returns NULL if the Operation have not set the data holder.
+ */
+//================================================================================
+
+void* GEOM_Function::GetCallBackData()
+{
+ Handle(TDataStd_Comment) aComment;
+ TDF_Label aChild = _label.FindChild( CALLBACK_LABEL );
+ if(!aChild.FindAttribute(TDataStd_Comment::GetID(), aComment)) return NULL;
+ TCollection_AsciiString string( aComment->Get() );
+
+ long long address;
+#ifndef WIN32
+ address = atoll ( string.ToCString() );
+#else
+ address = _strtoi64 ( string.ToCString(), NULL, 10 );
+#endif
+
+ return reinterpret_cast<void*> ( address );
+}
+
IMPLEMENT_STANDARD_HANDLE (GEOM_Function, Standard_Transient);
IMPLEMENT_STANDARD_RTTIEXT(GEOM_Function, Standard_Transient );
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
Standard_EXPORT GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType);
- Standard_EXPORT ~GEOM_Function() {}
+ Standard_EXPORT ~GEOM_Function();
Standard_EXPORT TDF_Label GetOwnerEntry();
//Returns a list of references to other function arguments at position thePosition
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition);
+ // Save a pointer to a data holder intended to pass data Driver -> Operation.
+ // This method should be called by Operation to set the data holder.
+ // An instance of GEOM_Function that sets the data holder will remove the
+ // corresponding OCAF attribute at it's destruction
+ Standard_EXPORT void SetCallBackData( void* data );
+
+ // Returns a pointer to a data holder intended to pass data Driver -> Operation.
+ // This method should be called by Driver to get the data holder to fill it in.
+ // Returns NULL if the Operation have not set the data holder.
+ Standard_EXPORT void* GetCallBackData();
+
//Sets a TopoDS_Shape argument at position thePosition
//void SetShape(int thePosition, const TopoDS_Shape& theShape);
TDF_Label _label;
bool _isDone;
+ bool _isCallBackData;
};
#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
*/
//=============================================================================
-Handle(GEOM_Object) GEOM_Object::GetObject(TDF_Label& theLabel)
+Handle(GEOM_Object) GEOM_Object::GetObject(const TDF_Label& theLabel)
{
Handle(GEOM_BaseObject) base = GEOM_BaseObject::GetObject(theLabel);
return Handle(GEOM_Object)::DownCast( base );
*/
//=============================================================================
-Handle(GEOM_Object) GEOM_Object::GetReferencedObject(TDF_Label& theLabel)
+Handle(GEOM_Object) GEOM_Object::GetReferencedObject(const TDF_Label& theLabel)
{
Handle(GEOM_BaseObject) base = GEOM_BaseObject::GetReferencedObject(theLabel);
return Handle(GEOM_Object)::DownCast( base );
return false;
}
+//================================================================================
+/*!
+ * \brief Returns GetLastFunction() of given objects
+ */
+//================================================================================
+
+Handle(TColStd_HSequenceOfTransient)
+GEOM_Object::GetLastFunctions( const std::list< Handle(GEOM_Object) >& theObjects )
+{
+ Handle(TColStd_HSequenceOfTransient) funs = new TColStd_HSequenceOfTransient;
+ std::list<Handle(GEOM_Object)>::const_iterator it = theObjects.begin();
+ for (; it != theObjects.end(); it++)
+ {
+ Handle(GEOM_Function) fun = (*it)->GetLastFunction();
+ if ( fun.IsNull())
+ return Handle(TColStd_HSequenceOfTransient)();
+ funs->Append( fun );
+ }
+ return funs;
+}
+
IMPLEMENT_STANDARD_HANDLE (GEOM_Object, GEOM_BaseObject );
IMPLEMENT_STANDARD_RTTIEXT(GEOM_Object, GEOM_BaseObject );
+
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <Aspect_TypeOfMarker.hxx>
#include <Standard_GUID.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
#include <TDF_Label.hxx>
#include <TopoDS_Shape.hxx>
+#include <list>
+
class GEOM_Object;
class Handle(TFunction_Driver);
class GEOM_Engine;
Standard_EXPORT ~GEOM_Object();
//Finds a GEOM_Object on the label theLabel
- Standard_EXPORT static Handle(GEOM_Object) GetObject(TDF_Label& theLabel);
+ Standard_EXPORT static Handle(GEOM_Object) GetObject(const TDF_Label& theLabel);
//Finds a GEOM_Object by a reference, stored on the label theLabel
- Standard_EXPORT static Handle(GEOM_Object) GetReferencedObject(TDF_Label& theLabel);
+ Standard_EXPORT static Handle(GEOM_Object) GetReferencedObject(const TDF_Label& theLabel);
//###########################################################
//Access to properties
//Returns false if the object is a sub-shape of another object
Standard_EXPORT bool IsMainShape();
+ //Comfort method
+ Standard_EXPORT static Handle(TColStd_HSequenceOfTransient)
+ GetLastFunctions( const std::list< Handle(GEOM_Object) >& theObjects );
+
public:
DEFINE_STANDARD_RTTI( GEOM_Object );
};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
{
if (--myCounter == 0) {
TCollection_AsciiString aDescr;
- if ( myAppend ) {
+ if ( myAppend )
aDescr = myFunction->GetDescription();
- if ( !aDescr.IsEmpty() ) aDescr += "\n\t";
- }
std::string aString = myStream.str();
+ if ( !aDescr.IsEmpty() && !aString.empty())
+ aDescr += "\n\t";
aDescr += (char *)aString.c_str();
myFunction->SetDescription( aDescr );
}
}
return *this;
}
+ Standard_EXPORT TPythonDump&
+ TPythonDump::operator<< (const std::list<Handle(GEOM_Object)>& theObjects)
+ {
+ Standard_Integer aLength = theObjects.size();
+ if ( aLength != 1 ) {
+ myStream << "[";
+ }
+ std::list<Handle(GEOM_Object)>::const_iterator obj = theObjects.begin();
+ for ( Standard_Integer i = 1; i <= aLength; i++, ++obj ) {
+ *this << *obj;
+ if ( i < aLength ) myStream << ", ";
+ }
+ if ( aLength != 1 ) {
+ myStream << "]";
+ }
+ return *this;
+ }
TPythonDump& TPythonDump::operator<< (const GEOM_BaseObject* theObject)
{
for (i = 1; i <= aLen; i++) {
anObject = Handle(GEOM_Object)::DownCast(theObjects->Value(i));
+ if ( anObject.IsNull() ) {
+ Handle(GEOM_Function) fun = Handle(GEOM_Function)::DownCast(theObjects->Value(i));
+ if ( !fun.IsNull() )
+ anObject = GEOM_Object::GetObject( fun->GetOwnerEntry() );
+ }
aLatest = GetCreatedLast(aLatest, anObject);
}
return aLatest;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TCollection_AsciiString.hxx>
+#include <list>
+
namespace GEOM
{
class TPythonDump
Standard_EXPORT TPythonDump& operator<< (const TCollection_AsciiString theArg);
Standard_EXPORT TPythonDump& operator<< (const TopAbs_ShapeEnum theArg);
Standard_EXPORT TPythonDump& operator<< (const Handle(GEOM_BaseObject)& theObject);
- Standard_EXPORT TPythonDump& operator<< (const Handle(TColStd_HSequenceOfTransient)& theObjects);
+ Standard_EXPORT TPythonDump& operator<< (const Handle(TColStd_HSequenceOfTransient)& objects);
+ Standard_EXPORT TPythonDump& operator<< (const std::list<Handle(GEOM_Object)>& theObjects);
Standard_EXPORT TPythonDump& operator<< (const GEOM_BaseObject* theObject);
};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
INCLUDE_DIRECTORIES(
${CAS_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}
+ ${PROJECT_SOURCE_DIR}/src/GEOMUtils
+ ${PROJECT_SOURCE_DIR}/src/GEOM
${CMAKE_CURRENT_SOURCE_DIR}
)
# libraries to link to
SET(_link_LIBRARIES
${CAS_KERNEL} ${CAS_TKBool} ${CAS_TKBO} ${CAS_TKMesh}
+ GEOMbasic GEOMUtils
${KERNEL_SALOMELocalTrace}
)
GEOMAlgo_BuilderShape.hxx
GEOMAlgo_Clsf.hxx
GEOMAlgo_ClsfBox.hxx
+ GEOMAlgo_ClsfQuad.hxx
GEOMAlgo_ClsfSolid.hxx
GEOMAlgo_ClsfSurf.hxx
GEOMAlgo_CoupleOfShapes.hxx
GEOMAlgo_FinderShapeOn2.hxx
GEOMAlgo_FinderShapeOnQuad.hxx
GEOMAlgo_GetInPlace.hxx
+ GEOMAlgo_GetInPlaceAPI.hxx
GEOMAlgo_GlueAnalyser.hxx
GEOMAlgo_GlueDetector.hxx
GEOMAlgo_Gluer.hxx
GEOMAlgo_IndexedDataMapOfShapeState.hxx
GEOMAlgo_KindOfBounds.hxx
GEOMAlgo_KindOfClosed.hxx
+ GEOMAlgo_KindOfDef.hxx
GEOMAlgo_KindOfName.hxx
GEOMAlgo_KindOfShape.hxx
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx
GEOMAlgo_BuilderShape.cxx
GEOMAlgo_Clsf.cxx
GEOMAlgo_ClsfBox.cxx
+ GEOMAlgo_ClsfQuad.cxx
GEOMAlgo_ClsfSolid.cxx
GEOMAlgo_ClsfSurf.cxx
GEOMAlgo_CoupleOfShapes.cxx
- GEOMAlgo_FinderShapeOn.cxx
- GEOMAlgo_FinderShapeOn1.cxx
GEOMAlgo_FinderShapeOn2.cxx
- GEOMAlgo_FinderShapeOnQuad.cxx
GEOMAlgo_GetInPlace.cxx
GEOMAlgo_GetInPlace_1.cxx
GEOMAlgo_GetInPlace_2.cxx
GEOMAlgo_GetInPlace_3.cxx
+ GEOMAlgo_GetInPlaceAPI.cxx
GEOMAlgo_GlueAnalyser.cxx
GEOMAlgo_GlueDetector.cxx
GEOMAlgo_Gluer.cxx
GEOMAlgo_ShapeInfoFiller.cxx
GEOMAlgo_ShapeInfoFiller_1.cxx
GEOMAlgo_ShapeSolid.cxx
- GEOMAlgo_ShellSolid.cxx
+ GEOMAlgo_ShellSolid.cxx
GEOMAlgo_SolidSolid.cxx
GEOMAlgo_Splitter.cxx
GEOMAlgo_StateCollector.cxx
GEOMAlgo_AlgoTools.hxx
GEOMAlgo_AlgoTools.cxx
GEOMAlgo_AlgoTools_1.cxx
-GEOMAlgo_AlgoTools_2.cxx
GEOMAlgo_SolidSolid.hxx
GEOMAlgo_SolidSolid.cxx
GEOMAlgo_ShapeAlgo.hxx
GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx
Basics_OCCTVersion.hxx
+
+GEOMAlgo_KindOfDef.hxx
--- Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+-- Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
--
-- Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
Standard_Integer& iCnt);
static
void CopySource(const TopoDS_Shape& aS,
- TopTools_IndexedDataMapOfShapeShape& aMapSS,
- TopoDS_Shape& aSC);
+ TopTools_IndexedDataMapOfShapeShape& aMapSS,
+ TopoDS_Shape& aSC);
//=======================================================================
//function : CopyShape
//purpose :
//=======================================================================
void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS,
- TopoDS_Shape& aSC)
+ TopoDS_Shape& aSC)
{
TopTools_IndexedDataMapOfShapeShape aMapSS;
//
//purpose :
//=======================================================================
void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS,
- TopoDS_Shape& aSC,
- TopTools_IndexedDataMapOfShapeShape& aMapSS)
+ TopoDS_Shape& aSC,
+ TopTools_IndexedDataMapOfShapeShape& aMapSS)
{
CopySource(aS, aMapSS, aSC);
}
//purpose :
//=======================================================================
void GEOMAlgo_AlgoTools::FaceNormal (const TopoDS_Face& aF,
- const Standard_Real U,
- const Standard_Real V,
- gp_Vec& aN)
+ const Standard_Real U,
+ const Standard_Real V,
+ gp_Vec& aN)
{
gp_Pnt aPnt ;
gp_Vec aD1U, aD1V;
return iRet;
}
//
+#if OCC_VERSION_LARGE > 0x06080000
+ // Try to copy PCurve from old edge to the new one.
+ iRet = BOPTools_AlgoTools2D::AttachExistingPCurve(aEold, aEnew, aF, aCtx);
+
+ if (iRet) {
+ // Do PCurve using projection algorithm.
+ iRet = 0;
+ } else {
+ // The PCurve is attached successfully.
+ return iRet;
+ }
+#endif
+ //
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aEnew, aF);
aC2D=BRep_Tool::CurveOnSurface(aEnew, aF, aT1, aT2);
if (aC2D.IsNull()){
// purpose:
//=======================================================================
void GEOMAlgo_AlgoTools::MakeContainer(const TopAbs_ShapeEnum theType,
- TopoDS_Shape& theC)
+ TopoDS_Shape& theC)
{
BRep_Builder aBB;
//
//purpose :
//=======================================================================
void GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
- const TopoDS_Face& aF,
- const Standard_Real aUMin,
- const Standard_Real aUMax)
+ const TopoDS_Face& aF,
+ const Standard_Real aUMin,
+ const Standard_Real aUMax)
{
Standard_Real aT1, aT2, aTx, aUx, aTol;
gp_Pnt2d aP2D;
//purpose :
//=======================================================================
void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE,
- gp_Pnt& aP3D)
+ gp_Pnt& aP3D)
{
Standard_Real aTx, aT1, aT2;
//
//purpose :
//=======================================================================
void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE,
- const Standard_Real aT,
- gp_Pnt& aP3D)
+ const Standard_Real aT,
+ gp_Pnt& aP3D)
{
Standard_Real aT1, aT2;
Handle(Geom_Curve) aC3D;
//purpose :
//=======================================================================
void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF,
- const Standard_Real aU,
- const Standard_Real aV,
- gp_Pnt& aP3D)
+ const Standard_Real aU,
+ const Standard_Real aV,
+ gp_Pnt& aP3D)
{
Handle(Geom_Surface) aS;
//
//purpose :
//=======================================================================
void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF,
- gp_Pnt& aP3D)
+ gp_Pnt& aP3D)
{
Standard_Real aU, aV, aUMin, aUMax, aVMin, aVMax;
//
//purpose :
//=======================================================================
void GEOMAlgo_AlgoTools::PointOnShape(const TopoDS_Shape& aS,
- gp_Pnt& aP3D)
+ gp_Pnt& aP3D)
{
TopAbs_ShapeEnum aType;
//
return 0; // Nothing to do
}
//
- while(1) {
+ for(;;) {
aNbEProcessed=aMProcessed.Extent();
if (aNbEProcessed==aNbE) {
break;
//purpose :
//=======================================================================
Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF,
- gp_Pnt& theP,
- gp_Pnt2d& theP2D)
+ gp_Pnt& theP,
+ gp_Pnt2d& theP2D)
{
Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
Standard_Integer iErr, aIx, aNbDomains, i;
//
Geom2dHatch_Intersector aIntr(aTotArcIntr, aTolTangfIntr);
Geom2dHatch_Hatcher aHatcher(aIntr,
- aTolHatch2D, aTolHatch3D,
- Standard_True, Standard_False);
+ aTolHatch2D, aTolHatch3D,
+ Standard_True, Standard_False);
//
iErr=0;
aEpsT=1.e-12;
}
//
// 4.
+ aVx=aVMin;
aNbDomains=aHatcher.NbDomains(aIx);
- for (i=1; i<=aNbDomains; ++i) {
- const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
- bHasFirstPoint=aDomain.HasFirstPoint();
- if (!bHasFirstPoint) {
- iErr=5;
- return iErr;
- }
- //
- aV1=aDomain.FirstPoint().Parameter();
- //
- bHasSecondPoint=aDomain.HasSecondPoint();
- if (!bHasSecondPoint) {
- iErr=6;
- return iErr;
- }
- //
- aV2=aDomain.SecondPoint().Parameter();
- //
- aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
- //
- break;
+ if (!aNbDomains) {
+ iErr=5;
+ return iErr;
+ }
+ //
+ i=1;
+ const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
+ bHasFirstPoint=aDomain.HasFirstPoint();
+ if (!bHasFirstPoint) {
+ iErr=5;
+ return iErr;
}
//
+ aV1=aDomain.FirstPoint().Parameter();
+ //
+ bHasSecondPoint=aDomain.HasSecondPoint();
+ if (!bHasSecondPoint) {
+ iErr=6;
+ return iErr;
+ }
+ //
+ aV2=aDomain.SecondPoint().Parameter();
+ //
+ aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
+ //
aS->D0(aUx, aVx, aPx);
//
theP2D.SetCoord(aUx, aVx);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+// File: GEOMAlgo_ClsfQuad.cxx
+// Created: Fri Feb 13 16:03:19 2015
+// Author: Sergey KHROMOV
+//
+
+
+#include <GEOMAlgo_ClsfQuad.hxx>
+#include <GEOMAlgo_SurfaceTools.hxx>
+
+#include <Geom_Plane.hxx>
+
+
+IMPLEMENT_STANDARD_HANDLE(GEOMAlgo_ClsfQuad, GEOMAlgo_Clsf);
+IMPLEMENT_STANDARD_RTTIEXT(GEOMAlgo_ClsfQuad, GEOMAlgo_Clsf);
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+GEOMAlgo_ClsfQuad::GEOMAlgo_ClsfQuad()
+: GEOMAlgo_Clsf(),
+ myQuadNormal(0., 0., 0.)
+{
+}
+//=======================================================================
+//function : ~
+//purpose :
+//=======================================================================
+GEOMAlgo_ClsfQuad::~GEOMAlgo_ClsfQuad()
+{
+}
+//=======================================================================
+//function : SetCorners
+//purpose :
+//=======================================================================
+void GEOMAlgo_ClsfQuad::SetCorners(const gp_Pnt &theTopLeftPoint,
+ const gp_Pnt &theTopRigthPoint,
+ const gp_Pnt &theBottomLeftPoint,
+ const gp_Pnt &theBottomRigthPoint)
+{
+ myPoints.resize(6);
+ myPoints[0] = theTopLeftPoint;
+ myPoints[1] = theTopRigthPoint;
+ myPoints[2] = theBottomRigthPoint;
+ myPoints[3] = theBottomLeftPoint;
+ myPoints[4] = myPoints[0];
+ myPoints[5] = myPoints[1];
+
+ // Find plane normal defined by corner points, it will be used to define
+ // a plane for each quadrangle side.
+ myQuadNormal.SetCoord (0., 0., 0.);
+
+ for ( int i = 1; i <= 4; ++i ) {
+ myQuadNormal +=
+ gp_Vec(myPoints[i], myPoints[i+1]) ^ gp_Vec(myPoints[i], myPoints[i-1]);
+ }
+
+ if (myQuadNormal.SquareMagnitude() <= DBL_MIN) {
+ return;
+ }
+
+ // detect concave quadrangle sides
+ myConcaveQuad = false;
+ myConcaveSide.resize (4, false);
+
+ for ( int i = 1; i <= 4; ++i ) {
+ gp_Vec localQN =
+ gp_Vec(myPoints[i], myPoints[i+1]) ^ gp_Vec(myPoints[i], myPoints[i-1]);
+
+ if (myQuadNormal * localQN < 0) {
+ myConcaveSide[i-1] = myConcaveSide[i] = myConcaveQuad = true;
+ }
+ }
+
+ // loop on quadrangle sides
+ myPlanes.reserve( 4 );
+
+ for ( int i = 0; i < 4; ++i ) {
+ // point1 -> point2 vector
+ gp_Vec aSideVec( myPoints[ i ], myPoints[ i + 1 ]);
+
+ // plane normal
+ gp_Vec aSideNorm = aSideVec ^ myQuadNormal;
+ if (aSideNorm.SquareMagnitude() <= DBL_MIN) {
+ continue;
+ }
+
+ // make plane
+ Handle(Geom_Plane) aPlane = new Geom_Plane(myPoints[i], aSideNorm);
+
+ myPlanes.push_back(GeomAdaptor_Surface());
+ myPlanes.back().Load( aPlane );
+ }
+}
+
+ //=======================================================================
+//function : GetCorners
+//purpose :
+//=======================================================================
+void GEOMAlgo_ClsfQuad::GetCorners(gp_Pnt &theTopLeftPoint,
+ gp_Pnt &theTopRigthPoint,
+ gp_Pnt &theBottomLeftPoint,
+ gp_Pnt &theBottomRigthPoint) const
+{
+ if (myPoints.size() == 6) {
+ theTopLeftPoint = myPoints[0];
+ theTopRigthPoint = myPoints[1];
+ theBottomLeftPoint = myPoints[3];
+ theBottomRigthPoint = myPoints[2];
+ }
+}
+
+//=======================================================================
+//function : CheckData
+//purpose :
+//=======================================================================
+void GEOMAlgo_ClsfQuad::CheckData()
+{
+ myErrorStatus = 0;
+
+ if (myQuadNormal.SquareMagnitude() <= DBL_MIN) {
+ myErrorStatus = 10; // undefined quadrangle normal.
+ return;
+ }
+}
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+void GEOMAlgo_ClsfQuad::Perform()
+{
+ myErrorStatus=0;
+ //
+ // Return IN if aP has TopAbs_IN with all sides.
+ // In the case of concave quadrangle, return IN if
+ // aP is OUT of only one concave side
+ double nbIn = 0.;
+
+ for (size_t i = 0; i < myPlanes.size(); ++i) {
+ TopAbs_State aSt;
+
+ GEOMAlgo_SurfaceTools::GetState(myPnt, myPlanes[i], myTolerance, aSt);
+
+ if (aSt == TopAbs_IN) {
+ nbIn += myConcaveSide[i] ? 0.5 : 1.0;
+ } else if (aSt == TopAbs_ON) {
+ // check that aP is between quadrangle corners
+ Handle(Geom_Plane) aSidePlane =
+ Handle(Geom_Plane)::DownCast(myPlanes[i].Surface());
+ gp_Vec aSideNorm = aSidePlane->Axis().Direction();
+ gp_Vec aSideVec = myQuadNormal ^ aSideNorm;
+ gp_Vec c1p (myPoints[i], myPnt);
+ gp_Vec pc2 (myPnt, myPoints[i+1]);
+
+ if (aSideVec * c1p >= 0. && aSideVec * pc2 >= 0.) {
+ myState = TopAbs_ON;
+ return;
+ }
+ // consider to be IN (???????????)
+ //nbIn += myConcaveSide[i] ? 0.5 : 1.0;
+ }
+ }
+
+ Standard_Real inThreshold = myPlanes.size(); // usually 4.0
+
+ if (myConcaveQuad) {
+ inThreshold = 2.5; // 1.0 + 1.0 + 0.5
+ }
+
+ if (nbIn >= inThreshold) {
+ myState = TopAbs_IN;
+ } else {
+ myState = TopAbs_OUT;
+ }
+}
+//=======================================================================
+//function : CanBeON
+//purpose :
+//=======================================================================
+ Standard_Boolean GEOMAlgo_ClsfQuad::CanBeON(const Handle(Geom_Curve)& aC) const
+{
+ return GEOMAlgo_Clsf::CanBeON(aC);
+}
+//=======================================================================
+//function : CanBeON
+//purpose :
+//=======================================================================
+ Standard_Boolean GEOMAlgo_ClsfQuad::CanBeON(const Handle(Geom_Surface)& aS1) const
+{
+ GeomAdaptor_Surface aGAS1;
+
+ aGAS1.Load(aS1);
+
+ GeomAbs_SurfaceType aST1 = aGAS1.GetType();
+ Standard_Boolean bRet = (aST1 == GeomAbs_Plane);
+
+ return bRet;
+}
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+// File: GEOMAlgo_ClsfQuad.hxx
+// Created: Fri Feb 13 16:03:19 2015
+// Author: Sergey KHROMOV
+//
+//
+#ifndef _GEOMAlgo_ClsfQuad_HeaderFile
+#define _GEOMAlgo_ClsfQuad_HeaderFile
+
+
+#include <GEOMAlgo_Clsf.hxx>
+
+#include <GeomAdaptor_Surface.hxx>
+#include <Standard_DefineHandle.hxx>
+
+#include <vector>
+
+
+DEFINE_STANDARD_HANDLE(GEOMAlgo_ClsfQuad, GEOMAlgo_Clsf)
+
+//=======================================================================
+// class : GEOMAlgo_ClsfQuad
+//purpose :
+//=======================================================================
+class GEOMAlgo_ClsfQuad : public GEOMAlgo_Clsf
+{
+
+public:
+
+ Standard_EXPORT
+ GEOMAlgo_ClsfQuad();
+
+ Standard_EXPORT
+ virtual ~GEOMAlgo_ClsfQuad();
+
+ Standard_EXPORT
+ void SetCorners(const gp_Pnt &theTopLeftPoint,
+ const gp_Pnt &theTopRigthPoint,
+ const gp_Pnt &theBottomLeftPoint,
+ const gp_Pnt &theBottomRigthPoint);
+
+ Standard_EXPORT
+ void GetCorners(gp_Pnt &theTopLeftPoint,
+ gp_Pnt &theTopRigthPoint,
+ gp_Pnt &theBottomLeftPoint,
+ gp_Pnt &theBottomRigthPoint) const;
+
+ Standard_EXPORT
+ virtual void Perform();
+
+ Standard_EXPORT
+ virtual void CheckData();
+
+ Standard_EXPORT
+ virtual Standard_Boolean CanBeON(const Handle(Geom_Curve)& aC) const;
+
+ Standard_EXPORT
+ virtual Standard_Boolean CanBeON(const Handle(Geom_Surface)& aST) const;
+
+ DEFINE_STANDARD_RTTI(GEOMAlgo_ClsfQuad);
+
+protected:
+
+ bool myConcaveQuad;
+ std::vector<bool> myConcaveSide;
+ std::vector<gp_Pnt> myPoints;
+ std::vector<GeomAdaptor_Surface> myPlanes;
+ gp_Vec myQuadNormal;
+
+};
+#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <BRepLib_MakeFace.hxx>
#include <BRepLib_FaceError.hxx>
-//#include <BOPTools_DSFiller.hxx>
#include <GEOMAlgo_WireSolid.hxx>
#include <GEOMAlgo_ShellSolid.hxx>
{
myErrorStatus=0;
//
- Standard_Boolean bIsDone;
Standard_Integer i, iErr;
TopAbs_State aSts[]={TopAbs_IN, TopAbs_OUT, TopAbs_ON};
TopTools_ListIteratorOfListOfShape aIt;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
aType1=myGAS.GetType();
//
TopExp::MapShapes(myShape, TopAbs_EDGE, aM);
+ //
+ bIsConformState=Standard_False;
+ //
aNb=aM.Extent();
for (i=1; i<=aNb; ++i) {
GEOMAlgo_ListOfPnt aLP;
}
}
//
+ bIsConformState=Standard_False;
+ //
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aE=aExp.Current();
const TopoDS_Shape& aSd=aM(i);
aMF.Clear();
TopExp::MapShapes(aSd, TopAbs_FACE, aMF);
+ //
+ bIsConformState=Standard_False;
+ //
aNbF=aMF.Extent();
for (j=1; j<=aNbF; ++j) {
const TopoDS_Shape& aF=aMF(j);
}// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder)
}// if (!aNb && myNbPntsMin) {
}
-//modified by NIZNHY-PKV Thu Jan 26 09:56:20 2012f
//=======================================================================
//function : InnerPoints
//purpose :
aLP.Clear();
InnerPoints(aE, aNbPntsMin, aLP);
}
-//modified by NIZNHY-PKV Thu Jan 26 09:56:32 2012t
//=======================================================================
//function : InnerPoints
//purpose :
return;
}
//
- //modified by NIZNHY-PKV Thu Jan 26 09:51:20 2012f
- /*
- aNbT=myNbPntsMin+1;
- dT=(aT2-aT1)/aNbT;
- for (j=1; j<=aNbPntsMin; ++j) {
- aT=aT1+j*dT;
- aC3D->D0(aT, aP);
- aLP.Append(aP);
- }
- */
aNbT=aNbPntsMin+1;
dT=(aT2-aT1)/aNbT;
for (j=1; j<aNbT; ++j) {
aC3D->D0(aT, aP);
aLP.Append(aP);
}
- //modified by NIZNHY-PKV Thu Jan 26 09:51:24 2012t
}
//=======================================================================
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// <pkv@irinox>
//
#include <GEOMAlgo_FinderShapeOn2.hxx>
-#include <math.h>
-
-#include <Basics_OCCTVersion.hxx>
-
-#include <Precision.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <TColStd_MapOfInteger.hxx>
+#include <GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx>
+#include <GEOMAlgo_DataMapOfPassKeyInteger.hxx>
+#include <GEOMAlgo_ListIteratorOfListOfPnt.hxx>
+#include <GEOMAlgo_PassKey.hxx>
+#include <GEOMAlgo_StateCollector.hxx>
+#include <GEOMAlgo_SurfaceTools.hxx>
-#include <gp_Trsf.hxx>
-#include <gp_Cylinder.hxx>
+#include <Bnd_Box.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepBndLib.hxx>
+#include <BRepMesh_IncrementalMesh.hxx>
+#include <BRepTools.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_Surface.hxx>
+#include <Geom2d_Line.hxx>
+#include <Geom2dAdaptor_Curve.hxx>
+#include <Geom2dHatch_Hatcher.hxx>
+#include <gp_Dir2d.hxx>
+#include <gp_Pnt2d.hxx>
#include <gp_Pnt.hxx>
-
-#include <TColgp_Array1OfPnt.hxx>
-
+#include <gp_Trsf.hxx>
+#include <HatchGen_Domain.hxx>
+#include <IntTools_Tools.hxx>
#include <Poly_Array1OfTriangle.hxx>
-#include <Poly_Triangle.hxx>
+#include <Poly_Polygon3D.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
+#include <Poly_Triangle.hxx>
#include <Poly_Triangulation.hxx>
-#include <Poly_Polygon3D.hxx>
-
-#include <Geom_Curve.hxx>
-#include <Geom_Surface.hxx>
-#include <GeomAdaptor_Surface.hxx>
-#include <GeomAbs_SurfaceType.hxx>
-#include <GeomAdaptor_Curve.hxx>
-#include <GeomAbs_CurveType.hxx>
-
+#include <Precision.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
#include <TopAbs_State.hxx>
-
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Edge.hxx>
-
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-
#include <TopTools_IndexedMapOfShape.hxx>
-#include <BRep_Tool.hxx>
-#include <BRepLib_MakeEdge.hxx>
-
-#include <GEOMAlgo_ListIteratorOfListOfPnt.hxx>
-#include <GEOMAlgo_SurfaceTools.hxx>
-#include <GEOMAlgo_StateCollector.hxx>
-#include <GEOMAlgo_FinderShapeOn.hxx>
-
-#include <GEOMAlgo_PassKey.hxx>
-#include <GEOMAlgo_DataMapOfPassKeyInteger.hxx>
-#include <GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx>
-//
-#include <gp_Dir2d.hxx>
-#include <gp_Pnt2d.hxx>
-#include <Geom2d_Line.hxx>
-#include <Geom2dAdaptor_Curve.hxx>
-#include <Geom2dHatch_Hatcher.hxx>
-#include <TColStd_ListOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <HatchGen_Domain.hxx>
-#include <Geom2dHatch_Hatcher.hxx>
#if OCC_VERSION_LARGE > 0x06070100
#include <IntTools_Context.hxx>
#else
#include <BOPInt_Context.hxx>
#endif
-#include <BRepTools.hxx>
-#include <IntTools_Tools.hxx>
//=======================================================================
//function :
//
const TopoDS_Edge& aE=TopoDS::Edge(aM(i));
//
+ bIsConformState=Standard_False;
+ //
aExp.Init(aE, TopAbs_VERTEX);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aV=aExp.Current();
}
}
//
+ //
+ bIsConformState=Standard_False;
+ //
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aE=aExp.Current();
const TopoDS_Shape& aSd=aM(i);
aMF.Clear();
TopExp::MapShapes(aSd, TopAbs_FACE, aMF);
+ //
+ bIsConformState=Standard_False;
+ //
aNbF=aMF.Extent();
for (j=1; j<=aNbF; ++j) {
const TopoDS_Shape& aF=aMF(j);
//
aTRF=BRep_Tool::Triangulation(aF, aLoc);
if (aTRF.IsNull()) {
- if (!GEOMAlgo_FinderShapeOn::BuildTriangulation(aF)) {
+ if (!BuildTriangulation(aF)) {
myWarningStatus=20; // no triangulation found
return;
}
if (aTRE.IsNull() || aPTE.IsNull()) {
Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(aE, aLoc);
if (aPE.IsNull()) {
- if (!GEOMAlgo_FinderShapeOn::BuildTriangulation(aE)) {
+ if (!BuildTriangulation(aE)) {
myErrorStatus=20; // no triangulation found
return;
}
}
}
+//=======================================================================
+//function : BuildTriangulation
+//purpose :
+//=======================================================================
+Standard_Boolean
+ GEOMAlgo_FinderShapeOn2::BuildTriangulation (const TopoDS_Shape& theShape)
+{
+ // calculate deflection
+ Standard_Real aDeviationCoefficient = 0.001;
+
+ Bnd_Box B;
+ BRepBndLib::Add(theShape, B);
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+
+ Standard_Real dx = aXmax - aXmin, dy = aYmax - aYmin, dz = aZmax - aZmin;
+ Standard_Real aDeflection = Max(Max(dx, dy), dz) * aDeviationCoefficient * 4;
+ Standard_Real aHLRAngle = 0.349066;
+
+ // build triangulation
+ BRepMesh_IncrementalMesh Inc (theShape, aDeflection, Standard_False, aHLRAngle);
+
+ // check triangulation
+ bool isTriangulation = true;
+
+ TopExp_Explorer exp (theShape, TopAbs_FACE);
+ if (exp.More())
+ {
+ TopLoc_Location aTopLoc;
+ Handle(Poly_Triangulation) aTRF;
+ aTRF = BRep_Tool::Triangulation(TopoDS::Face(exp.Current()), aTopLoc);
+ if (aTRF.IsNull()) {
+ isTriangulation = false;
+ }
+ }
+ else // no faces, try edges
+ {
+ TopExp_Explorer expe (theShape, TopAbs_EDGE);
+ if (!expe.More()) {
+ isTriangulation = false;
+ }
+ else {
+ TopLoc_Location aLoc;
+ Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(TopoDS::Edge(expe.Current()), aLoc);
+ if (aPE.IsNull()) {
+ isTriangulation = false;
+ }
+ }
+ }
+
+ return isTriangulation;
+}
+
//
// myErrorStatus :
//
// 40- point can not be classified
// 41- invalid data for classifier
// 42- can not compute hatching
-
-/*
-// A
-if (!aNb && myNbPntsMin) {
- // try to fill it yourself
- Standard_Boolean bIsDone;
- Standard_Integer aN1, aN2;
- Handle(Geom_Surface) aS;
- GeomAdaptor_Surface aGAS;
- GeomAbs_SurfaceType aType;
- //
- aS=BRep_Tool::Surface(aF);
- aGAS.Load(aS);
- aType=aGAS.GetType();
- if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) {
- // inner links
- aNbLinks=aMPKI.Extent();
- aIt.Initialize(aMPKI);
- for (; aIt.More(); aIt.Next()) {
- iCnt=aIt.Value();
- if (iCnt>1) {
- // take the first having occured inner link
- // and discretize it
- const GEOMAlgo_PassKey& aPK=aIt.Key();
- //
- aN1=(Standard_Integer)aPK.Id(1);
- aN2=(Standard_Integer)aPK.Id(2);
- //
- aP1=aNodes(aN1).Transformed(aTrsf);
- aP2=aNodes(aN2).Transformed(aTrsf);
- //
- if (aType==GeomAbs_Cylinder) {
- gp_Cylinder aCyl;
- //
- aCyl=aGAS.Cylinder();
- if (!GEOMAlgo_SurfaceTools::IsCoaxial(aP1, aP2, aCyl, myTolerance)) {
- continue;
- }
- }
- //
- BRepLib_MakeEdge aBME(aP1, aP2);
- bIsDone=aBME.IsDone();
- if (!bIsDone) {
- myErrorStatus=30; //can not obtain the line fron the link
- return;
- }
- //
- const TopoDS_Shape& aSx=aBME.Shape();
- const TopoDS_Edge& aE=TopoDS::Edge(aSx);
- //
- InnerPoints(aE, myNbPntsMin, aLP);
- break;
- }// if (iCnt>1)
- }// for (; aIt.More(); aIt.Next())
- }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder)
- }// if (!aNb && myNbPntsMin) {
-*/
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
const Standard_Integer aNbPnts,
GEOMAlgo_ListOfPnt& aLP) ;
+ Standard_EXPORT
+ Standard_Boolean BuildTriangulation(const TopoDS_Shape& aS) ;
+
TopAbs_ShapeEnum myShapeType;
GEOMAlgo_State myState;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+// File: GEOMAlgo_GetInPlaceAPI.cxx
+// Created:
+// Author: Sergey KHROMOV
+
+
+#include <GEOMAlgo_GetInPlaceAPI.hxx>
+#include <GEOMAlgo_GetInPlace.hxx>
+#include <GEOM_Function.hxx>
+#include <GEOM_Object.hxx>
+#include <GEOMUtils.hxx>
+
+#include <Bnd_Box.hxx>
+#include <BRepAdaptor_Surface.hxx>
+#include <BRepBndLib.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepExtrema_DistShapeShape.hxx>
+#include <BRepGProp.hxx>
+#include <BRep_Tool.hxx>
+#include <Geom2d_Curve.hxx>
+#include <GProp_GProps.hxx>
+#include <gp_Pnt.hxx>
+#include <Precision.hxx>
+#include <TDataStd_IntegerArray.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopTools_MapOfShape.hxx>
+
+
+//=======================================================================
+//function : GetInPlace
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMAlgo_GetInPlaceAPI::GetInPlace
+ (const TopoDS_Shape &theWhere,
+ const TopoDS_Shape &theWhat,
+ GEOMAlgo_GetInPlace &theGIP)
+{
+ if (theWhere.IsNull() || theWhat.IsNull()) {
+ return Standard_False;
+ }
+
+ // Compute confusion tolerance.
+ Standard_Real aTolConf = Precision::Confusion();
+ Standard_Integer i;
+
+ for (i = 0; i < 2; ++i) {
+ TopExp_Explorer anExp(i == 0 ? theWhere : theWhat, TopAbs_VERTEX);
+
+ for (; anExp.More(); anExp.Next()) {
+ const TopoDS_Vertex aVtx = TopoDS::Vertex(anExp.Current());
+ const Standard_Real aTolVtx = BRep_Tool::Tolerance(aVtx);
+
+ if (aTolVtx > aTolConf) {
+ aTolConf = aTolVtx;
+ }
+ }
+ }
+
+ // Compute mass tolerance.
+ Bnd_Box aBoundingBox;
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ Standard_Real aMassTol;
+
+ BRepBndLib::Add(theWhere, aBoundingBox);
+ BRepBndLib::Add(theWhat, aBoundingBox);
+ aBoundingBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ aMassTol = Max(aXmax - aXmin, aYmax - aYmin);
+ aMassTol = Max(aMassTol, aZmax - aZmin);
+ aMassTol *= aTolConf;
+
+ // Searching for the sub-shapes inside the ShapeWhere shape
+ theGIP.SetTolerance(aTolConf);
+ theGIP.SetTolMass(aMassTol);
+ theGIP.SetTolCG(aTolConf);
+
+ theGIP.SetArgument(theWhat);
+ theGIP.SetShapeWhere(theWhere);
+
+ theGIP.Perform();
+
+ int iErr = theGIP.ErrorStatus();
+
+ if (iErr) {
+ return Standard_False;
+ }
+
+ return Standard_True;
+}
+
+//=======================================================================
+//function : GetInPlaceOld
+//purpose :
+//=======================================================================
+Standard_Integer GEOMAlgo_GetInPlaceAPI::GetInPlaceOld
+ (const TopoDS_Shape &theWhere,
+ const TopoDS_Shape &theWhat,
+ TopTools_ListOfShape &theShapesInPlace)
+{
+ theShapesInPlace.Clear();
+
+ if (theWhere.IsNull() || theWhat.IsNull()) {
+ // Error: aWhere and aWhat TopoDS_Shape are Null.
+ return 1;
+ }
+
+ // Check shape type.
+ TopAbs_ShapeEnum iType = GEOMUtils::GetTypeOfSimplePart(theWhat);
+
+ if (iType == TopAbs_SHAPE) {
+ // Error: An attempt to extract a shape of not supported type.
+ return 2;
+ }
+
+ // Compute confusion tolerance.
+ Standard_Real aTolConf = Precision::Confusion();
+ Standard_Integer i;
+
+ for (i = 0; i < 2; ++i) {
+ TopExp_Explorer anExp(i == 0 ? theWhere : theWhat, TopAbs_VERTEX);
+
+ for (; anExp.More(); anExp.Next()) {
+ const TopoDS_Vertex aVtx = TopoDS::Vertex(anExp.Current());
+ const Standard_Real aTolVtx = BRep_Tool::Tolerance(aVtx);
+
+ if (aTolVtx > aTolConf) {
+ aTolConf = aTolVtx;
+ }
+ }
+ }
+
+ // Compute mass tolerance.
+ Bnd_Box aBoundingBox;
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ Standard_Real aMassTol;
+
+ BRepBndLib::Add(theWhere, aBoundingBox);
+ BRepBndLib::Add(theWhat, aBoundingBox);
+ aBoundingBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ aMassTol = Max(aXmax - aXmin, aYmax - aYmin);
+ aMassTol = Max(aMassTol, aZmax - aZmin);
+ aMassTol *= aTolConf;
+
+ // Compute the result.
+ TopExp_Explorer Exp_aWhat (theWhat, iType);
+ TopExp_Explorer Exp_aWhere (theWhere, iType);
+ Standard_Real tab_aWhat[4], tab_aWhere[4];
+ gp_Pnt aPnt, aPnt_aWhat;
+ TopoDS_Shape aPntShape;
+ TopoDS_Vertex aVertex;
+ bool isFound = false;
+ TopTools_MapOfShape map_aWhere;
+
+ for (; Exp_aWhere.More(); Exp_aWhere.Next()) {
+ if (!map_aWhere.Add(Exp_aWhere.Current()))
+ continue; // skip repeated shape to avoid mass addition
+ GetShapeProperties( Exp_aWhere.Current(), tab_aWhere, aPnt );
+ for ( Exp_aWhat.ReInit(); Exp_aWhat.More(); Exp_aWhat.Next() ) {
+ GetShapeProperties( Exp_aWhat.Current(), tab_aWhat, aPnt_aWhat );
+ if (fabs(tab_aWhat[3] - tab_aWhere[3]) <= aMassTol && aPnt_aWhat.Distance(aPnt) <= aTolConf)
+ isFound = true;
+ else {
+ if (tab_aWhat[3] > tab_aWhere[3]) {
+ aPntShape = BRepBuilderAPI_MakeVertex( aPnt ).Shape();
+ aVertex = TopoDS::Vertex( aPntShape );
+ BRepExtrema_DistShapeShape aWhereDistance ( aVertex, Exp_aWhere.Current() );
+ BRepExtrema_DistShapeShape aWhatDistance ( aVertex, Exp_aWhat.Current() );
+ if (aWhereDistance.IsDone() && aWhatDistance.IsDone() &&
+ fabs(aWhereDistance.Value() - aWhatDistance.Value()) <= aTolConf)
+ {
+ // 0020162: "EDF 961 GEOM : Getinplace is getting additionnal orthogonal faces"
+ // aVertex must be projected to the same point on Where and on What
+ gp_Pnt pOnWhat = aWhatDistance.PointOnShape2(1);
+ gp_Pnt pOnWhere = aWhereDistance.PointOnShape2(1);
+ isFound = (pOnWhat.Distance(pOnWhere) <= aTolConf);
+ if ( isFound && iType == TopAbs_FACE )
+ {
+ // check normals at pOnWhat and pOnWhere
+ const double angleTol = M_PI/180.;
+ gp_Vec normToWhat = GetNormal( TopoDS::Face(Exp_aWhat.Current()), aWhatDistance);
+ gp_Vec normToWhere = GetNormal( TopoDS::Face(Exp_aWhere.Current()), aWhereDistance);
+ if ( normToWhat * normToWhere < 0 )
+ normToWhat.Reverse();
+ isFound = ( normToWhat.Angle( normToWhere ) < angleTol );
+ }
+ }
+ }
+ }
+ if ( isFound ) {
+ theShapesInPlace.Append(Exp_aWhere.Current());
+ //aWhere_Mass += tab_aWhere[3];
+ isFound = false;
+ break;
+ }
+ }
+ }
+
+ if (theShapesInPlace.Extent() == 0) {
+ // Not found any Results
+ return 3;
+ }
+
+ return 0;
+}
+
+//=======================================================================
+//function : GetNormal
+//purpose :
+//=======================================================================
+gp_Vec GEOMAlgo_GetInPlaceAPI::GetNormal
+ (const TopoDS_Face &theFace,
+ const BRepExtrema_DistShapeShape &theExtrema)
+{
+ gp_Vec defaultNorm(1,0,0); // to have same normals on different faces
+ try {
+ // get UV at extrema point
+ Standard_Real u,v, f,l;
+ switch ( theExtrema.SupportTypeShape2(1) ) {
+ case BRepExtrema_IsInFace: {
+ theExtrema.ParOnFaceS2(1, u, v );
+ break;
+ }
+ case BRepExtrema_IsOnEdge: {
+ TopoDS_Edge edge = TopoDS::Edge( theExtrema.SupportOnShape2(1));
+ Handle(Geom2d_Curve) pcurve =
+ BRep_Tool::CurveOnSurface(edge, theFace, f,l);
+
+ theExtrema.ParOnEdgeS2( 1, u );
+ gp_Pnt2d uv = pcurve->Value( u );
+ u = uv.Coord(1);
+ v = uv.Coord(2);
+ break;
+ }
+ case BRepExtrema_IsVertex: return defaultNorm;
+ }
+ // get derivatives
+ BRepAdaptor_Surface surface( theFace, false );
+ gp_Vec du, dv; gp_Pnt p;
+ surface.D1( u, v, p, du, dv );
+
+ return du ^ dv;
+
+ } catch (Standard_Failure ) {
+ }
+ return defaultNorm;
+}
+
+//=======================================================================
+//function : GetShapeProperties
+//purpose :
+//=======================================================================
+void GEOMAlgo_GetInPlaceAPI::GetShapeProperties(const TopoDS_Shape &theShape,
+ Standard_Real theTab[],
+ gp_Pnt &theVertex)
+{
+ GProp_GProps aProps;
+ gp_Pnt aCenterMass;
+ Standard_Real aShapeSize;
+
+ if (theShape.ShapeType() == TopAbs_VERTEX) {
+ aCenterMass = BRep_Tool::Pnt(TopoDS::Vertex(theShape));
+ } else if (theShape.ShapeType() == TopAbs_EDGE) {
+ BRepGProp::LinearProperties(theShape, aProps);
+ } else if (theShape.ShapeType() == TopAbs_FACE) {
+ BRepGProp::SurfaceProperties(theShape, aProps);
+ } else {
+ BRepGProp::VolumeProperties(theShape, aProps);
+ }
+
+ if (theShape.ShapeType() == TopAbs_VERTEX) {
+ aShapeSize = 1;
+ } else {
+ aCenterMass = aProps.CentreOfMass();
+ aShapeSize = aProps.Mass();
+ }
+
+ theVertex = aCenterMass;
+ theTab[0] = theVertex.X();
+ theTab[1] = theVertex.Y();
+ theTab[2] = theVertex.Z();
+ theTab[3] = aShapeSize;
+}
+
+//=======================================================================
+//function : GetInPlaceByHistory
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMAlgo_GetInPlaceAPI::GetInPlaceByHistory
+ (const Handle(GEOM_Function) &theWhereFunction,
+ const TopTools_IndexedMapOfShape &theWhereIndices,
+ const TopoDS_Shape &theWhat,
+ TopTools_ListOfShape &theShapesInPlace)
+{
+ if (theWhereFunction.IsNull() || theWhat.IsNull())
+ return Standard_False;
+
+ if (theWhereIndices.Contains(theWhat)) {
+ // entity was not changed by the operation
+ theShapesInPlace.Append(theWhat);
+
+ return Standard_True;
+ }
+
+ // try to find in history
+ TDF_Label aHistoryLabel = theWhereFunction->GetHistoryEntry(Standard_False);
+
+ // search in history for all argument shapes
+ Standard_Boolean isFound = Standard_False;
+ Standard_Boolean isGood = Standard_False;
+
+ TDF_LabelSequence aLabelSeq;
+ theWhereFunction->GetDependency(aLabelSeq);
+ Standard_Integer nbArg = aLabelSeq.Length();
+
+ for (Standard_Integer iarg = 1; iarg <= nbArg && !isFound; iarg++) {
+
+ TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg);
+
+ Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
+ TopoDS_Shape anArgumentShape = anArgumentObject->GetValue();
+
+ TopTools_IndexedMapOfShape anArgumentIndices;
+ TopExp::MapShapes(anArgumentShape, anArgumentIndices);
+
+ if (anArgumentIndices.Contains(theWhat)) {
+ isFound = Standard_True;
+ Standard_Integer aWhatIndex = anArgumentIndices.FindIndex(theWhat);
+
+ // Find corresponding label in history
+ TDF_Label anArgumentHistoryLabel =
+ theWhereFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_False);
+ if (anArgumentHistoryLabel.IsNull()) {
+ // Lost History of operation argument. Possibly, all its entities was removed.
+ isGood = Standard_True;
+ }
+ else {
+ TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(aWhatIndex, Standard_False);
+
+ if (aWhatHistoryLabel.IsNull()) {
+ // Removed entity ? Compound ? Compsolid ? Shell ? Wire
+ isGood = Standard_False;
+ } else {
+ Handle(TDataStd_IntegerArray) anIntegerArray;
+ if (!aWhatHistoryLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anIntegerArray)) {
+ //Error: Empty modifications history for the sought shape.
+ isGood = Standard_False;
+ }
+ else {
+ isGood = Standard_True;
+ Standard_Integer imod, aModifLen = anIntegerArray->Array()->Length();
+ for (imod = 1; imod <= aModifLen; imod++) {
+ const Standard_Integer anIndex =
+ anIntegerArray->Array()->Value(imod);
+
+ theShapesInPlace.Append(theWhereIndices.FindKey(anIndex));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ isFound = isGood;
+
+ if (!isFound) {
+ // try compound/compsolid/shell/wire element by element
+ Standard_Boolean isFoundAny = Standard_False;
+ TopTools_MapOfShape mapShape;
+
+ if (theWhat.ShapeType() == TopAbs_COMPOUND ||
+ theWhat.ShapeType() == TopAbs_COMPSOLID) {
+ // recursive processing of compound/compsolid
+ TopoDS_Iterator anIt (theWhat, Standard_True, Standard_True);
+ for (; anIt.More(); anIt.Next()) {
+ if (mapShape.Add(anIt.Value())) {
+ TopoDS_Shape curWhat = anIt.Value();
+ isFoundAny = GetInPlaceByHistory(theWhereFunction, theWhereIndices, curWhat, theShapesInPlace);
+ if (isFoundAny) isFound = Standard_True;
+ }
+ }
+ }
+ else if (theWhat.ShapeType() == TopAbs_SHELL) {
+ // try to replace a shell by its faces images
+ TopExp_Explorer anExp (theWhat, TopAbs_FACE);
+ for (; anExp.More(); anExp.Next()) {
+ if (mapShape.Add(anExp.Current())) {
+ TopoDS_Shape curWhat = anExp.Current();
+ isFoundAny = GetInPlaceByHistory(theWhereFunction, theWhereIndices, curWhat, theShapesInPlace);
+ if (isFoundAny) isFound = Standard_True;
+ }
+ }
+ }
+ else if (theWhat.ShapeType() == TopAbs_WIRE) {
+ // try to replace a wire by its edges images
+ TopExp_Explorer anExp (theWhat, TopAbs_EDGE);
+ for (; anExp.More(); anExp.Next()) {
+ if (mapShape.Add(anExp.Current())) {
+ TopoDS_Shape curWhat = anExp.Current();
+ isFoundAny = GetInPlaceByHistory(theWhereFunction, theWhereIndices, curWhat, theShapesInPlace);
+ if (isFoundAny) isFound = Standard_True;
+ }
+ }
+ }
+ else {
+ // Removed entity
+ }
+ }
+
+ return isFound;
+}
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+// File: GEOMAlgo_GetInPlaceAPI.hxx
+// Created:
+// Author: Sergey KHROMOV
+
+#ifndef _GEOMAlgo_GetInPlaceAPI_HeaderFile
+#define _GEOMAlgo_GetInPlaceAPI_HeaderFile
+
+
+#include <gp_Vec.hxx>
+
+class GEOMAlgo_GetInPlace;
+class Handle_GEOM_Function;
+class BRepExtrema_DistShapeShape;
+class TopoDS_Face;
+class TopoDS_Shape;
+class TopTools_IndexedMapOfShape;
+class TopTools_ListOfShape;
+
+
+/**
+ * This is an API class for all GetInPlace algorithm.
+ * It facilitates using different GetInPlace algorithms:
+ * a new one(GEOMAlgo_GetInPlace), an old one and
+ * GetInPlaceByHistory.
+ */
+class GEOMAlgo_GetInPlaceAPI
+{
+
+public:
+
+ /**
+ * \brief New GetInPlace method implementation.
+ * Initializes the GEOMAlgo_GetInPlace object with correct parameters and
+ * performs computation (calls theGIP's method Perform. Returns
+ * Standard_True in face of success; Standard_False otherwise.
+ */
+ Standard_EXPORT static Standard_Boolean GetInPlace
+ (const TopoDS_Shape &theWhere,
+ const TopoDS_Shape &theWhat,
+ GEOMAlgo_GetInPlace &theGIP);
+
+ /*!
+ * \brief Old implementation of GetInPlace algoritm.
+ * This method searches among sub shapes of the shape theWhere parts that are
+ * coincident with the shape theWhat. The result list of shape is returned as
+ * an output parameter. It returns the error code with the following possible
+ * values:
+ * 0 - Success;
+ * 1 - theWhere and/or theWhat TopoDS_Shape are Null;
+ * 2 - An attempt to extract a shape of not supported type;
+ * 3 - Not found any Results.
+ */
+ Standard_EXPORT static Standard_Integer GetInPlaceOld
+ (const TopoDS_Shape &theWhere,
+ const TopoDS_Shape &theWhat,
+ TopTools_ListOfShape &theShapesInPlace);
+
+
+ /**
+ * \brief GetInPlaceByHistory method implementation.
+ * Returns Standard_True if something is found. Warning: theShapesInPlace
+ * list is not cleared at first.
+ */
+ Standard_EXPORT static Standard_Boolean GetInPlaceByHistory
+ (const Handle_GEOM_Function &theWhereFunction,
+ const TopTools_IndexedMapOfShape &theWhereIndices,
+ const TopoDS_Shape &theWhat,
+ TopTools_ListOfShape &theShapesInPlace);
+
+protected:
+
+ /*!
+ * \brief Return normal to face at extrema point
+ */
+ static gp_Vec GetNormal(const TopoDS_Face &theFace,
+ const BRepExtrema_DistShapeShape &theExtrema);
+
+ /*!
+ * Return the global properties of the shape: center of mass and
+ * a size (length, area or volume depending on the shape type).
+ */
+ static void GetShapeProperties(const TopoDS_Shape &theShape,
+ Standard_Real theTab[],
+ gp_Pnt &theVertex);
+
+};
+
+
+
+#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
gp_Pnt aPx;
gp_Pnt2d aP2Dx;
gp_Vec aDNx;
-
TopoDS_Face aF;
TopExp_Explorer aExp;
//
aCoef=10.;
//
aExp.Init (aZ, TopAbs_FACE);
- for (; aExp.More() ; aExp.Next()) {
+ if (aExp.More()) {
aF=*((TopoDS_Face*)&aExp.Current());
- break;
}
//
iErr=PntInFace(aF, aPx, aP2Dx);
//
// 4.
aNbDomains=aHatcher.NbDomains(aIx);
- for (i=1; i<=aNbDomains; ++i) {
- const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
- bHasFirstPoint=aDomain.HasFirstPoint();
- if (!bHasFirstPoint) {
- iErr=5;
- return iErr;
- }
- //
- aV1=aDomain.FirstPoint().Parameter();
- //
- bHasSecondPoint=aDomain.HasSecondPoint();
- if (!bHasSecondPoint) {
- iErr=6;
- return iErr;
- }
- //
- aV2=aDomain.SecondPoint().Parameter();
- //
- aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
- //
- break;
+ if (!aNbDomains) {
+ iErr=5;
+ return iErr;
+ }
+ //
+ i=1;
+ const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
+ bHasFirstPoint=aDomain.HasFirstPoint();
+ if (!bHasFirstPoint) {
+ iErr=5;
+ return iErr;
+ }
+ //
+ aV1=aDomain.FirstPoint().Parameter();
+ //
+ bHasSecondPoint=aDomain.HasSecondPoint();
+ if (!bHasSecondPoint) {
+ iErr=6;
+ return iErr;
}
//
+ aV2=aDomain.SecondPoint().Parameter();
+ //
+ aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
+ //
aS->D0(aUx, aVx, aPx);
//
theP2D.SetCoord(aUx, aVx);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//=======================================================================
GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector()
{}
-//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f
//=======================================================================
//function : StickedShapes
//purpose :
{
return myStickedShapes;
}
-//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t
//=======================================================================
//function : Perform
//purpose :
return;
}
//
- //modified by NIZNHY-PKV Wed Mar 14 08:00:09 2012f
CheckDetected();
if (myErrorStatus) {
return;
}
- //modified by NIZNHY-PKV Wed Mar 14 08:00:12 2012t
//
DetectEdges();
if (myErrorStatus) {
TColStd_MapIteratorOfMapOfInteger aIt1;
//
aMIP.Add(i);
- while(1) {
+ for(;;) {
aNbIP=aMIP.Extent();
aIt1.Initialize(aMIP);
for(; aIt1.More(); aIt1.Next()) {
//
aPK.SetShapes(aLV);
}
-//modified by NIZNHY-PKV Tue Mar 13 09:54:18 2012f
//=======================================================================
//function : CheckDetected
//purpose :
//
return iRet;
}
-//modified by NIZNHY-PKV Tue Mar 13 09:54:59 2012t
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// File: GEOMAlgo_Gluer.cxx
-// Created: Sat Dec 04 12:45:53 2004
-// Author: Peter KURNEV
-// <peter@PREFEX>
+// File: GEOMAlgo_Gluer.cxx
+// Created: Sat Dec 04 12:45:53 2004
+// Author: Peter KURNEV
+// <peter@PREFEX>
//
#include <GEOMAlgo_Gluer.hxx>
//
static
void GetSubShapes(const TopoDS_Shape& aS,
- TopTools_IndexedMapOfShape& aMSS);
+ TopTools_IndexedMapOfShape& aMSS);
//=======================================================================
//function : GEOMAlgo_Gluer
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
TopTools_DataMapOfShapeListOfShape aMVV;
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
- //modified by NIZNHY-PKV Thu Jan 21 10:03:07 2010f
- //GEOMAlgo_IndexedDataMapOfShapeBox aMSB;
GEOMAlgo_IndexedDataMapOfShapeBndSphere aMSB;
- //modified by NIZNHY-PKV Thu Jan 21 10:03:10 2010t
//
GEOMAlgo_BndSphereTreeSelector aSelector;
GEOMAlgo_BndSphereTree aBBTree;
TColStd_MapIteratorOfMapOfInteger aIt1;
//
aMIP.Add(i);
- while(1) {
+ for(;;) {
aNbIP=aMIP.Extent();
aIt1.Initialize(aMIP);
for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- if (aMIPC.Contains(aIP)) {
- continue;
- }
- //
- const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
- //modified by NIZNHY-PKV Thu Jan 21 10:04:09 2010f
- const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
- //const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP);
- //modified by NIZNHY-PKV Thu Jan 21 10:04:11 2010t
- //
- aSelector.Clear();
- aSelector.SetBox(aBoxVP);
- //
- aNbVSD=aBBTree.Select(aSelector);
- if (!aNbVSD) {
- continue; // it must not be
- }
- //
- const TColStd_ListOfInteger& aLI=aSelector.Indices();
- //
- aIt.Initialize(aLI);
- for (; aIt.More(); aIt.Next()) {
- aIP1=aIt.Value();
- if (aMIP.Contains(aIP1)) {
- continue;
- }
- aMIP1.Add(aIP1);
- } //for (; aIt.More(); aIt.Next()) {
+ aIP=aIt1.Key();
+ if (aMIPC.Contains(aIP)) {
+ continue;
+ }
+ //
+ const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
+ const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
+ //
+ aSelector.Clear();
+ aSelector.SetBox(aBoxVP);
+ //
+ aNbVSD=aBBTree.Select(aSelector);
+ if (!aNbVSD) {
+ continue; // it must not be
+ }
+ //
+ const TColStd_ListOfInteger& aLI=aSelector.Indices();
+ //
+ aIt.Initialize(aLI);
+ for (; aIt.More(); aIt.Next()) {
+ aIP1=aIt.Value();
+ if (aMIP.Contains(aIP1)) {
+ continue;
+ }
+ aMIP1.Add(aIP1);
+ } //for (; aIt.More(); aIt.Next()) {
}//for(; aIt1.More(); aIt1.Next()) {
//
aNbIP1=aMIP1.Extent();
if (!aNbIP1) {
- break;
+ break;
}
//
aIt1.Initialize(aMIP);
for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- aMIPC.Add(aIP);
+ aIP=aIt1.Key();
+ aMIPC.Add(aIP);
}
//
aMIP.Clear();
aIt1.Initialize(aMIP1);
for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- aMIP.Add(aIP);
+ aIP=aIt1.Key();
+ aMIP.Add(aIP);
}
aMIP1.Clear();
}// while(1)
else { // SD vertices founded [ aMIPC ]
aIt1.Initialize(aMIPC);
for(j=0; aIt1.More(); aIt1.Next(), ++j) {
- aIP=aIt1.Key();
- const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
- if (!j) {
- aVF=aVP;
- }
- aLVSD.Append(aVP);
- aMVProcessed.Add(aVP);
+ aIP=aIt1.Key();
+ const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
+ if (!j) {
+ aVF=aVP;
+ }
+ aLVSD.Append(aVP);
+ aMVProcessed.Add(aVP);
}
}
myImages.Bind(aVF, aLVSD);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aVSD=aItS.Value();
if (!myOrigins.IsBound(aVSD)) {
- myOrigins.Bind(aVSD, aV);
+ myOrigins.Bind(aVSD, aV);
}
}
}
aER.Orientation(TopAbs_FORWARD);
if (!BRep_Tool::Degenerated(aER)) {
// orient image
- Standard_Boolean bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
+ Standard_Boolean bIsToReverse=
+ GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
if (bIsToReverse) {
aER.Reverse();
}
aBB.Add(theResult, aShapeR);
}
}
- else
- {
+ else {
if (myKeepNonSolids) {
// just add image
const TopoDS_Shape& aShapeR = myOrigins.Find(theShape);
const TopoDS_Face& aF=TopoDS::Face(aExp.Current());
aFR=TopoDS::Face(myOrigins.Find(aF));
if (aFR.IsSame(aF)) {
- aBB.Add(aNewShell, aF);
- continue;
+ aBB.Add(aNewShell, aF);
+ continue;
}
bIsToReverse=IsToReverse(aFR, aF);
if (bIsToReverse) {
- aFR.Reverse();
+ aFR.Reverse();
}
aBB.Add(aNewShell, aFR);
}
if (aNbSDF==1) {
bHasNewSubShape=HasNewSubShape(aS1);
if (!bHasNewSubShape) {
- aNewShape=aS1;
- aNewShape.Orientation(TopAbs_FORWARD);
+ aNewShape=aS1;
+ aNewShape.Orientation(TopAbs_FORWARD);
}
}
//
if (bHasNewSubShape) {
if (aType==TopAbs_FACE) {
- TopoDS_Face aNewFace;
- //
- const TopoDS_Face& aF1=TopoDS::Face(aS1);
- MakeFace(aF1, aNewFace);
- aNewShape=aNewFace;
+ TopoDS_Face aNewFace;
+ //
+ const TopoDS_Face& aF1=TopoDS::Face(aS1);
+ MakeFace(aF1, aNewFace);
+ aNewShape=aNewFace;
}
else if (aType==TopAbs_EDGE) {
- TopoDS_Edge aNewEdge;
- //
- const TopoDS_Edge& aE1=TopoDS::Edge(aS1);
- MakeEdge(aE1, aNewEdge);
- aNewShape=aNewEdge;
+ TopoDS_Edge aNewEdge;
+ //
+ const TopoDS_Edge& aE1=TopoDS::Edge(aS1);
+ MakeEdge(aE1, aNewEdge);
+ aNewShape=aNewEdge;
}
}
//
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aFSD=aItS.Value();
if (!myOrigins.IsBound(aFSD)) {
- myOrigins.Bind(aFSD, aNewShape);
+ myOrigins.Bind(aFSD, aNewShape);
}
}
}
for (j=1; j<=aNbFS; ++j) {
const TopoDS_Shape& aFS=aMFS(j);
if (aMFR.Contains(aFS)) {
- const TopTools_ListOfShape& aLSx=aMFR.FindFromKey(aFS);
- aNbSx=aLSx.Extent();
- if (aNbSx==2) {
- bFound=!bFound;
- break;
- }
+ const TopTools_ListOfShape& aLSx=aMFR.FindFromKey(aFS);
+ aNbSx=aLSx.Extent();
+ if (aNbSx==2) {
+ bFound=!bFound;
+ break;
+ }
}
}
//
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF,
- GEOMAlgo_PassKeyShape& aPK)
+ GEOMAlgo_PassKeyShape& aPK)
{
Standard_Integer i, aNbE;
TopTools_ListOfShape aLE;
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE,
- GEOMAlgo_PassKeyShape& aPK)
+ GEOMAlgo_PassKeyShape& aPK)
{
TopoDS_Vertex aV1, aV2;
//
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV,
- TopoDS_Vertex& aNewVertex)
+ TopoDS_Vertex& aNewVertex)
{
Standard_Integer aNbV;
Standard_Real aTolV, aD, aDmax;
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
- TopoDS_Edge& aNewEdge)
+ TopoDS_Edge& aNewEdge)
{
myErrorStatus=0;
//
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
- TopoDS_Face& aNewFace)
+ TopoDS_Face& aNewFace)
{
myErrorStatus=0;
//
//
aER.Orientation(TopAbs_FORWARD);
if (!BRep_Tool::Degenerated(aER)) {
- // build p-curve
- if (bIsUPeriodic) {
- GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
- }
- BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
-
- // orient image
- bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
- if (bIsToReverse) {
- aER.Reverse();
- }
+ // build p-curve
+ if (bIsUPeriodic) {
+ GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
+ }
+ BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
+
+ // orient image
+ bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
+ if (bIsToReverse) {
+ aER.Reverse();
+ }
}
else {
- aER.Orientation(aE.Orientation());
+ aER.Orientation(aE.Orientation());
}
//
aBB.Add(newWire, aER);
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
- const TopoDS_Face& aF)
+ const TopoDS_Face& aF)
{
Standard_Boolean bRet;
Standard_Real aT, aT1, aT2, aTR, aScPr;
//purpose :
//=======================================================================
void GetSubShapes(const TopoDS_Shape& aS,
- TopTools_IndexedMapOfShape& aMSS)
+ TopTools_IndexedMapOfShape& aMSS)
{
Standard_Integer aR;
TopAbs_ShapeEnum aType;
//function : Modified
//purpose :
//=======================================================================
-const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS)
+const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified
+ (const TopoDS_Shape& aS)
{
TopAbs_ShapeEnum aType;
//
if(myOrigins.IsBound(aS)) {
const TopoDS_Shape& aSnew=myOrigins.Find(aS);
if (!aSnew.IsSame(aS)) {
- myGenerated.Append(aSnew);
+ myGenerated.Append(aSnew);
}
}
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
myImagesToWork.Clear();
myOriginsToWork.Clear();
myKeepNonSolids=Standard_False;
- //modified by NIZNHY-PKV Tue Mar 13 13:38:28 2012f
myDetector.Clear();
- //modified by NIZNHY-PKV Tue Mar 13 13:38:30 2012t
}
-//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f
//=======================================================================
//function : StickedShapes
//purpose :
{
return myDetector.StickedShapes();
}
-//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t
//=======================================================================
//function : SetShapesToGlue
//purpose :
//=======================================================================
-void GEOMAlgo_Gluer2::SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM)
+void GEOMAlgo_Gluer2::SetShapesToGlue
+ (const TopTools_DataMapOfShapeListOfShape& aM)
{
myShapesToGlue=aM;
}
myWarningStatus=0;
//
aNbSG=myShapesToGlue.Extent();
+ aType=TopAbs_SHAPE;
if (aNbSG) {
// Check myShapesToGlue
aItDMSLS.Initialize(myShapesToGlue);
myErrorStatus=0;
myWarningStatus=0;
//
+ bHasImage=Standard_False;
aItC.Initialize(myArgument);
for (; aItC.More(); aItC.Next()) {
const TopoDS_Shape& aCx=aItC.Value();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-/// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+/// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
///
/// This library is free software; you can redistribute it and/or
/// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+//GEOMAlgo_KindOfDef
+#ifndef _GEOMAlgo_KindOfDef_HeaderFile
+#define _GEOMAlgo_KindOfDef_HeaderFile
+
+
+enum GEOMAlgo_KindOfDef {
+GEOMAlgo_KD_UNKNOWN,
+GEOMAlgo_KD_SPECIFIED,
+GEOMAlgo_KD_ARBITRARY
+};
+
+#ifndef _Standard_PrimitiveTypes_HeaderFile
+#include <Standard_PrimitiveTypes.hxx>
+#endif
+
+#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
GEOMAlgo_KN_RECTANGLE,
GEOMAlgo_KN_TRIANGLE,
GEOMAlgo_KN_QUADRANGLE,
-GEOMAlgo_KN_ARCELLIPSE
+GEOMAlgo_KN_ARCELLIPSE,
+GEOMAlgo_KN_SOLID
};
#ifndef _Standard_PrimitiveTypes_HeaderFile
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
GEOMAlgo_KS_CIRCLE,
GEOMAlgo_KS_LINE,
GEOMAlgo_KS_DEGENERATED,
-//modified by NIZNHY-PKV Tue Jul 03 10:28:09 2012f
GEOMAlgo_KS_BSPLINE
-//modified by NIZNHY-PKV Tue Jul 03 10:28:11 2012t
};
#ifndef _Standard_PrimitiveTypes_HeaderFile
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
void DumpKindOfBounds(const GEOMAlgo_KindOfBounds aKB);
static
void DumpKindOfName(const GEOMAlgo_KindOfName aKS);
+static
+ void DumpKindOfDef(const GEOMAlgo_KindOfDef aKD);
static
void DumpPosition(const gp_Ax3& aAx3);
static
//function :
//purpose :
//=======================================================================
- GEOMAlgo_ShapeInfo::GEOMAlgo_ShapeInfo()
+GEOMAlgo_ShapeInfo::GEOMAlgo_ShapeInfo()
{
Reset();
}
//function : ~
//purpose :
//=======================================================================
- GEOMAlgo_ShapeInfo::~GEOMAlgo_ShapeInfo()
+GEOMAlgo_ShapeInfo::~GEOMAlgo_ShapeInfo()
{
}
//=======================================================================
//function : Reset
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::Reset()
+void GEOMAlgo_ShapeInfo::Reset()
{
Standard_Integer i;
//
myKindOfBounds=GEOMAlgo_KB_UNKNOWN;
myKindOfClosed=GEOMAlgo_KC_UNKNOWN;
myKindOfName=GEOMAlgo_KN_UNKNOWN;
+ myKindOfDef=GEOMAlgo_KD_UNKNOWN;
//
myLocation.SetCoord(99., 99., 99.);
myDirection.SetCoord(1.,0.,0.);
//function : SetType
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetType(const TopAbs_ShapeEnum aType)
+void GEOMAlgo_ShapeInfo::SetType(const TopAbs_ShapeEnum aType)
{
myType=aType;
}
//function : Type
//purpose :
//=======================================================================
- TopAbs_ShapeEnum GEOMAlgo_ShapeInfo::Type() const
+TopAbs_ShapeEnum GEOMAlgo_ShapeInfo::Type() const
{
return myType;
}
//function : SetNbSubShapes
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetNbSubShapes(const TopAbs_ShapeEnum aType,
- const Standard_Integer aNb)
+void GEOMAlgo_ShapeInfo::SetNbSubShapes(const TopAbs_ShapeEnum aType,
+ const Standard_Integer aNb)
{
Standard_Integer iN;
//function : NbSubShapes
//purpose :
//=======================================================================
- Standard_Integer GEOMAlgo_ShapeInfo::NbSubShapes(const TopAbs_ShapeEnum aType) const
+Standard_Integer GEOMAlgo_ShapeInfo::NbSubShapes
+ (const TopAbs_ShapeEnum aType) const
{
Standard_Integer iN;
//function : SetKindOfShape
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetKindOfShape(const GEOMAlgo_KindOfShape aT)
+void GEOMAlgo_ShapeInfo::SetKindOfShape(const GEOMAlgo_KindOfShape aT)
{
myKindOfShape=aT;
}
//function : KindOfShape
//purpose :
//=======================================================================
- GEOMAlgo_KindOfShape GEOMAlgo_ShapeInfo::KindOfShape() const
+GEOMAlgo_KindOfShape GEOMAlgo_ShapeInfo::KindOfShape() const
{
return myKindOfShape;
}
//function : SetKindOfName
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetKindOfName(const GEOMAlgo_KindOfName aT)
+void GEOMAlgo_ShapeInfo::SetKindOfName(const GEOMAlgo_KindOfName aT)
{
myKindOfName=aT;
}
//function : KindOfName
//purpose :
//=======================================================================
- GEOMAlgo_KindOfName GEOMAlgo_ShapeInfo::KindOfName() const
+GEOMAlgo_KindOfName GEOMAlgo_ShapeInfo::KindOfName() const
{
return myKindOfName;
}
//function : SetKindOfBounds
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetKindOfBounds(const GEOMAlgo_KindOfBounds aT)
+void GEOMAlgo_ShapeInfo::SetKindOfBounds(const GEOMAlgo_KindOfBounds aT)
{
myKindOfBounds=aT;
}
//function : KindOfBounds
//purpose :
//=======================================================================
- GEOMAlgo_KindOfBounds GEOMAlgo_ShapeInfo::KindOfBounds() const
+GEOMAlgo_KindOfBounds GEOMAlgo_ShapeInfo::KindOfBounds() const
{
return myKindOfBounds;
}
//function : SetKindOfClosed
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetKindOfClosed(const GEOMAlgo_KindOfClosed aT)
+void GEOMAlgo_ShapeInfo::SetKindOfClosed(const GEOMAlgo_KindOfClosed aT)
{
myKindOfClosed=aT;
}
//function : KindOfClosed
//purpose :
//=======================================================================
- GEOMAlgo_KindOfClosed GEOMAlgo_ShapeInfo::KindOfClosed() const
+GEOMAlgo_KindOfClosed GEOMAlgo_ShapeInfo::KindOfClosed() const
{
return myKindOfClosed;
}
//=======================================================================
+//function : SetKindOfDef
+//purpose :
+//=======================================================================
+void GEOMAlgo_ShapeInfo::SetKindOfDef(const GEOMAlgo_KindOfDef aT)
+{
+ myKindOfDef=aT;
+}
+//=======================================================================
+//function : KindOfDef
+//purpose :
+//=======================================================================
+GEOMAlgo_KindOfDef GEOMAlgo_ShapeInfo::KindOfDef() const
+{
+ return myKindOfDef;
+}
+//=======================================================================
//function : SetLocation
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetLocation(const gp_Pnt& aP)
+void GEOMAlgo_ShapeInfo::SetLocation(const gp_Pnt& aP)
{
myLocation=aP;
}
//function : Location
//purpose :
//=======================================================================
- const gp_Pnt& GEOMAlgo_ShapeInfo::Location() const
+const gp_Pnt& GEOMAlgo_ShapeInfo::Location() const
{
return myLocation;
}
//function : SetDirection
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetDirection(const gp_Dir& aD)
+void GEOMAlgo_ShapeInfo::SetDirection(const gp_Dir& aD)
{
myDirection=aD;
}
//function : Direction
//purpose :
//=======================================================================
- const gp_Dir& GEOMAlgo_ShapeInfo::Direction() const
+const gp_Dir& GEOMAlgo_ShapeInfo::Direction() const
{
return myDirection;
}
//function : SetPosition
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax2& aAx2)
+void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax2& aAx2)
{
gp_Ax3 aAx3(aAx2);
SetPosition(aAx3);
//function : SetPosition
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax3& aAx3)
+void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax3& aAx3)
{
myPosition=aAx3;
}
//function : Position
//purpose :
//=======================================================================
- const gp_Ax3& GEOMAlgo_ShapeInfo::Position() const
+const gp_Ax3& GEOMAlgo_ShapeInfo::Position() const
{
return myPosition;
}
//function : SetPnt1
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetPnt1(const gp_Pnt& aP)
+void GEOMAlgo_ShapeInfo::SetPnt1(const gp_Pnt& aP)
{
myPnt1=aP;
}
//function : Pnt1
//purpose :
//=======================================================================
- const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt1() const
+const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt1() const
{
return myPnt1;
}
//function : SetPnt2
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetPnt2(const gp_Pnt& aP)
+void GEOMAlgo_ShapeInfo::SetPnt2(const gp_Pnt& aP)
{
myPnt2=aP;
}
//function : Pnt2
//purpose :
//=======================================================================
- const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt2() const
+const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt2() const
{
return myPnt2;
}
//function : SetRadius1
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetRadius1(const Standard_Real aR)
+void GEOMAlgo_ShapeInfo::SetRadius1(const Standard_Real aR)
{
myRadius1=aR;
}
//function : Radius1
//purpose :
//=======================================================================
- Standard_Real GEOMAlgo_ShapeInfo::Radius1() const
+Standard_Real GEOMAlgo_ShapeInfo::Radius1() const
{
return myRadius1;
}
//function : SetRadius2
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetRadius2(const Standard_Real aR)
+void GEOMAlgo_ShapeInfo::SetRadius2(const Standard_Real aR)
{
myRadius2=aR;
}
//function : Radius2
//purpose :
//=======================================================================
- Standard_Real GEOMAlgo_ShapeInfo::Radius2() const
+Standard_Real GEOMAlgo_ShapeInfo::Radius2() const
{
return myRadius2;
}
//function : SetLength
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetLength(const Standard_Real aL)
+void GEOMAlgo_ShapeInfo::SetLength(const Standard_Real aL)
{
myLength=aL;
}
//function : Length
//purpose :
//=======================================================================
- Standard_Real GEOMAlgo_ShapeInfo::Length() const
+Standard_Real GEOMAlgo_ShapeInfo::Length() const
{
return myLength;
}
//function : SetWidth
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetWidth(const Standard_Real aW)
+void GEOMAlgo_ShapeInfo::SetWidth(const Standard_Real aW)
{
myWidth=aW;
}
//function : Width
//purpose :
//=======================================================================
- Standard_Real GEOMAlgo_ShapeInfo::Width() const
+Standard_Real GEOMAlgo_ShapeInfo::Width() const
{
return myWidth;
}
//function : SetHeight
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetHeight(const Standard_Real aH)
+void GEOMAlgo_ShapeInfo::SetHeight(const Standard_Real aH)
{
myHeight=aH;
}
//function : Height
//purpose :
//=======================================================================
- Standard_Real GEOMAlgo_ShapeInfo::Height() const
+Standard_Real GEOMAlgo_ShapeInfo::Height() const
{
return myHeight;
}
//function : Dump
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::Dump()const
+void GEOMAlgo_ShapeInfo::Dump()const
{
switch (myType) {
//
//function : DumpCompound
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::DumpCompound()const
+void GEOMAlgo_ShapeInfo::DumpCompound()const
{
Standard_Integer aNbV, aNbE, aNbF, aNbS, aNbC, aNbP;
GEOMAlgo_KindOfShape aKS;
//function : DumpCompSolid
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::DumpCompSolid()const
+void GEOMAlgo_ShapeInfo::DumpCompSolid()const
{
Standard_Integer aNbV, aNbE, aNbF, aNbS;
GEOMAlgo_KindOfShape aKS;
DumpKindOfBounds(aKB);
DumpKindOfClosed(aKC);
}
-
//=======================================================================
//function : DumpSolid
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::DumpSolid()const
+void GEOMAlgo_ShapeInfo::DumpSolid()const
{
Standard_Integer aNbV, aNbE, aNbF;
GEOMAlgo_KindOfShape aKS;
printf(" Height : %.3lf\n", myHeight);
}
}
-
//=======================================================================
//function : DumpFace
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::DumpFace()const
+void GEOMAlgo_ShapeInfo::DumpFace()const
{
Standard_Integer aNbV, aNbE;
GEOMAlgo_KindOfShape aKS;
GEOMAlgo_KindOfName aKN;
GEOMAlgo_KindOfBounds aKB;
GEOMAlgo_KindOfClosed aKC;
+ GEOMAlgo_KindOfDef aKD;
//
aNbV=NbSubShapes(TopAbs_VERTEX);
aNbE=NbSubShapes(TopAbs_EDGE);
aKN=KindOfName();
aKB=KindOfBounds();
aKC=KindOfClosed();
+ aKD=KindOfDef();
//
printf(" *FACE\n");
printf(" number of vertices: %d\n", aNbV);
DumpKindOfName (aKN);
DumpKindOfBounds(aKB);
DumpKindOfClosed(aKC);
+ DumpKindOfDef(aKD);
//
// PLANE
if (aKN==GEOMAlgo_KN_PLANE) {
//function : DumpShell
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::DumpShell()const
+void GEOMAlgo_ShapeInfo::DumpShell()const
{
Standard_Integer aNbV, aNbE, aNbF;
GEOMAlgo_KindOfClosed aKC;
//function : DumpWire
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::DumpWire()const
+void GEOMAlgo_ShapeInfo::DumpWire()const
{
Standard_Integer aNbV, aNbE;
GEOMAlgo_KindOfClosed aKC;
//function : DumpEdge
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::DumpEdge()const
+void GEOMAlgo_ShapeInfo::DumpEdge()const
{
Standard_Integer aNbV;
Standard_Real aX, aY, aZ;
//function : DumpVertex
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::DumpVertex()const
+void GEOMAlgo_ShapeInfo::DumpVertex()const
{
printf(" *VERTEX\n");
DumpLocation(myLocation);
//function : DumpLocation
//purpose :
//=======================================================================
- void DumpLocation(const gp_Pnt& aP)
+void DumpLocation(const gp_Pnt& aP)
{
Standard_Real aX, aY, aZ;
//
//function : DumpDirection
//purpose :
//=======================================================================
- void DumpDirection(const gp_Dir& aD)
+void DumpDirection(const gp_Dir& aD)
{
Standard_Real aX, aY, aZ;
//
"KN_RECTANGLE",
"KN_TRIANGLE",
"KN_QUADRANGLE",
- "KN_ARCELLIPSE"
+ "KN_ARCELLIPSE",
+ "KN_SOLID"
};
int i;
//
i=(Standard_Integer)aKS;
printf(" KindOfName : %s\n", pStr[i]);
}
+//=======================================================================
+//function : DumpKindOfDef
+//purpose :
+//=======================================================================
+void DumpKindOfDef(const GEOMAlgo_KindOfDef aKD)
+{
+ const char *pStr[]={
+ "KD_UNKNOWN",
+ "KD_SPECIFIED",
+ "KB_ARBITRARY"
+ };
+ int i;
+ //
+ i=(Standard_Integer)aKD;
+ printf(" KindOfDef: %s\n", pStr[i]);
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <GEOMAlgo_KindOfName.hxx>
#include <GEOMAlgo_KindOfBounds.hxx>
#include <GEOMAlgo_KindOfClosed.hxx>
+#include <GEOMAlgo_KindOfDef.hxx>
//=======================================================================
TopAbs_ShapeEnum Type() const;
Standard_EXPORT
- void SetNbSubShapes(const TopAbs_ShapeEnum aType,const Standard_Integer aNb) ;
+ void SetNbSubShapes(const TopAbs_ShapeEnum aType,
+ const Standard_Integer aNb) ;
Standard_EXPORT
Standard_Integer NbSubShapes(const TopAbs_ShapeEnum aType) const;
Standard_EXPORT
GEOMAlgo_KindOfClosed KindOfClosed() const;
+ Standard_EXPORT
+ void SetKindOfDef(const GEOMAlgo_KindOfDef aT) ;
+
+ Standard_EXPORT
+ GEOMAlgo_KindOfDef KindOfDef() const;
+
Standard_EXPORT
void SetLocation(const gp_Pnt& aP) ;
GEOMAlgo_KindOfName myKindOfName;
GEOMAlgo_KindOfBounds myKindOfBounds;
GEOMAlgo_KindOfClosed myKindOfClosed;
+ GEOMAlgo_KindOfDef myKindOfDef;
gp_Pnt myLocation;
gp_Dir myDirection;
gp_Ax3 myPosition;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//function :
//purpose :
//=======================================================================
- GEOMAlgo_ShapeInfoFiller::GEOMAlgo_ShapeInfoFiller()
+GEOMAlgo_ShapeInfoFiller::GEOMAlgo_ShapeInfoFiller()
:
GEOMAlgo_Algo()
{
//function : ~
//purpose :
//=======================================================================
- GEOMAlgo_ShapeInfoFiller::~GEOMAlgo_ShapeInfoFiller()
+GEOMAlgo_ShapeInfoFiller::~GEOMAlgo_ShapeInfoFiller()
{
}
//=======================================================================
//function : SetTolerance
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::SetTolerance(const Standard_Real aT)
+void GEOMAlgo_ShapeInfoFiller::SetTolerance(const Standard_Real aT)
{
myTolerance=aT;
}
//function : Tolerance
//purpose :
//=======================================================================
- Standard_Real GEOMAlgo_ShapeInfoFiller::Tolerance()const
+Standard_Real GEOMAlgo_ShapeInfoFiller::Tolerance()const
{
return myTolerance;
}
//function : SetShape
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::SetShape(const TopoDS_Shape& aS)
+void GEOMAlgo_ShapeInfoFiller::SetShape(const TopoDS_Shape& aS)
{
myShape=aS;
}
//function : Shape
//purpose :
//=======================================================================
- const TopoDS_Shape& GEOMAlgo_ShapeInfoFiller::Shape() const
+const TopoDS_Shape& GEOMAlgo_ShapeInfoFiller::Shape() const
{
return myShape;
}
//function : Info
//purpose :
//=======================================================================
- const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info() const
+const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info() const
{
return Info(myShape);
}
//function : Info
//purpose :
//=======================================================================
- const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info(const TopoDS_Shape& aS) const
+const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info
+ (const TopoDS_Shape& aS) const
{
if (!aS.IsNull()) {
if (myMapInfo.Contains(aS)) {
//function : CheckData
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::CheckData()
+void GEOMAlgo_ShapeInfoFiller::CheckData()
{
myErrorStatus=0;
//
//function : Perform
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::Perform()
+void GEOMAlgo_ShapeInfoFiller::Perform()
{
myErrorStatus=0;
//
//function :FillShape
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::FillShape(const TopoDS_Shape& aS)
+void GEOMAlgo_ShapeInfoFiller::FillShape(const TopoDS_Shape& aS)
{
TopAbs_ShapeEnum aType;
//
//function :FillSubShapes
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::FillSubShapes(const TopoDS_Shape& aS)
+void GEOMAlgo_ShapeInfoFiller::FillSubShapes(const TopoDS_Shape& aS)
{
TopoDS_Iterator aIt;
//
//function : FillContainer
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::FillContainer(const TopoDS_Shape& aS)
+void GEOMAlgo_ShapeInfoFiller::FillContainer(const TopoDS_Shape& aS)
{
myErrorStatus=0;
//
//function : FillSolid
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::FillSolid(const TopoDS_Shape& aS)
+void GEOMAlgo_ShapeInfoFiller::FillSolid(const TopoDS_Shape& aS)
{
- Standard_Integer aNbShells;
TopoDS_Solid aSd;
//
myErrorStatus=0;
//
aSd=TopoDS::Solid(aS);
//
- aNbShells=GEOMAlgo_ShapeInfoFiller::NbShells(aSd);
- if (aNbShells>1) {
- return;
- }
- //
FillDetails(aSd);
}
//=======================================================================
//function :FillFace
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::FillFace(const TopoDS_Shape& aS)
+void GEOMAlgo_ShapeInfoFiller::FillFace(const TopoDS_Shape& aS)
{
myErrorStatus=0;
+ if (myMapInfo.Contains(aS)) {
+ return;
+ }
//
Standard_Boolean bIsAllowedType;
- Standard_Integer aNbWires;//, iRet
Standard_Boolean bInf, bInfU1, bInfU2, bInfV1, bInfV2;
- Standard_Real aUMin, aUMax, aVMin, aVMax, aR1, aR2;
+ Standard_Real aUMin, aUMax, aVMin, aVMax, aR1, aR2, dV;
gp_Pnt aP0;
gp_Dir aDN;
gp_Ax3 aAx3;
GeomAbs_SurfaceType aST;
Handle(Geom_Surface) aSurf;
TopoDS_Face aF;
- //GEOMAlgo_KindOfName aKindOfName;
//----------------------------------------------------
- if (myMapInfo.Contains(aS)) {
- return;
- }
- else {
- GEOMAlgo_ShapeInfo aInfoX;
- myMapInfo.Add(aS, aInfoX);
- }
+ GEOMAlgo_ShapeInfo aInfoX;
+ myMapInfo.Add(aS, aInfoX);
+ //
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS);
//----------------------------------------------------
aInfo.SetType(TopAbs_FACE);
//
aF=TopoDS::Face(aS);
//
- aNbWires=GEOMAlgo_ShapeInfoFiller::NbWires(aF);
- //
aSurf=BRep_Tool::Surface(aF);
GeomAdaptor_Surface aGAS(aSurf);
aST=aGAS.GetType();
return;
}
//
+ //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 1. Plane
if (aST==GeomAbs_Plane) {
gp_Pln aPln;
aP0=aPln.Location();
aAx3=aPln.Position();
//
- aInfo.SetKindOfShape(GEOMAlgo_KS_PLANE);
+ aInfo.SetKindOfShape(GEOMAlgo_KS_PLANE);
+ aInfo.SetKindOfName(GEOMAlgo_KN_PLANE);
aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3);
//
- if (aNbWires>1) {
- return;
- }
- //
- //aSurf->Bounds(aUMin, aUMax, aVMin, aVMax);
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
bInfU1=Precision::IsNegativeInfinite(aUMin);
bInfU2=Precision::IsPositiveInfinite(aUMax);
bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2);
if (bInf) {
aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE);
+ return;
}
- else {
- aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
- }
+ //
+ aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
//
FillDetails(aF, aPln);
}// if (aCT==GeomAbs_Line) {
//
+ //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 2. Sphere
else if (aST==GeomAbs_Sphere) {
gp_Sphere aSphere;
aR1=aSphere.Radius();
//
aInfo.SetKindOfShape(GEOMAlgo_KS_SPHERE);
+ aInfo.SetKindOfName(GEOMAlgo_KN_SPHERE);
aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3);
aInfo.SetRadius1(aR1);
//
- if (aNbWires>1) {
- return;
- }
- //
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED);
//
FillDetails(aF, aSphere);
}// else if (aST==GeomAbs_Sphere) {
//
+ //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 3. Cylinder
else if (aST==GeomAbs_Cylinder) {
gp_Cylinder aCyl;
aR1=aCyl.Radius();
//
aInfo.SetKindOfShape(GEOMAlgo_KS_CYLINDER);
+ aInfo.SetKindOfName(GEOMAlgo_KN_CYLINDER);
aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3);
aInfo.SetRadius1(aR1);
//
- if (aNbWires>1) {
- return;
- }
- //
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
bInfU1=Precision::IsNegativeInfinite(aUMin);
bInfU2=Precision::IsPositiveInfinite(aUMax);
bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2);
if (bInf) {
aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE);
+ return;
}
- else {
- aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
- }
+ //
+ aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
+ //
+ dV=aVMax-aVMin;
+ aInfo.SetHeight(dV);
+ //
FillDetails(aF, aCyl);
}
//
+ //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 4. Cone
else if (aST==GeomAbs_Cone) {
+ Standard_Real aSemiAngle;
gp_Cone aCone;
//
aCone=aGAS.Cone();
aP0=aCone.Location();
aAx3=aCone.Position();
- //aR1=aCyl.Radius();
//
aInfo.SetKindOfShape(GEOMAlgo_KS_CONE);
+ aInfo.SetKindOfName(GEOMAlgo_KN_CONE);
aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3);
- //aInfo.SetRadius1(aR1);
- //
- if (aNbWires>1) {
- return;
- }
//
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
bInfU1=Precision::IsNegativeInfinite(aUMin);
bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2);
if (bInf) {
aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE);
+ return;
}
- else {
- aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
- }
+ //
+ aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
+ //
+ aSemiAngle=fabs(aCone.SemiAngle());
+ dV=(aVMax-aVMin)*cos(aSemiAngle);
+
+ aInfo.SetHeight(dV);
+ //
FillDetails(aF, aCone);
}
//
+ //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 5. Torus
else if (aST==GeomAbs_Torus) {
gp_Torus aTorus;
aR2=aTorus.MinorRadius();
//
aInfo.SetKindOfShape(GEOMAlgo_KS_TORUS);
+ aInfo.SetKindOfName(GEOMAlgo_KN_TORUS);
aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3);
aInfo.SetRadius1(aR1);
aInfo.SetRadius2(aR2);
//
- if (aNbWires>1) {
- return;
- }
- //
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
//
FillDetails(aF, aTorus);
FillSubShapes(aS);
return;
}
- //modified by NIZNHY-PKV Tue Jul 03 10:19:03 2012f
// BSplineCurve
if (aCT==GeomAbs_BSplineCurve) {
Standard_Integer aNbKnots, aNbPoles, aDegree;
aInfo.SetDirection(aDir);
}
}
- //modified by NIZNHY-PKV Tue Jul 03 10:19:06 2012t
// Line
else if (aCT==GeomAbs_Line) {
Standard_Boolean bInf1, bInf2;
//function :FillVertex
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::FillVertex(const TopoDS_Shape& aS)
+void GEOMAlgo_ShapeInfoFiller::FillVertex(const TopoDS_Shape& aS)
{
myErrorStatus=0;
//
//function : FillNbSubshapes
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::FillNbSubShapes(const TopoDS_Shape& aS,
- GEOMAlgo_ShapeInfo& aInfo)
+void GEOMAlgo_ShapeInfoFiller::FillNbSubShapes(const TopoDS_Shape& aS,
+ GEOMAlgo_ShapeInfo& aInfo)
{
myErrorStatus=0;
//
//function :NbShells
//purpose :
//=======================================================================
-Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd)
+Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells
+ (const TopoDS_Solid& aSd)
{
Standard_Integer iCnt;
TopoDS_Iterator aIt;
//
aIt.Initialize(aSd);
for (; aIt.More(); aIt.Next()) {
- //const TopoDS_Shape& aSh=aIt.Value();
++iCnt;
}
return iCnt;
//function : NbWires
//purpose :
//=======================================================================
-Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF)
+Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires
+ (const TopoDS_Face& aF)
{
Standard_Integer iCnt;
TopoDS_Iterator aIt;
//
aIt.Initialize(aF);
for (; aIt.More(); aIt.Next()) {
- //const TopoDS_Shape& aW=aIt.Value();
++iCnt;
}
return iCnt;
//function : IsAllowedType
//purpose :
//=======================================================================
-Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType aCT)
+Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType
+ (const GeomAbs_CurveType aCT)
{
Standard_Boolean bRet;
Standard_Integer i, aNb;
GeomAbs_Line,
GeomAbs_Circle,
GeomAbs_Ellipse,
- GeomAbs_BSplineCurve //modified by NIZNHY-PKV Tue Jul 03 10:18:01 2012ft
+ GeomAbs_BSplineCurve
};
//
bRet=Standard_False;
//function : IsAllowedType
//purpose :
//=======================================================================
-Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_SurfaceType aST)
+Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType
+ (const GeomAbs_SurfaceType aST)
{
Standard_Boolean bRet;
Standard_Integer i, aNb;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
{
Standard_Boolean bIsStepSphere;
- Standard_Integer i, aNbF, aNbCyl, aNbCon, aNbPgn, aNbRct, aNbCrc, aNbX;
+ Standard_Integer i, aNbF, aNbCyl, aNbCon, aNbPgn, aNbRct;
+ Standard_Integer aNbShells, aNbCrc, aNbX;
TopoDS_Shape aFCyl, aFCon;
TopTools_IndexedMapOfShape aMF;
GEOMAlgo_KindOfName aKNF;
+ GEOMAlgo_KindOfDef aKD;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aSd);
aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
return;
}
//
+ //modified by NIZNHY-PKV Tue Jun 09 08:35:23 2015f
+ if (aNbF==2) {
+ // case requested by the customer
+ // specific solid that should be treated as a sphere
+ bIsStepSphere=TreatStepSphere(aSd);
+ if (bIsStepSphere) {
+ return;
+ }
+ }
+ //modified by NIZNHY-PKV Tue Jun 09 08:35:28 2015t
+ //
+ aKD=GEOMAlgo_KD_SPECIFIED;
+ for (i=1; i<=aNbF && aKD==GEOMAlgo_KD_SPECIFIED; ++i) {
+ const TopoDS_Shape& aF=aMF(i);
+ GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF);
+ aKD=aInfoF.KindOfDef();
+ }
+ if (aKD!=GEOMAlgo_KD_SPECIFIED) {
+ aInfo.SetKindOfName(GEOMAlgo_KN_SOLID);
+ return;
+ }
+ //
+ aNbShells=GEOMAlgo_ShapeInfoFiller::NbShells(aSd);
+ if (aNbShells>1) {
+ aInfo.SetKindOfName(GEOMAlgo_KN_SOLID);
+ return;
+ }
+ //
+ //
if (aNbF==1) {
+ // mb: sphere, torus
const TopoDS_Shape& aF=aMF(1);
GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF);
aKNF=aInfoF.KindOfName(); // mb: sphere, torus
return;
}
}
- //modified by NIZNHY-PKV Tue Jul 03 13:23:55 2012f
+ //modified by NIZNHY-PKV Tue Jun 09 08:36:08 2015f
+ /*
else if (aNbF==2) {
// specific solid that should be treated as a sphere
bIsStepSphere=TreatStepSphere(aSd);
return;
}
}
- //modified by NIZNHY-PKV Tue Jul 03 13:23:57 2012t
+ */
+ //modified by NIZNHY-PKV Tue Jun 09 08:36:12 2015t
//
aNbCyl=0;
aNbCon=0;
const gp_Dir& aDNj=aIFj.Position().Direction();
//
aDot=aDNi*aDNj;
- //modified by NIZNHY-PKV Tue Jul 03 10:01:56 2012f
if (aDot<0.) {
aDot=-aDot;
}
- //modified by NIZNHY-PKV Tue Jul 03 10:01:52 2012t
if (fabs(1.-aDot)<0.0001) {
aMp.Add(i);
aMp.Add(j);
return;
}
//
+ iMin=-1;
+ iMax=-1;
aDistMin=1.e15;
aDistMax=-aDistMin;
for (i=0; i<aNbFi; ++i) {
TopTools_IndexedMapOfShape aMV;
BRepTools_WireExplorer aWExp;
GEOMAlgo_KindOfName aKN, aKNE;
- GEOMAlgo_KindOfShape aKS;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
- aKN=GEOMAlgo_KN_UNKNOWN;
- aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
- //
- aKS=aInfo.KindOfShape();
- if (aKS!=GEOMAlgo_KS_PLANE) {
- return;
- }
//
- if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) {
- aInfo.SetKindOfName(GEOMAlgo_KN_PLANE);
- return;
- }
+ aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
//
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
// 1. may be it is circle/ellipse
if (aNbV==1 && aNbE==1) {
aExp.Init(aF, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
+ if (aExp.More()) {
aE=aExp.Current();
- break;
}
//
const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
aInfo.SetRadius1(aInfoE.Radius1());
aInfo.SetLocation(aInfoE.Location());
aInfo.SetPosition(aInfoE.Position());
+ aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
}
if (aKNE==GEOMAlgo_KN_ELLIPSE) {
aKN=GEOMAlgo_KN_DISKELLIPSE;
aInfo.SetRadius2(aInfoE.Radius2());
aInfo.SetLocation(aInfoE.Location());
aInfo.SetPosition(aInfoE.Position());
+ aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
}
- }
+ return;
+ }// if (aNbV==1 && aNbE==1) {
//
- // 2. may be it is rectangle
- else {
- aExp.Init(aF, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- aE=aExp.Current();
- const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
- aKNE=aInfoE.KindOfName();
- if (aKNE!=GEOMAlgo_KN_SEGMENT) {
- return;
- }
+ //
+ Standard_Boolean bSegment;
+ //
+ bSegment=Standard_True;
+ aExp.Init(aF, TopAbs_EDGE);
+ for (; aExp.More() && bSegment; aExp.Next()) {
+ aE=aExp.Current();
+ const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
+ aKNE=aInfoE.KindOfName();
+ if (aKNE!=GEOMAlgo_KN_SEGMENT) {
+ bSegment=!bSegment;
}
- //
- aInfo.SetKindOfName(GEOMAlgo_KN_POLYGON);
+ }
+ //
+ if (bSegment) {
+ // 2. may be it is TRIANGLE, POLYGON, QUADRANGLE, RECTANGLE
+ aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
+ aInfo.SetKindOfName(GEOMAlgo_KN_POLYGON);
//
if (aNbV==3 && aNbE==3) {
aInfo.SetKindOfName(GEOMAlgo_KN_TRIANGLE);
//
aInfo.SetLocation(aPc);
aInfo.SetPosition(aAx3);
- //
- return;
- }
- //
- if (!(aNbV==4 && aNbE==4)) {
- return;
- }
- //
- // aNbV==4 && aNbE==4 and all edges are segments
- aIt.Initialize(aF);
- for (; aIt.More(); aIt.Next()){
- aW=TopoDS::Wire(aIt.Value());
- break;
- }
+ } // if (aNbV==3 && aNbE==3) {
//
- aWExp.Init(aW, aF);
- for (i=0; aWExp.More(); aWExp.Next(), ++i) {
- aEx=aWExp.Current();
- const GEOMAlgo_ShapeInfo& aInfoEx=myMapInfo.FindFromKey(aEx);
- aDx[i]=aInfoEx.Direction();
- aPx[i]=aInfoEx.Location();
- }
- //
- for (i=0; i<4; ++i) {
- j=(i==3) ? 0 : i+1;
- aDot=aDx[i]*aDx[j];
- if (fabs (aDot) > myTolerance) {
- aInfo.SetKindOfName(GEOMAlgo_KN_QUADRANGLE);
- return;
+ if (aNbV==4 && aNbE==4) {
+ aIt.Initialize(aF);
+ if (aIt.More()) {
+ aW=*((TopoDS_Wire*)&aIt.Value());
}
- }
- //
- // rectangle
- aInfo.SetKindOfName(GEOMAlgo_KN_RECTANGLE);
- //
- // shift location to the center and calc. sizes
- aXYZc.SetCoord(0.,0.,0.);
- TopExp::MapShapes(aF, TopAbs_VERTEX, aMV);
- for (i=1; i<=aNbV; ++i) {
- const TopoDS_Vertex& aV=TopoDS::Vertex(aMV(i));
- aP=BRep_Tool::Pnt(aV);
- const gp_XYZ& aXYZ=aP.XYZ();
- aXYZc=aXYZc+aXYZ;
- }
- //
- // Location : aPc in center of rectangle
- // Position : 0z is plane normal
- // 0x is along length
- //
- aXYZc.Divide(4.);
- aPc.SetXYZ(aXYZc);
- //
- gp_Lin aL0(aPx[0], aDx[0]);
- gp_Lin aL1(aPx[1], aDx[1]);
- //
- aD0=aL0.Distance(aPc);
- aD1=aL1.Distance(aPc);
- //
- aLength=aD0;
- aWidth =aD1;
- aDX=aL1.Direction();
- if (aD0<aD1) {
- aLength=aD1;
- aWidth =aD0;
- aDX=aL0.Direction();
- }
- //
- aLength=2.*aLength;
- aWidth =2.*aWidth;
- //
- aInfo.SetLocation(aPc);
- aInfo.SetLength(aLength);
- aInfo.SetWidth(aWidth);
- //
- const gp_Dir& aDZ=aPln.Axis().Direction();
- gp_Ax2 aAx2(aPc, aDZ, aDX);
- gp_Ax3 aAx3(aAx2);
- aInfo.SetPosition(aAx3);
- }
+ //
+ aWExp.Init(aW, aF);
+ for (i=0; aWExp.More(); aWExp.Next(), ++i) {
+ aEx=aWExp.Current();
+ const GEOMAlgo_ShapeInfo& aInfoEx=myMapInfo.FindFromKey(aEx);
+ aDx[i]=aInfoEx.Direction();
+ aPx[i]=aInfoEx.Location();
+ }
+ //
+ Standard_Boolean isRectangle = Standard_True;
+ for (i=0; i<4; ++i) {
+ j=(i==3) ? 0 : i+1;
+ aDot=aDx[i]*aDx[j];
+ if (fabs (aDot) > myTolerance) {
+ isRectangle = Standard_False;
+ break;
+ }
+ }
+ //
+ // rectangle
+ // shift location to the center
+ aXYZc.SetCoord(0.,0.,0.);
+ TopExp::MapShapes(aF, TopAbs_VERTEX, aMV);
+ for (i=1; i<=aNbV; ++i) {
+ const TopoDS_Vertex& aV=TopoDS::Vertex(aMV(i));
+ aP=BRep_Tool::Pnt(aV);
+ const gp_XYZ& aXYZ=aP.XYZ();
+ aXYZc=aXYZc+aXYZ;
+ }
+ //
+ // Location : aPc in center of rectangle
+ // Position : 0z is plane normal
+ // 0x is along the first edge (quadrangle) or
+ // along length (rectangle)
+ //
+ aXYZc.Divide(4.);
+ aPc.SetXYZ(aXYZc);
+ aDX=aDx[0];
+ aInfo.SetLocation(aPc);
- return;
+ if (isRectangle) {
+ // Calculate sizes
+ gp_Lin aL0(aPx[0], aDx[0]);
+ gp_Lin aL1(aPx[1], aDx[1]);
+ //
+ aD0=aL0.Distance(aPc);
+ aD1=aL1.Distance(aPc);
+ //
+ aLength=aD1;
+ aWidth =aD0;
+
+ if (aD0>aD1) {
+ aLength=aD0;
+ aWidth =aD1;
+ aDX=aDx[1];
+ }
+ //
+ aLength=2.*aLength;
+ aWidth =2.*aWidth;
+ //
+ aInfo.SetLength(aLength);
+ aInfo.SetWidth(aWidth);
+ aInfo.SetKindOfName(GEOMAlgo_KN_RECTANGLE);
+ } else {
+ aInfo.SetKindOfName(GEOMAlgo_KN_QUADRANGLE);
+ }
+ //
+ const gp_Dir& aDZ=aPln.Axis().Direction();
+ gp_Ax2 aAx2(aPc, aDZ, aDX);
+ gp_Ax3 aAx3(aAx2);
+ aInfo.SetPosition(aAx3);
+ //
+ }// if (aNbV==4 && aNbE==4) {
+ return;
+ }// if (bSegment) {
+ //
+ //aInfo.SetKindOfName(GEOMAlgo_KN_PLANE);
}
//=======================================================================
//function : FillDetails
//purpose :
//=======================================================================
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
- const gp_Sphere& )
+ const gp_Sphere& )//aSph)
{
+
Standard_Integer aNbV, aNbE, aNbSE, aNbDE;
TopoDS_Edge aE;
TopExp_Explorer aExp;
TopTools_MapOfShape aM;
- GEOMAlgo_KindOfShape aKS, aKSE;
+ GEOMAlgo_KindOfShape aKSE;//, aKSE;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
- aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
- //
- aKS=aInfo.KindOfShape();
- if (aKS!=GEOMAlgo_KS_SPHERE) {
- return;
- }
- //
+ //
+ aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
- if (!(aNbV==2 && aNbE==3)) {
- return;
- }
- //
- aNbSE=0;
- aNbDE=0;
- aExp.Init(aF, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- aE=TopoDS::Edge(aExp.Current());
- if(aM.Add(aE)) {
- const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
- aKSE=aInfoE.KindOfShape();
- //
- if (BRep_Tool::IsClosed(aE, aF)) {
- ++aNbSE;
- }
- else if (aKSE==GEOMAlgo_KS_DEGENERATED) {
- ++aNbDE;
+ if (aNbV==2 && aNbE==3) {
+ aNbSE=0;
+ aNbDE=0;
+ aExp.Init(aF, TopAbs_EDGE);
+ for (; aExp.More(); aExp.Next()) {
+ aE=TopoDS::Edge(aExp.Current());
+ if(aM.Add(aE)) {
+ const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
+ aKSE=aInfoE.KindOfShape();
+ //
+ if (BRep_Tool::IsClosed(aE, aF)) {
+ ++aNbSE;
+ }
+ else if (aKSE==GEOMAlgo_KS_DEGENERATED) {
+ ++aNbDE;
+ }
}
}
+ //
+ if (aNbSE==1 && aNbDE==2) {
+ aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
+ }
}
- //
- if (!(aNbSE==1 && aNbDE==2)) {
- return;
- }
- aInfo.SetKindOfName(GEOMAlgo_KN_SPHERE);
}
//=======================================================================
//function : FillDetails
//purpose :
//=======================================================================
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
- const gp_Cone& )//aCone)
+ const gp_Cylinder& aCyl)
+
{
- Standard_Integer aNbV, aNbE, aNbCE, aNbSE, aNbDE, i;
- Standard_Real aR[3], aHeight;
- gp_Pnt aPC[3], aPD, aPc, aPX[3];
- TopoDS_Vertex aVD;
+ Standard_Integer i, aNbV, aNbE, aNbCE, aNbSE;
+ Standard_Real aT0, aT1, aHeight;
+ gp_Pnt aPC[3], aPc;
TopoDS_Edge aE;
- TopoDS_Iterator aIt;
TopExp_Explorer aExp;
TopTools_MapOfShape aM;
- GEOMAlgo_KindOfShape aKS, aKSE;
- GEOMAlgo_KindOfName aKN, aKNE;
+ GEOMAlgo_KindOfName aKNE;
GEOMAlgo_KindOfClosed aKCE;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
- aKN=GEOMAlgo_KN_UNKNOWN;
- aInfo.SetKindOfName(aKN);
- //
- aKS=aInfo.KindOfShape();
- if (aKS!=GEOMAlgo_KS_CONE) {
- return;
- }
- //
- if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) {
- return;
- }
//
+ aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
- if (!(aNbV==2 && aNbE==3)) {
- return;
- }
- //
- i=0;
- aNbCE=0;
- aNbSE=0;
- aNbDE=0;
- aExp.Init(aF, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- aE=TopoDS::Edge(aExp.Current());
- if(aM.Add(aE)) {
- const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
- aKNE=aInfoE.KindOfName();
- aKCE=aInfoE.KindOfClosed();
- aKSE=aInfoE.KindOfShape();
- if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) {
- aPC[i]=aInfoE.Location();
- aR[i]=aInfoE.Radius1();
- //
- aIt.Initialize(aE);
- for (; aIt.More(); aIt.Next()) {
- aVD=TopoDS::Vertex(aIt.Value());
- break;
- }
- aPX[i]=BRep_Tool::Pnt(aVD);
- //
- ++i;
- ++aNbCE;
- }
- else if (aKNE==GEOMAlgo_KN_SEGMENT) {
- if (BRep_Tool::IsClosed(aE, aF)) {
- ++aNbSE;
+ if (aNbV==2 && aNbE==3) {
+ const gp_Ax1& aAx1=aCyl.Axis();
+ const gp_Dir& aDir=aAx1.Direction();
+ const gp_Pnt& aPLoc=aAx1.Location();
+ //
+ i=0;
+ aNbCE=0;
+ aNbSE=0;
+ aExp.Init(aF, TopAbs_EDGE);
+ for (; aExp.More(); aExp.Next()) {
+ aE=TopoDS::Edge(aExp.Current());
+ if(aM.Add(aE)) {
+ const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
+ aKNE=aInfoE.KindOfName();
+ aKCE=aInfoE.KindOfClosed();
+ if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) {
+ aPC[aNbCE]=aInfoE.Location();
+ ++aNbCE;
}
- }
- else if (aKSE==GEOMAlgo_KS_DEGENERATED) {
- aIt.Initialize(aE);
- for (; aIt.More(); aIt.Next()) {
- aVD=TopoDS::Vertex(aIt.Value());
- break;
+ else if (aKNE==GEOMAlgo_KN_SEGMENT) {
+ if (BRep_Tool::IsClosed(aE, aF)) {
+ ++aNbSE;
+ }
}
- //
- aPD=BRep_Tool::Pnt(aVD);
- //
- ++aNbDE;
}
}
- }
- //
- if (!((aNbCE==2 || (aNbCE==1 && aNbDE==1)) && aNbSE==1)) {
- return;
- }
- //
- if (aNbDE==1) {
- aPC[1]=aPD;
- aR[1]=0.;
- }
- //
- aHeight=aPC[0].Distance(aPC[1]);
- //
- Standard_Real aRmin, aRmax;
- gp_Ax2 aAx2new;
- //
- if (aR[0]>aR[1]) {
- aRmin=aR[1];
- aRmax=aR[0];
- aPc=aPC[0];
- gp_Vec aVz(aPC[0], aPC[1]);
- gp_Vec aVx(aPC[0], aPX[0]);
- gp_Dir aDz(aVz);
- gp_Dir aDx(aVx);
- gp_Ax2 aAx2(aPc, aDz, aDx);
- aAx2new=aAx2;
- }
- else {
- aRmin=aR[0];
- aRmax=aR[1];
- aPc=aPC[1];
- gp_Vec aVz(aPC[1], aPC[0]);
- gp_Vec aVx(aPC[1], aPX[1]);
- gp_Dir aDz(aVz);
- gp_Dir aDx(aVx);
- gp_Ax2 aAx2(aPc, aDz, aDx);
- aAx2new=aAx2;
- }
- //
- gp_Ax3 aAx3(aAx2new);
- aInfo.SetLocation(aPc);
- aInfo.SetPosition(aAx3);
- aInfo.SetRadius1(aRmax);
- aInfo.SetRadius2(aRmin);
- aInfo.SetHeight(aHeight);
- //
- aInfo.SetKindOfName(GEOMAlgo_KN_CONE);
+ //
+ if (aNbCE==2 && aNbSE==1) {
+ gp_Lin aLin(aPLoc, aDir);
+ //
+ aT0=ElCLib::Parameter(aLin, aPC[0]);
+ aT1=ElCLib::Parameter(aLin, aPC[1]);
+ //
+ aPc=aPC[0];
+ if (aT0>aT1) {
+ aPc=aPC[1];
+ }
+ aHeight=aPC[0].Distance(aPC[1]);
+ //
+ gp_Ax3 aAx3=aCyl.Position();
+ aAx3.SetLocation(aPc);
+ //
+ aInfo.SetPosition(aAx3);
+ aInfo.SetLocation(aPc);
+ aInfo.SetHeight(aHeight);
+ //
+ aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
+ return; // conventional cylinder
+ }//if (aNbCE==2 && aNbSE==1) {
+ }//if (aNbV==2 && aNbE==3) {
}
//=======================================================================
//function : FillDetails
//purpose :
//=======================================================================
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
- const gp_Cylinder& aCyl)
+ const gp_Cone& aCone)
{
- Standard_Integer i, aNbV, aNbE, aNbCE, aNbSE;
- Standard_Real aT0, aT1, aHeight;
- gp_Pnt aPC[3], aPc;
+ Standard_Integer aNbV, aNbE, aNbCE, aNbSE, aNbDE, i;
+ Standard_Real aR[3], aHeight, aRmin, aRmax;
+ gp_Pnt aPC[3], aPD, aPc, aPX[3];
+ TopoDS_Vertex aVD;
TopoDS_Edge aE;
+ TopoDS_Iterator aIt;
TopExp_Explorer aExp;
TopTools_MapOfShape aM;
- GEOMAlgo_KindOfShape aKS;
- GEOMAlgo_KindOfName aKN, aKNE;
+ GEOMAlgo_KindOfShape aKSE;
+ GEOMAlgo_KindOfName aKNE;
GEOMAlgo_KindOfClosed aKCE;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
- aKN=GEOMAlgo_KN_UNKNOWN;
- aInfo.SetKindOfName(aKN);
- //
- aKS=aInfo.KindOfShape();
- if (aKS!=GEOMAlgo_KS_CYLINDER) {
- return;
- }
//
- if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) {
- return;
- }
+ aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
//
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
- if (!(aNbV==2 && aNbE==3)) {
- return;
- }
- //
- i=0;
- aNbCE=0;
- aNbSE=0;
- aExp.Init(aF, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- aE=TopoDS::Edge(aExp.Current());
- if(aM.Add(aE)) {
- const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
- aKNE=aInfoE.KindOfName();
- aKCE=aInfoE.KindOfClosed();
- if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) {
- aPC[aNbCE]=aInfoE.Location();
- ++aNbCE;
- }
- else if (aKNE==GEOMAlgo_KN_SEGMENT) {
- if (BRep_Tool::IsClosed(aE, aF)) {
- ++aNbSE;
+ if (aNbV==2 && aNbE==3) {
+ i=0;
+ aNbCE=0;
+ aNbSE=0;
+ aNbDE=0;
+ aExp.Init(aF, TopAbs_EDGE);
+ for (; aExp.More(); aExp.Next()) {
+ aE=TopoDS::Edge(aExp.Current());
+ if(aM.Add(aE)) {
+ const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
+ aKNE=aInfoE.KindOfName();
+ aKCE=aInfoE.KindOfClosed();
+ aKSE=aInfoE.KindOfShape();
+ if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) {
+ aPC[i]=aInfoE.Location();
+ aR[i]=aInfoE.Radius1();
+ //
+ aIt.Initialize(aE);
+ if (aIt.More()) {
+ aVD=*((TopoDS_Vertex*)&aIt.Value());
+ }
+ aPX[i]=BRep_Tool::Pnt(aVD);
+ //
+ ++i;
+ ++aNbCE;
+ }
+ else if (aKNE==GEOMAlgo_KN_SEGMENT) {
+ if (BRep_Tool::IsClosed(aE, aF)) {
+ ++aNbSE;
+ }
+ }
+ else if (aKSE==GEOMAlgo_KS_DEGENERATED) {
+ aIt.Initialize(aE);
+ if (aIt.More()) {
+ aVD=*((TopoDS_Vertex*)&aIt.Value());
+ }
+ //
+ aPD=BRep_Tool::Pnt(aVD);
+ //
+ ++aNbDE;
}
}
}
- }
- //
- if (!(aNbCE==2 && aNbSE==1)) {
- return;
- }
- //
- const gp_Ax1& aAx1=aCyl.Axis();
- const gp_Dir& aDir=aAx1.Direction();
- const gp_Pnt& aPLoc=aAx1.Location();
- gp_Lin aLin(aPLoc, aDir);
- //
- aT0=ElCLib::Parameter(aLin, aPC[0]);
- aT1=ElCLib::Parameter(aLin, aPC[1]);
- //
- aPc=aPC[0];;
- if (aT0>aT1) {
- aPc=aPC[1];
- }
- aHeight=aPC[0].Distance(aPC[1]);
+ //
+ if ((aNbCE==2 || (aNbCE==1 && aNbDE==1)) && aNbSE==1) {
+ if (aNbDE==1) {
+ aPC[1]=aPD;
+ aR[1]=0.;
+ }
+ //
+ aHeight=aPC[0].Distance(aPC[1]);
+ //
+
+ gp_Ax2 aAx2new;
+ //
+ if (aR[0]>aR[1]) {
+ aRmin=aR[1];
+ aRmax=aR[0];
+ aPc=aPC[0];
+ gp_Vec aVz(aPC[0], aPC[1]);
+ gp_Vec aVx(aPC[0], aPX[0]);
+ gp_Dir aDz(aVz);
+ gp_Dir aDx(aVx);
+ gp_Ax2 aAx2(aPc, aDz, aDx);
+ aAx2new=aAx2;
+ }
+ else {
+ aRmin=aR[0];
+ aRmax=aR[1];
+ aPc=aPC[1];
+ gp_Vec aVz(aPC[1], aPC[0]);
+ gp_Vec aVx(aPC[1], aPX[1]);
+ gp_Dir aDz(aVz);
+ gp_Dir aDx(aVx);
+ gp_Ax2 aAx2(aPc, aDz, aDx);
+ aAx2new=aAx2;
+ }
+ //
+ gp_Ax3 aAx3(aAx2new);
+ aInfo.SetLocation(aPc);
+ aInfo.SetPosition(aAx3);
+ aInfo.SetRadius1(aRmax);
+ aInfo.SetRadius2(aRmin);
+ aInfo.SetHeight(aHeight);
+ //
+ aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
+ return;
+ }//if ((aNbCE==2 || (aNbCE==1 && aNbDE==1)) && aNbSE==1) {
+ }//if (aNbV==2 && aNbE==3) {
//
- gp_Ax3 aAx3=aCyl.Position();
- aAx3.SetLocation(aPc);
+ aInfo.SetRadius1 (aCone.RefRadius());
//
- aInfo.SetKindOfName(GEOMAlgo_KN_CYLINDER);
- aInfo.SetPosition(aAx3);
- aInfo.SetLocation(aPc);
- aInfo.SetHeight(aHeight);
+ aRmin=0.; // ZZ
+ aInfo.SetRadius2(aRmin);
}
-
//=======================================================================
//function : FillDetails
//purpose :
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
const gp_Torus& )
{
+
Standard_Integer aNbV, aNbE, aNbSE;
TopoDS_Edge aE;
TopExp_Explorer aExp;
GEOMAlgo_KindOfShape aKS;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
- aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
+ aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
//
aKS=aInfo.KindOfShape();
if (aKS!=GEOMAlgo_KS_TORUS) {
return;
}
- //
+
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
- aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
- if (!(aNbV==1 && aNbE==2)) {
- return;
- }
- //
- aNbSE=0;
- aExp.Init(aF, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- aE=TopoDS::Edge(aExp.Current());
- if (aM.Add(aE)) {
- if (BRep_Tool::IsClosed(aE, aF)) {
- ++aNbSE;
+ aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
+
+ if (aNbV==1 && aNbE==2) {
+ aNbSE=0;
+ aExp.Init(aF, TopAbs_EDGE);
+ for (; aExp.More(); aExp.Next()) {
+ aE=TopoDS::Edge(aExp.Current());
+ if (aM.Add(aE)) {
+ if (BRep_Tool::IsClosed(aE, aF)) {
+ ++aNbSE;
+ }
}
}
+ //
+ if (aNbSE==2) {
+ aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
+ }
}
- //
- if (aNbSE!=2) {
- return;
- }
- aInfo.SetKindOfName(GEOMAlgo_KN_TORUS);
}
-//modified by NIZNHY-PKV Tue Jul 03 13:29:41 2012f
//=======================================================================
//function : TreatStepSphere
//purpose :
//=======================================================================
-Standard_Boolean
- GEOMAlgo_ShapeInfoFiller::TreatStepSphere(const TopoDS_Solid& aSd)
+Standard_Boolean GEOMAlgo_ShapeInfoFiller::TreatStepSphere
+ (const TopoDS_Solid& aSd)
{
Standard_Boolean bRet, bIsAllowedType, bOnlyClosed, bIsEqual;
Standard_Integer j;
- Standard_Real aTolAng, aTolLin;
+ Standard_Real aTolAng, aTol;
Standard_Real aVolume, aVolumeS, dV, aArea, aAreaS, dA;
gp_Sphere aSphere[2];
GeomAbs_SurfaceType aST;
TopExp_Explorer aExp;
//
bRet=Standard_False;
- aTolLin=Precision::Confusion();
+ aTol=Precision::Confusion();
aTolAng=Precision::Angular();
//
aExp.Init(aSd, TopAbs_FACE);
aSphere[j]=aGAS.Sphere();
}
//
- bIsEqual=IsEqual(aSphere[0], aSphere[1], aTolLin);
+ bIsEqual=IsEqual(aSphere[0], aSphere[1], aTol);
if (!bIsEqual) {
return bRet;
}
//
aVolume=aSphere[0].Volume();
//
- BRepGProp::VolumeProperties(aSd, aGProps, bOnlyClosed);
+ //modified by NIZNHY-PKV Tue Jun 09 08:39:47 2015f
+ BRepGProp::VolumeProperties(aSd, aGProps, aTol, bOnlyClosed);
+ //BRepGProp::VolumeProperties(aSd, aGProps, bOnlyClosed);
+ //modified by NIZNHY-PKV Tue Jun 09 08:39:50 2015t
aVolumeS=aGProps.Mass();
if (aVolumeS<0.) {
aVolumeS=-aVolumeS;
}
//
dV=fabs(aVolumeS-aVolume);
- if (dV>aTolLin) {
+ if (dV>aTol) {
return bRet;
}
//--------------------------------
aArea=aSphere[0].Area();
//
- BRepGProp::SurfaceProperties(aSd, aGProps);
+ //modified by NIZNHY-PKV Tue Jun 09 08:23:54 2015f
+ BRepGProp::SurfaceProperties(aSd, aGProps, aTol);
+ //BRepGProp::SurfaceProperties(aSd, aGProps);
+ //modified by NIZNHY-PKV Tue Jun 09 08:23:56 2015t
aAreaS=aGProps.Mass();
//
dA=fabs(aAreaS-aArea);
- if (dA>aTolLin) {
+ if (dA>aTol) {
return bRet;
}
//
//
return bRet;
}
-//modified by NIZNHY-PKV Tue Jul 03 13:29:43 2012t
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
const BOPDS_IndexRange& aRange=pDS->Range(iRank);
aRange.Indices(iBeg, iEnd);
const TopoDS_Solid& aSolid=(!iRank) ? *((TopoDS_Solid*)&aTool) : *((TopoDS_Solid*)&aObj);
- BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
+ //BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
//
//------------------------------ShellSolidBuilder
GEOMAlgo_ShellSolidBuilder aSSB;
const TopoDS_Shape& aS=pDS->Shape(i);
aType=aS.ShapeType();
if (aType!=TopAbs_FACE) {
- continue;
+ continue;
}
//
aState=TopAbs_UNKNOWN;
aF=*((TopoDS_Face*)&aS);
//
if (!aImages.IsBound(aS)) {
- iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D);
- if (iErr) {
- myErrorStatus=16;
- return;
- }
- //
- aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx);
+ iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D);
+ if (iErr) {
+ myErrorStatus=16;
+ return;
+ }
+ //
+ aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx);
}
else {
- const BOPCol_ListOfShape& aLSp=aImages.Find(aS);
- aNbSp=aLSp.Extent();
- if (aNbSp>0) {
- continue;
- }
- //
- if (aNbSp==1) {
- aF=*((TopoDS_Face*)&aLSp.First());
- }
- //
- iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D);
- if (iErr) {
- myErrorStatus=16;
- return;
- }
- //
- aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx);
+ const BOPCol_ListOfShape& aLSp=aImages.Find(aS);
+ aNbSp=aLSp.Extent();
+ if (aNbSp>0) {
+ continue;
+ }
+ //
+ if (aNbSp==1) {
+ aF=*((TopoDS_Face*)&aLSp.First());
+ }
+ //
+ iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D);
+ if (iErr) {
+ myErrorStatus=16;
+ return;
+ }
+ //
+ aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx);
}
//----------
if (aState==TopAbs_ON) {
- myLSON.Append(aF);
+ myLSON.Append(aF);
}
else if (aState==TopAbs_OUT) {
- myLSOUT.Append(aF);
+ myLSOUT.Append(aF);
}
else if (aState==TopAbs_IN) {
- myLSIN.Append(aF);
- }
+ myLSIN.Append(aF);
+ }
//----------
}//for (i=iBeg; i<=iEnd; ++i) {
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
TopoDS_Iterator aItC;
//
aLC.Append (aC1);
- while(1) {
+ for(;;) {
aLC1.Clear();
aIt.Initialize(aLC);
for (; aIt.More(); aIt.Next()) {
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//function : GetState
//purpose :
//=======================================================================
- Standard_Integer GEOMAlgo_SurfaceTools::GetState(const gp_Pnt& aP,
- const GeomAdaptor_Surface& aGAS,
- const Standard_Real aTol,
- TopAbs_State& aState)
+ Standard_Integer GEOMAlgo_SurfaceTools::GetState
+ (const gp_Pnt& aP,
+ const GeomAdaptor_Surface& aGAS,
+ const Standard_Real aTol,
+ TopAbs_State& aState)
{
Standard_Integer iErr = 0;
GeomAbs_SurfaceType aType = aGAS.GetType();
//function : GetState
//purpose :
//=======================================================================
- Standard_Integer GEOMAlgo_SurfaceTools::GetState(const gp_Pnt& aP,
- const Handle(Geom_Surface)& aSurf,
- const Standard_Real aTol,
- TopAbs_State& aState)
+ Standard_Integer GEOMAlgo_SurfaceTools::GetState
+ (const gp_Pnt& aP,
+ const Handle(Geom_Surface)& aSurf,
+ const Standard_Real aTol,
+ TopAbs_State& aState)
{
Standard_Integer iErr;
GeomAdaptor_Surface aGAS;
//function : ReverseState
//purpose :
//=======================================================================
- TopAbs_State GEOMAlgo_SurfaceTools::ReverseState(const TopAbs_State aState)
+ TopAbs_State GEOMAlgo_SurfaceTools::ReverseState
+ (const TopAbs_State aState)
{
TopAbs_State aRSt=aState;
//
//function : IsCoaxial
//purpose :
//=======================================================================
-Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1,
- const gp_Pnt& aP2,
- const gp_Cylinder& aCyl,
- const Standard_Real aTol)
+Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial
+ (const gp_Pnt& aP1,
+ const gp_Pnt& aP2,
+ const gp_Cylinder& aCyl,
+ const Standard_Real aTol)
{
const gp_XYZ &aLoc = aCyl.Location().XYZ();
const gp_Ax1 &aAxis = aCyl.Axis();
gp_XYZ aDP2 = aP2.XYZ().Subtracted(aLoc);
Standard_Real aDot1 = aDP1.Dot(aDAxis);
Standard_Real aDot2 = aDP1.Dot(aDAxis);
- Standard_Real aTol2 = aTol*aTol;
+ //Standard_Real aTol2 = aTol*aTol;
// Project P1 and P2 onto a plane with location aLoc and Norm aDAxis.
aDP1.Subtract(aDAxis.Multiplied(aDot1));
if (fabs(aRadius1 - aRadius2) <= aTol) {
// Check the deflection of the middle point.
gp_XYZ aMidP = 0.5*(aDP1 + aDP2);
- Standard_Real aMidRadius1 = aMidP.Modulus();
+ //Standard_Real aMidRadius1 = aMidP.Modulus();
if (fabs(aRadius1 - aRadius2) <= aTol) {
isOn = Standard_True;
//function : IsAnalytic
//purpose :
//=======================================================================
-Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic(const Handle(Geom_Surface)& aSurf)
+Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic
+ (const Handle(Geom_Surface)& aSurf)
{
Standard_Boolean bRet;
GeomAbs_SurfaceType aType;
//function : IsConformState
//purpose :
//=======================================================================
-Standard_Boolean GEOMAlgo_SurfaceTools::IsConformState(const TopAbs_State aST1,
- const GEOMAlgo_State aST2)
+Standard_Boolean GEOMAlgo_SurfaceTools::IsConformState
+ (const TopAbs_State aST1,
+ const GEOMAlgo_State aST2)
{
Standard_Boolean bRet=Standard_False;
//
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// function : TypeName()
// purpose : Get string representation for the shape type
//=======================================================================
-QString GEOMBase::TypeName( TopAbs_ShapeEnum type )
+QString GEOMBase::TypeName( TopAbs_ShapeEnum type, bool capitalize )
{
QString name = "shape";
switch( type ) {
default:
break;
}
+ if ( capitalize && !name.isEmpty() )
+ name = name.left(1).toUpper() + name.mid(1);
return name;
}
// Function : PublishSubObject
// Purpose : Publish sub-shape under the main object
//================================================================
-void GEOMBase::PublishSubObject( GEOM::GEOM_Object_ptr object )
+void GEOMBase::PublishSubObject( GEOM::GEOM_Object_ptr object, const QString& name )
{
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( study && !CORBA::is_nil( object ) ) {
GEOM::GEOM_Object_var father = object->GetMainShape();
QString fatherEntry = GetEntry( father );
if ( entry.isEmpty() && !CORBA::is_nil( father ) && !fatherEntry.isEmpty() ) {
- QString name = GetName( object );
+ QString aName = !name.isEmpty() ? name : GetName( object );
GeometryGUI::GetGeomGen()->AddInStudy( GeometryGUI::ClientStudyToStudy( studyDS ),
- object, name.toLatin1().data(), father.in() );
+ object, aName.toLatin1().data(), father.in() );
}
}
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
static bool IsShape( GEOM::GEOM_Object_ptr object );
/* Get string representation of shape type */
- static QString TypeName( TopAbs_ShapeEnum type );
+ static QString TypeName( TopAbs_ShapeEnum type, bool capitalize = false );
/* Get study entry for the given object */
static QString GetEntry( GEOM::GEOM_Object_ptr object );
/* Publish sub-shape under the main object */
- static void PublishSubObject( GEOM::GEOM_Object_ptr object );
+ static void PublishSubObject( GEOM::GEOM_Object_ptr object, const QString& name = QString() );
static void Synchronize( QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right );
};
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <LightApp_DataOwner.h>
#include <SalomeApp_Tools.h>
#include <SALOME_ListIO.hxx>
+#include "utilities.h"
#include <SALOME_Prs.h>
+#include "utilities.h"
#include <OCCViewer_ViewModel.h>
#include <SVTK_ViewModel.h>
const bool toRemoveFromEngine,
const double lineWidth,
const int displayMode,
- const int color )
+ const int color,
+ const bool append )
{
if(!display) {
erasePreview( update );
return;
}
- erasePreview( false );
+ if( !append )
+ erasePreview( false );
try {
SUIT_OverrideCursor wc;
{
SUIT_ViewManager* aViewManager = myViewWindow->getViewManager();
if ( aViewManager->getType() == OCCViewer_Viewer::Type() ||
- aViewManager->getType() == SVTK_Viewer::Type() )
+ aViewManager->getType() == SVTK_Viewer::Type() )
{
- SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
- SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
- if (aView)
- aView->Erase( getDisplayer(), *anIter, true );
+ SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
+ SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
+ if (aView)
+ aView->Erase( getDisplayer(), *anIter, true );
}
}
delete *anIter;
//================================================================
// Function : localSelection
// Purpose : Activate selection of sub-shapes in accordance with mode
-// theMode is from TopAbs_ShapeEnum
+// modes are from TopAbs_ShapeEnum
//================================================================
-void GEOMBase_Helper::localSelection( const ObjectList& theObjs, const int theMode )
+void GEOMBase_Helper::localSelection( const ObjectList& theObjs, const std::list<int> modes )
{
SALOME_ListIO aListOfIO;
anEntry.toLatin1().constData(), "GEOM", strdup( GEOMBase::GetName( anObj ).toLatin1().constData() ) ) );
}
- getDisplayer()->LocalSelection( aListOfIO, theMode );
+ getDisplayer()->LocalSelection( aListOfIO, modes );
}
//================================================================
// Purpose : Activate selection of sub-shapes in accordance with mode
// theMode is from TopAbs_ShapeEnum
//================================================================
-void GEOMBase_Helper::localSelection( GEOM::GEOM_Object_ptr obj, const int mode )
+void GEOMBase_Helper::localSelection( const ObjectList& theObjs, const int theMode )
+{
+ std::list<int> modes;
+ modes.push_back( theMode );
+ localSelection( theObjs, modes );
+}
+
+//================================================================
+// Function : localSelection
+// Purpose : Activate selection of sub-shapes in accordance with mode
+// modes are from TopAbs_ShapeEnum
+//================================================================
+void GEOMBase_Helper::localSelection( GEOM::GEOM_Object_ptr obj, const std::list<int> modes )
{
// If object is null local selection for all objects is activated
if ( obj->_is_nil() ) {
- getDisplayer()->LocalSelection( Handle(SALOME_InteractiveObject)(), mode );
+ getDisplayer()->LocalSelection( Handle(SALOME_InteractiveObject)(), modes );
return;
}
ObjectList objList;
objList.push_back( obj );
- localSelection( objList, mode );
+ localSelection( objList, modes );
+}
+
+//================================================================
+// Function : localSelection
+// Purpose : Activate selection of sub-shapes in accordance with mode
+// mode is from TopAbs_ShapeEnum
+//================================================================
+void GEOMBase_Helper::localSelection( GEOM::GEOM_Object_ptr obj, const int mode )
+{
+ std::list<int> modes;
+ modes.push_back( mode );
+ localSelection( obj, modes );
+}
+
+//================================================================
+// Function : localSelection
+// Purpose : Activate selection of sub-shapes in accordance with mode
+// modes are from TopAbs_ShapeEnum
+//================================================================
+void GEOMBase_Helper::localSelection( const std::list<int> modes )
+{
+ localSelection( GEOM::GEOM_Object::_nil(), modes );
}
+//================================================================
+// Function : localSelection
+// Purpose : Activate selection of sub-shapes in accordance with mode
+// mode is from TopAbs_ShapeEnum
+//================================================================
+void GEOMBase_Helper::localSelection( const int mode )
+{
+ std::list<int> modes;
+ modes.push_back( mode );
+ localSelection( modes );
+}
//================================================================
// Function : globalSelection
showError();
}
else {
+ QList<GEOM::GeomObjPtr> anObjectList = getSourceObjects( );
addSubshapesToStudy(); // add Sub-shapes if local selection
const int nbObjs = objects.size();
QStringList anEntryList;
QString aName = getObjectName(obj);
if (aName.isEmpty()) {
aName = getNewObjectName(currObj);
- if ( nbObjs > 1 ) {
- if (aName.isEmpty())
- aName = getPrefix(obj);
- if (nbObjs <= 30) {
- // Try to find a unique name
- aName = GEOMBase::GetDefaultName(aName, extractPrefix());
- } else {
- // Don't check name uniqueness in case of numerous objects
- aName = aName + "_" + QString::number(aNumber++);
- }
- } else {
- // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
- if ( aName.isEmpty() )
- aName = GEOMBase::GetDefaultName( getPrefix( obj ) );
- }
+ if ( nbObjs > 1 ) {
+ if (aName.isEmpty())
+ aName = getPrefix(obj);
+ if (nbObjs <= 30) {
+ // Try to find a unique name
+ aName = GEOMBase::GetDefaultName(aName, extractPrefix());
+ } else {
+ // Don't check name uniqueness in case of numerous objects
+ aName = aName + "_" + QString::number(aNumber++);
+ }
+ } else {
+ // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
+ if ( aName.isEmpty() )
+ aName = GEOMBase::GetDefaultName( getPrefix( obj ) );
+ }
}
anEntryList << addInStudy( obj, aName.toLatin1().constData() );
// updateView=false
}
anApp->putInfo( QObject::tr("GEOM_PRP_DONE") );
}
+ if ( anObjectList.count() > 0 )
+ hideSourceObjects( anObjectList );
result = true;
}
else
if ( !CORBA::is_nil( cobject ) ) {
GEOM::ListOfLong_var indices = cobject->GetSubShapeIndices();
int length = indices->length();
- // VSR 18/03/2014: we need only sub-shapes with single sub-shape index (to exclude groups, etc)
- if ( length == 1 && indices[0] == theIndex ) {
- object = cobject;
- break;
+ // VSR 18/03/2014: we need only sub-shapes with single sub-shape index (to exclude groups, etc)
+ if ( length == 1 && indices[0] == theIndex ) {
+ object = cobject;
+ break;
}
}
}
//Impemented in Dialogs, called from Accept method
}
+//================================================================
+// Function : getSourceObjects
+// Purpose : Virtual method to get source objects
+//================================================================
+QList<GEOM::GeomObjPtr> GEOMBase_Helper::getSourceObjects()
+{
+ //Impemented in Dialogs, called from Accept method
+ QList<GEOM::GeomObjPtr> res;
+ return res;
+}
+
//================================================================
// Function : getSelected
// Purpose : Get selected object by specified type
}
return result;
}
+//================================================================
+// Function : hideSourceObject
+// Purpose :
+//================================================================
+void GEOMBase_Helper::hideSourceObjects( QList<GEOM::GeomObjPtr> theObject )
+{
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ if ( resMgr->booleanValue( "Geometry", "hide_input_object", true) ) {
+ GEOM_Displayer* aDisplayer = getDisplayer();
+ for ( int i = 0; i < theObject.count(); i++ )
+ aDisplayer->Erase( theObject[i].get() );
+ }
+}
//================================================================
// Function : setIsApplyAndClose
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
const bool toRemoveFromEngine = true,
const double lineWidth = -1,
const int displayMode = -1,
- const int color = -1 );
+ const int color = -1,
+ const bool append = false );
// This is the easiest way to show preview. It is based on execute() method.
// It removes temporary GEOM::GEOM_Objects automatically.
const bool = true );
void erasePreview ( const bool = true );
+ void localSelection( const ObjectList&, const std::list<int> );
void localSelection( const ObjectList&, const int );
+ void localSelection( GEOM::GEOM_Object_ptr, const std::list<int> );
void localSelection( GEOM::GEOM_Object_ptr, const int );
+ void localSelection( const std::list<int> );
+ void localSelection( const int );
void activate( const int );
void globalSelection( const int = GEOM_ALLOBJECTS, const bool = false );
void globalSelection( const TColStd_MapOfInteger&, const bool = false );
virtual QString getObjectName(GEOM::GEOM_Object_ptr object) const;
virtual bool extractPrefix() const;
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
GEOM::GEOM_Object_ptr findObjectInFather( GEOM::GEOM_Object_ptr theFather, const QString& theName );
GEOM::GEOM_Object_ptr findObjectInFather( GEOM::GEOM_Object_ptr theFather, int theIndex );
QList<GEOM::GeomObjPtr> getSelected( TopAbs_ShapeEnum type, int count, bool strict = true );
QList<GEOM::GeomObjPtr> getSelected( const QList<TopAbs_ShapeEnum>& types, int count, bool strict = true );
+ void hideSourceObjects( QList<GEOM::GeomObjPtr> theObjectList );
void SetIsPreview(const bool thePreview) {isPreview = thePreview;}
bool IsPreview() {return isPreview;}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
GEOMGUI_Selection.h
GEOM_GEOMGUI.hxx
GEOMGUI_CreationInfoWdg.h
+ GEOMGUI_TextTreeWdg.h
GEOMGUI_DimensionProperty.h
)
# header files / to be processed by moc
SET(_moc_HEADERS
GEOMGUI_CreationInfoWdg.h
+ GEOMGUI_TextTreeWdg.h
GeometryGUI.h
)
GEOMGUI_OCCSelector.cxx
GEOMGUI_Selection.cxx
GEOMGUI_CreationInfoWdg.cxx
+ GEOMGUI_TextTreeWdg.cxx
GEOMGUI_DimensionProperty.cxx
${_moc_SOURCES}
${_rcc_SOURCES}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// Author : Edward AGAPOV (eap)
#include "GEOMGUI_CreationInfoWdg.h"
+
+#include "GEOMImpl_Types.hxx"
-#include <SalomeApp_Application.h>
#include <SUIT_Desktop.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <SalomeApp_Application.h>
#include <QString>
#include <QLabel>
//:QWidget( app->desktop() )
{
setWindowTitle( tr( "CREATION_INFO_TITLE" ) );
- setObjectName( "geomCreationInformation" );
-
- QFrame* frame = new QFrame( this );
-
- QVBoxLayout* myLayout = new QVBoxLayout( this );
- myLayout->addWidget( frame );
- myLayout->setMargin(0);
- QGroupBox* operationGB = new QGroupBox( tr( "OPERATION" ), frame );
-
- myIconLbl = new QLabel( operationGB );
- myOperaionLnEd = new QLineEdit( operationGB );
- myOperaionLnEd->setReadOnly( true );
- myParamsTreeWd = new QTreeWidget( frame );
+ myParamsTreeWd = new QTreeWidget( this );
myParamsTreeWd->setColumnCount( 2 );
myParamsTreeWd->setHeaderLabels( QStringList() << tr( "PARAMETER" ) << tr( "VALUE" ) );
myParamsTreeWd->header()->setStretchLastSection( true );
myParamsTreeWd->header()->setResizeMode( 0, QHeaderView::ResizeToContents );
- QHBoxLayout* operationLay = new QHBoxLayout( operationGB );
- operationLay->addWidget( myIconLbl );
- operationLay->addWidget( myOperaionLnEd );
- operationLay->setMargin(5);
-
- QVBoxLayout* aLayout = new QVBoxLayout( frame );
- aLayout->addWidget( operationGB );
+ QVBoxLayout* aLayout = new QVBoxLayout( this );
aLayout->addWidget( myParamsTreeWd );
+ aLayout->setMargin(11);
// get a free dockable window id
myWindowID = 10;
++myWindowID; // pb when a GEOM is a sole module: CreationInfoWdg replaces Python console
}
-void GEOMGUI_CreationInfoWdg::setOperation(const QPixmap& icon, const QString& name)
+QTreeWidgetItem* GEOMGUI_CreationInfoWdg::addOperation(const QPixmap& icon, const QString& name)
{
- myIconLbl->setPixmap( icon );
- myOperaionLnEd->setText( name );
+ QTreeWidgetItem* item = new QTreeWidgetItem( myParamsTreeWd );
+ item->setIcon( 0, icon );
+ item->setText( 0, name );
if ( name.isEmpty() )
- myOperaionLnEd->setText( tr("NO_INFO"));
+ item->setText( 0, tr("NO_INFO"));
+
+ item->setExpanded( true );
+
+ return item;
}
-void GEOMGUI_CreationInfoWdg::addParam (const QString& name, const QString& value)
+void GEOMGUI_CreationInfoWdg::addParam (QTreeWidgetItem* operation,
+ const QString& name,
+ const QString& value)
{
- QTreeWidgetItem* item = new QTreeWidgetItem( myParamsTreeWd );
+ QTreeWidgetItem* item = new QTreeWidgetItem( operation );
//item->setFlags( Qt::NoItemFlags );
item->setExpanded( true );
void GEOMGUI_CreationInfoWdg::clear()
{
- myIconLbl->setPixmap( QPixmap() );
- myOperaionLnEd->setText( "" );
myParamsTreeWd->clear();
}
{
//std::cout<<"~GEOMGUI_CreationInfoWdg"<<std::endl;
}
+
+void GEOMGUI_CreationInfoWdg::setInfo( GEOM::CreationInformationSeq& info )
+{
+ clear();
+
+ QPixmap icon;
+ QString operationName;
+
+ try
+ {
+ if ( &info && info.length() > 0 )
+ {
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ for ( int j = 0, nb = info.length(); j < nb; ++j )
+ {
+ QString name = info[j].operationName.in();
+ if ( !name.isEmpty() )
+ {
+ // get plugin_name if any
+ QString plugin_name;
+ for ( size_t i = 0; i < info[j].params.length(); ++i )
+ {
+ QString value = info[j].params[i].name.in();
+ if ( value == PLUGIN_NAME )
+ plugin_name = info[j].params[i].value.in();
+ }
+ // get icon
+ QString prefix = plugin_name.isEmpty() ? "GEOM" : plugin_name;
+ if ( name.startsWith( "Import"))
+ icon = resMgr->loadPixmap( "GEOM", tr("ICO_IMPORT_SHAPE"), true );
+ else
+ icon = resMgr->loadPixmap( prefix, tr( ("ICO_"+name).toLatin1().constData() ), false );
+
+ // translate operation name
+ operationName = tr( ("MEN_"+name).toLatin1().constData() );
+ if ( operationName.startsWith( "MEN_" ))
+ operationName = name; // no translation
+
+ QTreeWidgetItem* operation = addOperation( icon, operationName );
+
+ // add parameters
+ for ( size_t i = 0; i < info[j].params.length(); ++i )
+ addParam( operation,
+ info[j].params[i].name.in(),
+ info[j].params[i].value.in() );
+ }
+ }
+ }
+ else
+ {
+ addOperation( icon, operationName );
+ }
+ }
+ catch (...)
+ {
+ }
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "GEOM_GEOMGUI.hxx"
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(GEOM_Gen)
+
#include <QWidget>
-class QString;
class QLabel;
class QLineEdit;
+class QString;
class QTreeWidget;
+class QTreeWidgetItem;
class SalomeApp_Application;
/*!
GEOMGUI_CreationInfoWdg( SalomeApp_Application* app );
~GEOMGUI_CreationInfoWdg();
- int getWinID() { return myWindowID; }
-
+ void setInfo( GEOM::CreationInformationSeq& info );
void clear();
- void setOperation(const QPixmap& icon, const QString& name);
- void addParam (const QString& name, const QString& value);
+
+ int getWinID() { return myWindowID; }
private:
- QLabel* myIconLbl;
- QLineEdit* myOperaionLnEd;
+ QTreeWidgetItem* addOperation(const QPixmap& icon, const QString& name);
+ void addParam (QTreeWidgetItem* operation, const QString& name, const QString& value);
+
+ QLabel* myIconLbl;
+ //QLineEdit* myOperaionLnEd;
QTreeWidget* myParamsTreeWd;
int myWindowID;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
#include "GEOMGUI_OCCSelector.h"
+#include <Basics_OCCTVersion.hxx>
+
#include <LightApp_DataSubOwner.h>
#include <OCCViewer_ViewModel.h>
Handle(SelectMgr_Selection) sel = theObj->Selection( m );
for ( sel->Init(); sel->More(); sel->Next() ) {
+#if OCC_VERSION_LARGE > 0x06080100
+ const Handle(SelectMgr_SensitiveEntity) aHSenEntity = sel->Sensitive();
+ if( aHSenEntity.IsNull() )
+ continue;
+
+ Handle(SelectBasics_SensitiveEntity) entity = aHSenEntity->BaseSensitive();
+#else
Handle(SelectBasics_SensitiveEntity) entity = sel->Sensitive();
+#endif
if ( entity.IsNull() )
continue;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <AIS_InteractiveObject.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_GraphicTool.hxx>
-#include <AIS_Drawer.hxx>
#include <Aspect_TypeOfFacingModel.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include<Graphic3d_MaterialAspect.hxx>
v = isVectorsMode( idx );
else if ( p == "isVerticesMode" )
v = isVerticesMode( idx );
+ else if ( p == "isNameMode" )
+ v = isNameMode( idx );
else if ( p == "topLevel" )
v = topLevel( idx );
else if ( p == "autoBringToFront" )
return res;
}
+bool GEOMGUI_Selection::isNameMode( const int index ) const
+{
+#ifdef USE_VISUAL_PROP_MAP
+ QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::ShowName ) );
+ if ( v.canConvert( QVariant::Bool ) )
+ return v.toBool();
+#endif
+
+ bool res = false;
+
+ SALOME_View* view = GEOM_Displayer::GetActiveView();
+ QString viewType = activeViewType();
+ if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
+ SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
+ if ( prs ) {
+ if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
+ SOCC_Prs* occPrs = (SOCC_Prs*) prs;
+ AIS_ListOfInteractive lst;
+ occPrs->GetObjects( lst );
+ if ( lst.Extent() ) {
+ Handle(AIS_InteractiveObject) io = lst.First();
+ if ( !io.IsNull() ) {
+ Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
+ if ( !aSh.IsNull() )
+ res = aSh->isShowName();
+ }
+ }
+ }
+ else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
+ SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
+ vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
+ if ( lst ) {
+ lst->InitTraversal();
+ vtkActor* actor = lst->GetNextActor();
+ if ( actor ) {
+ GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(actor);
+ if ( aGeomActor )
+ res = aGeomActor->GetNameMode();
+ }
+ }
+ }
+ }
+ }
+
+ return res;
+}
+
bool GEOMGUI_Selection::hasChildren( const _PTR(SObject)& obj )
{
if ( obj ) {
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
QString selectionMode() const;
bool isVectorsMode( const int ) const;
bool isVerticesMode( const int ) const;
+ bool isNameMode( const int ) const;
bool hasChildren( const int ) const;
int nbChildren( const int ) const;
bool hasConcealedChildren( const int ) const;
--- /dev/null
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+// File : GEOMGUI_TextTreeWdg.cxx
+// Author : Alexander KOVALEV (akl)
+
+#include "GEOMGUI_TextTreeWdg.h"
+
+#include "GEOMGUI_DimensionProperty.h"
+#include "GeometryGUI.h"
+#include "GeometryGUI_Operations.h"
+#include <GEOM_Constants.h>
+#include <GEOMUtils.hxx>
+
+// GUI includes
+#include <LightApp_Module.h>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Study.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_DataBrowser.h>
+
+// Qt includes
+#include <QAction>
+#include <QMenu>
+#include <QString>
+#include <QLabel>
+#include <QLineEdit>
+#include <QTreeWidget>
+#include <QHeaderView>
+#include <QGroupBox>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QHash>
+
+GEOMGUI_TextTreeWdg::GEOMGUI_TextTreeWdg( SalomeApp_Application* app )
+ : myDisplayer(NULL)
+{
+ myStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ myDisplayer = GEOM_Displayer( myStudy );
+
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ myVisibleIcon = QIcon( resMgr->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_VISIBLE" ) ) );
+ myInvisibleIcon = QIcon( resMgr->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_INVISIBLE" ) ) );
+
+ setWindowTitle( tr( "TEXT_TREE_VIEW_TITLE" ) );
+ setObjectName( "geomTextTreeWdg" );
+
+ setRootIsDecorated( true );
+ setSelectionMode( QAbstractItemView::ExtendedSelection );
+ setAllColumnsShowFocus( true );
+ setUniformRowHeights( true );
+
+ QStringList columnNames;
+ columnNames << tr("TEXT_TREE_VIEW_NAME") << "";
+ QTreeWidgetItem * headerItem = new QTreeWidgetItem( columnNames );
+ headerItem->setIcon( 1, myVisibleIcon );
+ setHeaderItem ( headerItem );
+ header()->moveSection( 1, 0 );
+ header()->setResizeMode( 1, QHeaderView::ResizeToContents );
+
+ QStringList rootNames;
+ rootNames << tr("GEOM_DIMENSIONS") << "";
+ myDimensionsItem = new QTreeWidgetItem( this, rootNames );
+ myDimensionsItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
+ addTopLevelItem( myDimensionsItem );
+
+ // get a free dockable window id
+ myWindowID = 11;
+ while( app->dockWindow( myWindowID ))
+ ++myWindowID;
+ ++myWindowID;
+
+ createActions();
+ setContextMenuPolicy( Qt::CustomContextMenu );
+ connect( this, SIGNAL( customContextMenuRequested(const QPoint&) ),
+ this, SLOT( showContextMenu(const QPoint&) ) );
+
+ connect( myStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ),
+ this, SLOT( updateVisibilityColumn( QString, Qtx::VisibilityState ) ) );
+ connect( app->objectBrowser(), SIGNAL( updated() ), this, SLOT( updateTree() ) );
+ GeometryGUI* aGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
+ connect( aGeomGUI, SIGNAL( DimensionsUpdated( const QString& ) ), this, SLOT( updateBranch( const QString& ) ) );
+ connect( this, SIGNAL( itemClicked( QTreeWidgetItem*, int) ),
+ this, SLOT( onItemClicked( QTreeWidgetItem*, int ) ) );
+
+}
+
+GEOMGUI_TextTreeWdg::~GEOMGUI_TextTreeWdg()
+{
+ //std::cout<<"~GEOMGUI_TextTreeWdg"<<std::endl;
+}
+
+//=================================================================================
+// function : createActions
+// purpose : Create context popup menu actions.
+//=================================================================================
+void GEOMGUI_TextTreeWdg::createActions()
+{
+ QAction* a = new QAction( tr( "MEN_DISPLAY" ), this );
+ a->setIcon( myVisibleIcon );
+ myActions.insert( GEOMOp::OpShow, a );
+
+ QAction* b = new QAction( tr( "MEN_ERASE" ), this );
+ b->setIcon( myInvisibleIcon );
+ myActions.insert( GEOMOp::OpHide, b );
+}
+
+//=================================================================================
+// function : updateTree
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::updateTree()
+{
+ myStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+ _PTR(Study) aDSStudy = myStudy->studyDS();
+ if ( aDSStudy ) {
+ _PTR(SComponent) SC ( aDSStudy->FindComponent( "GEOM" ) );
+ if ( SC ) {
+ _PTR(ChildIterator) anIter ( aDSStudy->NewChildIterator( SC ) );
+ anIter->InitEx( true );
+ QList<QString> objEntries = myObjects.keys();
+ while( anIter->More() ) {
+ _PTR(SObject) valSO ( anIter->Value() );
+ _PTR(SObject) refSO;
+ if ( !valSO->ReferencedObject( refSO ) ) {
+ // update tree of object's dimensions
+ QString anEntry = valSO->GetID().c_str();
+ updateBranch( anEntry );
+ objEntries.removeAll( anEntry );
+ }
+ anIter->Next();
+ }
+ foreach (QString entry, objEntries) {
+ removeBranch( entry, true );
+ }
+ }
+ }
+}
+
+//=================================================================================
+// function : updateBranch
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::updateBranch( const QString& theEntry )
+{
+ myStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+ if ( myStudy ) {
+ _PTR(Study) aStudyDS = myStudy->studyDS();
+ if ( aStudyDS ) {
+ _PTR(SObject) obj( aStudyDS->FindObjectID( theEntry.toStdString() ) );
+ QString aName = obj->GetName().c_str();
+
+ GEOMGUI_DimensionProperty aProp;
+ aProp.LoadFromAttribute( myStudy, theEntry.toStdString() );
+ int nbProps = aProp.GetNumber();
+
+ QTreeWidgetItem* objectItem = itemFromEntry( theEntry );
+ if ( objectItem ) {
+ removeBranch( theEntry, nbProps > 0 ? false : true );
+ }
+ QStringList itemName;
+ if ( nbProps > 0 ) {
+ itemName << aName << "";
+ if ( !objectItem ) {
+ objectItem = new QTreeWidgetItem( myDimensionsItem, itemName );
+ objectItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
+ objectItem->setData( 1, Qt::UserRole, theEntry );
+ myDimensionsItem->addChild( objectItem );
+ myObjects.insert( theEntry, objectItem );
+ if ( myDimensionsItem->childCount() == 1 )
+ myDimensionsItem->setExpanded( true );
+ }
+ bool isDisplayed = myDisplayer.IsDisplayed( theEntry );
+ // read dimension records from property
+ for ( int anIt = 0; anIt < aProp.GetNumber(); ++anIt )
+ {
+ QString aName = aProp.GetName( anIt );
+ bool isVisible = aProp.IsVisible( anIt );
+
+ QTreeWidgetItem* anItem = new QTreeWidgetItem;
+ anItem->setText( 0, aName );
+ // if ( isDisplayed )
+ anItem->setIcon( 1, isVisible ? myVisibleIcon : myInvisibleIcon );
+ anItem->setData( 0, Qt::UserRole, anIt );
+ anItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
+ objectItem->addChild( anItem );
+ }
+ }
+ }
+ }
+}
+
+//=================================================================================
+// function : removeBranch
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::removeBranch( const QString& theEntry, bool force )
+{
+ QTreeWidgetItem* objectItem = itemFromEntry( theEntry );
+ if ( !objectItem )
+ return;
+ qDeleteAll( objectItem->takeChildren() );
+ if ( force ) {
+ myDimensionsItem->removeChild( objectItem );
+ myObjects.remove( theEntry );
+ }
+}
+
+//=================================================================================
+// function : onItemClicked()
+// purpose : called when tree item was clicked
+//=================================================================================
+void GEOMGUI_TextTreeWdg::onItemClicked( QTreeWidgetItem* theItem, int theColumn )
+{
+ if( theColumn != 1 || theItem->icon( 1 ).isNull() || theItem->isDisabled() )
+ return;
+
+ std::string anEntry = entryFromItem( theItem->parent() ).toStdString();
+ int aDimIndex = idFromItem( theItem );
+ GEOMGUI_DimensionProperty aProp;
+ aProp.LoadFromAttribute( myStudy, anEntry );
+ if ( aProp.IsVisible( aDimIndex ) ) {
+ aProp.SetVisible( aDimIndex, false );
+ theItem->setIcon( 1, myInvisibleIcon );
+ } else {
+ aProp.SetVisible( aDimIndex, true );
+ theItem->setIcon( 1, myVisibleIcon );
+ }
+ aProp.SaveToAttribute( myStudy, anEntry );
+ redisplay( anEntry.c_str() );
+}
+
+//=================================================================================
+// function : idFromItem
+// purpose :
+//=================================================================================
+int GEOMGUI_TextTreeWdg::idFromItem( QTreeWidgetItem* theItem )
+{
+ if ( !theItem )
+ return -1;
+
+ bool isIdOK = false;
+ const int anId = theItem->data( 0, Qt::UserRole ).toInt( &isIdOK );
+
+ return isIdOK ? anId : -1;
+}
+
+//=================================================================================
+// function : entryFromItem
+// purpose :
+//=================================================================================
+QString GEOMGUI_TextTreeWdg::entryFromItem( QTreeWidgetItem* theShapeItem )
+{
+ if ( !theShapeItem )
+ return "";
+
+ return theShapeItem->data( 1, Qt::UserRole ).toString();
+}
+
+//=================================================================================
+// function : itemFromEntry
+// purpose :
+//=================================================================================
+QTreeWidgetItem* GEOMGUI_TextTreeWdg::itemFromEntry( QString theEntry )
+{
+ if ( theEntry.isEmpty() )
+ return 0;
+
+ return myObjects.value( theEntry, 0 );
+}
+
+//=================================================================================
+// function : updateVisibilityColumn
+// purpose : Update icons of dimension items.
+//=================================================================================
+void GEOMGUI_TextTreeWdg::updateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState )
+{
+ QTreeWidgetItem* anItem = itemFromEntry( theEntry );
+ if ( !anItem )
+ return;
+ anItem->setDisabled( theState != Qtx::ShownState );
+ QTreeWidgetItem* aChildItem;
+ GEOMGUI_DimensionProperty aProp;
+ for ( int i=0; i < anItem->childCount(); i++ ) {
+ aChildItem = anItem->child( i );
+ if ( theState == Qtx::ShownState ) {
+ aProp.LoadFromAttribute( myStudy, theEntry.toStdString() );
+ if ( aProp.GetNumber() == 0 )
+ continue;
+ aChildItem->setIcon( 1, aProp.IsVisible( idFromItem( aChildItem ) ) ? myVisibleIcon : myInvisibleIcon );
+ aChildItem->setDisabled( false );
+ } else {
+ aChildItem->setIcon( 1, QIcon() );
+ aChildItem->setDisabled( true );
+ }
+ }
+}
+
+//=================================================================================
+// function : showContextMenu
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::showContextMenu( const QPoint& pos )
+{
+ if ( selectedItems().isEmpty() )
+ return;
+ QMenu aMenu;
+ aMenu.addAction( myActions[GEOMOp::OpShow] );
+ aMenu.addAction( myActions[GEOMOp::OpHide] );
+ if ( selectedItems().count() == 1 ) {
+ QTreeWidgetItem* anItem = selectedItems().first();
+ QString anEntry = entryFromItem( anItem->parent() );
+ if ( !anEntry.isEmpty() ) {
+ GEOMGUI_DimensionProperty aProp;
+ aProp.LoadFromAttribute( myStudy, anEntry.toStdString() );
+ if ( aProp.GetNumber() == 0 )
+ return;
+ aMenu.clear();
+ if ( aProp.IsVisible( idFromItem( anItem ) ) )
+ aMenu.addAction( myActions[GEOMOp::OpHide] );
+ else
+ aMenu.addAction( myActions[GEOMOp::OpShow] );
+ }
+ }
+ QAction* selPopupItem = aMenu.exec( viewport()->mapToGlobal(pos) );
+ if ( selPopupItem == myActions[GEOMOp::OpShow] )
+ setVisibility( true );
+ else if ( selPopupItem == myActions[GEOMOp::OpHide] )
+ setVisibility( false );
+}
+
+//=================================================================================
+// function : setVisibility
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::setVisibility( bool theVisibility )
+{
+ if ( myDimensionsItem->isSelected() ) {
+ // set visibility for all dimensions
+ QTreeWidgetItem* anItem;
+ foreach ( QString entry, myObjects.keys() ) {
+ anItem = itemFromEntry( entry );
+ if ( !anItem->isDisabled() )
+ setShapeDimensionsVisibility( entry, theVisibility );
+ }
+ return;
+ }
+ foreach ( QTreeWidgetItem* item, selectedItems() ) {
+ if ( item->isDisabled() || item->parent()->isSelected() )
+ continue;
+ QString anEntry = entryFromItem( item );
+ if ( !anEntry.isEmpty() ) {
+ // it is a shape item
+ setShapeDimensionsVisibility( anEntry, theVisibility );
+ } else {
+ // it is a dimension item
+ anEntry = entryFromItem( item->parent() );
+ setDimensionVisibility( anEntry, item, theVisibility );
+ }
+ }
+}
+
+//=================================================================================
+// function : setShapeDimensionsVisibility
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::setShapeDimensionsVisibility( QString theEntry, bool theVisibility )
+{
+ QTreeWidgetItem* anItem = itemFromEntry( theEntry );
+ QTreeWidgetItem* aChildItem;
+ for ( int i=0; i < anItem->childCount(); i++ ) {
+ aChildItem = anItem->child( i );
+ setDimensionVisibility( theEntry, aChildItem, theVisibility );
+ }
+ redisplay( theEntry );
+}
+
+//=================================================================================
+// function : setDimensionVisibility
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::setDimensionVisibility( QString theEntry, QTreeWidgetItem* theDimItem, bool theVisibility )
+{
+ GEOMGUI_DimensionProperty aProp;
+ aProp.LoadFromAttribute( myStudy, theEntry.toStdString() );
+ int aDimIndex = idFromItem( theDimItem );
+ if ( aProp.GetNumber() == 0 || aProp.IsVisible( aDimIndex ) == theVisibility )
+ return;;
+ aProp.SetVisible( aDimIndex, theVisibility );
+ aProp.SaveToAttribute( myStudy, theEntry.toStdString() );
+
+ theDimItem->setIcon( 1, theVisibility ? myVisibleIcon : myInvisibleIcon );
+ redisplay( theEntry );
+}
+
+//=================================================================================
+// function : redisplay
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::redisplay( QString theEntry )
+{
+ Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( theEntry.toLatin1().constData(), "GEOM", "TEMP_IO" );
+ myDisplayer.Redisplay( io );
+}
--- /dev/null
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 GEOMGUI_TEXTTREEWDG_H
+#define GEOMGUI_TEXTTREEWDG_H
+
+#include "GEOM_GEOMGUI.hxx"
+#include "GEOM_Displayer.h"
+
+#include <QTreeWidget>
+#include <QHash>
+
+#include <SALOMEDSClient.hxx>
+
+class QLabel;
+class QLineEdit;
+class QString;
+class QTreeWidgetItem;
+class SalomeApp_Application;
+class SalomeApp_Study;
+
+/*!
+ * \brief Tree view contains Dimension and Annotation text items:
+ * - text visibility in OCC viewer
+ * - text object name
+ */
+class GEOMGUI_EXPORT GEOMGUI_TextTreeWdg : public QTreeWidget
+{
+ Q_OBJECT
+
+ public:
+ GEOMGUI_TextTreeWdg( SalomeApp_Application* app );
+ ~GEOMGUI_TextTreeWdg();
+
+ int getWinID() { return myWindowID; }
+
+ void removeBranch( const QString& theEntry,
+ bool force = true );
+ int idFromItem( QTreeWidgetItem* theItem );
+ QString entryFromItem( QTreeWidgetItem* theShapeItem );
+ QTreeWidgetItem* itemFromEntry( QString theEntry );
+ void setShapeDimensionsVisibility( QString theEntry, bool theVisibility );
+ void setDimensionVisibility( QString theEntry, QTreeWidgetItem* theDimItem, bool theVisibility );
+
+protected:
+ void createActions();
+ void redisplay( QString theEntry );
+
+ public slots:
+ void updateTree();
+ void updateBranch( const QString& theEntry );
+
+private slots:
+ void onItemClicked(QTreeWidgetItem*, int );
+ void updateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState );
+ void setVisibility( bool visibility );
+ void showContextMenu( const QPoint& pos );
+
+ private:
+
+ int myWindowID;
+
+ QIcon myVisibleIcon;
+ QIcon myInvisibleIcon;
+ QHash<QString, QTreeWidgetItem*> myObjects;
+ SalomeApp_Study* myStudy;
+ QTreeWidgetItem* myDimensionsItem;
+ GEOM_Displayer myDisplayer;
+
+ QMap<int, QAction*> myActions; //!< menu actions list
+
+};
+#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <LightApp_DataObject.h>
#include <SalomeApp_TypeFilter.h>
#include <SalomeApp_Tools.h>
+#include "utilities.h"
#include <SALOME_ListIO.hxx>
#include <SALOME_Prs.h>
+#include "utilities.h"
#include <SOCC_Prs.h>
#include <SOCC_ViewModel.h>
#include <OCCViewer_Utilities.h>
// OCCT Includes
-#include <AIS_Drawer.hxx>
#include <AIS_Dimension.hxx>
#include <AIS_LengthDimension.hxx>
#include <AIS_DiameterDimension.hxx>
// Hard-coded value of shape deflection coefficient for VTK viewer
const double VTK_MIN_DEFLECTION = 0.001;
+// If the next macro is defined, the deflection coefficient for VTK presentation
+// is limited by VTK_MIN_DEFLECTION
+//#define LIMIT_DEFLECTION_FOR_VTK
// Pixmap caching support
namespace
#endif
}
}
-}
+
+ uint randomize( uint size )
+ {
+ static bool initialized = false;
+ if ( !initialized ) {
+ qsrand( QDateTime::currentDateTime().toTime_t() );
+ initialized = true;
+ }
+ uint v = qrand();
+ v = uint( (double)( v ) / RAND_MAX * size );
+ v = qMax( uint(0), qMin ( v, size-1 ) );
+ return v;
+ }
+} // namespace
//================================================================
// Function : getActiveStudy
myHasDisplayMode = false;
int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS);
- myWidth = resMgr->integerValue("Geometry", "edge_width", -1);
- myIsosWidth = resMgr->integerValue("Geometry", "isolines_width", -1);
- myTransparency = resMgr->integerValue("Geometry", "transparency", 0) / 100.;
- myHasTransparency = false;
-
myTypeOfMarker = (Aspect_TypeOfMarker)(std::min((int)Aspect_TOM_RING3, std::max((int)Aspect_TOM_POINT, aType)));
myScaleOfMarker = (resMgr->integerValue("Geometry", "marker_scale", 1)-(int)GEOM::MS_10)*0.5 + 1.0;
myScaleOfMarker = std::min(7.0, std::max(1., myScaleOfMarker));
+ // Next properties provide a way to customize displaying of presentations;
+ // for instance, this is useful for preview
myColor = -1;
- // This color is used for shape displaying. If it is equal -1 then
- // default color is used.
myTexture = "";
-
+ myNbIsos = -1;
myWidth = -1;
+ myTransparency = -1;
myType = -1;
+ myIsosColor = -1;
+ myIsosWidth = -1;
+
+ // This parameter is used for activisation/deactivisation (selection) of objects to be displayed
myToActivate = true;
- // This parameter is used for activisation/deactivisation of objects to be displayed
// Activate parallel vizualisation only for testing purpose
// and if the corresponding env variable is set to 1
// - color for edges in shading+edges mode
AISShape->SetEdgesInShadingColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value<QColor>() ) );
+ // - color of labels (textual fields and shape name)
+ AISShape->SetLabelColor( qColorFromResources( "label_color", QColor( 255, 255, 255 ) ) );
+
// set display mode
AISShape->SetDisplayMode( HasDisplayMode() ?
// predefined display mode, manually set to displayer via GEOM_Displayer::SetDisplayMode() function
// display mode from properties
propMap.value( GEOM::propertyName( GEOM::DisplayMode ) ).toInt() );
- // - face boundaries color
- if( AISShape->DisplayMode() == GEOM_AISShape::ShadingWithEdges )
- AISShape->Attributes()->SetFaceBoundaryDraw( Standard_True );
+ // - face boundaries color and line width
anAspect = AISShape->Attributes()->FaceBoundaryAspect();
anAspect->SetColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value<QColor>() ) );
+ anAspect->SetWidth( HasWidth() ? GetWidth() : propMap.value( GEOM::propertyName( GEOM::LineWidth ) ).toInt() );
AISShape->Attributes()->SetFaceBoundaryAspect( anAspect );
// set display vectors flag
bool isVerticesMode = propMap.value( GEOM::propertyName( GEOM::Vertices ) ).toBool();
AISShape->SetDisplayVertices( isVerticesMode );
+ // set display name flag
+ bool isNameMode = propMap.value( GEOM::propertyName( GEOM::ShowName ) ).toBool();
+ AISShape->SetDisplayName( isNameMode );
+
// set transparency
if( HasTransparency() ) {
AISShape->SetTransparency( GetTransparency() );
int isosWidth = propMap.value( GEOM::propertyName( GEOM::IsosWidth ) ).toInt();
Handle(Prs3d_IsoAspect) uIsoAspect = AISShape->Attributes()->UIsoAspect();
Handle(Prs3d_IsoAspect) vIsoAspect = AISShape->Attributes()->VIsoAspect();
- uIsoAspect->SetColor( isosColor );
- uIsoAspect->SetWidth( isosWidth );
- uIsoAspect->SetNumber( uIsos );
- vIsoAspect->SetColor( isosColor );
- vIsoAspect->SetWidth( isosWidth );
- vIsoAspect->SetNumber( vIsos );
+
+ if ( HasIsosColor() ) {
+ uIsoAspect->SetColor( (Quantity_NameOfColor)GetIsosColor() );
+ vIsoAspect->SetColor( (Quantity_NameOfColor)GetIsosColor() );
+ }
+ else {
+ uIsoAspect->SetColor( isosColor );
+ vIsoAspect->SetColor( isosColor );
+ }
+
+ if ( HasIsosWidth() ) {
+ uIsoAspect->SetWidth( GetIsosWidth() );
+ vIsoAspect->SetWidth( GetIsosWidth() );
+ }
+ else {
+ uIsoAspect->SetWidth( isosWidth );
+ vIsoAspect->SetWidth( isosWidth );
+ }
+
+ if ( HasNbIsos() ) {
+ uIsoAspect->SetNumber( GetNbIsos() );
+ vIsoAspect->SetNumber( GetNbIsos() );
+ }
+ else {
+ uIsoAspect->SetNumber( uIsos );
+ vIsoAspect->SetNumber( vIsos );
+ }
+
AISShape->Attributes()->SetUIsoAspect( uIsoAspect );
AISShape->Attributes()->SetVIsoAspect( vIsoAspect );
// actor->SetShape(myShape,aDefPropMap.value(GEOM::propertyName( GEOM::Deflection )).toDouble(),myType == GEOM_VECTOR);
/////////////////////////////////////////////////////////////////////////
if ( !actor->getTopo().IsSame( myShape ) )
+#ifdef LIMIT_DEFLECTION_FOR_VTK
actor->SetShape( myShape, VTK_MIN_DEFLECTION, myType == GEOM_VECTOR );
+#else
+ actor->SetShape( myShape, qMax( propMap.value( GEOM::propertyName( GEOM::Deflection ) ).toDouble(), GEOM::minDeflection() ), myType == GEOM_VECTOR );
+#endif
// set material
Material_Model material;
// - set number of iso-lines
int nbIsos[2]= { 1, 1 };
- QStringList isos = propMap.value( GEOM::propertyName( GEOM::NbIsos ) ).toString().split( GEOM::subSectionSeparator() );
- nbIsos[0] = isos[0].toInt();
- nbIsos[1] = isos[1].toInt();
+ if ( HasNbIsos() ) {
+ nbIsos[0] = GetNbIsos();
+ nbIsos[1] = GetNbIsos();
+ }
+ else {
+ QStringList isos = propMap.value( GEOM::propertyName( GEOM::NbIsos ) ).toString().split( GEOM::subSectionSeparator() );
+ nbIsos[0] = isos[0].toInt();
+ nbIsos[1] = isos[1].toInt();
+ }
actor->SetNbIsos( nbIsos );
// - set iso-lines width
- actor->SetIsosWidth( propMap.value( GEOM::propertyName( GEOM::IsosWidth ) ).toInt() );
+ actor->SetIsosWidth( HasIsosWidth() ? GetIsosWidth() : propMap.value( GEOM::propertyName( GEOM::IsosWidth ) ).toInt() );
// - set iso-lines color
- c = propMap.value( GEOM::propertyName( GEOM::IsosColor ) ).value<QColor>();
+ if ( HasIsosColor() )
+ c = SalomeApp_Tools::color( Quantity_Color((Quantity_NameOfColor)GetIsosColor()) );
+ else
+ c = propMap.value( GEOM::propertyName( GEOM::IsosColor ) ).value<QColor>();
actor->SetIsosColor( c.redF(), c.greenF(), c.blueF() );
// set colors
c = propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value<QColor>();
actor->SetEdgesInShadingColor( c.redF(), c.greenF(), c.blueF() );
+ // - color of labels (shape name)
+ c = colorFromResources( "label_color", QColor( 255, 255, 255 ) );
+ actor->SetLabelColor( c.redF(), c.greenF(), c.blueF() );
+
// set opacity
if( HasTransparency() ) {
actor->SetOpacity( 1.0 - GetTransparency() );
// set display vertices flag
actor->SetVerticesMode( propMap.value( GEOM::propertyName( GEOM::Vertices ) ).toBool() );
+ // set display name flag
+ actor->SetNameMode( propMap.value( GEOM::propertyName( GEOM::ShowName ) ).toBool() );
+
// set display mode
int displayMode = HasDisplayMode() ?
// predefined display mode, manually set to displayer via GEOM_Displayer::SetDisplayMode() function
QColor aQColor = aResMgr->colorValue ( "Geometry", "dimensions_color", QColor( 0, 255, 0 ) );
int aLineWidth = aResMgr->integerValue( "Geometry", "dimensions_line_width", 1 );
- double aFontHeight = aResMgr->doubleValue ( "Geometry", "dimensions_font_height", 10 );
+ QFont aFont = aResMgr->fontValue ( "Geometry", "dimensions_font", QFont("Y14.5M-2009", 14) );
double anArrowLength = aResMgr->doubleValue ( "Geometry", "dimensions_arrow_length", 5 );
bool isUnitsShown = aResMgr->booleanValue( "Geometry", "dimensions_show_units", false );
QString aUnitsLength = aResMgr->stringValue ( "Geometry", "dimensions_length_units", "m" );
QString aUnitsAngle = aResMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" );
+ bool aUseText3d = aResMgr->booleanValue( "Geometry", "dimensions_use_text3d", false );
// restore dimension presentation from saved attribute or property data
AIS_ListOfInteractive aRestoredDimensions;
aStyle->SetCommonColor( aColor );
aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown );
- aStyle->MakeText3d( Standard_True );
+ aStyle->MakeText3d( aUseText3d );
aStyle->MakeTextShaded( Standard_True );
- aStyle->SetExtensionSize( aFontHeight * 0.5 );
- aStyle->TextAspect()->SetHeight( aFontHeight );
+ int fsize = aFont.pixelSize() != -1 ? aFont.pixelSize() : aFont.pointSize();
+ aStyle->SetExtensionSize( fsize * 0.5 );
+ aStyle->TextAspect()->SetFont( aFont.family().toLatin1().data() );
+ aStyle->TextAspect()->SetHeight( fsize );
aStyle->ArrowAspect()->SetLength( anArrowLength );
aStyle->LineAspect()->SetWidth( aLineWidth );
aStyle->SetTextHorizontalPosition( aPrs->DimensionAspect()->TextHorizontalPosition() );
if ( !GeomObject->_is_nil() )
{
+ theIO->setName( GeomObject->GetName() );
// finally set shape
setShape( GEOM_Client::get_client().GetShape( GeometryGUI::GetGeomGen(), GeomObject ) );
}
* of their sub-shapes (with opened local context for OCC viewer)
*/
//=================================================================
-void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& theIO, const int theMode )
+void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& theIO, const std::list<int> modes )
{
SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if (!theIO.IsNull() && !vf->isVisible(theIO))
Display(theIO);
SALOME_Prs* prs = vf->CreatePrs( theIO.IsNull() ? 0 : theIO->getEntry() );
- vf->LocalSelection( prs, theMode );
+ vf->LocalSelection( prs, modes );
delete prs; // delete presentation because displayer is its owner
}
}
+//=================================================================
+/*!
+ * GEOM_Displayer::LocalSelection
+ * Activate selection of CAD shapes with activisation of selection
+ * of their sub-shapes (with opened local context for OCC viewer)
+ */
+//=================================================================
+void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& theIO, const int theMode )
+{
+ std::list<int> modes;
+ modes.push_back( theMode );
+ LocalSelection( theIO, modes );
+}
+
//=================================================================
/*!
* GEOM_Displayer::globalSelection
* of their sub-shapes (with opened local context for OCC viewer)
*/
//=================================================================
-void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const int theMode )
+void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const std::list<int> modes )
{
SALOME_ListIteratorOfListIO Iter( theIOList );
for ( ; Iter.More(); Iter.Next() )
- LocalSelection( Iter.Value(), theMode );
+ LocalSelection( Iter.Value(), modes );
+}
+
+//=================================================================
+/*!
+ * GEOM_Displayer::LocalSelection
+ * Activate selection of CAD shapes with activisation of selection
+ * of their sub-shapes (with opened local context for OCC viewer)
+ */
+//=================================================================
+void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const int theMode )
+{
+ std::list<int> modes;
+ modes.push_back( theMode );
+ LocalSelection( theIOList, modes );
}
//=================================================================
//=================================================================
double GEOM_Displayer::SetTransparency( const double transparency )
{
- double aPrevTransparency = myTransparency;
- if ( transparency < 0 ) {
- UnsetTransparency();
- }
- else {
- myTransparency = transparency;
- myHasTransparency = true;
- }
- return aPrevTransparency;
+ double prevTransparency = myTransparency;
+ myTransparency = transparency;
+ return prevTransparency;
}
//=================================================================
//=================================================================
bool GEOM_Displayer::HasTransparency() const
{
- return myHasTransparency;
+ return myTransparency >= 0;
}
//=================================================================
//=================================================================
double GEOM_Displayer::UnsetTransparency()
{
- double aPrevTransparency = myTransparency;
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- myTransparency = resMgr->integerValue("Geometry", "transparency", 0) / 100.;
- myHasTransparency = false;
- return aPrevTransparency;
+ return SetTransparency( -1 );
}
-
//=================================================================
/*!
* GEOM_Displayer::SetTexture
- * Set color for shape displaying. If it is equal -1 then default color is used.
- * Available values are from Quantity_NameOfColor enumeration
*/
//=================================================================
void GEOM_Displayer::SetTexture( const std::string& texureFileName )
{
- if(texureFileName!="")
- {
- myTexture = texureFileName;
- }
+ myTexture = texureFileName;
}
bool GEOM_Displayer::HasTexture() const
myWidth = -1;
}
-
int GEOM_Displayer::GetIsosWidth() const
{
return myIsosWidth;
return myIsosWidth != -1;
}
+int GEOM_Displayer::SetNbIsos( const int nbIsos )
+{
+ int prevNbIsos = myNbIsos;
+ myNbIsos = nbIsos;
+ return prevNbIsos;
+}
+
+int GEOM_Displayer::UnsetNbIsos()
+{
+ return SetNbIsos( -1 );
+}
+
+int GEOM_Displayer::GetNbIsos() const
+{
+ return myNbIsos;
+}
+
+bool GEOM_Displayer::HasNbIsos() const
+{
+ return myNbIsos >= 0;
+}
+
+int GEOM_Displayer::SetIsosColor( const int color )
+{
+ int prevColor = myIsosColor;
+ myIsosColor = color;
+ return prevColor;
+}
+
+int GEOM_Displayer::GetIsosColor() const
+{
+ return myIsosColor;
+}
+
+bool GEOM_Displayer::HasIsosColor() const
+{
+ return myIsosColor != -1;
+}
+
+int GEOM_Displayer::UnsetIsosColor()
+{
+ return SetIsosColor( -1 );
+}
//=================================================================
/*!
}
}
- static int currentColor = 0;
+ static int currentColor = randomize( colors.size() );
SALOMEDS::Color color;
color.R = (double)colors[currentColor].red() / 255.0;
// - show vertices flag (false by default)
propMap.insert( GEOM::propertyName( GEOM::Vertices ), false );
+ // - show name flag (false by default)
+ propMap.insert( GEOM::propertyName( GEOM::ShowName ), false );
+
// - shading color (take default value from preferences)
propMap.insert( GEOM::propertyName( GEOM::ShadingColor ),
colorFromResources( "shading_color", QColor( 255, 255, 0 ) ) );
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
void SetIsosWidth ( const int );
int GetIsosWidth () const;
bool HasIsosWidth () const;
+
+ /* Set nb iso-libes for displaying. Use -1 to set default values. */
+ int SetNbIsos( const int );
+ int UnsetNbIsos();
+ int GetNbIsos() const;
+ bool HasNbIsos() const;
+ /* Set color for iso-lines displaying. If it is equal -1 then default color is used.
+ Available values are from Quantity_NameOfColor enumeration */
+ int SetIsosColor ( const int );
+ int UnsetIsosColor();
+ int GetIsosColor () const;
+ bool HasIsosColor () const;
+
/* Set display mode shape displaying. If it is equal -1 then display mode is used. */
int SetDisplayMode( const int );
int GetDisplayMode() const;
bool ToActivate() const;
/* Activate/Deactivate selection*/
+ void LocalSelection( const Handle(SALOME_InteractiveObject)&, const std::list<int> );
void LocalSelection( const Handle(SALOME_InteractiveObject)&, const int );
+ void LocalSelection( const SALOME_ListIO& theIOList, const std::list<int> );
void LocalSelection( const SALOME_ListIO& theIOList, const int );
void GlobalSelection( const int = GEOM_ALLOBJECTS, const bool = false );
void GlobalSelection( const TColStd_MapOfInteger&, const bool = false, const QList<int>* = 0 );
int myColor;
double myWidth;
int myIsosWidth;
+ int myNbIsos;
+ int myIsosColor;
bool myToActivate;
int myDisplayMode;
bool myHasDisplayMode;
Aspect_TypeOfMarker myTypeOfMarker;
double myScaleOfMarker;
double myTransparency;
- bool myHasTransparency;
private:
SalomeApp_Application* myApp;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
<source>ICON_DLG_BUILD_FACE</source>
<translation>build_face.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_BUILD_FACE_SURFACE</source>
+ <translation>build_face_surface.png</translation>
+ </message>
+ <message>
+ <source>ICON_DLG_BUILD_FACE_CONSTRAINTS</source>
+ <translation>build_face_constraints.png</translation>
+ </message>
<message>
<source>ICON_DLG_FACE_HW</source>
<translation>face_hw.png</translation>
<source>ICON_DLG_BUILD_SHELL</source>
<translation>build_shell.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_SOLID_FROM_FACES</source>
+ <translation>solid_from_faces.png</translation>
+ </message>
<message>
<source>ICON_DLG_BUILD_SOLID</source>
<translation>build_solid.png</translation>
<source>ICON_DLG_UNION_FACES</source>
<translation>union_faces.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_INSPECT_OBJECT</source>
+ <translation>inspect_object.png</translation>
+ </message>
<message>
<source>ICON_DLG_CHECKSHAPE</source>
<translation>check.png</translation>
<source>ICON_DLG_CHECK_SELF_INTERSECTIONS</source>
<translation>check_self_intersections.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_FAST_CHECK_INTERSECTIONS</source>
+ <translation>fast_intersect.png</translation>
+ </message>
<message>
<source>ICON_DLG_CIRCLE_PNTS</source>
<translation>circle3points.png</translation>
<source>ICON_DLG_DIVIDE_EDGE</source>
<translation>pointonedge.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_DIVIDE_EDGE_BY_PNT</source>
+ <translation>pointonedgebypoint.png</translation>
+ </message>
<message>
<source>ICON_DLG_ELLIPSE_PV</source>
<translation>ellipsepointvector.png</translation>
<translation>offset.png</translation>
</message>
<message>
- <source>ICON_DLG_PROJECTION</source>
+ <source>ICON_DLG_PROJECTION_ON_FACE</source>
<translation>projection.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_PROJECTION_ON_WIRE</source>
+ <translation>projection_on_wire.png</translation>
+ </message>
+ <message>
+ <source>ICON_DLG_PROJECTION_ON_EDGE</source>
+ <translation>projection_on_edge.png</translation>
+ </message>
+ <message>
+ <source>ICON_DLG_EXTEND_EDGE</source>
+ <translation>edgeextension.png</translation>
+ </message>
+ <message>
+ <source>ICON_DLG_EXTEND_FACE</source>
+ <translation>faceextension.png</translation>
+ </message>
+ <message>
+ <source>ICO_DLG_PROJ_ON_CYL</source>
+ <translation>proj_on_cyl.png</translation>
+ </message>
<message>
<source>ICON_DLG_PARTITION</source>
<translation>partition.png</translation>
<source>ICON_DLG_PRISM_DXDYDZ</source>
<translation>prism3.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_THICKNESS</source>
+ <translation>thickness.png</translation>
+ </message>
+ <message>
+ <source>ICON_DLG_THICKNESS_HOLLOWED</source>
+ <translation>thickness2.png</translation>
+ </message>
<message>
<source>ICON_DLG_PROPAGATE</source>
<translation>propagate.png</translation>
<source>ICON_VERTEX_MARKER_13</source>
<translation>marker_13.png</translation>
</message>
+ <message>
+ <source>ICON_SURFACE_FROM_FACE</source>
+ <translation>facetosurface.png</translation>
+ </message>
<message>
<source>ICO_ARC</source>
<translation>arc.png</translation>
<source>ICO_CHECK_SELF_INTERSECTIONS</source>
<translation>check_self_intersections.png</translation>
</message>
+ <message>
+ <source>ICO_FAST_CHECK_INTERSECTIONS</source>
+ <translation>fast_intersect.png</translation>
+ </message>
<message>
<source>ICO_CHECK_FREE_BNDS</source>
<translation>free_bound.png</translation>
<source>ICO_EXTRUSION</source>
<translation>prism.png</translation>
</message>
+ <message>
+ <source>ICO_THICKNESS</source>
+ <translation>thickness.png</translation>
+ </message>
<message>
<source>ICO_FACE</source>
<translation>build_face.png</translation>
<source>ICO_PROJECTION</source>
<translation>projection.png</translation>
</message>
+ <message>
+ <source>ICO_EXTENSION</source>
+ <translation>edgeextension.png</translation>
+ </message>
+ <message>
+ <source>ICO_PROJ_ON_CYL</source>
+ <translation>proj_on_cyl.png</translation>
+ </message>
<message>
<source>ICO_ORIGIN_AND_VECTORS</source>
<translation>origin_and_vectors.png</translation>
<source>ICO_ISOLINE_V</source>
<translation>isoline_v.png</translation>
</message>
+ <message>
+ <source>ICO_SURFACE_FROM_FACE</source>
+ <translation>facetosurface.png</translation>
+ </message>
<message>
<source>ICO_SOLID</source>
<translation>build_solid.png</translation>
</message>
+ <message>
+ <source>ICO_SOLID_FROM_FACES</source>
+ <translation>solid_from_face.png</translation>
+ </message>
<message>
<source>ICO_SOLID_SEL_ONLY</source>
<translation>build_solid.png</translation>
<source>ICO_GET_SHARED_SHAPES</source>
<translation>shared_shapes.png</translation>
</message>
+ <message>
+ <source>ICO_TRANSFER_DATA</source>
+ <translation>transfer_data.png</translation>
+ </message>
+ <message>
+ <source>ICO_IMPORT_SHAPE</source>
+ <translation>import.png</translation>
+ </message>
<message>
<source>ICON_DLG_POINT_FACE</source>
<translation>pointonface.png</translation>
<source>ICON_DLG_SHARED_SHAPES</source>
<translation>shared_shapes.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_TRANSFER_DATA</source>
+ <translation>transfer_data.png</translation>
+ </message>
<message>
<source>ICON_DLG_SCALE_ALONG_AXES</source>
<translation>scale_along_axes.png</translation>
<source>DEVIDE_EDGE_NEW_OBJECT_NAME</source>
<translation>NewObject</translation>
</message>
+ <message>
+ <source>DEVIDE_EDGE_BAD_PROJ_MSG</source>
+ <translation>Projection outside the edge</translation>
+ </message>
+ <message>
+ <source>DEVIDE_EDGE_BY_PROJ_POINT</source>
+ <translation>Points to project</translation>
+ </message>
<message>
<source>ERROR_SHAPE_TYPE</source>
<translation>Object of incorrect type selected!
<source>GEOM_NONBLOCKS</source>
<translation>NonBlocksGroup</translation>
</message>
+ <message>
+ <source>GEOM_USE_C1_CRITERION</source>
+ <translation>Use C1 criterion</translation>
+ </message>
<message>
<source>GEOM_CHECK_INFOS</source>
<translation>Object And Its Topological Information</translation>
<translation>Detect Self-intersections</translation>
</message>
<message>
- <source>GEOM_CHECK_SELF_INTERSECTIONS_FAILED</source>
- <translation>Detection of self-intersections failed</translation>
- </message>
- <message>
- <source>GEOM_NO_SELF_INTERSECTIONS</source>
- <translation>There are no self-intersections in the shape</translation>
- </message>
- <message>
- <source>GEOM_SELF_INTERSECTIONS_FOUND</source>
- <translation>Some self-intersections detected</translation>
+ <source>GEOM_FAST_CHECK_INTERSECTIONS</source>
+ <translation>Fast intersection</translation>
</message>
<message>
- <source>GEOM_CHECK_SELF_INTERSECTIONS_ERRORS</source>
- <translation>Warning: there were errors during the operation, so the list may be incomplete.</translation>
+ <source>GEOM_SHAPE_STATISTICS</source>
+ <translation>Shape Statistics</translation>
</message>
<message>
<source>GEOM_CIRCLE</source>
</message>
<message>
<source>GEOM_CYLINDER_ANGLE_ERR</source>
- <translation>Angle values 0 and 360 are unsafe to build proper volumes. Please uncheck the "Angle" box to use the regular cylinder constructor.</translation>
+ <translation>Angle values 0 and 360 are unsafe to build proper volumes. Please uncheck the "Angle" box to use the regular cylinder constructor.</translation>
</message>
<message>
<source>GEOM_D1</source>
</message>
<message>
<source>GEOM_DIVIDE_EDGE_TITLE</source>
- <translation>Addition of point</translation>
+ <translation>Addition of points</translation>
</message>
<message>
<source>GEOM_DX</source>
<source>GEOM_EXTRUSION_TITLE</source>
<translation>Construction by Extrusion</translation>
</message>
+ <message>
+ <source>GEOM_THICKNESS_TITLE</source>
+ <translation>Thickness Construction</translation>
+ </message>
+ <message>
+ <source>GEOM_THICKNESS_NAME</source>
+ <translation>Thickness</translation>
+ </message>
+ <message>
+ <source>GEOM_TOWARDS_INSIDE</source>
+ <translation>Thicken towards the inside</translation>
+ </message>
<message>
<source>GEOM_SCALE_PRISM</source>
<translation>Scale the face opposite to the base</translation>
<source>GEOM_FACE_FFW</source>
<translation>Face creation from wires and/or edges</translation>
</message>
+ <message>
+ <source>GEOM_FACE_FROM_SURFACE</source>
+ <translation>Face creation from surface bounded by wire</translation>
+ </message>
<message>
<source>GEOM_FACE_OPT</source>
<translation>Try to create a planar face</translation>
</message>
+ <message>
+ <source>GEOM_FACE_FFWC</source>
+ <translation>Face creation from wire and constraints</translation>
+ </message>
+ <message>
+ <source>GEOM_CONSTRAINTS</source>
+ <translation>Constraints</translation>
+ </message>
+ <message>
+ <source>GEOM_FACE_CONSTRAINT</source>
+ <translation>Constraint Face</translation>
+ </message>
+ <message>
+ <source>GEOM_SOLID_FROM_FACE_OPT</source>
+ <translation>Intersect/sew shapes</translation>
+ </message>
<message>
<source>MAKE_FACE_TOLERANCE_TOO_BIG</source>
<translation>Cannot build a planar face: required tolerance is
</message>
<message>
<source>GEOM_FILLING_COMPOUND</source>
- <translation>Input compound</translation>
+ <translation>Input contours</translation>
</message>
<message>
<source>GEOM_FILLING_MAX_DEG</source>
<source>GEOM_FREE_FACES</source>
<translation>Free faces</translation>
</message>
+ <message>
+ <source>GEOM_FREE_FACES_NAME</source>
+ <translation>Free_face</translation>
+ </message>
<message>
<source>GEOM_FREE_FACES_TITLE</source>
<translation>Free faces</translation>
<source>GEOM_GLUE_EDGES_TITLE</source>
<translation>Glue edges</translation>
</message>
+ <message>
+ <source>GEOM_GLUE_EDGES_DETECT_TITLE</source>
+ <translation>Coincident edges detection</translation>
+ </message>
+ <message>
+ <source>GEOM_GLUE_FACES_DETECT_TITLE</source>
+ <translation>Coincident faces detection</translation>
+ </message>
<message>
<source>GLUE_ERROR_STICKED_SHAPES</source>
<translation>The tolerance value is too big. Sticked shapes are detected.</translation>
<translation>Division pattern</translation>
</message>
<message>
- <source>GEOM_PROJECTION</source>
- <translation>Projection</translation>
+ <source>GEOM_PROJECTION_ON_FACE</source>
+ <translation>Projection on Face</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJECTION_ON_WIRE</source>
+ <translation>Projection on Wire</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJECTION_ON_EDGE</source>
+ <translation>Projection on Edge</translation>
</message>
<message>
<source>GEOM_PROJECTION_TITLE</source>
- <translation>Projection on Face</translation>
+ <translation>Projection</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJECTION_NAME</source>
+ <translation>Projection</translation>
</message>
<message>
- <source>GEOM_SOURCE_OBJECT</source>
+ <source>GEOM_PROJ_ON_FACE_SOURCE</source>
<translation>Source vertex, edge or wire</translation>
</message>
+ <message>
+ <source>GEOM_PROJ_ON_FACE_TARGET</source>
+ <translation>Target face</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_WIRE_SOURCE</source>
+ <translation>Source vertex</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_WIRE_TARGET</source>
+ <translation>Target wire</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_EDGE_SOURCE</source>
+ <translation>Source vertex</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_EDGE_TARGET</source>
+ <translation>Target edge</translation>
+ </message>
<message>
<source>GEOM_SOLUTION</source>
<translation>Solution :</translation>
<source>GEOM_SOLUTION_I</source>
<translation>Solution %1</translation>
</message>
- <message>
- <source>GEOM_TARGET_OBJECT</source>
- <translation>Target face</translation>
- </message>
<message>
<source>GEOM_WITH_CONTACT</source>
<translation>With contact</translation>
<source>GEOM_LENGTH_VALUE</source>
<translation>By length</translation>
</message>
+ <message>
+ <source>GEOM_TAKE_ORIENTATION_INTO_ACCOUNT</source>
+ <translation>Take edge orientation into account</translation>
+ </message>
<message>
<source>GEOM_PARTITION</source>
<translation>Partition</translation>
<source>GEOM_SELECT_UNPUBLISHED_EDGES</source>
<translation>Select unpublished edges</translation>
</message>
+ <message>
+ <source>GEOM_GENERATE_GROUPS</source>
+ <translation>Generate Groups</translation>
+ </message>
+ <message>
+ <source>GEOM_GROUP_NAME_PREFIX</source>
+ <translation>Group Names Prefix</translation>
+ </message>
+ <message>
+ <source>GEOM_STEP_BY_STEP</source>
+ <translation>Step-by-step generation</translation>
+ </message>
<message>
<source>GEOM_PLANE</source>
<translation>Plane</translation>
</message>
<message>
<source>GEOM_SECTION</source>
- <translation>Section</translation>
+ <translation>Intersection</translation>
</message>
<message>
<source>GEOM_SECTION_TITLE</source>
- <translation>Section Of Two Objects</translation>
+ <translation>Intersection Of Two Objects</translation>
</message>
<message>
<source>GEOM_SELECTED_FACE</source>
<source>GEOM_SELECTED_SHAPE</source>
<translation>Selected shape</translation>
</message>
+ <message>
+ <source>GEOM_SELECTED_SHAPES</source>
+ <translation>Selected shapes</translation>
+ </message>
<message>
<source>GEOM_SELECTION</source>
<translation>Selection</translation>
<source>GEOM_SOLID_TITLE</source>
<translation>Solid Construction</translation>
</message>
+ <message>
+ <source>GEOM_SOLID_SHELLS</source>
+ <translation>Make Solid From Shells</translation>
+ </message>
+ <message>
+ <source>GEOM_SOLID_FACES</source>
+ <translation>Make Solid From Connected Set Of Faces/Shells</translation>
+ </message>
<message>
<source>GEOM_SPHERE</source>
<translation>Sphere</translation>
</message>
<message>
<source>GEOM_SUPRESSFACE</source>
- <translation>Supress Face</translation>
+ <translation>Suppress Face</translation>
</message>
<message>
<source>GEOM_SUPRESSFACE_SELECT</source>
</message>
<message>
<source>GEOM_WRN_FACES_NOT_SHELL</source>
- <translation>Unable to create a shell. Result is a compound of faces.</translation>
+ <translation>Unable to create single shell. Result is a compound of shells.</translation>
+ </message>
+ <message>
+ <source>GEOM_WRN_FACES_NOT_FACE</source>
+ <translation>Unable to create single face. Result is a compound of faces.</translation>
</message>
<message>
<source>WRN_SHAPE_UNCLOSED</source>
<source>WRN_NULL_OBJECT_OR_SHAPE</source>
<translation>Shape %1 for solid creation is null</translation>
</message>
+ <message>
+ <source>GROUP_DOWN</source>
+ <translation>Down</translation>
+ </message>
+ <message>
+ <source>GROUP_UP</source>
+ <translation>Up</translation>
+ </message>
+ <message>
+ <source>GROUP_SIDE1</source>
+ <translation>Side1</translation>
+ </message>
+ <message>
+ <source>GROUP_SIDE2</source>
+ <translation>Side2</translation>
+ </message>
+ <message>
+ <source>GROUP_OTHER</source>
+ <translation>Other</translation>
+ </message>
<message>
<source>GEOM_X</source>
<translation>X :</translation>
<translation>2D Polyline</translation>
</message>
<message>
- <source>TOP_CURVE_CREATOR</source>
- <translation>Create 2D polyline</translation>
+ <source>TOP_CURVE_CREATOR</source>
+ <translation>Create 2D polyline</translation>
</message>
<message>
- <source>STB_CURVE_CREATOR</source>
- <translation>Create 2D polyline</translation>
+ <source>STB_CURVE_CREATOR</source>
+ <translation>Create 2D polyline</translation>
</message>
<message>
<source>MEN_ALL_SEL_ONLY</source>
<source>MEN_CHECK_SELF_INTERSECTIONS</source>
<translation>Detect Self-intersections</translation>
</message>
+ <message>
+ <source>MEN_FAST_CHECK_INTERSECTIONS</source>
+ <translation>Fast intersection</translation>
+ </message>
+ <message>
+ <source>MEN_SHAPE_STATISTICS</source>
+ <translation>Shape Statistics</translation>
+ </message>
<message>
<source>MEN_CHECK_FREE_BNDS</source>
<translation>Check Free Boundaries</translation>
</message>
<message>
<source>MEN_MEASURES</source>
- <translation>Measures</translation>
+ <translation>Inspection</translation>
</message>
<message>
<source>MEN_MIN_DIST</source>
<source>MEN_PROJECTION</source>
<translation>Projection</translation>
</message>
+ <message>
+ <source>MEN_PROJ_ON_CYL</source>
+ <translation>Projection on Cylinder</translation>
+ </message>
<message>
<source>MEN_OPERATIONS</source>
<translation>Operations</translation>
<source>MEN_PIPE_PATH</source>
<translation>Restore Path</translation>
</message>
+ <message>
+ <source>MEN_THICKNESS</source>
+ <translation>Thickness</translation>
+ </message>
<message>
<source>MEN_PLANE</source>
<translation>Plane</translation>
<source>MEN_POP_VERTICES</source>
<translation>Show Vertices</translation>
</message>
+ <message>
+ <source>MEN_POP_SHOW_NAME</source>
+ <translation>Show Name</translation>
+ </message>
<message>
<source>MEN_PREFERENCES</source>
<translation>Preferences</translation>
</message>
<message>
<source>MEN_SECTION</source>
- <translation>Section</translation>
+ <translation>Intersection</translation>
</message>
<message>
<source>MEN_SELECT_ONLY</source>
<source>MEN_ISOLINE</source>
<translation>Isoline</translation>
</message>
+ <message>
+ <source>MEN_SURFACE_FROM_FACE</source>
+ <translation>Surface From Face</translation>
+ </message>
<message>
<source>MEN_SOLID</source>
<translation>Solid</translation>
</message>
+ <message>
+ <source>MEN_SOLID_FROM_FACES</source>
+ <translation>Solid from connected faces</translation>
+ </message>
<message>
<source>MEN_SOLID_SEL_ONLY</source>
<translation>Solid</translation>
<source>MEN_VERTICES_MODE_OFF</source>
<translation>Hide Vertices</translation>
</message>
+ <message>
+ <source>MEN_NAME_MODE_ON</source>
+ <translation>Show Name</translation>
+ </message>
+ <message>
+ <source>MEN_NAME_MODE_OFF</source>
+ <translation>Hide Name</translation>
+ </message>
<message>
<source>MEN_WIREFRAME</source>
<translation>Wireframe</translation>
<source>MEN_POP_PREDEF_MATER_CUSTOM</source>
<translation>Custom...</translation>
</message>
+ <message>
+ <source>MEN_EDGE_EXTEND</source>
+ <translation>Extended Edge</translation>
+ </message>
+ <message>
+ <source>MEN_FACE_EXTEND</source>
+ <translation>Extended Face</translation>
+ </message>
<message>
<source>NAME_LBL</source>
<translation>Name: </translation>
</message>
<message>
<source>PREF_DEFLECTION</source>
- <translation>Deflection coefficient</translation>
+ <translation>Default deflection coefficient</translation>
</message>
<message>
<source>GEOM_PREF_def_precision</source>
</message>
<message>
<source>PREF_TRANSPARENCY</source>
- <translation>Transparency</translation>
+ <translation>Default transparency</translation>
</message>
<message>
<source>PREF_FREE_BOUND_COLOR</source>
</message>
<message>
<source>PREF_GROUP_VERTEX</source>
- <translation>Marker of Points</translation>
+ <translation>Default marker of points</translation>
</message>
<message>
<source>PREF_ISOS_COLOR</source>
<translation>Color of isolines</translation>
</message>
+ <message>
+ <source>PREF_LABEL_COLOR</source>
+ <translation>Color of labels</translation>
+ </message>
<message>
<source>PREF_TOPLEVEL_COLOR</source>
<translation>Top level color</translation>
</message>
<message>
<source>PREF_EDGE_WIDTH</source>
- <translation>Edges width</translation>
+ <translation>Default edges width</translation>
</message>
<message>
<source>PREF_ISOLINES_WIDTH</source>
- <translation>Iso lines width</translation>
+ <translation>Default isolines width</translation>
</message>
<message>
<source>PREF_PREVIEW_EDGE_WIDTH</source>
<translation>Line width</translation>
</message>
<message>
- <source>PREF_DIMENSIONS_FONT_HEIGHT</source>
- <translation>Font height</translation>
+ <source>PREF_DIMENSIONS_FONT</source>
+ <translation>Font</translation>
</message>
<message>
<source>PREF_DIMENSIONS_ARROW_LENGTH</source>
<source>PREF_DIMENSIONS_SHOW_UNITS</source>
<translation>Show units of measurement</translation>
</message>
+ <message>
+ <source>PREF_DIMENSIONS_USE_TEXT3D</source>
+ <translation>Use 3D text</translation>
+ </message>
+ <message>
+ <source>PREF_HIDE_INPUT_OBJECT</source>
+ <translation>Hide input objects from the viewer</translation>
+ </message>
<message>
<source>PREF_ISOS</source>
- <translation>Number of isolines</translation>
+ <translation>Default number of isolines</translation>
</message>
<message>
<source>PREF_ISOS_U</source>
</message>
<message>
<source>REMOVE_HOLES_NEW_OBJ_NAME</source>
- <translation>SupressHoles</translation>
+ <translation>SuppressHoles</translation>
</message>
<message>
<source>REMOVE_INT_WIRES_NEW_OBJ_NAME</source>
<translation>Detect Self-intersections</translation>
</message>
<message>
+ <source>STB_FAST_CHECK_INTERSECTIONS</source>
+ <translation>Fast intersection</translation>
+ </message>
+ <message>
+ <source>STB_SHAPE_STATISTICS</source>
+ <translation>Shape Statistics</translation>
+ </message>
+ <message>
<source>STB_CHECK_FREE_BNDS</source>
<translation>Check free boundaries</translation>
</message>
<source>STB_PROJECTION</source>
<translation>Project a point, an edge or a wire on a face</translation>
</message>
+ <message>
+ <source>STB_PROJ_ON_CYL</source>
+ <translation>Project a wire or a face on a cylinder</translation>
+ </message>
<message>
<source>STB_ORIGIN_AND_VECTORS</source>
<translation>Create an origin and base Vectors</translation>
<source>STB_PIPE_PATH</source>
<translation>Restore path from a pipe-like shape</translation>
</message>
+ <message>
+ <source>STB_THICKNESS</source>
+ <translation>Make a thick solid</translation>
+ </message>
<message>
<source>STB_PLANE</source>
<translation>Create a plane</translation>
<source>STB_POP_VERTICES</source>
<translation>Show Vertices</translation>
</message>
+ <message>
+ <source>STB_POP_SHOW_NAME</source>
+ <translation>Show Name</translation>
+ </message>
<message>
<source>STB_POP_SETTEXTURE</source>
<translation>Add a texture</translation>
</message>
<message>
<source>STB_SECTION</source>
- <translation>Section</translation>
+ <translation>Intersection</translation>
</message>
<message>
<source>STB_SEWING</source>
<source>STB_VECTOR_MODE</source>
<translation>Change Edge Presentation Mode</translation>
</message>
+ <message>
+ <source>STB_NAME_MODE</source>
+ <translation>Show/Hide names of visible shapes</translation>
+ </message>
<message>
<source>STB_SHADING_COLOR</source>
<translation>Set shading color</translation>
<source>STB_ISOLINE</source>
<translation>Create U- or V-Isoline</translation>
</message>
+ <message>
+ <source>STB_SURFACE_FROM_FACE</source>
+ <translation>Create a Surface From Face</translation>
+ </message>
<message>
<source>STB_SOLID</source>
<translation>Build a solid</translation>
</message>
<message>
<source>SUPRESS_FACE_NEW_OBJ_NAME</source>
- <translation>SupressFaces</translation>
+ <translation>SuppressFaces</translation>
</message>
<message>
<source>ShHealOper_ErrorExecution_msg</source>
<source>TOP_CHECK_SELF_INTERSECTIONS</source>
<translation>Detect Self-intersections</translation>
</message>
+ <message>
+ <source>TOP_FAST_CHECK_INTERSECTIONS</source>
+ <translation>Fast intersection</translation>
+ </message>
+ <message>
+ <source>TOP_SHAPE_STATISTICS</source>
+ <translation>Shape Statistics</translation>
+ </message>
<message>
<source>TOP_CHECK_FREE_BNDS</source>
<translation>Check free boundaries</translation>
<source>TOP_PROJECTION</source>
<translation>Projection</translation>
</message>
+ <message>
+ <source>TOP_PROJ_ON_CYL</source>
+ <translation>Projection on Cylinder</translation>
+ </message>
<message>
<source>TOP_ORIGIN_AND_VECTORS</source>
<translation>Create an origin and base Vectors</translation>
<source>TOP_PIPE_PATH</source>
<translation>Restore path</translation>
</message>
+ <message>
+ <source>TOP_THICKNESS</source>
+ <translation>Thickness</translation>
+ </message>
<message>
<source>TOP_PLANE</source>
<translation>Create a plane</translation>
</message>
<message>
<source>TOP_SECTION</source>
- <translation>Section</translation>
+ <translation>Intersection</translation>
</message>
<message>
<source>TOP_SEWING</source>
<source>TOP_ISOLINE</source>
<translation>Isoline</translation>
</message>
+ <message>
+ <source>TOP_SURFACE_FROM_FACE</source>
+ <translation>Surface From Face</translation>
+ </message>
<message>
<source>TOP_SOLID</source>
<translation>Build solid</translation>
</message>
<message>
<source>GEOM_REMOVE_WEBS</source>
- <translation>Compound of solids</translation>
+ <translation>Solids</translation>
</message>
<message>
<source>REMOVE_WEBS_NEW_OBJ_NAME</source>
<source>STB_UNION_FACES</source>
<translation>Union faces</translation>
</message>
+ <message>
+ <source>TOP_INSPECT_OBJECT</source>
+ <translation>Inspect Object</translation>
+ </message>
+ <message>
+ <source>MEN_INSPECT_OBJECT</source>
+ <translation>Inspect Object</translation>
+ </message>
+ <message>
+ <source>STB_INSPECT_OBJECT</source>
+ <translation>Inspect Object</translation>
+ </message>
<message>
<source>TOP_NORMALE</source>
<translation>Normal to a face</translation>
<source>GEOM_Z_I</source>
<translation>Z%1 :</translation>
</message>
+ <message>
+ <source>GEOM_A_I</source>
+ <translation>A%1 :</translation>
+ </message>
<message>
<source>GEOM_SHAPES_ON_SHAPE_TITLE</source>
<translation>Get shapes on shape</translation>
<source>STB_GET_SHARED_SHAPES</source>
<translation>Get shared shapes</translation>
</message>
+ <message>
+ <source>TOP_TRANSFER_DATA</source>
+ <translation>Transfer Data</translation>
+ </message>
+ <message>
+ <source>MEN_TRANSFER_DATA</source>
+ <translation>Transfer Data</translation>
+ </message>
+ <message>
+ <source>STB_TRANSFER_DATA</source>
+ <translation>Transfer Data</translation>
+ </message>
+ <message>
+ <source>TOP_EXTENSION</source>
+ <translation>Extend Edge or Face</translation>
+ </message>
+ <message>
+ <source>MEN_EXTENSION</source>
+ <translation>Extension</translation>
+ </message>
+ <message>
+ <source>STB_EXTENSION</source>
+ <translation>Extend Edge or Face</translation>
+ </message>
<message>
<source>GEOM_PUBLISH_RESULT_GRP</source>
<translation>Advanced options</translation>
<source>CC_PNT_ITEM_X_Y_Z</source>
<translation>X=%1, Y=%2, Z=%3</translation>
</message>
+ <message>
+ <source>GEOM_FILTER</source>
+ <translation>Filter</translation>
+ </message>
+ <message>
+ <source>GEOM_LESS_THAN</source>
+ <translation>Less Than</translation>
+ </message>
+ <message>
+ <source>GEOM_LESSOREQUAL_THAN</source>
+ <translation>Equal or Less Than</translation>
+ </message>
+ <message>
+ <source>GEOM_GREAT_THAN</source>
+ <translation>Greater Than</translation>
+ </message>
+ <message>
+ <source>GEOM_GREATOREQUAL_THAN</source>
+ <translation>Equal or Greater Than</translation>
+ </message>
+ <message>
+ <source>GEOM_SOME_SHAPES_SELECTED</source>
+ <translation>%1 shape(s) has(have) been selected</translation>
+ </message>
+ <message>
+ <source>GEOM_NO_SHAPES_SELECTED</source>
+ <translation>There are no shapes that meet filtering parameters</translation>
+ </message>
+ <message>
+ <source>GEOM_HEALING_STATS_TITLE</source>
+ <translation>What is done</translation>
+ </message>
+ <message>
+ <source>GEOM_HEALING_STATS_COL_1</source>
+ <translation>Count</translation>
+ </message>
+ <message>
+ <source>GEOM_HEALING_STATS_COL_2</source>
+ <translation>Modification</translation>
+ </message>
+ <message>
+ <source>GEOM_PLOT_DISTRIBUTION</source>
+ <translation>Plot</translation>
+ </message>
+ <message>
+ <source>GEOM_X_AXIS</source>
+ <translation>X Axis</translation>
+ </message>
+ <message>
+ <source>GEOM_Y_AXIS</source>
+ <translation>Y Axis</translation>
+ </message>
+ <message>
+ <source>GEOM_Z_AXIS</source>
+ <translation>Z Axis</translation>
+ </message>
+ <message>
+ <source>GEOM_DIM_AXES</source>
+ <translation>Dimensions along local axes</translation>
+ </message>
+ <message>
+ <source>SHOW_ALL_BTN</source>
+ <translation>Show all</translation>
+ </message>
+ <message>
+ <source>HIDE_ALL_BTN</source>
+ <translation>Hide all</translation>
+ </message>
</context>
<context>
<name>GeometryGUI</name>
</message>
<message>
<source>TOOL_MEASURES</source>
- <translation>Measures</translation>
+ <translation>Inspection</translation>
</message>
<message>
<source>TOOL_IMPORTEXPORT</source>
<translation>Import / Export XAO</translation>
</message>
- <message>
- <source>TABLE_SECTION</source>
- <translation>Section</translation>
- </message>
- <message>
- <source>TABLE_INDEX</source>
- <translation>Index</translation>
- </message>
- <message>
- <source>TABLE_X</source>
- <translation>X</translation>
- </message>
- <message>
- <source>TABLE_Y</source>
- <translation>Y</translation>
- </message>
</context>
<context>
<name>BasicGUI_CurveDlg</name>
<translation>X=%1, Y=%2, Z=%3</translation>
</message>
</context>
+<context>
+ <name>CurveCreator_TableView</name>
+ <message>
+ <source>TABLE_SECTION</source>
+ <translation>Section</translation>
+ </message>
+ <message>
+ <source>TABLE_INDEX</source>
+ <translation>Index</translation>
+ </message>
+ <message>
+ <source>TABLE_X</source>
+ <translation>X</translation>
+ </message>
+ <message>
+ <source>TABLE_Y</source>
+ <translation>Y</translation>
+ </message>
+</context>
<context>
<name>CurveCreator_Widget</name>
<message>
<source>GEOM_ADD_THICKNESS</source>
<translation>Add thickness (edges or wires only)</translation>
</message>
- <message>
- <source>GEOM_TOWARDS_INSIDE</source>
- <translation>Thicken towards the inside</translation>
- </message>
</context>
<context>
<name>GroupGUI</name>
<source>REMOVE_BTN</source>
<translation>Remove</translation>
</message>
- <message>
- <source>SHOW_ALL_BTN</source>
- <translation>Show all</translation>
- </message>
- <message>
- <source>HIDE_ALL_BTN</source>
- <translation>Hide all</translation>
- </message>
<message>
<source>DISTANCE_ITEM</source>
<translation>Distance</translation>
<translation>Enabling this option may result in a very time-consuming operation for some input shapes.
Would you like to continue?</translation>
</message>
+ <message>
+ <source>WIDTH_FACTOR_TOL</source>
+ <translation>Width factor tol.</translation>
+ </message>
+ <message>
+ <source>VOLUME_TOL</source>
+ <translation>Volume tol.</translation>
+ </message>
+ <message>
+ <source>TO_MERGE_SOLIDS</source>
+ <translation>To merge solids</translation>
+ </message>
+ <message>
+ <source>SELECT_ALL</source>
+ <translation>Select All</translation>
+ </message>
</context>
<context>
<name>GEOMToolsGUI_DeleteDlg</name>
<source>GEOM_SHARED_SHAPE</source>
<translation>Shared_%1</translation>
</message>
+ <message>
+ <source>GEOM_SHARED_SHAPES_MULTISHARE</source>
+ <translation>Shared by all</translation>
+ </message>
</context>
<context>
<name>GEOMToolsGUI_PublishDlg</name>
<translation>UnionFaces</translation>
</message>
</context>
+<context>
+ <name>RepairGUI_InspectObjectDlg</name>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_TITLE</source>
+ <translation>Inspect object</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_MAIN_SHAPE</source>
+ <translation>Main shape</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_TOLERANCE_FILTER</source>
+ <translation>Tolerance filter</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_RESET_MIN</source>
+ <translation>Min value</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_RESET_MAX</source>
+ <translation>Max value</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_SHOW</source>
+ <translation>Show Selected</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_SHOW_ONLY</source>
+ <translation>Show Only Selected</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_HIDE</source>
+ <translation>Hide Selected</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_PUBLISH</source>
+ <translation>Publish Selected</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_NAME</source>
+ <translation>Name</translation>
+ </message>
+</context>
<context>
<name>GEOMGUI_CreationInfoWdg</name>
<message>
<translation>(No info available)</translation>
</message>
</context>
+<context>
+ <name>GEOMGUI_TextTreeWdg</name>
+ <message>
+ <source>TEXT_TREE_VIEW_TITLE</source>
+ <translation>Text</translation>
+ </message>
+ <message>
+ <source>TEXT_TREE_VIEW_NAME</source>
+ <translation>Name</translation>
+ </message>
+</context>
<context>
<name>EntityGUI_IsolineDlg</name>
<message>
<translation>V-Isoline</translation>
</message>
</context>
+<context>
+ <name>MeasureGUI_CheckSelfIntersectionsDlg</name>
+ <message>
+ <source>GEOM_CHECK_INTERSECT_TYPE</source>
+ <translation>Self-intersection Detection Type</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_INTERSECTIONS</source>
+ <translation>Self-intersections</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_SUBSHAPES</source>
+ <translation>Sub-shapes</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_CHECK_LEVEL</source>
+ <translation>Level of check</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_SUMMARY</source>
+ <translation>Summary</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_COMPUTE</source>
+ <translation>Compute self-intersections</translation>
+ </message>
+ <message>
+ <source>GEOM_SELF_INTERSECTION_NAME</source>
+ <translation>Self_intersection</translation>
+ </message>
+ <message>
+ <source>GEOM_NO_SELF_INTERSECTIONS</source>
+ <translation>There are no self-intersections in the shape</translation>
+ </message>
+ <message>
+ <source>GEOM_SELF_INTERSECTIONS_FOUND</source>
+ <translation>Some self-intersections detected</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_SELF_INTERSECTIONS_FAILED</source>
+ <translation>Detection of self-intersections failed</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_SELF_INTERSECTIONS_ERRORS</source>
+ <translation>Warning: there were errors during the operation, so the list may be incomplete.</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_V_V</source>
+ <translation>Vertex to Vertex</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_V_E</source>
+ <translation>Vertex to Edge + all above</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_E_E</source>
+ <translation>Edge to Edge + all above</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_V_F</source>
+ <translation>Vertex to Face + all above</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_E_F</source>
+ <translation>Edge to Face + all above</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_ALL</source>
+ <translation>Face to Face + all above</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INT_DEFLECT</source>
+ <translation>Deflection coefficient</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INT_DETECT_GAPS</source>
+ <translation>Detect gaps with tolerance</translation>
+ </message>
+</context>
+<context>
+ <name>MeasureGUI_FastCheckIntersectionsDlg</name>
+ <message>
+ <source>GEOM_FAST_CHECK_INT_DEFLECT</source>
+ <translation>Deflection coefficient</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_CHECK_INT_DETECT_GAPS</source>
+ <translation>Detect gaps with tolerance</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_CHECK_INT_SUBSHAPES</source>
+ <translation>Sub-shapes of Object %1:</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_CHECK_INT_COMPUTE</source>
+ <translation>Compute intersections</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_INTERSECTION_NAME</source>
+ <translation>Fast_intersection</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_INTERSECTION_FAILS</source>
+ <translation>No intersections</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_CHECK_OBJ</source>
+ <translation>Objects And Results</translation>
+ </message>
+</context>
+<context>
+ <name>MeasureGUI_ShapeStatisticsDlg</name>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_TYPE</source>
+ <translation>Type</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_LENGTH</source>
+ <translation>Edges length</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_AREA</source>
+ <translation>Faces area</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_VOLUME</source>
+ <translation>Solids volume</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_NB_INTERVALS</source>
+ <translation>Number of intervals</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_SCALAR_RANGE</source>
+ <translation>Scalar range</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_COMPUTE</source>
+ <translation>Compute</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN</source>
+ <translation>Min</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MAX</source>
+ <translation>Max</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_CREATE_GROUPS</source>
+ <translation>Create Groups</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_DISTRIBUTION_NB_ENT</source>
+ <translation>Number of entities</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN_ERROR</source>
+ <translation>Set minimal range value or switch-off Scalar range</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MAX_ERROR</source>
+ <translation>Set maximal range value or switch-off Scalar range</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR</source>
+ <translation>Minimal range value can not be more than maximal</translation>
+ </message>
+ <message>
+ <source>GEOM_MSG_GROUPS_CREATED</source>
+ <translation>%1 groups created</translation>
+ </message>
+</context>
+<context>
+ <name>TransformationGUI_ExtensionDlg</name>
+ <message>
+ <source>GEOM_EXTENSION_TITLE</source>
+ <translation>Extension of Edge or Face</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION</source>
+ <translation>Extension</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MIN</source>
+ <translation>First Parameter</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MAX</source>
+ <translation>Last Parameter</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MIN_U</source>
+ <translation>First U-Parameter</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MAX_U</source>
+ <translation>Last U-Parameter</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MIN_V</source>
+ <translation>First V-Parameter</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MAX_V</source>
+ <translation>Last V-Parameter</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_EDGE_NAME</source>
+ <translation>ExtendedEdge</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_FACE_NAME</source>
+ <translation>ExtendedFace</translation>
+ </message>
+</context>
+<context>
+ <name>EntityGUI_SurfFromFaceDlg</name>
+ <message>
+ <source>GEOM_SURF_FROM_FACE_TITLE</source>
+ <translation>Surface From Face Construction</translation>
+ </message>
+ <message>
+ <source>GEOM_SURF_FROM_FACE</source>
+ <translation>Surface From Face</translation>
+ </message>
+ <message>
+ <source>GEOM_SURF_FROM_FACE_NAME</source>
+ <translation>SurfaceFromFace</translation>
+ </message>
+</context>
+<context>
+ <name>OperationGUI_TransferDataDlg</name>
+ <message>
+ <source>GEOM_TRANSFER_DATA_TITLE</source>
+ <translation>Transfer Data</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA</source>
+ <translation>Transfer Data</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_FROM</source>
+ <translation>Source Shape</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_TO</source>
+ <translation>Destination Shape</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_METHOD</source>
+ <translation>Type of Detection Operation</translation>
+ </message>
+ <message>
+ <source>GEOM_TD_METHOD_GETINPLACE</source>
+ <translation>Get In Place</translation>
+ </message>
+ <message>
+ <source>GEOM_TD_METHOD_GETINPLACE_OLD</source>
+ <translation>Get In Place (old)</translation>
+ </message>
+ <message>
+ <source>GEOM_TD_METHOD_GETINPLACE_HISTORY</source>
+ <translation>Get In Place By History</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_INFO</source>
+ <translation>Transfer Data: Information</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_NOT_COPIED</source>
+ <translation>There is nothing to be copied.</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_COPIED</source>
+ <translation>The following data are copied:</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_NAMES</source>
+ <translation>Names: %1 of %2</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_MATERIALS</source>
+ <translation>Materials: %1 of %2</translation>
+ </message>
+</context>
+<context>
+ <name>TransformationGUI_ProjectionOnCylDlg</name>
+ <message>
+ <source>GEOM_PROJ_ON_CYL_TITLE</source>
+ <translation>Projection On A Cylinder</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_CYL_START_ANGLE</source>
+ <translation>Starting angle</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_CYL_LENGTH_ANGLE</source>
+ <translation>Length angle</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_CYL_ROTATION_ANGLE</source>
+ <translation>Rotation angle</translation>
+ </message>
+</context>
</TS>
<TS version="2.0" language="fr_FR">
<context>
<name>@default</name>
- <message>
- <source>MEN_TEXTURE</source>
- <translation>Texture</translation>
- </message>
- <message>
- <source>GEOM_WRN_FACES_NOT_SHELL</source>
- <translation>Impossible de créer une coque. Le résultat est un assemblage de faces.</translation>
- </message>
<message>
<source>BRep_API: command not done</source>
<translation>Erreur: impossible de construire l'objet</translation>
<message>
<source>DEP_OBJECT</source>
<translation>L'objet choisi a été utilisé pour créer un autre objet ou est référencé par un autre module.
-La suppression de cet objet peut entrainer un export python invalide.
+La suppression de cet objet peut entrainer un export python invalide.
Voulez-vous tout de même supprimer ces objets ?</translation>
</message>
<source>DEVIDE_EDGE_NEW_OBJECT_NAME</source>
<translation>Nouvel objet</translation>
</message>
+ <message>
+ <source>DEVIDE_EDGE_BAD_PROJ_MSG</source>
+ <translation>Projection en dehors de l'arête</translation>
+ </message>
+ <message>
+ <source>DEVIDE_EDGE_BY_PROJ_POINT</source>
+ <translation>Points à projeter</translation>
+ </message>
<message>
<source>ERROR_SHAPE_TYPE</source>
<translation>Le type de l'objet choisi n'est pas correct!
</message>
<message>
<source>GEOM_BEZIER</source>
- <translation>Bezier</translation>
+ <translation>Bézier</translation>
</message>
<message>
<source>GEOM_BINORMAL</source>
</message>
<message>
<source>GEOM_BNDBOX_TITLE</source>
- <translation>Boîte englobante</translation>
+ <translation>Informations sur la Boîte englobante</translation>
</message>
<message>
<source>GEOM_BOX</source>
- <translation>Boite</translation>
+ <translation>Boîte</translation>
</message>
<message>
<source>GEOM_BOX_OBJ</source>
</message>
<message>
<source>GEOM_BSplineRestriction</source>
- <translation>Limitation BSpline</translation>
+ <translation>LimitationB-Spline</translation>
</message>
<message>
<source>GEOM_BUT_APPLY</source>
</message>
<message>
<source>GEOM_CHAMFER_FACES</source>
- <translation>Chanfrein sur des faces</translation>
+ <translation>Chanfrein sur les faces sélectionnées</translation>
</message>
<message>
<source>GEOM_CHAMFER_TITLE</source>
</message>
<message>
<source>GEOM_GETNONBLOCKS_TITLE</source>
- <translation>Récupérer les solides non-hexahédres et les faces non-quadrangles</translation>
+ <translation>Récupérer les solides qui ne sontpas des hexahédres et les faces qui ne sont pas des quadrangles</translation>
</message>
<message>
<source>GEOM_GETNONBLOCKS</source>
- <translation>Récupérer les solides non blocs</translation>
+ <translation>Récupérer les solides qui ne sont pas des blocs</translation>
</message>
<message>
<source>GEOM_NONBLOCKS</source>
<translation>GroupeSolidesNonBlocs</translation>
</message>
<message>
- <source>GEOM_CHECK_INFOS</source>
- <translation>Objet et son information topologique</translation>
- </message>
- <message>
- <source>GEOM_CHECK_SHAPE</source>
- <translation>Contrôler un objet</translation>
+ <source>GEOM_USE_C1_CRITERION</source>
+ <translation>Utiliser un critère C1</translation>
</message>
<message>
- <source>GEOM_CHECK_TITLE</source>
- <translation>Contrôler la validité de l'objet</translation>
+ <source>GEOM_CHECK_INFOS</source>
+ <translation>Objet et ses informations topologiques</translation>
</message>
<message>
<source>GEOM_CHECK_SELF_INTERSECTIONS</source>
<translation>Détecter les auto-intersections</translation>
</message>
<message>
- <source>GEOM_CHECK_SELF_INTERSECTIONS_FAILED</source>
- <translation>La détection d'auto-intersections a échoué</translation>
- </message>
- <message>
- <source>GEOM_NO_SELF_INTERSECTIONS</source>
- <translation>Il n'y a pas d'auto-intersection dans la géométrie</translation>
+ <source>GEOM_FAST_CHECK_INTERSECTIONS</source>
+ <translation>Intersection rapide</translation>
</message>
<message>
- <source>GEOM_SELF_INTERSECTIONS_FOUND</source>
- <translation>Des auto-intersections ont été détectées</translation>
+ <source>GEOM_SHAPE_STATISTICS</source>
+ <translation>Statistiques sur l'objet</translation>
</message>
<message>
<source>GEOM_CIRCLE</source>
</message>
<message>
<source>GEOM_CYLINDER_ANGLE_ERR</source>
- <translation>Les valeurs de l'angle 0 et 360 sont à éviter pour construire des volumes sains. Veuillez décocher la case "Angle" pour utiliser le constructeur de cylindre complet.</translation>
+ <translation>Les valeurs de l'angle 0 et 360 sont à éviter pour construire des volumes sains. Veuillez décocher la case "Angle" pour utiliser le constructeur de cylindre complet.</translation>
</message>
<message>
<source>GEOM_D1</source>
<source>GEOM_EXTRUSION_TITLE</source>
<translation>Construction par extrusion</translation>
</message>
+ <message>
+ <source>GEOM_THICKNESS_TITLE</source>
+ <translation>Epaississement</translation>
+ </message>
+ <message>
+ <source>GEOM_THICKNESS_NAME</source>
+ <translation>Epaississement</translation>
+ </message>
+ <message>
+ <source>GEOM_TOWARDS_INSIDE</source>
+ <translation>Epaissit vers l'intérieur</translation>
+ </message>
<message>
<source>GEOM_SCALE_PRISM</source>
<translation>Appliquer le facteur d'échelle</translation>
<source>GEOM_FACE_FFW</source>
<translation>Création d'une face à partir des contours et/ou arêtes</translation>
</message>
+ <message>
+ <source>GEOM_FACE_FROM_SURFACE</source>
+ <translation>Création de face depuis une surface bornée par un contour</translation>
+ </message>
<message>
<source>GEOM_FACE_OPT</source>
<translation>Privilégier la création d'une face plane</translation>
</message>
+ <message>
+ <source>GEOM_FACE_FFWC</source>
+ <translation>Création d'une face depuis un contour et des contraintes</translation>
+ </message>
+ <message>
+ <source>GEOM_CONSTRAINTS</source>
+ <translation>Contraintes</translation>
+ </message>
+ <message>
+ <source>GEOM_FACE_CONSTRAINT</source>
+ <translation>Face de contrainte</translation>
+ </message>
+ <message>
+ <source>GEOM_SOLID_FROM_FACE_OPT</source>
+ <translation>Intersecter/coller les formes</translation>
+ </message>
<message>
<source>MAKE_FACE_TOLERANCE_TOO_BIG</source>
<translation>Impossible de construire une face plane:
<source>GEOM_FREE_FACES</source>
<translation>Faces libres</translation>
</message>
+ <message>
+ <source>GEOM_FREE_FACES_NAME</source>
+ <translation>Face_libre</translation>
+ </message>
<message>
<source>GEOM_FREE_FACES_TITLE</source>
<translation>Faces libres</translation>
<source>GEOM_GLUE_EDGES_TITLE</source>
<translation>Recoller les arêtes</translation>
</message>
+ <message>
+ <source>GEOM_GLUE_EDGES_DETECT_TITLE</source>
+ <translation>Détection des arêtes coïncidentes</translation>
+ </message>
+ <message>
+ <source>GEOM_GLUE_FACES_DETECT_TITLE</source>
+ <translation>Détection des faces coïncidentes</translation>
+ </message>
<message>
<source>GLUE_ERROR_STICKED_SHAPES</source>
<translation>La valeur de la tolérance est trop importante. Détection de shapes "sticked".</translation>
<translation>Schema de découpe</translation>
</message>
<message>
- <source>GEOM_PROJECTION</source>
- <translation>Projection</translation>
+ <source>GEOM_PROJECTION_ON_FACE</source>
+ <translation>Projection sur une face</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJECTION_ON_WIRE</source>
+ <translation>Projection sur un contour</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJECTION_ON_EDGE</source>
+ <translation>Projection sur une arête</translation>
</message>
<message>
<source>GEOM_PROJECTION_TITLE</source>
<translation>Projection sur une face</translation>
</message>
<message>
- <source>GEOM_SOURCE_OBJECT</source>
- <translation>Point, arête ou contour de source</translation>
+ <source>GEOM_PROJECTION_NAME</source>
+ <translation>Projection</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_FACE_SOURCE</source>
+ <translation>Point, arête ou contour source</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_FACE_TARGET</source>
+ <translation>Face cible</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_WIRE_SOURCE</source>
+ <translation>Point source</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_WIRE_TARGET</source>
+ <translation>Contour cible</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_EDGE_SOURCE</source>
+ <translation>Point source</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_EDGE_TARGET</source>
+ <translation>Arête cible</translation>
</message>
<message>
<source>GEOM_SOLUTION</source>
<source>GEOM_SOLUTION_I</source>
<translation>Solution %1</translation>
</message>
- <message>
- <source>GEOM_TARGET_OBJECT</source>
- <translation>Face d'objectif</translation>
- </message>
<message>
<source>GEOM_WITH_CONTACT</source>
<translation>Avec contact</translation>
<source>GEOM_SELECT_UNPUBLISHED_EDGES</source>
<translation>Choisir les arêtes non-publiées</translation>
</message>
+ <message>
+ <source>GEOM_GENERATE_GROUPS</source>
+ <translation>Générer les groupes</translation>
+ </message>
+ <message>
+ <source>GEOM_GROUP_NAME_PREFIX</source>
+ <translation>Préfixe des groupes</translation>
+ </message>
<message>
<source>GEOM_PLANE</source>
<translation>Plan</translation>
</message>
<message>
<source>GEOM_SELECTED_SHAPE</source>
- <translation>Forme sélectionnée </translation>
+ <translation>Forme sélectionnée</translation>
+ </message>
+ <message>
+ <source>GEOM_SELECTED_SHAPES</source>
+ <translation>Formes sélectionnées</translation>
</message>
<message>
<source>GEOM_SELECTION</source>
<source>GEOM_SOLID_TITLE</source>
<translation>Construction d'un solide</translation>
</message>
+ <message>
+ <source>GEOM_SOLID_SHELLS</source>
+ <translation>Construire un solide depuis des coques</translation>
+ </message>
+ <message>
+ <source>GEOM_SOLID_FACES</source>
+ <translation>Construire un solide depuis des coques/faces connectées</translation>
+ </message>
<message>
<source>GEOM_SPHERE</source>
<translation>Sphère</translation>
<source>GEOM_WRN_WARNING</source>
<translation>Attention</translation>
</message>
+ <message>
+ <source>GEOM_WRN_FACES_NOT_SHELL</source>
+ <translation>Impossible de créer une coque. Le résultat est un assemblage de coques.</translation>
+ </message>
+ <message>
+ <source>GEOM_WRN_FACES_NOT_FACE</source>
+ <translation>Impossible de créer une face. Le résultat est un assemblage de faces.</translation>
+ </message>
<message>
<source>WRN_SHAPE_UNCLOSED</source>
<translation>Impossible de créer un solide à partir d'une forme non-fermée %1</translation>
<source>WRN_NULL_OBJECT_OR_SHAPE</source>
<translation>La forme %1 pour la création d'un solide est invalide</translation>
</message>
+ <message>
+ <source>GROUP_DOWN</source>
+ <translation>Bas</translation>
+ </message>
+ <message>
+ <source>GROUP_UP</source>
+ <translation>Haut</translation>
+ </message>
+ <message>
+ <source>GROUP_SIDE1</source>
+ <translation>Gauche</translation>
+ </message>
+ <message>
+ <source>GROUP_SIDE2</source>
+ <translation>Droite</translation>
+ </message>
+ <message>
+ <source>GROUP_OTHER</source>
+ <translation>Autre</translation>
+ </message>
<message>
<source>GEOM_X</source>
<translation>X :</translation>
<source>MEN_CURVE_CREATOR</source>
<translation>Créateur de courbe</translation>
</message>
+ <message>
+ <source>TOP_CURVE_CREATOR</source>
+ <translation>Créer une courbe</translation>
+ </message>
+ <message>
+ <source>STB_CURVE_CREATOR</source>
+ <translation>Créer une courbe</translation>
+ </message>
<message>
<source>MEN_ALL_SEL_ONLY</source>
<translation>Sélectionner tout</translation>
<source>MEN_CHECK_SELF_INTERSECTIONS</source>
<translation>Détections des auto-intersections</translation>
</message>
+ <message>
+ <source>MEN_FAST_CHECK_INTERSECTIONS</source>
+ <translation>Intersection rapide</translation>
+ </message>
+ <message>
+ <source>MEN_SHAPE_STATISTICS</source>
+ <translation>Statistiques sur l'objet</translation>
+ </message>
<message>
<source>MEN_CHECK_FREE_BNDS</source>
<translation>Contrôler les contours libres</translation>
</message>
<message>
<source>MEN_MEASURES</source>
- <translation>Mesures</translation>
+ <translation>Inspection</translation>
</message>
<message>
<source>MEN_MIN_DIST</source>
<source>MEN_PROJECTION</source>
<translation>Projection</translation>
</message>
+ <message>
+ <source>MEN_PROJ_ON_CYL</source>
+ <translation>Projection sur un cylindre</translation>
+ </message>
<message>
<source>MEN_OPERATIONS</source>
<translation>Opérations</translation>
<source>MEN_PIPE_PATH</source>
<translation>Retrouver le chemin</translation>
</message>
+ <message>
+ <source>MEN_THICKNESS</source>
+ <translation>Epaisseur</translation>
+ </message>
<message>
<source>MEN_PLANE</source>
<translation>Plan</translation>
</message>
<message>
<source>MEN_POP_VERTICES</source>
- <translation type="unfinished">Show Vertices</translation>
+ <translation>Montrer les sommets</translation>
+ </message>
+ <message>
+ <source>MEN_POP_SHOW_NAME</source>
+ <translation>Montrer le nom</translation>
</message>
<message>
<source>MEN_PREFERENCES</source>
<source>MEN_ISOLINE</source>
<translation>Isoligne</translation>
</message>
+ <message>
+ <source>MEN_SURFACE_FROM_FACE</source>
+ <translation>Surface depuis une face</translation>
+ </message>
<message>
<source>MEN_SOLID</source>
<translation>Solide</translation>
</message>
+ <message>
+ <source>MEN_SOLID_FROM_FACES</source>
+ <translation>Solide depuis des faces connectées</translation>
+ </message>
<message>
<source>MEN_SOLID_SEL_ONLY</source>
<translation>Solide</translation>
<source>MEN_MATERIALS_LIBRARY</source>
<translation>Librairie de materiaux</translation>
</message>
+ <message>
+ <source>MEN_TEXTURE</source>
+ <translation>Texture</translation>
+ </message>
<message>
<source>MEN_TORUS</source>
<translation>Tore</translation>
</message>
<message>
<source>MEN_VERTICES_MODE_ON</source>
- <translation type="unfinished">Show Vertices</translation>
+ <translation>Montrer les sommets</translation>
</message>
<message>
<source>MEN_VERTICES_MODE_OFF</source>
- <translation type="unfinished">Hide Vertices</translation>
+ <translation>Cacher les sommets</translation>
+ </message>
+ <message>
+ <source>MEN_NAME_MODE_ON</source>
+ <translation>Montrer le nom</translation>
+ </message>
+ <message>
+ <source>MEN_NAME_MODE_OFF</source>
+ <translation>Cacher le nom</translation>
</message>
<message>
<source>MEN_WIREFRAME</source>
<source>MEN_POP_PREDEF_MATER_CUSTOM</source>
<translation>Personnalisé...</translation>
</message>
+ <message>
+ <source>MEN_EDGE_EXTEND</source>
+ <translation>Arête étendue</translation>
+ </message>
+ <message>
+ <source>MEN_FACE_EXTEND</source>
+ <translation>Face étendue</translation>
+ </message>
<message>
<source>NAME_LBL</source>
<translation>Nom : </translation>
</message>
<message>
<source>PREF_DEFLECTION</source>
- <translation>Coefficient de déformation</translation>
+ <translation>Coefficient de déformation par défaut</translation>
</message>
<message>
<source>GEOM_PREF_def_precision</source>
</message>
<message>
<source>PREF_TRANSPARENCY</source>
- <translation>Transparence</translation>
+ <translation>Transparence par défaut</translation>
</message>
<message>
<source>PREF_FREE_BOUND_COLOR</source>
</message>
<message>
<source>PREF_GROUP_VERTEX</source>
- <translation>Marqueurs de points</translation>
+ <translation>Marqueurs de points par défaut</translation>
</message>
<message>
<source>PREF_ISOS_COLOR</source>
<translation>Couleur des isolignes</translation>
</message>
+ <message>
+ <source>PREF_LABEL_COLOR</source>
+ <translation>Couleur des étiquettes</translation>
+ </message>
<message>
<source>PREF_TOPLEVEL_COLOR</source>
<translation>Couleur des objets mis au premier plan</translation>
</message>
<message>
<source>PREF_EDGE_WIDTH</source>
- <translation>Epaisseur des arêtes</translation>
+ <translation>Epaisseur des arêtes par défaut</translation>
</message>
<message>
<source>PREF_ISOLINES_WIDTH</source>
- <translation>Epaisseur des isolignes</translation>
+ <translation>Epaisseur des isolignes par défaut</translation>
</message>
<message>
<source>PREF_PREVIEW_EDGE_WIDTH</source>
<translation>Epaisseur de la ligne</translation>
</message>
<message>
- <source>PREF_DIMENSIONS_FONT_HEIGHT</source>
- <translation>Taille de police</translation>
+ <source>PREF_DIMENSIONS_FONT</source>
+ <translation>Police</translation>
</message>
<message>
<source>PREF_DIMENSIONS_ARROW_LENGTH</source>
<source>PREF_DIMENSIONS_SHOW_UNITS</source>
<translation>Afficher les unités</translation>
</message>
+ <message>
+ <source>PREF_DIMENSIONS_USE_TEXT3D</source>
+ <translation>Utiliser du texte 3D</translation>
+ </message>
+ <message>
+ <source>PREF_HIDE_INPUT_OBJECT</source>
+ <translation>Cacher dans la vue les objets en entrée</translation>
+ </message>
<message>
<source>PREF_ISOS</source>
- <translation>Nombre d'isolignes</translation>
+ <translation>Nombre d'isolignes par défaut</translation>
</message>
<message>
<source>PREF_ISOS_U</source>
<source>STB_CHECK_SELF_INTERSECTIONS</source>
<translation>Détecte les auto-intersections</translation>
</message>
+ <message>
+ <source>STB_FAST_CHECK_INTERSECTIONS</source>
+ <translation>Intersection rapide</translation>
+ </message>
+ <message>
+ <source>STB_SHAPE_STATISTICS</source>
+ <translation>Statistique de l'objet</translation>
+ </message>
<message>
<source>STB_CHECK_FREE_BNDS</source>
<translation>Vérifier les contours libres</translation>
<source>STB_PROJECTION</source>
<translation>Projeter un point, une arête ou un contour sur une face</translation>
</message>
+ <message>
+ <source>STB_PROJ_ON_CYL</source>
+ <translation>Projète un contour ou une face sur un cylindre</translation>
+ </message>
<message>
<source>STB_ORIGIN_AND_VECTORS</source>
<translation>Créer les vecteurs de base et l'origine</translation>
<source>STB_PIPE_PATH</source>
<translation>Retrouver le chemin à partir d'un objet de type tuyau</translation>
</message>
+ <message>
+ <source>STB_THICKNESS</source>
+ <translation>Crée un solide par ajout d'épaisseur</translation>
+ </message>
<message>
<source>STB_PLANE</source>
<translation>Créer un plan</translation>
</message>
<message>
<source>STB_POP_VERTICES</source>
- <translation type="unfinished">Show Vertices</translation>
+ <translation>Montrer les sommets</translation>
+ </message>
+ <message>
+ <source>STB_POP_SHOW_NAME</source>
+ <translation>Montrer le nom</translation>
</message>
<message>
<source>STB_POP_SETTEXTURE</source>
<source>STB_VECTOR_MODE</source>
<translation>Changer le mode de représentation des arêtes</translation>
</message>
+ <message>
+ <source>STB_NAME_MODE</source>
+ <translation>Montrer/cacher le nom des objets visibles</translation>
+ </message>
<message>
<source>STB_SHADING_COLOR</source>
<translation>Définir la couleur d'ombrage</translation>
<source>STB_ISOLINE</source>
<translation>Créer une U ou V isoligne</translation>
</message>
+ <message>
+ <source>STB_SURFACE_FROM_FACE</source>
+ <translation>Créer une surface depuis une face</translation>
+ </message>
<message>
<source>STB_SOLID</source>
<translation>Construire un solide</translation>
<source>TOP_CHECK_SELF_INTERSECTIONS</source>
<translation>Détection des auto-intersections</translation>
</message>
+ <message>
+ <source>TOP_FAST_CHECK_INTERSECTIONS</source>
+ <translation>Intersection rapide</translation>
+ </message>
+ <message>
+ <source>TOP_SHAPE_STATISTICS</source>
+ <translation>Statistique de l'objet</translation>
+ </message>
<message>
<source>TOP_CHECK_FREE_BNDS</source>
<translation>Valider les contours libres</translation>
<source>TOP_PROJECTION</source>
<translation>Projection</translation>
</message>
+ <message>
+ <source>TOP_PROJ_ON_CYL</source>
+ <translation>Projection sur un cylindre</translation>
+ </message>
<message>
<source>TOP_ORIGIN_AND_VECTORS</source>
<translation>Créer l'origine et les vecteurs de base</translation>
<source>TOP_PIPE_PATH</source>
<translation>Retrouver le chemin</translation>
</message>
+ <message>
+ <source>TOP_THICKNESS</source>
+ <translation>Epaississement</translation>
+ </message>
<message>
<source>TOP_PLANE</source>
<translation>Créer un plan</translation>
<source>TOP_ISOLINE</source>
<translation>Isoligne</translation>
</message>
+ <message>
+ <source>TOP_SURFACE_FROM_FACE</source>
+ <translation>Surface depuis une face</translation>
+ </message>
<message>
<source>TOP_SOLID</source>
<translation>Créer un solide</translation>
<source>GEOM_REMOVE_EXTRA_EDGES_TITLE</source>
<translation>Supprimer les arêtes inutiles</translation>
</message>
+ <message>
+ <source>GEOM_BOOL_REMOVE_EXTRA_EDGES</source>
+ <translation>Supprimer les arêtes inutiles</translation>
+ </message>
<message>
<source>GEOM_REMOVE_EXTRA_EDGES</source>
<translation>Objet dont on supprime les arêtes inutiles</translation>
<source>STB_UNION_FACES</source>
<translation>Unir les faces</translation>
</message>
+ <message>
+ <source>TOP_INSPECT_OBJECT</source>
+ <translation>Inspecter un objet</translation>
+ </message>
+ <message>
+ <source>MEN_INSPECT_OBJECT</source>
+ <translation>Inspecter un objet</translation>
+ </message>
+ <message>
+ <source>STB_INSPECT_OBJECT</source>
+ <translation>Inspecter un objet</translation>
+ </message>
<message>
<source>TOP_NORMALE</source>
<translation>Vecteur normal à une face</translation>
</message>
<message>
<source>MEN_POP_SHOW_DEPENDENCY_TREE</source>
- <translation type="unfinished">Show dependency tree</translation>
+ <translation>Montrer l'arbre des dépendances</translation>
</message>
<message>
- <source>MEN_POP_SHOW_REDUCE_STUDY</source>
- <translation type="unfinished">Reduce study</translation>
+ <source>MEN_POP_REDUCE_STUDY</source>
+ <translation>Etude réduite</translation>
</message>
<message>
<source>MEN_POP_SHOW_ALL_DIMENSIONS</source>
<source>GEOM_Z_I</source>
<translation>Z%1 :</translation>
</message>
+ <message>
+ <source>GEOM_A_I</source>
+ <translation>A%1 :</translation>
+ </message>
<message>
<source>GEOM_SHAPES_ON_SHAPE_TITLE</source>
<translation>Trouver les éléments d'un objet</translation>
<source>STB_GET_SHARED_SHAPES</source>
<translation>Trouve les éléments partagés</translation>
</message>
+ <message>
+ <source>TOP_TRANSFER_DATA</source>
+ <translation>Transfert de données</translation>
+ </message>
+ <message>
+ <source>MEN_TRANSFER_DATA</source>
+ <translation>Transfert de données</translation>
+ </message>
+ <message>
+ <source>STB_TRANSFER_DATA</source>
+ <translation>Transfert de données</translation>
+ </message>
+ <message>
+ <source>TOP_EXTENSION</source>
+ <translation>Extend Edge or Face</translation>
+ </message>
+ <message>
+ <source>MEN_EXTENSION</source>
+ <translation>Extension</translation>
+ </message>
+ <message>
+ <source>STB_EXTENSION</source>
+ <translation>Extend Edge or Face</translation>
+ </message>
<message>
<source>GEOM_PUBLISH_RESULT_GRP</source>
<translation>Options avancées</translation>
</message>
<message>
<source>PREF_TAB_DEPENDENCY_VIEW</source>
- <translation type="unfinished">Dependency Tree</translation>
+ <translation>Arbre des dépendances</translation>
</message>
<message>
<source>PREF_HIERARCHY_TYPE</source>
- <translation type="unfinished">Hierarchy type</translation>
+ <translation>Type de hiérarchie</translation>
</message>
<message>
<source>MEN_ONLY_ASCENDANTS</source>
- <translation type="unfinished">Display only ascendants tree</translation>
+ <translation>Montrer seulement les liens ascendants</translation>
</message>
<message>
<source>MEN_ONLY_DESCENDANTS</source>
- <translation type="unfinished">Display only descendants tree</translation>
+ <translation>Montrer seulement les liens descendants</translation>
</message>
<message>
<source>MEN_BOTH_ASCENDANTS_DESCENDANTS</source>
- <translation type="unfinished">Display both ascendants and descendants trees</translation>
+ <translation>Montrer les liens ascendants et descendants</translation>
</message>
<message>
<source>GEOM_MOVE_POSSIBILITY</source>
- <translation type="unfinished">Possibility to move nodes</translation>
+ <translation>Possibilité de déplacer des noeuds</translation>
</message>
<message>
<source>PREF_GROUP_DEPENDENCY_VIEW_COLOR</source>
- <translation type="unfinished">Color</translation>
+ <translation>Couleur</translation>
</message>
<message>
<source>PREF_DEPENDENCY_VIEW_BACKGROUND_COLOR</source>
- <translation type="unfinished">Background color</translation>
+ <translation>Couleur du fond</translation>
</message>
<message>
<source>PREF_DEPENDENCY_VIEW_NODE_COLOR</source>
- <translation type="unfinished">Default node color</translation>
+ <translation>Couleur des noeuds par défaut</translation>
</message>
<message>
<source>PREF_DEPENDENCY_VIEW_MAIN_NODE_COLOR</source>
- <translation type="unfinished">Main node color</translation>
+ <translation>Couleur des noeuds principaux</translation>
</message>
<message>
<source>PREF_DEPENDENCY_VIEW_UNPUBLISH_NODE_COLOR</source>
- <translation type="unfinished">Unpublished node color</translation>
+ <translation>Couleur des noeuds non publiés</translation>
</message>
<message>
<source>PREF_DEPENDENCY_VIEW_SELECT_NODE_COLOR</source>
- <translation type="unfinished">Selected node color</translation>
+ <translation>Couleurs des noeuds sélectionnés</translation>
</message>
<message>
<source>PREF_DEPENDENCY_VIEW_ARROW_COLOR</source>
- <translation type="unfinished">Arrow color</translation>
+ <translation>Couleur des flèches par défaut</translation>
</message>
<message>
<source>PREF_DEPENDENCY_VIEW_HIGHLIGHT_ARROW_COLOR</source>
- <translation type="unfinished">Highlighted arrow color</translation>
+ <translation>Couleur des flèches en surbrillance</translation>
</message>
<message>
<source>PREF_DEPENDENCY_VIEW_SELECT_ARROW_COLOR</source>
- <translation type="unfinished">Selected arrow color</translation>
+ <translation>Couleur des flèches sélectionnées</translation>
</message>
<message>
<source>GEOM_ALL_IMPORT_FILES</source>
<source>CC_PNT_ITEM_X_Y_Z</source>
<translation>X=%1, Y=%2, Z=%3</translation>
</message>
+ <message>
+ <source>GEOM_FILTER</source>
+ <translation>Filtre</translation>
+ </message>
+ <message>
+ <source>GEOM_LESS_THAN</source>
+ <translation>Moins que</translation>
+ </message>
+ <message>
+ <source>GEOM_LESSOREQUAL_THAN</source>
+ <translation>Egal ou moins que</translation>
+ </message>
+ <message>
+ <source>GEOM_GREAT_THAN</source>
+ <translation>Plus que</translation>
+ </message>
+ <message>
+ <source>GEOM_GREATOREQUAL_THAN</source>
+ <translation>Egal ou plus que</translation>
+ </message>
+ <message>
+ <source>GEOM_SOME_SHAPES_SELECTED</source>
+ <translation>%1 forme(s) a(ont) été sélectionnée(s)</translation>
+ </message>
+ <message>
+ <source>GEOM_NO_SHAPES_SELECTED</source>
+ <translation>Aucune forme ne correspond aux paramètres de filtrage</translation>
+ </message>
+ <message>
+ <source>GEOM_HEALING_STATS_TITLE</source>
+ <translation>Modifications réalisées</translation>
+ </message>
+ <message>
+ <source>GEOM_HEALING_STATS_COL_1</source>
+ <translation>Décompte</translation>
+ </message>
+ <message>
+ <source>GEOM_HEALING_STATS_COL_2</source>
+ <translation>Modification</translation>
+ </message>
+ <message>
+ <source>GEOM_PLOT_DISTRIBUTION</source>
+ <translation>Graphe</translation>
+ </message>
+ <message>
+ <source>GEOM_X_AXIS</source>
+ <translation>Axe X</translation>
+ </message>
+ <message>
+ <source>GEOM_Y_AXIS</source>
+ <translation>Axe Y</translation>
+ </message>
+ <message>
+ <source>GEOM_Z_AXIS</source>
+ <translation>Axe Z</translation>
+ </message>
+ <message>
+ <source>GEOM_DIM_AXES</source>
+ <translation>Dimensions sur les axes locaux</translation>
+ </message>
</context>
<context>
<name>GeometryGUI</name>
</message>
<message>
<source>TOOL_MEASURES</source>
- <translation>Informations</translation>
+ <translation>Inspection</translation>
</message>
<message>
<source>TOOL_IMPORTEXPORT</source>
<translation>Face 2 V</translation>
</message>
</context>
-<context>
- <name>CurveCreator_NewPointDlg</name>
- <message>
- <source>ADD_NEW_POINT</source>
- <translation>Add new points</translation>
- </message>
- <message>
- <source>X_COORD</source>
- <translation>X</translation>
- </message>
- <message>
- <source>Y_COORD</source>
- <translation>Y</translation>
- </message>
- <message>
- <source>Z_COORD</source>
- <translation>Z</translation>
- </message>
- <message>
- <source>ADD_BTN</source>
- <translation>Add</translation>
- </message>
- <message>
- <source>ADD_CONTINUE_BTN</source>
- <translation>Add and continue</translation>
- </message>
- <message>
- <source>ADD_NEW_POINT_TO_%1</source>
- <translation>Add new point to %1</translation>
- </message>
- <message>
- <source>SET_POINT_COORDINATES</source>
- <translation>Set point coordinates</translation>
- </message>
-</context>
<context>
<name>CurveCreator_NewSectionDlg</name>
<message>
- <source>NAME</source>
- <translation>Name</translation>
+ <source>SECTION_NAME</source>
+ <translation>Nom</translation>
</message>
<message>
- <source>LINE_TYPE</source>
+ <source>SECTION_LINE_TYPE</source>
<translation>Type</translation>
</message>
<message>
- <source>POLYLINE_TYPE</source>
- <translation>Polyline</translation>
+ <source>SECTION_POLYLINE_TYPE</source>
+ <translation>Polyligne</translation>
</message>
<message>
- <source>SPLINE_TYPE</source>
+ <source>SECTION_SPLINE_TYPE</source>
<translation>Spline</translation>
</message>
<message>
- <source>LINE_CLOSED</source>
- <translation>Closed</translation>
+ <source>SECTION_LINE_CLOSED</source>
+ <translation>Fermée</translation>
</message>
<message>
- <source>OK</source>
- <translation>Ok</translation>
+ <source>SECTION_ADD_BTN</source>
+ <translation>Ajouter</translation>
</message>
<message>
- <source>ADD_BTN</source>
- <translation>Add</translation>
+ <source>SECTION_OK_BTN</source>
+ <translation>Ok</translation>
</message>
<message>
- <source>ADD_CONTINUE_BTN</source>
- <translation>Add and continue</translation>
+ <source>SECTION_CANCEL_BTN</source>
+ <translation>Annuler</translation>
</message>
<message>
<source>ADD_NEW_SECTION</source>
</message>
</context>
<context>
- <name>CurveCreator_Widget</name>
+ <name>CurveCreator_TableView</name>
<message>
- <source>CURVE_NAME_TLT</source>
- <translation>Nom</translation>
+ <source>TABLE_SECTION</source>
+ <translation>Section</translation>
+ </message>
+ <message>
+ <source>TABLE_INDEX</source>
+ <translation>Indice</translation>
+ </message>
+ <message>
+ <source>TABLE_X</source>
+ <translation>X</translation>
+ </message>
+ <message>
+ <source>TABLE_Y</source>
+ <translation>Y</translation>
</message>
+</context>
+<context>
+ <name>CurveCreator_Widget</name>
<message>
- <source>SECTION_GROUP_TLT</source>
+ <source>SECTION_GROUP_TITLE</source>
<translation>Sections</translation>
</message>
<message>
<source>NEW_SECTION_TLT</source>
<translation>Insérer une nouvelle section</translation>
</message>
- <message>
- <source>INSERT_SECTION_BEFORE</source>
- <translation>Insérer une section avant</translation>
- </message>
- <message>
- <source>INSERT_SECTION_BEFORE_TLT</source>
- <translation>Insérer section avant</translation>
- </message>
- <message>
- <source>INSERT_SECTION_AFTER</source>
- <translation>Insérer une section après</translation>
- </message>
- <message>
- <source>INSERT_SECTION_AFTER_TLT</source>
- <translation>Insérer section après</translation>
- </message>
<message>
<source>ADDITION_MODE</source>
<translation>Mode Ajout</translation>
<source>DETECTION_MODE_TLT</source>
<translation>Mode Détection</translation>
</message>
- <message>
- <source>INSERT_POINT_BEFORE</source>
- <translation>Insérer point avant</translation>
- </message>
- <message>
- <source>INSERT_POINT_BEFORE_TLT</source>
- <translation>Insérer un point avant</translation>
- </message>
- <message>
- <source>INSERT_POINT_AFTER</source>
- <translation>Insérer point après</translation>
- </message>
<message>
<source>CLOSE_SECTIONS</source>
<translation>Fermer sections</translation>
<source>JOIN_TLT</source>
<translation>Joindre les sections sélectionnées</translation>
</message>
- <message>
- <source>STEP_UP</source>
- <translation>Monter</translation>
- </message>
- <message>
- <source>STEP_UP_TLT</source>
- <translation>Monter les objets sélectionnés</translation>
- </message>
- <message>
- <source>STEP_DOWN</source>
- <translation>Descendre</translation>
- </message>
- <message>
- <source>STEP_DOWN_TLT</source>
- <translation>Descendre les objets sélectionnés</translation>
- </message>
<message>
<source>CLEAR_ALL</source>
<translation>Effacer tout</translation>
<translation>Joindre toutes les sections</translation>
</message>
</context>
+<context>
+ <name>EntityGUI_PolylineDlg</name>
+ <message>
+ <source>POLYLINE_DLG_TITLE</source>
+ <translation>Construction de polyligne</translation>
+ </message>
+ <message>
+ <source>POLYLINE_TITLE</source>
+ <translation>Polyligne</translation>
+ </message>
+ <message>
+ <source>POLYLINE_NAME</source>
+ <translation>Polyligne</translation>
+ </message>
+ <message>
+ <source>POLYLINE_IMPORT</source>
+ <translation>Importer une polyligne</translation>
+ </message>
+ <message>
+ <source>POLYLINE_ADD_SECTION</source>
+ <translation>Ajouter une section</translation>
+ </message>
+ <message>
+ <source>POLYLINE_EDIT_SECTION</source>
+ <translation>Modifier une section</translation>
+ </message>
+</context>
<context>
<name>EntityGUI_SketcherDlg</name>
<message>
<source>GEOM_ADD_THICKNESS</source>
<translation>Epaissir (arêtes ou contours uniquement)</translation>
</message>
- <message>
- <source>GEOM_TOWARDS_INSIDE</source>
- <translation>Epaissir vers l'intérieur</translation>
- </message>
</context>
<context>
<name>GroupGUI</name>
<translation>L'activation de cette option peut résulter en une perte de temps sur certains objets.
Voulez-vous continuer?</translation>
</message>
+ <message>
+ <source>WIDTH_FACTOR_TOL</source>
+ <translation>Tol. du facteur d'épaisseur</translation>
+ </message>
+ <message>
+ <source>VOLUME_TOL</source>
+ <translation>Tol. de volume</translation>
+ </message>
+ <message>
+ <source>TO_MERGE_SOLIDS</source>
+ <translation>Réunir les solides</translation>
+ </message>
+ <message>
+ <source>SELECT_ALL</source>
+ <translation>Tout sélectionner</translation>
+ </message>
</context>
<context>
<name>GEOMToolsGUI_DeleteDlg</name>
<source>GEOM_SHARED_SHAPE</source>
<translation>Partagé_%1</translation>
</message>
+ <message>
+ <source>GEOM_SHARED_SHAPES_MULTISHARE</source>
+ <translation>Partagé par tous</translation>
+ </message>
</context>
<context>
<name>GEOMToolsGUI_PublishDlg</name>
<name>GEOMToolsGUI_ReduceStudyDlg</name>
<message>
<source>GEOM_REDUCE_STUDY_TITLE</source>
- <translation type="unfinished">Reduce study</translation>
+ <translation>Etude réduite</translation>
</message>
<message>
<source>GEOM_REDUCE_STUDY_KEPT_OBJECTS</source>
- <translation type="unfinished">Objects to be kept</translation>
+ <translation>Objets à conserver</translation>
</message>
<message>
<source>GEOM_REDUCE_STUDY_REMOVE_OBJECTS</source>
- <translation type="unfinished">Objects to be removed</translation>
+ <translation>Objets à enlever</translation>
</message>
<message>
<source>GEOM_REDUCE_STUDY_NAME</source>
- <translation type="unfinished">Name</translation>
+ <translation>Nom</translation>
</message>
<message>
<source>GEOM_REDUCE_STUDY_OPTIONS</source>
- <translation type="unfinished">Options</translation>
+ <translation>Options</translation>
</message>
<message>
<source>GEOM_REDUCE_STUDY_INTERMEDIATES</source>
- <translation type="unfinished">Intermediate objects</translation>
+ <translation>Objets intermédiaires</translation>
</message>
<message>
<source>GEOM_REDUCE_STUDY_SUB_OBJECTS</source>
- <translation type="unfinished">Sub-objects</translation>
+ <translation>Sous-objets</translation>
</message>
<message>
<source>GEOM_REDUCE_STUDY_KEEP</source>
- <translation type="unfinished">Keep</translation>
+ <translation>Conserver</translation>
</message>
<message>
<source>GEOM_REDUCE_STUDY_UNPUBLISH</source>
- <translation type="unfinished">Unpublish</translation>
+ <translation>Dépublier</translation>
</message>
<message>
<source>GEOM_REDUCE_STUDY_REMOVE</source>
- <translation type="unfinished">Remove</translation>
+ <translation>Enlever</translation>
</message>
<message>
<source>GEOM_REDUCE_STUDY_REMOVE_EMPTY_FOLDER</source>
- <translation type="unfinished">Remove empty folders</translation>
+ <translation>Enlever les dossiers vide</translation>
</message>
<message>
<source>GEOM_REDUCE_STUDY_SOFT_REMOVAL</source>
- <translation type="unfinished">Soft removal</translation>
+ <translation>Dépublication seulement</translation>
</message>
<message>
<source>GEOM_REDUCE_STUDY_WARNING_DELETE</source>
- <translation type="unfinished">Do you really want to delete intermediate objects? After applying this operation study will be broken.</translation>
+ <translation>Voulez-vous vraiment supprimer les objets intermédiaires ? Après la confirmation de cette opération, l'étude sera cassée.</translation>
</message>
</context>
<context>
<translation>UnirFaces</translation>
</message>
</context>
+<context>
+ <name>RepairGUI_InspectObjectDlg</name>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_TITLE</source>
+ <translation>Inspecter un objet</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_MAIN_SHAPE</source>
+ <translation>Forme principale</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_SHOW</source>
+ <translation>Afficher la sélection</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_SHOW_ONLY</source>
+ <translation>Afficher la sélection seulement</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_HIDE</source>
+ <translation>Cacher la sélection</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_PUBLISH</source>
+ <translation>Publier la sélection</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_NAME</source>
+ <translation>Nom</translation>
+ </message>
+</context>
<context>
<name>GEOMGUI_CreationInfoWdg</name>
<message>
<translation>(aucune information disponible)</translation>
</message>
</context>
+<context>
+ <name>GEOMGUI_TextTreeWdg</name>
+ <message>
+ <source>TEXT_TREE_VIEW_TITLE</source>
+ <translation>Texte</translation>
+ </message>
+ <message>
+ <source>TEXT_TREE_VIEW_NAME</source>
+ <translation>Nom</translation>
+ </message>
+</context>
<context>
<name>EntityGUI_IsolineDlg</name>
<message>
<translation>V-Isoligne</translation>
</message>
</context>
+<context>
+ <name>MeasureGUI_CheckSelfIntersectionsDlg</name>
+ <message>
+ <source>GEOM_CHECK_INTERSECT_TYPE</source>
+ <translation>Détection du type d'auto-intersection</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_INTERSECTIONS</source>
+ <translation>Auto-intersections</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_SUBSHAPES</source>
+ <translation>Sous-formes</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_CHECK_LEVEL</source>
+ <translation>Niveau de vérification</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_SUMMARY</source>
+ <translation>Résumé</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_COMPUTE</source>
+ <translation>Calculer les auto-intersections</translation>
+ </message>
+ <message>
+ <source>GEOM_SELF_INTERSECTION_NAME</source>
+ <translation>Auto_intersection</translation>
+ </message>
+ <message>
+ <source>GEOM_NO_SELF_INTERSECTIONS</source>
+ <translation>Il n'y a pas d'auto-intersection dans la géométrie</translation>
+ </message>
+ <message>
+ <source>GEOM_SELF_INTERSECTIONS_FOUND</source>
+ <translation>Des auto-intersections ont été détectées</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_SELF_INTERSECTIONS_FAILED</source>
+ <translation>La détection d'auto-intersections a échoué</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_SELF_INTERSECTIONS_ERRORS</source>
+ <translation>Avertissement: il y a eu des erreurs pendant l'opération, la liste peut donc être incomplète.</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_V_V</source>
+ <translation>Point à point</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_V_E</source>
+ <translation>Point à arête + tout au-delà</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_E_E</source>
+ <translation>Arête à arête + tout au-delà</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_V_F</source>
+ <translation>Point à face + tout au-delà</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_E_F</source>
+ <translation>Arête à Face + tout au-delà</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_ALL</source>
+ <translation>Face à Face + tout au-delà</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INT_DEFLECT</source>
+ <translation>Coefficient de déflexion</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INT_DETECT_GAPS</source>
+ <translation>Détection des écarts avec tolérance</translation>
+ </message>
+</context>
+<context>
+ <name>MeasureGUI_FastCheckIntersectionsDlg</name>
+ <message>
+ <source>GEOM_FAST_CHECK_INT_DEFLECT</source>
+ <translation>Coefficient de déflection</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_CHECK_INT_DETECT_GAPS</source>
+ <translation>Détecter les écarts avec la tolérance</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_CHECK_INT_SUBSHAPES</source>
+ <translation>Sous-formes de l'objet %1:</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_CHECK_INT_COMPUTE</source>
+ <translation>Calculer les intersections</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_INTERSECTION_NAME</source>
+ <translation>Intersection_rapide</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_INTERSECTION_FAILS</source>
+ <translation>Pas d'intersection</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_CHECK_OBJ</source>
+ <translation>Objets et résultats</translation>
+ </message>
+</context>
+<context>
+ <name>MeasureGUI_ShapeStatisticsDlg</name>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_TYPE</source>
+ <translation>Type</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_LENGTH</source>
+ <translation>Longueur des arêtes</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_AREA</source>
+ <translation>Aire des faces</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_VOLUME</source>
+ <translation>Volume des solides</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_NB_INTERVALS</source>
+ <translation>Nombre d'intervalles</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_SCALAR_RANGE</source>
+ <translation>Echelle de dimension</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_COMPUTE</source>
+ <translation>Calculer</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN</source>
+ <translation>Min</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MAX</source>
+ <translation>Max</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_CREATE_GROUPS</source>
+ <translation>Créer des groupes</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_DISTRIBUTION_NB_ENT</source>
+ <translation>Nombre d'entités</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN_ERROR</source>
+ <translation>Spécifier une valeur minimale ou ignorer l'échelle de dimension</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MAX_ERROR</source>
+ <translation>Spécifier une valeur maximale ou ignorer l'échelle de dimension</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR</source>
+ <translation>La valeur minimal ne peut pas être plus grande que la maximale</translation>
+ </message>
+ <message>
+ <source>GEOM_MSG_GROUPS_CREATED</source>
+ <translation>%1 groupes créés</translation>
+ </message>
+</context>
+<context>
+ <name>TransformationGUI_ExtensionDlg</name>
+ <message>
+ <source>GEOM_EXTENSION_TITLE</source>
+ <translation>Extension d'arête ou de face</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION</source>
+ <translation>Extension</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MIN</source>
+ <translation>Premier paramètre</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MAX</source>
+ <translation>Dernier paramètre</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MIN_U</source>
+ <translation>Premier U-paramètre</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MAX_U</source>
+ <translation>Dernier U-paramètre</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MIN_V</source>
+ <translation>Premier V-paramètre</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MAX_V</source>
+ <translation>Dernier V-paramètre</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_EDGE_NAME</source>
+ <translation>AreteEtendue</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_FACE_NAME</source>
+ <translation>FaceEtendue</translation>
+ </message>
+</context>
+<context>
+ <name>EntityGUI_SurfFromFaceDlg</name>
+ <message>
+ <source>GEOM_SURF_FROM_FACE_TITLE</source>
+ <translation>Construction de surface depuis une face</translation>
+ </message>
+ <message>
+ <source>GEOM_SURF_FROM_FACE</source>
+ <translation>Surface depuis une face</translation>
+ </message>
+ <message>
+ <source>GEOM_SURF_FROM_FACE_NAME</source>
+ <translation>SurfaceDepuisFace</translation>
+ </message>
+</context>
+<context>
+ <name>OperationGUI_TransferDataDlg</name>
+ <message>
+ <source>GEOM_TRANSFER_DATA_TITLE</source>
+ <translation>Transfert de données</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA</source>
+ <translation>Transfert de données</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_FROM</source>
+ <translation>Forme source</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_TO</source>
+ <translation>Forme de destination</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_METHOD</source>
+ <translation>Type d'opération de détection</translation>
+ </message>
+ <message>
+ <source>GEOM_TD_METHOD_GETINPLACE</source>
+ <translation>Get In Place</translation>
+ </message>
+ <message>
+ <source>GEOM_TD_METHOD_GETINPLACE_OLD</source>
+ <translation>Get In Place (old)</translation>
+ </message>
+ <message>
+ <source>GEOM_TD_METHOD_GETINPLACE_HISTORY</source>
+ <translation>Get In Place By History</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_INFO</source>
+ <translation>Transfert de données: Information</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_NOT_COPIED</source>
+ <translation>Il n'y a rien à copier.</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_COPIED</source>
+ <translation>Les données suivantes ont été copiées:</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_NAMES</source>
+ <translation>Noms: %1 de %2</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_MATERIALS</source>
+ <translation>Matériaux: %1 de %2</translation>
+ </message>
+</context>
+<context>
+ <name>TransformationGUI_ProjectionOnCylDlg</name>
+ <message>
+ <source>GEOM_PROJ_ON_CYL_TITLE</source>
+ <translation>Projection sur un cylindre</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_CYL_START_ANGLE</source>
+ <translation>Angle de départ</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_CYL_LENGTH_ANGLE</source>
+ <translation>Longueur de l'angle</translation>
+ </message>
+</context>
</TS>
<source>DEVIDE_EDGE_NEW_OBJECT_NAME</source>
<translation>NewObject</translation>
</message>
+ <message>
+ <source>DEVIDE_EDGE_BAD_PROJ_MSG</source>
+ <translation>エッジ外側の投影</translation>
+ </message>
+ <message>
+ <source>DEVIDE_EDGE_BY_PROJ_POINT</source>
+ <translation>投影点</translation>
+ </message>
<message>
<source>ERROR_SHAPE_TYPE</source>
<translation>選択したオブジェクトの種類が正しくありません!\nフェース、シェルまたはソリッドを選択し、もう一度やり直してください。</translation>
<source>GEOM_NONBLOCKS</source>
<translation>GroupeSolidesNonBlocs</translation>
</message>
+ <message>
+ <source>GEOM_USE_C1_CRITERION</source>
+ <translation>C1 criterion の使用</translation>
+ </message>
<message>
<source>GEOM_CHECK_INFOS</source>
<translation>オブジェクトとその位相情報</translation>
<translation>自己交差の検出</translation>
</message>
<message>
- <source>GEOM_CHECK_SELF_INTERSECTIONS_FAILED</source>
- <translation>自己交差の検出に失敗しました</translation>
- </message>
- <message>
- <source>GEOM_NO_SELF_INTERSECTIONS</source>
- <translation>自己交差は検出されませんでした。</translation>
- </message>
- <message>
- <source>GEOM_SELF_INTERSECTIONS_FOUND</source>
- <translation>自己交差が検出されました。</translation>
+ <source>GEOM_FAST_CHECK_INTERSECTIONS</source>
+ <translation>クイック交点</translation>
</message>
<message>
- <source>GEOM_CHECK_SELF_INTERSECTIONS_ERRORS</source>
- <translation>警告: 操作中にエラーがあったので、リストが不完全かもしれない</translation>
+ <source>GEOM_SHAPE_STATISTICS</source>
+ <translation>形状の統計</translation>
</message>
<message>
<source>GEOM_CIRCLE</source>
<source>GEOM_CYLINDER_TITLE</source>
<translation>円柱の作成</translation>
</message>
+ <message>
+ <source>GEOM_CYLINDER_ANGLE_ERR</source>
+ <translation>角度値0°と360°はボリューム構築には不適切です。標準の円筒構築機能を使用するために角度ボックスのチェックを外してください。</translation>
+ </message>
<message>
<source>GEOM_D1</source>
<translation>D1 を:</translation>
<source>GEOM_EXTRUSION_TITLE</source>
<translation>面の押出し</translation>
</message>
+ <message>
+ <source>GEOM_THICKNESS_TITLE</source>
+ <translation>厚みの構築</translation>
+ </message>
+ <message>
+ <source>GEOM_THICKNESS_NAME</source>
+ <translation>Thickness</translation>
+ </message>
+ <message>
+ <source>GEOM_TOWARDS_INSIDE</source>
+ <translation>内側への厚み</translation>
+ </message>
<message>
<source>GEOM_SCALE_PRISM</source>
<translation>面のサイズを変えながら押し出す</translation>
<source>GEOM_FACE_FFW</source>
<translation>顔輪郭またはエッジからの作成</translation>
</message>
+ <message>
+ <source>GEOM_FACE_FROM_SURFACE</source>
+ <translation>ワイヤによる境界面からの面作成</translation>
+ </message>
<message>
<source>GEOM_FACE_OPT</source>
<translation>平らなフェースを作成</translation>
</message>
+ <message>
+ <source>GEOM_FACE_FFWC</source>
+ <translation>ワイヤと拘束点からの面作成</translation>
+ </message>
+ <message>
+ <source>GEOM_CONSTRAINTS</source>
+ <translation>拘束</translation>
+ </message>
+ <message>
+ <source>GEOM_FACE_CONSTRAINT</source>
+ <translation>拘束面</translation>
+ </message>
+ <message>
+ <source>GEOM_SOLID_FROM_FACE_OPT</source>
+ <translation>形状の交差・縫合</translation>
+ </message>
<message>
<source>MAKE_FACE_TOLERANCE_TOO_BIG</source>
<translation>平坦な面を作成できません: 作成された顔があまりにも高い耐性</translation>
<source>GEOM_FREE_FACES</source>
<translation>フリーフェース</translation>
</message>
+ <message>
+ <source>GEOM_FREE_FACES_NAME</source>
+ <translation>Free_face</translation>
+ </message>
<message>
<source>GEOM_FREE_FACES_TITLE</source>
<translation>フリーフェース</translation>
<source>GEOM_GLUE_EDGES_TITLE</source>
<translation>エッジ固着</translation>
</message>
+ <message>
+ <source>GEOM_GLUE_EDGES_DETECT_TITLE</source>
+ <translation>一致エッジ検出</translation>
+ </message>
+ <message>
+ <source>GEOM_GLUE_FACES_DETECT_TITLE</source>
+ <translation>一致面検出</translation>
+ </message>
<message>
<source>GLUE_ERROR_STICKED_SHAPES</source>
<translation>公差の値が大きすぎます。「付着」図形の検出。</translation>
<translation>加工図</translation>
</message>
<message>
- <source>GEOM_PROJECTION</source>
- <translation>Projection</translation>
+ <source>GEOM_PROJECTION_ON_FACE</source>
+ <translation>面上の投影</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJECTION_ON_WIRE</source>
+ <translation>ワイヤ上の投影</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJECTION_ON_EDGE</source>
+ <translation>エッジ上の投影</translation>
</message>
<message>
<source>GEOM_PROJECTION_TITLE</source>
<translation>フェース上に投影</translation>
</message>
<message>
- <source>GEOM_SOURCE_OBJECT</source>
- <translation>基になるポイント、エッジ、またはワイヤー</translation>
+ <source>GEOM_PROJECTION_NAME</source>
+ <translation>Projection</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_FACE_SOURCE</source>
+ <translation>ソース頂点、エッジまたはワイヤ</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_FACE_TARGET</source>
+ <translation>ターゲット面</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_WIRE_SOURCE</source>
+ <translation>ソース頂点</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_WIRE_TARGET</source>
+ <translation>ターゲットワイヤ</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_EDGE_SOURCE</source>
+ <translation>ソース頂点</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_EDGE_TARGET</source>
+ <translation>ターゲットエッジ</translation>
</message>
<message>
<source>GEOM_SOLUTION</source>
<source>GEOM_SOLUTION_I</source>
<translation>%1 のソリューション</translation>
</message>
- <message>
- <source>GEOM_TARGET_OBJECT</source>
- <translation>目的面</translation>
- </message>
<message>
<source>GEOM_WITH_CONTACT</source>
<translation>接触している</translation>
<source>GEOM_LENGTH_VALUE</source>
<translation>長さで</translation>
</message>
+ <message>
+ <source>GEOM_TAKE_ORIENTATION_INTO_ACCOUNT</source>
+ <translation>エッジの方向に注意</translation>
+ </message>
<message>
<source>GEOM_PARTITION</source>
<translation>Partition</translation>
<source>GEOM_SELECT_UNPUBLISHED_EDGES</source>
<translation>非公開のエッジを選択</translation>
</message>
+ <message>
+ <source>GEOM_GENERATE_GROUPS</source>
+ <translation>グループの作成</translation>
+ </message>
+ <message>
+ <source>GEOM_GROUP_NAME_PREFIX</source>
+ <translation>グループ名Prefix</translation>
+ </message>
+ <message>
+ <source>GEOM_STEP_BY_STEP</source>
+ <translation>ステップ生成</translation>
+ </message>
<message>
<source>GEOM_PLANE</source>
<translation>Plane</translation>
</message>
<message>
<source>GEOM_PRP_EXPORT</source>
- <translation>ジオメトリを %1 にエクスポート</translation>
+ <translation>ジオメトリを %1 にエクスポート...</translation>
</message>
<message>
<source>GEOM_PRP_LOADING</source>
<source>GEOM_SELECTED_SHAPE</source>
<translation>選択した形状</translation>
</message>
+ <message>
+ <source>GEOM_SELECTED_SHAPES</source>
+ <translation>選択済み形状</translation>
+ </message>
<message>
<source>GEOM_SELECTION</source>
<translation>選択</translation>
<source>GEOM_SOLID_TITLE</source>
<translation>ソリッドの構築</translation>
</message>
+ <message>
+ <source>GEOM_SOLID_SHELLS</source>
+ <translation>シェルからソリッドの作成</translation>
+ </message>
+ <message>
+ <source>GEOM_SOLID_FACES</source>
+ <translation>接続された面、シェルからソリッド作成</translation>
+ </message>
<message>
<source>GEOM_SPHERE</source>
<translation>Sphere</translation>
<source>GEOM_WRN_FACES_NOT_SHELL</source>
<translation>シェルを作成できません。面の結合です。</translation>
</message>
+ <message>
+ <source>GEOM_WRN_FACES_NOT_FACE</source>
+ <translation>たった1つの面を作成することはできません。結果は複合面になります。</translation>
+ </message>
<message>
<source>WRN_SHAPE_UNCLOSED</source>
<translation>閉じていないオブジェクト %1 からソリッドを作成できません</translation>
<source>WRN_NULL_OBJECT_OR_SHAPE</source>
<translation>ソリッド作成のオブジェクト %1 が無効</translation>
</message>
+ <message>
+ <source>GROUP_DOWN</source>
+ <translation>下</translation>
+ </message>
+ <message>
+ <source>GROUP_UP</source>
+ <translation>上</translation>
+ </message>
+ <message>
+ <source>GROUP_SIDE1</source>
+ <translation>横1</translation>
+ </message>
+ <message>
+ <source>GROUP_SIDE2</source>
+ <translation>横2</translation>
+ </message>
+ <message>
+ <source>GROUP_OTHER</source>
+ <translation>その他</translation>
+ </message>
<message>
<source>GEOM_X</source>
<translation>X :</translation>
<source>MEN_CURVE_CREATOR</source>
<translation>カーブの作成</translation>
</message>
+ <message>
+ <source>TOP_CURVE_CREATOR</source>
+ <translation>2Dポリラインの作成</translation>
+ </message>
+ <message>
+ <source>STB_CURVE_CREATOR</source>
+ <translation>2Dポリラインの作成</translation>
+ </message>
<message>
<source>MEN_ALL_SEL_ONLY</source>
<translation>全選択</translation>
<source>MEN_CHECK_SELF_INTERSECTIONS</source>
<translation>自己交差の確認</translation>
</message>
+ <message>
+ <source>MEN_FAST_CHECK_INTERSECTIONS</source>
+ <translation>クイック交点</translation>
+ </message>
+ <message>
+ <source>MEN_SHAPE_STATISTICS</source>
+ <translation>形状の統計</translation>
+ </message>
<message>
<source>MEN_CHECK_FREE_BNDS</source>
<translation>自由境界の確認</translation>
</message>
<message>
<source>MEN_IMPORT</source>
- <translation>インポート</translation>
+ <translation>インポート...</translation>
</message>
<message>
<source>MEN_INERTIA</source>
<source>MEN_PROJECTION</source>
<translation>投影</translation>
</message>
+ <message>
+ <source>MEN_PROJ_ON_CYL</source>
+ <translation>円筒の投影</translation>
+ </message>
<message>
<source>MEN_OPERATIONS</source>
<translation>操作</translation>
<source>MEN_PIPE_PATH</source>
<translation>経路の復元</translation>
</message>
+ <message>
+ <source>MEN_THICKNESS</source>
+ <translation>厚み</translation>
+ </message>
<message>
<source>MEN_PLANE</source>
<translation>平面</translation>
</message>
<message>
<source>MEN_POP_VERTICES</source>
- <translation type="unfinished">Show Vertices</translation>
+ <translation>頂点の表示</translation>
+ </message>
+ <message>
+ <source>MEN_POP_SHOW_NAME</source>
+ <translation>名前の表示</translation>
</message>
<message>
<source>MEN_PREFERENCES</source>
<source>MEN_ISOLINE</source>
<translation>等高線</translation>
</message>
+ <message>
+ <source>MEN_SURFACE_FROM_FACE</source>
+ <translation>面から表面</translation>
+ </message>
<message>
<source>MEN_SOLID</source>
<translation>ソリッド</translation>
</message>
+ <message>
+ <source>MEN_SOLID_FROM_FACES</source>
+ <translation>接続された面からソリッド</translation>
+ </message>
<message>
<source>MEN_SOLID_SEL_ONLY</source>
<translation>ソリッド</translation>
</message>
<message>
<source>MEN_MATERIALS_LIBRARY</source>
- <translation>æ\9d\90æ\96\99ã\81®ç\89¹æ\80§</translation>
+ <translation>æ\9d\90æ\96\99ã\83©ã\82¤ã\83\96ã\83©ã\83ª</translation>
</message>
<message>
<source>MEN_TEXTURE</source>
</message>
<message>
<source>MEN_VERTICES_MODE_ON</source>
- <translation type="unfinished">Show Vertices</translation>
+ <translation>頂点の表示</translation>
</message>
<message>
<source>MEN_VERTICES_MODE_OFF</source>
- <translation type="unfinished">Hide Vertices</translation>
+ <translation>頂点の非表示</translation>
+ </message>
+ <message>
+ <source>MEN_NAME_MODE_ON</source>
+ <translation>名前の表示</translation>
+ </message>
+ <message>
+ <source>MEN_NAME_MODE_OFF</source>
+ <translation>名前の非表示</translation>
</message>
<message>
<source>MEN_WIREFRAME</source>
<source>MEN_POP_PREDEF_MATER_CUSTOM</source>
<translation>カスタム...</translation>
</message>
+ <message>
+ <source>MEN_EDGE_EXTEND</source>
+ <translation>拡張エッジ</translation>
+ </message>
+ <message>
+ <source>MEN_FACE_EXTEND</source>
+ <translation>拡張面</translation>
+ </message>
<message>
<source>NAME_LBL</source>
<translation>名前:</translation>
<translation>表示モード</translation>
</message>
<message>
- <source>PREF_TRANSPARENCY</source>
- <translation>透明度</translation>
+ <source>PREF_TRANSPARENCY</source>
+ <translation>透明度</translation>
</message>
<message>
<source>PREF_FREE_BOUND_COLOR</source>
<source>PREF_ISOS_COLOR</source>
<translation>輪郭の色</translation>
</message>
+ <message>
+ <source>PREF_LABEL_COLOR</source>
+ <translation>ラベルの色</translation>
+ </message>
<message>
<source>PREF_TOPLEVEL_COLOR</source>
<translation>前景オブジェクトの色</translation>
<translation>線幅</translation>
</message>
<message>
- <source>PREF_DIMENSIONS_FONT_HEIGHT</source>
- <translation>フォント高さ</translation>
+ <source>PREF_DIMENSIONS_FONT</source>
+ <translation>フォント</translation>
</message>
<message>
<source>PREF_DIMENSIONS_ARROW_LENGTH</source>
<source>PREF_DIMENSIONS_SHOW_UNITS</source>
<translation>測定単位の表示</translation>
</message>
+ <message>
+ <source>PREF_DIMENSIONS_USE_TEXT3D</source>
+ <translation>3Dテキストの使用</translation>
+ </message>
+ <message>
+ <source>PREF_HIDE_INPUT_OBJECT</source>
+ <translation>ビューワから入力したオブジェクトの非表示</translation>
+ </message>
<message>
<source>PREF_ISOS</source>
<translation>輪郭の数</translation>
</message>
<message>
<source>MATERIAL_LIBRARY_TLT</source>
- <translation>図書館資料</translation>
+ <translation>材料ライブラリ</translation>
</message>
<message>
<source>REMOVE_HOLES_NEW_OBJ_NAME</source>
<source>STB_CHECK_SELF_INTERSECTIONS</source>
<translation>自己交差の確認</translation>
</message>
+ <message>
+ <source>STB_FAST_CHECK_INTERSECTIONS</source>
+ <translation>クイック交点</translation>
+ </message>
+ <message>
+ <source>STB_SHAPE_STATISTICS</source>
+ <translation>形状の統計</translation>
+ </message>
<message>
<source>STB_CHECK_FREE_BNDS</source>
<translation>自由境界をチェック</translation>
<source>STB_PROJECTION</source>
<translation>ポイント、エッジ、または輪郭上の 1 つの側面を投影</translation>
</message>
+ <message>
+ <source>STB_PROJ_ON_CYL</source>
+ <translation>円筒上のワイヤまたは面を投影</translation>
+ </message>
<message>
<source>STB_ORIGIN_AND_VECTORS</source>
<translation>起源と基底ベクトルを作成します。</translation>
<source>STB_PIPE_PATH</source>
<translation>経路の復元</translation>
</message>
+ <message>
+ <source>STB_THICKNESS</source>
+ <translation>厚みのあるソリッドの作成</translation>
+ </message>
<message>
<source>STB_PLANE</source>
<translation>平面を作成</translation>
</message>
<message>
<source>STB_POP_VERTICES</source>
- <translation type="unfinished">Show Vertices</translation>
+ <translation>頂点の表示</translation>
+ </message>
+ <message>
+ <source>STB_POP_SHOW_NAME</source>
+ <translation>名前の表示</translation>
</message>
<message>
<source>STB_POP_SETTEXTURE</source>
<source>STB_VECTOR_MODE</source>
<translation>エッジの表示モードを変更</translation>
</message>
+ <message>
+ <source>STB_NAME_MODE</source>
+ <translation>表示中の形状の名前を表示/非表示</translation>
+ </message>
<message>
<source>STB_SHADING_COLOR</source>
<translation>網かけの色を設定</translation>
<source>STB_ISOLINE</source>
<translation>UまたはV方向等高線の作成</translation>
</message>
+ <message>
+ <source>STB_SURFACE_FROM_FACE</source>
+ <translation>面から表面の作成</translation>
+ </message>
<message>
<source>STB_SOLID</source>
<translation>ソリッドを構築</translation>
<source>TOP_CHECK_SELF_INTERSECTIONS</source>
<translation>自己交差の確認</translation>
</message>
+ <message>
+ <source>TOP_FAST_CHECK_INTERSECTIONS</source>
+ <translation>クイック交点</translation>
+ </message>
+ <message>
+ <source>TOP_SHAPE_STATISTICS</source>
+ <translation>形状の統計</translation>
+ </message>
<message>
<source>TOP_CHECK_FREE_BNDS</source>
<translation>自由境界を確認</translation>
<source>TOP_PROJECTION</source>
<translation>投影</translation>
</message>
+ <message>
+ <source>TOP_PROJ_ON_CYL</source>
+ <translation>円筒上に投影</translation>
+ </message>
<message>
<source>TOP_ORIGIN_AND_VECTORS</source>
<translation>起源と根拠のベクトルを作成します。</translation>
<source>TOP_PIPE_PATH</source>
<translation>経路の復元</translation>
</message>
+ <message>
+ <source>TOP_THICKNESS</source>
+ <translation>厚み</translation>
+ </message>
<message>
<source>TOP_PLANE</source>
<translation>平面を作成</translation>
<source>TOP_ISOLINE</source>
<translation>等高線</translation>
</message>
+ <message>
+ <source>TOP_SURFACE_FROM_FACE</source>
+ <translation>面から表面</translation>
+ </message>
<message>
<source>TOP_SOLID</source>
<translation>ソリッドを作成</translation>
</message>
<message>
<source>MEN_UNION_FACES</source>
- <translation>é\80£å\90\88ã\81«ç\9b´é\9d¢ã\81\97ã\81¦ã\81\84ã\81¾ã\81\99ã\80\82</translation>
+ <translation>é\9d¢ã\81®å\85±æ\9c\89</translation>
</message>
<message>
<source>STB_UNION_FACES</source>
<translation>連合に直面しています。</translation>
</message>
+ <message>
+ <source>TOP_INSPECT_OBJECT</source>
+ <translation>オブジェクトの点検</translation>
+ </message>
+ <message>
+ <source>MEN_INSPECT_OBJECT</source>
+ <translation>オブジェクトの点検</translation>
+ </message>
+ <message>
+ <source>STB_INSPECT_OBJECT</source>
+ <translation>オブジェクトの点検</translation>
+ </message>
<message>
<source>TOP_NORMALE</source>
<translation>フェースに垂直</translation>
<translation>オブジェクトの基準寸法を管理</translation>
</message>
<message>
- <source>MEN_POP_SHOW_DEPENDENCY_TREE</source>
- <translation type="unfinished">Show dependency tree</translation>
+ <source>MEN_POP_SHOW_DEPENDENCY_TREE</source>
+ <translation>依存ツリーの表示</translation>
</message>
<message>
- <source>MEN_POP_SHOW_REDUCE_STUDY</source>
- <translation type="unfinished">Reduce study</translation>
+ <source>MEN_POP_REDUCE_STUDY</source>
+ <translation>スタディの削減</translation>
</message>
<message>
<source>MEN_POP_SHOW_ALL_DIMENSIONS</source>
<source>GEOM_Z_I</source>
<translation>Z%1 :</translation>
</message>
+ <message>
+ <source>GEOM_A_I</source>
+ <translation>A%1 :</translation>
+ </message>
<message>
<source>GEOM_SHAPES_ON_SHAPE_TITLE</source>
<translation>オブジェクトの要素を見つける</translation>
<source>STB_GET_SHARED_SHAPES</source>
<translation>共有アイテムを取得</translation>
</message>
+ <message>
+ <source>TOP_TRANSFER_DATA</source>
+ <translation>データ転送</translation>
+ </message>
+ <message>
+ <source>MEN_TRANSFER_DATA</source>
+ <translation>データ転送</translation>
+ </message>
+ <message>
+ <source>STB_TRANSFER_DATA</source>
+ <translation>データ転送</translation>
+ </message>
+ <message>
+ <source>TOP_EXTENSION</source>
+ <translation>エッジまたは面の拡張</translation>
+ </message>
+ <message>
+ <source>MEN_EXTENSION</source>
+ <translation>拡張</translation>
+ </message>
+ <message>
+ <source>STB_EXTENSION</source>
+ <translation>エッジまたは面の拡張</translation>
+ </message>
<message>
<source>GEOM_PUBLISH_RESULT_GRP</source>
<translation>高度なオプション</translation>
<translation>プレビュー</translation>
</message>
<message>
- <source>PREF_TAB_DEPENDENCY_VIEW</source>
- <translation type="unfinished">Dependency Tree</translation>
+ <source>PREF_TAB_DEPENDENCY_VIEW</source>
+ <translation>依存ツリー</translation>
</message>
<message>
- <source>PREF_HIERARCHY_TYPE</source>
- <translation type="unfinished">Hierarchy type</translation>
+ <source>PREF_HIERARCHY_TYPE</source>
+ <translation>階層タイプ</translation>
</message>
<message>
- <source>MEN_ONLY_ASCENDANTS</source>
- <translation type="unfinished">Display only ascendants tree</translation>
+ <source>MEN_ONLY_ASCENDANTS</source>
+ <translation>ツリー上位のみ表示</translation>
</message>
<message>
- <source>MEN_ONLY_DESCENDANTS</source>
- <translation type="unfinished">Display only descendants tree</translation>
+ <source>MEN_ONLY_DESCENDANTS</source>
+ <translation>ツリー下位のみ表示</translation>
</message>
<message>
- <source>MEN_BOTH_ASCENDANTS_DESCENDANTS</source>
- <translation type="unfinished">Display both ascendants and descendants trees</translation>
+ <source>MEN_BOTH_ASCENDANTS_DESCENDANTS</source>
+ <translation>ツリー上位と下位の両方表示</translation>
</message>
<message>
- <source>GEOM_MOVE_POSSIBILITY</source>
- <translation type="unfinished">Possibility to move nodes</translation>
+ <source>GEOM_MOVE_POSSIBILITY</source>
+ <translation>ノード移動可能性</translation>
</message>
<message>
- <source>PREF_GROUP_DEPENDENCY_VIEW_COLOR</source>
- <translation type="unfinished">Color</translation>
+ <source>PREF_GROUP_DEPENDENCY_VIEW_COLOR</source>
+ <translation>色</translation>
</message>
<message>
- <source>PREF_DEPENDENCY_VIEW_BACKGROUND_COLOR</source>
- <translation type="unfinished">Background color</translation>
+ <source>PREF_DEPENDENCY_VIEW_BACKGROUND_COLOR</source>
+ <translation>背景色</translation>
</message>
<message>
- <source>PREF_DEPENDENCY_VIEW_NODE_COLOR</source>
- <translation type="unfinished">Default node color</translation>
+ <source>PREF_DEPENDENCY_VIEW_NODE_COLOR</source>
+ <translation>デフォルトノード色</translation>
</message>
<message>
- <source>PREF_DEPENDENCY_VIEW_MAIN_NODE_COLOR</source>
- <translation type="unfinished">Main node color</translation>
+ <source>PREF_DEPENDENCY_VIEW_MAIN_NODE_COLOR</source>
+ <translation>主ノード色</translation>
</message>
<message>
- <source>PREF_DEPENDENCY_VIEW_UNPUBLISH_NODE_COLOR</source>
- <translation type="unfinished">Unpublished node color</translation>
+ <source>PREF_DEPENDENCY_VIEW_UNPUBLISH_NODE_COLOR</source>
+ <translation>非公開ノード色</translation>
</message>
<message>
- <source>PREF_DEPENDENCY_VIEW_SELECT_NODE_COLOR</source>
- <translation type="unfinished">Selected node color</translation>
+ <source>PREF_DEPENDENCY_VIEW_SELECT_NODE_COLOR</source>
+ <translation>選択ノード色</translation>
</message>
<message>
- <source>PREF_DEPENDENCY_VIEW_ARROW_COLOR</source>
- <translation type="unfinished">Arrow color</translation>
+ <source>PREF_DEPENDENCY_VIEW_ARROW_COLOR</source>
+ <translation>デフォルト矢印色</translation>
</message>
<message>
- <source>PREF_DEPENDENCY_VIEW_HIGHLIGHT_ARROW_COLOR</source>
- <translation type="unfinished">Highlighted arrow color</translation>
+ <source>PREF_DEPENDENCY_VIEW_HIGHLIGHT_ARROW_COLOR</source>
+ <translation>ハイライト矢印色</translation>
</message>
<message>
- <source>PREF_DEPENDENCY_VIEW_SELECT_ARROW_COLOR</source>
- <translation type="unfinished">Selected arrow color</translation>
+ <source>PREF_DEPENDENCY_VIEW_SELECT_ARROW_COLOR</source>
+ <translation>選択矢印色</translation>
</message>
<message>
<source>GEOM_ALL_IMPORT_FILES</source>
<source>CC_PNT_ITEM_X_Y_Z</source>
<translation>X=%1, Y=%2, Z=%3</translation>
</message>
+ <message>
+ <source>GEOM_FILTER</source>
+ <translation>フィルタ</translation>
+ </message>
+ <message>
+ <source>GEOM_LESS_THAN</source>
+ <translation>未満</translation>
+ </message>
+ <message>
+ <source>GEOM_LESSOREQUAL_THAN</source>
+ <translation>以下</translation>
+ </message>
+ <message>
+ <source>GEOM_GREAT_THAN</source>
+ <translation>超える</translation>
+ </message>
+ <message>
+ <source>GEOM_GREATOREQUAL_THAN</source>
+ <translation>以上</translation>
+ </message>
+ <message>
+ <source>GEOM_SOME_SHAPES_SELECTED</source>
+ <translation>%1 個選択済み</translation>
+ </message>
+ <message>
+ <source>GEOM_NO_SHAPES_SELECTED</source>
+ <translation>フィルタリングパラメータに適合する形状はありません</translation>
+ </message>
+ <message>
+ <source>GEOM_HEALING_STATS_TITLE</source>
+ <translation>行われた変更</translation>
+ </message>
+ <message>
+ <source>GEOM_HEALING_STATS_COL_1</source>
+ <translation>カウント</translation>
+ </message>
+ <message>
+ <source>GEOM_HEALING_STATS_COL_2</source>
+ <translation>修正</translation>
+ </message>
+ <message>
+ <source>GEOM_PLOT_DISTRIBUTION</source>
+ <translation>Plot</translation>
+ </message>
+ <message>
+ <source>GEOM_X_AXIS</source>
+ <translation>X軸</translation>
+ </message>
+ <message>
+ <source>GEOM_Y_AXIS</source>
+ <translation>Y軸</translation>
+ </message>
+ <message>
+ <source>GEOM_Z_AXIS</source>
+ <translation>Z軸</translation>
+ </message>
+ <message>
+ <source>GEOM_DIM_AXES</source>
+ <translation>局所座標軸に沿った次元</translation>
+ </message>
</context>
<context>
<name>GeometryGUI</name>
<message>
<source>TOOL_BASIC</source>
- <translation>基礎オブジェクト</translation>
+ <translation>基本</translation>
</message>
<message>
<source>TOOL_BLOCKS</source>
- <translation>ブロック分割</translation>
+ <translation>ブロック</translation>
</message>
<message>
<source>TOOL_BOOLEAN</source>
- <translation>ã\83\96ã\83¼ã\83ªã\82¢ã\83³æ\93\8dä½\9c</translation>
+ <translation>ã\83\96ã\83¼ã\83ªã\82¢ã\83³æ¼\94ç®\97</translation>
</message>
<message>
<source>TOOL_FEATURES</source>
- <translation>フィーチャー</translation>
+ <translation>修正</translation>
</message>
<message>
<source>TOOL_GENERATION</source>
- <translation>押し出し/回転</translation>
+ <translation>作成</translation>
</message>
<message>
<source>TOOL_PRIMITIVES</source>
- <translation>基本図形</translation>
+ <translation>プリミティブ</translation>
</message>
<message>
<source>TOOL_TRANSFORMATION</source>
- <translation>変形/移動/回転</translation>
+ <translation>変形</translation>
</message>
<message>
<source>TOOL_BUILD</source>
</message>
<message>
<source>TOOL_ADVANCED</source>
- <translation>高度なツール</translation>
+ <translation>上級</translation>
</message>
<message>
<source>TOOL_MEASURES</source>
- <translation>æ\83\85å ±/測å®\9a</translation>
+ <translation>測定</translation>
</message>
<message>
<source>TOOL_IMPORTEXPORT</source>
- <translation>インポート/エクスポート</translation>
+ <translation>インポート / エクスポート XAO</translation>
</message>
</context>
<context>
<translation>フェース 2 V</translation>
</message>
</context>
- <context>
- <name>CurveCreator_NewPointDlg</name>
- <message>
- <source>ADD_NEW_POINT</source>
- <translation>新しい点の追加</translation>
- </message>
- <message>
- <source>X_COORD</source>
- <translation>X</translation>
- </message>
- <message>
- <source>Y_COORD</source>
- <translation>Y</translation>
- </message>
- <message>
- <source>Z_COORD</source>
- <translation>Z</translation>
- </message>
- <message>
- <source>ADD_BTN</source>
- <translation>追加</translation>
- </message>
- <message>
- <source>ADD_CONTINUE_BTN</source>
- <translation>追加して継続</translation>
- </message>
- <message>
- <source>ADD_NEW_POINT_TO_%1</source>
- <translation>新しい点を%1に追加</translation>
- </message>
- <message>
- <source>SET_POINT_COORDINATES</source>
- <translation>点座標の設定</translation>
- </message>
- </context>
<context>
<name>CurveCreator_NewSectionDlg</name>
<message>
- <source>NAME</source>
+ <source>SECTION_NAME</source>
<translation>名前</translation>
</message>
<message>
- <source>LINE_TYPE</source>
- <translation>ã\83©ã\82¤ã\83³</translation>
+ <source>SECTION_LINE_TYPE</source>
+ <translation>ã\82¿ã\82¤ã\83\97</translation>
</message>
<message>
- <source>POLYLINE_TYPE</source>
+ <source>SECTION_POLYLINE_TYPE</source>
<translation>ポリライン</translation>
</message>
<message>
- <source>SPLINE_TYPE</source>
+ <source>SECTION_SPLINE_TYPE</source>
<translation>スプライン</translation>
</message>
<message>
- <source>LINE_CLOSED</source>
+ <source>SECTION_LINE_CLOSED</source>
<translation>閉じたライン</translation>
</message>
<message>
- <source>OK</source>
- <translation>Ok</translation>
+ <source>SECTION_ADD_BTN</source>
+ <translation>追加</translation>
</message>
<message>
- <source>ADD_BTN</source>
- <translation>追加</translation>
+ <source>SECTION_OK_BTN</source>
+ <translation>Ok</translation>
</message>
<message>
- <source>ADD_CONTINUE_BTN</source>
- <translation>追加して継続</translation>
+ <source>SECTION_CANCEL_BTN</source>
+ <translation>キャンセル</translation>
</message>
<message>
<source>ADD_NEW_SECTION</source>
</message>
</context>
<context>
- <name>CurveCreator_Widget</name>
+ <name>CurveCreator_TableView</name>
+ <message>
+ <source>TABLE_SECTION</source>
+ <translation>Section</translation>
+ </message>
<message>
- <source>CURVE_NAME_TLT</source>
- <translation>カーブの名前</translation>
+ <source>TABLE_INDEX</source>
+ <translation>Index</translation>
</message>
<message>
- <source>SECTION_GROUP_TLT</source>
- <translation>断面グループ</translation>
+ <source>TABLE_X</source>
+ <translation>X</translation>
+ </message>
+ <message>
+ <source>TABLE_Y</source>
+ <translation>Y</translation>
+ </message>
+ </context>
+ <context>
+ <name>CurveCreator_Widget</name>
+ <message>
+ <source>SECTION_GROUP_TITLE</source>
+ <translation>断面</translation>
</message>
<message>
<source>UNDO</source>
<source>NEW_SECTION_TLT</source>
<translation>新しい断面の挿入</translation>
</message>
- <message>
- <source>INSERT_SECTION_BEFORE</source>
- <translation>前に断面を挿入</translation>
- </message>
- <message>
- <source>INSERT_SECTION_BEFORE_TLT</source>
- <translation>前に断面を挿入</translation>
- </message>
- <message>
- <source>INSERT_SECTION_AFTER</source>
- <translation>後に断面の挿入</translation>
- </message>
- <message>
- <source>INSERT_SECTION_AFTER_TLT</source>
- <translation>後に断面の挿入</translation>
- </message>
<message>
<source>ADDITION_MODE</source>
<translation>追加モード</translation>
<source>DETECTION_MODE_TLT</source>
<translation>検出モード</translation>
</message>
- <message>
- <source>INSERT_POINT_BEFORE</source>
- <translation>前に点の挿入</translation>
- </message>
- <message>
- <source>INSERT_POINT_BEFORE_TLT</source>
- <translation>前に点の挿入</translation>
- </message>
- <message>
- <source>INSERT_POINT_AFTER</source>
- <translation>後に点の挿入</translation>
- </message>
<message>
<source>CLOSE_SECTIONS</source>
<translation>断面を閉じる</translation>
<source>JOIN_TLT</source>
<translation>選択した断面を結合</translation>
</message>
- <message>
- <source>STEP_UP</source>
- <translation>上昇</translation>
- </message>
- <message>
- <source>STEP_UP_TLT</source>
- <translation>選択したオブジェクトを上昇</translation>
- </message>
- <message>
- <source>STEP_DOWN</source>
- <translation>下降</translation>
- </message>
- <message>
- <source>STEP_DOWN_TLT</source>
- <translation>選択したオブジェクトを下降</translation>
- </message>
<message>
<source>CLEAR_ALL</source>
<translation>すべて消去</translation>
<translation>すべての断面を結合</translation>
</message>
</context>
+ <context>
+ <name>EntityGUI_PolylineDlg</name>
+ <message>
+ <source>POLYLINE_DLG_TITLE</source>
+ <translation>ポリラインの構築</translation>
+ </message>
+ <message>
+ <source>POLYLINE_TITLE</source>
+ <translation>ポリライン</translation>
+ </message>
+ <message>
+ <source>POLYLINE_NAME</source>
+ <translation>Polyline</translation>
+ </message>
+ <message>
+ <source>POLYLINE_IMPORT</source>
+ <translation>ポリラインのインポート</translation>
+ </message>
+ <message>
+ <source>POLYLINE_ADD_SECTION</source>
+ <translation>断面の追加</translation>
+ </message>
+ <message>
+ <source>POLYLINE_EDIT_SECTION</source>
+ <translation>断面の編集</translation>
+ </message>
+ </context>
<context>
<name>EntityGUI_SketcherDlg</name>
<message>
<source>GEOM_ADD_THICKNESS</source>
<translation>厚み追加(エッジまたはワイヤーのみ)</translation>
</message>
- <message>
- <source>GEOM_TOWARDS_INSIDE</source>
- <translation>内側に向かって厚く</translation>
- </message>
</context>
<context>
<name>GroupGUI</name>
<source>TIME_CONSUMING</source>
<translation>このオプションを有効にすると、特定のオブジェクトを時間の無駄が可能性があります。続行しますか。</translation>
</message>
+ <message>
+ <source>WIDTH_FACTOR_TOL</source>
+ <translation>Width factor tol.</translation>
+ </message>
+ <message>
+ <source>VOLUME_TOL</source>
+ <translation>Volume tol.</translation>
+ </message>
+ <message>
+ <source>TO_MERGE_SOLIDS</source>
+ <translation>ソリッドのマージ 用</translation>
+ </message>
+ <message>
+ <source>SELECT_ALL</source>
+ <translation>すべて選択</translation>
+ </message>
</context>
<context>
<name>GEOMToolsGUI_DeleteDlg</name>
<source>GEOM_SHARED_SHAPE</source>
<translation>Shared_%1</translation>
</message>
+ <message>
+ <source>GEOM_SHARED_SHAPES_MULTISHARE</source>
+ <translation>すべてが共有する</translation>
+ </message>
</context>
<context>
<name>GEOMToolsGUI_PublishDlg</name>
<context>
<name>GEOMToolsGUI_ReduceStudyDlg</name>
<message>
- <source>GEOM_REDUCE_STUDY_TITLE</source>
- <translation type="unfinished">Reduce study</translation>
+ <source>GEOM_REDUCE_STUDY_TITLE</source>
+ <translation>スタディの削減</translation>
</message>
<message>
- <source>GEOM_REDUCE_STUDY_KEPT_OBJECTS</source>
- <translation type="unfinished">Objects to be kept</translation>
+ <source>GEOM_REDUCE_STUDY_KEPT_OBJECTS</source>
+ <translation>保持されたオブジェクト</translation>
</message>
<message>
- <source>GEOM_REDUCE_STUDY_REMOVE_OBJECTS</source>
- <translation type="unfinished">Objects to be removed</translation>
+ <source>GEOM_REDUCE_STUDY_REMOVE_OBJECTS</source>
+ <translation>削除されたオブジェクト</translation>
</message>
<message>
- <source>GEOM_REDUCE_STUDY_NAME</source>
- <translation type="unfinished">Name</translation>
+ <source>GEOM_REDUCE_STUDY_NAME</source>
+ <translation>Name</translation>
</message>
<message>
- <source>GEOM_REDUCE_STUDY_OPTIONS</source>
- <translation type="unfinished">Options</translation>
+ <source>GEOM_REDUCE_STUDY_OPTIONS</source>
+ <translation>オプション</translation>
</message>
<message>
- <source>GEOM_REDUCE_STUDY_INTERMEDIATES</source>
- <translation type="unfinished">Intermediate objects</translation>
+ <source>GEOM_REDUCE_STUDY_INTERMEDIATES</source>
+ <translation>中間オブジェクト</translation>
</message>
<message>
- <source>GEOM_REDUCE_STUDY_SUB_OBJECTS</source>
- <translation type="unfinished">Sub-objects</translation>
+ <source>GEOM_REDUCE_STUDY_SUB_OBJECTS</source>
+ <translation>サブオブジェクト</translation>
</message>
<message>
- <source>GEOM_REDUCE_STUDY_KEEP</source>
- <translation type="unfinished">Keep</translation>
+ <source>GEOM_REDUCE_STUDY_KEEP</source>
+ <translation>保持</translation>
</message>
<message>
- <source>GEOM_REDUCE_STUDY_UNPUBLISH</source>
- <translation type="unfinished">Unpublish</translation>
+ <source>GEOM_REDUCE_STUDY_UNPUBLISH</source>
+ <translation>非公開</translation>
</message>
<message>
- <source>GEOM_REDUCE_STUDY_REMOVE</source>
- <translation type="unfinished">Remove</translation>
+ <source>GEOM_REDUCE_STUDY_REMOVE</source>
+ <translation>削除</translation>
</message>
<message>
- <source>GEOM_REDUCE_STUDY_REMOVE_EMPTY_FOLDER</source>
- <translation type="unfinished">Remove empty folders</translation>
+ <source>GEOM_REDUCE_STUDY_REMOVE_EMPTY_FOLDER</source>
+ <translation>空フォルダの削除</translation>
</message>
<message>
- <source>GEOM_REDUCE_STUDY_SOFT_REMOVAL</source>
- <translation type="unfinished">Soft removal</translation>
+ <source>GEOM_REDUCE_STUDY_SOFT_REMOVAL</source>
+ <translation>ソフト除去</translation>
</message>
<message>
- <source>GEOM_REDUCE_STUDY_WARNING_DELETE</source>
- <translation type="unfinished">Do you really want to delete intermediate objects? After applying this operation study will be broken.</translation>
+ <source>GEOM_REDUCE_STUDY_WARNING_DELETE</source>
+ <translation>本当に中間オブジェクトを削除しますか? この操作の適用後、スタディは無くなります。</translation>
</message>
</context>
<context>
<translation>UnionFaces</translation>
</message>
</context>
+ <context>
+ <name>RepairGUI_InspectObjectDlg</name>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_TITLE</source>
+ <translation>オブジェクト点検</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_MAIN_SHAPE</source>
+ <translation>主形状</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_SHOW</source>
+ <translation>選択を表示</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_SHOW_ONLY</source>
+ <translation>選択のみを表示</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_HIDE</source>
+ <translation>選択を非表示</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_PUBLISH</source>
+ <translation>選択を公開</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_NAME</source>
+ <translation>名前</translation>
+ </message>
+ </context>
<context>
<name>GEOMGUI_CreationInfoWdg</name>
<message>
<translation>(有効情報なし)</translation>
</message>
</context>
+ <context>
+ <name>GEOMGUI_TextTreeWdg</name>
+ <message>
+ <source>TEXT_TREE_VIEW_TITLE</source>
+ <translation>テキスト</translation>
+ </message>
+ <message>
+ <source>TEXT_TREE_VIEW_NAME</source>
+ <translation>名前</translation>
+ </message>
+ </context>
<context>
<name>EntityGUI_IsolineDlg</name>
<message>
<translation>V-Isoline</translation>
</message>
</context>
+ <context>
+ <name>MeasureGUI_CheckSelfIntersectionsDlg</name>
+ <message>
+ <source>GEOM_CHECK_INTERSECT_TYPE</source>
+ <translation>自己交差検出型</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_INTERSECTIONS</source>
+ <translation>自己交差</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_SUBSHAPES</source>
+ <translation>サブ形状</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_CHECK_LEVEL</source>
+ <translation>チェックのレベル</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_SUMMARY</source>
+ <translation>サマリ</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_COMPUTE</source>
+ <translation>自己交差の計算</translation>
+ </message>
+ <message>
+ <source>GEOM_SELF_INTERSECTION_NAME</source>
+ <translation>自己交差</translation>
+ </message>
+ <message>
+ <source>GEOM_NO_SELF_INTERSECTIONS</source>
+ <translation>形状内に自己交差はありません。</translation>
+ </message>
+ <message>
+ <source>GEOM_SELF_INTERSECTIONS_FOUND</source>
+ <translation>いくつかの自己交差が検出されました</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_SELF_INTERSECTIONS_FAILED</source>
+ <translation>自己交差の検出に失敗しました</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_SELF_INTERSECTIONS_ERRORS</source>
+ <translation>警告: 操作中にエラーが発生したため、リストは完成されません。</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_V_V</source>
+ <translation>頂点から頂点</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_V_E</source>
+ <translation>頂点からエッジ と上記すべて</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_E_E</source>
+ <translation>エッジからエッジと上記すべて</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_V_F</source>
+ <translation>頂点から面と上記すべて</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_E_F</source>
+ <translation>エッジから面と上記すべて</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INTE_ALL</source>
+ <translation>面から面と上記すべて</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INT_DEFLECT</source>
+ <translation>偏向係数</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INT_DETECT_GAPS</source>
+ <translation>トレランスとのギャップ検出</translation>
+ </message>
+ </context>
+ <context>
+ <name>MeasureGUI_FastCheckIntersectionsDlg</name>
+ <message>
+ <source>GEOM_FAST_CHECK_INT_DEFLECT</source>
+ <translation>たわみ係数</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_CHECK_INT_DETECT_GAPS</source>
+ <translation>トレランスによるギャップ検出</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_CHECK_INT_SUBSHAPES</source>
+ <translation>オブジェクト %1 のサブ形状:</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_CHECK_INT_COMPUTE</source>
+ <translation>交点の計算</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_INTERSECTION_NAME</source>
+ <translation>クイック交点</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_INTERSECTION_FAILS</source>
+ <translation>交点はない</translation>
+ </message>
+ <message>
+ <source>GEOM_FAST_CHECK_OBJ</source>
+ <translation>オブジェクトと結果</translation>
+ </message>
+ </context>
+ <context>
+ <name>MeasureGUI_ShapeStatisticsDlg</name>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_TYPE</source>
+ <translation>タイプ</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_LENGTH</source>
+ <translation>エッジ長さ</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_AREA</source>
+ <translation>面の面積</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_VOLUME</source>
+ <translation>ソリッドの体積</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_NB_INTERVALS</source>
+ <translation>間隔数</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_SCALAR_RANGE</source>
+ <translation>スカラ範囲</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_COMPUTE</source>
+ <translation>計算</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN</source>
+ <translation>Min</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MAX</source>
+ <translation>Max</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_CREATE_GROUPS</source>
+ <translation>グループの作成</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_DISTRIBUTION_NB_ENT</source>
+ <translation>エンティティ数</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN_ERROR</source>
+ <translation>範囲内最小の値をセットするかスカラ範囲のスイッチをOFFにしてください。</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MAX_ERROR</source>
+ <translation>範囲内最大の値をセットするかスカラ範囲のスイッチをOFFにしてください。</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR</source>
+ <translation>範囲内最小値が最大値より大きくすることはできません</translation>
+ </message>
+ <message>
+ <source>GEOM_MSG_GROUPS_CREATED</source>
+ <translation>%1 グループを作成しました。</translation>
+ </message>
+ </context>
+ <context>
+ <name>TransformationGUI_ExtensionDlg</name>
+ <message>
+ <source>GEOM_EXTENSION_TITLE</source>
+ <translation>エッジまたは面の拡張</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION</source>
+ <translation>拡張</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MIN</source>
+ <translation>第1パラメータ</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MAX</source>
+ <translation>最後のパラメータ</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MIN_U</source>
+ <translation>第1U-パラメータ</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MAX_U</source>
+ <translation>最後のU-パラメータ</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MIN_V</source>
+ <translation>第1V-パラメータ</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_MAX_V</source>
+ <translation>最後のV-パラメータ</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_EDGE_NAME</source>
+ <translation>ExtendedEdge</translation>
+ </message>
+ <message>
+ <source>GEOM_EXTENSION_FACE_NAME</source>
+ <translation>拡張面</translation>
+ </message>
+ </context>
+ <context>
+ <name>EntityGUI_SurfFromFaceDlg</name>
+ <message>
+ <source>GEOM_SURF_FROM_FACE_TITLE</source>
+ <translation>面から表面の作成</translation>
+ </message>
+ <message>
+ <source>GEOM_SURF_FROM_FACE</source>
+ <translation>面から表面</translation>
+ </message>
+ <message>
+ <source>GEOM_SURF_FROM_FACE_NAME</source>
+ <translation>SurfaceFromFace</translation>
+ </message>
+ </context>
+ <context>
+ <name>OperationGUI_TransferDataDlg</name>
+ <message>
+ <source>GEOM_TRANSFER_DATA_TITLE</source>
+ <translation>データ転送</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA</source>
+ <translation>データ転送</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_FROM</source>
+ <translation>ソース形状</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_TO</source>
+ <translation>行き先形状</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_METHOD</source>
+ <translation>検出操作のタイプ</translation>
+ </message>
+ <message>
+ <source>GEOM_TD_METHOD_GETINPLACE</source>
+ <translation>場所の中で取得</translation>
+ </message>
+ <message>
+ <source>GEOM_TD_METHOD_GETINPLACE_OLD</source>
+ <translation>場所(旧)の中で取得</translation>
+ </message>
+ <message>
+ <source>GEOM_TD_METHOD_GETINPLACE_HISTORY</source>
+ <translation>履歴より場所の中で取得</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_INFO</source>
+ <translation>データ転送: 情報</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_NOT_COPIED</source>
+ <translation>コピーされたものはありません。</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_COPIED</source>
+ <translation>以下のデータがコピーされます:</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_NAMES</source>
+ <translation>名前: %2 の %1</translation>
+ </message>
+ <message>
+ <source>GEOM_TRANSFER_DATA_MATERIALS</source>
+ <translation>材料: %2 の %1</translation>
+ </message>
+ </context>
+ <context>
+ <name>TransformationGUI_ProjectionOnCylDlg</name>
+ <message>
+ <source>GEOM_PROJ_ON_CYL_TITLE</source>
+ <translation>円筒上に投影</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_CYL_START_ANGLE</source>
+ <translation>Starting angle</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_CYL_LENGTH_ANGLE</source>
+ <translation>Length angle</translation>
+ </message>
+ <message>
+ <source>GEOM_PROJ_ON_CYL_ROTATION_ANGLE</source>
+ <translation>回転角度</translation>
+ </message>
+ </context>
</TS>
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GEOMGUI_OCCSelector.h"
#include "GEOMGUI_Selection.h"
#include "GEOMGUI_CreationInfoWdg.h"
+#include "GEOMGUI_TextTreeWdg.h"
#include "GEOMGUI_DimensionProperty.h"
#include "GEOM_Constants.h"
#include "GEOM_Displayer.h"
#include <SUIT_Session.h>
#include <SUIT_ViewManager.h>
-#include <PyInterp_Interp.h>
-
#include <OCCViewer_ViewWindow.h>
#include <OCCViewer_ViewPort3d.h>
#include <OCCViewer_ViewModel.h>
#include <SVTK_InteractorStyle.h>
#include <SVTK_ViewModel.h>
+#ifndef DISABLE_GRAPHICSVIEW
#include <GraphicsView_Viewer.h>
+#endif
#include <SalomeApp_Application.h>
#include <SalomeApp_DataObject.h>
#include <SALOMEDS_SObject.hxx>
#include <Basics_OCCTVersion.hxx>
+#include <QtxFontEdit.h>
// External includes
#include <QDir>
#include <QString>
#include <QPainter>
#include <QSignalMapper>
+#include <QFontDatabase>
-#include <AIS_Drawer.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Prs3d_Drawer.hxx>
#include <NCollection_DataMap.hxx>
#include <TColStd_HArray1OfByte.hxx>
+#include <TColStd_SequenceOfHAsciiString.hxx>
#include <utilities.h>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx>
+#include <Font_SystemFont.hxx>
+#include <Font_FontMgr.hxx>
+#include <TCollection_HAsciiString.hxx>
+
#include "GEOM_version.h"
#include "GEOMImpl_Types.hxx" // dangerous hxx (defines short-name macros) - include after all
myLocalSelectionMode = GEOM_ALLOBJECTS;
myCreationInfoWdg = 0;
+ myTextTreeWdg = 0;
connect( Material_ResourceMgr::resourceMgr(), SIGNAL( changed() ), this, SLOT( updateMaterials() ) );
SUIT_ViewWindow* window = desk->activeWindow();
bool ViewOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
bool ViewVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
+#ifndef DISABLE_GRAPHICSVIEW
bool ViewDep = ( window && window->getViewManager()->getType() == GraphicsView_Viewer::Type() );
+#else
+ bool ViewDep = 0;
+#endif
// if current viewframe is not of OCC and not of VTK type - return immediately
// fix for IPAL8958 - allow some commands to execute even when NO viewer is active (rename for example)
QList<int> NotViewerDependentCommands;
case GEOMOp::OpSelectCompound: // POPUP MENU - SELECT ONLY - COMPOUND
case GEOMOp::OpSelectAll: // POPUP MENU - SELECT ONLY - SELECT ALL
case GEOMOp::OpDelete: // MENU EDIT - DELETE
+#ifndef DISABLE_PYCONSOLE
case GEOMOp::OpCheckGeom: // MENU TOOLS - CHECK GEOMETRY
+#endif
case GEOMOp::OpMaterialsLibrary: // MENU TOOLS - MATERIALS LIBRARY
case GEOMOp::OpDeflection: // POPUP MENU - DEFLECTION COEFFICIENT
case GEOMOp::OpColor: // POPUP MENU - COLOR
case GEOMOp::OpClsBringToFront: //
case GEOMOp::OpCreateFolder: // POPUP MENU - CREATE FOLDER
case GEOMOp::OpSortChildren: // POPUP MENU - SORT CHILD ITEMS
+#ifndef DISABLE_GRAPHICSVIEW
case GEOMOp::OpShowDependencyTree: // POPUP MENU - SHOW DEPENDENCY TREE
+#endif
case GEOMOp::OpReduceStudy: // POPUP MENU - REDUCE STUDY
libName = "GEOMToolsGUI";
break;
case GEOMOp::OpShow: // MENU VIEW - DISPLAY
case GEOMOp::OpSwitchVectors: // MENU VIEW - VECTOR MODE
case GEOMOp::OpSwitchVertices: // MENU VIEW - VERTICES MODE
+ case GEOMOp::OpSwitchName: // MENU VIEW - VERTICES MODE
case GEOMOp::OpWireframe: // POPUP MENU - WIREFRAME
case GEOMOp::OpShading: // POPUP MENU - SHADING
case GEOMOp::OpShadingWithEdges: // POPUP MENU - SHADING WITH EDGES
case GEOMOp::OpTexture: // POPUP MENU - TEXTURE
case GEOMOp::OpVectors: // POPUP MENU - VECTORS
case GEOMOp::OpVertices: // POPUP MENU - VERTICES
+ case GEOMOp::OpShowName: // POPUP MENU - SHOW NAME
libName = "DisplayGUI";
break;
case GEOMOp::OpPoint: // MENU BASIC - POINT
case GEOMOp::OpFilling: // MENU GENERATION - FILLING
case GEOMOp::OpPipe: // MENU GENERATION - PIPE
case GEOMOp::OpPipePath: // MENU GENERATION - RESTORE PATH
+ case GEOMOp::OpThickness: // MENU GENERATION - THICKNESS
libName = "GenerationGUI";
break;
case GEOMOp::Op2dSketcher: // MENU ENTITY - SKETCHER
case GEOMOp::Op3dSketcher: // MENU ENTITY - 3D SKETCHER
case GEOMOp::OpIsoline: // MENU BASIC - ISOLINE
case GEOMOp::OpExplode: // MENU ENTITY - EXPLODE
+ case GEOMOp::OpSurfaceFromFace: // MENU ENTITY - SURFACE FROM FACE
#ifdef WITH_OPENCV
case GEOMOp::OpFeatureDetect: // MENU ENTITY - FEATURE DETECTION
#endif
case GEOMOp::OpScale: // MENU TRANSFORMATION - SCALE
case GEOMOp::OpOffset: // MENU TRANSFORMATION - OFFSET
case GEOMOp::OpProjection: // MENU TRANSFORMATION - PROJECTION
+ case GEOMOp::OpProjOnCyl: // MENU TRANSFORMATION - PROJECTION ON CYLINDER
case GEOMOp::OpMultiTranslate: // MENU TRANSFORMATION - MULTI-TRANSLATION
case GEOMOp::OpMultiRotate: // MENU TRANSFORMATION - MULTI-ROTATION
case GEOMOp::OpReimport: // CONTEXT(POPUP) MENU - RELOAD_IMPORTED
+ case GEOMOp::OpExtension: // MENU TRANSFORMATION - EXTENSION
libName = "TransformationGUI";
break;
case GEOMOp::OpPartition: // MENU OPERATION - PARTITION
case GEOMOp::OpSharedShapes: // MENU OPERATION - GET SHARED SHAPES
case GEOMOp::OpExtrudedBoss: // MENU OPERATION - EXTRUDED BOSS
case GEOMOp::OpExtrudedCut: // MENU OPERATION - EXTRUDED CUT
+ case GEOMOp::OpTransferData: // MENU OPERATION - TRANSFER DATA
libName = "OperationGUI";
break;
case GEOMOp::OpSewing: // MENU REPAIR - SEWING
case GEOMOp::OpRemoveExtraEdges: // MENU REPAIR - REMOVE EXTRA EDGES
case GEOMOp::OpFuseEdges: // MENU REPAIR - FUSE COLLINEAR EDGES
case GEOMOp::OpUnionFaces: // MENU REPAIR - UNION FACES
+ case GEOMOp::OpInspectObj: // MENU REPAIR - INSPECT OBJECT
libName = "RepairGUI";
break;
case GEOMOp::OpProperties: // MENU MEASURE - PROPERTIES
case GEOMOp::OpGetNonBlocks: // MENU MEASURE - Get NON BLOCKS
case GEOMOp::OpPointCoordinates: // MENU MEASURE - POINT COORDINATES
case GEOMOp::OpCheckSelfInters: // MENU MEASURE - CHECK SELF INTERSECTIONS
+ case GEOMOp::OpFastCheckInters: // MENU MEASURE - FAST CHECK INTERSECTIONS
case GEOMOp::OpManageDimensions: // MENU MEASURE - MANAGE DIMENSIONS
+#ifndef DISABLE_PLOT2DVIEWER
+ case GEOMOp::OpShapeStatistics: // MENU MEASURE - SHAPE STATISTICS
+#endif
case GEOMOp::OpShowAllDimensions: // POPUP MENU - SHOW ALL DIMENSIONS
case GEOMOp::OpHideAllDimensions: // POPUP MENU - HIDE ALL DIMENSIONS
libName = "MeasureGUI";
GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOX, "OX" );
GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOY, "OY" );
GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOZ, "OZ" );
+ anOrigin->UnRegister();
+ anOX->UnRegister();
+ anOY->UnRegister();
+ anOZ->UnRegister();
+ aBasicOperations->UnRegister();
getApp()->updateObjectBrowser( true );
}
createGeomAction( GEOMOp::OpPlane, "PLANE" );
createGeomAction( GEOMOp::OpLCS, "LOCAL_CS" );
createGeomAction( GEOMOp::OpOriginAndVectors, "ORIGIN_AND_VECTORS" );
+ createGeomAction( GEOMOp::OpSurfaceFromFace, "SURFACE_FROM_FACE" );
createGeomAction( GEOMOp::OpBox, "BOX" );
createGeomAction( GEOMOp::OpCylinder, "CYLINDER" );
createGeomAction( GEOMOp::OpFilling, "FILLING" );
createGeomAction( GEOMOp::OpPipe, "PIPE" );
createGeomAction( GEOMOp::OpPipePath, "PIPE_PATH" );
+ createGeomAction( GEOMOp::OpThickness, "THICKNESS" );
createGeomAction( GEOMOp::OpGroupCreate, "GROUP_CREATE" );
createGeomAction( GEOMOp::OpGroupEdit, "GROUP_EDIT" );
createGeomAction( GEOMOp::Op2dSketcher, "SKETCH" );
createGeomAction( GEOMOp::Op3dSketcher, "3DSKETCH" );
- createGeomAction( GEOMOp::OpIsoline, "ISOLINE" );
createGeomAction( GEOMOp::OpExplode, "EXPLODE" );
#ifdef WITH_OPENCV
createGeomAction( GEOMOp::OpFeatureDetect,"FEATURE_DETECTION" );
createGeomAction( GEOMOp::OpScale, "SCALE" );
createGeomAction( GEOMOp::OpOffset, "OFFSET" );
createGeomAction( GEOMOp::OpProjection, "PROJECTION" );
+ createGeomAction( GEOMOp::OpProjOnCyl, "PROJ_ON_CYL" );
createGeomAction( GEOMOp::OpMultiTranslate, "MUL_TRANSLATION" );
createGeomAction( GEOMOp::OpMultiRotate, "MUL_ROTATION" );
+ createGeomAction( GEOMOp::OpExtension, "EXTENSION" );
createGeomAction( GEOMOp::OpPartition, "PARTITION" );
createGeomAction( GEOMOp::OpArchimede, "ARCHIMEDE" );
//createGeomAction( GEOMOp::OpClipping, "CLIPPING" );
createGeomAction( GEOMOp::OpShapesOnShape, "GET_SHAPES_ON_SHAPE" );
createGeomAction( GEOMOp::OpSharedShapes, "GET_SHARED_SHAPES" );
+ createGeomAction( GEOMOp::OpTransferData, "TRANSFER_DATA" );
createGeomAction( GEOMOp::OpExtrudedCut, "EXTRUDED_CUT" );
createGeomAction( GEOMOp::OpExtrudedBoss, "EXTRUDED_BOSS" );
createGeomAction( GEOMOp::OpFillet1d, "FILLET_1D" );
createGeomAction( GEOMOp::OpRemoveExtraEdges, "REMOVE_EXTRA_EDGES" );
createGeomAction( GEOMOp::OpFuseEdges, "FUSE_EDGES" );
createGeomAction( GEOMOp::OpUnionFaces, "UNION_FACES" );
+ createGeomAction( GEOMOp::OpInspectObj, "INSPECT_OBJECT" );
createGeomAction( GEOMOp::OpPointCoordinates, "POINT_COORDS" );
createGeomAction( GEOMOp::OpProperties, "BASIC_PROPS" );
createGeomAction( GEOMOp::OpCheckCompound, "CHECK_COMPOUND" );
createGeomAction( GEOMOp::OpGetNonBlocks, "GET_NON_BLOCKS" );
createGeomAction( GEOMOp::OpCheckSelfInters, "CHECK_SELF_INTERSECTIONS" );
+ createGeomAction( GEOMOp::OpFastCheckInters, "FAST_CHECK_INTERSECTIONS" );
+#ifndef DISABLE_PLOT2DVIEWER
+ createGeomAction( GEOMOp::OpShapeStatistics, "SHAPE_STATISTICS" );
+#endif
+#ifndef DISABLE_PYCONSOLE
#ifdef _DEBUG_ // PAL16821
createGeomAction( GEOMOp::OpCheckGeom, "CHECK_GEOMETRY" );
+#endif
#endif
createGeomAction( GEOMOp::OpMaterialsLibrary, "MATERIALS_LIBRARY" );
createGeomAction( GEOMOp::OpShow, "DISPLAY" );
createGeomAction( GEOMOp::OpSwitchVectors, "VECTOR_MODE");
createGeomAction( GEOMOp::OpSwitchVertices, "VERTICES_MODE");
+ createGeomAction( GEOMOp::OpSwitchName, "NAME_MODE");
createGeomAction( GEOMOp::OpSelectVertex, "VERTEX_SEL_ONLY" ,"", 0, true );
createGeomAction( GEOMOp::OpSelectEdge, "EDGE_SEL_ONLY", "", 0, true );
createGeomAction( GEOMOp::OpSelectWire, "WIRE_SEL_ONLY", "", 0, true );
createGeomAction( GEOMOp::OpIsosWidth, "ISOS_WIDTH");
createGeomAction( GEOMOp::OpVectors, "POP_VECTORS", "", 0, true );
createGeomAction( GEOMOp::OpVertices, "POP_VERTICES", "", 0, true );
+ createGeomAction( GEOMOp::OpShowName, "POP_SHOW_NAME", "", 0, true );
createGeomAction( GEOMOp::OpDeflection, "POP_DEFLECTION" );
createGeomAction( GEOMOp::OpColor, "POP_COLOR" );
createGeomAction( GEOMOp::OpSetTexture, "POP_SETTEXTURE" );
createGeomAction( GEOMOp::OpPredefMaterCustom, "POP_PREDEF_MATER_CUSTOM" );
createGeomAction( GEOMOp::OpCreateFolder, "POP_CREATE_FOLDER" );
createGeomAction( GEOMOp::OpSortChildren, "POP_SORT_CHILD_ITEMS" );
+#ifndef DISABLE_GRAPHICSVIEW
createGeomAction( GEOMOp::OpShowDependencyTree, "POP_SHOW_DEPENDENCY_TREE" );
+#endif
createGeomAction( GEOMOp::OpReduceStudy, "POP_REDUCE_STUDY" );
createGeomAction( GEOMOp::OpShowAllDimensions, "POP_SHOW_ALL_DIMENSIONS" );
createGeomAction( GEOMOp::OpHideAllDimensions, "POP_HIDE_ALL_DIMENSIONS" );
createMenu( GEOMOp::Op2dPolylineEditor, basicId, -1 );
createMenu( GEOMOp::Op3dSketcher, basicId, -1 );
createMenu( GEOMOp::OpIsoline, basicId, -1 );
+ createMenu( GEOMOp::OpSurfaceFromFace, basicId, -1 );
createMenu( separator(), basicId, -1 );
createMenu( GEOMOp::OpVector, basicId, -1 );
createMenu( GEOMOp::OpPlane, basicId, -1 );
createMenu( GEOMOp::OpFilling, genId, -1 );
createMenu( GEOMOp::OpPipe, genId, -1 );
createMenu( GEOMOp::OpPipePath, genId, -1 );
+ createMenu( GEOMOp::OpThickness, genId, -1 );
//int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
//createMenu( GEOMOp::OpSmoothingSurface, advId, -1 );
createMenu( GEOMOp::OpScale, transId, -1 );
createMenu( GEOMOp::OpOffset, transId, -1 );
createMenu( GEOMOp::OpProjection, transId, -1 );
+ createMenu( GEOMOp::OpExtension, transId, -1 );
+ createMenu( GEOMOp::OpProjOnCyl, transId, -1 );
createMenu( separator(), transId, -1 );
createMenu( GEOMOp::OpMultiTranslate, transId, -1 );
createMenu( GEOMOp::OpMultiRotate, transId, -1 );
createMenu( GEOMOp::OpArchimede, operId, -1 );
createMenu( GEOMOp::OpShapesOnShape, operId, -1 );
createMenu( GEOMOp::OpSharedShapes, operId, -1 );
+ createMenu( GEOMOp::OpTransferData, operId, -1 );
createMenu( separator(), operId, -1 );
createMenu( GEOMOp::OpCheckCompound, measurId, -1 );
createMenu( GEOMOp::OpGetNonBlocks, measurId, -1 );
createMenu( GEOMOp::OpCheckSelfInters, measurId, -1 );
+ createMenu( GEOMOp::OpFastCheckInters, measurId, -1 );
+ createMenu( GEOMOp::OpInspectObj, measurId, -1 );
+#ifndef DISABLE_PLOT2DVIEWER
+ createMenu( GEOMOp::OpShapeStatistics, measurId, -1 );
+#endif
int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 );
+#ifndef DISABLE_PYCONSOLE
#if defined(_DEBUG_) || defined(_DEBUG) // PAL16821
createMenu( separator(), toolsId, -1 );
createMenu( GEOMOp::OpCheckGeom, toolsId, -1 );
+#endif
#endif
createMenu( separator(), toolsId, -1 );
createMenu( separator(), dispmodeId, -1 );
createMenu( GEOMOp::OpSwitchVectors, dispmodeId, -1 );
createMenu( GEOMOp::OpSwitchVertices, dispmodeId, -1 );
+ createMenu( GEOMOp::OpSwitchName, dispmodeId, -1 );
createMenu( separator(), viewId, -1 );
createMenu( GEOMOp::OpShowAll, viewId, -1 );
createTool( GEOMOp::Op2dPolylineEditor, basicTbId );
createTool( GEOMOp::Op3dSketcher, basicTbId ); //rnc
createTool( GEOMOp::OpIsoline, basicTbId );
+ createTool( GEOMOp::OpSurfaceFromFace, basicTbId );
createTool( GEOMOp::OpPlane, basicTbId );
createTool( GEOMOp::OpLCS, basicTbId );
createTool( GEOMOp::OpOriginAndVectors, basicTbId );
createTool( GEOMOp::OpFilling, genTbId );
createTool( GEOMOp::OpPipe, genTbId );
createTool( GEOMOp::OpPipePath, genTbId );
+ createTool( GEOMOp::OpThickness, genTbId );
int transTbId = createTool( tr( "TOOL_TRANSFORMATION" ), QString( "GEOMTransformation" ) );
createTool( GEOMOp::OpTranslate, transTbId );
createTool( GEOMOp::OpScale, transTbId );
createTool( GEOMOp::OpOffset, transTbId );
createTool( GEOMOp::OpProjection, transTbId );
+ createTool( GEOMOp::OpExtension, transTbId );
+ createTool( GEOMOp::OpProjOnCyl, transTbId );
createTool( separator(), transTbId );
createTool( GEOMOp::OpMultiTranslate, transTbId );
createTool( GEOMOp::OpMultiRotate, transTbId );
createTool( GEOMOp::OpArchimede, operTbId );
createTool( GEOMOp::OpShapesOnShape, operTbId );
createTool( GEOMOp::OpSharedShapes, operTbId );
+ createTool( GEOMOp::OpTransferData, operTbId );
int featTbId = createTool( tr( "TOOL_FEATURES" ), QString( "GEOMModification" ) );
createTool( GEOMOp::OpFillet1d, featTbId );
createTool( GEOMOp::OpCheckCompound, measureTbId );
createTool( GEOMOp::OpGetNonBlocks, measureTbId );
createTool( GEOMOp::OpCheckSelfInters, measureTbId );
+ createTool( GEOMOp::OpFastCheckInters, measureTbId );
int picturesTbId = createTool( tr( "TOOL_PICTURES" ), QString( "GEOMPictures" ) );
createTool( GEOMOp::OpPictureImport, picturesTbId );
QString clientOCCorOB_AndSomeVisible = clientOCCorOB + " and selcount>0 and isVisible";
QString autoColorPrefix =
- "(client='ObjectBrowser' or client='OCCViewer') and type='Shape' and selcount=1 and isOCC=true";
+ "(client='ObjectBrowser' or client='OCCViewer' or client='VTKViewer') and type='Shape' and selcount=1";
QtxPopupMgr* mgr = popupMgr();
mgr->insert( action( GEOMOp::OpVertices ), dispmodeId, -1 ); // vertices
mgr->setRule( action( GEOMOp::OpVertices ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpVertices ), clientOCCorVTK + " and isVerticesMode", QtxPopupMgr::ToggleRule );
+ mgr->insert( action( GEOMOp::OpShowName ), dispmodeId, -1 ); // show name
+ mgr->setRule( action( GEOMOp::OpShowName ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( GEOMOp::OpShowName ), clientOCCorVTK + " and isNameMode", QtxPopupMgr::ToggleRule );
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpColor ), -1, -1 ); // color
mgr->insert( action( GEOMOp::OpSortChildren ), -1, -1 ); // Sort child items
mgr->setRule( action( GEOMOp::OpSortChildren ), QString("client='ObjectBrowser' and $component={'GEOM'} and nbChildren>1"), QtxPopupMgr::VisibleRule );
+#ifndef DISABLE_GRAPHICSVIEW
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpShowDependencyTree ), -1, -1 ); // Show dependency tree
mgr->setRule( action( GEOMOp::OpShowDependencyTree ), clientOCCorVTKorOB + " and selcount>0 and ($component={'GEOM'}) and type='Shape'", QtxPopupMgr::VisibleRule );
+#endif
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpReduceStudy ), -1, -1 ); // Reduce Study
// icon
QPixmap icon;
if ( !adata.icon.empty() )
- icon = resMgr->loadPixmap( pdata.name.c_str(), adata.icon.c_str() );
+ icon = resMgr->loadPixmap( pdata.name.c_str(), adata.icon.c_str() );
// menu text (path)
QStringList smenus = QString( adata.menuText.c_str() ).split( "/" );
QString actionName = smenus.last();
actionStat = actionStat.toUpper().prepend( "STB_" );
createAction( id, // ~ adata.label
- tr( actionTool.toLatin1().constData() ),
- icon,
- tr( actionName.toLatin1().constData() ),
- tr( actionStat.toLatin1().constData() ),
- QKeySequence( tr( adata.accel.c_str() ) ),
- application()->desktop(),
- false /*toggle*/,
- this, SLOT( OnGUIEvent() ),
- QString() /*shortcutAction*/ );
+ tr( actionTool.toLatin1().constData() ),
+ icon,
+ tr( actionName.toLatin1().constData() ),
+ tr( actionStat.toLatin1().constData() ),
+ QKeySequence( tr( adata.accel.c_str() ) ),
+ application()->desktop(),
+ false /*toggle*/,
+ this, SLOT( OnGUIEvent() ),
+ QString() /*shortcutAction*/ );
int menuId = -1;
foreach ( QString subMenu, smenus ) {
- QStringList subMenuList = subMenu.split( ":" );
- QString subMenuName = subMenuList[0].toUpper().prepend( "MEN_" );
- int subMenuGroup = subMenuList.size() > 1 ? subMenuList[1].toInt() : -1;
- menuId = createMenu( tr( subMenuName.toLatin1().constData() ), menuId, -1, subMenuGroup );
+ QStringList subMenuList = subMenu.split( ":" );
+ QString subMenuName = subMenuList[0].toUpper().prepend( "MEN_" );
+ int subMenuGroup = subMenuList.size() > 1 ? subMenuList[1].toInt() : -1;
+ menuId = createMenu( tr( subMenuName.toLatin1().constData() ), menuId, -1, subMenuGroup );
}
createMenu( id, menuId, -1 );
if ( !stools.isEmpty() ) {
- QString subTool = stools[0];
- subTool = subTool.toUpper().prepend( "TOOL_" );
- int toolId = createTool( tr( subTool.toLatin1().constData() ) );
- createTool(id, toolId);
+ QString subTool = stools[0];
+ subTool = subTool.toUpper().prepend( "TOOL_" );
+ int toolId = createTool( tr( subTool.toLatin1().constData() ) );
+ createTool(id, toolId);
}
// add action id to map
// import Python module that manages GEOM plugins (need to be here because SalomePyQt API uses active module)
PyGILState_STATE gstate = PyGILState_Ensure();
- PyObjWrapper pluginsmanager = PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager");
+ PyObject* pluginsmanager = PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager");
if ( !pluginsmanager ) {
PyErr_Print();
}
else {
- PyObjWrapper result =
+ PyObject* result =
PyObject_CallMethod(pluginsmanager, (char*)"initialize", (char*)"isss", 1, "geom",
- tr("MEN_NEW_ENTITY").toStdString().c_str(),
- tr("GEOM_PLUGINS_OTHER").toStdString().c_str());
+ tr("MEN_NEW_ENTITY").toUtf8().data(),
+ tr("GEOM_PLUGINS_OTHER").toUtf8().data());
if ( !result )
PyErr_Print();
+ Py_XDECREF(result);
}
PyGILState_Release(gstate);
// end of GEOM plugins loading
getApp()->insertDockWindow( myCreationInfoWdg->getWinID(), myCreationInfoWdg );
getApp()->placeDockWindow( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea );
+ if ( !myTextTreeWdg )
+ myTextTreeWdg = new GEOMGUI_TextTreeWdg( getApp() );
+ getApp()->insertDockWindow( myTextTreeWdg->getWinID(), myTextTreeWdg );
+ getApp()->placeDockWindow( myTextTreeWdg->getWinID(), Qt::LeftDockWidgetArea );
+
//NPAL 19674
SALOME_ListIO selected;
sm->selectedObjects( selected );
}
}
+ Py_XDECREF(pluginsmanager);
return true;
}
disconnect( selMrg, SIGNAL( currentSelectionChanged() ), this, SLOT( updateCreationInfo() ));
disconnect( selMrg, SIGNAL( currentSelectionChanged() ), this, SLOT( updateFieldColorScale() ));
- getApp()->removeDockWindow( myCreationInfoWdg->getWinID() );
- myCreationInfoWdg = 0;
+ if ( myCreationInfoWdg ) {
+ getApp()->removeDockWindow( myCreationInfoWdg->getWinID() );
+ myCreationInfoWdg = 0;
+ }
+ if ( myTextTreeWdg ) {
+ getApp()->removeDockWindow( myTextTreeWdg->getWinID() );
+ disconnect( application(), 0, myTextTreeWdg, 0 );
+ myTextTreeWdg = 0;
+ }
EmitSignalCloseAllDialogs();
if ( !win )
return;
- const bool ViewOCC = ( win->getViewManager()->getType() == OCCViewer_Viewer::Type() );
- //const bool ViewVTK = ( win->getViewManager()->getType() == SVTK_Viewer::Type() );
+ const bool ViewOCC = ( win->getViewManager() ? win->getViewManager()->getType() == OCCViewer_Viewer::Type() : false );
+ //const bool ViewVTK = ( win->getViewManager() ? win->getViewManager()->getType() == SVTK_Viewer::Type() : false );
// disable non-OCC viewframe menu commands
// action( GEOMOp::Op2dSketcher )->setEnabled( ViewOCC ); // SKETCHER
{
mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
mappa.insert( SalomeApp_Application::WT_NoteBook, Qt::LeftDockWidgetArea );
+#ifndef DISABLE_PYCONSOLE
mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
+#endif
if ( myCreationInfoWdg )
mappa.insert( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea );
+ if ( myTextTreeWdg )
+ mappa.insert( myTextTreeWdg->getWinID(), Qt::LeftDockWidgetArea );
}
void GeometryGUI::viewManagers( QStringList& lst ) const
// pass creation info of geomObj to myCreationInfoWdg
if ( myCreationInfoWdg ) {
- QPixmap icon;
- QString operationName;
- myCreationInfoWdg->setOperation( icon, operationName );
+ GEOM::CreationInformationSeq_var info;
try {
OCC_CATCH_SIGNALS;
- GEOM::CreationInformation_var info = geomObj->GetCreationInformation();
- if ( &info.in() ) {
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- QString name = info->operationName.in();
- if ( !name.isEmpty() ) {
-
- QString plugin_name;
- for ( size_t i = 0; i < info->params.length(); ++i ) {
- myCreationInfoWdg->addParam( info->params[i].name.in(),
- info->params[i].value.in() );
- QString value = info->params[i].name.in();
- if( value == PLUGIN_NAME ) {
- plugin_name = info->params[i].value.in();
- }
- }
- QString prefix = plugin_name.isEmpty() ? "GEOM" : plugin_name;
- icon = resMgr->loadPixmap( prefix, tr( ("ICO_"+name).toLatin1().constData() ), false );
- operationName = tr( ("MEN_"+name).toLatin1().constData() );
- if ( operationName.startsWith( "MEN_" ))
- operationName = name; // no translation
- myCreationInfoWdg->setOperation( icon, operationName );
- }
- }
+ info = geomObj->GetCreationInformation();
}
catch (...) {
}
+ myCreationInfoWdg->setInfo( info );
}
}
void GeometryGUI::createPreferences()
{
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+
int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId );
addPreference( tr( "PREF_ISOS_COLOR" ), genGroup,
LightApp_Preferences::Color, "Geometry", "isos_color" );
+ addPreference( tr( "PREF_LABEL_COLOR" ), genGroup,
+ LightApp_Preferences::Color, "Geometry", "label_color" );
+
+ addPreference( "", genGroup, LightApp_Preferences::Space );
+
addPreference( tr( "PREF_TOPLEVEL_COLOR" ), genGroup,
LightApp_Preferences::Color, "Geometry", "toplevel_color" );
LightApp_Preferences::Selector, "Geometry", "toplevel_dm" );
int transparency = addPreference( tr( "PREF_TRANSPARENCY" ), genGroup,
- LightApp_Preferences::IntSpin, "Geometry", "transparency" );
+ LightApp_Preferences::IntSpin, "Geometry", "transparency" );
int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup,
LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
setPreferenceProperty( aDimLineWidthId, "min", 1 );
setPreferenceProperty( aDimLineWidthId, "max", 5 );
- int aDimFontHeightId = addPreference( tr( "PREF_DIMENSIONS_FONT_HEIGHT" ), aDimGroupId,
- LightApp_Preferences::DblSpin, "Geometry", "dimensions_font_height" );
-
- setPreferenceProperty( aDimFontHeightId, "min", 1e-9 );
- setPreferenceProperty( aDimFontHeightId, "max", 1e+9 );
- setPreferenceProperty( aDimFontHeightId, "precision", 9 );
+ int aDimFontId = addPreference( tr( "PREF_DIMENSIONS_FONT" ), aDimGroupId, LightApp_Preferences::Font, "Geometry", "dimensions_font" );
+
+ int f = QtxFontEdit::Family | QtxFontEdit::Size;
+ setPreferenceProperty( aDimFontId, "features", f );
+ setPreferenceProperty( aDimFontId, "mode", QtxFontEdit::Custom );
+
+ Handle(Font_FontMgr) fmgr = Font_FontMgr::GetInstance();
+ QString aFontFile = "";
+ resMgr->value("resources", "GEOM", aFontFile);
+ aFontFile = aFontFile + QDir::separator() + "Y14.5M-2009.ttf";
+ // add enginier font into combobox
+ int fontID = QFontDatabase::addApplicationFont( aFontFile );
+ Handle(Font_SystemFont) sf = new Font_SystemFont(
+ new TCollection_HAsciiString("Y14.5M-2009"),
+ Font_FA_Regular,
+ new TCollection_HAsciiString(aFontFile.toLatin1().data()) );
+ // register font in OCC font manager
+ fmgr->RegisterFont( sf, Standard_False );
+
+ // get list of supported fonts by OCC
+ QStringList anOCCFonts;
+ TColStd_SequenceOfHAsciiString theFontsNames;
+ fmgr->GetAvailableFontsNames( theFontsNames );
+ for(Standard_Integer i=1; i<=theFontsNames.Length(); i++) {
+ Handle(TCollection_HAsciiString) str = theFontsNames(i);
+ anOCCFonts << str->ToCString();
+ }
+ anOCCFonts.removeDuplicates();
+ // set the supported fonts into combobox to use its only
+ setPreferenceProperty( aDimFontId, "fonts", anOCCFonts );
int aDimArrLengthId = addPreference( tr( "PREF_DIMENSIONS_ARROW_LENGTH" ), aDimGroupId,
LightApp_Preferences::DblSpin, "Geometry", "dimensions_arrow_length" );
int anAngUnitsId = addPreference( tr( "PREF_DIMENSIONS_ANGLE_UNITS" ), aDimGroupId,
LightApp_Preferences::Selector, "Geometry", "dimensions_angle_units" );
- addPreference( tr( "PREF_DIMENSIONS_SHOW_UNITS" ), aDimGroupId,
- LightApp_Preferences::Bool, "Geometry", "dimensions_show_units" );
-
QStringList aListOfLengthUnits;
aListOfLengthUnits << "m";
aListOfLengthUnits << "cm";
setPreferenceProperty( aLengthUnitsId, "strings", aListOfLengthUnits );
setPreferenceProperty( anAngUnitsId, "strings", aListOfAngUnits );
+ addPreference( tr( "PREF_DIMENSIONS_SHOW_UNITS" ), aDimGroupId,
+ LightApp_Preferences::Bool, "Geometry", "dimensions_show_units" );
+
int aDimDefFlyout = addPreference( tr( "PREF_DIMENSIONS_DEFAULT_FLYOUT" ), aDimGroupId,
LightApp_Preferences::DblSpin, "Geometry", "dimensions_default_flyout" );
setPreferenceProperty( aDimDefFlyout, "max", 1e+9 );
setPreferenceProperty( aDimDefFlyout, "precision", 9 );
+ addPreference( tr( "PREF_DIMENSIONS_USE_TEXT3D" ), aDimGroupId,
+ LightApp_Preferences::Bool, "Geometry", "dimensions_use_text3d" );
+
int isoGroup = addPreference( tr( "PREF_ISOS" ), tabId );
setPreferenceProperty( isoGroup, "columns", 2 );
int isoU = addPreference( tr( "PREF_ISOS_U" ), isoGroup,
QList<QVariant> aMarkerTypeIndicesList;
QList<QVariant> aMarkerTypeIconsList;
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
for ( int i = GEOM::MT_POINT; i < GEOM::MT_USER; i++ ) {
QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
QPixmap pixmap = resMgr->loadPixmap( "GEOM", tr( qPrintable( icoFile ) ) );
addPreference( tr( "GEOM_PREVIEW" ), operationsGroup,
LightApp_Preferences::Bool, "Geometry", "geom_preview" );
+ addPreference( tr( "PREF_HIDE_INPUT_OBJECT" ), operationsGroup,
+ LightApp_Preferences::Bool, "Geometry", "hide_input_object" );
+
int DependencyViewId = addPreference( tr( "PREF_TAB_DEPENDENCY_VIEW" ) );
int treeGeneralGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), DependencyViewId );
}
else if ( param == QString("dimensions_color") ||
param == QString("dimensions_line_width") ||
- param == QString("dimensions_font_height") ||
+ param == QString("dimensions_font") ||
param == QString("dimensions_arrow_length") ||
param == QString("dimensions_show_units") ||
param == QString("dimensions_length_units") ||
- param == QString("dimensions_angle_units") )
+ param == QString("dimensions_angle_units") ||
+ param == QString("dimensions_use_text3d") ||
+ param == QString("label_color") )
{
SalomeApp_Application* anApp = getApp();
if ( !anApp )
aViewer->GetVisible( aVisible );
aDisplayer.Redisplay( aVisible, false, aViewer );
}
-
+ if ( param == QString( "label_color" ) ) {
+ ViewManagerList aVMsVTK;
+ anApp->viewManagers( SVTK_Viewer::Type(), aVMsVTK );
+ ViewManagerList::Iterator anIt = aVMsVTK.begin();
+ for ( ; anIt != aVMsVTK.end(); ++anIt )
+ {
+ SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>( (*anIt)->getViewModel() );
+ if ( !aViewer )
+ {
+ continue;
+ }
+ SALOME_ListIO aVisible;
+ aViewer->GetVisible( aVisible );
+ aDisplayer.Redisplay( aVisible, false, aViewer );
+ }
+ }
aDisplayer.UpdateViewer();
}
else if ( param.startsWith( "dependency_tree") )
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Vertices )).toString().toStdString());
}
+ if (aProps.contains(GEOM::propertyName( GEOM::ShowName ))) {
+ param = occParam + GEOM::propertyName( GEOM::ShowName );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::ShowName )).toString().toStdString());
+ }
+
if (aProps.contains(GEOM::propertyName( GEOM::Deflection ))) {
param = occParam + GEOM::propertyName( GEOM::Deflection );
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Deflection )).toString().toStdString());
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::EdgesDirection ), val == "true" || val == "1");
} else if (paramNameStr == GEOM::propertyName( GEOM::Vertices )) {
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Vertices ), val == "true" || val == "1");
+ } else if (paramNameStr == GEOM::propertyName( GEOM::ShowName )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::ShowName ), val == "true" || val == "1");
} else if (paramNameStr == GEOM::propertyName( GEOM::Deflection )) {
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Deflection ), val.toDouble());
} else if (paramNameStr == GEOM::propertyName( GEOM::PointMarker )) {
}
}
+// Compute current name mode of the viewer
+void UpdateNameMode( SalomeApp_Application* app )
+{
+ bool isMode = false;
+ SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+ SUIT_ViewWindow* viewWindow = app->desktop()->activeWindow();
+ GEOM_Displayer displayer( aStudy );
+ int aMgrId = viewWindow->getViewManager()->getGlobalId();
+
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
+
+ SALOME_ListIO anIOlst;
+ window->GetVisible( anIOlst );
+
+ for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
+ Handle( SALOME_InteractiveObject ) io = It.Value();
+ QVariant v = aStudy->getObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::ShowName ), QVariant() );
+ bool isIONameMode = v.isValid() ? v.toBool() : false;
+ if( isIONameMode )
+ isMode = true;
+ }
+ viewWindow->setProperty( "NameMode", isMode );
+}
+
void GeometryGUI::onViewAboutToShow()
{
SUIT_ViewWindow* window = application()->desktop()->activeWindow();
QAction* a = action( GEOMOp::OpSwitchVectors );
QAction* aVerticesAction = action( GEOMOp::OpSwitchVertices );
+ QAction* aNameAction = action( GEOMOp::OpSwitchName );
if ( window ) {
a->setEnabled(true);
bool vmode = window->property("VectorsMode").toBool();
aVerticesAction->setEnabled(true);
vmode = window->property("VerticesMode").toBool();
aVerticesAction->setText ( vmode == 1 ? tr( "MEN_VERTICES_MODE_OFF" ) : tr("MEN_VERTICES_MODE_ON") );
+ UpdateNameMode( getApp() );
+ aNameAction->setEnabled(true);
+ vmode = window->property("NameMode").toBool();
+ aNameAction->setText ( vmode == 1 ? tr( "MEN_NAME_MODE_OFF" ) : tr("MEN_NAME_MODE_ON") );
} else {
a->setText ( tr("MEN_VECTOR_MODE_ON") );
a->setEnabled(false);
aVerticesAction->setText ( tr("MEN_VERTICES_MODE_ON") );
aVerticesAction->setEnabled(false);
+ aNameAction->setText ( tr("MEN_NAME_MODE_ON") );
+ aNameAction->setEnabled(false);
}
}
// update Object browser
getApp()->updateObjectBrowser( false );
}
+
+void GeometryGUI::emitDimensionsUpdated( QString entry )
+{
+ emit DimensionsUpdated( entry );
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
class SUIT_ViewManager;
class SalomeApp_Study;
class GEOMGUI_CreationInfoWdg;
+class GEOMGUI_TextTreeWdg;
//=================================================================================
// class : GeometryGUI
virtual bool isDraggable( const SUIT_DataObject* what ) const;
virtual bool isDropAccepted( const SUIT_DataObject* where ) const;
virtual void dropObjects( const DataObjectList& what,
- SUIT_DataObject* where,
- const int row, Qt::DropAction action );
+ SUIT_DataObject* where,
+ const int row, Qt::DropAction action );
+
+ void emitDimensionsUpdated( QString entry );
public slots:
virtual bool deactivateModule( SUIT_Study* );
void SignalDefaultStepValueChanged( double newVal );
void SignalDependencyTreeParamChanged( const QString&, const QString& );
void SignalDependencyTreeRenameObject( const QString& );
+ void DimensionsUpdated( const QString& );
protected:
virtual LightApp_Selection* createSelection() const;
GEOMGUI_CreationInfoWdg* myCreationInfoWdg;
+ GEOMGUI_TextTreeWdg* myTextTreeWdg;
+
SALOME_ListIO myTopLevelIOList;
friend class DisplayGUI;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
enum {
// ToolsGUI --------------------//--------------------------------
OpDelete = 1020, // MENU EDIT - DELETE
+#ifndef DISABLE_PYCONSOLE
OpCheckGeom = 1030, // MENU TOOLS - CHECK GEOMETRY
+#endif
OpMaterialsLibrary = 1040, // MENU TOOLS - MATERIALS LIBRARY
OpSelectVertex = 1100, // POPUP MENU - SELECT ONLY - VERTEX
OpSelectEdge = 1101, // POPUP MENU - SELECT ONLY - EDGE
OpIsosWidth = 1261, // POPUP MENU - LINE WIDTH - ISOS WIDTH
OpCreateFolder = 1262, // POPUP MENU - CREATE FOLDER
OpSortChildren = 1263, // POPUP MENU - SORT CHILD ITEMS
+#ifndef DISABLE_GRAPHICSVIEW
OpShowDependencyTree = 1264, // POPUP MENU - SHOW DEPENDENCY TREE
+#endif
OpReduceStudy = 1265, // POPUP MENU - REDUCE STUDY
// DisplayGUI ------------------//--------------------------------
OpSwitchVectors = 2001, // MENU VIEW - DISPLAY MODE - SHOW/HIDE EDGE DIRECTION
OpDMShadingWithEdges = 2012, // MENU VIEW - DISPLAY MODE - SHADING WITH EDGES
OpDMTexture = 2013, // MENU VIEW - DISPLAY MODE - TEXTURE
OpSwitchVertices = 2014, // MENU VIEW - DISPLAY MODE - SHOW/HIDE VERTICES
+ OpSwitchName = 2015, // MENU VIEW - DISPLAY MODE - SHOW/HIDE NAME
OpShow = 2100, // POPUP MENU - SHOW
OpShowOnly = 2101, // POPUP MENU - SHOW ONLY
OpHide = 2102, // POPUP MENU - HIDE
OpBringToFront = 2205, // POPUP MENU - BRING TO FRONT
OpClsBringToFront = 2206,
OpVertices = 2208, // POPUP MENU - DISPLAY MODE - SHOW VERTICES
+ OpShowName = 2209, // POPUP MENU - DISPLAY MODE - SHOW NAME
// BasicGUI --------------------//--------------------------------
OpPoint = 3000, // MENU NEW ENTITY - BASIC - POINT
OpLine = 3001, // MENU NEW ENTITY - BASIC - LINE
OpLCS = 3008, // MENU NEW ENTITY - BASIC - LOCAL COORDINATE SYSTEM
OpOriginAndVectors = 3009, // MENU NEW ENTITY - BASIC - ORIGIN AND BASE VECTORS
OpIsoline = 3010, // MENU NEW ENTITY - BASIC - ISOLINE
+ OpSurfaceFromFace = 3011, // MENU NEW ENTITY - BASIC - SURFACE FROM FACE
// PrimitiveGUI ----------------//--------------------------------
OpBox = 3100, // MENU NEW ENTITY - PRIMITIVES - BOX
OpCylinder = 3101, // MENU NEW ENTITY - PRIMITIVES - CYLINDER
OpFilling = 3202, // MENU NEW ENTITY - GENERATION - FILLING
OpPipe = 3203, // MENU NEW ENTITY - GENERATION - EXTRUSION ALONG PATH
OpPipePath = 3204, // MENU NEW ENTITY - GENERATION - RESTORE PATH
+ OpThickness = 3205, // MENU NEW ENTITY - GENERATION - THICKNESS
// EntityGUI -------------------//--------------------------------
Op2dSketcher = 3300, // MENU NEW ENTITY - SKETCHER
Op3dSketcher = 3301, // MENU NEW ENTITY - 3D SKETCHER
OpMultiRotate = 3607, // MENU OPERATIONS - TRANSFORMATION - MULTI-ROTATION
OpReimport = 3608, // POPUP MENU - RELOAD IMPORTED
OpProjection = 3609, // MENU OPERATIONS - TRANSFORMATION - PROJECTION
+ OpExtension = 3610, // MENU OPERATIONS - TRANSFORMATION - EXTENSION
+ OpProjOnCyl = 3611, // MENU OPERATIONS - TRANSFORMATION - PROJECTION ON CYLINDER
// OperationGUI ----------------//--------------------------------
OpPartition = 3700, // MENU OPERATION - PARTITION
OpArchimede = 3701, // MENU OPERATION - ARCHIMEDE
OpSharedShapes = 3708, // MENU OPERATION - GET SHARED SHAPES
OpExtrudedBoss = 3709, // MENU OPERATION - ETRUDED BOSS
OpExtrudedCut = 3710, // MENU OPERATION - ETRUDED CUT
+ OpTransferData = 3711, // MENU OPERATION - TRANSFER DATA
// RepairGUI -------------------//--------------------------------
OpSewing = 4000, // MENU REPAIR - SEWING
OpSuppressFaces = 4001, // MENU REPAIR - SUPPRESS FACES
OpManageDimensions = 5014, // MENU MEASURES - MANAGE DIMENSIONS
OpShowAllDimensions = 5015, // POPUP MENU - SHOW ALL DIMENSIONS
OpHideAllDimensions = 5016, // POPUP MENU - HIDE ALL DIMENSIONS
+ OpFastCheckInters = 5017, // MENU MEASURES - FAST CHECK INTERSECTIONS
+ OpInspectObj = 5018, // MENU MEASURES - INSPECT OBJECT
+#ifndef DISABLE_PLOT2DVIEWER
+ OpShapeStatistics = 5019, // MENU MEASURES - SHAPE STATISTICS
+#endif
// GroupGUI --------------------//--------------------------------
OpGroupCreate = 6000, // MENU GROUP - CREATE
OpGroupEdit = 6001, // MENU GROUP - EDIT
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
${PROJECT_SOURCE_DIR}/src/SKETCHER
${PROJECT_SOURCE_DIR}/src/ARCHIMEDE
${PROJECT_SOURCE_DIR}/src/XAO
+ ${PROJECT_SOURCE_DIR}/src/ShHealOper
${CMAKE_CURRENT_SOURCE_DIR}
)
GEOMImpl_ITranslate.hxx
GEOMImpl_IMirror.hxx
GEOMImpl_IProjection.hxx
+ GEOMImpl_IProjOnCyl.hxx
GEOMImpl_IOffset.hxx
GEOMImpl_IScale.hxx
GEOMImpl_IRotate.hxx
GEOMImpl_ICone.hxx
GEOMImpl_ISphere.hxx
GEOMImpl_ITorus.hxx
+ GEOMImpl_ITransferData.hxx
GEOMImpl_IPrism.hxx
GEOMImpl_IPipe.hxx
GEOMImpl_IPipePath.hxx
GEOMImpl_IRevolution.hxx
GEOMImpl_IMeasure.hxx
GEOMImpl_IShapes.hxx
+ GEOMImpl_IShapeExtend.hxx
GEOMImpl_IFilling.hxx
GEOMImpl_IThruSections.hxx
GEOMImpl_IPartition.hxx
GEOMImpl_IFieldOperations.cxx
GEOMImpl_IBaseIEOperations.cxx
GEOMImpl_IPolyline2D.cxx
+ GEOMImpl_ITransferData.cxx
GEOMImpl_Gen.cxx
GEOMImpl_PointDriver.cxx
GEOMImpl_VectorDriver.cxx
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#define PLANAR_FACE_MAX_TOLERANCE 1e-06
+// The following macro, when enabled, causes pcurves upgrade after MakeFilling algorithm
+// in MakeAnyFace function;
+// WARNING: it may lead to extra vertices generation by partition algorithm
+// in some cases, for example when fillet is made on a PipeTShape -
+// see issues 0021568 and 0021550
+// VSR (15/05/2012): macro commented out (disabled) to avoid extra vertices!
+//#define MAKE_FACE_UPGRADE_PCURVES
+
+// The following macro, when enabled, causes fixing tolerance for pcurves
+// after BRepBuilderAPI_MakeFace + ShHealOper_ShapeProcess in MakeAnyFace function;
+// This sometimes allows to fix problems of extra vertices generation
+// see issue 0022706
+// VSR (17/11/2014): macro enabled
+#define MAKE_FACE_PCURVES_FIX_TOLERANCE
+
+#ifdef MAKE_FACE_PCURVES_FIX_TOLERANCE
+#include <BOPTools_AlgoTools.hxx>
+#include <NCollection_DataMap.hxx>
+#include <ShapeFix_ShapeTolerance.hxx>
+#endif
+
static Standard_Integer mod4 (Standard_Integer nb)
{
if (nb <= 0) return nb + 4;
// 12.04.2006 for PAL12149 begin
Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(aFace));
-// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN
-// the following block, when enabled, leads to extra vertices generation by partition algorithm
-// in some cases, for example when fillet is made on a PipeTShape
-#if 0
-// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END
+#ifdef MAKE_FACE_UPGRADE_PCURVES
BRep_Builder BB;
TopoDS_Iterator itw(theWire);
for (; itw.More(); itw.Next())
}
// 12.04.2006 for PAL12149 end
- if (theResult.IsNull()) { // try to deal with pure result of filling
+ if (!theResult.IsNull()) {
+ // try to deal with result of BRepBuilderAPI_MakeFace + ShHealOper_ShapeProcess
+#if OCC_VERSION_LARGE >= 0x06080000
+#ifdef MAKE_FACE_PCURVES_FIX_TOLERANCE
+ // check and fix pcurves, if necessary
+ Standard_Real aT, aTolE, aD, aDMax;
+ TopExp_Explorer aExpF, aExpE;
+ NCollection_DataMap<TopoDS_Shape, Standard_Real, TopTools_ShapeMapHasher> aDMETol;
+ aExpF.Init(theResult, TopAbs_FACE);
+ for (; aExpF.More(); aExpF.Next()) {
+ const TopoDS_Face& aF = *(TopoDS_Face*)&aExpF.Current();
+ aExpE.Init(aF, TopAbs_EDGE);
+ for (; aExpE.More(); aExpE.Next()) {
+ const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExpE.Current();
+ if (!BOPTools_AlgoTools::ComputeTolerance(aF, aE, aDMax, aT)) continue;
+ aTolE = BRep_Tool::Tolerance(aE);
+ if (aDMax < aTolE) continue;
+ if (aDMETol.IsBound(aE)) {
+ aD = aDMETol.Find(aE);
+ if (aDMax > aD) {
+ aDMETol.UnBind(aE);
+ aDMETol.Bind(aE, aDMax);
+ }
+ }
+ else {
+ aDMETol.Bind(aE, aDMax);
+ }
+ }
+ }
+ NCollection_DataMap<TopoDS_Shape, Standard_Real, TopTools_ShapeMapHasher>::Iterator aDMETolIt(aDMETol);
+ ShapeFix_ShapeTolerance sat;
+ for (; aDMETolIt.More(); aDMETolIt.Next()) {
+ sat.LimitTolerance(aDMETolIt.Key(), aDMETolIt.Value());
+ }
+#endif
+#endif
+ }
+ else {
+ // try to deal with pure result of BRepOffsetAPI_MakeFilling
+
// Update tolerance
Standard_Real aTol = MF.G0Error();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TNaming_CopyShape.hxx>
-#include <ShapeFix_ShapeTolerance.hxx>
-#include <ShapeFix_Shape.hxx>
-
#include <BRep_Builder.hxx>
-#include <BRepAlgo.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Section.hxx>
-#include <BRepCheck_Analyzer.hxx>
#include <BOPAlgo_CheckerSI.hxx>
#include <BOPDS_DS.hxx>
{
TopoDS_Shape aResult;
- if (theShape.IsNull() == Standard_False) {
+ if (!theShape.IsNull()) {
BlockFix_BlockFixAPI aTool;
aTool.OptimumNbFaces() = 0;
aTool.SetShape(theShape);
aTool.Perform();
- aResult = aTool.Shape();
-
- // Repair result
- BRepCheck_Analyzer anAna (aResult, false);
- Standard_Boolean isValid = anAna.IsValid();
+ TopoDS_Shape aShape = aTool.Shape();
- if (!isValid) {
+ if (GEOMUtils::CheckShape(aShape)) {
+ aResult = aShape;
+ }
+ else {
TopoDS_Shape aFixed;
ShHealOper_ShapeProcess aHealer;
-
- aHealer.Perform(aResult, aFixed);
-
- if (aHealer.isDone()) {
+ aHealer.Perform(aShape, aFixed);
+ if (aHealer.isDone() && GEOMUtils::CheckShape(aFixed))
aResult = aFixed;
- anAna.Init(aResult, false);
- isValid = anAna.IsValid();
- }
- }
-
- if (!isValid) {
- aResult.Nullify();
}
}
if (!aShape1.IsNull() && !aShape2.IsNull()) {
// check arguments for Mantis issue 0021019
- BRepCheck_Analyzer ana (aShape1, Standard_True);
- if (!ana.IsValid())
- StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
- ana.Init(aShape2);
- if (!ana.IsValid())
+ if (!GEOMUtils::CheckShape(aShape1, true) || !GEOMUtils::CheckShape(aShape2, true))
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
if (isCheckSelfInte) {
aShape = aRefShape->GetValue();
if (!aShape.IsNull()) {
- BRepCheck_Analyzer anAna (aShape, Standard_True);
- if (!anAna.IsValid()) {
+ // check arguments for Mantis issue 0021019
+ if (!GEOMUtils::CheckShape(aShape, true))
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
- }
BOPAlgo_CheckerSI aCSI; // checker of self-interferences
for (i = 2; i <= nbShapes; i++) {
aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(i));
aShape2 = aRefShape->GetValue();
- anAna.Init(aShape2);
-
- if (!anAna.IsValid()) {
+
+ if (!GEOMUtils::CheckShape(aShape2, true))
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
- }
if (isCheckSelfInte) {
BOPCol_ListOfShape aList2;
if (!aShape.IsNull()) {
// check arguments for Mantis issue 0021019
- BRepCheck_Analyzer anAna (aShape, Standard_True);
-
- if (!anAna.IsValid()) {
+ if (!GEOMUtils::CheckShape(aShape, true))
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
- }
BOPAlgo_CheckerSI aCSI; // checker of self-interferences
for (i = 1; i <= nbShapes; i++) {
aRefTool = Handle(GEOM_Function)::DownCast(aTools->Value(i));
aTool = aRefTool->GetValue();
- anAna.Init(aTool);
- if (!anAna.IsValid()) {
+ if (!GEOMUtils::CheckShape(aTool, true))
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
- }
if (isCheckSelfInte) {
BOPCol_ListOfShape aList2;
}
// 08.07.2008 skl for bug 19761 from Mantis
- BRepCheck_Analyzer ana (aShape, Standard_True);
- ana.Init(aShape);
- if (!ana.IsValid()) {
- ShapeFix_ShapeTolerance aSFT;
- aSFT.LimitTolerance(aShape, Precision::Confusion(),
- Precision::Confusion(), TopAbs_SHAPE);
- Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
- aSfs->Perform();
- aShape = aSfs->Shape();
- ana.Init(aShape);
- if (!ana.IsValid())
- Standard_ConstructionError::Raise("Boolean operation aborted : non valid shape result");
- }
-
- // BEGIN: Mantis issue 0021060: always limit tolerance of BOP result
- // 1. Get shape parameters for comparison
- int nbTypes [TopAbs_SHAPE];
- {
- for (int iType = 0; iType < TopAbs_SHAPE; ++iType)
- nbTypes[iType] = 0;
- nbTypes[aShape.ShapeType()]++;
-
- TopTools_MapOfShape aMapOfShape;
- aMapOfShape.Add(aShape);
- TopTools_ListOfShape aListOfShape;
- aListOfShape.Append(aShape);
-
- TopTools_ListIteratorOfListOfShape itL (aListOfShape);
- for (; itL.More(); itL.Next()) {
- TopoDS_Iterator it (itL.Value());
- for (; it.More(); it.Next()) {
- TopoDS_Shape s = it.Value();
- if (aMapOfShape.Add(s)) {
- aListOfShape.Append(s);
- nbTypes[s.ShapeType()]++;
- }
- }
- }
- }
-
- // 2. Limit tolerance
- TopoDS_Shape aShapeCopy;
- TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
- TNaming_CopyShape::CopyTool(aShape, aMapTShapes, aShapeCopy);
- ShapeFix_ShapeTolerance aSFT;
- aSFT.LimitTolerance(aShapeCopy, Precision::Confusion(), Precision::Confusion(), TopAbs_SHAPE);
- Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape (aShapeCopy);
- aSfs->Perform();
- aShapeCopy = aSfs->Shape();
-
- // 3. Check parameters
- ana.Init(aShapeCopy);
- if (ana.IsValid()) {
- int iType, nbTypesCopy [TopAbs_SHAPE];
-
- for (iType = 0; iType < TopAbs_SHAPE; ++iType)
- nbTypesCopy[iType] = 0;
- nbTypesCopy[aShapeCopy.ShapeType()]++;
-
- TopTools_MapOfShape aMapOfShape;
- aMapOfShape.Add(aShapeCopy);
- TopTools_ListOfShape aListOfShape;
- aListOfShape.Append(aShapeCopy);
-
- TopTools_ListIteratorOfListOfShape itL (aListOfShape);
- for (; itL.More(); itL.Next()) {
- TopoDS_Iterator it (itL.Value());
- for (; it.More(); it.Next()) {
- TopoDS_Shape s = it.Value();
- if (aMapOfShape.Add(s)) {
- aListOfShape.Append(s);
- nbTypesCopy[s.ShapeType()]++;
- }
- }
- }
-
- bool isEqual = true;
- for (iType = 0; iType < TopAbs_SHAPE && isEqual; ++iType) {
- if (nbTypes[iType] != nbTypesCopy[iType])
- isEqual = false;
- }
- if (isEqual)
- aShape = aShapeCopy;
- }
- // END: Mantis issue 0021060
+ if ( !GEOMUtils::CheckShape(aShape, true) && !GEOMUtils::FixShapeTolerance(aShape) )
+ Standard_ConstructionError::Raise("Boolean operation aborted : non valid shape result");
return aShape;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <Standard_Stream.hxx>
-
#include <GEOMImpl_ChamferDriver.hxx>
#include <GEOMImpl_IChamfer.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOMImpl_ILocalOperations.hxx>
#include <GEOMImpl_Block6Explorer.hxx>
-
+#include <GEOMUtils.hxx>
#include <GEOM_Function.hxx>
#include <BRepLib.hxx>
#include <BRepTools.hxx>
#include <BRepFilletAPI_MakeChamfer.hxx>
-#include <ShapeFix_Shape.hxx>
-#include <ShapeFix_ShapeTolerance.hxx>
-
#include <TopAbs.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Iterator.hxx>
-#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <Precision.hxx>
-#include <gp_Pnt.hxx>
#include <StdFail_NotDone.hxx>
//=======================================================================
return aChamferDriver;
}
-
//=======================================================================
//function : GEOMImpl_ChamferDriver
//purpose :
if (!fill.IsDone()) {
StdFail_NotDone::Raise("Chamfer can not be computed on the given shape with the given parameters");
}
- aShape = fill.Shape();
+ aShape = GEOMUtils::ReduceCompound( fill.Shape() );
if (aShape.IsNull()) return 0;
// reduce tolerances
- ShapeFix_ShapeTolerance aSFT;
- aSFT.LimitTolerance(aShape, Precision::Confusion(),
- Precision::Confusion(), TopAbs_SHAPE);
- Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
- aSfs->Perform();
- aShape = aSfs->Shape();
+ GEOMUtils::FixShapeTolerance( aShape );
// fix SameParameter flag
BRepLib::SameParameter(aShape, 1.E-5, Standard_True);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GEOMImpl_CopyDriver.hxx"
#include "GEOMImpl_ICopy.hxx"
+#include "GEOMImpl_ITransferData.hxx"
#include "GEOMImpl_Types.hxx"
#include "GEOM_Function.hxx"
#include "GEOM_Object.hxx"
+#include "GEOMAlgo_GetInPlace.hxx"
+#include "GEOMAlgo_GetInPlaceAPI.hxx"
-#include <BRep_Tool.hxx>
-#include <gp_Pnt.hxx>
-#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopAbs.hxx>
+#include <TopExp.hxx>
#include <TNaming_CopyShape.hxx>
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
+#include <TFunction_Logbook.hxx>
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_MapIteratorOfMapOfShape.hxx>
+
+
+#define NB_DATUM 2
+#define DATUM_NAME_INDEX 1
+#define DATUM_MATERIAL_INDEX 2
+
//=======================================================================
//function : GetID
Standard_Integer aType = aFunction->GetType();
+ if (aType == TRANSFER_DATA) {
+ return transferData(log);
+ }
+
GEOMImpl_ICopy aCI (aFunction);
TopoDS_Shape aCopy;
return true;
}
+//================================================================================
+/*!
+ * \brief Performs Transfer Data operation.
+ */
+//================================================================================
+
+Standard_Integer GEOMImpl_CopyDriver::transferData(TFunction_Logbook& log) const
+{
+ Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
+ GEOMImpl_ITransferData aTD (aFunction);
+ Handle(GEOM_Function) aRef1 = aTD.GetRef1();
+ Handle(GEOM_Function) aRef2 = aTD.GetRef2();
+
+ if (aRef1.IsNull() || aRef2.IsNull()) {
+ return 0;
+ }
+
+ TopoDS_Shape aShape1 = aRef1->GetValue();
+ TopoDS_Shape aShape2 = aRef2->GetValue();
+ const int aFindMethod = aTD.GetFindMethod();
+ TopTools_IndexedDataMapOfShapeListOfShape aMapSoDest;
+ TopTools_IndexedMapOfShape anIndices1;
+
+ TopExp::MapShapes(aShape1, anIndices1);
+
+ switch (aFindMethod) {
+ case TD_GET_IN_PLACE:
+ if (!getInPlace(aShape1, anIndices1, aShape2, aMapSoDest)) {
+ return 0;
+ }
+ break;
+ case TD_GET_IN_PLACE_OLD:
+ if (!getInPlaceOld(aRef1, anIndices1, aShape2, aMapSoDest)) {
+ return 0;
+ }
+ break;
+ case TD_GET_IN_PLACE_BY_HISTORY:
+ if (!getInPlaceByHistory(aRef1, anIndices1, aShape2, aRef2, aMapSoDest)) {
+ return 0;
+ }
+ break;
+ default:
+ return 0;
+ }
+
+ // Perform copying names.
+ Handle(TColStd_HArray1OfExtendedString) aDatumName =
+ new TColStd_HArray1OfExtendedString(1, NB_DATUM);
+ Handle(TColStd_HArray1OfInteger) aDatumMaxVal =
+ new TColStd_HArray1OfInteger(1, NB_DATUM, 0);
+ Handle(TColStd_HArray1OfInteger) aDatumVal =
+ new TColStd_HArray1OfInteger(1, NB_DATUM, 0);
+ GEOMImpl_ITransferData aTD1(aRef1);
+ GEOMImpl_ITransferData aTD2(aRef2);
+ Standard_Integer i;
+ Standard_Integer aNbShapes = anIndices1.Extent();
+ TopTools_MapOfShape aMapFence;
+
+ aDatumName->SetValue(DATUM_NAME_INDEX, "GEOM_TRANSFER_DATA_NAMES");
+ aDatumName->SetValue(DATUM_MATERIAL_INDEX, "GEOM_TRANSFER_DATA_MATERIALS");
+
+ for (i = 1; i <= aNbShapes; ++i) {
+ const TopoDS_Shape &aSource = anIndices1.FindKey(i);
+ TCollection_AsciiString aName = aTD1.GetName(aSource);
+ TCollection_AsciiString aMaterial = aTD1.GetMaterial(aSource);
+
+ // Transfer name
+ if (!aName.IsEmpty()) {
+ aDatumMaxVal->ChangeValue(DATUM_NAME_INDEX)++;
+
+ if (aMapSoDest.Contains(aSource)) {
+ aDatumVal->ChangeValue(DATUM_NAME_INDEX)++;
+
+ // Copy name to the list of subshapes of the second shape.
+ const TopTools_ListOfShape &aListDest =
+ aMapSoDest.FindFromKey(aSource);
+ TopTools_ListIteratorOfListOfShape anIt(aListDest);
+
+ for (; anIt.More(); anIt.Next()) {
+ const TopoDS_Shape &aShapeDest = anIt.Value();
+
+ if (aMapFence.Add(aShapeDest)) {
+ aTD2.SetName(aShapeDest, aName);
+ }
+ }
+ }
+ }
+
+ // Transfer Material
+ if (!aMaterial.IsEmpty()) {
+ aDatumMaxVal->ChangeValue(DATUM_MATERIAL_INDEX)++;
+
+ if (aMapSoDest.Contains(aSource)) {
+ aDatumVal->ChangeValue(DATUM_MATERIAL_INDEX)++;
+
+ // Copy material to the list of subshapes of the second shape.
+ const TopTools_ListOfShape &aListDest =
+ aMapSoDest.FindFromKey(aSource);
+ TopTools_ListIteratorOfListOfShape anIt(aListDest);
+
+ for (; anIt.More(); anIt.Next()) {
+ const TopoDS_Shape &aShapeDest = anIt.Value();
+
+ if (aMapFence.Add(aShapeDest)) {
+ aTD2.SetMaterial(aShapeDest, aMaterial);
+ }
+ }
+ }
+ }
+ }
+
+ // Store results.
+ aTD.SetDatumName(aDatumName);
+ aTD.SetDatumMaxVal(aDatumMaxVal);
+ aTD.SetDatumVal(aDatumVal);
+
+ return 1;
+}
+
+//================================================================================
+/*!
+ * \brief For each subshape of the source shape compute coinsident sub-shapes
+ * of the destination shape using GetInPlace method.
+ */
+//================================================================================
+
+Standard_Boolean GEOMImpl_CopyDriver::getInPlace
+ (const TopoDS_Shape &theSourceShape,
+ const TopTools_IndexedMapOfShape &theSourceIndices,
+ const TopoDS_Shape &theDestinationShape,
+ TopTools_IndexedDataMapOfShapeListOfShape &theMapSourceDest) const
+{
+ // Searching for the sub-shapes inside theDestinationShape shape
+ GEOMAlgo_GetInPlace aGIP;
+
+ if (!GEOMAlgo_GetInPlaceAPI::GetInPlace
+ (theDestinationShape, theSourceShape, aGIP)) {
+ return Standard_False;
+ }
+
+ const GEOMAlgo_DataMapOfShapeMapOfShape &aShapesIn = aGIP.ShapesIn();
+ const GEOMAlgo_DataMapOfShapeMapOfShape &aShapesOn = aGIP.ShapesOn();
+ Standard_Integer i;
+ Standard_Integer j;
+ Standard_Integer aNbShapes = theSourceIndices.Extent();
+
+ for (i = 1; i <= aNbShapes; ++i) {
+ const TopoDS_Shape &aSource = theSourceIndices.FindKey(i);
+ TopTools_ListOfShape aListShapes2;
+ TopTools_MapOfShape aMapShapes2;
+
+ for (j = 0; j < 2; ++j) {
+ const GEOMAlgo_DataMapOfShapeMapOfShape &aShapes2 =
+ j == 0 ? aShapesIn : aShapesOn;
+
+ if (aShapes2.IsBound(aSource)) {
+ const TopTools_MapOfShape &aMapShapesDest =
+ aShapes2.Find(aSource);
+ TopTools_MapIteratorOfMapOfShape aMapIter(aMapShapesDest);
+
+ for (; aMapIter.More(); aMapIter.Next()) {
+ const TopoDS_Shape &aShapeDest = aMapIter.Key();
+
+ if (aMapShapes2.Add(aShapeDest)) {
+ aListShapes2.Append(aShapeDest);
+ }
+ }
+ }
+ }
+
+ if (!aListShapes2.IsEmpty()) {
+ theMapSourceDest.Add(aSource, aListShapes2);
+ }
+ }
+
+ return Standard_True;
+}
+
+//================================================================================
+/*!
+ * \brief For each subshape of the source shape compute coinsident sub-shapes
+ * of the destination shape using an old implementation
+ * of GetInPlace algorithm.
+ */
+//================================================================================
+
+Standard_Boolean GEOMImpl_CopyDriver::getInPlaceOld
+ (const Handle(GEOM_Function) &theSourceRef,
+ const TopTools_IndexedMapOfShape &theSourceIndices,
+ const TopoDS_Shape &theDestinationShape,
+ TopTools_IndexedDataMapOfShapeListOfShape &theMapSourceDest) const
+{
+ const Standard_Integer aNbShapes = theSourceIndices.Extent();
+ Standard_Integer i;
+ Standard_Integer iErr;
+ TopTools_ListOfShape aModifiedList;
+ GEOMImpl_ITransferData aTDSource(theSourceRef);
+
+ for (i = 1; i <= aNbShapes; ++i) {
+ const TopoDS_Shape &aSource = theSourceIndices.FindKey(i);
+ TCollection_AsciiString aName = aTDSource.GetName(aSource);
+ TCollection_AsciiString aMaterial = aTDSource.GetMaterial(aSource);
+
+ if (aName.IsEmpty() && aMaterial.IsEmpty()) {
+ continue;
+ }
+
+ // Call old GetInPlace.
+ iErr = GEOMAlgo_GetInPlaceAPI::GetInPlaceOld
+ (theDestinationShape, aSource, aModifiedList);
+
+ if (iErr == 3) {
+ // Nothing is found. Skip.
+ continue;
+ }
+
+ if (iErr) {
+ // Error.
+ return Standard_False;
+ }
+
+ theMapSourceDest.Add(aSource, aModifiedList);
+ }
+
+ return Standard_True;
+}
+
+//================================================================================
+/*!
+ * \brief For each subshape of the source shape compute coinsident sub-shapes
+ * of the destination shape using GetInPlaceByHistory algorithm.
+ */
+//================================================================================
+
+Standard_Boolean GEOMImpl_CopyDriver::getInPlaceByHistory
+ (const Handle(GEOM_Function) &theSourceRef,
+ const TopTools_IndexedMapOfShape &theSourceIndices,
+ const TopoDS_Shape &theDestinationShape,
+ const Handle(GEOM_Function) &theDestinationRef,
+ TopTools_IndexedDataMapOfShapeListOfShape &theMapSourceDest) const
+{
+ const Standard_Integer aNbShapes = theSourceIndices.Extent();
+ Standard_Integer i;
+ GEOMImpl_ITransferData aTDSource(theSourceRef);
+ TopTools_IndexedMapOfShape aDestIndices;
+
+ TopExp::MapShapes(theDestinationShape, aDestIndices);
+
+ for (i = 1; i <= aNbShapes; ++i) {
+ const TopoDS_Shape &aSource = theSourceIndices.FindKey(i);
+ TCollection_AsciiString aName = aTDSource.GetName(aSource);
+ TCollection_AsciiString aMaterial = aTDSource.GetMaterial(aSource);
+
+ if (aName.IsEmpty() && aMaterial.IsEmpty()) {
+ continue;
+ }
+
+ // Call GetInPlaceByHistory.
+ TopTools_ListOfShape aModifiedList;
+ const Standard_Boolean isFound = GEOMAlgo_GetInPlaceAPI::GetInPlaceByHistory
+ (theDestinationRef, aDestIndices, aSource, aModifiedList);
+
+ if (isFound && !aModifiedList.IsEmpty()) {
+ theMapSourceDest.Add(aSource, aModifiedList);
+ }
+ }
+
+ return Standard_True;
+}
+
IMPLEMENT_STANDARD_HANDLE (GEOMImpl_CopyDriver,GEOM_BaseDriver);
IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_CopyDriver,GEOM_BaseDriver);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#ifndef _GEOMImpl_CopyDriver_HeaderFile
#define _GEOMImpl_CopyDriver_HeaderFile
-#ifndef _TColStd_SequenceOfExtendedString_HeaderFile
-#include <TColStd_SequenceOfExtendedString.hxx>
-#endif
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-
-#ifndef _TFunction_Driver_HeaderFile
-#include <TFunction_Driver.hxx>
-#endif
-#ifndef _TFunction_Logbook_HeaderFile
-#include <TFunction_Logbook.hxx>
-#endif
-#ifndef _Standard_CString_HeaderFile
-#include <Standard_CString.hxx>
-#endif
-
-class TColStd_SequenceOfExtendedString;
+class TopoDS_Shape;
+class TopTools_IndexedDataMapOfShapeListOfShape;
+class TopTools_IndexedMapOfShape;
+class Standard_GUID;
#include "GEOM_BaseDriver.hxx"
+
DEFINE_STANDARD_HANDLE( GEOMImpl_CopyDriver, GEOM_BaseDriver );
class GEOMImpl_CopyDriver : public GEOM_BaseDriver {
std::vector<GEOM_Param>& params);
DEFINE_STANDARD_RTTI( GEOMImpl_CopyDriver )
+
+private:
+
+ Standard_Integer transferData(TFunction_Logbook& log) const;
+
+ Standard_Boolean getInPlace
+ (const TopoDS_Shape &theSourceShape,
+ const TopTools_IndexedMapOfShape &theSourceIndices,
+ const TopoDS_Shape &theDestinationShape,
+ TopTools_IndexedDataMapOfShapeListOfShape &theMapSourceDest) const;
+
+ Standard_Boolean getInPlaceOld
+ (const Handle(GEOM_Function) &theSourceShapeRef,
+ const TopTools_IndexedMapOfShape &theSourceIndices,
+ const TopoDS_Shape &theDestinationShape,
+ TopTools_IndexedDataMapOfShapeListOfShape &theMapSourceDest) const;
+
+ Standard_Boolean getInPlaceByHistory
+ (const Handle(GEOM_Function) &theSourceShapeRef,
+ const TopTools_IndexedMapOfShape &theSourceIndices,
+ const TopoDS_Shape &theDestinationShape,
+ const Handle(GEOM_Function) &theDestinationRef,
+ TopTools_IndexedDataMapOfShapeListOfShape &theMapSourceDest) const;
+
};
#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()));
MC.Build();
if (!MC.IsDone()) {
- StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
+ StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
}
aShape = MC.Shape();
break;
BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()), aCI.GetA());
MC.Build();
if (!MC.IsDone()) {
- StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters. Failure.");
+ StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters. Failure.");
}
aShape = MC.Shape();
break;
AddParam( theParams, "Radius", aCI.GetR() );
AddParam( theParams, "Height", aCI.GetH() );
break;
- case CONE_PNT_VEC_R1_R2_H:
+ case CYLINDER_R_H_A:
+ AddParam( theParams, "Radius", aCI.GetR() );
+ AddParam( theParams, "Height", aCI.GetH() );
+ AddParam( theParams, "Angle", aCI.GetA() );
+ break;
+ case CYLINDER_PNT_VEC_R_H:
AddParam( theParams, "Base Point", aCI.GetPoint() );
AddParam( theParams, "Vector", aCI.GetVector() );
AddParam( theParams, "Radius", aCI.GetR() );
AddParam( theParams, "Height", aCI.GetH() );
break;
+ case CYLINDER_PNT_VEC_R_H_A:
+ AddParam( theParams, "Base Point", aCI.GetPoint() );
+ AddParam( theParams, "Vector", aCI.GetVector() );
+ AddParam( theParams, "Radius", aCI.GetR() );
+ AddParam( theParams, "Height", aCI.GetH() );
+ AddParam( theParams, "Angle", aCI.GetA() );
+ break;
default:
return false;
}
-
+
return true;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <Standard_ConstructionError.hxx>
#include <Precision.hxx>
+#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Circ.hxx>
TopExp::Vertices(anE, V1, V2, Standard_True);
if (!V1.IsNull() && !V2.IsNull()) {
gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
- gp_Ax2 anAxes (aP, -aV);
- gp_Circ aCirc (anAxes, aCI.GetRadius());
+ gp_Ax2 anAxes (aP, aV);
+ gp_Ax3 anAxes3(anAxes);
+ gp_Pln aPln(anAxes3);
+ gp_Ax2 anAxes1(aP, -aV);
+ gp_Circ aCirc (anAxes1, aCI.GetRadius());
TopoDS_Shape aCircle = BRepBuilderAPI_MakeEdge(aCirc).Edge();
BRepBuilderAPI_MakeWire MW;
MW.Add(TopoDS::Edge(aCircle));
- BRepBuilderAPI_MakeFace MF (MW, Standard_False);
+ BRepBuilderAPI_MakeFace MF (aPln, MW);
aShape = MF.Shape();
}
}
if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular()))
Standard_ConstructionError::Raise("Disk creation aborted: points lay on one line");
Handle(Geom_Circle) aCirc = GC_MakeCircle(aP3, aP2, aP1).Value();
+ gp_Circ aGpCirc = aCirc->Circ();
+ gp_Ax2 anAxes = aGpCirc.Position();
+ gp_Ax3 anAxes3(anAxes.Location(), -anAxes.Direction());
+ gp_Pln aPln(anAxes3);
TopoDS_Shape aCircle = BRepBuilderAPI_MakeEdge(aCirc).Edge();
BRepBuilderAPI_MakeWire MW;
MW.Add(TopoDS::Edge(aCircle));
- BRepBuilderAPI_MakeFace MF (MW, Standard_False);
+ BRepBuilderAPI_MakeFace MF (aPln, MW);
aShape = MF.Shape();
}
}
else if (anOrient == 3)
aV = gp::DY();
- gp_Ax2 anAxes (aP, -aV);
- gp_Circ aCirc (anAxes, aCI.GetRadius());
+ gp_Ax2 anAxes (aP, aV);
+ gp_Ax2 anAxes1(aP, -aV);
+ gp_Ax3 anAxes3(anAxes);
+ gp_Pln aPln(anAxes3);
+ gp_Circ aCirc (anAxes1, aCI.GetRadius());
TopoDS_Shape aCircle = BRepBuilderAPI_MakeEdge(aCirc).Edge();
BRepBuilderAPI_MakeWire MW;
MW.Add(TopoDS::Edge(aCircle));
- BRepBuilderAPI_MakeFace MF (MW, Standard_False);
+ BRepBuilderAPI_MakeFace MF (aPln, MW);
aShape = MF.Shape();
}
else {
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
AddParam( theParams, "Step", data.GetStepID() );
AddParam( theParams, "Stamp", data.GetStepStamp() );
}
+ else if ( funType == GEOM_Field::FUN_CHANGE_COMP_NAMES )
+ {
+ theOperationName = "Change component names";
+ }
+ else if ( funType == GEOM_Field::FUN_CHANGE_STEP_STAMP )
+ {
+ theOperationName = "Change stamp";
+ AddParam( theParams, "Stamp", data.GetStepStamp() );
+ }
+ else if ( funType == GEOM_Field::FUN_CHANGE_VALUE )
+ {
+ theOperationName = "FIELD_EDIT";//"Change values";
+ AddParam( theParams, "Values", "..." );
+ }
else
{
return false;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <Precision.hxx>
#include <TColStd_ListIteratorOfListOfReal.hxx>
#include <IntRes2d_IntersectionSegment.hxx>
+#include <TopExp.hxx>
+
+
+/**
+ * This function returns Standard_True if it is possible to divide edge, i.e.
+ * if one parameter either start or end one is inside the edge. This function
+ * is used in the method GEOMImpl_Fillet1d::Result.
+ *
+ * \param theEdge the edge
+ * \param theStart the start parameter
+ * \param theEnd the end parameter
+ * \return Standard_True if it is possible to split edge;
+ * Standard_False otherwise.
+ */
+static Standard_Boolean IsDivideEdge(const TopoDS_Edge &theEdge,
+ const Standard_Real theStart,
+ const Standard_Real theEnd)
+{
+ Standard_Real aFirst;
+ Standard_Real aLast;
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aFirst, aLast);
+ gp_Pnt aPStart = aCurve->Value(theStart);
+ gp_Pnt aPEnd = aCurve->Value(theEnd);
+ TopoDS_Vertex aVFirst = TopExp::FirstVertex(theEdge);
+ TopoDS_Vertex aVLast = TopExp::FirstVertex(theEdge);
+ Standard_Real aTolFirst = BRep_Tool::Tolerance(aVFirst);
+ Standard_Real aTolLast = BRep_Tool::Tolerance(aVLast);
+ Standard_Real aTolConf = Precision::Confusion();
+ gp_Pnt aPFirst = BRep_Tool::Pnt(aVFirst);
+ gp_Pnt aPLast = BRep_Tool::Pnt(aVLast);
+ Standard_Real aDistSF = aPStart.Distance(aPFirst);
+ Standard_Real aDistSL = aPStart.Distance(aPLast);
+ Standard_Real aDistEF = aPEnd.Distance(aPFirst);
+ Standard_Real aDistEL = aPEnd.Distance(aPLast);
+ Standard_Boolean isSplit = Standard_True;
+
+ if (aDistSF <= aTolFirst + aTolConf ||
+ aDistSL <= aTolLast + aTolConf) {
+ if (aDistEF <= aTolFirst + aTolConf ||
+ aDistEL <= aTolLast + aTolConf) {
+ isSplit = Standard_False;
+ }
+ }
+
+ return isSplit;
+}
/**
* class GEOMImpl_Fillet1d
else
anEnd = aNearest->GetParam();
- if (fabs(aStart - anEnd) > Precision::Confusion())
+ if (IsDivideEdge(myEdge1, aStart, anEnd))
{
//Divide edge
BRepBuilderAPI_MakeEdge aDivider1(aCurve, aStart, anEnd);
else
anEnd = aNearest->GetParam2();
- if (fabs(aStart - anEnd) > Precision::Confusion())
+ if (IsDivideEdge(myEdge2, aStart, anEnd))
{
BRepBuilderAPI_MakeEdge aDivider2(aCurve, aStart, anEnd);
if (myEdgesExchnged)
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
MakeFillet(aWireNew, aVertexListNew, rad, isFinalPass, aResult);
}
+ if (!GEOMUtils::CheckShape(aResult, true) &&
+ !GEOMUtils::FixShapeTolerance(aResult)) {
+ Standard_ConstructionError::Raise("Non valid shape result");
+ }
+
aFunction->SetValue(aResult);
log.SetTouched(Label());
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <Standard_Stream.hxx>
-
#include <GEOMImpl_Fillet2dDriver.hxx>
#include <GEOMImpl_IFillet2d.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOMImpl_ILocalOperations.hxx>
#include <GEOMImpl_Block6Explorer.hxx>
#include <GEOM_Function.hxx>
+#include <GEOMUtils.hxx>
#include <BRepFilletAPI_MakeFillet2d.hxx>
-#include <BRepCheck_Analyzer.hxx>
-#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
-#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopAbs.hxx>
-#include <TopExp_Explorer.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
-#include <ShapeFix_ShapeTolerance.hxx>
-#include <ShapeFix_Shape.hxx>
-
-#include <Precision.hxx>
-#include <gp_Pnt.hxx>
#include <StdFail_NotDone.hxx>
//=======================================================================
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <Standard_Stream.hxx>
-
#include <GEOMImpl_FilletDriver.hxx>
#include <GEOMImpl_IFillet.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOMImpl_ILocalOperations.hxx>
+#include <GEOMUtils.hxx>
#include <GEOM_Function.hxx>
#include <BRepFilletAPI_MakeFillet.hxx>
-#include <BRepCheck_Analyzer.hxx>
-#include <BRep_Tool.hxx>
-
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopAbs.hxx>
#include <TopExp_Explorer.hxx>
-
-#include <ShapeFix_ShapeTolerance.hxx>
-#include <ShapeFix_Shape.hxx>
-
-#include <Precision.hxx>
-#include <gp_Pnt.hxx>
#include <StdFail_NotDone.hxx>
+// Debug PipeTShape function: uncomment the macro below to correct tolerance
+// of resulting face after fillet creation
+// VSR 30/12/2014: macro disabled
+//#define FIX_FACE_TOLERANCE
+// Debug PipeTShape function: uncomment the macro below to correct tolerance
+// of resulting curves after fillet creation
+// VSR 30/12/2014: macro disabled
+//#define FIX_CURVES_TOLERANCES
+
//=======================================================================
//function : GetID
//purpose :
if (!fill.IsDone()) {
StdFail_NotDone::Raise("Fillet can't be computed on the given shape with the given radius");
}
- aShape = fill.Shape();
+ aShape = GEOMUtils::ReduceCompound( fill.Shape() );
if (aShape.IsNull()) return 0;
- // Check shape validity
- BRepCheck_Analyzer ana (aShape, false);
- if (!ana.IsValid()) {
- // 08.07.2008 added by skl during fixing bug 19761 from Mantis
- ShapeFix_ShapeTolerance aSFT;
- aSFT.LimitTolerance(aShape, Precision::Confusion(),
- Precision::Confusion(), TopAbs_SHAPE);
- Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
- aSfs->Perform();
- aShape = aSfs->Shape();
- ana.Init(aShape);
- if (!ana.IsValid())
- StdFail_NotDone::Raise("Fillet algorithm have produced an invalid shape result");
- }
+#if defined(FIX_CURVES_TOLERANCES)
+ bool isOk = GEOMUtils::FixShapeCurves(aShape);
+#elif defined(FIX_FACE_TOLERANCE)
+ bool isOk = GEOMUtils::FixShapeTolerance(aShape, TopAbs_FACE);
+#else
+ // 08.07.2008 added by skl during fixing bug 19761 from Mantis
+ bool isOk = GEOMUtils::CheckShape(aShape) || GEOMUtils::FixShapeTolerance(aShape);
+#endif
+ if ( !isOk )
+ StdFail_NotDone::Raise("Fillet algorithm have produced an invalid shape result");
aFunction->SetValue(aShape);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <Basics_OCCTVersion.hxx>
-#include <ShapeFix_Face.hxx>
-
-#include <BRep_Tool.hxx>
#include <BRepAlgo.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_Copy.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepOffsetAPI_MakeFilling.hxx>
-#include <TopAbs.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Vertex.hxx>
-
+#include <GeomAPI_PointsToBSpline.hxx>
+#include <GeomAPI_PointsToBSplineSurface.hxx>
+#include <GeomFill_AppSurf.hxx>
+#include <GeomFill_Line.hxx>
+#include <GeomFill_SectionGenerator.hxx>
+#include <Geom_BSplineCurve.hxx>
+#include <Geom_BSplineSurface.hxx>
+#include <Geom_BezierCurve.hxx>
+#include <Geom_Circle.hxx>
#include <Geom_Curve.hxx>
+#include <Geom_Ellipse.hxx>
+#include <Geom_Line.hxx>
#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
-#include <Geom_Line.hxx>
-#include <Geom_Circle.hxx>
-#include <Geom_Ellipse.hxx>
-#include <Geom_BezierCurve.hxx>
-#include <Geom_BSplineCurve.hxx>
-#include <Geom_BSplineSurface.hxx>
-#include <GeomFill_Line.hxx>
-#include <GeomFill_AppSurf.hxx>
-#include <GeomFill_SectionGenerator.hxx>
-#include <GeomAPI_PointsToBSplineSurface.hxx>
-#include <GeomAPI_PointsToBSpline.hxx>
-#include <TColGeom_SequenceOfCurve.hxx>
+#include <Precision.hxx>
+#include <ShapeFix_Face.hxx>
-#include <TColgp_SequenceOfPnt.hxx>
+#include <TColGeom_SequenceOfCurve.hxx>
#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
-#include <Precision.hxx>
+#include <TopAbs.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_SequenceOfShape.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
#include <Standard_ConstructionError.hxx>
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
if (aFunction.IsNull()) return 0;
- if (aFunction->GetType() != BASIC_FILLING) return 0;
-
- GEOMImpl_IFilling IF (aFunction);
- Handle(GEOM_Function) aShapeFunction = IF.GetShape();
- if (aShapeFunction.IsNull()) return 0;
-
TopoDS_Shape aShape;
- BRepBuilderAPI_Copy Copy (aShapeFunction->GetValue());
- if (Copy.IsDone())
- aShape = Copy.Shape();
-
- if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND) return 0;
-
- Standard_Integer mindeg = IF.GetMinDeg();
- Standard_Integer maxdeg = IF.GetMaxDeg();
- Standard_Real tol3d = IF.GetTol3D();
- Standard_Boolean isApprox = IF.GetApprox();
+ GEOMImpl_IFilling IF (aFunction);
+ if( aFunction->GetType() == BASIC_FILLING )
+ {
+ GEOMImpl_IFilling IF (aFunction);
+ Standard_Integer mindeg = IF.GetMinDeg();
+ Standard_Integer maxdeg = IF.GetMaxDeg();
+ Standard_Real tol3d = IF.GetTol3D();
+ Standard_Boolean isApprox = IF.GetApprox();
+
+ if (mindeg > maxdeg) {
+ Standard_RangeError::Raise("Minimal degree can not be more than maximal degree");
+ }
- if (mindeg > maxdeg) {
- Standard_RangeError::Raise("Minimal degree can not be more than maximal degree");
- }
+ /* we verify the contents of the shape */
+ TopExp_Explorer Ex;
+ TopoDS_Shape Scurrent;
+ Standard_Real First, Last;
+ Handle(Geom_Curve) C;
+
+ TopoDS_Compound aComp;
+ BRep_Builder B;
+ B.MakeCompound(aComp);
+
+ // input is either a list or compound of contours
+ TopTools_SequenceOfShape contours;
+ Handle(TColStd_HSequenceOfTransient) aShapeFunctions = IF.GetShapes();
+ if ( aShapeFunctions.IsNull() || aShapeFunctions->IsEmpty() ) return 0;
+ for ( int i = 1; i <= aShapeFunctions->Length(); ++i )
+ {
+ Handle(GEOM_Function) fun = Handle(GEOM_Function)::DownCast( aShapeFunctions->Value( i ));
+ if ( fun.IsNull() ) return 0;
+ TopoDS_Shape s = fun->GetValue();
+ if ( s.IsNull() ) return 0;
+ BRepBuilderAPI_Copy Copy (s);
+ if ( Copy.IsDone() )
+ contours.Append( Copy.Shape() );
+ }
- /* we verify the contents of the shape */
- TopExp_Explorer Ex;
- TopoDS_Shape Scurrent;
- Standard_Real First, Last;
- Handle(Geom_Curve) C;
-
- TopoDS_Compound aComp;
- BRep_Builder B;
- B.MakeCompound(aComp);
-
- // 1. Convert argument wires, if any, into BSpline edges
- TopoDS_Iterator It (aShape);
- for (; It.More(); It.Next()) {
- Scurrent = It.Value();
- if (Scurrent.ShapeType() != TopAbs_EDGE) {
- TopoDS_Edge NewEdge;
- if (Scurrent.ShapeType() == TopAbs_WIRE)
- {
- const TopoDS_Wire& CurWire = TopoDS::Wire(Scurrent);
- NewEdge = BRepAlgo::ConcatenateWireC0(CurWire);
- }
- if (NewEdge.IsNull()) {
- Standard_ConstructionError::Raise("The argument compound must contain only edges");
+ // 1. Convert argument wires, if any, into BSpline edges
+ for ( int i = 1; i <= contours.Length(); ++i )
+ {
+ Scurrent = contours.Value( i );
+ if (Scurrent.ShapeType() != TopAbs_EDGE) {
+
+ if (Scurrent.ShapeType() == TopAbs_WIRE)
+ {
+ const TopoDS_Wire& CurWire = TopoDS::Wire(Scurrent);
+ TopoDS_Edge NewEdge = BRepAlgo::ConcatenateWireC0(CurWire);
+ if (NewEdge.IsNull())
+ Standard_ConstructionError::Raise("Failed to join several edges into one");
+ Scurrent = NewEdge;
+ }
+ else if (Scurrent.ShapeType() == TopAbs_COMPOUND)
+ {
+ for ( TopoDS_Iterator It( Scurrent ); It.More(); It.Next() )
+ contours.Append( It.Value() );
+ continue;
+ }
+ else
+ {
+ Standard_ConstructionError::Raise("Input must contain only edges or/and wires");
+ }
}
- Scurrent = NewEdge;
+ B.Add(aComp,Scurrent);
}
- B.Add(aComp,Scurrent);
- }
- aShape = aComp;
-
- // 2. The surface construction
- if (!isApprox) {
- // make filling as in old version of SALOME (before 4.1.1)
-
- Standard_Real tol2d = IF.GetTol2D();
- Standard_Integer nbiter = IF.GetNbIter();
- Standard_Integer aMethod = IF.GetMethod();
-
- GeomFill_SectionGenerator Section;
- Standard_Integer i = 0;
- Handle(Geom_Curve) aLastC;
- gp_Pnt PL1,PL2;
- for (Ex.Init(aShape, TopAbs_EDGE); Ex.More(); Ex.Next()) {
- Scurrent = Ex.Current();
- if (Scurrent.IsNull() || Scurrent.ShapeType() != TopAbs_EDGE) return 0;
- if (BRep_Tool::Degenerated(TopoDS::Edge(Scurrent))) continue;
- C = BRep_Tool::Curve(TopoDS::Edge(Scurrent), First, Last);
- //if (Scurrent.Orientation() == TopAbs_REVERSED)
- // // Mantis isuue 0020659: consider the orientation of the edges
- // C = new Geom_TrimmedCurve(C, Last, First);
- //else
- // C = new Geom_TrimmedCurve(C, First, Last);
- C = new Geom_TrimmedCurve(C, First, Last);
- gp_Pnt P1,P2;
- C->D0(First,P1);
- C->D0(Last,P2);
-
- if (aMethod == 1 && Scurrent.Orientation() == TopAbs_REVERSED) {
- C->Reverse();
- }
- else if (aMethod == 2) {
- if (i == 0) {
- PL1 = P1;
- PL2 = P2;
+ aShape = aComp;
+
+ // 2. The surface construction
+ if (!isApprox) {
+ // make filling as in old version of SALOME (before 4.1.1)
+
+ Standard_Real tol2d = IF.GetTol2D();
+ Standard_Integer nbiter = IF.GetNbIter();
+ Standard_Integer aMethod = IF.GetMethod();
+
+ GeomFill_SectionGenerator Section;
+ Standard_Integer i = 0;
+ Handle(Geom_Curve) aLastC;
+ gp_Pnt PL1,PL2;
+ for (Ex.Init(aShape, TopAbs_EDGE); Ex.More(); Ex.Next()) {
+ Scurrent = Ex.Current();
+ if (Scurrent.IsNull() || Scurrent.ShapeType() != TopAbs_EDGE) return 0;
+ if (BRep_Tool::Degenerated(TopoDS::Edge(Scurrent))) continue;
+ C = BRep_Tool::Curve(TopoDS::Edge(Scurrent), First, Last);
+ //if (Scurrent.Orientation() == TopAbs_REVERSED)
+ // // Mantis isuue 0020659: consider the orientation of the edges
+ // C = new Geom_TrimmedCurve(C, Last, First);
+ //else
+ // C = new Geom_TrimmedCurve(C, First, Last);
+ C = new Geom_TrimmedCurve(C, First, Last);
+ gp_Pnt P1,P2;
+ C->D0(First,P1);
+ C->D0(Last,P2);
+
+ if (aMethod == 1 && Scurrent.Orientation() == TopAbs_REVERSED) {
+ C->Reverse();
}
- else {
- double d1 = PL1.Distance(P1) + PL2.Distance(P2);
- double d2 = PL1.Distance(P2) + PL2.Distance(P1);
- if (d2 < d1) {
- C->Reverse();
- PL1 = P2;
- PL2 = P1;
- }
- else {
+ else if (aMethod == 2) {
+ if (i == 0) {
PL1 = P1;
PL2 = P2;
}
+ else {
+ double d1 = PL1.Distance(P1) + PL2.Distance(P2);
+ double d2 = PL1.Distance(P2) + PL2.Distance(P1);
+ if (d2 < d1) {
+ C->Reverse();
+ PL1 = P2;
+ PL2 = P1;
+ }
+ else {
+ PL1 = P1;
+ PL2 = P2;
+ }
+ }
}
- }
- Section.AddCurve(C);
- i++;
- }
+ Section.AddCurve(C);
+ i++;
+ }
- /* a 'tolerance' is used to compare 2 knots : see GeomFill_Generator.cdl */
- Section.Perform(Precision::Confusion());
- Handle(GeomFill_Line) Line = new GeomFill_Line(i);
+ /* a 'tolerance' is used to compare 2 knots : see GeomFill_Generator.cdl */
+ Section.Perform(Precision::PConfusion());
+ Handle(GeomFill_Line) Line = new GeomFill_Line(i);
- GeomFill_AppSurf App (mindeg, maxdeg, tol3d, tol2d, nbiter); /* user parameters */
- App.Perform(Line, Section);
+ GeomFill_AppSurf App (mindeg, maxdeg, tol3d, tol2d, nbiter); /* user parameters */
+ App.Perform(Line, Section);
- if (!App.IsDone()) return 0;
- Standard_Integer UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots;
- App.SurfShape(UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots);
- Handle(Geom_BSplineSurface) GBS = new Geom_BSplineSurface
- (App.SurfPoles(), App.SurfWeights(), App.SurfUKnots(), App.SurfVKnots(),
- App.SurfUMults(), App.SurfVMults(), App.UDegree(), App.VDegree());
+ if (!App.IsDone()) return 0;
+ Standard_Integer UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots;
+ App.SurfShape(UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots);
+ Handle(Geom_BSplineSurface) GBS = new Geom_BSplineSurface
+ (App.SurfPoles(), App.SurfWeights(), App.SurfUKnots(), App.SurfVKnots(),
+ App.SurfUMults(), App.SurfVMults(), App.UDegree(), App.VDegree());
- if (GBS.IsNull()) return 0;
- aShape = BRepBuilderAPI_MakeFace(GBS, Precision::Confusion());
- }
- else {
- // implemented by skl 20.03.2008 for bug 16568
- // make approximation - try to create bspline surface
- // using GeomAPI_PointsToBSplineSurface
-
- TColGeom_SequenceOfCurve aSeq;
- int MaxNbPoles = 0;
-
- // add curves from edges to sequence and find maximal
- // number of poles if some of them are bsplines
- for (Ex.Init(aShape, TopAbs_EDGE); Ex.More(); Ex.Next()) {
- Scurrent = Ex.Current();
- if (Scurrent.IsNull() || Scurrent.ShapeType() != TopAbs_EDGE) return 0;
- if (BRep_Tool::Degenerated(TopoDS::Edge(Scurrent))) continue;
- C = BRep_Tool::Curve(TopoDS::Edge(Scurrent), First, Last);
- Handle(Geom_TrimmedCurve) TC = Handle(Geom_TrimmedCurve)::DownCast(C);
- if (TC.IsNull()) {
- Handle(Geom_BSplineCurve) BC = Handle(Geom_BSplineCurve)::DownCast(C);
- if (!BC.IsNull()) {
- MaxNbPoles = Max(MaxNbPoles,BC->NbPoles());
+ if (GBS.IsNull()) return 0;
+ aShape = BRepBuilderAPI_MakeFace(GBS, Precision::Confusion());
+ }
+ else {
+ // implemented by skl 20.03.2008 for bug 16568
+ // make approximation - try to create bspline surface
+ // using GeomAPI_PointsToBSplineSurface
+
+ TColGeom_SequenceOfCurve aSeq;
+ int MaxNbPoles = 0;
+
+ // add curves from edges to sequence and find maximal
+ // number of poles if some of them are bsplines
+ for (Ex.Init(aShape, TopAbs_EDGE); Ex.More(); Ex.Next()) {
+ Scurrent = Ex.Current();
+ if (Scurrent.IsNull() || Scurrent.ShapeType() != TopAbs_EDGE) return 0;
+ if (BRep_Tool::Degenerated(TopoDS::Edge(Scurrent))) continue;
+ C = BRep_Tool::Curve(TopoDS::Edge(Scurrent), First, Last);
+ Handle(Geom_TrimmedCurve) TC = Handle(Geom_TrimmedCurve)::DownCast(C);
+ if (TC.IsNull()) {
+ Handle(Geom_BSplineCurve) BC = Handle(Geom_BSplineCurve)::DownCast(C);
+ if (!BC.IsNull()) {
+ MaxNbPoles = Max(MaxNbPoles,BC->NbPoles());
+ }
}
- }
- else {
- Handle(Geom_BSplineCurve) BC = Handle(Geom_BSplineCurve)::DownCast(TC->BasisCurve());
- if (BC.IsNull()) {
- Handle(Geom_TrimmedCurve) TC1 = Handle(Geom_TrimmedCurve)::DownCast(TC->BasisCurve());
- if (!TC1.IsNull()) {
- BC = Handle(Geom_BSplineCurve)::DownCast(TC1->BasisCurve());
+ else {
+ Handle(Geom_BSplineCurve) BC = Handle(Geom_BSplineCurve)::DownCast(TC->BasisCurve());
+ if (BC.IsNull()) {
+ Handle(Geom_TrimmedCurve) TC1 = Handle(Geom_TrimmedCurve)::DownCast(TC->BasisCurve());
+ if (!TC1.IsNull()) {
+ BC = Handle(Geom_BSplineCurve)::DownCast(TC1->BasisCurve());
+ }
+ }
+ if (!BC.IsNull()) {
+ MaxNbPoles = Max(MaxNbPoles,BC->NbPoles());
}
}
- if (!BC.IsNull()) {
- MaxNbPoles = Max(MaxNbPoles,BC->NbPoles());
+ aSeq.Append(C);
+ }
+ // prepare array of points for creation bspline surface
+ // size of this array: by U parameter - number of curves,
+ // by V parameter - determ using MaxNbPoles but it's
+ // value must be between 21(min) and 101(max)
+ int nbc = aSeq.Length();
+ int nbp = Max(21, 2*MaxNbPoles-1);
+
+ // commented for Mantis issue 0021541
+ //if (nbp > 101) nbp = 101;
+
+ TColgp_Array2OfPnt Points (1, nbc, 1, nbp);
+ int ic = 1;
+ for (; ic <= nbc; ic++) {
+ Handle(Geom_Curve) C = aSeq.Value(ic);
+ double fp = C->FirstParameter();
+ double lp = C->LastParameter();
+ double dp = (lp-fp)/(nbp-1);
+ int j = 0;
+ gp_Pnt P;
+ for (; j < nbp; j++) {
+ C->D0(fp+dp*j, P);
+ Points.SetValue(ic, j+1, P);
+ }
+ }
+ GeomAPI_PointsToBSplineSurface PTB (Points, mindeg, maxdeg, GeomAbs_C2, tol3d);
+ Handle(Geom_BSplineSurface) BS = PTB.Surface();
+ BRepBuilderAPI_MakeFace BB (BS, Precision::Confusion());
+ TopoDS_Face NewF = BB.Face();
+ Handle(ShapeFix_Face) sff = new ShapeFix_Face (NewF);
+ sff->Perform();
+ sff->FixOrientation();
+ aShape = sff->Face();
+ }
+ }
+ else if( aFunction->GetType() == FILLING_ON_CONSTRAINTS )
+ {
+ BRepOffsetAPI_MakeFilling MakeFilling;
+
+ Handle(TColStd_HSequenceOfTransient) aConstraints = IF.GetShapes();
+
+ for ( unsigned int ind = 1; ind <= aConstraints->Length(); ind++ ) {
+ TopoDS_Edge E;
+ TopoDS_Face F;
+ Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast( aConstraints->Value(ind) );
+ if ( !aRefShape->GetValue().IsNull() && aRefShape->GetValue().ShapeType() == TopAbs_EDGE )
+ E = TopoDS::Edge(aRefShape->GetValue() );
+ else {
+ Standard_RangeError::Raise("Wrong parameters");
+ }
+ if ( ind < aConstraints->Length() ) {
+ Handle(GEOM_Function) aRefFaceShape = Handle(GEOM_Function)::DownCast( aConstraints->Value(ind+1) );
+ if ( !aRefFaceShape->GetValue().IsNull() && aRefFaceShape->GetValue().ShapeType() == TopAbs_FACE ) {
+ F = TopoDS::Face( aRefFaceShape->GetValue() );
+ ind++;
}
}
- aSeq.Append(C);
+ if ( !F.IsNull() )
+ MakeFilling.Add( E, F, GeomAbs_G1 );
+ else
+ MakeFilling.Add( E, GeomAbs_C0 );
}
- // prepare array of points for creation bspline surface
- // size of this array: by U parameter - number of curves,
- // by V parameter - determ using MaxNbPoles but it's
- // value must be between 21(min) and 101(max)
- int nbc = aSeq.Length();
- int nbp = Max(21, 2*MaxNbPoles-1);
-
- // commented for Mantis issue 0021541
- //if (nbp > 101) nbp = 101;
-
- TColgp_Array2OfPnt Points (1, nbc, 1, nbp);
- int ic = 1;
- for (; ic <= nbc; ic++) {
- Handle(Geom_Curve) C = aSeq.Value(ic);
- double fp = C->FirstParameter();
- double lp = C->LastParameter();
- double dp = (lp-fp)/(nbp-1);
- int j = 0;
- gp_Pnt P;
- for (; j < nbp; j++) {
- C->D0(fp+dp*j, P);
- Points.SetValue(ic, j+1, P);
- }
+
+ MakeFilling.Build();
+ if ( !MakeFilling.IsDone() )
+ {
+ Standard_RangeError::Raise("Filling on constraints failed");
}
- GeomAPI_PointsToBSplineSurface PTB (Points, mindeg, maxdeg, GeomAbs_C2, tol3d);
- Handle(Geom_BSplineSurface) BS = PTB.Surface();
- BRepBuilderAPI_MakeFace BB (BS, Precision::Confusion());
- TopoDS_Face NewF = BB.Face();
- Handle(ShapeFix_Face) sff = new ShapeFix_Face (NewF);
- sff->Perform();
- sff->FixOrientation();
- aShape = sff->Face();
+
+ aShape = TopoDS::Face( MakeFilling.Shape() );
}
/* We test the validity of resulting shape */
if (!BRepAlgo::IsValid((aShape))) {
Standard_ConstructionError::Raise("Algorithm has produced an invalid shape result");
- return 0;
}
aFunction->SetValue(aShape);
switch ( aType ) {
case BASIC_FILLING:
{
- AddParam( theParams, "Input compound", aCI.GetShape() );
+ AddParam( theParams, "Input compound", aCI.GetShapes() );
AddParam( theParams, "Method", aCI.GetMethod() );
const char* method[3] =
{ "Standard", "Use edges orientation", "Correct edges orientation" };
AddParam( theParams, "Approximation", aCI.GetApprox() );
break;
}
+ case FILLING_ON_CONSTRAINTS:
+ {
+ theOperationName = "FACE";
+ AddParam( theParams, "Edges/Faces", aCI.GetShapes() );
+ break;
+ }
default:
return false;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "utilities.h"
+#include <BRep_Builder.hxx>
+#include <ShapeFix_Shape.hxx>
#include <TDataStd_IntegerArray.hxx>
-
#include <TopExp.hxx>
-#include <TopoDS_Shape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
-
-#include <ShapeFix_Shape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopoDS_Shape.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_Failure.hxx>
//function : GlueFaces
//purpose :
//=======================================================================
-TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
- const Standard_Real theTolerance,
- const Standard_Boolean doKeepNonSolids)
+TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces
+ (const TopoDS_Shape &theShape,
+ const Standard_Real theTolerance,
+ const Standard_Boolean doKeepNonSolids,
+ TopTools_DataMapOfShapeListOfShape *pMapModif)
{
TopoDS_Shape aRes;
// 5. Result
aRes = aGA.Shape();
+ if (pMapModif) {
+ // Fill the map of modified shapes.
+ TopTools_IndexedMapOfShape aMapSubShapes;
+
+ TopExp::MapShapes(theShape, aMapSubShapes);
+ pMapModif->Clear();
+
+ const Standard_Integer aNbShapes = aMapSubShapes.Extent();
+ Standard_Integer i;
+
+ for (i = 1; i <= aNbShapes; ++i) {
+ const TopoDS_Shape &aSubShape = aMapSubShapes.FindKey(i);
+ const TopTools_ListOfShape &aModif = aGA.Modified(aSubShape);
+
+ if (!aModif.IsEmpty()) {
+ pMapModif->Bind(aSubShape, aModif);
+ }
+ }
+ }
+
return aRes;
}
TopoDS_Shape aShape;
TCollection_AsciiString aWrn;
- Handle(GEOM_Function) aRefBase = aCI.GetBase();
- TopoDS_Shape aShapeBase = aRefBase->GetValue();
+ TopoDS_Shape aShapeBase;
+ Handle(TColStd_HSequenceOfTransient) aRefBases = aCI.GetBase();
+ if ( aRefBases && !aRefBases->IsEmpty() )
+ {
+ if ( aRefBases->Length() == 1 )
+ {
+ Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aRefBases->Value(1));
+ if ( !aRefShape.IsNull() )
+ aShapeBase = aRefShape->GetValue();
+ }
+ else
+ {
+ TopoDS_Compound compound;
+ BRep_Builder builder;
+ builder.MakeCompound( compound );
+ int ind = 1;
+ for ( ; ind <= aRefBases->Length(); ind++)
+ {
+ Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aRefBases->Value(ind));
+ if ( aRefShape.IsNull() ) break;
+ TopoDS_Shape aShape = aRefShape->GetValue();
+ if (aShape.IsNull()) break;
+ builder.Add( compound, aShape );
+ }
+ if ( ind > aRefBases->Length() )
+ aShapeBase = compound;
+ else
+ aShapeBase.Nullify();
+ }
+ }
if (aShapeBase.IsNull()) {
Standard_NullObject::Raise("Shape for gluing is null");
}
switch ( aType ) {
case GLUE_FACES:
theOperationName = "GLUE_FACES";
- AddParam( theParams, "Selected shape", aCI.GetBase() );
+ AddParam( theParams, "Selected shapes", aCI.GetBase() );
AddParam( theParams, "Tolerance", aCI.GetTolerance() );
AddParam( theParams, "To keep non solids", aCI.GetKeepNonSolids() );
break;
case GLUE_EDGES:
theOperationName = "GLUE_EDGES";
- AddParam( theParams, "Selected shape", aCI.GetBase() );
+ AddParam( theParams, "Selected shapes", aCI.GetBase() );
AddParam( theParams, "Tolerance", aCI.GetTolerance() );
break;
case GLUE_FACES_BY_LIST:
theOperationName = "GLUE_FACES";
- AddParam( theParams, "Selected shape", aCI.GetBase() );
+ AddParam( theParams, "Selected shapes", aCI.GetBase() );
AddParam( theParams, "Tolerance", aCI.GetTolerance() );
AddParam( theParams, "Faces", aCI.GetFaces() );
AddParam( theParams, "To keep non solids", aCI.GetKeepNonSolids() );
break;
case GLUE_EDGES_BY_LIST:
theOperationName = "GLUE_EDGES";
- AddParam( theParams, "Selected shape", aCI.GetBase() );
+ AddParam( theParams, "Selected shapes", aCI.GetBase() );
AddParam( theParams, "Tolerance", aCI.GetTolerance() );
AddParam( theParams, "Edges", aCI.GetFaces() );
break;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TCollection_AsciiString.hxx>
class TColStd_SequenceOfExtendedString;
+class TopTools_DataMapOfShapeListOfShape;
#include "GEOM_BaseDriver.hxx"
bool GetCreationInformation(std::string& theOperationName,
std::vector<GEOM_Param>& params);
-Standard_EXPORT static TopoDS_Shape GlueFaces (const TopoDS_Shape& theShape,
- const Standard_Real theTolerance,
- const Standard_Boolean doKeepNonSolids = Standard_True);
+Standard_EXPORT static TopoDS_Shape GlueFaces
+ (const TopoDS_Shape &theShape,
+ const Standard_Real theTolerance,
+ const Standard_Boolean doKeepNonSolids = Standard_True,
+ TopTools_DataMapOfShapeListOfShape *pMapModif = NULL);
/*
Standard_EXPORT TopoDS_Shape GlueFacesWithWarnings (const TopoDS_Shape& theShape,
const Standard_Real theTolerance,
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <Standard_Stream.hxx>
-
#include <GEOMImpl_HealingDriver.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOMImpl_IHealing.hxx>
#include <TNaming_CopyShape.hxx>
-#include <ShapeFix_ShapeTolerance.hxx>
-#include <ShapeFix_Shape.hxx>
-
#include <BRep_Builder.hxx>
#include <BRepAdaptor_Curve.hxx>
-#include <BRepCheck_Analyzer.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <TopExp.hxx>
Sew(&HI, anOriginalShape, aShape, true);
break;
case REMOVE_INTERNAL_FACES:
- RemoveInternalFaces(anOriginalShape, aShape);
+ RemoveInternalFaces(&HI, anOriginalShape, aShape);
break;
case DIVIDE_EDGE:
+ case DIVIDE_EDGE_BY_POINT:
AddPointOnEdge(&HI, anOriginalShape, aShape);
break;
case CHANGE_ORIENTATION:
if (!aHealer.isDone())
raiseNotDoneExeption( ShHealOper_NotError );
+ SaveStatistics( aHealer );
+
return Standard_True;
}
//function : SupressFaces
//purpose :
//=======================================================================
-void SuppressFacesRec (const TopTools_SequenceOfShape& theShapesFaces,
- const TopoDS_Shape& theOriginalShape,
- TopoDS_Shape& theOutShape)
+void GEOMImpl_HealingDriver::SuppressFacesRec (const TopTools_SequenceOfShape& theShapesFaces,
+ const TopoDS_Shape& theOriginalShape,
+ TopoDS_Shape& theOutShape) const
{
if ((theOriginalShape.ShapeType() != TopAbs_COMPOUND &&
theOriginalShape.ShapeType() != TopAbs_COMPSOLID))
theOutShape = GEOMImpl_GlueDriver::GlueFaces(aSh, Precision::Confusion(), Standard_True);
}
}
+ // count removed faces
+ TopTools_IndexedMapOfShape faces;
+ TopExp::MapShapes(theOriginalShape, TopAbs_FACE, faces);
+ int nbBefore = faces.Extent();
+ faces.Clear();
+ TopExp::MapShapes(theOutShape, TopAbs_FACE, faces);
+ int nbAfter = faces.Extent();
+
+ if ( nbAfter < nbBefore )
+ {
+ ShHealOper_Tool tool;
+ ShHealOper_ModifStats& stats = tool.GetStatistics();
+ stats.AddModif( "Face removed", nbBefore - nbAfter );
+ SaveStatistics( tool );
+ }
return Standard_True;
}
else
raiseNotDoneExeption( aHealer.GetErrorStatus() );
+ SaveStatistics( aHealer );
+
return aResult;
}
else
raiseNotDoneExeption( aHealer.GetErrorStatus() );
+ SaveStatistics( aHealer );
+
return aResult;
}
else
raiseNotDoneExeption( aHealer.GetErrorStatus() );
+ SaveStatistics( aHealer );
+
return aResult;
}
//function : Sew
//purpose :
//=======================================================================
-Standard_Boolean GEOMImpl_HealingDriver::Sew (GEOMImpl_IHealing* theHI,
+Standard_Boolean GEOMImpl_HealingDriver::Sew (GEOMImpl_IHealing* theHI,
const TopoDS_Shape& theOriginalShape,
- TopoDS_Shape& theOutShape,
- Standard_Boolean isAllowNonManifold) const
+ TopoDS_Shape& theOutShape,
+ Standard_Boolean isAllowNonManifold) const
{
Standard_Real aTol = theHI->GetTolerance();
- ShHealOper_Sewing aHealer (theOriginalShape, aTol);
+ TopoDS_Compound aCompound;
+ BRep_Builder builder;
+ builder.MakeCompound( aCompound );
+
+ builder.Add( aCompound, theOriginalShape );
+ Handle(TColStd_HSequenceOfTransient) otherObjs = theHI->GetShapes();
+ for ( int ind = 1; ind <= otherObjs->Length(); ind++)
+ {
+ Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(otherObjs->Value(ind));
+ builder.Add( aCompound, aRefShape->GetValue() );
+ }
+
+ ShHealOper_Sewing aHealer (aCompound, aTol);
// Set non-manifold mode.
aHealer.SetNonManifoldMode(isAllowNonManifold);
else
raiseNotDoneExeption( aHealer.GetErrorStatus() );
+ SaveStatistics( aHealer );
+
return aResult;
}
//function : RemoveInternalFaces
//purpose :
//=======================================================================
-Standard_Boolean GEOMImpl_HealingDriver::RemoveInternalFaces (const TopoDS_Shape& theOriginalShape,
- TopoDS_Shape& theOutShape) const
+Standard_Boolean
+GEOMImpl_HealingDriver::RemoveInternalFaces (GEOMImpl_IHealing* theHI,
+ const TopoDS_Shape& theOriginalShape,
+ TopoDS_Shape& theOutShape) const
{
+ // get all input shapes
+ TopTools_SequenceOfShape shapeSeq;
+ shapeSeq.Append( theOriginalShape );
+ Handle(TColStd_HSequenceOfTransient) otherObjs = theHI->GetShapes();
+ if ( !otherObjs.IsNull() )
+ for ( int ind = 1; ind <= otherObjs->Length(); ind++)
+ {
+ Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(otherObjs->Value(ind));
+ TopoDS_Shape aShape = aRefShape->GetValue();
+ if (aShape.IsNull())
+ Standard_NullObject::Raise("Null object given");
+ shapeSeq.Append( aShape );
+ }
+
+ // pass input shapes to the algorithm
GEOMAlgo_RemoverWebs aTool;
- aTool.SetShape(theOriginalShape);
+ if ( shapeSeq.Length() == 1 )
+ {
+ aTool.SetShape( shapeSeq.First() );
+ }
+ else
+ {
+ TopoDS_Compound solidCompound;
+ BRep_Builder builder;
+ builder.MakeCompound( solidCompound );
+ for ( int ind = 1; ind <= shapeSeq.Length(); ++ind )
+ for ( TopExp_Explorer so( shapeSeq( ind ), TopAbs_SOLID ); so.More(); so.Next() )
+ builder.Add( solidCompound, so.Current() );
+
+ aTool.SetShape( solidCompound );
+ }
+
+ // run the algorithm
aTool.Perform();
if (aTool.ErrorStatus() == 0) { // OK
//function : AddPointOnEdge
//purpose :
//=======================================================================
-Standard_Boolean GEOMImpl_HealingDriver::AddPointOnEdge (GEOMImpl_IHealing* theHI,
+Standard_Boolean GEOMImpl_HealingDriver::AddPointOnEdge (GEOMImpl_IHealing* theHI,
const TopoDS_Shape& theOriginalShape,
- TopoDS_Shape& theOutShape) const
+ TopoDS_Shape& theOutShape) const
{
Standard_Boolean isByParameter = theHI->GetIsByParameter();
- Standard_Integer anIndex = theHI->GetIndex();
- Standard_Real aValue = theHI->GetDevideEdgeValue();
+ Standard_Integer anIndex = theHI->GetIndex();
+ Standard_Real aValue = theHI->GetDevideEdgeValue();
+
+ TopoDS_Shape pointToProject;
+ {
+ Handle(TColStd_HSequenceOfTransient) funs = theHI->GetShapes();
+ if ( !funs.IsNull() && funs->Length() > 0 ) {
+ TopoDS_Compound vCompound;
+ BRep_Builder builder;
+ builder.MakeCompound( vCompound );
+ pointToProject = vCompound;
+ for ( int ind = 1; ind <= funs->Length(); ind++)
+ {
+ Handle(GEOM_Function) vFun = Handle(GEOM_Function)::DownCast(funs->Value(ind));
+ TopoDS_Shape vertex = vFun->GetValue();
+ if ( vertex.IsNull() )
+ Standard_NullObject::Raise("Null vertex given");
+ builder.Add( vCompound, vertex );
+ }
+ }
+ }
ShHealOper_EdgeDivide aHealer (theOriginalShape);
Standard_Boolean aResult = Standard_False;
- if (anIndex == -1) { // apply algorythm for the whole shape which is EDGE
- if (theOriginalShape.ShapeType() == TopAbs_EDGE)
- aResult = aHealer.Perform(TopoDS::Edge(theOriginalShape), aValue, isByParameter);
+ if (anIndex == -1) { // apply algorithm for the whole shape which is EDGE
+ if (theOriginalShape.ShapeType() == TopAbs_EDGE) {
+ if ( pointToProject.IsNull() )
+ aResult = aHealer.Perform(TopoDS::Edge(theOriginalShape), aValue, isByParameter);
+ else
+ aResult = aHealer.Perform(TopoDS::Edge(theOriginalShape), pointToProject);
+ }
} else {
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes(theOriginalShape, aShapes);
TopoDS_Shape aEdgeShape = aShapes.FindKey(anIndex);
- if (aEdgeShape.ShapeType() == TopAbs_EDGE)
- aResult = aHealer.Perform(TopoDS::Edge(aEdgeShape), aValue, isByParameter);
+ if (aEdgeShape.ShapeType() == TopAbs_EDGE) {
+ if ( pointToProject.IsNull() )
+ aResult = aHealer.Perform(TopoDS::Edge(aEdgeShape), aValue, isByParameter);
+ else
+ aResult = aHealer.Perform(TopoDS::Edge(aEdgeShape), pointToProject);
+ }
}
if (aResult)
else
raiseNotDoneExeption( aHealer.GetErrorStatus() );
+ SaveStatistics( aHealer );
+
return aResult;
}
else
raiseNotDoneExeption( aHealer.GetErrorStatus() );
+ SaveStatistics( aHealer );
+
return aResult;
}
TopoDS_Shape& theOutShape) const
{
Standard_Real aTol = theHI->GetTolerance();
+ TopAbs_ShapeEnum aType = theHI->GetType();
+
if (aTol < Precision::Confusion())
aTol = Precision::Confusion();
// 1. Make a copy to prevent the original shape changes.
TopoDS_Shape aShapeCopy;
- TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
- TNaming_CopyShape::CopyTool(theOriginalShape, aMapTShapes, aShapeCopy);
+ {
+ TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
+ TNaming_CopyShape::CopyTool(theOriginalShape, aMapTShapes, aShapeCopy);
+ }
// 2. Limit tolerance.
- ShapeFix_ShapeTolerance aSFT;
- aSFT.LimitTolerance(aShapeCopy, aTol, aTol, TopAbs_SHAPE);
+ if (!GEOMUtils::FixShapeTolerance(aShapeCopy, aType, aTol))
+ StdFail_NotDone::Raise("Non valid shape result");
- // 3. Fix obtained shape.
- Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape (aShapeCopy);
- aSfs->Perform();
- theOutShape = aSfs->Shape();
+ // 3. Set the result
+ theOutShape = aShapeCopy;
- BRepCheck_Analyzer ana (theOutShape, Standard_True);
- if (!ana.IsValid())
- StdFail_NotDone::Raise("Non valid shape result");
+ // 4. Collect statistics
+ {
+ ShHealOper_Tool tool;
+ ShHealOper_ModifStats& stats = tool.GetStatistics();
+
+ int nb[3] = { 0,0,0 };
+ TopTools_IndexedMapOfShape aShapes;
+ TopExp::MapShapes( theOutShape, TopAbs_VERTEX, aShapes);
+ for ( int i = 1; i <= aShapes.Extent(); ++i )
+ {
+ const TopoDS_Vertex& v = TopoDS::Vertex( aShapes( i ));
+ double tol = BRep_Tool::Tolerance( v );
+ if ( tol < aTol ) nb[0]++;
+ else if ( tol > aTol ) nb[2]++;
+ else nb[1]++;
+ }
+ if ( nb[0] > 0 )
+ stats.AddModif( "Tolerance of vertex decreased for shape validity", nb[0] );
+ if ( nb[1] > 0 )
+ stats.AddModif( "Tolerance of vertex limited as requested", nb[1] );
+ if ( nb[2] > 0 )
+ stats.AddModif( "Tolerance of vertex increased for shape validity", nb[2] );
+
+ nb[0] = nb[1] = nb[2] = 0;
+ aShapes.Clear();
+ TopExp::MapShapes( theOutShape, TopAbs_EDGE, aShapes);
+ for ( int i = 1; i <= aShapes.Extent(); ++i )
+ {
+ const TopoDS_Edge& e = TopoDS::Edge( aShapes( i ));
+ double tol = BRep_Tool::Tolerance( e );
+ if ( tol < aTol ) nb[0]++;
+ else if ( tol > aTol ) nb[2]++;
+ else nb[1]++;
+ }
+ if ( nb[0] > 0 )
+ stats.AddModif( "Tolerance of edge decreased for shape validity", nb[0] );
+ if ( nb[1] > 0 )
+ stats.AddModif( "Tolerance of edge limited as requested", nb[1] );
+ if ( nb[2] > 0 )
+ stats.AddModif( "Tolerance of edge increased for shape validity", nb[2] );
+
+ nb[0] = nb[1] = nb[2] = 0;
+ aShapes.Clear();
+ TopExp::MapShapes( theOutShape, TopAbs_FACE, aShapes);
+ for ( int i = 1; i <= aShapes.Extent(); ++i )
+ {
+ const TopoDS_Face& f = TopoDS::Face( aShapes( i ));
+ double tol = BRep_Tool::Tolerance( f );
+ if ( tol < aTol ) nb[0]++;
+ else if ( tol > aTol ) nb[2]++;
+ else nb[1]++;
+ }
+ if ( nb[0] > 0 )
+ stats.AddModif( "Tolerance of face decreased for shape validity", nb[0] );
+ if ( nb[1] > 0 )
+ stats.AddModif( "Tolerance of face limited as requested", nb[1] );
+ if ( nb[2] > 0 )
+ stats.AddModif( "Tolerance of face increased for shape validity", nb[2] );
+
+ SaveStatistics( tool );
+ }
}
//=======================================================================
removeAll = true;
if (!removeAll) {
- for (unsigned int ind = 1; ind <= aVerts->Length(); ind++) {
+ for ( int ind = 1; ind <= aVerts->Length(); ind++) {
Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aVerts->Value(ind));
TopoDS_Shape aShape_i = aRefShape->GetValue();
if (aShape_i.IsNull())
theWire = TopoDS::Wire(Fixer->Shape());
*/
- TopoDS_Edge prevEdge;
- TopTools_ListOfShape finalList, currChain;
+ // Get the ordered list of edges.
+ TopTools_ListOfShape anEdges;
+ TopTools_ListOfShape aCurVertices;
+ BRepTools_WireExplorer aWExp (theWire);
- BRepTools_WireExplorer wexp (theWire);
- if (wexp.More()) {
- prevEdge = wexp.Current();
- currChain.Append(prevEdge);
- wexp.Next();
+ for (; aWExp.More(); aWExp.Next()) {
+ anEdges.Append(aWExp.Current());
+ aCurVertices.Append(aWExp.CurrentVertex());
}
- else {
+
+ if (anEdges.IsEmpty()) {
Standard_NullObject::Raise("Empty wire given");
}
- for (; wexp.More(); wexp.Next()) {
- TopoDS_Edge anEdge = wexp.Current();
- TopoDS_Vertex CurVertex = wexp.CurrentVertex();
+ // Treat the case if the wire is closed and first and last edges are C1.
+ Standard_Boolean isShift = Standard_False;
+
+ if (BRep_Tool::IsClosed(theWire)) {
+ // Wire is closed. Check if there are more than 2 edges in the wire.
+ if (!anEdges.First().IsSame(anEdges.Last())) {
+ isShift = Standard_True;
+ }
+ }
+
+ if (isShift) {
+ // Put first edge to the end of the list while the chain break is reached.
+ TopoDS_Shape aFirstEdge = anEdges.First();
+
+ while (isShift) {
+ isShift = Standard_False;
+
+ // Check if the first vertex should be kept
+ if (aMapToRemove.Contains(aCurVertices.First()) || removeAll) {
+ // Check if first and last edges are C1.
+ TopoDS_Edge anEdge1 = TopoDS::Edge(anEdges.Last());
+ TopoDS_Edge anEdge2 = TopoDS::Edge(anEdges.First());
+
+ if (AreEdgesC1(anEdge1, anEdge2)) {
+ // Make the first edge last.
+ anEdges.Append(anEdge2);
+ anEdges.RemoveFirst();
+ aCurVertices.Append(aCurVertices.First());
+ aCurVertices.RemoveFirst();
+
+ // Check if we reached the first edge again.
+ // Break the loop in this case.
+ isShift = !aFirstEdge.IsSame(anEdges.First());
+ }
+ }
+ }
+ }
+
+ TopTools_ListOfShape finalList, currChain;
+ TopTools_ListIteratorOfListOfShape anEIter(anEdges);
+ TopTools_ListIteratorOfListOfShape aVIter(aCurVertices);
+ TopoDS_Edge prevEdge = TopoDS::Edge(anEIter.Value());
+
+ currChain.Append(prevEdge);
+ anEIter.Next();
+ aVIter.Next();
+
+ for (; anEIter.More(); anEIter.Next(), aVIter.Next()) {
+ TopoDS_Edge anEdge = TopoDS::Edge(anEIter.Value());
+ const TopoDS_Shape &aCurVertex = aVIter.Value();
bool continueChain = false;
- if (aMapToRemove.Contains(CurVertex) || removeAll) {
+ if (aMapToRemove.Contains(aCurVertex) || removeAll) {
// if C1 -> continue chain
if (AreEdgesC1(prevEdge, anEdge)) {
continueChain = true;
}
theOutShape = aFinalWire;
- BRepCheck_Analyzer ana (theOutShape, Standard_True);
- if (!ana.IsValid())
+ if (!GEOMUtils::CheckShape(theOutShape, true))
StdFail_NotDone::Raise("Non valid shape result");
}
case SEWING:
case SEWING_NON_MANIFOLD:
theOperationName = "SEWING";
- AddParam( theParams, "Selected shape", aCI.GetOriginal() );
+ AddParam( theParams, "Selected shapes", aCI.GetOriginalAndShapes() );
AddParam( theParams, "Allow Non Manifold", ( aType == SEWING_NON_MANIFOLD ));
AddParam( theParams, "Tolerance", aCI.GetTolerance() );
break;
AddParam( theParams, "By parameter", aCI.GetIsByParameter() );
AddParam( theParams, "Value", aCI.GetDevideEdgeValue() );
break;
+ case DIVIDE_EDGE_BY_POINT:
+ theOperationName = "POINT_ON_EDGE";
+ if ( aCI.GetIndex() > 0 )
+ AddParam( theParams, "Edge", "#" ) << aCI.GetIndex() << " of " << aCI.GetOriginal();
+ else
+ AddParam( theParams, "Edge", aCI.GetOriginal() );
+ AddParam( theParams, "Points", aCI.GetShapes() );
+ break;
case CHANGE_ORIENTATION:
theOperationName = "CHANGE_ORIENTATION";
AddParam( theParams, "Selected shape", aCI.GetOriginal() );
theOperationName = "LIMIT_TOLERANCE";
AddParam( theParams, "Selected shape", aCI.GetOriginal() );
AddParam( theParams, "Tolerance", aCI.GetTolerance() );
+ AddParam( theParams, "Type", aCI.GetType() );
break;
case FUSE_COLLINEAR_EDGES:
theOperationName = "FUSE_EDGES";
break;
case REMOVE_INTERNAL_FACES:
theOperationName = "REMOVE_WEBS";
- AddParam( theParams, "Selected shape", aCI.GetOriginal() );
+ AddParam( theParams, "Selected shapes", aCI.GetOriginalAndShapes() );
break;
default:
return false;
return true;
}
+
+//================================================================================
+/*!
+ * \brief Pass a record of what is done to the operation
+ */
+//================================================================================
+
+void GEOMImpl_HealingDriver::SaveStatistics( const ShHealOper_Tool& healer, bool add ) const
+{
+ if ( healer.GetStatistics().GetData().empty() )
+ return;
+
+ if (Label().IsNull()) return;
+
+ Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
+ if (aFunction.IsNull()) return;
+
+ GEOMImpl_IHealing HI (aFunction);
+ ShHealOper_ModifStats * stats = HI.GetStatistics();
+ if ( !stats ) return;
+
+ if ( add )
+ stats->Add( healer.GetStatistics() );
+ else
+ *stats = healer.GetStatistics();
+}
+
IMPLEMENT_STANDARD_HANDLE (GEOMImpl_HealingDriver,GEOM_BaseDriver);
IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_HealingDriver,GEOM_BaseDriver);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <Standard_CString.hxx>
#endif
-class GEOMImpl_IHealing;
+#include "GEOM_BaseDriver.hxx"
+class GEOMImpl_IHealing;
+class ShHealOper_Tool;
+class TopTools_SequenceOfShape;
-#include "GEOM_BaseDriver.hxx"
DEFINE_STANDARD_HANDLE( GEOMImpl_HealingDriver, GEOM_BaseDriver );
private:
Standard_Boolean ShapeProcess ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
Standard_Boolean SuppressFaces ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
+ void SuppressFacesRec (const TopTools_SequenceOfShape& theShapesFaces,
+ const TopoDS_Shape& theOriginalShape,
+ TopoDS_Shape& theOutShape) const;
Standard_Boolean CloseContour ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
Standard_Boolean RemoveIntWires( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
Standard_Boolean RemoveHoles ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
Standard_Boolean Sew ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape&, Standard_Boolean ) const;
- Standard_Boolean RemoveInternalFaces ( const TopoDS_Shape&, TopoDS_Shape& ) const;
+ Standard_Boolean RemoveInternalFaces ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
Standard_Boolean AddPointOnEdge( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
Standard_Boolean ChangeOrientation( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
void LimitTolerance( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
+ void SaveStatistics( const ShHealOper_Tool& healer, bool add=false ) const;
};
#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GEOMImpl_IDisk.hxx>
#include <GEOMImpl_ICylinder.hxx>
#include <GEOMImpl_ICone.hxx>
+#include <GEOMImpl_IGroupOperations.hxx>
#include <GEOMImpl_ISphere.hxx>
#include <GEOMImpl_ITorus.hxx>
#include <GEOMImpl_IPrism.hxx>
#include <GEOMImpl_IPipePath.hxx>
#include <Precision.hxx>
+#include <TopExp.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
: GEOM_IOperations(theEngine, theDocID)
{
MESSAGE("GEOMImpl_I3DPrimOperations::GEOMImpl_I3DPrimOperations");
+ myGroupOperations = new GEOMImpl_IGroupOperations(GetEngine(), GetDocID());
}
//=============================================================================
GEOMImpl_I3DPrimOperations::~GEOMImpl_I3DPrimOperations()
{
MESSAGE("GEOMImpl_I3DPrimOperations::~GEOMImpl_I3DPrimOperations");
+ delete myGroupOperations;
}
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRHA (Handle(GEOM_Object) thePnt,
- Handle(GEOM_Object) theVec,
- double theR, double theH, double theA)
+ Handle(GEOM_Object) theVec,
+ double theR, double theH, double theA)
{
SetErrorCode(KO);
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDraftPrism
- (Handle(GEOM_Object) theInitShape ,Handle(GEOM_Object) theBase, double theHeight, double theAngle, bool theFuse)
+ (Handle(GEOM_Object) theInitShape ,Handle(GEOM_Object) theBase, double theHeight, double theAngle, bool theFuse, bool theInvert)
{
SetErrorCode(KO);
aCI.SetFuseFlag(1);
else
aCI.SetFuseFlag(0);
+ aCI.SetInvertFlag(theInvert);
//Compute the Draft Prism Feature value
try {
}
//Make a Python command
+ GEOM::TPythonDump pd (aFunction);
if(theFuse)
{
- GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakeExtrudedBoss("
- << theInitShape << ", " << theBase << ", " << theHeight << ", " << theAngle << ")";
+ pd << aPrism << " = geompy.MakeExtrudedBoss(" << theInitShape << ", " << theBase << ", "
+ << theHeight << ", " << theAngle;
}
else
{
- GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakeExtrudedCut("
- << theInitShape << ", " << theBase << ", " << theHeight << ", " << theAngle << ")";
+ pd << aPrism << " = geompy.MakeExtrudedCut(" << theInitShape << ", " << theBase << ", "
+ << theHeight << ", " << theAngle;
}
+ if (theInvert)
+ pd << ", " << theInvert;
+ pd << ")";
SetErrorCode(OK);
return aPrism;
* MakePipe
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipe (Handle(GEOM_Object) theBase,
- Handle(GEOM_Object) thePath)
+Handle(TColStd_HSequenceOfTransient) GEOMImpl_I3DPrimOperations::MakePipe
+ (const Handle(GEOM_Object) &theBase,
+ const Handle(GEOM_Object) &thePath,
+ const bool IsGenerateGroups)
{
SetErrorCode(KO);
aCI.SetBase(aRefBase);
aCI.SetPath(aRefPath);
+ aCI.SetGenerateGroups(IsGenerateGroups);
//Compute the Pipe value
try {
return NULL;
}
+ // Create the sequence of objects.
+ Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+
+ aSeq->Append(aPipe);
+ createGroups(aPipe, &aCI, aSeq);
+
//Make a Python command
- GEOM::TPythonDump(aFunction) << aPipe << " = geompy.MakePipe("
- << theBase << ", " << thePath << ")";
+ GEOM::TPythonDump pyDump(aFunction);
+
+ if (IsGenerateGroups) {
+ pyDump << aSeq;
+ } else {
+ pyDump << aPipe;
+ }
+
+ pyDump << " = geompy.MakePipe(" << theBase << ", " << thePath;
+
+ if (IsGenerateGroups) {
+ pyDump << ", True";
+ }
+
+ pyDump << ")";
SetErrorCode(OK);
- return aPipe;
+ return aSeq;
}
* MakeFilling
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
- (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg,
- double theTol2D, double theTol3D, int theNbIter,
- int theMethod, bool isApprox)
+Handle(GEOM_Object)
+GEOMImpl_I3DPrimOperations::MakeFilling (std::list< Handle(GEOM_Object)> & theContours,
+ int theMinDeg, int theMaxDeg,
+ double theTol2D, double theTol3D, int theNbIter,
+ int theMethod, bool isApprox)
{
SetErrorCode(KO);
- if (theShape.IsNull()) return NULL;
-
+ Handle(TColStd_HSequenceOfTransient) contours = GEOM_Object::GetLastFunctions( theContours );
+ if ( contours.IsNull() || contours->IsEmpty() ) {
+ SetErrorCode("NULL argument shape");
+ return NULL;
+ }
//Add a new Filling object
Handle(GEOM_Object) aFilling = GetEngine()->AddObject(GetDocID(), GEOM_FILLING);
if (aFunction->GetDriverGUID() != GEOMImpl_FillingDriver::GetID()) return NULL;
GEOMImpl_IFilling aFI (aFunction);
-
- Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
-
- if (aRefShape.IsNull()) return NULL;
-
- aFI.SetShape(aRefShape);
+ aFI.SetShapes(contours);
aFI.SetMinDeg(theMinDeg);
aFI.SetMaxDeg(theMaxDeg);
aFI.SetTol2D(theTol2D);
//Make a Python command
GEOM::TPythonDump pd (aFunction);
- pd << aFilling << " = geompy.MakeFilling(" << theShape ;
+ pd << aFilling << " = geompy.MakeFilling(" << theContours ;
if ( theMinDeg != 2 ) pd << ", theMinDeg=" << theMinDeg ;
if ( theMaxDeg != 5 ) pd << ", theMaxDeg=" << theMaxDeg ;
if ( fabs(theTol2D-0.0001) > Precision::Confusion() )
- pd << ", theTol2D=" << theTol2D ;
+ { pd << ", theTol2D=" << theTol2D ; }
if ( fabs(theTol3D-0.0001) > Precision::Confusion() )
- pd << ", theTol3D=" << theTol3D ;
+ { pd << ", theTol3D=" << theTol3D ; }
if ( theNbIter != 0 ) pd << ", theNbIter=" << theNbIter ;
if ( theMethod==1 ) pd << ", theMethod=GEOM.FOM_UseOri";
else if( theMethod==2 ) pd << ", theMethod=GEOM.FOM_AutoCorrect";
- if(isApprox) pd << ", isApprox=" << isApprox ;
+ if ( isApprox ) pd << ", isApprox=" << isApprox ;
pd << ")";
SetErrorCode(OK);
* MakePipeWithDifferentSections
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections(
- const Handle(TColStd_HSequenceOfTransient)& theBases,
- const Handle(TColStd_HSequenceOfTransient)& theLocations,
- const Handle(GEOM_Object)& thePath,
- bool theWithContact,
- bool theWithCorrections)
+Handle(TColStd_HSequenceOfTransient)
+ GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections
+ (const Handle(TColStd_HSequenceOfTransient) &theBases,
+ const Handle(TColStd_HSequenceOfTransient) &theLocations,
+ const Handle(GEOM_Object) &thePath,
+ const bool theWithContact,
+ const bool theWithCorrections,
+ const bool IsBySteps,
+ const bool IsGenerateGroups)
{
- Handle(GEOM_Object) anObj;
SetErrorCode(KO);
if(theBases.IsNull())
- return anObj;
+ return NULL;
Standard_Integer nbBases = theBases->Length();
if (!nbBases)
- return anObj;
+ return NULL;
Standard_Integer nbLocs = (theLocations.IsNull() ? 0 :theLocations->Length());
//Add a new Pipe object
Handle(GEOM_Function) aFunction =
aPipeDS->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_DIFFERENT_SECTIONS);
- if (aFunction.IsNull()) return anObj;
+ if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
- if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return anObj;
+ if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return NULL;
GEOMImpl_IPipeDiffSect aCI (aFunction);
Handle(GEOM_Function) aRefPath = thePath->GetLastFunction();
if(aRefPath.IsNull())
- return anObj;
+ return NULL;
Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
Handle(TColStd_HSequenceOfTransient) aSeqLocs = new TColStd_HSequenceOfTransient;
}
if(!aSeqBases->Length())
- return anObj;
+ return NULL;
aCI.SetBases(aSeqBases);
aCI.SetLocations(aSeqLocs);
aCI.SetPath(aRefPath);
- aCI.SetWithContactMode(theWithContact);
- aCI.SetWithCorrectionMode(theWithCorrections);
+
+ if (!IsBySteps) {
+ aCI.SetWithContactMode(theWithContact);
+ aCI.SetWithCorrectionMode(theWithCorrections);
+ }
+
+ aCI.SetIsBySteps(IsBySteps);
+ aCI.SetGenerateGroups(IsGenerateGroups);
//Compute the Pipe value
try {
OCC_CATCH_SIGNALS;
if (!GetSolver()->ComputeFunction(aFunction)) {
SetErrorCode("Pipe with defferent section driver failed");
- return anObj;
+ return NULL;
}
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
SetErrorCode(aFail->GetMessageString());
- return anObj;
+ return NULL;
}
+ // Create the sequence of objects.
+ Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+
+ aSeq->Append(aPipeDS);
+ createGroups(aPipeDS, &aCI, aSeq);
+
//Make a Python command
GEOM::TPythonDump pyDump(aFunction);
- pyDump << aPipeDS << " = geompy.MakePipeWithDifferentSections([";
+
+ if (IsGenerateGroups) {
+ pyDump << aSeq;
+ } else {
+ pyDump << aPipeDS;
+ }
+
+ if (IsBySteps) {
+ pyDump << " = geompy.MakePipeWithDifferentSectionsBySteps([";
+ } else {
+ pyDump << " = geompy.MakePipeWithDifferentSections([";
+ }
for(i =1 ; i <= nbBases; i++) {
}
}
- pyDump<< "], "<<thePath<<","<<theWithContact << "," << theWithCorrections<<")";
+ pyDump<< "], "<<thePath;
+
+ if (!IsBySteps) {
+ pyDump<<","<<theWithContact << "," << theWithCorrections;
+ }
+
+ if (IsGenerateGroups) {
+ pyDump << ", True";
+ }
+
+ pyDump << ")";
SetErrorCode(OK);
- return aPipeDS;
+ return aSeq;
}
* MakePipeWithShellSections
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections(
- const Handle(TColStd_HSequenceOfTransient)& theBases,
- const Handle(TColStd_HSequenceOfTransient)& theSubBases,
- const Handle(TColStd_HSequenceOfTransient)& theLocations,
- const Handle(GEOM_Object)& thePath,
- bool theWithContact,
- bool theWithCorrections)
+Handle(TColStd_HSequenceOfTransient)
+ GEOMImpl_I3DPrimOperations::MakePipeWithShellSections
+ (const Handle(TColStd_HSequenceOfTransient) &theBases,
+ const Handle(TColStd_HSequenceOfTransient) &theSubBases,
+ const Handle(TColStd_HSequenceOfTransient) &theLocations,
+ const Handle(GEOM_Object) &thePath,
+ const bool theWithContact,
+ const bool theWithCorrections,
+ const bool IsGenerateGroups)
{
- Handle(GEOM_Object) anObj;
SetErrorCode(KO);
if(theBases.IsNull())
- return anObj;
+ return NULL;
Standard_Integer nbBases = theBases->Length();
if (!nbBases)
- return anObj;
+ return NULL;
Standard_Integer nbSubBases = (theSubBases.IsNull() ? 0 :theSubBases->Length());
Handle(GEOM_Function) aFunction =
aPipeDS->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_SHELL_SECTIONS);
- if (aFunction.IsNull()) return anObj;
+ if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
- if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return anObj;
+ if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return NULL;
//GEOMImpl_IPipeDiffSect aCI (aFunction);
GEOMImpl_IPipeShellSect aCI (aFunction);
Handle(GEOM_Function) aRefPath = thePath->GetLastFunction();
if(aRefPath.IsNull())
- return anObj;
+ return NULL;
Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
}
if(!aSeqBases->Length())
- return anObj;
+ return NULL;
aCI.SetBases(aSeqBases);
aCI.SetSubBases(aSeqSubBases);
aCI.SetPath(aRefPath);
aCI.SetWithContactMode(theWithContact);
aCI.SetWithCorrectionMode(theWithCorrections);
+ aCI.SetGenerateGroups(IsGenerateGroups);
//Compute the Pipe value
try {
OCC_CATCH_SIGNALS;
if (!GetSolver()->ComputeFunction(aFunction)) {
SetErrorCode("Pipe with shell sections driver failed");
- return anObj;
+ return NULL;
}
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
SetErrorCode(aFail->GetMessageString());
- return anObj;
+ return NULL;
}
+ // Create the sequence of objects.
+ Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+
+ aSeq->Append(aPipeDS);
+ createGroups(aPipeDS, &aCI, aSeq);
+
//Make a Python command
GEOM::TPythonDump pyDump(aFunction);
- pyDump << aPipeDS << " = geompy.MakePipeWithShellSections([";
+
+ if (IsGenerateGroups) {
+ pyDump << aSeq;
+ } else {
+ pyDump << aPipeDS;
+ }
+
+ pyDump << " = geompy.MakePipeWithShellSections([";
for(i =1 ; i <= nbBases; i++) {
}
}
- pyDump<< "], "<<thePath<<","<<theWithContact << "," << theWithCorrections<<")";
+ pyDump<< "], "<<thePath<<","<<theWithContact << "," << theWithCorrections;
+
+ if (IsGenerateGroups) {
+ pyDump << ", True";
+ }
+
+ pyDump << ")";
SetErrorCode(OK);
- return aPipeDS;
+ return aSeq;
}
* MakePipeShellsWithoutPath
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath(
- const Handle(TColStd_HSequenceOfTransient)& theBases,
- const Handle(TColStd_HSequenceOfTransient)& theLocations)
+Handle(TColStd_HSequenceOfTransient)
+ GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath
+ (const Handle(TColStd_HSequenceOfTransient) &theBases,
+ const Handle(TColStd_HSequenceOfTransient) &theLocations,
+ const bool IsGenerateGroups)
{
- Handle(GEOM_Object) anObj;
SetErrorCode(KO);
if(theBases.IsNull())
- return anObj;
+ return NULL;
Standard_Integer nbBases = theBases->Length();
if (!nbBases)
- return anObj;
+ return NULL;
Standard_Integer nbLocs = (theLocations.IsNull() ? 0 :theLocations->Length());
Handle(GEOM_Function) aFunction =
aPipeDS->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_SHELLS_WITHOUT_PATH);
- if (aFunction.IsNull()) return anObj;
+ if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
- if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return anObj;
+ if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return NULL;
GEOMImpl_IPipeShellSect aCI (aFunction);
}
if(!aSeqBases->Length())
- return anObj;
+ return NULL;
aCI.SetBases(aSeqBases);
aCI.SetLocations(aSeqLocs);
+ aCI.SetGenerateGroups(IsGenerateGroups);
//Compute the Pipe value
try {
OCC_CATCH_SIGNALS;
if (!GetSolver()->ComputeFunction(aFunction)) {
SetErrorCode("Pipe with shell sections without path driver failed");
- return anObj;
+ return NULL;
}
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
SetErrorCode(aFail->GetMessageString());
- return anObj;
+ return NULL;
}
+ // Create the sequence of objects.
+ Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+
+ aSeq->Append(aPipeDS);
+ createGroups(aPipeDS, &aCI, aSeq);
+
//Make a Python command
GEOM::TPythonDump pyDump(aFunction);
- pyDump << aPipeDS << " = geompy.MakePipeShellsWithoutPath([";
+
+ if (IsGenerateGroups) {
+ pyDump << aSeq;
+ } else {
+ pyDump << aPipeDS;
+ }
+
+ pyDump << " = geompy.MakePipeShellsWithoutPath([";
for(i =1 ; i <= nbBases; i++) {
}
}
- pyDump<< "])";
+ pyDump<< "]";
+
+ if (IsGenerateGroups) {
+ pyDump << ", True";
+ }
+
+ pyDump << ")";
SetErrorCode(OK);
- return aPipeDS;
+ return aSeq;
}
* MakePipeBiNormalAlongVector
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeBiNormalAlongVector (Handle(GEOM_Object) theBase,
- Handle(GEOM_Object) thePath,
- Handle(GEOM_Object) theVec)
+Handle(TColStd_HSequenceOfTransient)
+ GEOMImpl_I3DPrimOperations::MakePipeBiNormalAlongVector
+ (const Handle(GEOM_Object) &theBase,
+ const Handle(GEOM_Object) &thePath,
+ const Handle(GEOM_Object) &theVec,
+ const bool IsGenerateGroups)
{
SetErrorCode(KO);
aCI.SetBase(aRefBase);
aCI.SetPath(aRefPath);
aCI.SetVector(aRefVec);
+ aCI.SetGenerateGroups(IsGenerateGroups);
//Compute the Pipe value
try {
return NULL;
}
+ // Create the sequence of objects.
+ Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+
+ aSeq->Append(aPipe);
+ createGroups(aPipe, &aCI, aSeq);
+
//Make a Python command
- GEOM::TPythonDump(aFunction) << aPipe << " = geompy.MakePipeBiNormalAlongVector("
- << theBase << ", " << thePath << ", " << theVec << ")";
+ GEOM::TPythonDump pyDump(aFunction);
+
+ if (IsGenerateGroups) {
+ pyDump << aSeq;
+ } else {
+ pyDump << aPipe;
+ }
+
+ pyDump << " = geompy.MakePipeBiNormalAlongVector("
+ << theBase << ", " << thePath << ", " << theVec;
+
+ if (IsGenerateGroups) {
+ pyDump << ", True";
+ }
+
+ pyDump << ")";
SetErrorCode(OK);
- return aPipe;
+ return aSeq;
}
//=============================================================================
* MakeThickening
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThickening(Handle(GEOM_Object) theObject,
- double theOffset,
- bool copy = true)
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThickening
+ (Handle(GEOM_Object) theObject,
+ const Handle(TColStd_HArray1OfInteger) &theFacesIDs,
+ double theOffset,
+ bool isCopy,
+ bool theInside)
{
SetErrorCode(KO);
//Add a new Offset function
Handle(GEOM_Function) aFunction;
Handle(GEOM_Object) aCopy;
- if (copy)
+ if (isCopy)
{
//Add a new Copy object
aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
GEOMImpl_IOffset aTI (aFunction);
aTI.SetShape(anOriginal);
aTI.SetValue(theOffset);
+ aTI.SetParam(theInside);
+
+ if (theFacesIDs.IsNull() == Standard_False) {
+ aTI.SetFaceIDs(theFacesIDs);
+ }
//Compute the offset
try {
}
//Make a Python command
- if(copy)
- {
- GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeThickSolid("
- << theObject << ", " << theOffset << ")";
- SetErrorCode(OK);
- return aCopy;
+ GEOM::TPythonDump pd (aFunction);
+ Handle(GEOM_Object) aResult;
+
+ if (isCopy) {
+ pd << aCopy << " = geompy.MakeThickSolid("
+ << theObject << ", " << theOffset;
+ aResult = aCopy;
+ } else {
+ pd << "geompy.Thicken(" << theObject << ", " << theOffset;
+ aResult = theObject;
}
- else
- {
- GEOM::TPythonDump(aFunction) << "geompy.Thicken("
- << theObject << ", " << theOffset << ")";
- SetErrorCode(OK);
- return theObject;
+
+ pd << ", [";
+ if (theFacesIDs.IsNull() == Standard_False) {
+ // Dump faces IDs.
+ Standard_Integer i;
+
+ for (i = theFacesIDs->Lower(); i < theFacesIDs->Upper(); ++i) {
+ pd << theFacesIDs->Value(i) << ", ";
+ }
+ // Dump the last value.
+ pd << theFacesIDs->Value(i);
}
+ pd << "]";
+
+ if (theInside)
+ pd << ", " << theInside;
+
+ pd << ")";
+ SetErrorCode(OK);
+
+ return aResult;
}
//=============================================================================
SetErrorCode(OK);
return aPath;
}
+
+//=============================================================================
+/*!
+ * createGroup
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::createGroup
+ (const Handle(GEOM_Object) &theBaseObject,
+ const Handle(TColStd_HArray1OfInteger) &theGroupIDs,
+ const TCollection_AsciiString &theName,
+ const TopTools_IndexedMapOfShape &theIndices)
+{
+ if (theBaseObject.IsNull() || theGroupIDs.IsNull()) {
+ return NULL;
+ }
+
+ // Get the Shape type.
+ const Standard_Integer anID = theGroupIDs->Value(theGroupIDs->Lower());
+ const Standard_Integer aNbShapes = theIndices.Extent();
+
+ if (anID < 1 || anID > aNbShapes) {
+ return NULL;
+ }
+
+ const TopoDS_Shape aSubShape = theIndices.FindKey(anID);
+
+ if (aSubShape.IsNull()) {
+ return NULL;
+ }
+
+ // Create a group.
+ const TopAbs_ShapeEnum aGroupType = aSubShape.ShapeType();
+ Handle(GEOM_Object) aGroup =
+ myGroupOperations->CreateGroup(theBaseObject, aGroupType);
+
+ if (aGroup.IsNull() == Standard_False) {
+ aGroup->GetLastFunction()->SetDescription("");
+ aGroup->SetName(theName.ToCString());
+
+ Handle(TColStd_HSequenceOfInteger) aSeqIDs = new TColStd_HSequenceOfInteger;
+ Standard_Integer i;
+
+ for (i = theGroupIDs->Lower(); i <= theGroupIDs->Upper(); ++i) {
+ // Get and check the index.
+ const Standard_Integer anIndex = theGroupIDs->Value(i);
+
+ if (anIndex < 1 || anIndex > aNbShapes) {
+ return NULL;
+ }
+
+ // Get and check the sub-shape.
+ const TopoDS_Shape aSubShape = theIndices.FindKey(anIndex);
+
+ if (aSubShape.IsNull()) {
+ return NULL;
+ }
+
+ // Check the shape type.
+ if (aSubShape.ShapeType() != aGroupType) {
+ return NULL;
+ }
+
+ aSeqIDs->Append(anIndex);
+ }
+
+ myGroupOperations->UnionIDs(aGroup, aSeqIDs);
+ aGroup->GetLastFunction()->SetDescription("");
+ }
+
+ return aGroup;
+}
+
+//=============================================================================
+/*!
+ * createGroups
+ */
+//=============================================================================
+void GEOMImpl_I3DPrimOperations::createGroups
+ (const Handle(GEOM_Object) &theBaseObject,
+ GEOMImpl_IPipe *thePipe,
+ Handle(TColStd_HSequenceOfTransient) &theSequence)
+{
+ if (theBaseObject.IsNull() || thePipe == NULL || theSequence.IsNull()) {
+ return;
+ }
+
+ TopoDS_Shape aShape = theBaseObject->GetValue();
+
+ if (aShape.IsNull()) {
+ return;
+ }
+
+ TopTools_IndexedMapOfShape anIndices;
+ Handle(TColStd_HArray1OfInteger) aGroupIDs;
+ TopoDS_Shape aShapeType;
+ const Standard_Integer aNbGroups = 5;
+ Handle(GEOM_Object) aGrps[aNbGroups];
+ Standard_Integer i;
+
+ TopExp::MapShapes(aShape, anIndices);
+
+ // Create groups.
+ aGroupIDs = thePipe->GetGroupDown();
+ aGrps[0] = createGroup(theBaseObject, aGroupIDs, "GROUP_DOWN", anIndices);
+ aGroupIDs = thePipe->GetGroupUp();
+ aGrps[1] = createGroup(theBaseObject, aGroupIDs, "GROUP_UP", anIndices);
+ aGroupIDs = thePipe->GetGroupSide1();
+ aGrps[2] = createGroup(theBaseObject, aGroupIDs, "GROUP_SIDE1", anIndices);
+ aGroupIDs = thePipe->GetGroupSide2();
+ aGrps[3] = createGroup(theBaseObject, aGroupIDs, "GROUP_SIDE2", anIndices);
+ aGroupIDs = thePipe->GetGroupOther();
+ aGrps[4] = createGroup(theBaseObject, aGroupIDs, "GROUP_OTHER", anIndices);
+
+ for (i = 0; i < aNbGroups; ++i) {
+ if (aGrps[i].IsNull() == Standard_False) {
+ theSequence->Append(aGrps[i]);
+ }
+ }
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TDocStd_Document.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
+class GEOMImpl_IGroupOperations;
+class GEOMImpl_IPipe;
+class TopTools_IndexedMapOfShape;
+
+
class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
public:
Standard_EXPORT GEOMImpl_I3DPrimOperations(GEOM_Engine* theEngine, int theDocID);
Standard_EXPORT Handle(GEOM_Object) MakeDiskR (double theR, int theOrientation);
Standard_EXPORT Handle(GEOM_Object) MakeCylinderRH (double theR, double theH);
Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt,
- Handle(GEOM_Object) theVec,
- double theR, double theH);
+ Handle(GEOM_Object) theVec,
+ double theR, double theH);
Standard_EXPORT Handle(GEOM_Object) MakeCylinderRHA (double theR, double theH, double theA);
Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRHA (Handle(GEOM_Object) thePnt,
- Handle(GEOM_Object) theVec,
- double theR, double theH, double theA);
+ Handle(GEOM_Object) theVec,
+ double theR, double theH, double theA);
Standard_EXPORT Handle(GEOM_Object) MakeConeR1R2H (double theR1, double theR2, double theH);
Standard_EXPORT Handle(GEOM_Object) MakeConePntVecR1R2H (Handle(GEOM_Object) thePnt,
- Handle(GEOM_Object) theVec,
- double theR1, double theR2, double theH);
+ Handle(GEOM_Object) theVec,
+ double theR1, double theR2, double theH);
Standard_EXPORT Handle(GEOM_Object) MakeSphereR (double theR);
Standard_EXPORT Handle(GEOM_Object) MakeSpherePntR (Handle(GEOM_Object) thePnt, double theR);
Standard_EXPORT Handle(GEOM_Object) MakeTorusRR (double theRMajor, double theRMinor);
Standard_EXPORT Handle(GEOM_Object) MakeTorusPntVecRR (Handle(GEOM_Object) thePnt,
- Handle(GEOM_Object) theVec,
- double theRMajor, double theRMinor);
+ Handle(GEOM_Object) theVec,
+ double theRMajor, double theRMinor);
Standard_EXPORT Handle(GEOM_Object) MakePrismVecH (Handle(GEOM_Object) theBase,
Handle(GEOM_Object) theVec,
double theDX, double theDY, double theDZ);
Standard_EXPORT Handle(GEOM_Object) MakeDraftPrism (Handle(GEOM_Object) theInitShape, Handle(GEOM_Object) theBase,
- double theHeight, double theAngle, bool theFuse);
+ double theHeight, double theAngle, bool theFuse, bool theInvert = false );
- Standard_EXPORT Handle(GEOM_Object) MakePipe (Handle(GEOM_Object) theBase,
- Handle(GEOM_Object) thePath);
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakePipe
+ (const Handle(GEOM_Object) &theBase,
+ const Handle(GEOM_Object) &thePath,
+ const bool IsGenerateGroups);
Standard_EXPORT Handle(GEOM_Object) MakeRevolutionAxisAngle (Handle(GEOM_Object) theBase,
Handle(GEOM_Object) theAxis,
Handle(GEOM_Object) theAxis,
double theAngle);
- Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape,
+ Standard_EXPORT Handle(GEOM_Object) MakeFilling (std::list< Handle(GEOM_Object)> & theContours,
int theMinDeg, int theMaxDeg,
double theTol2D, double theTol3D,
int theNbIter, int theMethod,
double thePreci,
bool theRuled);
- Standard_EXPORT Handle(GEOM_Object) MakePipeWithDifferentSections(
- const Handle(TColStd_HSequenceOfTransient)& theBases,
- const Handle(TColStd_HSequenceOfTransient)& theLocations,
- const Handle(GEOM_Object)& thePath,
- bool theWithContact,
- bool theWithCorrections);
-
- Standard_EXPORT Handle(GEOM_Object) MakePipeWithShellSections(
- const Handle(TColStd_HSequenceOfTransient)& theBases,
- const Handle(TColStd_HSequenceOfTransient)& theSubBases,
- const Handle(TColStd_HSequenceOfTransient)& theLocations,
- const Handle(GEOM_Object)& thePath,
- bool theWithContact,
- bool theWithCorrections);
-
- Standard_EXPORT Handle(GEOM_Object) MakePipeShellsWithoutPath
- (const Handle(TColStd_HSequenceOfTransient)& theBases,
- const Handle(TColStd_HSequenceOfTransient)& theLocations);
-
- Standard_EXPORT Handle(GEOM_Object) MakePipeBiNormalAlongVector (Handle(GEOM_Object) theBase,
- Handle(GEOM_Object) thePath,
- Handle(GEOM_Object) theVec);
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
+ MakePipeWithDifferentSections
+ (const Handle(TColStd_HSequenceOfTransient) &theBases,
+ const Handle(TColStd_HSequenceOfTransient) &theLocations,
+ const Handle(GEOM_Object) &thePath,
+ const bool theWithContact,
+ const bool theWithCorrections,
+ const bool IsBySteps,
+ const bool IsGenerateGroups);
+
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakePipeWithShellSections
+ (const Handle(TColStd_HSequenceOfTransient) &theBases,
+ const Handle(TColStd_HSequenceOfTransient) &theSubBases,
+ const Handle(TColStd_HSequenceOfTransient) &theLocations,
+ const Handle(GEOM_Object) &thePath,
+ const bool theWithContact,
+ const bool theWithCorrections,
+ const bool IsGenerateGroups);
+
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakePipeShellsWithoutPath
+ (const Handle(TColStd_HSequenceOfTransient) &theBases,
+ const Handle(TColStd_HSequenceOfTransient) &theLocations,
+ const bool IsGenerateGroups);
+
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakePipeBiNormalAlongVector
+ (const Handle(GEOM_Object) &theBase,
+ const Handle(GEOM_Object) &thePath,
+ const Handle(GEOM_Object) &theVec,
+ const bool IsGenerateGroups);
- Standard_EXPORT Handle(GEOM_Object) MakeThickening (Handle(GEOM_Object) theObject,
- double theOffset,
- bool isCopy);
+ Standard_EXPORT Handle(GEOM_Object) MakeThickening
+ (Handle(GEOM_Object) theObject,
+ const Handle(TColStd_HArray1OfInteger) &theFacesIDs,
+ double theOffset,
+ bool isCopy,
+ bool theInside = false);
Standard_EXPORT Handle(GEOM_Object) RestorePath (Handle(GEOM_Object) theShape,
Handle(GEOM_Object) theBase1,
Standard_EXPORT Handle(GEOM_Object) RestorePath (Handle(GEOM_Object) theShape,
const Handle(TColStd_HSequenceOfTransient)& theBase1,
const Handle(TColStd_HSequenceOfTransient)& theBase2);
+
+private:
+
+ Handle(GEOM_Object) createGroup
+ (const Handle(GEOM_Object) &theBaseObject,
+ const Handle(TColStd_HArray1OfInteger) &theGroupIDs,
+ const TCollection_AsciiString &theName,
+ const TopTools_IndexedMapOfShape &theIndices);
+
+ void createGroups(const Handle(GEOM_Object) &theBaseObject,
+ GEOMImpl_IPipe *thePipe,
+ Handle(TColStd_HSequenceOfTransient) &theSequence);
+
+private:
+
+ GEOMImpl_IGroupOperations *myGroupOperations;
+
};
#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
(Handle(GEOM_Object) theGeomObj,
- double theParam1,
- double theParam2,
- double theParam3,
+ double theParam1,
+ double theParam2,
+ double theParam3,
const PointLocation theLocation,
+ const bool takeOrientationIntoAccount,
Handle(GEOM_Object) theRefPoint)
{
SetErrorCode(KO);
case PointOn_CurveByParam:
aPI.SetCurve(aRefFunction);
aPI.SetParameter(theParam1);
+ aPI.SetTakeOrientationIntoAccount(takeOrientationIntoAccount);
break;
case PointOn_CurveByLength:
aPI.SetCurve(aRefFunction);
{
case PointOn_CurveByParam:
GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve("
- << theGeomObj << ", " << theParam1 << ")";
+ << theGeomObj << ", " << theParam1 << ", "
+ << takeOrientationIntoAccount << ")";
break;
case PointOn_CurveByLength:
GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByLength("
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
- (Handle(GEOM_Object) theCurve, double theParameter)
+ (Handle(GEOM_Object) theCurve,
+ double theParameter,
+ bool takeOrientationIntoAccount)
{
- return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam);
+ return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam,
+ takeOrientationIntoAccount);
}
//=============================================================================
double theLength,
Handle(GEOM_Object) theStartPoint)
{
- return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength, theStartPoint);
+ return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength,
+ false, theStartPoint);
}
//=============================================================================
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
Standard_EXPORT Handle(GEOM_Object) MakePointWithReference (Handle(GEOM_Object) theReference,
double theX, double theY, double theZ);
- Standard_EXPORT Handle(GEOM_Object) MakePointOnCurve (Handle(GEOM_Object) theCurve,
- double theParameter);
+ Standard_EXPORT Handle(GEOM_Object) MakePointOnCurve
+ (Handle(GEOM_Object) theCurve,
+ double theParameter,
+ bool takeOrientationIntoAccount);
Standard_EXPORT Handle(GEOM_Object) MakePointOnCurveByLength (Handle(GEOM_Object) theCurve,
double theLength,
PointOn_Face
};
- Handle(GEOM_Object) makePointOnGeom (Handle(GEOM_Object) theGeomObj,
- double theParam1,
- double theParam2,
- double theParam3,
- const PointLocation theLocation,
- Handle(GEOM_Object) theRefPoint = 0);
+ Handle(GEOM_Object) makePointOnGeom
+ (Handle(GEOM_Object) theGeomObj,
+ double theParam1,
+ double theParam2,
+ double theParam3,
+ const PointLocation theLocation,
+ const bool takeOrientationIntoAccount = false,
+ Handle(GEOM_Object) theRefPoint = 0);
};
#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <Bnd_Box.hxx>
#include <GProp_GProps.hxx>
+#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+
+/**
+ * This function returns Standard_True if the face is quadrangular. It means
+ * that it has only 1 wire with 4 edges. If there are more then 4 edges in
+ * the wire and theToleranceC1 is not negative the new implementation is used.
+ * According to it the face is quadrangular if it is quadrangular according to
+ * an old implementation or if it has a single wire with more then 4 edges
+ * that form exactly 4 bounds of C1 continuity with the given tolerance.
+ *
+ * \param theFace the face to be checked
+ * \param theToleranceC1 if negative, it is not used; otherwise it is used
+ * to check if two neighbor edges of face have C1 continuity.
+ * \return Standard_True if the face is quadrangular; Standard_False otherwise.
+ */
+static Standard_Boolean IsQuadrangle(const TopoDS_Face &theFace,
+ const Standard_Real theToleranceC1)
+{
+ TopExp_Explorer aFExp (theFace, TopAbs_WIRE);
+
+ if (!aFExp.More()) {
+ // no wire in the face
+ return Standard_False;
+ }
+
+ TopoDS_Shape aWire = aFExp.Current();
+
+ aFExp.Next();
+
+ if (aFExp.More()) {
+ // multiple wires in the face
+ return Standard_False;
+ }
+
+ // Check number of edges in the face
+ Standard_Integer aNbEdges = 0;
+ TopTools_MapOfShape aMapEdges;
+ TopExp_Explorer aWExp(aWire, TopAbs_EDGE);
+
+ for (; aWExp.More(); aWExp.Next()) {
+ if (aMapEdges.Add(aWExp.Current())) {
+ aNbEdges++;
+
+ if (aNbEdges > 4) {
+ break;
+ }
+ }
+ }
+
+ if (aNbEdges < 4) {
+ return Standard_False;
+ }
+
+ if (aNbEdges > 4) {
+ if (theToleranceC1 < 0.) {
+ return Standard_False;
+ }
+
+ // Check if a wire has 4 bounds of C1 continuity.
+ BRepTools_WireExplorer aWireExp(TopoDS::Wire(aWire), theFace);
+ TopTools_ListOfShape anEdges;
+
+ for (aNbEdges = 0; aWireExp.More(); aWireExp.Next()) {
+ const TopoDS_Edge &anEdge = aWireExp.Current();
+
+ // Skip degenerated edges.
+ if (!BRep_Tool::Degenerated(anEdge)) {
+ anEdges.Append(anEdge);
+ ++aNbEdges;
+ }
+ }
+
+ if (aNbEdges < 4) {
+ return Standard_False;
+ }
+
+ // Compute number of sharp corners.
+ anEdges.Append(anEdges.First()); // To make a loop.
+
+ TopTools_ListIteratorOfListOfShape anIter(anEdges);
+ Standard_Real aPar[2];
+ Standard_Integer aNbCorners = 0;
+ TopoDS_Edge anEdge1 = TopoDS::Edge(anEdges.First());
+ Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(anEdge1, aPar[0], aPar[1]);
+ Handle(Geom_Curve) aCurve2;
+ TopoDS_Edge anEdge2;
+ TopoDS_Vertex aCommonVtx;
+ gp_Pnt aPnt;
+ gp_Vec aVec1;
+ gp_Vec aVec2;
+ Standard_Boolean isReversed1 = (anEdge1.Orientation() == TopAbs_REVERSED);
+ Standard_Boolean isReversed2;
+
+ for (anIter.Next(); anIter.More(); anIter.Next()) {
+ TopoDS_Edge anEdge2 = TopoDS::Edge(anIter.Value());
+
+ if (!TopExp::CommonVertex(anEdge1, anEdge2, aCommonVtx)) {
+ // NEVERREACHED
+ return Standard_False;
+ }
+
+ // Check the angle between tangent vectors of 2 curves at this point.
+ Standard_Real aParam1 = BRep_Tool::Parameter(aCommonVtx, anEdge1);
+ Standard_Real aParam2 = BRep_Tool::Parameter(aCommonVtx, anEdge2);
+
+ aCurve2 = BRep_Tool::Curve(anEdge2, aPar[0], aPar[1]);
+ isReversed2 = (anEdge2.Orientation() == TopAbs_REVERSED);
+ aCurve1->D1(aParam1, aPnt, aVec1);
+ aCurve2->D1(aParam2, aPnt, aVec2);
+
+ if (isReversed1) {
+ aVec1.Reverse();
+ }
+
+ if (isReversed2) {
+ aVec2.Reverse();
+ }
+ const Standard_Real anAngle = aVec1.Angle(aVec2);
+
+ if (anAngle > theToleranceC1) {
+ ++aNbCorners;
+
+ if (aNbCorners > 4) {
+ break;
+ }
+ }
+
+ // Go to the next couple of edges.
+ anEdge1 = anEdge2;
+ aCurve1 = aCurve2;
+ isReversed1 = isReversed2;
+ }
+
+ // Check the total number of corners.
+ if (aNbCorners != 4) {
+ return Standard_False;
+ }
+ }
+
+ return Standard_True;
+}
+
//=============================================================================
/*!
* constructor:
TopTools_ListOfShape& BLO,
TopTools_ListOfShape& NOT,
TopTools_ListOfShape& EXT,
- TopTools_ListOfShape& NOQ)
+ TopTools_ListOfShape& NOQ,
+ const Standard_Real theToleranceC1)
{
TopAbs_ShapeEnum aType = theShape.ShapeType();
switch (aType) {
{
TopoDS_Iterator It (theShape);
for (; It.More(); It.Next()) {
- AddBlocksFrom(It.Value(), BLO, NOT, EXT, NOQ);
+ AddBlocksFrom(It.Value(), BLO, NOT, EXT, NOQ, theToleranceC1);
}
}
break;
// Check, if there are seam or degenerated edges
BlockFix_CheckTool aTool;
aTool.SetShape(theShape);
+ aTool.SetAngTolerance(theToleranceC1);
aTool.Perform();
if (aTool.NbPossibleBlocks() > 0) {
EXT.Append(theShape);
TopExp_Explorer expF (theShape, TopAbs_FACE);
for (; expF.More(); expF.Next()) {
- if (mapFaces.Add(expF.Current())) {
- nbFaces++;
- //0021483//if (nbFaces > 6) break;
+ TopoDS_Face aF = TopoDS::Face(expF.Current());
- // get wire
- TopoDS_Shape aF = expF.Current();
- TopExp_Explorer wires (aF, TopAbs_WIRE);
- if (!wires.More()) {
- // no wire in the face
- hasNonQuadr = Standard_True;
- NOQ.Append(aF);//0021483
- //0021483//break;
- continue;
- }
- TopoDS_Shape aWire = wires.Current();
- wires.Next();
- if (wires.More()) {
- // multiple wires in the face
- hasNonQuadr = Standard_True;
- NOQ.Append(aF);//0021483
- //0021483//break;
- continue;
- }
+ if (mapFaces.Add(aF)) {
+ nbFaces++;
- // Check number of edges in the face
- Standard_Integer nbEdges = 0;
- TopTools_MapOfShape mapEdges;
- TopExp_Explorer expW (aWire, TopAbs_EDGE);
- for (; expW.More(); expW.Next()) {
- if (mapEdges.Add(expW.Current())) {
- nbEdges++;
- if (nbEdges > 4) break;
- }
- }
- if (nbEdges != 4) {
+ if (!IsQuadrangle(aF, theToleranceC1)) {
hasNonQuadr = Standard_True;
NOQ.Append(aF);//0021483
}
TopTools_MapOfShape mapFaces;
TopExp_Explorer expF (theShape, TopAbs_FACE);
for (; expF.More(); expF.Next()) {
- if (mapFaces.Add(expF.Current())) {
- // get wire
- TopoDS_Shape aF = expF.Current();
- TopExp_Explorer wires (aF, TopAbs_WIRE);
- if (!wires.More()) {
- // no wire in the face
- NOQ.Append(aF);//0021483
- continue;
- }
- TopoDS_Shape aWire = wires.Current();
- wires.Next();
- if (wires.More()) {
- // multiple wires in the face
- NOQ.Append(aF);//0021483
- continue;
- }
+ TopoDS_Face aF = TopoDS::Face(expF.Current());
- // Check number of edges in the face
- Standard_Integer nbEdges = 0;
- TopTools_MapOfShape mapEdges;
- TopExp_Explorer expW (aWire, TopAbs_EDGE);
- for (; expW.More(); expW.Next()) {
- if (mapEdges.Add(expW.Current())) {
- nbEdges++;
- if (nbEdges > 4) break;
- }
- }
- if (nbEdges != 4) {
+ if (mapFaces.Add(aF)) {
+ if (!IsQuadrangle(aF, theToleranceC1)) {
NOQ.Append(aF);//0021483
}
}
}
}
-void AddBlocksFromOld (const TopoDS_Shape& theShape,
- TopTools_ListOfShape& BLO,
- TopTools_ListOfShape& NOT,
- TopTools_ListOfShape& DEG,
- TopTools_ListOfShape& SEA)
-{
- TopAbs_ShapeEnum aType = theShape.ShapeType();
- switch (aType) {
- case TopAbs_COMPOUND:
- case TopAbs_COMPSOLID:
- {
- TopoDS_Iterator It (theShape);
- for (; It.More(); It.Next()) {
- AddBlocksFromOld(It.Value(), BLO, NOT, DEG, SEA);
- }
- }
- break;
- case TopAbs_SOLID:
- {
- TopTools_MapOfShape mapFaces;
- TopExp_Explorer expF (theShape, TopAbs_FACE);
- Standard_Integer nbFaces = 0;
- Standard_Boolean hasNonQuadr = Standard_False;
- Standard_Boolean hasDegenerated = Standard_False;
- Standard_Boolean hasSeam = Standard_False;
- for (; expF.More(); expF.Next()) {
- if (mapFaces.Add(expF.Current())) {
- nbFaces++;
- if (nbFaces > 6) break;
-
- // Check number of edges in the face
- Standard_Integer nbEdges = 0;
- TopTools_MapOfShape mapEdges;
-
- // get wire
- TopoDS_Shape aF = expF.Current();
- TopExp_Explorer wires (aF, TopAbs_WIRE);
- if (!wires.More()) {
- // no wire in the face
- hasNonQuadr = Standard_True;
- break;
- }
- TopoDS_Shape aWire = wires.Current();
- wires.Next();
- if (wires.More()) {
- // multiple wires in the face
- hasNonQuadr = Standard_True;
- break;
- }
-
- // iterate on wire
- BRepTools_WireExplorer aWE (TopoDS::Wire(aWire), TopoDS::Face(aF));
- for (; aWE.More(); aWE.Next(), nbEdges++) {
- if (BRep_Tool::Degenerated(aWE.Current())) {
- // degenerated edge found
- hasDegenerated = Standard_True;
-// break;
- }
- if (mapEdges.Contains(aWE.Current())) {
- // seam edge found
- hasSeam = Standard_True;
-// break;
- }
- mapEdges.Add(aWE.Current());
- }
- if (nbEdges != 4) {
- hasNonQuadr = Standard_True;
- }
- }
- }
- if (nbFaces == 6) {
- if (hasDegenerated || hasSeam) {
- if (hasDegenerated) {
- DEG.Append(theShape);
- }
- if (hasSeam) {
- SEA.Append(theShape);
- }
- } else if (hasNonQuadr) {
- NOT.Append(theShape);
- } else {
- BLO.Append(theShape);
- }
- } else {
- NOT.Append(theShape);
- }
- }
- break;
- default:
- NOT.Append(theShape);
- }
-}
-
#define REL_NOT_CONNECTED 0
#define REL_OK 1
#define REL_NOT_GLUED 2
return Standard_False;
}
-//=============================================================================
-/*!
- * CheckCompoundOfBlocksOld
- */
-//=============================================================================
-Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocksOld
- (Handle(GEOM_Object) theCompound,
- std::list<BCError>& theErrors)
-{
- SetErrorCode(KO);
-
- if (theCompound.IsNull()) return Standard_False;
- TopoDS_Shape aBlockOrComp = theCompound->GetValue();
-
- Standard_Boolean isCompOfBlocks = Standard_True;
-
- // Map sub-shapes and their indices
- TopTools_IndexedMapOfShape anIndices;
- TopExp::MapShapes(aBlockOrComp, anIndices);
-
- // 1. Report non-blocks
- TopTools_ListOfShape NOT; // Not blocks
- TopTools_ListOfShape DEG; // Hexahedral solids, having degenerated edges
- TopTools_ListOfShape SEA; // Hexahedral solids, having seam edges
- TopTools_ListOfShape BLO; // All blocks from the given compound
- AddBlocksFromOld(aBlockOrComp, BLO, NOT, DEG, SEA);
-
- if (NOT.Extent() > 0) {
- isCompOfBlocks = Standard_False;
- BCError anErr;
- anErr.error = NOT_BLOCK;
- TopTools_ListIteratorOfListOfShape it (NOT);
- for (; it.More(); it.Next()) {
- anErr.incriminated.push_back(anIndices.FindIndex(it.Value()));
- }
- theErrors.push_back(anErr);
- }
-
- if (DEG.Extent() > 0 || SEA.Extent() > 0) {
- isCompOfBlocks = Standard_False;
- BCError anErr;
- anErr.error = EXTRA_EDGE;
-
- TopTools_ListIteratorOfListOfShape itDEG (DEG);
- for (; itDEG.More(); itDEG.Next()) {
- anErr.incriminated.push_back(anIndices.FindIndex(itDEG.Value()));
- }
-
- TopTools_ListIteratorOfListOfShape itSEA (SEA);
- for (; itSEA.More(); itSEA.Next()) {
- anErr.incriminated.push_back(anIndices.FindIndex(itSEA.Value()));
- }
-
- theErrors.push_back(anErr);
- }
-
- Standard_Integer nbBlocks = BLO.Extent();
- if (nbBlocks == 0) {
- isCompOfBlocks = Standard_False;
- SetErrorCode(OK);
- return isCompOfBlocks;
- }
- if (nbBlocks == 1) {
- SetErrorCode(OK);
- return isCompOfBlocks;
- }
-
- // Convert list of blocks into array for easy and fast access
- Standard_Integer ibl = 1;
- TopTools_Array1OfShape aBlocks (1, nbBlocks);
- TopTools_ListIteratorOfListOfShape BLOit (BLO);
- for (; BLOit.More(); BLOit.Next(), ibl++) {
- aBlocks.SetValue(ibl, BLOit.Value());
- }
-
- // 2. Find relations between all blocks,
- // report connection errors (NOT_GLUED and INVALID_CONNECTION)
- TColStd_Array2OfInteger aRelations (1, nbBlocks, 1, nbBlocks);
- aRelations.Init(REL_NOT_CONNECTED);
-
- Standard_Integer row = 1;
- for (row = 1; row <= nbBlocks; row++) {
- TopoDS_Shape aBlock = aBlocks.Value(row);
-
- Standard_Integer col = row + 1;
- for (; col <= nbBlocks; col++) {
- Standard_Integer aRel = BlocksRelation(aBlock, aBlocks.Value(col));
- if (aRel != REL_NOT_CONNECTED) {
- aRelations.SetValue(row, col, aRel);
- aRelations.SetValue(col, row, aRel);
- if (aRel == REL_NOT_GLUED) {
- // report connection error
- isCompOfBlocks = Standard_False;
- BCError anErr;
- anErr.error = NOT_GLUED;
- anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(row)));
- anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(col)));
- theErrors.push_back(anErr);
- } else if (aRel == REL_COLLISION_VV ||
- aRel == REL_COLLISION_FF ||
- aRel == REL_COLLISION_EE ||
- aRel == REL_UNKNOWN) {
- // report connection error
- isCompOfBlocks = Standard_False;
- BCError anErr;
- anErr.error = INVALID_CONNECTION;
- anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(row)));
- anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(col)));
- theErrors.push_back(anErr);
- } else {
- }
- }
- }
- }
-
- // 3. Find largest set of connected (good connection or not glued) blocks
- TColStd_MapOfInteger aProcessedMap;
- TColStd_MapOfInteger aLargestSet;
- TColStd_MapOfInteger aCurrentSet;
- for (ibl = 1; ibl <= nbBlocks; ibl++) {
- if (!aProcessedMap.Contains(ibl)) {
- aCurrentSet.Clear();
- FindConnected(ibl, aRelations, aProcessedMap, aCurrentSet);
- if (aCurrentSet.Extent() > aLargestSet.Extent()) {
- aLargestSet = aCurrentSet;
- }
- }
- }
-
- // 4. Report all blocks, isolated from <aLargestSet>
- BCError anErr;
- anErr.error = NOT_CONNECTED;
- Standard_Boolean hasIsolated = Standard_False;
- for (ibl = 1; ibl <= nbBlocks; ibl++) {
- if (!aLargestSet.Contains(ibl)) {
- aProcessedMap.Clear();
- if (!HasAnyConnection(ibl, aLargestSet, aRelations, aProcessedMap)) {
- // report connection absence
- hasIsolated = Standard_True;
- anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(ibl)));
- }
- }
- }
- if (hasIsolated) {
- isCompOfBlocks = Standard_False;
- theErrors.push_back(anErr);
- }
-
- SetErrorCode(OK);
- return isCompOfBlocks;
-}
-
//=============================================================================
/*!
* PrintBCErrors
//=============================================================================
Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocks
(Handle(GEOM_Object) theCompound,
+ const Standard_Real theToleranceC1,
std::list<BCError>& theErrors)
{
SetErrorCode(KO);
TopTools_ListOfShape EXT; // Hexahedral solids, having degenerated and/or seam edges
TopTools_ListOfShape BLO; // All blocks from the given compound
TopTools_ListOfShape NOQ; // All non-quadrangular faces
- AddBlocksFrom(aBlockOrComp, BLO, NOT, EXT, NOQ);
+ AddBlocksFrom(aBlockOrComp, BLO, NOT, EXT, NOQ, theToleranceC1);
// Report non-blocks
if (NOT.Extent() > 0) {
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetNonBlocks
- (Handle(GEOM_Object) theShape,
+ (Handle(GEOM_Object) theShape,
+ const Standard_Real theToleranceC1,
Handle(GEOM_Object)& theNonQuads)
{
SetErrorCode(KO);
TopTools_ListOfShape NOT; // Not blocks
TopTools_ListOfShape EXT; // Hexahedral solids, having degenerated and/or seam edges
TopTools_ListOfShape NOQ; // All non-quadrangular faces
- AddBlocksFrom(aShape, BLO, NOT, EXT, NOQ);
+ AddBlocksFrom(aShape, BLO, NOT, EXT, NOQ, theToleranceC1);
if (NOT.IsEmpty() && EXT.IsEmpty() && NOQ.IsEmpty()) {
SetErrorCode("NOT_FOUND_ANY");
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
std::list<int> incriminated;
};
- Standard_EXPORT Standard_Boolean CheckCompoundOfBlocksOld (Handle(GEOM_Object) theCompound,
- std::list<BCError>& theErrors);
-
Standard_EXPORT Standard_Boolean CheckCompoundOfBlocks (Handle(GEOM_Object) theCompound,
+ const Standard_Real theToleranceC1,
std::list<BCError>& theErrors);
Standard_EXPORT TCollection_AsciiString PrintBCErrors (Handle(GEOM_Object) theCompound,
const std::list<BCError>& theErrors);
- Standard_EXPORT Handle(GEOM_Object) GetNonBlocks (Handle(GEOM_Object) theShape,
+ Standard_EXPORT Handle(GEOM_Object) GetNonBlocks (Handle(GEOM_Object) theShape,
+ const Standard_Real theToleranceC1,
Handle(GEOM_Object)& theNonQuads);
Standard_EXPORT Handle(GEOM_Object) RemoveExtraEdges (Handle(GEOM_Object) theShape,
TopTools_ListOfShape& BLO,
TopTools_ListOfShape& NOT,
TopTools_ListOfShape& EXT,
- TopTools_ListOfShape& NOQ);
+ TopTools_ListOfShape& NOQ,
+ const Standard_Real theToleranceC1 = -1.);
// Extract blocks from blocks compounds
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) ExplodeCompoundOfBlocks
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
* =========== PYTHON ==============
* ==================================*/
-typedef struct {
- PyObject_HEAD
- int softspace;
- std::string *out;
- } PyStdOut;
-
-static void
-PyStdOut_dealloc(PyStdOut *self)
-{
- PyObject_Del(self);
-}
-
-static PyObject *
-PyStdOut_write(PyStdOut *self, PyObject *args)
+namespace
{
- char *c;
- int l;
- if (!PyArg_ParseTuple(args, "t#:write",&c, &l))
- return NULL;
-
- //std::cerr << c ;
- *(self->out)=*(self->out)+c;
-
- Py_INCREF(Py_None);
- return Py_None;
-}
+ typedef struct {
+ PyObject_HEAD
+ int softspace;
+ std::string *out;
+ } PyStdOut;
+
+ static void
+ PyStdOut_dealloc(PyStdOut *self)
+ {
+ PyObject_Del(self);
+ }
-static PyMethodDef PyStdOut_methods[] = {
- {"write", (PyCFunction)PyStdOut_write, METH_VARARGS,
- PyDoc_STR("write(string) -> None")},
- {NULL, NULL} /* sentinel */
-};
-
-static PyMemberDef PyStdOut_memberlist[] = {
- {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
- (char*)"flag indicating that a space needs to be printed; used by print"},
- {NULL} /* Sentinel */
-};
-
-static PyTypeObject PyStdOut_Type = {
- /* The ob_type field must be initialized in the module init function
- * to be portable to Windows without using C++. */
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
- "PyOut", /*tp_name*/
- sizeof(PyStdOut), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- /* methods */
- (destructor)PyStdOut_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
- PyObject_GenericGetAttr, /*tp_getattro*/
- /* softspace is writable: we must supply tp_setattro */
- PyObject_GenericSetAttr, /* tp_setattro */
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- 0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
- 0, /*tp_richcompare*/
- 0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
- PyStdOut_methods, /*tp_methods*/
- PyStdOut_memberlist, /*tp_members*/
- 0, /*tp_getset*/
- 0, /*tp_base*/
- 0, /*tp_dict*/
- 0, /*tp_descr_get*/
- 0, /*tp_descr_set*/
- 0, /*tp_dictoffset*/
- 0, /*tp_init*/
- 0, /*tp_alloc*/
- 0, /*tp_new*/
- 0, /*tp_free*/
- 0, /*tp_is_gc*/
-};
-
-PyObject * newPyStdOut( std::string& out )
-{
- PyStdOut *self;
- self = PyObject_New(PyStdOut, &PyStdOut_Type);
- if (self == NULL)
- return NULL;
- self->softspace = 0;
- self->out=&out;
- return (PyObject*)self;
+ static PyObject*
+ PyStdOut_write(PyStdOut* self, PyObject* args)
+ {
+ char *c;
+ int l;
+ if (!PyArg_ParseTuple(args, "t#:write", &c, &l))
+ return NULL;
+
+ *(self->out) = *(self->out) + c;
+
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+
+ static PyMethodDef PyStdOut_methods[] = {
+ {"write", (PyCFunction)PyStdOut_write, METH_VARARGS,
+ PyDoc_STR("write(string) -> None")},
+ {NULL, NULL} /* sentinel */
+ };
+
+ static PyMemberDef PyStdOut_memberlist[] = {
+ {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
+ (char*)"flag indicating that a space needs to be printed; used by print"},
+ {NULL} /* Sentinel */
+ };
+
+ static PyTypeObject PyStdOut_Type = {
+ /* The ob_type field must be initialized in the module init function
+ * to be portable to Windows without using C++. */
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "PyOut", /*tp_name*/
+ sizeof(PyStdOut), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor)PyStdOut_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ /* softspace is writable: we must supply tp_setattro */
+ PyObject_GenericSetAttr, /* tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ PyStdOut_methods, /*tp_methods*/
+ PyStdOut_memberlist, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ 0, /*tp_init*/
+ 0, /*tp_alloc*/
+ 0, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ };
+
+ PyObject* newPyStdOut( std::string& out )
+ {
+ PyStdOut* self = PyObject_New(PyStdOut, &PyStdOut_Type);
+ if (self) {
+ self->softspace = 0;
+ self->out=&out;
+ }
+ return (PyObject*)self;
+ }
}
-
////////////////////////END PYTHON///////////////////////////
//=============================================================================
/*!
PyObject * func = NULL;
func = PyObject_GetAttrString(main_mod, "coordCalculator");
-
+
if (func == NULL){
SetErrorCode("Can't get function from python module !!!");
PyGILState_Release(gstate);
else
coords = PyObject_CallFunction(func,(char*)"(d, d, d)", theParamMin, theParamMax, theParamStep );
- PyObject* new_stderr = NULL;
-
if (coords == NULL){
fflush(stderr);
std::string err_description="";
- new_stderr = newPyStdOut(err_description);
+ PyObject* new_stderr = newPyStdOut(err_description);
+ PyObject* old_stderr = PySys_GetObject((char*)"stderr");
+ Py_INCREF(old_stderr);
PySys_SetObject((char*)"stderr", new_stderr);
PyErr_Print();
- PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ PySys_SetObject((char*)"stderr", old_stderr);
Py_DECREF(new_stderr);
MESSAGE("Can't evaluate coordCalculator()" << " error is " << err_description);
SetErrorCode("Can't evaluate the expressions, please check them !!!");
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//NOTE: This is an intreface to a function for the Filling operation.
//
#include "GEOM_Function.hxx"
+#include <TColStd_HSequenceOfTransient.hxx>
-#define FILL_ARG_MINDEG 1
-#define FILL_ARG_MAXDEG 2
-#define FILL_ARG_TOL2D 3
-#define FILL_ARG_TOL3D 4
-#define FILL_ARG_SHAPE 5
-#define FILL_ARG_NBITER 6
-#define FILL_ARG_APPROX 7
-#define FILL_ARG_METHOD 8
+enum GEOMImpl_IFilling_Arg {
+ FILL_ARG_MINDEG = 1,
+ FILL_ARG_MAXDEG = 2,
+ FILL_ARG_TOL2D = 3,
+ FILL_ARG_TOL3D = 4,
+ FILL_ARG_SHAPE = 5,
+ FILL_ARG_NBITER = 6,
+ FILL_ARG_APPROX = 7,
+ FILL_ARG_METHOD = 8
+};
class GEOMImpl_IFilling
{
- public:
+public:
GEOMImpl_IFilling(Handle(GEOM_Function) theFunction): _func(theFunction) {}
-
+
void SetTol2D(double theTol2D) { _func->SetReal(FILL_ARG_TOL2D, theTol2D); }
- void SetTol3D(double theTol3D) { _func->SetReal(FILL_ARG_TOL3D, theTol3D); }
+ void SetTol3D(double theTol3D) { _func->SetReal(FILL_ARG_TOL3D, theTol3D); }
double GetTol2D() { return _func->GetReal(FILL_ARG_TOL2D); }
- double GetTol3D() { return _func->GetReal(FILL_ARG_TOL3D); }
-
+ double GetTol3D() { return _func->GetReal(FILL_ARG_TOL3D); }
+
void SetMinDeg(int theMinDeg) { _func->SetInteger(FILL_ARG_MINDEG, theMinDeg); }
void SetMaxDeg(int theMaxDeg) { _func->SetInteger(FILL_ARG_MAXDEG, theMaxDeg); }
int GetMinDeg() { return _func->GetInteger(FILL_ARG_MINDEG); }
int GetMaxDeg() { return _func->GetInteger(FILL_ARG_MAXDEG); }
void SetNbIter(int theNbIter) { _func->SetInteger(FILL_ARG_NBITER, theNbIter); }
- int GetNbIter() { return _func->GetInteger(FILL_ARG_NBITER); }
+ int GetNbIter() { return _func->GetInteger(FILL_ARG_NBITER); }
void SetApprox(bool theApprox) { _func->SetInteger(FILL_ARG_APPROX, theApprox); }
- bool GetApprox() { return _func->GetInteger(FILL_ARG_APPROX); }
+ bool GetApprox() { return _func->GetInteger(FILL_ARG_APPROX); }
void SetMethod(int theMethod) { _func->SetInteger(FILL_ARG_METHOD, theMethod); }
- int GetMethod() { return _func->GetInteger(FILL_ARG_METHOD); }
+ int GetMethod() { return _func->GetInteger(FILL_ARG_METHOD); }
+ void SetShapes(const Handle(TColStd_HSequenceOfTransient)& theShapes)
+ { _func->SetReferenceList(FILL_ARG_SHAPE, theShapes); }
+ Handle(TColStd_HSequenceOfTransient) GetShapes()
+ {
+ Handle(TColStd_HSequenceOfTransient) aSeq = _func->GetReferenceList(FILL_ARG_SHAPE);
+ if ( aSeq.IsNull() ) {
+ Handle(GEOM_Function) fun = GetShape();
+ if ( !fun.IsNull() ) {
+ aSeq = new TColStd_HSequenceOfTransient;
+ aSeq->Append( fun );
+ }
+ }
+ return aSeq;
+ }
void SetShape(Handle(GEOM_Function) theShape) { _func->SetReference(FILL_ARG_SHAPE, theShape); }
Handle(GEOM_Function) GetShape() { return _func->GetReference(FILL_ARG_SHAPE); }
- private:
+private:
Handle(GEOM_Function) _func;
};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TColStd_HSequenceOfTransient.hxx>
-#define GLUE_ARG_BASE 1
-#define GLUE_ARG_TOLER 2
-#define GLUE_ARG_FACES 3
+#define GLUE_ARG_BASE 1
+#define GLUE_ARG_TOLER 2
+#define GLUE_ARG_FACES 3
#define GLUE_ARG_KEEPALL 4
#define GLUE_ARG_GLUEEDG 5
GEOMImpl_IGlue(Handle(GEOM_Function) theFunction): _func(theFunction) {}
- void SetBase(Handle(GEOM_Function) theRefBase)
- { _func->SetReference(GLUE_ARG_BASE, theRefBase); }
+ void SetBase(const Handle(TColStd_HSequenceOfTransient)& theShapes)
+ { _func->SetReferenceList(GLUE_ARG_BASE, theShapes); }
- Handle(GEOM_Function) GetBase() { return _func->GetReference(GLUE_ARG_BASE); }
+ Handle(TColStd_HSequenceOfTransient) GetBase()
+ { return _func->GetReferenceList(GLUE_ARG_BASE); }
void SetTolerance(const Standard_Real theTolerance)
{ _func->SetReal(GLUE_ARG_TOLER, theTolerance); }
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray1OfExtendedString.hxx>
-#include "TColStd_HSequenceOfTransient.hxx"
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <TopAbs.hxx>
+#include <ShHealOper_ModifStats.hxx>
class GEOMImpl_IHealing
{
ARG_DEV_EDGE_VALUE = 8,
ARG_IS_BY_PARAMETER = 9,
ARG_SUBSHAPE_INDEX = 10,
- ARG_LIST_SHAPES = 11
+ ARG_LIST_SHAPES = 11,
+ ARG_TYPE = 12
};
GEOMImpl_IHealing(Handle(GEOM_Function) theFunction): _func(theFunction) {}
void SetValues( const Handle(TColStd_HArray1OfExtendedString)& arr ) { if ( !arr.IsNull() ) _func->SetStringArray(ARG_SHAPE_PROCESS_VALUES, arr); }
Handle(TColStd_HArray1OfExtendedString) GetValues() { return _func->GetStringArray(ARG_SHAPE_PROCESS_VALUES); }
- void SetOriginal( Handle(GEOM_Function)& f ) { _func->SetReference(ARG_ORIGINAL, f); }
+ void SetOriginal( Handle(GEOM_Function) f ) { _func->SetReference(ARG_ORIGINAL, f); }
Handle(GEOM_Function) GetOriginal() { return _func->GetReference(ARG_ORIGINAL); }
void SetFaces( const Handle(TColStd_HArray1OfInteger)& arr ) { if ( !arr.IsNull() ) _func->SetIntegerArray(ARG_LIST_ARGUMENTS, arr); }
void SetTolerance( Standard_Real val ) { _func->SetReal(ARG_TOLERANCE, val); }
Standard_Real GetTolerance() { return _func->GetReal(ARG_TOLERANCE); }
+ void SetType( TopAbs_ShapeEnum val ) { _func->SetInteger(ARG_TYPE, (Standard_Integer)val); }
+ TopAbs_ShapeEnum GetType() { TopAbs_ShapeEnum type = (TopAbs_ShapeEnum)(_func->GetInteger(ARG_TYPE)); return _func->IsDone() ? type : TopAbs_SHAPE; }
+
void SetDevideEdgeValue( Standard_Real val ) { _func->SetReal(ARG_DEV_EDGE_VALUE, val); }
Standard_Real GetDevideEdgeValue() { return _func->GetReal(ARG_DEV_EDGE_VALUE); }
Handle(TColStd_HSequenceOfTransient) GetShapes()
{ return _func->GetReferenceList(ARG_LIST_SHAPES); }
+ Handle(TColStd_HSequenceOfTransient) GetOriginalAndShapes()
+ {
+ Handle(TColStd_HSequenceOfTransient) funs = GetShapes();
+ if ( funs.IsNull() ) funs = new TColStd_HSequenceOfTransient;
+ funs->Prepend( GetOriginal() );
+ return funs;
+ }
+
+ void SetStatistics( ShHealOper_ModifStats* ms )
+ {
+ if ( ms ) ms->Clear();
+ _func->SetCallBackData( (void*) ms );
+ }
+ ShHealOper_ModifStats* GetStatistics()
+ {
+ return (ShHealOper_ModifStats*) _func->GetCallBackData();
+ }
+
private:
Handle(GEOM_Function) _func;
};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#endif
#include <Standard_Version.hxx>
-#include <Standard_Stream.hxx>
#include <GEOMImpl_IHealingOperations.hxx>
-
#include <GEOM_PythonDump.hxx>
-
#include <GEOMImpl_HealingDriver.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOMImpl_IHealing.hxx>
#include <GEOMImpl_IVector.hxx>
#include <GEOMImpl_VectorDriver.hxx>
#include <GEOMImpl_CopyDriver.hxx>
+#include <ShHealOper_ModifStats.hxx>
+#include <ShHealOper_ShapeProcess.hxx>
#include <Basics_OCCTVersion.hxx>
-#include "utilities.h"
+#include <utilities.h>
#include <OpUtil.hxx>
#include <Utils_ExceptHandlers.hxx>
-#include <ShHealOper_ShapeProcess.hxx>
-
+#include <BRep_Builder.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
-
-#include <TopoDS_Compound.hxx>
-#include <TopExp_Explorer.hxx>
-
#include <TColStd_HArray1OfExtendedString.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TCollection_AsciiString.hxx>
-
-#include <TDF_Tool.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_SequenceOfShape.hxx>
+#include <TopoDS_Compound.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
GEOMImpl_IHealingOperations::GEOMImpl_IHealingOperations (GEOM_Engine* theEngine, int theDocID)
: GEOM_IOperations(theEngine, theDocID)
{
+ myModifStats = new ShHealOper_ModifStats;
MESSAGE("GEOMImpl_IHealingOperations::GEOMImpl_IHealingOperations");
}
//=============================================================================
GEOMImpl_IHealingOperations::~GEOMImpl_IHealingOperations()
{
+ delete myModifStats;
MESSAGE("GEOMImpl_IHealingOperations::~GEOMImpl_IHealingOperations");
}
HI.SetParameters( theParams );
HI.SetValues( theValues );
}
+ HI.SetStatistics( myModifStats );
//Compute the translation
try {
} else if( theOperation == "DropSmallEdges" ) {
theParams.push_back( "DropSmallEdges.Tolerance3d" );
+ } else if( theOperation == "DropSmallSolids" ) {
+ theParams.push_back( "DropSmallSolids.WidthFactorThreshold" );
+ theParams.push_back( "DropSmallSolids.VolumeThreshold" );
+ theParams.push_back( "DropSmallSolids.MergeSolids" );
+
} else if( theOperation == "BSplineRestriction" ) {
theParams.push_back( "BSplineRestriction.SurfaceMode" );
theParams.push_back( "BSplineRestriction.Curve3dMode" );
GEOMImpl_IHealing HI (aFunction);
HI.SetFaces(theFaces);
HI.SetOriginal(aLastFunction);
+ HI.SetStatistics( myModifStats );
//Compute the translation
try {
HI.SetWires( theWires );
HI.SetIsCommonVertex( isCommonVertex );
HI.SetOriginal( aLastFunction );
+ HI.SetStatistics( myModifStats );
//Compute the translation
try {
GEOMImpl_IHealing HI(aFunction);
HI.SetWires( theWires );
HI.SetOriginal( aLastFunction );
+ HI.SetStatistics( myModifStats );
//Compute the translation
try {
GEOMImpl_IHealing HI(aFunction);
HI.SetWires( theWires );
HI.SetOriginal( aLastFunction );
+ HI.SetStatistics( myModifStats );
//Compute the translation
try {
* Sew
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IHealingOperations::Sew (Handle(GEOM_Object) theObject,
- double theTolerance,
- bool isAllowNonManifold)
+Handle(GEOM_Object)
+GEOMImpl_IHealingOperations::Sew (std::list<Handle(GEOM_Object)>& theObjects,
+ double theTolerance,
+ bool isAllowNonManifold)
{
// set error code, check parameters
SetErrorCode(KO);
- if (theObject.IsNull())
+ if (theObjects.empty())
return NULL;
- Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
- if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed
+ Handle(TColStd_HSequenceOfTransient) objects =
+ GEOM_Object::GetLastFunctions( theObjects );
+ if ( objects.IsNull() || objects->IsEmpty() ) {
+ SetErrorCode("NULL argument shape");
+ return NULL;
+ }
// Add a new object
Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY );
//Add the function
int aFunctionType = (isAllowNonManifold ? SEWING_NON_MANIFOLD : SEWING);
-
- aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), aFunctionType);
-
+ Handle(GEOM_Function) aFunction =
+ aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), aFunctionType);
if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
// prepare "data container" class IHealing
GEOMImpl_IHealing HI(aFunction);
HI.SetTolerance( theTolerance );
- HI.SetOriginal( aLastFunction );
+ HI.SetOriginal( theObjects.front()->GetLastFunction() ); objects->Remove(1);
+ HI.SetShapes( objects );
+ HI.SetStatistics( myModifStats );
//Compute the result
try {
//Make a Python command
GEOM::TPythonDump pd(aFunction);
- pd << aNewObject << " = geompy.Sew(" << theObject << ", " << theTolerance;
+ pd << aNewObject << " = geompy.Sew(" << theObjects << ", " << theTolerance;
if (isAllowNonManifold) {
- pd << ", true";
+ pd << ", True";
}
pd << ")";
* RemoveInternalFaces
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IHealingOperations::RemoveInternalFaces (Handle(GEOM_Object) theObject)
+Handle(GEOM_Object)
+GEOMImpl_IHealingOperations::RemoveInternalFaces (std::list< Handle(GEOM_Object)> & theSolids)
{
// set error code, check parameters
SetErrorCode(KO);
- if (theObject.IsNull())
+ if (theSolids.empty())
return NULL;
- Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
- if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed
+ Handle(TColStd_HSequenceOfTransient) objects = GEOM_Object::GetLastFunctions( theSolids );
+ if ( objects.IsNull() || objects->IsEmpty() ) {
+ SetErrorCode("NULL argument shape");
+ return NULL;
+ }
// Add a new object
Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
//Add the function
- aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), REMOVE_INTERNAL_FACES);
+ Handle(GEOM_Function)
+ aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), REMOVE_INTERNAL_FACES);
if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
// prepare "data container" class IHealing
GEOMImpl_IHealing HI (aFunction);
- HI.SetOriginal(aLastFunction);
+ HI.SetOriginal( theSolids.front()->GetLastFunction() ); objects->Remove(1);
+ HI.SetShapes( objects );
+ HI.SetStatistics( myModifStats );
//Compute the result
try {
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.RemoveInternalFaces(" << theObject << ")";
+ GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.RemoveInternalFaces(" << theSolids << ")";
SetErrorCode(OK);
return aNewObject;
HI.SetDevideEdgeValue( theValue );
HI.SetIsByParameter( isByParameter );
HI.SetOriginal( aLastFunction );
+ HI.SetStatistics( myModifStats );
//Compute the translation
try {
return aNewObject;
}
+//=============================================================================
+/*!
+ * DivideEdgeByPoint
+ */
+//=============================================================================
+Handle(GEOM_Object)
+GEOMImpl_IHealingOperations::DivideEdgeByPoint (Handle(GEOM_Object) theObject,
+ int theIndex,
+ std::list< Handle(GEOM_Object)> & thePoints)
+{
+ // set error code, check parameters
+ SetErrorCode(KO);
+
+ if (theObject.IsNull() || thePoints.empty() )
+ return NULL;
+
+ Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
+ if (aLastFunction.IsNull() )
+ return NULL; //There is no function which creates an object to be processed
+
+ Handle(TColStd_HSequenceOfTransient) aPointFunc = GEOM_Object::GetLastFunctions( thePoints );
+ if ( aPointFunc.IsNull() || aPointFunc->IsEmpty() ) {
+ SetErrorCode("NULL argument points");
+ return NULL;
+ }
+
+ // Add a new object
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY );
+
+ //Add the function
+ aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), DIVIDE_EDGE_BY_POINT);
+
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
+
+ // prepare "data container" class IHealing
+ GEOMImpl_IHealing HI(aFunction);
+ HI.SetIndex ( theIndex );
+ HI.SetOriginal ( aLastFunction );
+ HI.SetShapes ( aPointFunc );
+
+ HI.SetStatistics( myModifStats );
+
+ //Compute the translation
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Healing driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction)
+ << aNewObject << " = geompy.DivideEdgeByPoint(" << theObject
+ << ", " << theIndex << ", " << thePoints << ")";
+
+ SetErrorCode(OK);
+ return aNewObject;
+}
+
//=============================================================================
/*!
* FuseCollinearEdgesWithinWire
if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
GEOMImpl_IHealing aCI (aFunction);
+ aCI.SetStatistics( myModifStats );
Handle(GEOM_Function) aRefShape = theWire->GetLastFunction();
if (aRefShape.IsNull()) return NULL;
* GetFreeBoundary
*/
//=============================================================================
-bool GEOMImpl_IHealingOperations::GetFreeBoundary (Handle(GEOM_Object) theObject,
+bool GEOMImpl_IHealingOperations::GetFreeBoundary (Handle(TColStd_HSequenceOfTransient)& theObjects,
Handle(TColStd_HSequenceOfTransient)& theClosed,
Handle(TColStd_HSequenceOfTransient)& theOpen )
{
// set error code, check parameters
SetErrorCode(KO);
- if ( theObject.IsNull() || theClosed.IsNull() || theOpen.IsNull() )
+ if ( theObjects.IsNull() || theObjects->Length() == 0 ||
+ theClosed.IsNull() || theOpen.IsNull() )
return false;
- TopoDS_Shape aShape = theObject->GetValue();
- if ( aShape.IsNull() )
- return false;
+ TopoDS_Shape aShape;
+ TopTools_SequenceOfShape shapes;
+ for ( int ind = 1; ind <= theObjects->Length(); ind++)
+ {
+ Handle(GEOM_Object) aRefShape = Handle(GEOM_Object)::DownCast( theObjects->Value(ind));
+ if ( aRefShape.IsNull() )
+ return false;
+ aShape = aRefShape->GetValue();
+ if ( aShape.IsNull() )
+ return false;
+ shapes.Append( aShape );
+ }
+
+ if ( shapes.Length() > 1 )
+ {
+ TopoDS_Compound compound;
+ BRep_Builder builder;
+ builder.MakeCompound( compound );
+ for ( int i = 1; i <= shapes.Length(); ++i )
+ builder.Add( compound, shapes( i ) );
+
+ aShape = compound;
+ }
// get free boundary shapes
pd << "empty_list";
}
- pd << ") = geompy.GetFreeBoundary(" << theObject << ")";
+ pd << ") = geompy.GetFreeBoundary(" << theObjects << ")";
}
SetErrorCode(OK);
// prepare "data container" class IVector
GEOMImpl_IVector aVI (aFunction);
aVI.SetCurve(aLastFunction);
+
+ myModifStats->Clear();
+ myModifStats->AddModif( "Vector reversed" );
}
else {
//Add the function
// prepare "data container" class IHealing
GEOMImpl_IHealing HI (aFunction);
HI.SetOriginal(aLastFunction);
+ HI.SetStatistics( myModifStats );
}
//Compute the translation
return NULL; //There is no function which creates an object to be processed
// Add a new object
- Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
if (theObject->GetType() == GEOM_VECTOR) { // Mantis issue 21066
//Add the function
// prepare "data container" class IVector
GEOMImpl_IVector aVI (aFunction);
aVI.SetCurve(aLastFunction);
+
+ myModifStats->Clear();
+ myModifStats->AddModif( "Vector reversed" );
}
else {
//Add the function
// prepare "data container" class IHealing
GEOMImpl_IHealing aHI (aFunction);
aHI.SetOriginal(aLastFunction);
+ aHI.SetStatistics( myModifStats );
}
// Compute the result
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IHealingOperations::LimitTolerance (Handle(GEOM_Object) theObject,
- double theTolerance)
+ double theTolerance,
+ TopAbs_ShapeEnum theType)
{
// Set error code, check parameters
SetErrorCode(KO);
GEOMImpl_IHealing HI (aFunction);
HI.SetOriginal(aLastFunction);
HI.SetTolerance(theTolerance);
+ HI.SetType(theType);
+ HI.SetStatistics( myModifStats );
// Compute
try {
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GEOM_Engine.hxx"
#include "GEOM_Object.hxx"
+#include <TopAbs.hxx>
#include <TColStd_HArray1OfExtendedString.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <list>
+class ShHealOper_ModifStats;
+
class GEOMImpl_IHealingOperations : public GEOM_IOperations {
public:
Standard_EXPORT GEOMImpl_IHealingOperations(GEOM_Engine* theEngine, int theDocID);
Standard_EXPORT Handle(GEOM_Object) FillHoles( Handle(GEOM_Object) theObject,
const Handle(TColStd_HArray1OfInteger)& theWires);
- Standard_EXPORT Handle(GEOM_Object) Sew( Handle(GEOM_Object) theObject,
- double theTolerance,
- bool isAllowNonManifold);
+ Standard_EXPORT Handle(GEOM_Object) Sew( std::list<Handle(GEOM_Object)> & theObject,
+ double theTolerance,
+ bool isAllowNonManifold);
- Standard_EXPORT Handle(GEOM_Object) RemoveInternalFaces (Handle(GEOM_Object) theObject);
+ Standard_EXPORT Handle(GEOM_Object) RemoveInternalFaces (std::list< Handle(GEOM_Object)> & theSolids);
Standard_EXPORT Handle(GEOM_Object) DivideEdge( Handle(GEOM_Object) theObject,
- int theIndex,
- double theValue,
- bool isByParameter );
+ int theIndex,
+ double theValue,
+ bool isByParameter );
+
+ Standard_EXPORT Handle(GEOM_Object) DivideEdgeByPoint( Handle(GEOM_Object) theObject,
+ int theIndex,
+ std::list<Handle(GEOM_Object)>& thePoint );
Standard_EXPORT Handle(GEOM_Object) FuseCollinearEdgesWithinWire
(Handle(GEOM_Object) theWire,
// this function does not use Function-Driver mechanism, it just computes the free
// boundary edges and returns them in the sequence. It is called just for information reasons
// and it's not intended for history/undo/redo/etc..
- Standard_EXPORT bool GetFreeBoundary ( Handle(GEOM_Object) theObject,
- Handle(TColStd_HSequenceOfTransient)& theOutClosedWires,
- Handle(TColStd_HSequenceOfTransient)& theOutOpenWires );
+ Standard_EXPORT bool GetFreeBoundary ( Handle(TColStd_HSequenceOfTransient)& theObjects,
+ Handle(TColStd_HSequenceOfTransient)& theOutClosedWires,
+ Handle(TColStd_HSequenceOfTransient)& theOutOpenWires );
Standard_EXPORT Handle(GEOM_Object) ChangeOrientation( Handle(GEOM_Object) theObject);
Standard_EXPORT Handle(GEOM_Object) ChangeOrientationCopy( Handle(GEOM_Object) theObject);
Standard_EXPORT Handle(GEOM_Object) LimitTolerance( Handle(GEOM_Object) theObject,
- double theTolerance );
+ double theTolerance,
+ TopAbs_ShapeEnum theType = TopAbs_SHAPE );
+
+ const ShHealOper_ModifStats* GetStatistics() { return myModifStats; }
+
+private:
+ ShHealOper_ModifStats* myModifStats;
};
#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GEOMImpl_ImportDriver.hxx>
#include <GEOMImpl_ICopy.hxx>
#include <GEOMImpl_IImportExport.hxx>
+#include <GEOMImpl_ITransferData.hxx>
#include <GEOMImpl_Types.hxx>
#include "GEOMImpl_IShapesOperations.hxx"
#include "GEOMImpl_IGroupOperations.hxx"
SetErrorCode(OK);
return id_list;
}
+
+//=============================================================================
+/*!
+ * TransferData
+ */
+//=============================================================================
+bool GEOMImpl_IInsertOperations::TransferData
+ (const Handle(GEOM_Object) &theObjectFrom,
+ const Handle(GEOM_Object) &theObjectTo,
+ const int theFindMethod,
+ std::list<TransferDatum> &theResult)
+{
+ SetErrorCode(KO);
+
+ if (theObjectFrom.IsNull() || theObjectTo.IsNull()) {
+ return false;
+ }
+
+ //Add a new Transfer Data object object
+ Handle(GEOM_Object) aTDObj =
+ GetEngine()->AddObject(GetDocID(), GEOM_TRANSFER_DATA);
+
+ //Add a Transfer Data function for created object
+ Handle(GEOM_Function) aFunction =
+ aTDObj->AddFunction(GEOMImpl_CopyDriver::GetID(), TRANSFER_DATA);
+
+ //Check if the function is set correctly
+ if(aFunction->GetDriverGUID() != GEOMImpl_CopyDriver::GetID()) {
+ return false;
+ }
+
+ Handle(GEOM_Function) aFunctionFrom = theObjectFrom->GetLastFunction();
+ Handle(GEOM_Function) aFunctionTo = theObjectTo->GetLastFunction();
+
+ if (aFunctionFrom.IsNull() || aFunctionTo.IsNull()) {
+ return false;
+ }
+
+ GEOMImpl_ITransferData aTD(aFunction);
+
+ aTD.SetRef1(aFunctionFrom);
+ aTD.SetRef2(aFunctionTo);
+ aTD.SetFindMethod(theFindMethod);
+
+ // Transfer data
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Transfer data failed");
+ return false;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return false;
+ }
+
+ // Fill result list of data.
+ theResult.clear();
+
+ Handle(TColStd_HArray1OfExtendedString) aDatumName = aTD.GetDatumName();
+ Handle(TColStd_HArray1OfInteger) aDatumMaxVal = aTD.GetDatumMaxVal();
+ Handle(TColStd_HArray1OfInteger) aDatumVal = aTD.GetDatumVal();
+
+ if (!aDatumName.IsNull() && !aDatumMaxVal.IsNull() && !aDatumVal.IsNull()) {
+ Standard_Integer i;
+ Standard_Integer aNbDatum = aDatumName->Length();
+
+ for (i = 1; i <= aNbDatum; ++i) {
+ if (aDatumMaxVal->Value(i) > 0) {
+ TransferDatum aDatum;
+
+ aDatum.myName = TCollection_AsciiString(aDatumName->Value(i));
+ aDatum.myNumber = aDatumVal->Value(i);
+ aDatum.myMaxNumber = aDatumMaxVal->Value(i);
+ theResult.push_back(aDatum);
+ }
+ }
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction);
+ pd << "geompy.TransferData(" << theObjectFrom << ", " << theObjectTo;
+ pd << ", GEOM.";
+
+ switch (theFindMethod) {
+ case TD_GET_IN_PLACE:
+ pd << "FSM_GetInPlace";
+ break;
+ case TD_GET_IN_PLACE_OLD:
+ pd << "FSM_GetInPlace_Old";
+ break;
+ case TD_GET_IN_PLACE_BY_HISTORY:
+ default:
+ pd << "FSM_GetInPlaceByHistory";
+ break;
+ }
+ pd << ")";
+
+ SetErrorCode(OK);
+
+ return true;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
class GEOMImpl_IInsertOperations : public GEOM_IOperations {
public:
+
+ struct TransferDatum
+ {
+ TCollection_AsciiString myName;
+ long myNumber;
+ long myMaxNumber;
+ };
+
Standard_EXPORT GEOMImpl_IInsertOperations(GEOM_Engine* theEngine, int theDocID);
Standard_EXPORT ~GEOMImpl_IInsertOperations();
Standard_EXPORT std::list<int> GetAllTextures();
+ Standard_EXPORT bool TransferData
+ (const Handle(GEOM_Object) &theObjectFrom,
+ const Handle(GEOM_Object) &theObjectTo,
+ const int theFindMethod,
+ std::list<TransferDatum> &theResult);
+
private:
std::vector<Handle(Resource_Manager)> myResMgrList;
GEOMImpl_IShapesOperations* myShapesOperations;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+#include <Basics_OCCTVersion.hxx>
+
#include <GEOMImpl_IMeasureOperations.hxx>
#include <GEOMImpl_IMeasure.hxx>
#include <GEOMImpl_MeasureDriver.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
+#include <BRepExtrema_ShapeProximity.hxx>
+#if OCC_VERSION_LARGE > 0x06090000
+#include <BRepExtrema_SelfIntersection.hxx>
+#include <BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx>
+#endif
#include <BRepGProp.hxx>
#include <BRepTools.hxx>
#include <BRep_Tool.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <GeomLProp_CLProps.hxx>
#include <GeomLProp_SLProps.hxx>
+#include <Geom_Plane.hxx>
#include <GProp_GProps.hxx>
#include <GProp_PrincipalProps.hxx>
#include <ShapeAnalysis.hxx>
#include <TopoDS_Edge.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape.hxx>
+#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+#include <set>
+
//=============================================================================
/*!
* Constructor
}
const GEOMAlgo_ShapeInfo& anInfo = aSF.Info();
+ // specific processing for some "advandced" objects
+ switch ( geom_type ) {
+ case GEOM_MARKER:
+ // local coordinate systen
+ // (+) geompy.kind.LCS xc yc zc xx xy xz yx yy yz zx zy zz
+
+ TopoDS_Face aFace = TopoDS::Face( aShape );
+ Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) );
+ gp_Pnt aC = aPlane->Pln().Location();
+ gp_Ax3 anAx3 = aPlane->Pln().Position();
+
+ theDoubles->Append(aC.X());
+ theDoubles->Append(aC.Y());
+ theDoubles->Append(aC.Z());
+
+ gp_Dir aD = anAx3.XDirection();
+ theDoubles->Append(aD.X());
+ theDoubles->Append(aD.Y());
+ theDoubles->Append(aD.Z());
+ aD = anAx3.YDirection();
+ theDoubles->Append(aD.X());
+ theDoubles->Append(aD.Y());
+ theDoubles->Append(aD.Z());
+ aD = anAx3.Direction();
+ theDoubles->Append(aD.X());
+ theDoubles->Append(aD.Y());
+ theDoubles->Append(aD.Z());
+
+ SetErrorCode(OK);
+ return SK_LCS;
+ }
+
// Interprete results
TopAbs_ShapeEnum aType = anInfo.Type();
switch (aType)
theDoubles->Append(aD.X());
theDoubles->Append(aD.Y());
theDoubles->Append(aD.Z());
+
+ if (anInfo.KindOfBounds() != GEOMAlgo_KB_INFINITE)
+ {
+ // (+) geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices
+ aKind = SK_PLANAR;
+
+ theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE));
+ theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX));
+ }
}
break;
default:
- if (anInfo.KindOfShape() == GEOMAlgo_KS_PLANE) {
- // (+) geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices
-
- aKind = SK_PLANAR;
-
- gp_Pnt aC = anInfo.Location();
- theDoubles->Append(aC.X());
- theDoubles->Append(aC.Y());
- theDoubles->Append(aC.Z());
-
- gp_Ax3 anAx3 = anInfo.Position();
- gp_Dir aD = anAx3.Direction();
- theDoubles->Append(aD.X());
- theDoubles->Append(aD.Y());
- theDoubles->Append(aD.Z());
-
- theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE));
- theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX));
- }
- else {
- // ??? geompy.kind.FACE nb_edges nb_vertices _surface_type_id_
- // (+) geompy.kind.FACE nb_edges nb_vertices
-
- theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE));
- theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX));
- }
+ // ??? geompy.kind.FACE nb_edges nb_vertices _surface_type_id_
+ // (+) geompy.kind.FACE nb_edges nb_vertices
+ theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE));
+ theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX));
}
}
break;
//=============================================================================
bool GEOMImpl_IMeasureOperations::CheckSelfIntersections
(Handle(GEOM_Object) theShape,
+ const SICheckLevel theCheckLevel,
Handle(TColStd_HSequenceOfInteger)& theIntersections)
{
SetErrorCode(KO);
- bool isGood = false;
if (theIntersections.IsNull())
theIntersections = new TColStd_HSequenceOfInteger;
theIntersections->Clear();
if (theShape.IsNull())
- return isGood;
+ return false;
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
- if (aRefShape.IsNull()) return isGood;
+ if (aRefShape.IsNull()) return false;
TopoDS_Shape aShape = aRefShape->GetValue();
- if (aShape.IsNull()) return isGood;
+ if (aShape.IsNull()) return false;
// 0. Prepare data
TopoDS_Shape aScopy;
//
BOPAlgo_CheckerSI aCSI; // checker of self-interferences
aCSI.SetArguments(aLCS);
+ aCSI.SetLevelOfCheck(theCheckLevel);
// 1. Launch the checker
aCSI.Perform();
Standard_Integer iErr = aCSI.ErrorStatus();
- isGood = true;
//
Standard_Integer aNbS, n1, n2;
BOPDS_MapIteratorMapOfPassKey aItMPK;
theIntersections->Append(anIndices.FindIndex(aS1));
theIntersections->Append(anIndices.FindIndex(aS2));
- isGood = false;
}
if (!iErr) {
SetErrorCode(OK);
}
+ return theIntersections->IsEmpty();
+}
+
+//=============================================================================
+/*!
+ * CheckSelfIntersectionsFast
+ */
+//=============================================================================
+bool GEOMImpl_IMeasureOperations::CheckSelfIntersectionsFast
+ (Handle(GEOM_Object) theShape,
+ float theDeflection, double theTolerance,
+ Handle(TColStd_HSequenceOfInteger)& theIntersections)
+{
+ SetErrorCode(KO);
+
+ if (theIntersections.IsNull())
+ theIntersections = new TColStd_HSequenceOfInteger;
+ else
+ theIntersections->Clear();
+
+ if (theShape.IsNull())
+ return false;
+
+ Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+ if (aRefShape.IsNull()) return false;
+
+ TopoDS_Shape aShape = aRefShape->GetValue();
+ if (aShape.IsNull()) return false;
+
+ // Prepare data
+ TopoDS_Shape aScopy;
+
+ GEOMAlgo_AlgoTools::CopyShape(aShape, aScopy);
+ GEOMUtils::MeshShape(aScopy, theDeflection);
+
+ // Map sub-shapes and their indices
+ TopTools_IndexedMapOfShape anIndices;
+ TopExp::MapShapes(aScopy, anIndices);
+
+#if OCC_VERSION_LARGE > 0x06090000
+ // Checker of fast interferences
+ BRepExtrema_SelfIntersection aTool(aScopy, (theTolerance <= 0.) ? 0.0 : theTolerance);
+
+ // Launch the checker
+ aTool.Perform();
+
+ const BRepExtrema_MapOfIntegerPackedMapOfInteger& intersections = aTool.OverlapElements();
+
+ std::set<Standard_Integer> processed;
+
+ for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator it(intersections); it.More(); it.Next()) {
+ Standard_Integer idxLeft = it.Key();
+ if (processed.count(idxLeft) > 0) continue; // already added
+ processed.insert(idxLeft);
+ const TColStd_PackedMapOfInteger& overlaps = it.Value();
+ for (TColStd_MapIteratorOfPackedMapOfInteger subit(overlaps); subit.More(); subit.Next()) {
+ Standard_Integer idxRight = subit.Key();
+ if (processed.count(idxRight) > 0) continue; // already added
+ const TopoDS_Shape& aS1 = aTool.GetSubShape(idxLeft);
+ const TopoDS_Shape& aS2 = aTool.GetSubShape(idxRight);
+ theIntersections->Append(anIndices.FindIndex(aS1));
+ theIntersections->Append(anIndices.FindIndex(aS2));
+ }
+ }
+
+ if (aTool.IsDone())
+ SetErrorCode(OK);
+#endif
+
+ return theIntersections->IsEmpty();
+}
+
+//=============================================================================
+/*!
+ * FastIntersect
+ */
+//=============================================================================
+bool GEOMImpl_IMeasureOperations::FastIntersect (Handle(GEOM_Object) theShape1, Handle(GEOM_Object) theShape2,
+ double theTolerance, float theDeflection,
+ Handle(TColStd_HSequenceOfInteger)& theIntersections1,
+ Handle(TColStd_HSequenceOfInteger)& theIntersections2)
+{
+ SetErrorCode(KO);
+ bool isGood = false;
+
+ if (theIntersections1.IsNull())
+ theIntersections1 = new TColStd_HSequenceOfInteger;
+ else
+ theIntersections1->Clear();
+
+ if (theIntersections2.IsNull())
+ theIntersections2 = new TColStd_HSequenceOfInteger;
+ else
+ theIntersections2->Clear();
+
+ if (theShape1.IsNull() || theShape2.IsNull()) {
+ SetErrorCode("Objects have NULL Shape");
+ return isGood;
+ }
+
+ if (theShape1 == theShape2) {
+ SetErrorCode("Objects are equal");
+ return isGood;
+ }
+ Handle(GEOM_Function) aRefShape1 = theShape1->GetLastFunction();
+ Handle(GEOM_Function) aRefShape2 = theShape2->GetLastFunction();
+ if (aRefShape1.IsNull() || aRefShape2.IsNull()) return isGood;
+
+ TopoDS_Shape aShape1 = aRefShape1->GetValue();
+ TopoDS_Shape aShape2 = aRefShape2->GetValue();
+ if (aShape1.IsNull() || aShape2.IsNull()) return isGood;
+
+ // 0. Prepare data
+ TopoDS_Shape aScopy1, aScopy2;
+ GEOMAlgo_AlgoTools::CopyShape(aShape1, aScopy1);
+ GEOMAlgo_AlgoTools::CopyShape(aShape2, aScopy2);
+
+ GEOMUtils::MeshShape(aScopy1, theDeflection);
+ GEOMUtils::MeshShape(aScopy2, theDeflection);
+ //
+ // Map sub-shapes and their indices
+ TopTools_IndexedMapOfShape anIndices1, anIndices2;
+ TopExp::MapShapes(aScopy1, anIndices1);
+ TopExp::MapShapes(aScopy2, anIndices2);
+
+ BOPCol_ListOfShape aLCS1, aLCS2;
+ aLCS1.Append(aScopy1); aLCS2.Append(aScopy2);
+ //
+ BRepExtrema_ShapeProximity aBSP; // checker of fast interferences
+ aBSP.LoadShape1(aScopy1); aBSP.LoadShape2(aScopy2);
+ aBSP.SetTolerance((theTolerance <= 0.) ? 0.0 : theTolerance);
+
+ // 1. Launch the checker
+ aBSP.Perform();
+
+ // 2. Get sets of IDs of overlapped faces
+#if OCC_VERSION_LARGE > 0x06090000
+ for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt1 (aBSP.OverlapSubShapes1()); anIt1.More(); anIt1.Next())
+#else
+ for (BRepExtrema_OverlappedSubShapes::Iterator anIt1 (aBSP.OverlapSubShapes1()); anIt1.More(); anIt1.Next())
+#endif
+ {
+ const TopoDS_Shape& aS1 = aBSP.GetSubShape1(anIt1.Key());
+ theIntersections1->Append(anIndices1.FindIndex(aS1));
+ }
+
+#if OCC_VERSION_LARGE > 0x06090000
+ for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt2 (aBSP.OverlapSubShapes2()); anIt2.More(); anIt2.Next())
+#else
+ for (BRepExtrema_OverlappedSubShapes::Iterator anIt2 (aBSP.OverlapSubShapes2()); anIt2.More(); anIt2.Next())
+#endif
+ {
+ const TopoDS_Shape& aS2 = aBSP.GetSubShape2(anIt2.Key());
+ theIntersections2->Append(anIndices2.FindIndex(aS2));
+ }
+
+ isGood = !theIntersections1->IsEmpty() && !theIntersections1->IsEmpty();
+
+ if (aBSP.IsDone())
+ SetErrorCode(OK);
+
return isGood;
}
try {
OCC_CATCH_SIGNALS;
- int iType, nbTypes [TopAbs_SHAPE];
- for (iType = 0; iType < TopAbs_SHAPE; ++iType)
+ int iType, nbTypes [TopAbs_SHAPE], nbFlatType [TopAbs_SHAPE];
+ for (iType = 0; iType < TopAbs_SHAPE; ++iType) {
nbTypes[iType] = 0;
+ nbFlatType[iType] = 0;
+ }
nbTypes[aShape.ShapeType()]++;
TopTools_MapOfShape aMapOfShape;
TopTools_ListIteratorOfListOfShape itL (aListOfShape);
for (; itL.More(); itL.Next()) {
- TopoDS_Iterator it (itL.Value());
+ TopoDS_Shape sp = itL.Value();
+ TopoDS_Iterator it (sp);
for (; it.More(); it.Next()) {
TopoDS_Shape s = it.Value();
if (aMapOfShape.Add(s)) {
aListOfShape.Append(s);
nbTypes[s.ShapeType()]++;
+ if ((sp.ShapeType() == TopAbs_COMPOUND) || (sp.ShapeType() == TopAbs_COMPSOLID)) {
+ nbFlatType[s.ShapeType()]++;
+ }
}
}
}
Astr = Astr + " SOLID : " + TCollection_AsciiString(nbTypes[TopAbs_SOLID]) + "\n";
Astr = Astr + " COMPSOLID : " + TCollection_AsciiString(nbTypes[TopAbs_COMPSOLID]) + "\n";
Astr = Astr + " COMPOUND : " + TCollection_AsciiString(nbTypes[TopAbs_COMPOUND]) + "\n";
- Astr = Astr + " SHAPE : " + TCollection_AsciiString(aMapOfShape.Extent());
+ Astr = Astr + " SHAPE : " + TCollection_AsciiString(aMapOfShape.Extent()) + "\n";
+
+ if ((aShape.ShapeType() == TopAbs_COMPOUND) || (aShape.ShapeType() == TopAbs_COMPSOLID)){
+ Astr = Astr + " --------------------- \n Flat content : \n";
+ if (nbFlatType[TopAbs_VERTEX] > 0)
+ Astr = Astr + " VERTEX : " + TCollection_AsciiString(nbFlatType[TopAbs_VERTEX]) + "\n";
+ if (nbFlatType[TopAbs_EDGE] > 0)
+ Astr = Astr + " EDGE : " + TCollection_AsciiString(nbFlatType[TopAbs_EDGE]) + "\n";
+ if (nbFlatType[TopAbs_WIRE] > 0)
+ Astr = Astr + " WIRE : " + TCollection_AsciiString(nbFlatType[TopAbs_WIRE]) + "\n";
+ if (nbFlatType[TopAbs_FACE] > 0)
+ Astr = Astr + " FACE : " + TCollection_AsciiString(nbFlatType[TopAbs_FACE]) + "\n";
+ if (nbFlatType[TopAbs_SHELL] > 0)
+ Astr = Astr + " SHELL : " + TCollection_AsciiString(nbFlatType[TopAbs_SHELL]) + "\n";
+ if (nbFlatType[TopAbs_SOLID] > 0)
+ Astr = Astr + " SOLID : " + TCollection_AsciiString(nbFlatType[TopAbs_SOLID]) + "\n";
+ }
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
SK_SEGMENT, // segment
SK_EDGE, // other edge
// VERTEX
- SK_VERTEX,
+ SK_VERTEX, // vertex
// ADVANCED shapes
+ SK_LCS, // local coordinate system
+ // (other advanced shapes)
SK_ADVANCED, // all advanced shapes (temporary implementation)
};
+ /**
+ * This enumeration represents the level of checking shape on
+ * self-interference. It defines which interferferences will be checked.
+ */
+ enum SICheckLevel
+ {
+ SI_V_V = 0, // only V/V interferences
+ SI_V_E, // V/V and V/E interferences
+ SI_E_E, // V/V, V/E and E/E interferences
+ SI_V_F, // V/V, V/E, E/E and V/F interferences
+ SI_E_F, // V/V, V/E, E/E, V/F and E/F interferences
+ SI_ALL // all interferences
+ };
+
Standard_EXPORT ShapeKind KindOfShape (Handle(GEOM_Object) theShape,
Handle(TColStd_HSequenceOfInteger)& theIntegers,
Handle(TColStd_HSequenceOfReal)& theDoubles);
const std::list<ShapeError> &theErrors);
Standard_EXPORT bool CheckSelfIntersections (Handle(GEOM_Object) theShape,
+ const SICheckLevel theCheckLevel,
Handle(TColStd_HSequenceOfInteger)& theIntersections);
+
+ Standard_EXPORT bool CheckSelfIntersectionsFast (Handle(GEOM_Object) theShape,
+ float deflection,
+ double tolerance,
+ Handle(TColStd_HSequenceOfInteger)& theIntersections);
+
+ Standard_EXPORT bool FastIntersect (Handle(GEOM_Object) theShape1, Handle(GEOM_Object) theShape2,
+ double tolerance, float deflection,
+ Handle(TColStd_HSequenceOfInteger)& theIntersections1,
+ Handle(TColStd_HSequenceOfInteger)& theIntersections2);
Standard_EXPORT TCollection_AsciiString IsGoodForSolid (Handle(GEOM_Object) theShape);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//NOTE: This is an intreface to a function for the Offset creation.
//
#include "GEOM_Function.hxx"
+#include <TColStd_HArray1OfInteger.hxx>
#define OFF_ARG_SHAPE 1
#define OFF_ARG_VALUE 2
+#define OFF_ARG_IDS 3
+#define OFF_ARG_PARAM 4
class GEOMImpl_IOffset
{
double GetValue() { return _func->GetReal(OFF_ARG_VALUE); }
+ void SetParam(Standard_Boolean theParam) { _func->SetInteger(OFF_ARG_PARAM, theParam ? 1 : 0); }
+
+ Standard_Boolean GetParam() { return _func->GetInteger(OFF_ARG_PARAM); }
+
+ void SetFaceIDs(const Handle(TColStd_HArray1OfInteger)& theFaceIDs)
+ { _func->SetIntegerArray(OFF_ARG_IDS, theFaceIDs); }
+
+ Handle(TColStd_HArray1OfInteger) GetFaceIDs()
+ { return _func->GetIntegerArray(OFF_ARG_IDS); }
+
private:
Handle(GEOM_Function) _func;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GEOM_Function.hxx"
-#define PIPE_ARG_BASE 1
-#define PIPE_ARG_PATH 2
+#include <TColStd_HArray1OfInteger.hxx>
+
+// ---- GEOMImpl_IPipe
+#define PIPE_ARG_BASE 1
+#define PIPE_ARG_PATH 2
+
+// ---- GEOMImpl_IPipeBiNormal
+#define PIPE_ARG_VEC 3
+
+// ---- GEOMImpl_IPipeDiffSect
+#define PIPEDS_LIST_BASES 1
+//#define PIPEDS_ARG_PATH 2
+#define PIPEDS_LIST_LOCATIONS 3
+#define PIPEDS_ARG_WITHCONTACT 4
+#define PIPEDS_ARG_WITHCORRECT 5
+#define PIPEDS_ARG_BY_STEPS 6
+
+// ---- GEOMImpl_IPipeShellSect
+#define PIPEDS_LIST_SUBBASES 6
+
+// ---- Generate groups block (common)
+#define PIPE_GENERATE_GROUPS 7
+#define PIPE_GROUP_DOWN 8
+#define PIPE_GROUP_UP 9
+#define PIPE_GROUP_SIDE1 10
+#define PIPE_GROUP_SIDE2 11
+#define PIPE_GROUP_OTHER 12
+
class GEOMImpl_IPipe
{
public:
GEOMImpl_IPipe(Handle(GEOM_Function) theFunction): _func(theFunction) {}
+ virtual ~GEOMImpl_IPipe() {}
void SetBase (Handle(GEOM_Function) theBase) { _func->SetReference(PIPE_ARG_BASE, theBase); }
void SetPath (Handle(GEOM_Function) thePath) { _func->SetReference(PIPE_ARG_PATH, thePath); }
+ void SetGenerateGroups (int theGenerateGroups)
+ { _func->SetInteger(PIPE_GENERATE_GROUPS, theGenerateGroups); }
+ void SetGroupDown (const Handle(TColStd_HArray1OfInteger) &theGroup)
+ { _func->SetIntegerArray(PIPE_GROUP_DOWN, theGroup); }
+ void SetGroupUp (const Handle(TColStd_HArray1OfInteger) &theGroup)
+ { _func->SetIntegerArray(PIPE_GROUP_UP, theGroup); }
+ void SetGroupSide1 (const Handle(TColStd_HArray1OfInteger) &theGroup)
+ { _func->SetIntegerArray(PIPE_GROUP_SIDE1, theGroup); }
+ void SetGroupSide2 (const Handle(TColStd_HArray1OfInteger) &theGroup)
+ { _func->SetIntegerArray(PIPE_GROUP_SIDE2, theGroup); }
+ void SetGroupOther (const Handle(TColStd_HArray1OfInteger) &theGroup)
+ { _func->SetIntegerArray(PIPE_GROUP_OTHER, theGroup); }
Handle(GEOM_Function) GetBase() { return _func->GetReference(PIPE_ARG_BASE); }
Handle(GEOM_Function) GetPath() { return _func->GetReference(PIPE_ARG_PATH); }
+ int GetGenerateGroups () { return _func->GetInteger(PIPE_GENERATE_GROUPS); }
+ Handle(TColStd_HArray1OfInteger) GetGroupDown ()
+ { return _func->GetIntegerArray(PIPE_GROUP_DOWN); }
+ Handle(TColStd_HArray1OfInteger) GetGroupUp ()
+ { return _func->GetIntegerArray(PIPE_GROUP_UP); }
+ Handle(TColStd_HArray1OfInteger) GetGroupSide1 ()
+ { return _func->GetIntegerArray(PIPE_GROUP_SIDE1); }
+ Handle(TColStd_HArray1OfInteger) GetGroupSide2 ()
+ { return _func->GetIntegerArray(PIPE_GROUP_SIDE2); }
+ Handle(TColStd_HArray1OfInteger) GetGroupOther ()
+ { return _func->GetIntegerArray(PIPE_GROUP_OTHER); }
protected:
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#ifndef _GEOMImpl_IPIPEBINORMAL_HXX_
#define _GEOMImpl_IPIPEBINORMAL_HXX_
-#include "GEOM_Function.hxx"
-#ifndef _GEOMImpl_IPIPE_HXX_
#include "GEOMImpl_IPipe.hxx"
-#endif
-#define PIPE_ARG_BASE 1
-#define PIPE_ARG_PATH 2
-#define PIPE_ARG_VEC 3
+// Position definitions are declared in the base class.
class GEOMImpl_IPipeBiNormal : public GEOMImpl_IPipe
{
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#ifndef _GEOMImpl_IPIPEDIFFSECT_HXX_
#define _GEOMImpl_IPIPEDIFFSECT_HXX_
-#include "GEOM_Function.hxx"
-#include <TColStd_HSequenceOfTransient.hxx>
-
-#ifndef _GEOMImpl_IPIPE_HXX_
#include "GEOMImpl_IPipe.hxx"
-#endif
-
-#define PIPEDS_LIST_BASES 1
-#define PIPEDS_LIST_LOCATIONS 3
-//#define PIPEDS_ARG_PATH 2
-#define PIPEDS_ARG_WITHCONTACT 4
-#define PIPEDS_ARG_WITHCORRECT 5
+#include <TColStd_HSequenceOfTransient.hxx>
+// Position definitions are declared in the base class.
class GEOMImpl_IPipeDiffSect : public GEOMImpl_IPipe
{
int GetWithCorrectionMode()
{ return _func->GetInteger(PIPEDS_ARG_WITHCORRECT); }
+ void SetIsBySteps (int IsBySteps)
+ { _func->SetInteger(PIPEDS_ARG_BY_STEPS, IsBySteps); }
+
+ int GetIsBySteps()
+ { return _func->GetInteger(PIPEDS_ARG_BY_STEPS); }
+
};
#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#ifndef _GEOMImpl_IPIPESHELLSECT_HXX_
#define _GEOMImpl_IPIPESHELLSECT_HXX_
-#include "GEOM_Function.hxx"
-#ifndef _GEOMImpl_IPIPEDIFFSECT_HXX_
#include "GEOMImpl_IPipeDiffSect.hxx"
-#endif
-
+#include "GEOM_Function.hxx"
#include <TColStd_HSequenceOfTransient.hxx>
-#define PIPEDS_LIST_SUBBASES 6
-
+// Position definitions are declared in the base class GEOMImpl_IPipe.
class GEOMImpl_IPipeShellSect : public GEOMImpl_IPipeDiffSect
{
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#define ARG_LENGTH 11
-//#define ARG_FLAG 12
+#define ARG_USE_ORIENTATION 12
class GEOMImpl_IPoint
{
void SetParameter(double theParam) { _func->SetReal(ARG_PARAM, theParam); }
void SetParameter2(double theParam) { _func->SetReal(ARG_PARAM2, theParam); }
void SetLength(double theLength) { _func->SetReal(ARG_LENGTH, theLength); }
- //void SetReversed(bool theReversed) { _func->SetInteger(ARG_FLAG, theReversed); }
+ void SetTakeOrientationIntoAccount(bool takeOrientationIntoAccount)
+ { _func->SetInteger(ARG_USE_ORIENTATION, takeOrientationIntoAccount); }
double GetParameter() { return _func->GetReal(ARG_PARAM); }
double GetParameter2() { return _func->GetReal(ARG_PARAM2); }
double GetLength() { return _func->GetReal(ARG_LENGTH); }
- //bool GetReversed() { return _func->GetInteger(ARG_FLAG); }
+ bool GetTakeOrientationIntoAccount() { return _func->GetInteger(ARG_USE_ORIENTATION); }
private:
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#define PRISM_ARG_FUSE 11
#define PRISM_ARG_INIT 12
#define PRISM_ARG_MODE 13
+#define PRISM_ARG_INVERT 14
class GEOMImpl_IPrism
{
void SetFuseFlag(int theFlag) { _func->SetInteger(PRISM_ARG_FUSE, theFlag); }
// void SetMode(GEOMImpl_Mode theMode) { _func->SetInteger(PRISM_ARG_MODE, theMode); } //TEST
+ void SetInvertFlag(Standard_Boolean theInvert) { _func->SetInteger(PRISM_ARG_INVERT, theInvert ? 1 : 0);}
int GetFuseFlag() { return _func->GetInteger(PRISM_ARG_FUSE); }
// GEOMImpl_Mode GetMode() { return _func->GetInteger(PRISM_ARG_MODE); } //TEST
+ Standard_Boolean GetInvertFlag() { return _func->GetInteger(PRISM_ARG_INVERT); }
private:
--- /dev/null
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+//NOTE: This is an interface to a function for the Projection on cylinder creation.
+
+#include "GEOM_Function.hxx"
+
+#define PROJCYL_ARG_SHAPE 1
+#define PROJCYL_ARG_RADIUS 2
+#define PROJCYL_ARG_START_ANGLE 3
+#define PROJCYL_ARG_ANGLE_LENGTH 4
+#define PROJCYL_ARG_ANGLE_ROTATION 5
+
+class GEOMImpl_IProjOnCyl
+{
+
+public:
+
+ GEOMImpl_IProjOnCyl(Handle(GEOM_Function) theFunction): _func(theFunction) {}
+
+ void SetShape (const Handle(GEOM_Function) &theShape)
+ { _func->SetReference(PROJCYL_ARG_SHAPE, theShape); }
+ void SetRadius (const Standard_Real theRadius)
+ { _func->SetReal(PROJCYL_ARG_RADIUS, theRadius); }
+ void SetStartAngle (const Standard_Real theStartAngle)
+ { _func->SetReal(PROJCYL_ARG_START_ANGLE, theStartAngle); }
+ void SetAngleLength (const Standard_Real theAngleLength)
+ { _func->SetReal(PROJCYL_ARG_ANGLE_LENGTH, theAngleLength); }
+ void SetAngleRotation (const Standard_Real theAngleLength)
+ { _func->SetReal(PROJCYL_ARG_ANGLE_ROTATION, theAngleLength); }
+
+ Handle(GEOM_Function) GetShape()
+ { return _func->GetReference(PROJCYL_ARG_SHAPE); }
+ Standard_Real GetRadius()
+ { return _func->GetReal(PROJCYL_ARG_RADIUS ); }
+ Standard_Real GetStartAngle()
+ { return _func->GetReal(PROJCYL_ARG_START_ANGLE ); }
+ Standard_Real GetAngleLength()
+ { return _func->GetReal(PROJCYL_ARG_ANGLE_LENGTH ); }
+ Standard_Real GetAngleRotation()
+ { return _func->GetReal(PROJCYL_ARG_ANGLE_ROTATION ); }
+
+ private:
+
+ Handle(GEOM_Function) _func;
+
+};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+//NOTE: This is an intreface to a function for the extended shape creation.
+//
+#include "GEOM_Function.hxx"
+
+#define SHAPE_EXTEND_SHAPE 1
+#define SHAPE_EXTEND_UMIN 2
+#define SHAPE_EXTEND_UMAX 3
+#define SHAPE_EXTEND_VMIN 4
+#define SHAPE_EXTEND_VMAX 5
+
+class GEOMImpl_IShapeExtend
+{
+ public:
+
+ GEOMImpl_IShapeExtend(Handle(GEOM_Function) theFunction): _func(theFunction) {}
+
+ void SetShape(Handle(GEOM_Function) theShape)
+ { _func->SetReference(SHAPE_EXTEND_SHAPE, theShape); }
+
+ Handle(GEOM_Function) GetShape()
+ { return _func->GetReference(SHAPE_EXTEND_SHAPE); }
+
+ void SetUMin(const Standard_Real theUMin)
+ { _func->SetReal(SHAPE_EXTEND_UMIN, theUMin); }
+
+ double GetUMin()
+ { return _func->GetReal(SHAPE_EXTEND_UMIN); }
+
+ void SetUMax(const Standard_Real theUMax)
+ { _func->SetReal(SHAPE_EXTEND_UMAX, theUMax); }
+
+ double GetUMax()
+ { return _func->GetReal(SHAPE_EXTEND_UMAX); }
+
+ void SetVMin(const Standard_Real theVMin)
+ { _func->SetReal(SHAPE_EXTEND_VMIN, theVMin); }
+
+ double GetVMin()
+ { return _func->GetReal(SHAPE_EXTEND_VMIN); }
+
+ void SetVMax(const Standard_Real theVMax)
+ { _func->SetReal(SHAPE_EXTEND_VMAX, theVMax); }
+
+ double GetVMax()
+ { return _func->GetReal(SHAPE_EXTEND_VMAX); }
+
+ private:
+
+ Handle(GEOM_Function) _func;
+};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
SHAPE_ARG_SHAPES = 1, // for Wire, Shell, Solid and Compound
SHAPE_ARG_BASE = 2, // for Face, Solid and Sub-shape
SHAPE_ARG_PLANAR = 3, // for Face
+ SHAPE_ARG_INTERSECT = 3, // for Solid From Connected Faces (NOTE: same value as SHAPE_ARG_PLANAR is used!)
SHAPE_ARG_SUBTYPE = 4, // for Sub-shape
SHAPE_ARG_INDICES = 5, // for Sub-shape
SHAPE_ARG_TOLERANCE = 6, // linear tolerance (for Wire, Edge)
Standard_Real GetAngularTolerance() { return _func->GetReal(SHAPE_ARG_ANGLE_TOL); }
+ void SetIsIntersect(const Standard_Boolean isIntersect)
+ {_func->SetInteger(SHAPE_ARG_INTERSECT, isIntersect ? 1 : 0);}
+
+ Standard_Boolean GetIsIntersect() { return (_func->GetInteger(SHAPE_ARG_INTERSECT) == 1); }
+
private:
Handle(GEOM_Function) _func;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007
// Project : SALOME
-#include <Standard_Stream.hxx>
+//#include <Standard_Stream.hxx>
#include "GEOMImpl_IShapesOperations.hxx"
#include "GEOMImpl_VectorDriver.hxx"
#include "GEOMImpl_ShapeDriver.hxx"
#include "GEOMImpl_GlueDriver.hxx"
+#include "GEOMImpl_FillingDriver.hxx"
#include "GEOMImpl_IVector.hxx"
#include "GEOMImpl_IShapes.hxx"
+#include "GEOMImpl_IShapeExtend.hxx"
#include "GEOMImpl_IGlue.hxx"
+#include "GEOMImpl_IFilling.hxx"
#include "GEOMImpl_Block6Explorer.hxx"
#include "GEOMImpl_IHealingOperations.hxx"
#include "GEOMUtils.hxx"
#include "GEOMAlgo_ClsfBox.hxx"
+#include "GEOMAlgo_ClsfQuad.hxx"
#include "GEOMAlgo_ClsfSolid.hxx"
-#include "GEOMAlgo_CoupleOfShapes.hxx"
-#include "GEOMAlgo_FinderShapeOn1.hxx"
-#include "GEOMAlgo_FinderShapeOnQuad.hxx"
+#include "GEOMAlgo_ClsfSurf.hxx"
#include "GEOMAlgo_FinderShapeOn2.hxx"
#include "GEOMAlgo_GetInPlace.hxx"
+#include "GEOMAlgo_GetInPlaceAPI.hxx"
#include "GEOMAlgo_GlueDetector.hxx"
-#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
-#include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
-
-#include <Basics_OCCTVersion.hxx>
#include <utilities.h>
-#include <OpUtil.hxx>
-#include <Utils_ExceptHandlers.hxx>
-
-#include <TFunction_DriverTable.hxx>
-#include <TFunction_Driver.hxx>
-#include <TFunction_Logbook.hxx>
-#include <TDataStd_Integer.hxx>
-#include <TDataStd_IntegerArray.hxx>
-#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
-#include <TDF_Tool.hxx>
-
-#include <BRepExtrema_ExtCF.hxx>
-#include <BRepExtrema_DistShapeShape.hxx>
-#include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepTools.hxx>
-#include <BRepGProp.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
-#include <BRepBndLib.hxx>
-#include <BRepMesh_IncrementalMesh.hxx>
-
-#include <TopAbs.hxx>
+#include <BRepTools.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <GeomLib_Tool.hxx>
+#include <Geom_CylindricalSurface.hxx>
+#include <Geom_Plane.hxx>
+#include <Geom_SphericalSurface.hxx>
+#include <Geom_Surface.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <Precision.hxx>
+#include <TColStd_HArray1OfInteger.hxx>
+#include <TDF_Tool.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
-#include <TopLoc_Location.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Solid.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <TopTools_Array1OfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_MapOfShape.hxx>
#include <TopTools_MapOfOrientedShape.hxx>
-
-#include <Geom_Surface.hxx>
-#include <Geom_Plane.hxx>
-#include <Geom_SphericalSurface.hxx>
-#include <Geom_CylindricalSurface.hxx>
-#include <GeomAdaptor_Surface.hxx>
-
-#include <GeomLib_Tool.hxx>
-#include <Geom2d_Curve.hxx>
-
-#include <Bnd_Box.hxx>
-#include <GProp_GProps.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <TColStd_HArray1OfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_ListOfInteger.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_SequenceOfShape.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Solid.hxx>
+#include <TopoDS_Vertex.hxx>
#include <gp_Cylinder.hxx>
-#include <gp_Lin.hxx>
#include <gp_Pnt.hxx>
#include <vector>
-#include <algorithm>
-#include <functional>
-#include <Standard_NullObject.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
-// Includes added for GetInPlace algorithm improvement
+namespace {
+
+ void AddFlatSubShapes(const TopoDS_Shape& S, TopTools_ListOfShape& L, TopTools_MapOfShape& M)
+ {
+ if (S.ShapeType() != TopAbs_COMPOUND) {
+ L.Append(S);
+ }
+ else {
+ TopoDS_Iterator It(S, Standard_True, Standard_True);
+ for (; It.More(); It.Next()) {
+ TopoDS_Shape SS = It.Value();
+ if (M.Add(SS))
+ AddFlatSubShapes(SS, L, M);
+ }
+ }
+ }
+}
-#include <GEOMImpl_MeasureDriver.hxx>
-#include <GEOMImpl_IMeasure.hxx>
-#include <BRepBuilderAPI_MakeVertex.hxx>
+namespace
+{
+ const double MAX_TOLERANCE = 1.e-7;
+
+ /**
+ * \brief Returns the vertex from theWhere shape that is coincident with
+ * theVertex.
+ *
+ * \param theWhere the shape where the coinsident vertex is searched.
+ * \param theVertex the vertex to be searched.
+ * \return the coincident vertex if it is found. Otherwise null object.
+ */
+ static TopoDS_Vertex getSameVertex(const TopoDS_Shape &theWhere,
+ const TopoDS_Vertex &theVertex)
+ {
+ TopoDS_Vertex aResult;
+ gp_Pnt aPoint = BRep_Tool::Pnt(theVertex);
+ TopExp_Explorer anExp(theWhere, TopAbs_VERTEX);
+ TopTools_MapOfShape aMap;
+
+ for(; anExp.More(); anExp.Next()) {
+ const TopoDS_Shape &aLocalShape = anExp.Current();
-#include <BRepClass_FaceClassifier.hxx>
-#include <BRepClass3d_SolidClassifier.hxx>
-#include <Precision.hxx>
+ if(!aMap.Add(aLocalShape)) {
+ continue;
+ }
+
+ TopoDS_Vertex aVertex = TopoDS::Vertex(aLocalShape);
+ gp_Pnt aPoint2 = BRep_Tool::Pnt(aVertex);
+
+ if(aPoint.Distance(aPoint2) <= MAX_TOLERANCE) {
+ aResult = aVertex;
+ break;
+ }
+ }
+
+ return aResult;
+ }
+} // end of namespace
//=============================================================================
/*!
return aShape;
}
+//=============================================================================
+/*!
+ * MakeFaceFromSurface
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceFromSurface
+ (Handle(GEOM_Object) theFace,
+ Handle(GEOM_Object) theWire)
+{
+ SetErrorCode(KO);
+
+ //Add a new object
+ Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
+
+ //Add a new function
+ Handle(GEOM_Function) aFunction =
+ aShape->AddFunction(GEOMImpl_ShapeDriver::GetID(), FACE_FROM_SURFACE);
+
+ if (aFunction.IsNull()) {
+ return NULL;
+ }
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) {
+ return NULL;
+ }
+
+ GEOMImpl_IShapes aCI (aFunction);
+ Handle(TColStd_HSequenceOfTransient) aShapesSeq =
+ new TColStd_HSequenceOfTransient;
+ Handle(GEOM_Function) aRefFace = theFace->GetLastFunction();
+ Handle(GEOM_Function) aRefWire = theWire->GetLastFunction();
+
+ if (aRefFace.IsNull()) {
+ SetErrorCode("NULL argument face for the face construction");
+ return NULL;
+ }
+
+ if (aRefWire.IsNull()) {
+ SetErrorCode("NULL argument wire for the face construction");
+ return NULL;
+ }
+
+ aShapesSeq->Append(aRefFace);
+ aShapesSeq->Append(aRefWire);
+
+ aCI.SetShapes(aShapesSeq);
+
+ //Compute the face
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Shape driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump (aFunction) << aShape
+ << " = geompy.MakeFaceFromSurface(" << theFace << ", " << theWire << ")";
+
+ SetErrorCode(OK);
+
+ return aShape;
+}
+
+//=============================================================================
+/*!
+ * MakeFaceWithConstraints
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceWithConstraints
+ (std::list<Handle(GEOM_Object)> theConstraints)
+{
+ SetErrorCode(KO);
+
+ //Add a new object
+ Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_FILLING);
+
+ //Add a new function
+ Handle(GEOM_Function) aFunction =
+ aShape->AddFunction(GEOMImpl_FillingDriver::GetID(), FILLING_ON_CONSTRAINTS);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_FillingDriver::GetID()) return NULL;
+
+ GEOMImpl_IFilling aCI (aFunction);
+ Handle(TColStd_HSequenceOfTransient) aConstraints = new TColStd_HSequenceOfTransient;
+
+ // Shapes
+ std::list<Handle(GEOM_Object)>::iterator it = theConstraints.begin();
+ while (it != theConstraints.end()) {
+ Handle(GEOM_Object) anObject = (*it);
+ if ( anObject.IsNull() || anObject->GetValue().ShapeType() != TopAbs_EDGE ) {
+ SetErrorCode("NULL argument edge for the face construction");
+ return NULL;
+ }
+ Handle(GEOM_Function) aRefSh = anObject->GetLastFunction();
+ aConstraints->Append(aRefSh);
+ it++;
+ if ( it != theConstraints.end() ) {
+ Handle(GEOM_Object) aFace = (*it);
+ if ( aFace.IsNull() ) {
+ // null constraint face - it is a valid case
+ it++;
+ continue;
+ }
+ if ( aFace->GetValue().ShapeType() != TopAbs_FACE )
+ // constraint face can be omitted - it is a valid case
+ continue;
+ // Keep the old error code as IsSubShapeBelongsTo changes it.
+ TCollection_AsciiString anOldCode = GetErrorCode();
+
+ if ( IsSubShapeBelongsTo( anObject, 0, aFace, 0 ) ) {
+ // valid constraint
+ SetErrorCode(anOldCode);
+ aRefSh = aFace->GetLastFunction();
+ aConstraints->Append(aRefSh);
+ it++;
+ }
+ else {
+ // bad constraint
+ SetErrorCode("Face is NULL or not connected to the Edge");
+ return NULL;
+ }
+ }
+ }
+ aCI.SetShapes( aConstraints );
+
+ //Compute the shape
+ Standard_Boolean isWarning = Standard_False;
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Shape driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ // to provide warning
+ if (!aFunction->GetValue().IsNull()) {
+ isWarning = Standard_True;
+ } else {
+ return NULL;
+ }
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction);
+ pd << aShape << " = geompy.MakeFaceWithConstraints([";
+
+ // Constraints
+ it = theConstraints.begin();
+ if (it != theConstraints.end() ) {
+ pd << (*it++);
+ while (it != theConstraints.end()) {
+ Handle(GEOM_Object) anObject = (*it++);
+ if( !anObject.IsNull() )
+ pd << ", " << anObject;
+ }
+ }
+ pd << "])";
+
+ // to provide warning
+ if (!isWarning) SetErrorCode(OK);
+ return aShape;
+}
+
//=============================================================================
/*!
* MakeShell
return aShape;
}
+//=============================================================================
+/*!
+ * MakeSolidFromConnectedFaces
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeSolidFromConnectedFaces
+ (std::list<Handle(GEOM_Object)> theFacesOrShells,
+ const Standard_Boolean isIntersect)
+{
+ SetErrorCode(KO);
+
+ //Add a new object
+ Handle(GEOM_Object) aSolid = GetEngine()->AddObject(GetDocID(), GEOM_SOLID);
+
+ //Add a new function
+ Handle(GEOM_Function) aFunction =
+ aSolid->AddFunction(GEOMImpl_ShapeDriver::GetID(), SOLID_FACES);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL;
+
+ GEOMImpl_IShapes aCI (aFunction);
+
+ Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient;
+
+ // Shapes
+ std::list<Handle(GEOM_Object)>::iterator it = theFacesOrShells.begin();
+ for (; it != theFacesOrShells.end(); it++) {
+ Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction();
+ if (aRefSh.IsNull()) {
+ SetErrorCode("NULL argument shape for the shape construction");
+ return NULL;
+ }
+ aShapesSeq->Append(aRefSh);
+ }
+ aCI.SetShapes(aShapesSeq);
+ aCI.SetIsIntersect(isIntersect);
+
+ //Compute the shape
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Shape driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction);
+ pd << aSolid << " = geompy.MakeSolidFromConnectedFaces([";
+
+ // Shapes
+ it = theFacesOrShells.begin();
+ if (it != theFacesOrShells.end()) {
+ pd << (*it++);
+ while (it != theFacesOrShells.end()) {
+ pd << ", " << (*it++);
+ }
+ }
+ pd << "]," << (isIntersect ? "True" : "False") << ")";
+
+ SetErrorCode(OK);
+ return aSolid;
+}
+
//=============================================================================
/*!
* MakeGlueFaces
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces
- (Handle(GEOM_Object) theShape,
- const Standard_Real theTolerance,
- const Standard_Boolean doKeepNonSolids)
+Handle(GEOM_Object)
+GEOMImpl_IShapesOperations::MakeGlueFaces (std::list< Handle(GEOM_Object) >& theShapes,
+ const Standard_Real theTolerance,
+ const Standard_Boolean doKeepNonSolids)
{
SetErrorCode(KO);
- if (theShape.IsNull()) return NULL;
+ Handle(TColStd_HSequenceOfTransient) objects = GEOM_Object::GetLastFunctions( theShapes );
+ if ( objects.IsNull() || objects->IsEmpty() ) {
+ SetErrorCode("NULL argument shape");
+ return NULL;
+ }
//Add a new Glued object
Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED);
GEOMImpl_IGlue aCI (aFunction);
- Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
- if (aRefShape.IsNull()) return NULL;
-
- aCI.SetBase(aRefShape);
+ aCI.SetBase( objects );
aCI.SetTolerance(theTolerance);
aCI.SetKeepNonSolids(doKeepNonSolids);
//Make a Python command
GEOM::TPythonDump(aFunction) << aGlued << " = geompy.MakeGlueFaces("
- << theShape << ", " << theTolerance << ")";
+ << theShapes << ", " << theTolerance << ")";
// to provide warning
if (!isWarning) SetErrorCode(OK);
* MakeGlueFacesByList
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
- (Handle(GEOM_Object) theShape,
- const Standard_Real theTolerance,
- std::list<Handle(GEOM_Object)> theFaces,
- const Standard_Boolean doKeepNonSolids,
- const Standard_Boolean doGlueAllEdges)
+Handle(GEOM_Object)
+GEOMImpl_IShapesOperations::MakeGlueFacesByList(std::list< Handle(GEOM_Object) >& theShapes,
+ const Standard_Real theTolerance,
+ std::list<Handle(GEOM_Object)> & theFaces,
+ const Standard_Boolean doKeepNonSolids,
+ const Standard_Boolean doGlueAllEdges)
{
SetErrorCode(KO);
- if (theShape.IsNull()) return NULL;
+ Handle(TColStd_HSequenceOfTransient) objects = GEOM_Object::GetLastFunctions( theShapes );
+ if ( objects.IsNull() || objects->IsEmpty() ) {
+ SetErrorCode("NULL argument shape");
+ return NULL;
+ }
+ Handle(TColStd_HSequenceOfTransient) aFaces = GEOM_Object::GetLastFunctions( theFaces );
+ if ( aFaces.IsNull() ) {
+ SetErrorCode("NULL argument shape for the shape construction");
+ return NULL;
+ }
//Add a new Glued object
Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED);
GEOMImpl_IGlue aCI (aFunction);
- Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
- if (aRefShape.IsNull()) return NULL;
-
- aCI.SetBase(aRefShape);
+ aCI.SetBase( objects );
aCI.SetTolerance(theTolerance);
aCI.SetKeepNonSolids(doKeepNonSolids);
aCI.SetGlueAllEdges(doGlueAllEdges);
-
- Handle(TColStd_HSequenceOfTransient) aFaces = new TColStd_HSequenceOfTransient;
- std::list<Handle(GEOM_Object)>::iterator it = theFaces.begin();
- for (; it != theFaces.end(); it++) {
- Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction();
- if (aRefSh.IsNull()) {
- SetErrorCode("NULL argument shape for the shape construction");
- return NULL;
- }
- aFaces->Append(aRefSh);
- }
- aCI.SetFaces(aFaces);
+ aCI.SetFaces(aFaces);
//Compute the sub-shape value
Standard_Boolean isWarning = Standard_False;
GEOM::TPythonDump pd(aFunction);
pd << aGlued << " = geompy.MakeGlueFacesByList("
- << theShape << ", " << theTolerance << ", [";
- // Faces
- it = theFaces.begin();
- if (it != theFaces.end()) {
- pd << (*it++);
- while (it != theFaces.end()) {
- pd << ", " << (*it++);
- }
- }
- pd << "], " << (bool)doKeepNonSolids << ", " << (bool)doGlueAllEdges << ")";
+ << theShapes << ", " << theTolerance << ", " << theFaces << ", "
+ << (bool)doKeepNonSolids << ", " << (bool)doGlueAllEdges << ")";
// to provide warning
if (!isWarning) SetErrorCode(OK);
* MakeGlueEdges
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdges
- (Handle(GEOM_Object) theShape,
- const Standard_Real theTolerance)
+Handle(GEOM_Object)
+GEOMImpl_IShapesOperations::MakeGlueEdges (std::list< Handle(GEOM_Object) >& theShapes,
+ const Standard_Real theTolerance)
{
SetErrorCode(KO);
- if (theShape.IsNull()) return NULL;
+ Handle(TColStd_HSequenceOfTransient) objects = GEOM_Object::GetLastFunctions( theShapes );
+ if ( objects.IsNull() || objects->IsEmpty() ) {
+ SetErrorCode("NULL argument shape");
+ return NULL;
+ }
//Add a new Glued object
Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED);
GEOMImpl_IGlue aCI (aFunction);
- Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
- if (aRefShape.IsNull()) return NULL;
-
- aCI.SetBase(aRefShape);
+ aCI.SetBase( objects );
aCI.SetTolerance(theTolerance);
aCI.SetKeepNonSolids(true);
//Make a Python command
GEOM::TPythonDump(aFunction) << aGlued << " = geompy.MakeGlueEdges("
- << theShape << ", " << theTolerance << ")";
+ << theShapes << ", " << theTolerance << ")";
// to provide warning
if (!isWarning) SetErrorCode(OK);
* GetGlueShapes
*/
//=============================================================================
-Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueShapes
- (Handle(GEOM_Object) theShape,
- const Standard_Real theTolerance,
- const TopAbs_ShapeEnum theType)
+Handle(TColStd_HSequenceOfTransient)
+GEOMImpl_IShapesOperations::GetGlueShapes (std::list< Handle(GEOM_Object) >& theShapes,
+ const Standard_Real theTolerance,
+ const TopAbs_ShapeEnum theType)
{
SetErrorCode(KO);
- if (theShape.IsNull()) return NULL;
- TopoDS_Shape aShape = theShape->GetValue();
- if (aShape.IsNull()) return NULL;
+ TopoDS_Shape aShape;
+ TopTools_SequenceOfShape shapes;
+ std::list< Handle(GEOM_Object) >::iterator s = theShapes.begin();
+ Handle(GEOM_Object) lastCreatedGO;
+ for ( ; s != theShapes.end(); ++s )
+ {
+ Handle(GEOM_Object) go = *s;
+ if ( go.IsNull() ) return NULL;
+ aShape = go->GetValue();
+ if ( aShape.IsNull() ) return NULL;
+ shapes.Append( aShape );
+ lastCreatedGO = GEOM::GetCreatedLast( lastCreatedGO, go );
+ }
+ if ( shapes.Length() > 1 )
+ {
+ TopoDS_Compound compound;
+ BRep_Builder builder;
+ builder.MakeCompound( compound );
+ for ( int i = 1; i <= shapes.Length(); ++i )
+ builder.Add( compound, shapes( i ) );
+
+ aShape = compound;
+ }
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
Standard_Integer iErr = aGluer.ErrorStatus();
if (iErr) return NULL;
- TCollection_AsciiString anAsciiList, anEntry;
- TopTools_IndexedMapOfShape anIndices;
- TopExp::MapShapes(aShape, anIndices);
+ std::vector< TopTools_IndexedMapOfShape* > anIndices( shapes.Length(), NULL );
Handle(TColStd_HArray1OfInteger) anArray;
Handle(GEOM_Object) anObj;
GEOMUtils::SortShapes(listOnePerSet, Standard_False);
TopTools_ListIteratorOfListOfShape aListIt (listOnePerSet);
- for (; aListIt.More(); aListIt.Next()) {
+ for (; aListIt.More(); aListIt.Next())
+ {
TopoDS_Shape aValue = aListIt.Value();
- anArray = new TColStd_HArray1OfInteger(1,1);
- anArray->SetValue(1, anIndices.FindIndex(aValue));
- anObj = GetEngine()->AddSubShape(theShape, anArray);
- if (!anObj.IsNull()) {
- aSeq->Append(anObj);
-
- // for python command
- TDF_Tool::Entry(anObj->GetEntry(), anEntry);
- anAsciiList += anEntry;
- anAsciiList += ",";
+ // find a shape to add aValue as a sub-shape
+ anObj.Nullify();
+ s = theShapes.begin();
+ for ( int i = 0; i < shapes.Length(); ++i, ++s )
+ {
+ Handle(GEOM_Object) object = *s;
+ if ( !anIndices[i] ) {
+ anIndices[i] = new TopTools_IndexedMapOfShape;
+ TopExp::MapShapes( object->GetValue(), *anIndices[i]);
+ }
+ if (int index = anIndices[i]->FindIndex( aValue )) {
+ anArray = new TColStd_HArray1OfInteger(1,1);
+ anArray->SetValue(1, index);
+ anObj = GetEngine()->AddSubShape( object, anArray);
+ break;
+ }
}
+ if (!anObj.IsNull())
+ aSeq->Append(anObj);
}
+ for ( size_t i = 0 ; i < anIndices.size(); ++i )
+ delete anIndices[i];
// Make a Python command
- if (anAsciiList.Length() > 0) {
- anAsciiList.Trunc(anAsciiList.Length() - 1);
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ if ( aSeq->Length() > 0)
+ {
+ Handle(GEOM_Function) aFunction = lastCreatedGO->GetLastFunction();
GEOM::TPythonDump pd (aFunction, /*append=*/true);
- pd << "[" << anAsciiList.ToCString();
- if (theType == TopAbs_FACE)
- pd << "] = geompy.GetGlueFaces(" << theShape << ", " << theTolerance << ")";
- else if (theType == TopAbs_EDGE)
- pd << "] = geompy.GetGlueEdges(" << theShape << ", " << theTolerance << ")";
+ pd << aSeq
+ << " = geompy." << (theType == TopAbs_FACE ? "GetGlueFaces" : "GetGlueEdges" )
+ << "( " << theShapes << ", " << theTolerance << ")";
}
SetErrorCode(OK);
* MakeGlueEdgesByList
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdgesByList
- (Handle(GEOM_Object) theShape,
- const Standard_Real theTolerance,
- std::list<Handle(GEOM_Object)> theEdges)
+Handle(GEOM_Object)
+GEOMImpl_IShapesOperations::MakeGlueEdgesByList (std::list< Handle(GEOM_Object) >& theShapes,
+ const Standard_Real theTolerance,
+ std::list<Handle(GEOM_Object)>& theEdges)
{
SetErrorCode(KO);
- if (theShape.IsNull()) return NULL;
-
+ Handle(TColStd_HSequenceOfTransient) objects = GEOM_Object::GetLastFunctions( theShapes );
+ if ( objects.IsNull() || objects->IsEmpty() ) {
+ SetErrorCode("NULL argument shape");
+ return NULL;
+ }
+ Handle(TColStd_HSequenceOfTransient) anEdges = GEOM_Object::GetLastFunctions( theEdges );
+ if ( anEdges.IsNull() ) {
+ SetErrorCode("NULL argument shape for the shape construction");
+ return NULL;
+ }
//Add a new Glued object
Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED);
GEOMImpl_IGlue aCI (aFunction);
- Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
- if (aRefShape.IsNull()) return NULL;
-
- aCI.SetBase(aRefShape);
+ aCI.SetBase( objects );
aCI.SetTolerance(theTolerance);
aCI.SetKeepNonSolids(true);
-
- Handle(TColStd_HSequenceOfTransient) anEdges = new TColStd_HSequenceOfTransient;
- std::list<Handle(GEOM_Object)>::iterator it = theEdges.begin();
- for (; it != theEdges.end(); it++) {
- Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction();
- if (aRefSh.IsNull()) {
- SetErrorCode("NULL argument shape for the shape construction");
- return NULL;
- }
- anEdges->Append(aRefSh);
- }
aCI.SetFaces(anEdges);
//Compute the sub-shape value
GEOM::TPythonDump pd (aFunction);
pd << aGlued << " = geompy.MakeGlueEdgesByList("
- << theShape << ", " << theTolerance << ", [";
- // Edges
- it = theEdges.begin();
- if (it != theEdges.end()) {
- pd << (*it++);
- while (it != theEdges.end()) {
- pd << ", " << (*it++);
- }
- }
- pd << "])";
+ << theShapes << ", " << theTolerance << ", " << theEdges << " )";
// to provide warning
if (!isWarning) SetErrorCode(OK);
//=============================================================================
Handle(TColStd_HSequenceOfTransient)
GEOMImpl_IShapesOperations::GetExistingSubObjects(Handle(GEOM_Object) theShape,
- const Standard_Boolean theGroupsOnly)
+ const Standard_Boolean theGroupsOnly)
{
// note: this method does not return fields
Handle(GEOM_BaseObject) obj = Handle(GEOM_BaseObject)::DownCast( results->Value(i));
obj->GetEntryString();
if ( i < results->Length() )
- anAsciiList += ",";
+ anAsciiList += ",";
}
GEOM::TPythonDump pd (theShape->GetLastFunction(), /*append=*/true);
Handle(TColStd_HSequenceOfTransient)
GEOMImpl_IShapesOperations::GetExistingSubObjects(Handle(GEOM_Object) theShape,
- const Standard_Integer theTypes)
+ const Standard_Integer theTypes)
{
SetErrorCode(KO);
bool isSubShape = anObj->IsKind(STANDARD_TYPE(GEOM_Object)) && anObj->GetType() != GEOM_GROUP;
bool isField = anObj->IsKind(STANDARD_TYPE(GEOM_Field));
if (theTypes & Groups && isGroup ||
- theTypes & SubShapes && isSubShape ||
- theTypes & Fields && isField) {
+ theTypes & SubShapes && isSubShape ||
+ theTypes & Fields && isField) {
aSeq->Append(anObj);
}
}
TopTools_ListOfShape listShape;
if (aShape.ShapeType() == TopAbs_COMPOUND &&
- (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE ||
- TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPSOLID ||
- TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPOUND))
+ (theShapeType == TopAbs_SHAPE || theShapeType == TopAbs_FLAT || theShapeType == TopAbs_COMPOUND))
{
TopoDS_Iterator It (aShape, Standard_True, Standard_True);
for (; It.More(); It.Next()) {
- if (mapShape.Add(It.Value())) {
- if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE ||
- TopAbs_ShapeEnum(theShapeType) == It.Value().ShapeType()) {
- listShape.Append(It.Value());
+ TopoDS_Shape SS = It.Value();
+ if (mapShape.Add(SS)) {
+ if (theShapeType == TopAbs_FLAT) {
+ AddFlatSubShapes(SS, listShape, mapShape);
+ }
+ else if (theShapeType == TopAbs_SHAPE || theShapeType == SS.ShapeType()) {
+ listShape.Append(SS);
}
+ // VSR: for EXPLODE_NEW_INCLUDE_MAIN and EXPLODE_OLD_INCLUDE_MAIN:
+ // it seems it is necessary to add top-level shape if theShapeType == TopAbs_COMPOUND
}
}
}
listShape.Append(exp.Current());
}
- if (listShape.IsEmpty()) {
+ if (listShape.IsEmpty()){
//SetErrorCode("The given shape has no sub-shapes of the requested type");
SetErrorCode(NOT_FOUND_ANY); // NPAL18017
return aSeq;
// Put this subshape in the list of sub-shapes of theMainShape
aMainShape->AddSubShapeReference(aFunction);
}
-
if (!anObj.IsNull()) {
- aSeq->Append(anObj);
+ aSeq->Append(anObj);
- // for python command
- TDF_Tool::Entry(anObj->GetEntry(), anEntry);
- anAsciiList += anEntry;
- anAsciiList += ",";
- }
- }
+ // for python command
+ TDF_Tool::Entry(anObj->GetEntry(), anEntry);
+ anAsciiList += anEntry;
+ anAsciiList += ",";
+ }
+ }
//Make a Python command
anAsciiList.Trunc(anAsciiList.Length() - 1);
TopTools_ListOfShape listShape;
if (aShape.ShapeType() == TopAbs_COMPOUND &&
- (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE ||
- TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPSOLID ||
- TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPOUND))
+ (theShapeType == TopAbs_SHAPE || theShapeType == TopAbs_FLAT || theShapeType == TopAbs_COMPOUND))
{
TopoDS_Iterator It (aShape, Standard_True, Standard_True);
for (; It.More(); It.Next()) {
- if (mapShape.Add(It.Value())) {
- if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE ||
- TopAbs_ShapeEnum(theShapeType) == It.Value().ShapeType()) {
- listShape.Append(It.Value());
+ TopoDS_Shape SS = It.Value();
+ if (mapShape.Add(SS)) {
+ if (theShapeType == TopAbs_FLAT) {
+ AddFlatSubShapes(SS, listShape, mapShape);
+ }
+ else if (theShapeType == TopAbs_SHAPE || theShapeType == SS.ShapeType()) {
+ listShape.Append(SS);
}
}
}
return aTypeName;
}
+//=============================================================================
+/*!
+ * IsSubShapeBelongsTo
+ */
+//=============================================================================
+Standard_Boolean GEOMImpl_IShapesOperations::IsSubShapeBelongsTo( Handle(GEOM_Object) theSubObject,
+ const Standard_Integer theSubObjectIndex,
+ Handle(GEOM_Object) theObject,
+ const Standard_Integer theObjectIndex)
+{
+ SetErrorCode(KO);
+
+ if ( theObject.IsNull() || theSubObject.IsNull() )
+ return false;
+
+ TopoDS_Shape shape = theObject->GetValue();
+ TopoDS_Shape subShape = theSubObject->GetValue();
+
+ if ( shape.IsNull() || subShape.IsNull() )
+ return false;
+
+ TopTools_IndexedMapOfShape anIndices;
+ if ( theObjectIndex > 0 ) {
+ TopExp::MapShapes( shape, anIndices );
+ shape = anIndices.FindKey(theObjectIndex);
+ }
+ if ( theSubObjectIndex > 0 ) {
+ TopExp::MapShapes( subShape, anIndices );
+ subShape = anIndices.FindKey(theSubObjectIndex);
+ }
+
+ TopExp::MapShapes( shape, anIndices );
+
+ const Standard_Boolean isBelongTo = anIndices.Contains(subShape);
+
+ SetErrorCode(OK);
+
+ return isBelongTo;
+}
+
//=============================================================================
/*!
* NumberOfSubShapes
*/
try {
- OCC_CATCH_SIGNALS;
- int iType, nbTypes [TopAbs_SHAPE];
- for (iType = 0; iType < TopAbs_SHAPE; ++iType)
- nbTypes[iType] = 0;
- nbTypes[aShape.ShapeType()]++;
-
- TopTools_MapOfShape aMapOfShape;
- aMapOfShape.Add(aShape);
- TopTools_ListOfShape aListOfShape;
- aListOfShape.Append(aShape);
-
- TopTools_ListIteratorOfListOfShape itL (aListOfShape);
- for (; itL.More(); itL.Next()) {
- TopoDS_Iterator it (itL.Value());
- for (; it.More(); it.Next()) {
- TopoDS_Shape s = it.Value();
- if (aMapOfShape.Add(s)) {
- aListOfShape.Append(s);
- nbTypes[s.ShapeType()]++;
+ if (theShapeType == TopAbs_FLAT) {
+ TopTools_MapOfShape aMapOfShape;
+ TopTools_ListOfShape aListOfShape;
+ AddFlatSubShapes(aShape, aListOfShape, aMapOfShape);
+ nbShapes = aListOfShape.Extent();
+ }
+ else {
+ OCC_CATCH_SIGNALS;
+ int iType, nbTypes [TopAbs_SHAPE];
+ for (iType = 0; iType < TopAbs_SHAPE; ++iType)
+ nbTypes[iType] = 0;
+ nbTypes[aShape.ShapeType()]++;
+
+ TopTools_MapOfShape aMapOfShape;
+ aMapOfShape.Add(aShape);
+ TopTools_ListOfShape aListOfShape;
+ aListOfShape.Append(aShape);
+
+ TopTools_ListIteratorOfListOfShape itL (aListOfShape);
+ for (; itL.More(); itL.Next()) {
+ TopoDS_Iterator it (itL.Value());
+ for (; it.More(); it.Next()) {
+ TopoDS_Shape s = it.Value();
+ if (aMapOfShape.Add(s)) {
+ aListOfShape.Append(s);
+ nbTypes[s.ShapeType()]++;
+ }
}
}
+
+ if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE)
+ nbShapes = aMapOfShape.Extent();
+ else
+ nbShapes = nbTypes[theShapeType];
}
-
- if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE)
- nbShapes = aMapOfShape.Extent();
- else
- nbShapes = nbTypes[theShapeType];
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
}
if (aSeq->IsEmpty()) {
- SetErrorCode("The given shapes have no shared sub-shapes of the requested type");
+ SetErrorCode(NOT_FOUND_ANY);
return aSeq;
}
//=======================================================================
//function : GetSharedShapes
//purpose :
+//
+// NOTE on the implementation
+//
+// 1) Resulting sub-shapes are published as a children of the 1st input shape
+// from theShapes list. Due to this reason only direct sub-shapes of the 1st
+// shape can be contained in the result of the operation (i.e. shares between
+// 2nd/3rd, etc couples cannot be retrieved.
+// 2) An exception from above case is when a single compound is specified as an
+// input. In this case we search shares between its top-level content, so we
+// are able to search shares between all possible couples of shapes.
+// 3) Parameter theMultiShare controls what types of shares to search:
+// - True: get sub-shapes that are shared between ALL input shapes;
+// - False: get shares between couples of input sub-shapes (see points 1 and 2).
+//
+// Thus, we have the following cases:
+// [1] theShapes = N shapes (N>1), theMultiShare = True
+// Result: sub-shapes that are shared by all theShapes
+// [2] theShapes = N shapes (N>1), theMultiShare = False
+// Result: sub-shapes of 1st shape from theShapes that are shared with any shape
+// from theShapes
+// [3] theShapes = 1 shape, theMultiShare = True
+// Result: sub-shapes that are shared by all top-level sub-objects of theShapes[0]
+// [4] theShapes = 1 shape, theMultiShare = False
+// Result: sub-shapes of all possible couples of all top-level sub-objects of
+// theShapes[0].
//=======================================================================
Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes
- (std::list<Handle(GEOM_Object)> theShapes,
- const Standard_Integer theShapeType)
+ (std::list<Handle(GEOM_Object)> & theShapes,
+ const Standard_Integer theShapeType,
+ const bool theMultiShare)
{
SetErrorCode(KO);
int aLen = theShapes.size();
if (aLen < 1) return NULL;
- int ind = 1;
std::list<Handle(GEOM_Object)>::iterator it = theShapes.begin();
- Handle(GEOM_Object) aMainObj = (*it++);
+ // main object is always first in the input list
+ // it is the object from which sub-shapes indices are taken
+ // and where results are published
+ Handle(GEOM_Object) aMainObj = *it;
Handle(GEOM_Function) aMainShape = aMainObj->GetLastFunction();
- if (aMainShape.IsNull()) {
- SetErrorCode("NULL shape for GetSharedShapes");
- return NULL;
- }
-
- TopoDS_Shape aShape1 = aMainShape->GetValue();
- if (aShape1.IsNull()) return NULL;
-
- TopTools_IndexedMapOfShape anIndices;
- TopExp::MapShapes(aShape1, anIndices);
-
- TopTools_IndexedMapOfShape mapSelected;
- TopExp::MapShapes(aShape1, TopAbs_ShapeEnum(theShapeType), mapSelected);
-
- // Find shared shapes
- BRep_Builder B;
- TopoDS_Compound aCurrSelection;
- for (; it != theShapes.end(); it++, ind++) {
+ // collect all shapes from the input list (including first one) for processing
+ TopTools_SequenceOfShape shapeSeq;
+ for (; it != theShapes.end(); it++) {
Handle(GEOM_Function) aRefShape = (*it)->GetLastFunction();
if (aRefShape.IsNull()) {
SetErrorCode("NULL shape for GetSharedShapes");
return NULL;
}
+ TopoDS_Shape aShape = aRefShape->GetValue();
+ if (aShape.IsNull()) {
+ SetErrorCode("NULL shape for GetSharedShapes");
+ return NULL;
+ }
+ shapeSeq.Append( aShape );
+ }
+
+ // if only single shape is specified as input
+ // collect all ites top-level sub-shapes for processing
+ if ( shapeSeq.Length() == 1 )
+ {
+ TopoDS_Shape aShape = shapeSeq.First();
+ shapeSeq.Clear();
+ for ( TopoDS_Iterator it( aShape ); it.More(); it.Next() )
+ shapeSeq.Append( it.Value() );
+ }
- TopoDS_Compound aCompound;
- B.MakeCompound(aCompound);
+ // map all sub-shapes in a main shape to their indices
+ TopTools_IndexedMapOfShape anIndices;
+ TopExp::MapShapes(aMainShape->GetValue(), anIndices);
+ TopTools_MapOfShape mapShape;
- TopoDS_Shape aShape2 = aRefShape->GetValue();
- if (aShape2.IsNull()) return NULL;
+ // find shared shapes
- TopTools_MapOfShape mapShape2;
- TopExp_Explorer exp (aShape2, TopAbs_ShapeEnum(theShapeType));
- for (; exp.More(); exp.Next()) {
- TopoDS_Shape aSS = exp.Current();
- if (mapShape2.Add(aSS) && mapSelected.Contains(aSS)) {
- B.Add(aCompound, aSS);
+ // here we will collect all shares
+ TopTools_ListOfShape aShared;
+
+ // number of iterations
+ int nbIters = theMultiShare || theShapes.size() > 1 ? 1 : shapeSeq.Length()-1;
+ // numShares factor to search (i.e. by what nb of shapes each found sub-shape should be shared)
+ int nbShares = theMultiShare ? shapeSeq.Length()-1 : 1;
+
+ for ( int iter = 1; iter <= nbIters; iter++) {
+ for ( int ind = iter+1; ind <= shapeSeq.Length(); ind++) {
+ if ( ind-1+nbShares > shapeSeq.Length() ) break;
+ TopoDS_Compound aCurrSelection;
+ TopoDS_Shape aShape1 = shapeSeq.Value( iter );
+ TopTools_IndexedMapOfShape mapSelected;
+ TopExp::MapShapes(aShape1, TopAbs_ShapeEnum(theShapeType), mapSelected);
+ for ( int s = 0; s < nbShares; s++ ) {
+ BRep_Builder B;
+ TopoDS_Compound aCompound;
+ B.MakeCompound(aCompound);
+ const TopoDS_Shape& aShape2 = shapeSeq.Value( ind+s );
+ TopTools_MapOfShape mapShape2;
+ TopExp_Explorer exp (aShape2, TopAbs_ShapeEnum(theShapeType));
+ for (; exp.More(); exp.Next()) {
+ const TopoDS_Shape& aSS = exp.Current();
+ if (mapShape2.Add(aSS) && mapSelected.Contains(aSS)) {
+ B.Add(aCompound, aSS);
+ }
+ }
+ mapSelected.Clear();
+ aCurrSelection = aCompound;
+ TopExp::MapShapes(aCurrSelection, TopAbs_ShapeEnum(theShapeType), mapSelected);
+ }
+ TopoDS_Iterator itSel(aCurrSelection, Standard_True, Standard_True);
+ for (; itSel.More(); itSel.Next()) {
+ const TopoDS_Shape& aSS = itSel.Value();
+ if (mapShape.Add(aSS) )
+ aShared.Append(aSS);
}
}
-
- mapSelected.Clear();
- TopExp::MapShapes(aCompound, TopAbs_ShapeEnum(theShapeType), mapSelected);
- aCurrSelection = aCompound;
}
- // Create GEOM_Object for each found shared shape (collected in aCurrSelection)
- Handle(GEOM_Object) anObj;
- Handle(TColStd_HArray1OfInteger) anArray;
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
- TCollection_AsciiString anAsciiList, anEntry;
- TopoDS_Iterator itSel (aCurrSelection, Standard_True, Standard_True);
- for (; itSel.More(); itSel.Next()) {
- anArray = new TColStd_HArray1OfInteger(1,1);
- anArray->SetValue(1, anIndices.FindIndex(itSel.Value()));
+ if (aShared.IsEmpty()){
+ SetErrorCode(NOT_FOUND_ANY);
+ return aSeq;
+ }
+
+ // create GEOM_Object for each found shared shape (collected in aShared)
+ TCollection_AsciiString anAsciiList;
+ Handle(GEOM_Object) anObj;
+ TopTools_ListIteratorOfListOfShape itSub (aShared);
+ for (; itSub.More(); itSub.Next()) {
+ TopoDS_Shape aValue = itSub.Value();
+ Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1);
+ anArray->SetValue(1, anIndices.FindIndex(aValue));
anObj = GetEngine()->AddSubShape(aMainObj, anArray);
aSeq->Append(anObj);
// for python command
+ TCollection_AsciiString anEntry;
TDF_Tool::Entry(anObj->GetEntry(), anEntry);
anAsciiList += anEntry;
anAsciiList += ",";
}
- if (aSeq->IsEmpty()) {
- SetErrorCode("The given shapes have no shared sub-shapes of the requested type");
- return aSeq;
- }
-
- // Make a Python command
+ // make a Python command
anAsciiList.Trunc(anAsciiList.Length() - 1);
- // IPAL22904: TC6.5.0: order of python commands is wrong after dump study
- Handle(TColStd_HSequenceOfTransient) anObjects = new TColStd_HSequenceOfTransient;
- for( it = theShapes.begin(); it != theShapes.end(); it++ )
- {
- Handle(GEOM_Object) anObj = *it;
- if( !anObj.IsNull() )
- anObjects->Append( anObj );
- }
-
- // Get the function of the latest published object
- Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast( anObjects )->GetLastFunction();
- if( aFunction.IsNull() ) // just in case
- aFunction = aMainShape;
-
- GEOM::TPythonDump pd (aFunction, /*append=*/true);
+ GEOM::TPythonDump pd (anObj->GetLastFunction());
pd << "[" << anAsciiList.ToCString()
- << "] = geompy.GetSharedShapesMulti([";
+ << "] = geompy.GetSharedShapesMulti(";
+
+ if ( aLen > 1 )
+ pd << "[";
it = theShapes.begin();
pd << (*it++);
while (it != theShapes.end()) {
pd << ", " << (*it++);
}
+ if ( aLen > 1 )
+ pd << "]";
- pd << "], " << TopAbs_ShapeEnum(theShapeType) << ")";
+ pd << ", " << TopAbs_ShapeEnum(theShapeType) << ", " << theMultiShare << ")";
SetErrorCode(OK);
return aSeq;
TopoDS_Shape aShape = theShape->GetValue();
// Check presence of triangulation, build if need
- if (!GEOMUtils::CheckTriangulation(aShape)) {
+ if (theShapeType != TopAbs_VERTEX && !GEOMUtils::CheckTriangulation(aShape)) {
SetErrorCode("Cannot build triangulation on the shape");
return aSeqOfIDs;
}
// Interprete results
Standard_Integer iErr = aFinder.ErrorStatus();
- // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of error codes is in GEOMAlgo_FinderShapeOn2.cxx
if (iErr) {
MESSAGE(" iErr : " << iErr);
TCollection_AsciiString aMsg (" iErr : ");
return aSeqOfIDs;
}
Standard_Integer iWrn = aFinder.WarningStatus();
- // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn2.cxx
if (iWrn) {
MESSAGE(" *** iWrn : " << iWrn);
}
TopTools_ListOfShape res;
// Check presence of triangulation, build if need
- if (!GEOMUtils::CheckTriangulation(aShape)) {
+ if (theShapeType != TopAbs_VERTEX && !GEOMUtils::CheckTriangulation(aShape)) {
SetErrorCode("Cannot build triangulation on the shape");
return aSeqOfIDs;
}
+ // Compute classification tolerance.
+ TopTools_IndexedMapOfShape aMapVtx;
+ Standard_Real aTol = Precision::Confusion();
+
+ TopExp::MapShapes(aShape, TopAbs_VERTEX, aMapVtx);
+
+ Standard_Integer i;
+ Standard_Integer aNbVtx = aMapVtx.Extent();
+
+ for (i = 1; i <= aNbVtx; ++i) {
+ const TopoDS_Vertex aVtx = TopoDS::Vertex(aMapVtx.FindKey(i));
+ const Standard_Real aVtxTol = BRep_Tool::Tolerance(aVtx);
+
+ if (aTol < aVtxTol) {
+ aTol = aVtxTol;
+ }
+ }
+
+ // Bound the tolerance value.
+ if (aTol > 0.0001) {
+ aTol = 0.0001;
+ }
+
// Call algo
GEOMAlgo_FinderShapeOn2 aFinder;
- Standard_Real aTol = 0.0001; // default value
Handle(GEOMAlgo_ClsfSolid) aClsfSolid = new GEOMAlgo_ClsfSolid;
aClsfSolid->SetShape(aCheckShape);
// Interprete results
Standard_Integer iErr = aFinder.ErrorStatus();
- // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of error codes is in GEOMAlgo_FinderShapeOn2.cxx
if (iErr) {
if (iErr == 41) {
SetErrorCode("theCheckShape must be a solid");
return aSeqOfIDs;
}
Standard_Integer iWrn = aFinder.WarningStatus();
- // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn2.cxx
if (iWrn) {
MESSAGE(" *** iWrn : " << iWrn);
}
return aRes;
}
-//=======================================================================
-//function : getShapesOnSurfaceIDs
- /*!
- * \brief Find IDs of sub-shapes complying with given status about surface
- * \param theSurface - the surface to check state of sub-shapes against
- * \param theShape - the shape to explore
- * \param theShapeType - type of sub-shape of theShape
- * \param theState - required state
- * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
- */
-//=======================================================================
-Handle(TColStd_HSequenceOfInteger)
- GEOMImpl_IShapesOperations::getShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
- const TopoDS_Shape& theShape,
- TopAbs_ShapeEnum theShapeType,
- GEOMAlgo_State theState)
+//=============================================================================
+/*!
+ * GetSubShapeEdgeSorted
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient)
+ GEOMImpl_IShapesOperations::GetSubShapeEdgeSorted
+ (const Handle(GEOM_Object) &theShape,
+ const Handle(GEOM_Object) &theStartPoint)
{
- Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
+ // Get the sorted edges indices.
+ Handle(TColStd_HSequenceOfInteger) aSortedIDs =
+ getSubShapeEdgeSortedIDs(theShape, theStartPoint);
- // Check presence of triangulation, build if need
- if (!GEOMUtils::CheckTriangulation(theShape)) {
- SetErrorCode("Cannot build triangulation on the shape");
- return aSeqOfIDs;
- }
+ // Get object by indices.
+ TCollection_AsciiString anAsciiList;
+ Handle(TColStd_HSequenceOfTransient) aSeq =
+ getObjectsShapesOn(theShape, aSortedIDs, anAsciiList);
- // BEGIN: Mantis issue 0020961: Error on a pipe T-Shape
- // Compute tolerance
- Standard_Real T, VertMax = -RealLast();
- try {
- OCC_CATCH_SIGNALS;
- for (TopExp_Explorer ExV (theShape, TopAbs_VERTEX); ExV.More(); ExV.Next()) {
- TopoDS_Vertex Vertex = TopoDS::Vertex(ExV.Current());
- T = BRep_Tool::Tolerance(Vertex);
- if (T > VertMax)
- VertMax = T;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return aSeqOfIDs;
+ if (aSeq.IsNull() || aSeq->IsEmpty()) {
+ SetErrorCode("Empty sequence of edges");
+ return NULL;
}
- // END: Mantis issue 0020961
- // Call algo
- GEOMAlgo_FinderShapeOn1 aFinder;
- //Standard_Real aTol = 0.0001; // default value
- Standard_Real aTol = VertMax; // Mantis issue 0020961
+ // Make a Python command
+ Handle(GEOM_Object) anObj =
+ Handle(GEOM_Object)::DownCast(aSeq->Value(1));
+ Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
- aFinder.SetShape(theShape);
- aFinder.SetTolerance(aTol);
- aFinder.SetSurface(theSurface);
- aFinder.SetShapeType(theShapeType);
- aFinder.SetState(theState);
+ GEOM::TPythonDump(aFunction)
+ << "[" << anAsciiList.ToCString() << "] = geompy.GetSubShapeEdgeSorted("
+ << theShape << ", " << theStartPoint << ")";
- // Sets the minimal number of inner points for the faces that do not have own
- // inner points at all (for e.g. rectangular planar faces have just 2 triangles).
- // Default value=3
- aFinder.SetNbPntsMin(3);
- // Sets the maximal number of inner points for edges or faces.
- // It is usefull for the cases when this number is very big (e.g =2000) to improve
- // the performance. If this value =0, all inner points will be taken into account.
- // Default value=0
- aFinder.SetNbPntsMax(100);
+ SetErrorCode(OK);
- aFinder.Perform();
+ return aSeq;
+}
- // Interprete results
- Standard_Integer iErr = aFinder.ErrorStatus();
- // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
- if (iErr) {
- MESSAGE(" iErr : " << iErr);
+//=============================================================================
+/*!
+ * GetSubShapesWithTolerance
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient)
+ GEOMImpl_IShapesOperations::GetSubShapesWithTolerance
+ (const Handle(GEOM_Object) &theShape,
+ const Standard_Integer theShapeType,
+ const GEOMUtils::ComparisonCondition theCondition,
+ const Standard_Real theTolerance)
+{
+ if (theShape.IsNull()) {
+ SetErrorCode("NULL GEOM object");
+ return NULL;
+ }
+
+ TopoDS_Shape aShape = theShape->GetValue();
+
+ if (aShape.IsNull()) {
+ SetErrorCode("NULL Shape");
+ return NULL;
+ }
+
+ if (theShapeType != TopAbs_FACE && theShapeType != TopAbs_EDGE &&
+ theShapeType != TopAbs_VERTEX && aShape.ShapeType() >= theShapeType) {
+ SetErrorCode("Invalid shape type");
+ return NULL;
+ }
+
+ TopTools_IndexedMapOfShape anIndices;
+ TopTools_MapOfShape aMapFence;
+ TopExp_Explorer anExp(aShape,
+ (TopAbs_ShapeEnum) theShapeType);
+ Handle(TColStd_HSequenceOfInteger) anIDs = new TColStd_HSequenceOfInteger;
+
+ TopExp::MapShapes(aShape, anIndices);
+
+ for (; anExp.More(); anExp.Next()) {
+ const TopoDS_Shape &aSubShape = anExp.Current();
+
+ if (aMapFence.Add(aSubShape)) {
+ // Compute tolerance
+ Standard_Real aTolerance = -1.;
+
+ switch (aSubShape.ShapeType()) {
+ case TopAbs_FACE:
+ aTolerance = BRep_Tool::Tolerance(TopoDS::Face(aSubShape));
+ break;
+ case TopAbs_EDGE:
+ aTolerance = BRep_Tool::Tolerance(TopoDS::Edge(aSubShape));
+ break;
+ case TopAbs_VERTEX:
+ aTolerance = BRep_Tool::Tolerance(TopoDS::Vertex(aSubShape));
+ break;
+ default:
+ break;
+ }
+
+ if (aTolerance < 0.) {
+ continue;
+ }
+
+ // Compare the tolerance with reference value.
+ if (GEOMUtils::IsFitCondition (theCondition, aTolerance, theTolerance)) {
+ anIDs->Append(anIndices.FindIndex(aSubShape));
+ }
+ }
+ }
+
+ if (anIDs->IsEmpty()) {
+ SetErrorCode("Empty sequence of sub-shapes");
+ return NULL;
+ }
+
+ // Get objects by indices.
+ TCollection_AsciiString anAsciiList;
+ Handle(TColStd_HSequenceOfTransient) aSeq =
+ getObjectsShapesOn(theShape, anIDs, anAsciiList);
+
+ if (aSeq.IsNull() || aSeq->IsEmpty()) {
+ SetErrorCode("Empty sequence of edges");
+ return NULL;
+ }
+
+ // Make a Python command
+ Handle(GEOM_Object) anObj =
+ Handle(GEOM_Object)::DownCast(aSeq->Value(1));
+ Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
+
+ GEOM::TPythonDump(aFunction)
+ << "[" << anAsciiList.ToCString() << "] = geompy.GetSubShapesWithTolerance("
+ << theShape << ", " << theShapeType << ", " << theCondition << ", "
+ << theTolerance << ")";
+
+ SetErrorCode(OK);
+
+ return aSeq;
+}
+
+//=======================================================================
+//function : getShapesOnSurfaceIDs
+ /*!
+ * \brief Find IDs of sub-shapes complying with given status about surface
+ * \param theSurface - the surface to check state of sub-shapes against
+ * \param theShape - the shape to explore
+ * \param theShapeType - type of sub-shape of theShape
+ * \param theState - required state
+ * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
+ */
+//=======================================================================
+Handle(TColStd_HSequenceOfInteger)
+ GEOMImpl_IShapesOperations::getShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
+ const TopoDS_Shape& theShape,
+ TopAbs_ShapeEnum theShapeType,
+ GEOMAlgo_State theState)
+{
+ Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
+
+ // Check presence of triangulation, build if need
+ if (theShapeType != TopAbs_VERTEX &&
+ !GEOMUtils::CheckTriangulation(theShape)) {
+ SetErrorCode("Cannot build triangulation on the shape");
+ return aSeqOfIDs;
+ }
+
+ // BEGIN: Mantis issue 0020961: Error on a pipe T-Shape
+ // Compute tolerance
+ Standard_Real T, VertMax = -RealLast();
+ try {
+ OCC_CATCH_SIGNALS;
+ for (TopExp_Explorer ExV (theShape, TopAbs_VERTEX); ExV.More(); ExV.Next()) {
+ TopoDS_Vertex Vertex = TopoDS::Vertex(ExV.Current());
+ T = BRep_Tool::Tolerance(Vertex);
+ if (T > VertMax)
+ VertMax = T;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return aSeqOfIDs;
+ }
+ // END: Mantis issue 0020961
+
+ // Call algo
+ GEOMAlgo_FinderShapeOn2 aFinder;
+ Handle(GEOMAlgo_ClsfSurf) aClsfSurf = new GEOMAlgo_ClsfSurf;
+ Standard_Real aTol = VertMax; // Mantis issue 0020961
+
+ aClsfSurf->SetSurface(theSurface);
+ aFinder.SetShape(theShape);
+ aFinder.SetTolerance(aTol);
+ aFinder.SetClsf(aClsfSurf);
+ aFinder.SetShapeType(theShapeType);
+ aFinder.SetState(theState);
+
+ // Sets the minimal number of inner points for the faces that do not have own
+ // inner points at all (for e.g. rectangular planar faces have just 2 triangles).
+ // Default value=3
+ aFinder.SetNbPntsMin(3);
+ // Sets the maximal number of inner points for edges or faces.
+ // It is usefull for the cases when this number is very big (e.g =2000) to improve
+ // the performance. If this value =0, all inner points will be taken into account.
+ // Default value=0
+ aFinder.SetNbPntsMax(100);
+
+ aFinder.Perform();
+
+ // Interprete results
+ Standard_Integer iErr = aFinder.ErrorStatus();
+ // the detailed description of error codes is in GEOMAlgo_FinderShapeOn2.cxx
+ if (iErr) {
+ MESSAGE(" iErr : " << iErr);
TCollection_AsciiString aMsg (" iErr : ");
aMsg += TCollection_AsciiString(iErr);
SetErrorCode(aMsg);
return aSeqOfIDs;
}
Standard_Integer iWrn = aFinder.WarningStatus();
- // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn2.cxx
if (iWrn) {
MESSAGE(" *** iWrn : " << iWrn);
}
return aSeq;
}
+//=============================================================================
+/*!
+ * getSubShapeEdgeSortedIDs
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfInteger)
+ GEOMImpl_IShapesOperations::getSubShapeEdgeSortedIDs
+ (const Handle(GEOM_Object) &theShape,
+ const Handle(GEOM_Object) &theStartPoint)
+{
+ Handle(TColStd_HSequenceOfInteger) aResult;
+
+ if (theShape.IsNull() || theStartPoint.IsNull()) {
+ SetErrorCode("NULL GEOM object");
+ return aResult;
+ }
+
+ const TopoDS_Shape aShape = theShape->GetValue();
+ const TopoDS_Shape aStartPoint = theStartPoint->GetValue();
+
+ if (aShape.IsNull() || aStartPoint.IsNull()) {
+ SetErrorCode("NULL Shape");
+ return aResult;
+ }
+
+ if (aStartPoint.ShapeType() != TopAbs_VERTEX) {
+ SetErrorCode("Starting point is not a vertex");
+ return aResult;
+ }
+
+ TopExp_Explorer anExp(aShape, TopAbs_EDGE);
+ TopTools_MapOfShape aMapFence;
+ TopTools_ListOfShape anEdges;
+
+ for (; anExp.More(); anExp.Next()) {
+ const TopoDS_Shape &anEdge = anExp.Current();
+
+ if (aMapFence.Add(anEdge)) {
+ anEdges.Append(anEdge);
+ }
+ }
+
+ if (anEdges.IsEmpty()) {
+ SetErrorCode("Shape doesn't contain edges");
+ return aResult;
+ }
+
+ // Step 1: Sort edges
+ GEOMUtils::SortShapes(anEdges, Standard_False);
+
+ TopTools_ListIteratorOfListOfShape anIter(anEdges);
+ TopoDS_Vertex aV[2];
+ TopTools_DataMapOfShapeListOfShape aMapVE;
+
+ // Step 2: Fill the map vertex - list of edges.
+ for (; anIter.More(); anIter.Next()) {
+ TopoDS_Edge anEdge = TopoDS::Edge(anIter.Value());
+
+ TopExp::Vertices(anEdge, aV[0], aV[1]);
+
+ const Standard_Integer aNbV = aV[0].IsSame(aV[1]) ? 1 : 2;
+ Standard_Integer i;
+
+ for (i = 0; i < aNbV; ++i) {
+ if (aV[i].IsNull() == Standard_False) {
+ if (!aMapVE.IsBound(aV[i])) {
+ // There is no this vertex in the map.
+ aMapVE.Bind(aV[i], TopTools_ListOfShape());
+ }
+
+ // Add the edge to the list bound with the vertex aV[i].
+ TopTools_ListOfShape &aLEdges = aMapVE.ChangeFind(aV[i]);
+
+ aLEdges.Append(anEdge);
+ }
+ }
+ }
+
+ // Step 3: Find starting point in aMapVE.
+ TopoDS_Vertex aStartVtx = TopoDS::Vertex(aStartPoint);
+
+ if (!aMapVE.IsBound(aStartVtx)) {
+ aStartVtx = getSameVertex(aShape, aStartVtx);
+
+ if (aStartVtx.IsNull()) {
+ SetErrorCode("Invalid Starting point");
+ return aResult;
+ }
+ }
+
+ TopTools_IndexedMapOfShape anIndices;
+ TopTools_MapOfShape aMapVFence;
+ TopoDS_Shape aCurVtx = aStartVtx;
+ TopoDS_Edge aCurEdge =
+ TopoDS::Edge(aMapVE.Find(aCurVtx).First());
+
+ aResult = new TColStd_HSequenceOfInteger;
+ TopExp::MapShapes(aShape, anIndices);
+
+ // Step 4: Fill the list of sorted edges.
+ while (aMapVFence.Add(aCurVtx)) {
+ // Append the ID of the current edge to the list of sorted.
+ aResult->Append(anIndices.FindIndex(aCurEdge));
+ TopExp::Vertices(aCurEdge, aV[0], aV[1]);
+
+ // Get the next vertex.
+ if (aCurVtx.IsSame(aV[0])) {
+ if (aCurVtx.IsSame(aV[1])) {
+ // There is no next vertex.
+ break;
+ } else {
+ aCurVtx = aV[1];
+ }
+ } else {
+ aCurVtx = aV[0];
+ }
+
+ if (aCurVtx.IsNull()) {
+ // There is no next vertex.
+ break;
+ }
+
+ // Get the next edge.
+ const TopTools_ListOfShape &aLEdges = aMapVE.Find(aCurVtx);
+ TopTools_ListIteratorOfListOfShape anEIter(aLEdges);
+
+ for (; anEIter.More(); anEIter.Next()) {
+ const TopoDS_Shape &aLocalEdge = anEIter.Value();
+
+ if (aLocalEdge.IsNull() == Standard_False) {
+ if (!aCurEdge.IsSame(aLocalEdge)) {
+ aCurEdge = TopoDS::Edge(aLocalEdge);
+ break;
+ }
+ }
+ }
+
+ if (!anEIter.More()) {
+ // There is no next edge.
+ break;
+ }
+ }
+
+ return aResult;
+}
+
//=======================================================================
//function : getShapesOnSurface
/*!
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
// Check presence of triangulation, build if need
- if (!GEOMUtils::CheckTriangulation(aShape)) {
+ if (theShapeType != TopAbs_VERTEX && !GEOMUtils::CheckTriangulation(aShape)) {
SetErrorCode("Cannot build triangulation on the shape");
return aSeqOfIDs;
}
gp_Pnt aPntBL = BRep_Tool::Pnt(TopoDS::Vertex(aBL));
gp_Pnt aPntBR = BRep_Tool::Pnt(TopoDS::Vertex(aBR));
- GEOMAlgo_FinderShapeOnQuad aFinder( aPntTL, aPntTR, aPntBL, aPntBR );
+ GEOMAlgo_FinderShapeOn2 aFinder;
+ Handle(GEOMAlgo_ClsfQuad) aClsfQuad = new GEOMAlgo_ClsfQuad;
+
Standard_Real aTol = 0.0001; // default value
+ aClsfQuad->SetCorners(aPntTL, aPntTR, aPntBL, aPntBR);
aFinder.SetShape(aShape);
aFinder.SetTolerance(aTol);
- //aFinder.SetSurface(theSurface);
+ aFinder.SetClsf(aClsfQuad);
aFinder.SetShapeType(aShapeType);
aFinder.SetState(theState);
// Interprete results
Standard_Integer iErr = aFinder.ErrorStatus();
- // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of error codes is in GEOMAlgo_FinderShapeOn2.cxx
if (iErr) {
MESSAGE(" iErr : " << iErr);
TCollection_AsciiString aMsg (" iErr : ");
return aSeqOfIDs;
}
Standard_Integer iWrn = aFinder.WarningStatus();
- // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn2.cxx
if (iWrn) {
MESSAGE(" *** iWrn : " << iWrn);
}
return aSeqOfIDs;
}
-//=============================================================================
-/*!
- * GetInPlaceOfShape
- */
-//=============================================================================
-static bool GetInPlaceOfShape (const Handle(GEOM_Function)& theWhereFunction,
- const TopTools_IndexedMapOfShape& theWhereIndices,
- const TopoDS_Shape& theWhat,
- TColStd_ListOfInteger& theModifiedList)
-{
- if (theWhereFunction.IsNull() || theWhat.IsNull()) return false;
-
- if (theWhereIndices.Contains(theWhat)) {
- // entity was not changed by the operation
- Standard_Integer aWhatIndex = theWhereIndices.FindIndex(theWhat);
- theModifiedList.Append(aWhatIndex);
- return true;
- }
-
- // try to find in history
- TDF_Label aHistoryLabel = theWhereFunction->GetHistoryEntry(Standard_False);
-
- // search in history for all argument shapes
- Standard_Boolean isFound = Standard_False;
- Standard_Boolean isGood = Standard_False;
-
- TDF_LabelSequence aLabelSeq;
- theWhereFunction->GetDependency(aLabelSeq);
- Standard_Integer nbArg = aLabelSeq.Length();
-
- for (Standard_Integer iarg = 1; iarg <= nbArg && !isFound; iarg++) {
-
- TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg);
-
- Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
- TopoDS_Shape anArgumentShape = anArgumentObject->GetValue();
-
- TopTools_IndexedMapOfShape anArgumentIndices;
- TopExp::MapShapes(anArgumentShape, anArgumentIndices);
-
- if (anArgumentIndices.Contains(theWhat)) {
- isFound = Standard_True;
- Standard_Integer aWhatIndex = anArgumentIndices.FindIndex(theWhat);
-
- // Find corresponding label in history
- TDF_Label anArgumentHistoryLabel =
- theWhereFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_False);
- if (anArgumentHistoryLabel.IsNull()) {
- // Lost History of operation argument. Possibly, all its entities was removed.
- isGood = Standard_True;
- }
- else {
- TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(aWhatIndex, Standard_False);
-
- if (aWhatHistoryLabel.IsNull()) {
- // Removed entity ? Compound ? Compsolid ? Shell ? Wire
- isGood = Standard_False;
- } else {
- Handle(TDataStd_IntegerArray) anIntegerArray;
- if (!aWhatHistoryLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anIntegerArray)) {
- //Error: Empty modifications history for the sought shape.
- isGood = Standard_False;
- }
- else {
- isGood = Standard_True;
- Standard_Integer imod, aModifLen = anIntegerArray->Array()->Length();
- for (imod = 1; imod <= aModifLen; imod++) {
- theModifiedList.Append(anIntegerArray->Array()->Value(imod));
- }
- }
- }
- }
- }
- }
-
- isFound = isGood;
-
- if (!isFound) {
- // try compound/compsolid/shell/wire element by element
- bool isFoundAny = false;
- TopTools_MapOfShape mapShape;
-
- if (theWhat.ShapeType() == TopAbs_COMPOUND ||
- theWhat.ShapeType() == TopAbs_COMPSOLID) {
- // recursive processing of compound/compsolid
- TopoDS_Iterator anIt (theWhat, Standard_True, Standard_True);
- for (; anIt.More(); anIt.Next()) {
- if (mapShape.Add(anIt.Value())) {
- TopoDS_Shape curWhat = anIt.Value();
- isFoundAny = GetInPlaceOfShape(theWhereFunction, theWhereIndices, curWhat, theModifiedList);
- if (isFoundAny) isFound = Standard_True;
- }
- }
- }
- else if (theWhat.ShapeType() == TopAbs_SHELL) {
- // try to replace a shell by its faces images
- TopExp_Explorer anExp (theWhat, TopAbs_FACE);
- for (; anExp.More(); anExp.Next()) {
- if (mapShape.Add(anExp.Current())) {
- TopoDS_Shape curWhat = anExp.Current();
- isFoundAny = GetInPlaceOfShape(theWhereFunction, theWhereIndices, curWhat, theModifiedList);
- if (isFoundAny) isFound = Standard_True;
- }
- }
- }
- else if (theWhat.ShapeType() == TopAbs_WIRE) {
- // try to replace a wire by its edges images
- TopExp_Explorer anExp (theWhat, TopAbs_EDGE);
- for (; anExp.More(); anExp.Next()) {
- if (mapShape.Add(anExp.Current())) {
- TopoDS_Shape curWhat = anExp.Current();
- isFoundAny = GetInPlaceOfShape(theWhereFunction, theWhereIndices, curWhat, theModifiedList);
- if (isFoundAny) isFound = Standard_True;
- }
- }
- }
- else {
- // Removed entity
- }
- }
-
- return isFound;
-}
-
-//=============================================================================
-/*!
- * GetShapeProperties
- */
-//=============================================================================
-void GEOMImpl_IShapesOperations::GetShapeProperties( const TopoDS_Shape aShape, Standard_Real tab[],
- gp_Pnt & aVertex )
-{
- GProp_GProps theProps;
- gp_Pnt aCenterMass;
- //TopoDS_Shape aPntShape;
- Standard_Real aShapeSize;
-
- if (aShape.ShapeType() == TopAbs_VERTEX) aCenterMass = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
- else if (aShape.ShapeType() == TopAbs_EDGE) BRepGProp::LinearProperties(aShape, theProps);
- else if (aShape.ShapeType() == TopAbs_FACE) BRepGProp::SurfaceProperties(aShape, theProps);
- else BRepGProp::VolumeProperties(aShape, theProps);
-
- if (aShape.ShapeType() == TopAbs_VERTEX)
- aShapeSize = 1;
- else {
- aCenterMass = theProps.CentreOfMass();
- aShapeSize = theProps.Mass();
- }
-
-// aPntShape = BRepBuilderAPI_MakeVertex(aCenterMass).Shape();
-// aVertex = BRep_Tool::Pnt( TopoDS::Vertex( aPntShape ) );
- aVertex = aCenterMass;
- tab[0] = aVertex.X();
- tab[1] = aVertex.Y();
- tab[2] = aVertex.Z();
- tab[3] = aShapeSize;
- return;
-}
-
-namespace {
-
- //================================================================================
- /*!
- * \brief Return normal to face at extrema point
- */
- //================================================================================
-
- gp_Vec GetNormal (const TopoDS_Face& face, const BRepExtrema_DistShapeShape& extrema)
- {
- gp_Vec defaultNorm(1,0,0); // to have same normals on different faces
- try {
- // get UV at extrema point
- Standard_Real u,v, f,l;
- switch ( extrema.SupportTypeShape2(1) ) {
- case BRepExtrema_IsInFace: {
- extrema.ParOnFaceS2(1, u, v );
- break;
- }
- case BRepExtrema_IsOnEdge: {
- TopoDS_Edge edge = TopoDS::Edge( extrema.SupportOnShape2(1));
- Handle(Geom2d_Curve) pcurve = BRep_Tool::CurveOnSurface( edge, face, f,l );
- extrema.ParOnEdgeS2( 1, u );
- gp_Pnt2d uv = pcurve->Value( u );
- u = uv.Coord(1);
- v = uv.Coord(2);
- break;
- }
- case BRepExtrema_IsVertex: return defaultNorm;
- }
- // get derivatives
- BRepAdaptor_Surface surface( face, false );
- gp_Vec du, dv; gp_Pnt p;
- surface.D1( u, v, p, du, dv );
-
- return du ^ dv;
-
- } catch (Standard_Failure ) {
- }
- return defaultNorm;
- }
-}
-
//=============================================================================
/*!
* case GetInPlace:
TopoDS_Shape aWhere = theShapeWhere->GetValue();
TopoDS_Shape aWhat = theShapeWhat->GetValue();
- TopoDS_Shape aPntShape;
- TopoDS_Vertex aVertex;
if (aWhere.IsNull() || aWhat.IsNull()) {
SetErrorCode("Error: aWhere and aWhat TopoDS_Shape are Null.");
return NULL;
}
- Handle(GEOM_Function) aWhereFunction = theShapeWhere->GetLastFunction();
- if (aWhereFunction.IsNull()) {
- SetErrorCode("Error: aWhereFunction is Null.");
- return NULL;
- }
-
- TopTools_IndexedMapOfShape aWhereIndices;
- TopExp::MapShapes(aWhere, aWhereIndices);
-
- TopAbs_ShapeEnum iType = TopAbs_SOLID;
- Standard_Real dl_l = 1e-3;
- Standard_Real min_l, Tol_0D, Tol_1D, Tol_2D, Tol_3D, Tol_Mass;
- Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
- Bnd_Box BoundingBox;
- gp_Pnt aPnt, aPnt_aWhat, tab_Pnt[2];
- GProp_GProps aProps;
-
- // Find the iType of the aWhat shape
- iType = GEOMUtils::GetTypeOfSimplePart(aWhat);
- if (iType == TopAbs_SHAPE) {
- SetErrorCode("Error: An attempt to extract a shape of not supported type.");
- return NULL;
- }
-
- TopExp_Explorer Exp_aWhat ( aWhat, iType );
- TopExp_Explorer Exp_aWhere ( aWhere, iType );
- TopExp_Explorer Exp_Edge ( aWhere, TopAbs_EDGE );
-
- // Find the shortest edge in theShapeWhere shape
- BRepBndLib::Add(aWhere, BoundingBox);
- BoundingBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
- min_l = fabs(aXmax - aXmin);
- if( min_l < fabs(aYmax - aYmin) ) min_l = fabs(aYmax - aYmin);
- if( min_l < fabs(aZmax - aZmin) ) min_l = fabs(aZmax - aZmin);
-
- // Mantis issue 0020908 BEGIN
- if (!Exp_Edge.More()) {
- min_l = Precision::Confusion();
- }
- // Mantis issue 0020908 END
- for ( Standard_Integer nbEdge = 0; Exp_Edge.More(); Exp_Edge.Next(), nbEdge++ ) {
- TopExp_Explorer Exp_Vertex( Exp_Edge.Current(), TopAbs_VERTEX);
- for ( Standard_Integer nbVertex = 0; Exp_Vertex.More(); Exp_Vertex.Next(), nbVertex++ ) {
- aPnt = BRep_Tool::Pnt( TopoDS::Vertex( Exp_Vertex.Current() ) );
- tab_Pnt[nbVertex] = aPnt;
- }
- if ( ! tab_Pnt[0].IsEqual(tab_Pnt[1], dl_l) ) {
- BRepGProp::LinearProperties(Exp_Edge.Current(), aProps);
- if ( aProps.Mass() < min_l ) min_l = aProps.Mass();
- }
- }
- min_l *= dl_l;
-
- // Compute tolerances
- Tol_0D = dl_l;
- Tol_1D = dl_l * min_l;
- Tol_2D = dl_l * ( min_l * min_l) * ( 2. + dl_l);
- Tol_3D = dl_l * ( min_l * min_l * min_l ) * ( 3. + (3 * dl_l) + (dl_l * dl_l) );
-
- if (Tol_0D < Precision::Confusion()) Tol_0D = Precision::Confusion();
- if (Tol_1D < Precision::Confusion()) Tol_1D = Precision::Confusion();
- if (Tol_2D < Precision::Confusion()) Tol_2D = Precision::Confusion();
- if (Tol_3D < Precision::Confusion()) Tol_3D = Precision::Confusion();
-
- Tol_Mass = Tol_3D;
- if ( iType == TopAbs_VERTEX ) Tol_Mass = Tol_0D;
- else if ( iType == TopAbs_EDGE ) Tol_Mass = Tol_1D;
- else if ( iType == TopAbs_FACE ) Tol_Mass = Tol_2D;
-
// Searching for the sub-shapes inside the ShapeWhere shape
GEOMAlgo_GetInPlace aGIP;
- aGIP.SetTolerance(Tol_1D);
- aGIP.SetTolMass(Tol_Mass);
- aGIP.SetTolCG(Tol_1D);
- aGIP.SetArgument(aWhat);
- aGIP.SetShapeWhere(aWhere);
-
- aGIP.Perform();
- int iErr = aGIP.ErrorStatus();
- if (iErr) {
+ if (!GEOMAlgo_GetInPlaceAPI::GetInPlace(aWhere, aWhat, aGIP)) {
SetErrorCode("Error in GEOMAlgo_GetInPlace");
return NULL;
}
- // aGIP.IsFound() returns true only when the whole theShapeWhat
- // is found (as one shape or several parts). But we are also interested
- // in the partial result, that is why this check is commented.
- //if (!aGIP.IsFound()) {
- // SetErrorCode(NOT_FOUND_ANY);
- // return NULL;
- //}
-
// Add direct result.
- TopTools_ListOfShape aLSA;
- const TopoDS_Shape &aShapeResult = aGIP.Result();
- TopTools_MapOfShape aMFence;
+ TopTools_ListOfShape aLSA;
+ const TopoDS_Shape &aShapeResult = aGIP.Result();
+ TopTools_MapOfShape aMFence;
+ TopTools_IndexedMapOfShape aWhereIndices;
+ Standard_Integer aShapeType = -1;
+
+ TopExp::MapShapes(aWhere, aWhereIndices);
if (aShapeResult.IsNull() == Standard_False) {
- TopoDS_Iterator anIt(aShapeResult);
+ TopoDS_Iterator anIt(aShapeResult);
+ Standard_Boolean isFirst = Standard_True;
for (; anIt.More(); anIt.Next()) {
const TopoDS_Shape &aPart = anIt.Value();
if(aWhereIndices.Contains(aPart) && aMFence.Add(aPart)) {
+ const TopAbs_ShapeEnum aType = aPart.ShapeType();
+
+ if (aShapeType == -1) {
+ // Initialization.
+ aShapeType = aType;
+ } else if (aShapeType != TopAbs_SHAPE && aShapeType != aType) {
+ // Different types.
+ aShapeType = TopAbs_SHAPE;
+ }
+
aLSA.Append(aPart);
}
}
Handle(TColStd_HArray1OfInteger) aModifiedArray = new TColStd_HArray1OfInteger (1, aLSA.Extent());
TopTools_ListIteratorOfListOfShape anIterModif (aLSA);
for (Standard_Integer imod = 1; anIterModif.More(); anIterModif.Next(), imod++) {
- if (aWhereIndices.Contains(anIterModif.Value())) {
- aModifiedArray->SetValue(imod, aWhereIndices.FindIndex(anIterModif.Value()));
- }
- else {
- SetErrorCode("Error: wrong sub-shape returned");
- return NULL;
- }
+ aModifiedArray->SetValue(imod, aWhereIndices.FindIndex(anIterModif.Value()));
}
//Add a new object
return NULL;
}
- if (aModifiedArray->Length() > 1 || theShapeWhat->GetType() == GEOM_GROUP) {
+ const Standard_Boolean isSameType = (aShapeType != TopAbs_SHAPE);
+
+ if ((aModifiedArray->Length() > 1 && isSameType) ||
+ theShapeWhat->GetType() == GEOM_GROUP) {
//Set a GROUP type
aResult->SetType(GEOM_GROUP);
* default:
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceOld (Handle(GEOM_Object) theShapeWhere,
- Handle(GEOM_Object) theShapeWhat)
+Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceOld
+ (Handle(GEOM_Object) theShapeWhere,
+ Handle(GEOM_Object) theShapeWhat)
{
SetErrorCode(KO);
if (theShapeWhere.IsNull() || theShapeWhat.IsNull()) return NULL;
- TopoDS_Shape aWhere = theShapeWhere->GetValue();
- TopoDS_Shape aWhat = theShapeWhat->GetValue();
- TopoDS_Shape aPntShape;
- TopoDS_Vertex aVertex;
+ TopoDS_Shape aWhere = theShapeWhere->GetValue();
+ TopoDS_Shape aWhat = theShapeWhat->GetValue();
+ TopTools_ListOfShape aModifiedList;
+ const Standard_Integer iErr =
+ GEOMAlgo_GetInPlaceAPI::GetInPlaceOld(aWhere, aWhat, aModifiedList);
- if (aWhere.IsNull() || aWhat.IsNull()) {
- SetErrorCode("Error: aWhere and aWhat TopoDS_Shape are Null.");
- return NULL;
- }
+ if (iErr) {
+ switch (iErr) {
+ case 1:
+ SetErrorCode("Error: aWhere and aWhat TopoDS_Shape are Null.");
+ break;
+ case 2:
+ SetErrorCode
+ ("Error: An attempt to extract a shape of not supported type.");
+ break;
+ case 3:
+ SetErrorCode(NOT_FOUND_ANY);
+ break;
+ default:
+ SetErrorCode("Shape driver failed");
+ break;
+ }
- Handle(GEOM_Function) aWhereFunction = theShapeWhere->GetLastFunction();
- if (aWhereFunction.IsNull()) {
- SetErrorCode("Error: aWhereFunction is Null.");
return NULL;
}
TopTools_IndexedMapOfShape aWhereIndices;
TopExp::MapShapes(aWhere, aWhereIndices);
- TColStd_ListOfInteger aModifiedList;
- Standard_Integer aWhereIndex;
- Handle(TColStd_HArray1OfInteger) aModifiedArray;
- Handle(GEOM_Object) aResult;
-
- bool isFound = false;
- TopAbs_ShapeEnum iType = TopAbs_SOLID;
- //Standard_Real aWhat_Mass = 0., aWhere_Mass = 0.;
- Standard_Real tab_aWhat[4], tab_aWhere[4];
- Standard_Real dl_l = 1e-3;
- Standard_Real min_l, Tol_0D, Tol_1D, Tol_2D, Tol_3D, Tol_Mass;
- Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
- Bnd_Box BoundingBox;
- gp_Pnt aPnt, aPnt_aWhat, tab_Pnt[2];
- GProp_GProps aProps;
-
- // Find the iType of the aWhat shape
- /*
- if ( aWhat.ShapeType() == TopAbs_VERTEX ) iType = TopAbs_VERTEX;
- else if ( aWhat.ShapeType() == TopAbs_EDGE || aWhat.ShapeType() == TopAbs_WIRE ) iType = TopAbs_EDGE;
- else if ( aWhat.ShapeType() == TopAbs_FACE || aWhat.ShapeType() == TopAbs_SHELL ) iType = TopAbs_FACE;
- else if ( aWhat.ShapeType() == TopAbs_SOLID || aWhat.ShapeType() == TopAbs_COMPSOLID ) iType = TopAbs_SOLID;
- else if ( aWhat.ShapeType() == TopAbs_COMPOUND ) {
- // Only the iType of the first shape in the compound is taken into account
- TopoDS_Iterator It (aWhat, Standard_False, Standard_False);
- if ( !It.More() ) {
- SetErrorCode("Error: theShapeWhat is an empty COMPOUND.");
- return NULL;
- }
- TopAbs_ShapeEnum compType = It.Value().ShapeType();
- if ( compType == TopAbs_VERTEX ) iType = TopAbs_VERTEX;
- else if ( compType == TopAbs_EDGE || compType == TopAbs_WIRE ) iType = TopAbs_EDGE;
- else if ( compType == TopAbs_FACE || compType == TopAbs_SHELL) iType = TopAbs_FACE;
- else if ( compType == TopAbs_SOLID || compType == TopAbs_COMPSOLID) iType = TopAbs_SOLID;
- }
- else {
- SetErrorCode("Error: An attempt to extract a shape of not supported type.");
- return NULL;
- }
- */
- iType = GEOMUtils::GetTypeOfSimplePart(aWhat);
- if (iType == TopAbs_SHAPE) {
- SetErrorCode("Error: An attempt to extract a shape of not supported type.");
- return NULL;
- }
-
- TopExp_Explorer Exp_aWhat ( aWhat, iType );
- TopExp_Explorer Exp_aWhere ( aWhere, iType );
- TopExp_Explorer Exp_Edge ( aWhere, TopAbs_EDGE );
-
- // Find the shortest edge in theShapeWhere shape
- BRepBndLib::Add(aWhere, BoundingBox);
- BoundingBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
- min_l = fabs(aXmax - aXmin);
- if( min_l < fabs(aYmax - aYmin) ) min_l = fabs(aYmax - aYmin);
- if( min_l < fabs(aZmax - aZmin) ) min_l = fabs(aZmax - aZmin);
- min_l /= dl_l;
- // Mantis issue 0020908 BEGIN
- if (!Exp_Edge.More()) {
- min_l = Precision::Confusion();
- }
- // Mantis issue 0020908 END
- for ( Standard_Integer nbEdge = 0; Exp_Edge.More(); Exp_Edge.Next(), nbEdge++ ) {
- TopExp_Explorer Exp_Vertex( Exp_Edge.Current(), TopAbs_VERTEX);
- for ( Standard_Integer nbVertex = 0; Exp_Vertex.More(); Exp_Vertex.Next(), nbVertex++ ) {
- aPnt = BRep_Tool::Pnt( TopoDS::Vertex( Exp_Vertex.Current() ) );
- tab_Pnt[nbVertex] = aPnt;
- }
- if ( ! tab_Pnt[0].IsEqual(tab_Pnt[1], dl_l) ) {
- BRepGProp::LinearProperties(Exp_Edge.Current(), aProps);
- if ( aProps.Mass() < min_l ) min_l = aProps.Mass();
- }
- }
-
- // Compute tolerances
- Tol_0D = dl_l;
- Tol_1D = dl_l * min_l;
- Tol_2D = dl_l * ( min_l * min_l) * ( 2. + dl_l);
- Tol_3D = dl_l * ( min_l * min_l * min_l ) * ( 3. + (3 * dl_l) + (dl_l * dl_l) );
-
- if (Tol_0D < Precision::Confusion()) Tol_0D = Precision::Confusion();
- if (Tol_1D < Precision::Confusion()) Tol_1D = Precision::Confusion();
- if (Tol_2D < Precision::Confusion()) Tol_2D = Precision::Confusion();
- if (Tol_3D < Precision::Confusion()) Tol_3D = Precision::Confusion();
-
- //if (Tol_1D > 1.0) Tol_1D = 1.0;
- //if (Tol_2D > 1.0) Tol_2D = 1.0;
- //if (Tol_3D > 1.0) Tol_3D = 1.0;
-
- Tol_Mass = Tol_3D;
- if ( iType == TopAbs_VERTEX ) Tol_Mass = Tol_0D;
- else if ( iType == TopAbs_EDGE ) Tol_Mass = Tol_1D;
- else if ( iType == TopAbs_FACE ) Tol_Mass = Tol_2D;
-
- // Compute the ShapeWhat Mass
- /*
- for ( ; Exp_aWhat.More(); Exp_aWhat.Next() ) {
- if ( iType == TopAbs_VERTEX ) {
- aWhat_Mass += 1;
- continue;
- }
- else if ( iType == TopAbs_EDGE ) BRepGProp::LinearProperties(Exp_aWhat.Current(), aProps);
- else if ( iType == TopAbs_FACE ) BRepGProp::SurfaceProperties(Exp_aWhat.Current(), aProps);
- else BRepGProp::VolumeProperties(Exp_aWhat.Current(), aProps);
- aWhat_Mass += aProps.Mass();
- }
- */
-
- // Searching for the sub-shapes inside the ShapeWhere shape
- TopTools_MapOfShape map_aWhere;
- for ( Exp_aWhere.ReInit(); Exp_aWhere.More(); Exp_aWhere.Next() ) {
- if (!map_aWhere.Add(Exp_aWhere.Current()))
- continue; // skip repeated shape to avoid mass addition
- GetShapeProperties( Exp_aWhere.Current(), tab_aWhere, aPnt );
- for ( Exp_aWhat.ReInit(); Exp_aWhat.More(); Exp_aWhat.Next() ) {
- GetShapeProperties( Exp_aWhat.Current(), tab_aWhat, aPnt_aWhat );
- if ( fabs(tab_aWhat[3] - tab_aWhere[3]) <= Tol_Mass && aPnt_aWhat.Distance(aPnt) <= Tol_1D )
- isFound = true;
- else {
- if ( (tab_aWhat[3] - tab_aWhere[3]) > Tol_Mass ) {
- aPntShape = BRepBuilderAPI_MakeVertex( aPnt ).Shape();
- aVertex = TopoDS::Vertex( aPntShape );
- BRepExtrema_DistShapeShape aWhereDistance ( aVertex, Exp_aWhere.Current() );
- BRepExtrema_DistShapeShape aWhatDistance ( aVertex, Exp_aWhat.Current() );
- if ( aWhereDistance.IsDone() && aWhatDistance.IsDone() &&
- fabs(aWhereDistance.Value() - aWhatDistance.Value()) <= Tol_1D )
- {
- // 0020162: "EDF 961 GEOM : Getinplace is getting additionnal orthogonal faces"
- // aVertex must be projected to the same point on Where and on What
- gp_Pnt pOnWhat = aWhatDistance.PointOnShape2(1);
- gp_Pnt pOnWhere = aWhereDistance.PointOnShape2(1);
- isFound = ( pOnWhat.Distance(pOnWhere) <= Tol_1D );
- if ( isFound && iType == TopAbs_FACE )
- {
- // check normals at pOnWhat and pOnWhere
- const double angleTol = M_PI/180.;
- gp_Vec normToWhat = GetNormal( TopoDS::Face(Exp_aWhat.Current()), aWhatDistance);
- gp_Vec normToWhere = GetNormal( TopoDS::Face(Exp_aWhere.Current()), aWhereDistance);
- if ( normToWhat * normToWhere < 0 )
- normToWhat.Reverse();
- isFound = ( normToWhat.Angle( normToWhere ) < angleTol );
- }
- }
- }
- }
- if ( isFound ) {
- aWhereIndex = aWhereIndices.FindIndex(Exp_aWhere.Current());
- aModifiedList.Append(aWhereIndex);
- //aWhere_Mass += tab_aWhere[3];
- isFound = false;
- break;
- }
+ Handle(TColStd_HArray1OfInteger) aModifiedArray =
+ new TColStd_HArray1OfInteger (1, aModifiedList.Extent());
+ TopTools_ListIteratorOfListOfShape anIterModif (aModifiedList);
+ Standard_Integer imod;
+ Standard_Integer aShapeType = -1;
+
+ for (imod = 1; anIterModif.More(); anIterModif.Next(), imod++) {
+ const Standard_Integer anIndex =
+ aWhereIndices.FindIndex(anIterModif.Value());
+ const TopAbs_ShapeEnum aType = anIterModif.Value().ShapeType();
+
+ if (aShapeType == -1) {
+ // Initialization.
+ aShapeType = aType;
+ } else if (aShapeType != TopAbs_SHAPE && aShapeType != aType) {
+ // Different types.
+ aShapeType = TopAbs_SHAPE;
}
- //if ( fabs( aWhat_Mass - aWhere_Mass ) <= Tol_Mass )
- //break;
- }
- if (aModifiedList.Extent() == 0) { // Not found any Results
- SetErrorCode(NOT_FOUND_ANY);
- return NULL;
+ aModifiedArray->SetValue(imod, anIndex);
}
- aModifiedArray = new TColStd_HArray1OfInteger (1, aModifiedList.Extent());
- TColStd_ListIteratorOfListOfInteger anIterModif (aModifiedList);
- for (Standard_Integer imod = 1; anIterModif.More(); anIterModif.Next(), imod++)
- aModifiedArray->SetValue(imod, anIterModif.Value());
-
//Add a new object
- aResult = GetEngine()->AddSubShape(theShapeWhere, aModifiedArray);
+ Handle(GEOM_Object) aResult =
+ GetEngine()->AddSubShape(theShapeWhere, aModifiedArray);
+
if (aResult.IsNull()) {
SetErrorCode("Error in algorithm: result found, but cannot be returned.");
return NULL;
}
- if (aModifiedArray->Length() > 1 || theShapeWhat->GetType() == GEOM_GROUP) {
+ const Standard_Boolean isSameType = (aShapeType != TopAbs_SHAPE);
+
+ if ((aModifiedArray->Length() > 1 && isSameType) ||
+ theShapeWhat->GetType() == GEOM_GROUP) {
//Set a GROUP type
aResult->SetType(GEOM_GROUP);
<< theShapeWhere << ", " << theShapeWhat << ", False)";
SetErrorCode(OK);
+
return aResult;
}
//Fill array of indices
TopTools_IndexedMapOfShape aWhereIndices;
+
TopExp::MapShapes(aWhere, aWhereIndices);
// process shape
- TColStd_ListOfInteger aModifiedList;
- bool isFound = GetInPlaceOfShape(aWhereFunction, aWhereIndices, aWhat, aModifiedList);
+ TopTools_ListOfShape aModifiedList;
+ bool isFound = GEOMAlgo_GetInPlaceAPI::GetInPlaceByHistory
+ (aWhereFunction, aWhereIndices, aWhat, aModifiedList);
if (!isFound || aModifiedList.Extent() < 1) {
SetErrorCode("Error: No history found for the sought shape or its sub-shapes.");
return NULL;
}
- Standard_Integer nbFound = aModifiedList.Extent();
- TColStd_ListIteratorOfListOfInteger anIterModif (aModifiedList);
- if ( nbFound > 1 )
- {
- // remove sub-shapes inappropriate for group creation
- TopAbs_ShapeEnum subType = TopAbs_SHAPE;
- while ( anIterModif.More() ) {
- TopAbs_ShapeEnum type = aWhereIndices( anIterModif.Value() ).ShapeType();
- bool okForGroup = ( type == TopAbs_VERTEX || type == TopAbs_EDGE ||
- type == TopAbs_FACE || type == TopAbs_SOLID );
- if ( okForGroup ) {
- if ( subType == TopAbs_SHAPE )
- subType = type;
- else
- okForGroup = ( subType == type );
- }
- if ( okForGroup )
- anIterModif.Next();
- else
- aModifiedList.Remove( anIterModif );
- nbFound -= ( !okForGroup );
- }
- if ( nbFound == 0 ) {
- SetErrorCode("Error: result found but it's type is inappropriate for group creation.");
- return NULL;
+ Handle(TColStd_HArray1OfInteger) aModifiedArray =
+ new TColStd_HArray1OfInteger (1, aModifiedList.Extent());
+ TopTools_ListIteratorOfListOfShape anIterModif (aModifiedList);
+ Standard_Integer imod;
+ Standard_Integer aShapeType = -1;
+
+ for (imod = 1; anIterModif.More(); anIterModif.Next(), imod++) {
+ const Standard_Integer anIndex =
+ aWhereIndices.FindIndex(anIterModif.Value());
+ const TopAbs_ShapeEnum aType = anIterModif.Value().ShapeType();
+
+ if (aShapeType == -1) {
+ // Initialization.
+ aShapeType = aType;
+ } else if (aShapeType != TopAbs_SHAPE && aShapeType != aType) {
+ // Different types.
+ aShapeType = TopAbs_SHAPE;
}
- }
- Handle(TColStd_HArray1OfInteger) aModifiedArray =
- new TColStd_HArray1OfInteger( 1, nbFound );
- anIterModif.Initialize(aModifiedList);
- for (Standard_Integer imod = 1; anIterModif.More(); anIterModif.Next(), imod++)
- aModifiedArray->SetValue(imod, anIterModif.Value());
+ aModifiedArray->SetValue(imod, anIndex);
+ }
//Add a new object
Handle(GEOM_Object) aResult = GetEngine()->AddSubShape(theShapeWhere, aModifiedArray);
return NULL;
}
- if (aModifiedArray->Length() > 1) {
+ const Standard_Boolean isSameType = (aShapeType != TopAbs_SHAPE);
+
+ if ((aModifiedArray->Length() > 1 && isSameType) ||
+ theShapeWhat->GetType() == GEOM_GROUP) {
//Set a GROUP type
aResult->SetType(GEOM_GROUP);
return aResult;
}
-#define MAX_TOLERANCE 1.e-7
-
//=======================================================================
//function : isSameEdge
//purpose : Returns True if two edges coincide
double U11, U12, U21, U22;
Handle(Geom_Curve) C1 = BRep_Tool::Curve(theEdge1, U11, U12);
Handle(Geom_Curve) C2 = BRep_Tool::Curve(theEdge2, U21, U22);
- if(C1->DynamicType() == C2->DynamicType()) return true;
//Check that both edges has the same geometry
double range = U12-U11;
U = U11+range*2.0/3.0;
gp_Pnt P2 = C1->Value(U); //Compute a point on two thirds of the edge's length
+ C2 = new Geom_TrimmedCurve(C2, U21, U22);
+
if(!GeomLib_Tool::Parameter(C2, P1, MAX_TOLERANCE, U) || U < U21 || U > U22)
return false;
switch (aWhat.ShapeType()) {
case TopAbs_VERTEX: {
- gp_Pnt P = BRep_Tool::Pnt(TopoDS::Vertex(aWhat));
- TopExp_Explorer E(aWhere, TopAbs_VERTEX);
- for(; E.More(); E.Next()) {
- if(!aMap.Add(E.Current())) continue;
- gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(E.Current()));
- if(P.Distance(P2) <= MAX_TOLERANCE) {
- isFound = true;
- aSubShape = E.Current();
- break;
- }
- }
+ aSubShape = getSameVertex(aWhere, TopoDS::Vertex(aWhat));
+ isFound = !aSubShape.IsNull();
break;
}
case TopAbs_EDGE: {
return NULL;
}
}
+
+//=======================================================================
+//function : ExtendEdge
+//purpose :
+//=======================================================================
+Handle(GEOM_Object) GEOMImpl_IShapesOperations::ExtendEdge
+ (const Handle(GEOM_Object) &theEdge,
+ const Standard_Real theMin,
+ const Standard_Real theMax)
+{
+ SetErrorCode(KO);
+
+ if (theEdge.IsNull()) {
+ return NULL;
+ }
+
+ //Add a new Edge object
+ Handle(GEOM_Object) aResEdge = GetEngine()->AddObject(GetDocID(), GEOM_EDGE);
+
+ //Add a new Vector function
+ Handle(GEOM_Function) aFunction =
+ aResEdge->AddFunction(GEOMImpl_ShapeDriver::GetID(), EDGE_UV);
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) {
+ return NULL;
+ }
+
+ GEOMImpl_IShapeExtend aCI (aFunction);
+
+ Handle(GEOM_Function) anEdge = theEdge->GetLastFunction();
+
+ if (anEdge.IsNull()) {
+ return NULL;
+ }
+
+ aCI.SetShape(anEdge);
+ aCI.SetUMin(theMin);
+ aCI.SetUMax(theMax);
+
+ //Compute the Edge value
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Shape driver failed");
+
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction)
+ << aResEdge << " = geompy.ExtendEdge("
+ << theEdge << ", " << theMin << ", " << theMax << ")";
+
+ SetErrorCode(OK);
+
+ return aResEdge;
+}
+
+//=======================================================================
+//function : ExtendFace
+//purpose :
+//=======================================================================
+Handle(GEOM_Object) GEOMImpl_IShapesOperations::ExtendFace
+ (const Handle(GEOM_Object) &theFace,
+ const Standard_Real theUMin,
+ const Standard_Real theUMax,
+ const Standard_Real theVMin,
+ const Standard_Real theVMax)
+{
+ SetErrorCode(KO);
+
+ if (theFace.IsNull()) {
+ return NULL;
+ }
+
+ //Add a new Face object
+ Handle(GEOM_Object) aResFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
+
+ //Add a new Vector function
+ Handle(GEOM_Function) aFunction =
+ aResFace->AddFunction(GEOMImpl_ShapeDriver::GetID(), FACE_UV);
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) {
+ return NULL;
+ }
+
+ GEOMImpl_IShapeExtend aCI (aFunction);
+
+ Handle(GEOM_Function) aFace = theFace->GetLastFunction();
+
+ if (aFace.IsNull()) {
+ return NULL;
+ }
+
+ aCI.SetShape(aFace);
+ aCI.SetUMin(theUMin);
+ aCI.SetUMax(theUMax);
+ aCI.SetVMin(theVMin);
+ aCI.SetVMax(theVMax);
+
+ //Compute the Face value
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Shape driver failed");
+
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction)
+ << aResFace << " = geompy.ExtendFace("
+ << theFace << ", " << theUMin << ", " << theUMax << ", "
+ << theVMin << ", " << theVMax << ")";
+
+ SetErrorCode(OK);
+
+ return aResFace;
+}
+
+//=======================================================================
+//function : MakeSurfaceFromFace
+//purpose :
+//=======================================================================
+Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeSurfaceFromFace
+ (const Handle(GEOM_Object) &theFace)
+{
+ SetErrorCode(KO);
+
+ if (theFace.IsNull()) {
+ return NULL;
+ }
+
+ //Add a new Face object
+ Handle(GEOM_Object) aResFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
+
+ //Add a new Vector function
+ Handle(GEOM_Function) aFunction =
+ aResFace->AddFunction(GEOMImpl_ShapeDriver::GetID(), SURFACE_FROM_FACE);
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) {
+ return NULL;
+ }
+
+ GEOMImpl_IShapeExtend aCI (aFunction);
+
+ Handle(GEOM_Function) aFace = theFace->GetLastFunction();
+
+ if (aFace.IsNull()) {
+ return NULL;
+ }
+
+ aCI.SetShape(aFace);
+
+ //Compute the Face value
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Shape driver failed");
+
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction)
+ << aResFace << " = geompy.MakeSurfaceFromFace("
+ << theFace << ")";
+
+ SetErrorCode(OK);
+
+ return aResFace;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GEOM_IOperations.hxx"
#include "GEOMAlgo_State.hxx"
+#include "GEOMUtils.hxx"
-#include <TopoDS_Shape.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <NCollection_DataMap.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
-#include <Handle_Geom_Surface.hxx>
-
-#include <gp_Pnt.hxx>
+#include <Geom_Surface.hxx>
#include <list>
-#include <functional>
class GEOM_Engine;
class Handle(GEOM_Object);
class Handle(TColStd_HArray1OfInteger);
+class TopoDS_Shape;
class GEOMImpl_IShapesOperations : public GEOM_IOperations
{
Standard_EXPORT Handle(GEOM_Object) MakeFaceWires (std::list<Handle(GEOM_Object)> theWires,
const bool isPlanarWanted);
+ Standard_EXPORT Handle(GEOM_Object) MakeFaceFromSurface
+ (Handle(GEOM_Object) theFace,
+ Handle(GEOM_Object) theWire);
+
+ Standard_EXPORT Handle(GEOM_Object) MakeFaceWithConstraints (std::list<Handle(GEOM_Object)> theConstraints);
+
Standard_EXPORT Handle(GEOM_Object) MakeShell (std::list<Handle(GEOM_Object)> theShapes);
Standard_EXPORT Handle(GEOM_Object) MakeSolidShells (std::list<Handle(GEOM_Object)> theShells);
Standard_EXPORT Handle(GEOM_Object) MakeCompound (std::list<Handle(GEOM_Object)> theShapes);
- Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape,
+ Standard_EXPORT Handle(GEOM_Object) MakeSolidFromConnectedFaces (std::list<Handle(GEOM_Object)> theFacesOrShells,
+ const Standard_Boolean isIntersect);
+
+ Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids);
- //Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape,
- // const Standard_Real theTolerance);
-
- Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape,
+ Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance,
- std::list<Handle(GEOM_Object)> theFaces,
+ std::list<Handle(GEOM_Object)>& theFaces,
const Standard_Boolean doKeepNonSolids,
const Standard_Boolean doGlueAllEdges);
- Standard_EXPORT Handle(GEOM_Object) MakeGlueEdges (Handle(GEOM_Object) theShape,
+ Standard_EXPORT Handle(GEOM_Object) MakeGlueEdges (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance);
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueShapes (Handle(GEOM_Object) theShape,
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueShapes (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance,
const TopAbs_ShapeEnum theType);
- Standard_EXPORT Handle(GEOM_Object) MakeGlueEdgesByList (Handle(GEOM_Object) theShape,
+ Standard_EXPORT Handle(GEOM_Object) MakeGlueEdgesByList (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance,
- std::list<Handle(GEOM_Object)> theEdges);
+ std::list<Handle(GEOM_Object)> & theEdges);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetExistingSubObjects(Handle(GEOM_Object) theShape,
- const Standard_Boolean theGroupsOnly);
+ const Standard_Boolean theGroupsOnly);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetExistingSubObjects(Handle(GEOM_Object) theShape,
- const Standard_Integer theTypes = All);
+ const Standard_Integer theTypes = All);
enum ExplodeType {
EXPLODE_OLD_INCLUDE_MAIN,
Standard_EXPORT TCollection_AsciiString GetShapeTypeString (Handle(GEOM_Object) theShape);
+ Standard_EXPORT Standard_Boolean IsSubShapeBelongsTo(Handle(GEOM_Object) theSubObject,
+ const Standard_Integer theSubObjectIndex,
+ Handle(GEOM_Object) theObject,
+ const Standard_Integer theObjectIndex);
+
Standard_EXPORT Standard_Integer NumberOfSubShapes (Handle(GEOM_Object) theShape,
const Standard_Integer theShapeType);
const Standard_Integer theShapeType);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
- GetSharedShapes (std::list<Handle(GEOM_Object)> theShapes,
- const Standard_Integer theShapeType);
+ GetSharedShapes (std::list<Handle(GEOM_Object)>& theShapes,
+ const Standard_Integer theShapeType,
+ const bool theMultiShare = true);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
GetShapesOnPlane (const Handle(GEOM_Object)& theShape,
Handle(GEOM_Object) theCenter,
const Standard_Real theRadius);
- void GetShapeProperties(const TopoDS_Shape aShape, Standard_Real propertiesArray[], gp_Pnt & aPnt);
-
Standard_EXPORT Handle(GEOM_Object) GetInPlace (Handle(GEOM_Object) theShapeWhere,
Handle(GEOM_Object) theShapeWhat);
const Standard_Integer theShapeType,
GEOMAlgo_State theState);
+ /*!
+ * \brief Resize the input edge with the new Min and Max parameters.
+ * The input edge parameters range is [0, 1]. If theMin parameter is
+ * negative, the input edge is extended, otherwise it is shrinked by
+ * theMin parameter. If theMax is greater than 1, the edge is extended,
+ * otherwise it is shrinked by theMax parameter
+ * \param theEdge the input edge to be resized
+ * \param theMin the minimal parameter value
+ * \param theMax the maximal parameter value
+ * \retval Handle(GEOM_Object) - newly created edge
+ */
+ Standard_EXPORT Handle(GEOM_Object)
+ ExtendEdge(const Handle(GEOM_Object)& theEdge,
+ const Standard_Real theMin,
+ const Standard_Real theMax);
+
+ /*!
+ * \brief Resize the input face with the new UMin, UMax, VMin and VMax
+ * parameters. The input face U and V parameters range is [0, 1]. If
+ * theUMin parameter is negative, the input face is extended, otherwise
+ * it is shrinked along U direction by theUMin parameter. If theUMax is
+ * greater than 1, the face is extended, otherwise it is shrinked along
+ * U direction by theUMax parameter. So as for theVMin, theVMax and
+ * V direction of the input face.
+ * \param theFace the input face to be resized
+ * \param theUMin the minimal U parameter value
+ * \param theUMax the maximal U parameter value
+ * \param theVMin the minimal V parameter value
+ * \param theVMax the maximal V parameter value
+ * \retval Handle(GEOM_Object) - newly created face
+ */
+ Standard_EXPORT Handle(GEOM_Object)
+ ExtendFace(const Handle(GEOM_Object)& theFace,
+ const Standard_Real theUMin,
+ const Standard_Real theUMax,
+ const Standard_Real theVMin,
+ const Standard_Real theVMax);
+
+ /*!
+ * \brief Make a surface from a face. This function takes some face as
+ * input parameter and creates new GEOM_Object, i.e. topological shape
+ * by extracting underlying surface of the source face and limiting it
+ * by the Umin, Umax, Vmin, Vmax parameters of the source face (in the
+ * parametrical space).
+ * \param theFace the input face
+ * \retval Handle(GEOM_Object) - newly created face
+ */
+ Standard_EXPORT Handle(GEOM_Object)
+ MakeSurfaceFromFace(const Handle(GEOM_Object) &theFace);
+
+ /*!
+ * \brief Explode a shape into edges sorted in a row from a starting point.
+ * \param theShape - the shape to be exploded on edges.
+ * \param theStartPoint - the starting point.
+ * \return Ordered list of edges sorted in a row from a starting point.
+ */
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
+ GetSubShapeEdgeSorted (const Handle(GEOM_Object) &theShape,
+ const Handle(GEOM_Object) &theStartPoint);
+
+ /*!
+ * \brief Return the list of subshapes that satisfies a certain tolerance
+ * criterion. The user defines the type of shapes to be returned, the
+ * condition and the tolerance value. The operation is defined for
+ * faces, edges and vertices only. E.g. for theShapeType FACE, theCondition
+ * CC_GT and theTolerance 1.e-7 this method returns all faces of theShape
+ * that have tolerances greater then 1.e7.
+ *
+ * \param theShape the shape to be exploded
+ * \param theShapeType the type of shapes to be returned. Can have the
+ * values FACE, EDGE and VERTEX only.
+ * \param theCondition the condition type.
+ * \param theTolerance the tolerance filter.
+ * \return the list of shapes that satisfy the conditions.
+ */
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetSubShapesWithTolerance
+ (const Handle(GEOM_Object) &theShape,
+ const Standard_Integer theShapeType,
+ const GEOMUtils::ComparisonCondition theCondition,
+ const Standard_Real theTolerance);
+
private:
Handle(GEOM_Object) MakeShape (std::list<Handle(GEOM_Object)> theShapes,
const Standard_Integer theObjectType,
const Handle(TColStd_HSequenceOfInteger)& theShapeIDs,
TCollection_AsciiString & theShapeEntries);
+ /*!
+ * \brief Explode a shape into edges sorted in a row from a starting point.
+ * \param theShape - the shape to be exploded on edges.
+ * \param theStartPoint - the starting point.
+ * \return Ordered list of edges sorted in a row from a starting point.
+ */
+ Handle(TColStd_HSequenceOfInteger) getSubShapeEdgeSortedIDs
+ (const Handle(GEOM_Object) &theShape,
+ const Handle(GEOM_Object) &theStartPoint);
+
/*!
* \brief Select the object created last
* \param theObj1 - Object 1
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+//NOTE: This is an intreface to a function for the Transfer Data functionality.
+//
+
+
+#include "GEOMImpl_ITransferData.hxx"
+
+#include <TDataStd_Comment.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDF_ChildIDIterator.hxx>
+#include <TNaming_Builder.hxx>
+#include <TNaming_NamedShape.hxx>
+
+
+//=============================================================================
+/*!
+ * SetName
+ */
+//=============================================================================
+void GEOMImpl_ITransferData::SetStringData
+ (const TopoDS_Shape &theSubShape,
+ const TCollection_AsciiString &theData,
+ const Standard_Boolean IsName)
+{
+ TDF_Label aLabel;
+ TDF_ChildIDIterator anIt
+ (_func->GetNamingEntry(), TDataStd_Name::GetID(), Standard_True);
+
+ for (; anIt.More(); anIt.Next()) {
+ Handle(TDataStd_Name) aNameAttr =
+ Handle(TDataStd_Name)::DownCast(anIt.Value());
+
+ if (aNameAttr.IsNull()) {
+ continue;
+ }
+
+ TDF_Label aLab = aNameAttr->Label();
+ Handle(TNaming_NamedShape) aShAttr;
+
+ if (aLab.FindAttribute(TNaming_NamedShape::GetID(), aShAttr) &&
+ aShAttr->Get().IsEqual(theSubShape)) {
+ aLabel = aLab;
+ break;
+ }
+ }
+
+ if (aLabel.IsNull()) {
+ TDF_TagSource aTag;
+
+ aLabel = aTag.NewChild(_func->GetNamingEntry());
+
+ TNaming_Builder aTnBuild (aLabel);
+
+ aTnBuild.Generated(theSubShape);
+ }
+
+ // set a name or a material
+ TCollection_ExtendedString aDataExt(theData);
+
+ if (IsName) {
+ TDataStd_Name::Set(aLabel, aDataExt);
+ } else {
+ TDataStd_Comment::Set(aLabel, aDataExt);
+ }
+}
+
+//=============================================================================
+/*!
+ * GetStringData
+ */
+//=============================================================================
+TCollection_AsciiString GEOMImpl_ITransferData::GetStringData
+ (const TopoDS_Shape &theSubShape,
+ const Standard_Boolean IsName)
+{
+ // check all named shapes using iterator
+ TCollection_AsciiString aResult;
+ TDF_ChildIDIterator anIt
+ (_func->GetNamingEntry(), TNaming_NamedShape::GetID(), Standard_True);
+
+ for (; anIt.More(); anIt.Next()) {
+ Handle(TNaming_NamedShape) aShAttr =
+ Handle(TNaming_NamedShape)::DownCast(anIt.Value());
+
+ if (aShAttr.IsNull()) {
+ continue;
+ }
+
+ if (aShAttr->Get().IsEqual(theSubShape)) {
+ TDF_Label aLabel = aShAttr->Label();
+ Standard_Boolean isFound = Standard_False;
+
+ if (IsName) {
+ Handle(TDataStd_Name) aString;
+
+ if(aLabel.FindAttribute(TDataStd_Name::GetID(), aString)) {
+ aResult = TCollection_AsciiString(aString->Get());
+ isFound = Standard_True;
+ }
+ } else {
+ Handle(TDataStd_Comment) aString;
+
+ if(aLabel.FindAttribute(TDataStd_Comment::GetID(), aString)) {
+ aResult = TCollection_AsciiString(aString->Get());
+ isFound = Standard_True;
+ }
+ }
+
+ if (isFound) {
+ break;
+ }
+ }
+ }
+
+ return aResult;
+}
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+//NOTE: This is an intreface to a function for the Transfer Data functionality.
+//
+
+
+#ifndef _GEOMImpl_ITransferData_HXX_
+#define _GEOMImpl_ITransferData_HXX_
+
+
+#include "GEOM_GEOMImpl.hxx"
+#include "GEOM_Function.hxx"
+
+#include <TColStd_HArray1OfInteger.hxx>
+
+
+#define TD_ARG_REF1 1
+#define TD_ARG_REF2 2
+#define TD_ARG_METHOD 3
+#define TD_ARG_DATUM_NAME 4
+#define TD_ARG_DATUM_MAX_VALUE 5
+#define TD_ARG_DATUM_VALUE 6
+
+class GEOMImpl_ITransferData
+{
+ public:
+
+ GEOMImpl_ITransferData(const Handle(GEOM_Function) &theFunction)
+ : _func(theFunction) {}
+
+ void SetRef1(const Handle(GEOM_Function) &theRefPoint1)
+ { _func->SetReference(TD_ARG_REF1, theRefPoint1); }
+
+ Handle(GEOM_Function) GetRef1() { return _func->GetReference(TD_ARG_REF1); }
+
+ void SetRef2(const Handle(GEOM_Function) &theRefPoint2)
+ { _func->SetReference(TD_ARG_REF2, theRefPoint2); }
+
+ Handle(GEOM_Function) GetRef2() { return _func->GetReference(TD_ARG_REF2); }
+
+ void SetFindMethod(const int theFindMethod)
+ { _func->SetInteger(TD_ARG_METHOD, theFindMethod); }
+
+ int GetFindMethod() { return _func->GetInteger(TD_ARG_METHOD); }
+
+ void SetDatumName(const Handle(TColStd_HArray1OfExtendedString) &theDatumName)
+ { _func->SetStringArray(TD_ARG_DATUM_NAME, theDatumName); }
+
+ Handle(TColStd_HArray1OfExtendedString) GetDatumName()
+ { return _func->GetStringArray(TD_ARG_DATUM_NAME); }
+
+ void SetDatumMaxVal(const Handle(TColStd_HArray1OfInteger) &theDatumMaxVal)
+ { _func->SetIntegerArray(TD_ARG_DATUM_MAX_VALUE, theDatumMaxVal); }
+
+ Handle(TColStd_HArray1OfInteger) GetDatumMaxVal()
+ { return _func->GetIntegerArray(TD_ARG_DATUM_MAX_VALUE); }
+
+ void SetDatumVal(const Handle(TColStd_HArray1OfInteger) &theDatumVal)
+ { _func->SetIntegerArray(TD_ARG_DATUM_VALUE, theDatumVal); }
+
+ Handle(TColStd_HArray1OfInteger) GetDatumVal()
+ { return _func->GetIntegerArray(TD_ARG_DATUM_VALUE); }
+
+ GEOMIMPL_EXPORT void SetName(const TopoDS_Shape &theSubShape,
+ const TCollection_AsciiString &theName)
+ { SetStringData(theSubShape, theName, Standard_True); }
+
+ GEOMIMPL_EXPORT TCollection_AsciiString GetName
+ (const TopoDS_Shape &theSubShape)
+ { return GetStringData(theSubShape, Standard_True); }
+
+ GEOMIMPL_EXPORT void SetMaterial(const TopoDS_Shape &theSubShape,
+ const TCollection_AsciiString &theName)
+ { SetStringData(theSubShape, theName, Standard_False); }
+
+ GEOMIMPL_EXPORT TCollection_AsciiString GetMaterial
+ (const TopoDS_Shape &theSubShape)
+ { return GetStringData(theSubShape, Standard_False); }
+
+ private:
+
+ TCollection_AsciiString GetStringData(const TopoDS_Shape &theSubShape,
+ const Standard_Boolean IsName);
+
+ void SetStringData(const TopoDS_Shape &theSubShape,
+ const TCollection_AsciiString &theData,
+ const Standard_Boolean IsName);
+
+ private:
+
+ Handle(GEOM_Function) _func;
+};
+
+#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GEOMImpl_ITranslate.hxx>
#include <GEOMImpl_IMirror.hxx>
#include <GEOMImpl_IProjection.hxx>
+#include <GEOMImpl_IProjOnCyl.hxx>
#include <GEOMImpl_IOffset.hxx>
#include <GEOMImpl_IScale.hxx>
#include <GEOMImpl_IRotate.hxx>
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
//Add a translate function
Handle(GEOM_Function) aFunction =
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
//Add a translate function
Handle(GEOM_Function) aFunction =
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
//Add a translate function
Handle(GEOM_Function) aFunction =
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
//Add a mirror function
Handle(GEOM_Function) aFunction =
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
//Add a mirror function
Handle(GEOM_Function) aFunction =
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
//Add a mirror function
Handle(GEOM_Function) aFunction =
if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
//Add a new Offset function
Handle(GEOM_Function) aFunction =
* ProjectShapeCopy
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_ITransformOperations::ProjectShapeCopy
- (Handle(GEOM_Object) theSource, Handle(GEOM_Object) theTarget)
+Handle(GEOM_Object)
+GEOMImpl_ITransformOperations::ProjectShapeCopy (Handle(GEOM_Object) theSource,
+ Handle(GEOM_Object) theTarget)
{
SetErrorCode(KO);
Handle(GEOM_Function) aLastFunction = theSource->GetLastFunction();
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be projected
- //Add a new Projection object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
+ Handle(GEOM_Object) aCopy;
- //Add a Projection function
- Handle(GEOM_Function) aFunction =
- aCopy->AddFunction(GEOMImpl_ProjectionDriver::GetID(), PROJECTION_COPY);
+ TopoDS_Shape aTarget = theTarget->GetValue();
+ if ( aTarget.IsNull() ) return NULL;
+ if ( aTarget.ShapeType() == TopAbs_EDGE ||
+ aTarget.ShapeType() == TopAbs_WIRE )
+ {
+ // a TPythonDump prevents dumping ProjectPointOnWire(),
+ // dump of MakeProjection() is done at the end of this function
+ GEOM::TPythonDump preventDump(aLastFunction, /*append=*/true);
+ Standard_Integer dummy;
+ ProjectPointOnWire( theSource, theTarget, aCopy, dummy );
+ if ( aCopy.IsNull() || !IsDone() )
+ return NULL;
+ }
+ else
+ {
+ //Add a new Projection object
+ aCopy = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
- //Check if the function is set correctly
- if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) return NULL;
+ //Add a Projection function
+ Handle(GEOM_Function) aFunction =
+ aCopy->AddFunction(GEOMImpl_ProjectionDriver::GetID(), PROJECTION_COPY);
- GEOMImpl_IMirror aTI (aFunction);
- aTI.SetPlane(theTarget->GetLastFunction());
- aTI.SetOriginal(aLastFunction);
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) return NULL;
- //Compute the Projection
- try {
- OCC_CATCH_SIGNALS;
- if (!GetSolver()->ComputeFunction(aFunction)) {
- SetErrorCode("Projection driver failed");
+ GEOMImpl_IMirror aTI (aFunction);
+ aTI.SetPlane(theTarget->GetLastFunction());
+ aTI.SetOriginal(aLastFunction);
+
+ //Compute the Projection
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Projection driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
//Make a Python command
+ Handle(GEOM_Function) aFunction = aCopy->GetLastFunction();
GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeProjection("
<< theSource << ", " << theTarget << ")";
if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
//Add a scale function
Handle(GEOM_Function) aFunction =
if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
//Add a position function
Standard_Integer aType = POSITION_SHAPE_COPY;
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
//Add a rotate function
aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_COPY);
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
//Add a rotate function
aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS_COPY);
if (aSampleFunc.IsNull()) return NULL; // There is no function which creates a sample object
// Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
// Add a transform function (depends on theSample function)
Handle(GEOM_Function) aFunction =
SetErrorCode(OK);
return aCopy;
}
+
+//=============================================================================
+/*!
+ * MakeProjectionOnCylinder
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ITransformOperations::MakeProjectionOnCylinder
+ (const Handle(GEOM_Object) &theObject,
+ const Standard_Real theRadius,
+ const Standard_Real theStartAngle,
+ const Standard_Real theAngleLength,
+ const Standard_Real theAngleRotation)
+{
+ SetErrorCode(KO);
+
+ if (theObject.IsNull()) {
+ return NULL;
+ }
+
+ Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
+
+ if (aLastFunction.IsNull()) {
+ //There is no function which creates an object to be projected
+ return NULL;
+ }
+
+ //Add a new Projection object
+ Handle(GEOM_Object) aResult =
+ GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
+
+ //Add a Projection function
+ Handle(GEOM_Function) aFunction = aResult->AddFunction
+ (GEOMImpl_ProjectionDriver::GetID(), PROJECTION_ON_CYLINDER);
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) {
+ return aResult;
+ }
+
+ GEOMImpl_IProjOnCyl aProj (aFunction);
+
+ aProj.SetShape(aLastFunction);
+ aProj.SetRadius(theRadius);
+ aProj.SetStartAngle(theStartAngle);
+ aProj.SetAngleLength(theAngleLength);
+ aProj.SetAngleRotation(theAngleRotation);
+
+ //Compute the Projection
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Projection driver failed");
+ return aResult;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return aResult;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction)
+ << aResult << " = geompy.MakeProjectionOnCylinder("
+ << theObject << ", " << theRadius << ", " << theStartAngle
+ << ", " << theAngleLength << ", " << theAngleRotation << ")";
+
+ SetErrorCode(OK);
+
+ return aResult;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
Standard_EXPORT Handle(GEOM_Object) TransformLikeOtherCopy (Handle(GEOM_Object) theObject,
Handle(GEOM_Object) theSample);
+ Standard_EXPORT Handle(GEOM_Object) MakeProjectionOnCylinder
+ (const Handle(GEOM_Object) &theObject,
+ const Standard_Real theRadius,
+ const Standard_Real theStartAngle,
+ const Standard_Real theAngleLength,
+ const Standard_Real theAngleRotation);
+
};
#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GEOMImpl_IOffset.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
+#include <GEOMUtils.hxx>
#include <BRepOffsetAPI_MakeOffsetShape.hxx>
-#include <BRep_Tool.hxx>
-#include <TopoDS.hxx>
+#include <BRepOffsetAPI_MakeThickSolid.hxx>
#include <TopoDS_Shape.hxx>
-#include <TopoDS_Vertex.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
-
#include <BRepClass3d_SolidClassifier.hxx>
-
#include <Precision.hxx>
-#include <gp_Pnt.hxx>
-
-#include <BRepCheck_Analyzer.hxx>
-#include <ShapeFix_ShapeTolerance.hxx>
-#include <ShapeFix_Shape.hxx>
-
#include <Standard_ConstructionError.hxx>
#include <StdFail_NotDone.hxx>
-#include "utilities.h"
-
//=======================================================================
//function : GetID
//purpose :
return aOffsetDriver;
}
-
//=======================================================================
//function : GEOMImpl_OffsetDriver
//purpose :
Handle(GEOM_Function) aRefShape = aCI.GetShape();
TopoDS_Shape aShapeBase = aRefShape->GetValue();
Standard_Real anOffset = aCI.GetValue();
+ Standard_Boolean isInside = aCI.GetParam();
Standard_Real aTol = Precision::Confusion();
+ if (isInside)
+ anOffset = -anOffset;
+
if (Abs(anOffset) < aTol) {
TCollection_AsciiString aMsg ("Absolute value of offset can not be less than the tolerance value (");
aMsg += TCollection_AsciiString(aTol);
aTol);
if (MO.IsDone()) {
aShape = MO.Shape();
- // 23.04.2010 skl for bug 21699 from Mantis
- BRepCheck_Analyzer ana (aShape, Standard_True);
- ana.Init(aShape);
- if (!ana.IsValid()) {
- ShapeFix_ShapeTolerance aSFT;
- aSFT.LimitTolerance(aShape, Precision::Confusion(),
- Precision::Confusion(), TopAbs_SHAPE);
- Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
- aSfs->Perform();
- aShape = aSfs->Shape();
- ana.Init(aShape);
- if (!ana.IsValid())
- Standard_ConstructionError::Raise("Boolean operation aborted : non valid shape result");
- }
+ if ( !GEOMUtils::CheckShape(aShape, true) && !GEOMUtils::FixShapeTolerance(aShape) )
+ Standard_ConstructionError::Raise("Boolean operation aborted : non valid shape result");
}
else {
StdFail_NotDone::Raise("Offset construction failed");
}
else if (aType == OFFSET_THICKENING || aType == OFFSET_THICKENING_COPY)
{
- BRepClass3d_SolidClassifier aClassifier = BRepClass3d_SolidClassifier(aShapeBase);
- aClassifier.PerformInfinitePoint(Precision::Confusion());
- if (aClassifier.State()==TopAbs_IN)
- {
- // If the generated pipe faces normals are oriented towards the inside, the offset is negative
- // so that the thickening is still towards outside
- anOffset=-anOffset;
- }
+ const TopAbs_ShapeEnum aType = aShapeBase.ShapeType();
+
+ if (aType == TopAbs_FACE || aType == TopAbs_SHELL) {
+ // Create a thick solid.
+ BRepClass3d_SolidClassifier aClassifier = BRepClass3d_SolidClassifier(aShapeBase);
+ aClassifier.PerformInfinitePoint(Precision::Confusion());
+ if (aClassifier.State()==TopAbs_IN)
+ {
+ // If the generated pipe faces normals are oriented towards the inside, the offset is negative
+ // so that the thickening is still towards outside
+ anOffset=-anOffset;
+ }
- BRepOffset_MakeOffset myOffsetShape(aShapeBase, anOffset, aTol, BRepOffset_Skin,
- Standard_False, Standard_False, GeomAbs_Intersection, Standard_True);
+ BRepOffset_MakeOffset myOffsetShape(aShapeBase, anOffset, aTol, BRepOffset_Skin,
+ Standard_False, Standard_False, GeomAbs_Intersection, Standard_True);
- if (!myOffsetShape.IsDone())
- {
- StdFail_NotDone::Raise("Thickening construction failed");
- }
- aShape = myOffsetShape.Shape();
+ if (!myOffsetShape.IsDone())
+ {
+ StdFail_NotDone::Raise("Thickening construction failed");
+ }
+ aShape = myOffsetShape.Shape();
+
+ // Control the solid orientation. This is mostly done to fix a bug in case of extrusion
+ // of a circle. The built solid is then badly oriented
+ BRepClass3d_SolidClassifier anotherClassifier = BRepClass3d_SolidClassifier(aShape);
+ anotherClassifier.PerformInfinitePoint(Precision::Confusion());
+ if (anotherClassifier.State()==TopAbs_IN)
+ {
+ aShape.Reverse();
+ }
+ } else if (aType == TopAbs_SOLID) {
+ // Create a hollowed solid.
+ Handle(TColStd_HArray1OfInteger) aFacesIDs = aCI.GetFaceIDs();
+ TopTools_ListOfShape aFacesToRm;
- // Control the solid orientation. This is mostly done to fix a bug in case of extrusion
- // of a circle. The built solid is then badly oriented
- BRepClass3d_SolidClassifier anotherClassifier = BRepClass3d_SolidClassifier(aShape);
- anotherClassifier.PerformInfinitePoint(Precision::Confusion());
- if (anotherClassifier.State()==TopAbs_IN)
- {
- aShape.Reverse();
+ if (aFacesIDs.IsNull()) {
+ return 0;
+ }
+
+ TopTools_IndexedMapOfShape anIndices;
+
+ TopExp::MapShapes(aShapeBase, anIndices);
+
+ Standard_Integer aNbShapes = anIndices.Extent();
+ Standard_Integer i;
+
+ for (i = aFacesIDs->Lower(); i <= aFacesIDs->Upper(); ++i) {
+ const Standard_Integer anIndex = aFacesIDs->Value(i);
+
+ if (anIndex < 1 || anIndex > aNbShapes) {
+ // Invalid index.
+ return 0;
+ }
+
+ const TopoDS_Shape &aFace = anIndices.FindKey(anIndex);
+
+ if (aFace.ShapeType() != TopAbs_FACE) {
+ // Shape by index is not a face.
+ return 0;
+ }
+
+ aFacesToRm.Append(aFace);
+ }
+
+ // Create a hollowed solid.
+ BRepOffsetAPI_MakeThickSolid aMkSolid
+ (aShapeBase, aFacesToRm, anOffset, aTol, BRepOffset_Skin,
+ Standard_False, Standard_False, GeomAbs_Intersection);
+
+ if (aMkSolid.IsDone()) {
+ aShape = aMkSolid.Shape();
+ }
}
}
break;
case OFFSET_THICKENING:
case OFFSET_THICKENING_COPY:
- theOperationName = "MakeThickening";
+ theOperationName = "THICKNESS";
AddParam( theParams, "Object", aCI.GetShape() );
- AddParam( theParams, "Offset", aCI.GetValue() );
+ AddParam( theParams, "Offset", aCI.GetParam() ? -aCI.GetValue() : aCI.GetValue() );
+ {
+ Handle(TColStd_HArray1OfInteger) aFacesIDs = aCI.GetFaceIDs();
+
+ if (aFacesIDs.IsNull() == Standard_False) {
+ AddParam(theParams, "Faces IDs", aFacesIDs);
+ }
+ }
break;
default:
return false;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <Standard_Stream.hxx>
-
#include <GEOMImpl_PartitionDriver.hxx>
#include <GEOMImpl_IPartition.hxx>
#include <GEOMImpl_Types.hxx>
-
+#include <GEOMUtils.hxx>
#include <GEOM_Object.hxx>
#include <GEOM_Function.hxx>
-
#include <GEOMAlgo_Splitter.hxx>
#include <TDataStd_IntegerArray.hxx>
#include <TNaming_CopyShape.hxx>
-//#include <BRepBuilderAPI_Copy.hxx>
-#include <BRep_Tool.hxx>
-#include <BRepAlgo.hxx>
-#include <BRepTools.hxx>
-
#include <TopAbs.hxx>
#include <TopExp.hxx>
-#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Wire.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
-#include <ShapeFix_ShapeTolerance.hxx>
-#include <ShapeFix_Shape.hxx>
-
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_ListOfInteger.hxx>
#include <Standard_NullObject.hxx>
#include <StdFail_NotDone.hxx>
-#include <Precision.hxx>
-#include <gp_Pnt.hxx>
#include <BOPAlgo_CheckerSI.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
Standard_ConstructionError::Raise("Partition aborted : non valid shape result");
//end of IPAL21418
- if (!BRepAlgo::IsValid(aShape)) {
- // 08.07.2008 added by skl during fixing bug 19761 from Mantis
- ShapeFix_ShapeTolerance aSFT;
- aSFT.LimitTolerance(aShape, Precision::Confusion(),
- Precision::Confusion(), TopAbs_SHAPE);
- Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
- aSfs->Perform();
- aShape = aSfs->Shape();
- if (!BRepAlgo::IsValid(aShape))
- Standard_ConstructionError::Raise("Partition aborted : non valid shape result");
- }
+ if ( !GEOMUtils::CheckShape(aShape, true) && !GEOMUtils::FixShapeTolerance(aShape) )
+ Standard_ConstructionError::Raise("Partition aborted : non valid shape result");
aFunction->SetValue(aShape);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeFix_Face.hxx>
#include <ShapeFix_Shell.hxx>
-#include <ShapeFix_Shape.hxx>
-#include <ShapeFix_ShapeTolerance.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepBuilderAPI_MakeSolid.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_Sewing.hxx>
-#include <BRepCheck_Analyzer.hxx>
+#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepGProp.hxx>
#include <GeomFill_Trihedron.hxx>
#include <GeomFill_CorrectedFrenet.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Compound.hxx>
+#include <TopTools_DataMapOfShapeSequenceOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <GProp_GProps.hxx>
#include "utilities.h"
+#define GROUP_DOWN 0
+#define GROUP_UP 1
+#define GROUP_SIDE1 2
+#define GROUP_SIDE2 3
+#define GROUP_OTHER 4
+
+static const Standard_Real TolPipeSurf = 5.e-4;
+
+static bool FillGroups(const TopTools_SequenceOfShape *theGroups,
+ const TopTools_IndexedMapOfShape &theIndices,
+ Handle(TColStd_HArray1OfInteger) *theGroupIds);
+
+static void StoreGroups(GEOMImpl_IPipe *theCI,
+ Handle(TColStd_HArray1OfInteger) *theGroups);
+
+static bool DoGroups(BRepOffsetAPI_MakePipeShell &theSweep,
+ TopTools_SequenceOfShape *theGroups);
+
+static bool CreateGroups(BRepOffsetAPI_MakePipeShell &theSweep,
+ GEOMImpl_IPipe *theCI);
//=======================================================================
//function : GetID
Standard_Boolean isDone = theBuilder.IsDone();
- if (!isDone) {
+ if (!isDone ||
+ theBuilder.ErrorOnSurface() > TolPipeSurf) {
// Try to use Descrete Trihedron mode.
theBuilder.SetDiscreteMode();
theBuilder.Build();
BuildPipeShell(aBuilder);
TopoDS_Shape aShape = aBuilder.Shape();
- /*
- TopoDS_Compound C;
- BRep_Builder B;
- B.MakeCompound(C);
- B.Add(C,aShape);
- B.Add(C,FS1);
- B.Add(C,FS2);
- BRepTools::Write(C,"/dn02/users_Linux/skl/work/Bugs/14857/comp.brep");
- */
ShapeAnalysis_Edge sae;
double tol = Max(BRep_Tool::Tolerance(TopoDS::Face(FS1)),
BRep_Tool::Tolerance(TopoDS::Face(FS2)));
FS2 = Fs(numface);
}
+//=======================================================================
+//function : RemoveFaces
+//purpose : This function returns theShapeFrom without faces of the shape
+// theFacesToRm. It returns a shell if theShapeFrom is a solid or
+// a compound otherwise. Auxilary for CreatePipeWithDifferentSections
+// method.
+//=======================================================================
+static TopoDS_Shape RemoveFaces(const TopoDS_Shape &theShapeFrom,
+ const TopoDS_Shape &theFacesToRm)
+{
+ TopTools_IndexedMapOfShape aMapFaces;
+ TopExp_Explorer anExp(theShapeFrom, TopAbs_FACE);
+ BRep_Builder aBuilder;
+ TopoDS_Shape aResult;
+
+ if (theShapeFrom.ShapeType() == TopAbs_SOLID) {
+ // Create shell
+ aBuilder.MakeShell(TopoDS::Shell(aResult));
+ } else {
+ // Create compound
+ aBuilder.MakeCompound(TopoDS::Compound(aResult));
+ }
+
+ TopExp::MapShapes(theFacesToRm, TopAbs_FACE, aMapFaces);
+
+ for (; anExp.More(); anExp.Next()) {
+ const TopoDS_Shape &aFace = anExp.Current();
+
+ if (!aMapFaces.Contains(aFace)) {
+ aBuilder.Add(aResult, aFace);
+ }
+ }
+
+ return aResult;
+}
+
//=======================================================================
//function : CreatePipeWithDifferentSections
//purpose :
//=======================================================================
TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
- (const TopoDS_Wire& theWirePath,
- const Handle(TopTools_HSequenceOfShape) theHSeqBases,
- const Handle(TopTools_HSequenceOfShape) theHSeqLocs,
- const Standard_Boolean theWithContact,
- const Standard_Boolean theWithCorrect)
+ (const TopoDS_Wire &theWirePath,
+ const Handle(TopTools_HSequenceOfShape) theHSeqBases,
+ const Handle(TopTools_HSequenceOfShape) theHSeqLocs,
+ const Standard_Boolean theWithContact,
+ const Standard_Boolean theWithCorrect,
+ const Standard_Boolean IsBySteps,
+ Handle(TColStd_HArray1OfInteger) *theGroups)
{
TopoDS_Shape aShape;
}
}
- // check curvature of wire for condition that
- // max summary angle between directions along
- // wire path must be < 4*PI. If not - split wire
- // and seguences of shapes, perform pipe for each
- // and make sewing after that
- double fp,lp;
- gp_Pnt P1,P2;
- gp_Vec Vec1,Vec2;
- double SumAng = 0;
- if ( Edges.Length() > 0 ) {
- Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(Edges.Value(1)),fp,lp);
- C->D1(fp,P1,Vec1);
- C->D1(lp,P2,Vec2);
- SumAng = fabs(Vec1.Angle(Vec2));
- Vec1 = Vec2;
- P1 = P2;
- }
TColStd_SequenceOfInteger SplitEdgeNums,SplitLocNums;
- int LastLoc = 1;
- //cout<<"Edges.Length()="<<Edges.Length()<<endl;
- for (i=2; i<=Edges.Length(); i++) {
- TopoDS_Edge edge = TopoDS::Edge(Edges.Value(i));
- double tol = BRep_Tool::Tolerance(edge);
- Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp);
- C->D1(lp,P2,Vec2);
- double ang = fabs(Vec1.Angle(Vec2));
- SumAng += ang;
- if (SumAng>4*M_PI) {
- SumAng = ang;
- SplitEdgeNums.Append(i-1);
- int j;
- for (j=LastLoc+1; j<=aSeqLocs.Length(); j++) {
- TopoDS_Vertex aVert = TopoDS::Vertex(aSeqLocs.Value(j));
- gp_Pnt P = BRep_Tool::Pnt(aVert);
- if (P1.Distance(P) < tol) {
- SplitLocNums.Append(j);
- LastLoc = j;
- break;
- }
+
+ if (IsBySteps) {
+ // Fill SplitEdgeNums and SplitLocNums with intermediate location indices
+ // and corresponding edge indices.
+ Standard_Integer i = 1;
+ Standard_Integer j;
+ TopoDS_Vertex aVert;
+ gp_Pnt aP;
+
+ for (j = 2; j < aSeqLocs.Length(); j++) {
+ SplitLocNums.Append(j);
+ aVert = TopoDS::Vertex(aSeqLocs.Value(j));
+ aP = BRep_Tool::Pnt(aVert);
+
+ while (i < Edges.Length()) {
+ Standard_Real aFp;
+ Standard_Real aLp;
+ TopoDS_Edge anEdge = TopoDS::Edge(Edges.Value(i));
+ Standard_Real aTol = BRep_Tool::Tolerance(anEdge);
+ Handle(Geom_Curve) aC = BRep_Tool::Curve(anEdge, aFp, aLp);
+ gp_Pnt aPLast;
+
+ aC->D0(aLp, aPLast);
+ i++;
+
+ if (aP.Distance(aPLast) < aTol) {
+ SplitEdgeNums.Append(i - 1);
+ break;
}
}
+ }
+ } else {
+ // check curvature of wire for condition that
+ // max summary angle between directions along
+ // wire path must be < 4*PI. If not - split wire
+ // and seguences of shapes, perform pipe for each
+ // and make sewing after that
+ double fp,lp;
+ gp_Pnt P1,P2;
+ gp_Vec Vec1,Vec2;
+ double SumAng = 0;
+ if ( Edges.Length() > 0 ) {
+ Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(Edges.Value(1)),fp,lp);
+ C->D1(fp,P1,Vec1);
+ C->D1(lp,P2,Vec2);
+ SumAng = fabs(Vec1.Angle(Vec2));
Vec1 = Vec2;
P1 = P2;
+ }
+ int LastLoc = 1;
+ //cout<<"Edges.Length()="<<Edges.Length()<<endl;
+ for (i=2; i<=Edges.Length(); i++) {
+ TopoDS_Edge edge = TopoDS::Edge(Edges.Value(i));
+ double tol = BRep_Tool::Tolerance(edge);
+ Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp);
+ C->D1(lp,P2,Vec2);
+ double ang = fabs(Vec1.Angle(Vec2));
+ SumAng += ang;
+ if (SumAng>4*M_PI) {
+ SumAng = ang;
+ SplitEdgeNums.Append(i-1);
+ int j;
+ for (j=LastLoc+1; j<=aSeqLocs.Length(); j++) {
+ TopoDS_Vertex aVert = TopoDS::Vertex(aSeqLocs.Value(j));
+ gp_Pnt P = BRep_Tool::Pnt(aVert);
+ if (P1.Distance(P) < tol) {
+ SplitLocNums.Append(j);
+ LastLoc = j;
+ break;
+ }
+ }
+ }
+ Vec1 = Vec2;
+ P1 = P2;
+ }
}
+ bool isCreateGroups = (theGroups != NULL);
+
if (SplitLocNums.Length()==SplitEdgeNums.Length() && SplitEdgeNums.Length()>0) {
- TopTools_SequenceOfShape aSeqRes;
+ TopTools_SequenceOfShape aSeqRes;
+ TopTools_DataMapOfShapeSequenceOfShape aMapResGroups[5];
+ Standard_Integer iGrp;
int nn, num1 = 1, num2 = 1;
for (nn=1; nn<=SplitEdgeNums.Length(); nn++) {
// create wirepath and sequences of shapes
Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid");
}
- BuildPipeShell(aBuilder);
+ Standard_Boolean isDone = BuildPipeShell(aBuilder);
+
+ if (isDone && NeedCreateSolid && nn == 1) {
+ // Make solid for the first step.
+ isDone = aBuilder.MakeSolid();
+ }
+
+ if (!isDone) {
+ Standard_ConstructionError::Raise("Pipe construction failure");
+ }
TopoDS_Shape resShape = aBuilder.Shape();
+
+ if (NeedCreateSolid && nn == 1) {
+ // Remove top lid from the result.
+ resShape = RemoveFaces(resShape, aBuilder.LastShape());
+ }
+
aSeqRes.Append(resShape);
+
+ // Create groups.
+ if (isCreateGroups) {
+ // Make groups.
+ TopTools_SequenceOfShape aGroups[5];
+
+ if (!DoGroups(aBuilder, aGroups)) {
+ Standard_ConstructionError::Raise("Generate groups failure");
+ }
+
+ // Get shapes from all groups.
+ for (iGrp = 0; iGrp < 5; ++iGrp) {
+ aMapResGroups[iGrp].Bind(resShape, aGroups[iGrp]);
+ }
+ }
}
// create wirepath and sequences of shapes for last part
BRep_Builder B;
Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid");
}
- BuildPipeShell(aBuilder);
+ Standard_Boolean isDone = BuildPipeShell(aBuilder);
+
+ if (isDone && NeedCreateSolid) {
+ isDone = aBuilder.MakeSolid();
+ }
+
+ if (!isDone) {
+ Standard_ConstructionError::Raise("Pipe construction failure");
+ }
TopoDS_Shape resShape = aBuilder.Shape();
+
+ if (NeedCreateSolid) {
+ // Remove bottom lid from the result.
+ resShape = RemoveFaces(resShape, aBuilder.FirstShape());
+ }
+
aSeqRes.Append(resShape);
+
+ // Create groups.
+ if (isCreateGroups) {
+ // Make groups.
+ TopTools_SequenceOfShape aGroups[5];
+
+ if (!DoGroups(aBuilder, aGroups)) {
+ Standard_ConstructionError::Raise("Generate groups failure");
+ }
+
+ // Get shapes from all groups.
+ for (iGrp = 0; iGrp < 5; ++iGrp) {
+ aMapResGroups[iGrp].Bind(resShape, aGroups[iGrp]);
+ }
+ }
+
// make sewing for result
Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing;
aSewing->SetTolerance(Precision::Confusion());
}
aSewing->Perform();
aShape = aSewing->SewedShape();
+
+ if (NeedCreateSolid && aShape.ShapeType() == TopAbs_SHELL) {
+ // Build a solid.
+ BRepBuilderAPI_MakeSolid aMkSolid;
+
+ aMkSolid.Add(TopoDS::Shell(aShape));
+
+ if (!aMkSolid.IsDone()) {
+ Standard_ConstructionError::Raise("Can't create solid pipe");
+ }
+
+ TopoDS_Solid aSolid = aMkSolid.Solid();
+ BRepClass3d_SolidClassifier aSC(aSolid);
+
+ aSC.PerformInfinitePoint(Precision::Confusion());
+
+ if (aSC.State() == TopAbs_IN) {
+ aShape = aSolid.Reversed();
+ } else {
+ aShape = aSolid;
+ }
+ }
+
+ if (isCreateGroups) {
+ // Replase Group shapes by modified ones.
+ TopTools_SequenceOfShape aSeqGroups[5];
+
+ // For each group.
+ for (iGrp = 0; iGrp < 5; ++iGrp) {
+ // For each pipe
+ for (i = 1; i <= aSeqRes.Length(); ++i) {
+ if (iGrp == GROUP_DOWN && i > 1) {
+ // For DOWN group we use only the first pipe.
+ continue;
+ }
+
+ if (iGrp == GROUP_UP && i < aSeqRes.Length()) {
+ // For UP group we use only the last pipe.
+ continue;
+ }
+
+ const TopTools_SequenceOfShape &aShapes =
+ aMapResGroups[iGrp].Find(aSeqRes.Value(i));
+ Standard_Integer j;
+
+ // For each sub-shape of pipe
+ for (j = 1; j <= aShapes.Length(); ++j) {
+ const TopoDS_Shape &aGrpShape = aShapes.Value(j);
+
+ if (aSewing->IsModifiedSubShape(aGrpShape)) {
+ // Use the shape modified by sewing.
+ const TopoDS_Shape &aModifGrpShape =
+ aSewing->ModifiedSubShape(aGrpShape);
+
+ aSeqGroups[iGrp].Append(aModifGrpShape);
+ } else {
+ // Use the shape as it is.
+ aSeqGroups[iGrp].Append(aGrpShape);
+ }
+ }
+ }
+ }
+
+ // Fill groups
+ TopTools_IndexedMapOfShape anIndices;
+
+ TopExp::MapShapes(aShape, anIndices);
+
+ if (!FillGroups(aSeqGroups, anIndices, theGroups)) {
+ Standard_ConstructionError::Raise("Generate groups failure");
+ }
+ }
}
else {
// old implementation without splitting
Standard_ConstructionError::Raise("Pipe construction failure");
}
aShape = aBuilder.Shape();
+
+ if (isCreateGroups) {
+ // Make groups.
+ TopTools_SequenceOfShape aSeqGroups[5];
+
+ if (!DoGroups(aBuilder, aSeqGroups)) {
+ Standard_ConstructionError::Raise("Generate groups failure");
+ }
+
+ // Fill the groups.
+ Handle(TColStd_HArray1OfInteger) aGroupIds[5];
+ TopTools_IndexedMapOfShape anIndices;
+ const TopoDS_Shape aResult = aBuilder.Shape();
+
+ TopExp::MapShapes(aResult, anIndices);
+
+ if (!FillGroups(aSeqGroups, anIndices, theGroups)) {
+ Standard_ConstructionError::Raise("Generate groups failure");
+ }
+ }
aSeqFaces.Append(aShape);
for (j = 1; j <=usedBases.Length(); j++)
aBuilder.Delete(usedBases.Value(j));
static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
GEOMImpl_IPipe* aCI)
{
- //cout<<"CreatePipeForShellSections"<<endl;
- //TopoDS_Shape res;
int i,j;
BRep_Builder B;
Handle(TColStd_HSequenceOfTransient) aLocObjs = aCIDS->GetLocations();
Standard_Boolean aWithContact = (aCIDS->GetWithContactMode());
Standard_Boolean aWithCorrect = (aCIDS->GetWithCorrectionMode());
+ Standard_Boolean isGenerateGroups = aCIDS->GetGenerateGroups();
Standard_Integer nbBases = aBasesObjs->Length(),
nbSubBases = (aSubBasesObjs.IsNull() ? 0 :aSubBasesObjs->Length()),
Standard_ConstructionError::Raise("Number of sections is not equal to number of subsections ");
}
- //BRepOffsetAPI_MakePipeShell aBuilder(aWirePath);
-
TopTools_SequenceOfShape VLocs;
for (i=1; i<=nbBases; i++) {
Handle(Standard_Transient) anItemLoc = aLocObjs->Value(i);
for (; i<=Edges.Length(); i++)
B.Add(W,Edges.Value(i));
Wires.Append(W);
- //cout<<"Wires.Length()="<<Wires.Length()<<endl;
}
if (Wires.Length() != nbLocs-1) {
("One of location shapes is not lied on the path");
}
- //TopTools_SequenceOfShape aSeqBases;
- //TopTools_SequenceOfShape aSeqSubBases;
- //TopTools_SequenceOfShape aSeqFaces;
- TopoDS_Compound aComp;
+ TopTools_SequenceOfShape aGroups[5];
+ TopoDS_Compound aComp;
B.MakeCompound(aComp);
for (i = 1; i < nbBases; i++) {
TopoDS_Wire WPath = TopoDS::Wire(Wires.Value(i));
continue;
TopAbs_ShapeEnum aType2 = aShBase2.ShapeType();
- //BRepTools::Write(aShBase1,"/dn02/users_Linux/skl/work/Bugs/14857/base1.brep");
-
bool OkSec = (aType1==TopAbs_SHELL || aType1==TopAbs_FACE) &&
(aType2==TopAbs_SHELL || aType2==TopAbs_FACE);
if (!OkSec) {
CreateFewSolids = true;
}
- /*
- // check orientation of sections
- bool NeedReverse = false;
- {
- // first section
- anExp.Init(aShBase1, TopAbs_FACE);
- TopoDS_Shape aFace = anExp.Current();
- TColgp_SequenceOfPnt aPnts;
- double xc=0, yc=0, zc=0;
- for (anExp.Init(aFace, TopAbs_VERTEX); anExp.More(); anExp.Next()) {
- TopoDS_Vertex V = TopoDS::Vertex(anExp.Current());
- aPnts.Append(BRep_Tool::Pnt(V));
- xc += aPnts.Last().X();
- yc += aPnts.Last().Y();
- zc += aPnts.Last().Z();
- }
- gp_Pnt PC(xc/aPnts.Length(), yc/aPnts.Length(), zc/aPnts.Length());
- gp_Vec V1(PC,aPnts.Value(1));
- gp_Vec V2(PC,aPnts.Value(2));
- gp_Vec VN = V1.Crossed(V2);
- for (int ip=2; ip<aPnts.Length(); ip++) {
- V1 = gp_Vec(PC,aPnts.Value(ip));
- V2 = gp_Vec(PC,aPnts.Value(ip+1));
- VN.Add(V1.Crossed(V2));
- }
- gp_Vec PathNorm;
- gp_Pnt PLoc = BRep_Tool::Pnt(TopoDS::Vertex(VLocs(i)));
- TopExp_Explorer WE;
- for (WE.Init(WPath, TopAbs_EDGE); WE.More(); WE.Next()) {
- TopoDS_Edge edge = TopoDS::Edge(WE.Current());
- double tol = BRep_Tool::Tolerance(edge);
- TopoDS_Vertex VF = sae.FirstVertex(edge);
- gp_Pnt PF = BRep_Tool::Pnt(VF);
- if (PF.Distance(PLoc) < tol) {
- double fp,lp;
- Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp);
- gp_Pnt P1,P2;
- C->D0(fp,P1);
- if (P1.Distance(PLoc) < tol) {
- C->D0(fp+(lp-fp)/100,P2);
- }
- else {
- C->D0(lp,P1);
- C->D0(lp+(fp-lp)/100,P2);
- }
- PathNorm = gp_Vec(P1,P2);
- break;
- }
- else {
- TopoDS_Vertex VL = sae.LastVertex(edge);
- gp_Pnt PL = BRep_Tool::Pnt(VL);
- if (PL.Distance(PLoc) < tol) {
- double fp,lp;
- Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp);
- gp_Pnt P1,P2;
- C->D0(fp,P1);
- if (P1.Distance(PLoc) < tol) {
- C->D0(fp+(lp-fp)/100,P2);
- }
- else {
- C->D0(lp,P1);
- C->D0(lp+(fp-lp)/100,P2);
- }
- PathNorm = gp_Vec(P2,P1);
- break;
- }
- }
- }
- cout<<"VN("<<VN.X()<<","<<VN.Y()<<","<<VN.Z()<<")"<<endl;
- cout<<"PathNorm("<<PathNorm.X()<<","<<PathNorm.Y()<<","<<PathNorm.Z()<<")"<<endl;
- if (fabs(VN.Angle(PathNorm))>PI/2.) {
- NeedReverse = true;
- aShBase1.Reverse();
- }
- }
- {
- // second section
- anExp.Init(aShBase2, TopAbs_FACE);
- TopoDS_Shape aFace = anExp.Current();
- TColgp_SequenceOfPnt aPnts;
- double xc=0, yc=0, zc=0;
- for (anExp.Init(aFace, TopAbs_VERTEX); anExp.More(); anExp.Next()) {
- TopoDS_Vertex V = TopoDS::Vertex(anExp.Current());
- aPnts.Append(BRep_Tool::Pnt(V));
- xc += aPnts.Last().X();
- yc += aPnts.Last().Y();
- zc += aPnts.Last().Z();
- }
- gp_Pnt PC(xc/aPnts.Length(), yc/aPnts.Length(), zc/aPnts.Length());
- gp_Vec V1(PC,aPnts.Value(1));
- gp_Vec V2(PC,aPnts.Value(2));
- gp_Vec VN = V1.Crossed(V2);
- for (int ip=2; ip<aPnts.Length(); ip++) {
- V1 = gp_Vec(PC,aPnts.Value(ip));
- V2 = gp_Vec(PC,aPnts.Value(ip+1));
- VN.Add(V1.Crossed(V2));
- }
- gp_Vec PathNorm;
- gp_Pnt PLoc = BRep_Tool::Pnt(TopoDS::Vertex(VLocs(i+1)));
- TopExp_Explorer WE;
- for (WE.Init(WPath, TopAbs_EDGE); WE.More(); WE.Next()) {
- TopoDS_Edge edge = TopoDS::Edge(WE.Current());
- double tol = BRep_Tool::Tolerance(edge);
- TopoDS_Vertex VF = sae.FirstVertex(edge);
- gp_Pnt PF = BRep_Tool::Pnt(VF);
- if (PF.Distance(PLoc) < tol) {
- double fp,lp;
- Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp);
- gp_Pnt P1,P2;
- C->D0(fp,P1);
- if (P1.Distance(PLoc) < tol) {
- C->D0(fp+(lp-fp)/100,P2);
- }
- else {
- C->D0(lp,P1);
- C->D0(lp+(fp-lp)/100,P2);
- }
- PathNorm = gp_Vec(P2,P1);
- break;
- }
- else {
- TopoDS_Vertex VL = sae.LastVertex(edge);
- gp_Pnt PL = BRep_Tool::Pnt(VL);
- if (PL.Distance(PLoc) < tol) {
- double fp,lp;
- Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp);
- gp_Pnt P1,P2;
- C->D0(fp,P1);
- if (P1.Distance(PLoc) < tol) {
- C->D0(fp+(lp-fp)/100,P2);
- }
- else {
- C->D0(lp,P1);
- C->D0(lp+(fp-lp)/100,P2);
- }
- PathNorm = gp_Vec(P2,P1);
- break;
- }
- }
- }
- //cout<<"VN("<<VN.X()<<","<<VN.Y()<<","<<VN.Z()<<")"<<endl;
- //cout<<"PathNorm("<<PathNorm.X()<<","<<PathNorm.Y()<<","<<PathNorm.Z()<<")"<<endl;
- if (fabs(VN.Angle(PathNorm))>PI/2.)
- aShBase2.Reverse();
- }
- */
-
if (!CreateFewSolids) {
// we can create only one solid
TopoDS_Shape aWire1, aWire2;
BuildPipeShell(aBuilder);
- TopoDS_Shape aShape = aBuilder.Shape();
+ TopoDS_Shape aShape = aBuilder.Shape();
+ TopTools_SequenceOfShape aLocalGroups[5];
+
+ // Create groups.
+ if (isGenerateGroups) {
+ // Make groups.
+ if (!DoGroups(aBuilder, aLocalGroups)) {
+ if (aCI) delete aCI;
+ Standard_ConstructionError::Raise("Generate groups failure");
+ }
+
+ // Clear the groups Down and Up.
+ aLocalGroups[GROUP_DOWN].Clear();
+ aLocalGroups[GROUP_UP].Clear();
+ }
+
TopoDS_Shell aShell;
B.MakeShell(aShell);
for (anExp.Init(aShape, TopAbs_FACE); anExp.More(); anExp.Next()) {
}
for (anExp.Init(aShBase1, TopAbs_FACE); anExp.More(); anExp.Next()) {
B.Add(aShell,anExp.Current());
+
+ if (isGenerateGroups && i == 1) {
+ aLocalGroups[GROUP_DOWN].Append(anExp.Current());
+ }
}
for (anExp.Init(aShBase2, TopAbs_FACE); anExp.More(); anExp.Next()) {
B.Add(aShell,anExp.Current());
+
+ if (isGenerateGroups && i == nbBases - 1) {
+ aLocalGroups[GROUP_UP].Append(anExp.Current());
+ }
}
// make sewing for this shell
Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing;
else {
B.Add(aComp,aShell);
}
+
+ if (isGenerateGroups) {
+ Standard_Integer iGrp;
+
+ for (iGrp = 0; iGrp < 5; ++iGrp) {
+ Standard_Integer j;
+
+ // For each sub-shape of pipe
+ for (j = 1; j <= aLocalGroups[iGrp].Length(); ++j) {
+ const TopoDS_Shape &aGrpShape = aLocalGroups[iGrp].Value(j);
+
+ if (aSewing->IsModifiedSubShape(aGrpShape)) {
+ // Use the shape modified by sewing.
+ const TopoDS_Shape &aModifGrpShape =
+ aSewing->ModifiedSubShape(aGrpShape);
+
+ aGroups[iGrp].Append(aModifGrpShape);
+ } else {
+ // Use the shape as it is.
+ aGroups[iGrp].Append(aGrpShape);
+ }
+ }
+ }
+ }
}
}
else {
BuildPipeShell(aBuilder);
- TopoDS_Shape aShape = aBuilder.Shape();
+ TopoDS_Shape aShape = aBuilder.Shape();
+ TopTools_SequenceOfShape aLocalGroups[5];
+
+ // Create groups.
+ if (isGenerateGroups) {
+ // Make groups.
+ if (!DoGroups(aBuilder, aLocalGroups)) {
+ if (aCI) delete aCI;
+ Standard_ConstructionError::Raise("Generate groups failure");
+ }
+
+ // Clear the groups Down and Up.
+ aLocalGroups[GROUP_DOWN].Clear();
+ aLocalGroups[GROUP_UP].Clear();
+
+ if (i == 1) {
+ aLocalGroups[GROUP_DOWN].Append(F1);
+ }
+
+ if (i == nbBases - 1) {
+ aLocalGroups[GROUP_UP].Append(F2);
+ }
+ }
+
TopoDS_Shell aShell;
B.MakeShell(aShell);
for (anExp.Init(aShape, TopAbs_FACE); anExp.More(); anExp.Next()) {
else {
B.Add(aComp,aShell);
}
+
+ if (isGenerateGroups) {
+ // Replase Group shapes by modified ones.
+ Standard_Integer iGrp;
+
+ // For each group.
+ for (iGrp = 0; iGrp < 5; ++iGrp) {
+ Standard_Integer j;
+
+ // For each sub-shape of pipe
+ for (j = 1; j <= aLocalGroups[iGrp].Length(); ++j) {
+ const TopoDS_Shape &aGrpShape = aLocalGroups[iGrp].Value(j);
+
+ if (aSewing->IsModifiedSubShape(aGrpShape)) {
+ // Use the shape modified by sewing.
+ const TopoDS_Shape &aModifGrpShape =
+ aSewing->ModifiedSubShape(aGrpShape);
+
+ aGroups[iGrp].Append(aModifGrpShape);
+ } else {
+ // Use the shape as it is.
+ aGroups[iGrp].Append(aGrpShape);
+ }
+ }
+ }
+ }
}
}
+ }
+ }
+ if (isGenerateGroups) {
+ // Fill the groups.
+ Handle(TColStd_HArray1OfInteger) aGroupIds[5];
+ TopTools_IndexedMapOfShape anIndices;
+
+ TopExp::MapShapes(aComp, anIndices);
+
+ if (!FillGroups(aGroups, anIndices, aGroupIds)) {
+ if (aCI) delete aCI;
+ Standard_ConstructionError::Raise("Generate groups failure");
}
+
+ StoreGroups(aCI, aGroupIds);
}
- //BRepTools::Write(aComp,"/dn02/users_Linux/skl/work/Bugs/14857/comp.brep");
return aComp;
}
Handle(TColStd_HSequenceOfTransient) aBasesObjs = aCIDS->GetBases();
// vertex for recognition
Handle(TColStd_HSequenceOfTransient) VObjs = aCIDS->GetLocations();
+ Standard_Boolean isGenerateGroups = aCIDS->GetGenerateGroups();
Standard_Integer nbBases = aBasesObjs->Length(),
nbv = (VObjs.IsNull() ? 0 :VObjs->Length());
Standard_ConstructionError::Raise("Number of shapes for recognition is invalid");
}
+ TopTools_SequenceOfShape aGroups[5];
TopTools_SequenceOfShape SecVs,Bases;
for (i=1; i<=nbBases; i++) {
// vertex
}
TopTools_MapOfShape aFaces1,aFaces2;
+ TopTools_MapOfShape aBndEdges1;
+
for (anExp.Init(aShBase1, TopAbs_FACE); anExp.More(); anExp.Next()) {
- aFaces1.Add(anExp.Current());
+ const TopoDS_Shape &aBaseFace1 = anExp.Current();
+
+ if (aFaces1.Add(aBaseFace1)) {
+ // Get boundary edges.
+ TopExp_Explorer anExpE(aBaseFace1, TopAbs_EDGE);
+
+ for (; anExpE.More(); anExpE.Next()) {
+ const TopoDS_Shape &aBaseEdge1 = anExpE.Current();
+
+ if (!aBndEdges1.Add(aBaseEdge1)) {
+ aBndEdges1.Remove(aBaseEdge1);
+ }
+ }
+ }
}
for (anExp.Init(aShBase2, TopAbs_FACE); anExp.More(); anExp.Next()) {
aFaces2.Add(anExp.Current());
TopExp_Explorer anExpE(F1,TopAbs_EDGE);
TopTools_SequenceOfShape aNewFs;
+ TopTools_SequenceOfShape aLocalGroups[5];
+
//int nbee=0;
for (; anExpE.More(); anExpE.Next()) {
TopoDS_Edge E1 = TopoDS::Edge(anExpE.Current());
B.Add(W,E2);
B.Add(W,E3);
B.Add(W,E4.Reversed());
- //cout<<" wire for edge "<<nbee<<" is created"<<endl;
- //BRepTools::Write(W,"/dn02/users_Linux/skl/work/Bugs/14857/w.brep");
// make surface
GeomConvert::CurveToBSplineCurve(C4,Convert_RationalC1);
if (CE4->Degree()<3)
CE4->IncreaseDegree(3);
- //cout<<"CE1->Degree()="<<CE1->Degree()<<" CE2->Degree()="<<CE2->Degree()
- // <<" CE3->Degree()="<<CE3->Degree()<<" CE4->Degree()="<<CE4->Degree()<<endl;
- //if (fic.open("/dn02/users_Linux/skl/work/Bugs/14857/ce1.brep",ios::out)) {
- // os<<"DrawTrSurf_BSplineCurve"<<endl;
- // GeomTools::Write(CE1,os);
- // fic.close();
- //}
Handle(Geom_Surface) BS;
try {
TopoDS_Face FixedFace = sff->Face();
aNewFs.Append(FixedFace);
VPE.Add(E1,FixedFace);
- //cout<<" face for edge "<<nbee<<" is created"<<endl;
- //BRepTools::Write(FixedFace,"/dn02/users_Linux/skl/work/Bugs/14857/f.brep");
+
+ if (isGenerateGroups) {
+ if (aBndEdges1.Contains(E1)) {
+ // This is a boundary face.
+ aLocalGroups[GROUP_OTHER].Append(FixedFace);
+ }
+ }
}
// make shell
TopoDS_Shell aShell;
B.Add(aShell,F1);
B.Add(aShell,F2);
+ // Create groups.
+ if (isGenerateGroups && i == 1) {
+ aLocalGroups[GROUP_DOWN].Append(F1);
+ }
+
+ if (isGenerateGroups && i == nbBases - 1) {
+ aLocalGroups[GROUP_UP].Append(F2);
+ }
+
// make sewing for this shell
Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing;
aSewing->SetTolerance(Precision::Confusion());
aSewing->Perform();
MESSAGE (" shell for face "<<nbff<<" is created");
const TopoDS_Shape aSewShape = aSewing->SewedShape();
- //BRepTools::Write(aSewShape,"/dn02/users_Linux/skl/work/Bugs/14857/sew.brep");
if (aSewShape.ShapeType() == TopAbs_SHELL) {
aShell = TopoDS::Shell(aSewShape);
GProp_GProps aSystem;
B.Add(aComp,aShell);
MESSAGE (" solid for face "<<nbff<<" is not created");
}
- //cout<<" solid for face "<<nbff<<" is created"<<endl;
- //Handle(ShapeFix_Shell) sfs = new ShapeFix_Shell(aShell);
- //sfs->Perform();
- //TopoDS_Shell FixedShell = sfs->Shell();
- /*
- GProp_GProps aSystem;
- BRepGProp::VolumeProperties(FixedShell, aSystem);
- if (aSystem.Mass()<0) {
- //cout<<"aSewShape is reversed"<<endl;
- FixedShell.Reverse();
- }
- if (BRep_Tool::IsClosed(FixedShell)) {
- TopoDS_Solid aSolid;
- B.MakeSolid(aSolid);
- B.Add(aSolid,aShell);
- B.Add(aComp,aSolid);
- }
- else {
- B.Add(aComp,FixedShell);
+ if (isGenerateGroups) {
+ Standard_Integer iGrp;
+
+ for (iGrp = 0; iGrp < 5; ++iGrp) {
+ Standard_Integer j;
+
+ // For each sub-shape of pipe
+ for (j = 1; j <= aLocalGroups[iGrp].Length(); ++j) {
+ const TopoDS_Shape &aGrpShape = aLocalGroups[iGrp].Value(j);
+
+ if (aSewing->IsModifiedSubShape(aGrpShape)) {
+ // Use the shape modified by sewing.
+ const TopoDS_Shape &aModifGrpShape =
+ aSewing->ModifiedSubShape(aGrpShape);
+
+ aGroups[iGrp].Append(aModifGrpShape);
+ } else {
+ // Use the shape as it is.
+ aGroups[iGrp].Append(aGrpShape);
+ }
+ }
+ }
}
- */
}
}
- //BRepTools::Write(aComp,"/dn02/users_Linux/skl/work/Bugs/14857/comp.brep");
+ if (isGenerateGroups) {
+ // Fill the groups.
+ Handle(TColStd_HArray1OfInteger) aGroupIds[5];
+ TopTools_IndexedMapOfShape anIndices;
+
+ TopExp::MapShapes(aComp, anIndices);
+
+ if (!FillGroups(aGroups, anIndices, aGroupIds)) {
+ if (aCI) delete aCI;
+ Standard_ConstructionError::Raise("Generate groups failure");
+ }
+
+ StoreGroups(aCI, aGroupIds);
+ }
+
return aComp;
}
PipeBuilder.MakeSolid();
}
+ if (!CreateGroups(PipeBuilder, aCIBN)) {
+ if (aCIBN) delete aCIBN;
+ Standard_ConstructionError::Raise("Generate groups failure");
+ }
+
return PipeBuilder.Shape();
}
+//=======================================================================
+//function : FillGroups
+//purpose : auxilary for DoGroups()
+//=======================================================================
+bool FillGroups(const TopTools_SequenceOfShape *theGroups,
+ const TopTools_IndexedMapOfShape &theIndices,
+ Handle(TColStd_HArray1OfInteger) *theGroupIds)
+{
+ Standard_Integer i;
+
+ for (i = 0; i < 5; ++i) {
+ if (!theGroups[i].IsEmpty()) {
+ const Standard_Integer aNbShapes = theGroups[i].Length();
+ Standard_Integer j;
+
+ theGroupIds[i] = new TColStd_HArray1OfInteger(1, aNbShapes);
+
+ for (j = 1; j <= aNbShapes; ++j) {
+ const TopoDS_Shape &aShape = theGroups[i].Value(j);
+ const Standard_Integer anIndex = theIndices.FindIndex(aShape);
+
+ if (anIndex == 0) {
+ return false;
+ }
+
+ theGroupIds[i]->SetValue(j, anIndex);
+ }
+ }
+ }
+
+ return true;
+}
+
+//=======================================================================
+//function : StoreGroups
+//purpose : auxilary for CreateGroups()
+//=======================================================================
+void StoreGroups(GEOMImpl_IPipe *theCI,
+ Handle(TColStd_HArray1OfInteger) *theGroups)
+{
+ if (theGroups[GROUP_DOWN].IsNull() == Standard_False) {
+ theCI->SetGroupDown(theGroups[GROUP_DOWN]);
+ }
+
+ if (theGroups[GROUP_UP].IsNull() == Standard_False) {
+ theCI->SetGroupUp(theGroups[GROUP_UP]);
+ }
+
+ if (theGroups[GROUP_SIDE1].IsNull() == Standard_False) {
+ theCI->SetGroupSide1(theGroups[GROUP_SIDE1]);
+ }
+
+ if (theGroups[GROUP_SIDE2].IsNull() == Standard_False) {
+ theCI->SetGroupSide2(theGroups[GROUP_SIDE2]);
+ }
+
+ if (theGroups[GROUP_OTHER].IsNull() == Standard_False) {
+ theCI->SetGroupOther(theGroups[GROUP_OTHER]);
+ }
+}
+
+//=======================================================================
+//function : CreateDownUpGroups
+//purpose : auxilary for DoGroups()
+//=======================================================================
+static bool CreateDownUpGroups(BRepPrimAPI_MakeSweep *theSweep,
+ TopTools_SequenceOfShape *theGroups,
+ Standard_Boolean &IsDoSides)
+{
+ const TopoDS_Shape aDownShape = theSweep->FirstShape();
+ const TopAbs_ShapeEnum aType = aDownShape.ShapeType();
+ TopAbs_ShapeEnum anUpDownType = TopAbs_SHAPE;
+
+ IsDoSides = Standard_False;
+
+ switch (aType) {
+ case TopAbs_EDGE:
+ case TopAbs_WIRE:
+ anUpDownType = TopAbs_EDGE;
+
+ if (GEOMUtils::IsOpenPath(aDownShape)) {
+ IsDoSides = Standard_True;
+ }
+ break;
+ case TopAbs_FACE:
+ case TopAbs_SHELL:
+ anUpDownType = TopAbs_FACE;
+ break;
+ default:
+ break;
+ }
+
+ if (anUpDownType == TopAbs_SHAPE) {
+ // Invalid Up and Down group type.
+ return false;
+ }
+
+ TopExp_Explorer anExp(aDownShape, anUpDownType);
+ TopTools_MapOfShape aMapFence;
+
+ // Create Down group.
+ for (; anExp.More(); anExp.Next()) {
+ const TopoDS_Shape &aShape = anExp.Current();
+
+ if (aMapFence.Add(aShape)) {
+ theGroups[GROUP_DOWN].Append(aShape);
+ }
+ }
+
+ // Create Up group
+ const TopoDS_Shape anUpShape = theSweep->LastShape();
+
+ aMapFence.Clear();
+ anExp.Init(anUpShape, anUpDownType);
+
+ for (; anExp.More(); anExp.Next()) {
+ const TopoDS_Shape &aShape = anExp.Current();
+
+ if (aMapFence.Add(aShape)) {
+ theGroups[GROUP_UP].Append(aShape);
+ }
+ }
+
+ return true;
+}
+
+//=======================================================================
+//function : DoGroups
+//purpose : auxilary for CreateGroups()
+//=======================================================================
+bool DoGroups(BRepOffsetAPI_MakePipeShell &theSweep,
+ TopTools_SequenceOfShape *theGroups)
+{
+ Standard_Boolean isDoSides = Standard_False;
+
+ if (!CreateDownUpGroups(&theSweep, theGroups, isDoSides)) {
+ // Up and Down groups creation failure
+ return false;
+ }
+
+ const TopoDS_Shape aDownShape = theSweep.FirstShape();
+
+ if (isDoSides) {
+ // Create Side1 and Side2 groups.
+ const TopAbs_ShapeEnum aType = aDownShape.ShapeType();
+ TopoDS_Vertex aV[2];
+ Standard_Integer i;
+
+ if (aType == TopAbs_EDGE) {
+ TopExp::Vertices(TopoDS::Edge(aDownShape), aV[0], aV[1], Standard_True);
+ } else { // aType == TopAbs_WIRE
+ TopExp::Vertices(TopoDS::Wire(aDownShape), aV[0], aV[1]);
+ }
+
+ for (i = 0; i < 2; ++i) {
+ if (aV[i].IsNull() == Standard_False) {
+ const TopTools_ListOfShape &aLstSide = theSweep.Generated(aV[i]);
+
+ if (!aLstSide.IsEmpty()) {
+ TopTools_ListIteratorOfListOfShape aSideIt(aLstSide);
+ TopTools_MapOfShape aMapFence;
+ const Standard_Integer anIdSide =
+ (i == 0 ? GROUP_SIDE1 : GROUP_SIDE2);
+
+ for (; aSideIt.More(); aSideIt.Next()) {
+ const TopoDS_Shape &aSideShape = aSideIt.Value();
+
+ if (aSideShape.ShapeType() == TopAbs_EDGE) {
+ if (aMapFence.Add(aSideShape)) {
+ theGroups[anIdSide].Append(aSideShape);
+ }
+ } else {
+ // Only edges can be is Side1 and Side2 groups.
+ return false;
+ }
+ }
+ }
+ }
+ }
+ } else {
+ // Create Other group. Get boudnary edges of the profile.
+ TopTools_MapOfShape aMapBndEdges;
+ TopExp_Explorer anExp(aDownShape, TopAbs_EDGE);
+
+ for (; anExp.More(); anExp.Next()) {
+ const TopoDS_Shape &anEdge = anExp.Current();
+
+ if (!aMapBndEdges.Add(anEdge)) {
+ aMapBndEdges.Remove(anEdge);
+ }
+ }
+
+ // Fill the map of faces generated from profile's boundary edges.
+ TopTools_MapIteratorOfMapOfShape anIter(aMapBndEdges);
+ TopTools_MapOfShape aMapFence;
+
+ for (; anIter.More(); anIter.Next()) {
+ const TopTools_ListOfShape &aLstOther = theSweep.Generated(anIter.Key());
+
+ if (!aLstOther.IsEmpty()) {
+ TopTools_ListIteratorOfListOfShape anOtherIt(aLstOther);
+
+ for (; anOtherIt.More(); anOtherIt.Next()) {
+ const TopoDS_Shape &anOtherShape = anOtherIt.Value();
+
+ if (anOtherShape.ShapeType() == TopAbs_FACE) {
+ if (aMapFence.Add(anOtherShape)) {
+ theGroups[GROUP_OTHER].Append(anOtherShape);
+ }
+ } else {
+ // Only faces can be in Other group.
+ return false;
+ }
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+//=======================================================================
+//function : CreateGroups
+//purpose : auxilary for Execute()
+//=======================================================================
+bool CreateGroups(BRepOffsetAPI_MakePipeShell &theSweep,
+ GEOMImpl_IPipe *theCI)
+{
+ if (!theCI->GetGenerateGroups()) {
+ // Nothing to do.
+ return true;
+ }
+
+ // Make groups.
+ TopTools_SequenceOfShape aGroups[5];
+
+ if (!DoGroups(theSweep, aGroups)) {
+ return false;
+ }
+
+ // Fill the groups.
+ Handle(TColStd_HArray1OfInteger) aGroupIds[5];
+ TopTools_IndexedMapOfShape anIndices;
+ const TopoDS_Shape aResult = theSweep.Shape();
+
+ TopExp::MapShapes(aResult, anIndices);
+
+ if (!FillGroups(aGroups, anIndices, aGroupIds)) {
+ return false;
+ }
+
+ // Store groups.
+ StoreGroups(theCI, aGroupIds);
+
+ return true;
+}
+
+//=======================================================================
+//function : DoGroups
+//purpose : auxilary for CreateGroups()
+//=======================================================================
+static bool DoGroups(const TopoDS_Shape &theProfile,
+ const TopoDS_Shape &thePath,
+ BRepOffsetAPI_MakePipe &theSweep,
+ TopTools_SequenceOfShape *theGroups)
+{
+ Standard_Boolean isDoSides = Standard_False;
+
+ if (!CreateDownUpGroups(&theSweep, theGroups, isDoSides)) {
+ // Up and Down groups creation failure
+ return false;
+ }
+
+ if (isDoSides) {
+ // Create Side1 and Side2 groups.
+ const TopAbs_ShapeEnum aType = theProfile.ShapeType();
+ TopoDS_Vertex aV[2];
+ Standard_Integer i;
+
+ if (aType == TopAbs_EDGE) {
+ TopExp::Vertices(TopoDS::Edge(theProfile), aV[0], aV[1], Standard_True);
+ } else { // aType == TopAbs_WIRE
+ TopExp::Vertices(TopoDS::Wire(theProfile), aV[0], aV[1]);
+ }
+
+ for (i = 0; i < 2; ++i) {
+ if (aV[i].IsNull() == Standard_False) {
+ TopExp_Explorer anExpP(thePath, TopAbs_EDGE);
+ TopTools_MapOfShape aMapFence;
+ const Standard_Integer anIdSide =
+ (i == 0 ? GROUP_SIDE1 : GROUP_SIDE2);
+
+ for (; anExpP.More(); anExpP.Next()) {
+ const TopoDS_Shape aSideShape =
+ theSweep.Generated(anExpP.Current(), aV[i]);
+
+ if (aSideShape.ShapeType() == TopAbs_EDGE) {
+ if (aMapFence.Add(aSideShape)) {
+ theGroups[anIdSide].Append(aSideShape);
+ }
+ } else {
+ // Only edges can be is Side1 and Side2 groups.
+ return false;
+ }
+ }
+ }
+ }
+ } else {
+ // Create Other group. Get boudnary edges of the profile.
+ TopTools_MapOfShape aMapBndEdges;
+ TopExp_Explorer anExp(theProfile, TopAbs_EDGE);
+
+ for (; anExp.More(); anExp.Next()) {
+ const TopoDS_Shape &anEdge = anExp.Current();
+
+ if (!aMapBndEdges.Add(anEdge)) {
+ aMapBndEdges.Remove(anEdge);
+ }
+ }
+
+ TopExp_Explorer anExpP(thePath, TopAbs_EDGE);
+ TopTools_MapOfShape aMapFence;
+
+ for (; anExpP.More(); anExpP.Next()) {
+ TopTools_MapIteratorOfMapOfShape anIter(aMapBndEdges);
+
+ for (; anIter.More(); anIter.Next()) {
+ const TopoDS_Shape anOtherShape =
+ theSweep.Generated(anExpP.Current(), anIter.Key());
+
+ if (anOtherShape.ShapeType() == TopAbs_FACE) {
+ if (aMapFence.Add(anOtherShape)) {
+ theGroups[GROUP_OTHER].Append(anOtherShape);
+ }
+ } else {
+ // Only faces can be in Other group.
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+//=======================================================================
+//function : CreateGroups
+//purpose : auxilary for Execute()
+//=======================================================================
+static bool CreateGroups(const TopoDS_Shape &theProfile,
+ const TopoDS_Shape &thePath,
+ BRepOffsetAPI_MakePipe &theSweep,
+ GEOMImpl_IPipe *theCI)
+{
+ if (!theCI->GetGenerateGroups()) {
+ // Nothing to do.
+ return true;
+ }
+
+ // Make groups.
+ TopTools_SequenceOfShape aGroups[5];
+
+ if (!DoGroups(theProfile, thePath, theSweep, aGroups)) {
+ return false;
+ }
+
+ // Fill the groups.
+ Handle(TColStd_HArray1OfInteger) aGroupIds[5];
+ TopTools_IndexedMapOfShape anIndices;
+ const TopoDS_Shape aResult = theSweep.Shape();
+
+ TopExp::MapShapes(aResult, anIndices);
+
+ if (!FillGroups(aGroups, anIndices, aGroupIds)) {
+ return false;
+ }
+
+ // Store groups.
+ StoreGroups(theCI, aGroupIds);
+
+ return true;
+}
+
//=======================================================================
//function : Execute
//purpose :
if (aCI) delete aCI;
Standard_TypeMismatch::Raise("MakePipe aborted : path shape is neither a wire nor an edge");
}
+
+ // Check if it is possible to create groups.
+ if (aCI->GetGenerateGroups() && !GEOMUtils::IsOpenPath(aWirePath)) {
+ if (aCI) {
+ delete aCI;
+ }
+
+ Standard_ConstructionError::Raise
+ ("Can't create groups if the path is closed");
+ }
}
- TopoDS_Shape aShape;
+ TopoDS_Shape aShape;
+ const Standard_Boolean isGenerateGroups = aCI->GetGenerateGroups();
if (aType == PIPE_BASE_PATH) {
Handle(GEOM_Function) aRefBase = aCI->GetBase();
}
else
aShape = Sweep.Shape(); //result is good
-
+
+ if (!CreateGroups(Sweep, aCI)) {
+ if (aCI) delete aCI;
+ Standard_ConstructionError::Raise("Generate groups failure");
+ }
}
else
{
GeomFill_Trihedron theBestMode = EvaluateBestSweepMode(aWirePath);
BRepOffsetAPI_MakePipe aMkPipe(aWirePath, aShapeBase, theBestMode);
- if (aMkPipe.IsDone()) {
+ if (aMkPipe.IsDone() && aMkPipe.ErrorOnSurface() <= TolPipeSurf) {
aShape = aMkPipe.Shape();
+
+ if (!CreateGroups(aShapeBase, aWirePath, aMkPipe, aCI)) {
+ if (aCI) delete aCI;
+ Standard_ConstructionError::Raise("Generate groups failure");
+ }
} else if (theBestMode != GeomFill_IsDiscreteTrihedron) {
// Try to use Descrete Trihedron mode.
BRepOffsetAPI_MakePipe aMkPipeDescrete
if (aMkPipeDescrete.IsDone()) {
aShape = aMkPipeDescrete.Shape();
+
+ if (!CreateGroups(aShapeBase, aWirePath, aMkPipeDescrete, aCI)) {
+ if (aCI) delete aCI;
+ Standard_ConstructionError::Raise("Generate groups failure");
+ }
}
}
}
Handle(TColStd_HSequenceOfTransient) aLocObjs = aCIDS->GetLocations ();
Standard_Boolean aWithContact = (aCIDS->GetWithContactMode());
Standard_Boolean aWithCorrect = (aCIDS->GetWithCorrectionMode());
+ Standard_Boolean isBySteps = aCIDS->GetIsBySteps();
+
if (aCI) {
delete aCI;
aCI = 0;
aHSeqLocs->Append(aShapeLoc);
}
- aShape = CreatePipeWithDifferentSections(aWirePath, aHSeqBases, aHSeqLocs, aWithContact, aWithCorrect);
+
+ Handle(TColStd_HArray1OfInteger) *pGroups = NULL;
+ Handle(TColStd_HArray1OfInteger) aGroups[5];
+
+ if (isGenerateGroups) {
+ pGroups = aGroups;
+ }
+
+ aShape = CreatePipeWithDifferentSections
+ (aWirePath, aHSeqBases, aHSeqLocs,
+ aWithContact, aWithCorrect, isBySteps, pGroups);
+
+ if (isGenerateGroups) {
+ // Store created groups.
+ GEOMImpl_IPipeDiffSect aPipeDS(aFunction);
+
+ StoreGroups(&aPipeDS, aGroups);
+ }
}
//building pipe with shell sections
if (aShape.IsNull()) return 0;
- BRepCheck_Analyzer ana (aShape, Standard_False);
- if (!ana.IsValid()) {
- ShapeFix_ShapeTolerance aSFT;
- aSFT.LimitTolerance(aShape,Precision::Confusion(),Precision::Confusion());
- Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
- aSfs->SetPrecision(Precision::Confusion());
- aSfs->Perform();
- aShape = aSfs->Shape();
-
- ana.Init(aShape, Standard_False);
- if (!ana.IsValid())
- Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
- }
+ if ( !GEOMUtils::CheckShape(aShape) && !GEOMUtils::FixShapeTolerance(aShape) )
+ Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
if (aType != PIPE_BASE_PATH &&
aType != PIPE_SHELLS_WITHOUT_PATH) {
aVertMaxTol = aTol;
}
aVertMaxTol += Precision::Confusion();
- aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, aVertMaxTol, Standard_True);
- //aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, Precision::Confusion(), Standard_True);
+
+ TopTools_DataMapOfShapeListOfShape aMapModif;
+ TopTools_DataMapOfShapeListOfShape *pMapModif = NULL;
+
+ if (isGenerateGroups) {
+ pMapModif = &aMapModif;
+ }
+
+ TopoDS_Shape aNewShape = GEOMImpl_GlueDriver::GlueFaces
+ (aShape, aVertMaxTol, Standard_True, pMapModif);
+
+ if (isGenerateGroups && !aMapModif.IsEmpty()) {
+ // Update groups.
+ GEOMImpl_IPipe aCI(aFunction);
+ Handle(TColStd_HArray1OfInteger) aGroupIDs[5] =
+ { aCI.GetGroupDown(), aCI.GetGroupUp(), aCI.GetGroupSide1(),
+ aCI.GetGroupSide2(), aCI.GetGroupOther() };
+ TopTools_IndexedMapOfShape anIndices;
+ TopTools_IndexedMapOfShape aNewIndices;
+ TopTools_SequenceOfShape aNewShapes[5];
+ TopTools_MapOfShape aMapReplaced;
+ TopTools_MapOfShape aMapGlued;
+ Standard_Integer iGrp;
+ Standard_Integer i;
+
+ TopExp::MapShapes(aShape, anIndices);
+ TopExp::MapShapes(aNewShape, aNewIndices);
+
+ for (iGrp = 0; iGrp < 5; ++iGrp) {
+ if (aGroupIDs[iGrp].IsNull() == Standard_False) {
+ const Standard_Integer aLower = aGroupIDs[iGrp]->Lower();
+ const Standard_Integer anUpper = aGroupIDs[iGrp]->Upper();
+
+ for (i = aLower; i <= anUpper; ++i) {
+ const Standard_Integer anIndex = aGroupIDs[iGrp]->Value(i);
+ const TopoDS_Shape &aSubShape = anIndices.FindKey(anIndex);
+
+ if (aMapModif.IsBound(aSubShape)) {
+ const TopTools_ListOfShape &aListModif =
+ aMapModif.Find(aSubShape);
+ TopTools_ListIteratorOfListOfShape anIter(aListModif);
+
+ for (; anIter.More(); anIter.Next()) {
+ const TopoDS_Shape &aNewShape = anIter.Value();
+
+ if (aMapReplaced.Add(aNewShape)) {
+ aNewShapes[iGrp].Append(aNewShape);
+ } else {
+ // This is a glued shape. It means that it is internal
+ // one and should be removed from groups later.
+ aMapGlued.Add(aNewShape);
+ }
+ }
+ } else {
+ // Shape is not modified.
+ aNewShapes[iGrp].Append(aSubShape);
+ }
+ }
+ }
+ }
+
+ if (!aMapGlued.IsEmpty()) {
+ // Remove glued (internal) shapes from groups.
+ for (iGrp = 0; iGrp < 5; ++iGrp) {
+ Standard_Integer aNbShapes = aNewShapes[iGrp].Length();
+
+ for (i = 1; i < aNbShapes; ++i) {
+ const TopoDS_Shape &aNewShape = aNewShapes[iGrp].Value(i);
+
+ if (aMapGlued.Contains(aNewShape)) {
+ aNewShapes[iGrp].Remove(i);
+ --i;
+ --aNbShapes;
+ }
+ }
+ }
+ }
+
+ // Store modified groups.
+ Handle(TColStd_HArray1OfInteger) aNewGroupIDs[5];
+
+ if (!FillGroups(aNewShapes, aNewIndices, aNewGroupIDs)) {
+ Standard_ConstructionError::Raise("Generate groups failure");
+ }
+
+ StoreGroups(&aCI, aNewGroupIDs);
+ }
+
+ aShape = aNewShape;
}
}
+ // Note: group indices should not be changed after the next call.
TopoDS_Shape aRes = GEOMUtils::CompsolidToCompound(aShape);
aFunction->SetValue(aRes);
AddParam( theParams, "Bases", aCI.GetBases() );
AddParam( theParams, "Locations", aCI.GetLocations() );
AddParam( theParams, "Path", aCI.GetPath() );
- AddParam( theParams, "With contact", aCI.GetWithContactMode() );
- AddParam( theParams, "With correction", aCI.GetWithCorrectionMode() );
+
+ if (!aCI.GetIsBySteps()) {
+ AddParam( theParams, "With contact", aCI.GetWithContactMode() );
+ AddParam( theParams, "With correction", aCI.GetWithCorrectionMode() );
+ }
+
+ AddParam( theParams, "Step by step", aCI.GetIsBySteps() );
break;
}
case PIPE_SHELL_SECTIONS:
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
Standard_EXPORT ~GEOMImpl_PipeDriver() {};
Standard_EXPORT static TopoDS_Shape CreatePipeWithDifferentSections
- (const TopoDS_Wire& theWirePath,
- const Handle(TopTools_HSequenceOfShape) theBases,
- const Handle(TopTools_HSequenceOfShape) theLocs,
- const Standard_Boolean theWithContact,
- const Standard_Boolean theWithCorrect);
+ (const TopoDS_Wire &theWirePath,
+ const Handle(TopTools_HSequenceOfShape) theBases,
+ const Handle(TopTools_HSequenceOfShape) theLocs,
+ const Standard_Boolean theWithContact,
+ const Standard_Boolean theWithCorrect,
+ const Standard_Boolean IsBySteps,
+ Handle(TColStd_HArray1OfInteger) *theGroups = NULL);
Standard_EXPORT virtual
bool GetCreationInformation(std::string& theOperationName,
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <Standard_Stream.hxx>
-
-#include <Basics_OCCTVersion.hxx>
-
#include <GEOMImpl_PipePathDriver.hxx>
-
-#include <GEOMImpl_IShapesOperations.hxx>
#include <GEOMImpl_ShapeDriver.hxx>
#include <GEOMImpl_IPipePath.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
-#include <ShapeAnalysis_FreeBounds.hxx>
-#include <ShapeAnalysis_Edge.hxx>
-#include <ShapeFix_Face.hxx>
-#include <ShapeFix_Shell.hxx>
-#include <ShapeFix_Shape.hxx>
-#include <ShapeFix_ShapeTolerance.hxx>
-
-#include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepBuilderAPI_Copy.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <BRepBuilderAPI_MakeWire.hxx>
-#include <BRepBuilderAPI_Sewing.hxx>
-#include <BRepCheck_Analyzer.hxx>
-#include <BRepGProp.hxx>
-#include <BRepOffsetAPI_MakePipe.hxx>
-#include <BRepOffsetAPI_MakePipeShell.hxx>
-
#include <BRepOffsetAPI_MiddlePath.hxx>
-
-#include <TopAbs.hxx>
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Solid.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopTools_SequenceOfShape.hxx>
-#include <TopTools_HSequenceOfShape.hxx>
-#include <TopTools_IndexedDataMapOfShapeShape.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-
-#include <GProp_GProps.hxx>
-
-#include <GeomAPI_ProjectPointOnCurve.hxx>
-#include <GeomAPI_Interpolate.hxx>
-#include <Geom_TrimmedCurve.hxx>
-#include <Geom_Plane.hxx>
-#include <Geom_RectangularTrimmedSurface.hxx>
-#include <Geom_BezierSurface.hxx>
-#include <Geom_Line.hxx>
-#include <Geom_Conic.hxx>
-#include <Geom_BSplineCurve.hxx>
-#include <Geom_BSplineSurface.hxx>
-#include <GeomFill_BSplineCurves.hxx>
-#include <GeomConvert_ApproxCurve.hxx>
-#include <GeomConvert.hxx>
-
-#include <TColgp_SequenceOfPnt.hxx>
-#include <TColgp_HArray1OfPnt.hxx>
-#include <TColgp_Array2OfPnt.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
-
#include <Precision.hxx>
-
#include <Standard_NullObject.hxx>
-#include <Standard_TypeMismatch.hxx>
-#include <Standard_ConstructionError.hxx>
-
-#include "utilities.h"
//=======================================================================
//function : GetID
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
Standard_Real aFP, aLP, aP;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), aFP, aLP);
if ( !aCurve.IsNull() ) {
- aP = aFP + (aLP - aFP) * aPI.GetParameter();
+ if (aPI.GetTakeOrientationIntoAccount() &&
+ aRefShape.Orientation() == TopAbs_REVERSED) {
+ aP = 1. - aPI.GetParameter();
+ } else {
+ aP = aPI.GetParameter();
+ }
+
+ aP = aFP + (aLP - aFP) * aP;
aPnt = aCurve->Value(aP);
}
else {
case POINT_CURVE_PAR:
AddParam( theParams, "Edge", aCI.GetCurve() );
AddParam( theParams, "Parameter", aCI.GetParameter() );
+ AddParam( theParams, "Use Orientation", aCI.GetTakeOrientationIntoAccount() );
break;
case POINT_CURVE_COORD:
AddParam( theParams, "X", aCI.GetX() );
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
}
}
- char *aSeparator = "\n\t";
+ const char *aSeparator = "\n\t";
Standard_Integer i;
std::list <std::list <double> >::const_iterator anIt = myCoords.begin();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
Standard_Real aHeight = aCI.GetH(); // Height of the extrusion
Standard_Real anAngle = aCI.GetDraftAngle(); // Draft angle
Standard_Boolean isProtrusion = (aCI.GetFuseFlag()==1);
+ Standard_Boolean isInvert = aCI.GetInvertFlag();
// Flag to know wether the feature is a protrusion (fuse) or a depression (cut)
// history of the Base wire (RefBase)
if(!aSuppObj.IsNull()) // If the wire has a support
aSupport = aSuppObj->GetValue();
- aShape = MakeDraftPrism(anInitShape, aSketch, aHeight, anAngle, isProtrusion, aSupport);
+ aShape = MakeDraftPrism(anInitShape, aSketch, aHeight, anAngle, isProtrusion, aSupport, isInvert);
}
if (aShape.IsNull()) return 0;
aLocs->Append(aShapeCDG_1);
aLocs->Append(aShapeCDG_2);
- aShape = GEOMImpl_PipeDriver::CreatePipeWithDifferentSections(aWirePath, aBases, aLocs, false, false);
+ aShape = GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
+ (aWirePath, aBases, aLocs, false, false, false);
// 7. Make a solid, if possible
if (theShapeBase.ShapeType() == TopAbs_FACE) {
const Standard_Real theHeight,
const Standard_Real theAngle,
bool isProtrusion,
- const TopoDS_Shape& theSupport)
+ const TopoDS_Shape& theSupport,
+ bool isInvert)
{
TopoDS_Shape aShape;
}
// Invert height and angle if the operation is an extruded cut
- bool invert = !isProtrusion;
+ bool invert = isInvert? isProtrusion : !isProtrusion;
// If the face has a reversed orientation invert for extruded boss operations
if(aFaceBase.Orientation() == TopAbs_REVERSED)
- invert = isProtrusion;
+ invert = !invert;
Standard_Real anAngle = theAngle;
Standard_Real aHeight = theHeight;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
const Standard_Real theHeight,
const Standard_Real theAngle,
bool isProtrusion,
- const TopoDS_Shape& theSupport);
+ const TopoDS_Shape& theSupport,
+ bool isInvert = false);
Standard_EXPORT virtual
bool GetCreationInformation(std::string& theOperationName,
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GEOMImpl_IMirror.hxx>
#include <GEOMImpl_IProjection.hxx>
+#include <GEOMImpl_IProjOnCyl.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
+#include <GEOMUtils.hxx>
+#include <GEOMUtils_HTrsfCurve2d.hxx>
+#include <Approx_Curve2d.hxx>
+#include <Bnd_Box2d.hxx>
+#include <BndLib_Add2dCurve.hxx>
#include <BRep_Tool.hxx>
+#include <BRepAdaptor_Curve2d.hxx>
#include <BRepBuilderAPI_Transform.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
+#include <BRepLib.hxx>
#include <BRepOffsetAPI_NormalProjection.hxx>
#include <BRepTools.hxx>
+#include <BRepTools_WireExplorer.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <Geom_Curve.hxx>
+#include <Geom_CylindricalSurface.hxx>
#include <Geom_Plane.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
#include <gp_Trsf.hxx>
#include <gp_Pnt.hxx>
if (!hasValidSolution) {
Standard_ConstructionError::Raise("Projection aborted : no projection");
}
+ } else if (aType == PROJECTION_ON_CYLINDER) {
+ GEOMImpl_IProjOnCyl aProj (aFunction);
+ Handle(GEOM_Function) aShapeFunction = aProj.GetShape();
+
+ if (aShapeFunction.IsNull()) {
+ return 0;
+ }
+
+ TopoDS_Shape aShape = aShapeFunction->GetValue();
+
+ if (aShape.IsNull()) {
+ return 0;
+ }
+
+ // Get the face.
+ const TopAbs_ShapeEnum aType = aShape.ShapeType();
+ const Standard_Real aRadius = aProj.GetRadius();
+ const Standard_Real aStartAngle = aProj.GetStartAngle();
+ const Standard_Real aLengthAngle = aProj.GetAngleLength();
+ const Standard_Real aRotationAngle = aProj.GetAngleRotation();
+
+ if (aType != TopAbs_WIRE && aType != TopAbs_FACE) {
+ return 0;
+ }
+
+ if (aRadius <= Precision::Confusion()) {
+ return 0;
+ }
+
+ TopoDS_Shape aProjShape = projectOnCylinder
+ (aShape, aRadius, aStartAngle, aLengthAngle, aRotationAngle);
+
+ if (aProjShape.IsNull()) {
+ return 0;
+ }
+
+ aFunction->SetValue(aProjShape);
}
return 1;
switch ( aType ) {
case PROJECTION_COPY:
- {
- GEOMImpl_IMirror aCI( function );
+ {
+ GEOMImpl_IMirror aCI( function );
- AddParam( theParams, "Source object", aCI.GetOriginal() );
- AddParam( theParams, "Target face", aCI.GetPlane() );
- break;
- }
+ AddParam( theParams, "Source object", aCI.GetOriginal() );
+ AddParam( theParams, "Target face", aCI.GetPlane() );
+ break;
+ }
case PROJECTION_ON_WIRE:
- {
- GEOMImpl_IProjection aProj (function);
+ {
+ GEOMImpl_IProjection aProj (function);
+
+ AddParam(theParams, "Point", aProj.GetPoint());
+ AddParam(theParams, "Shape", aProj.GetShape());
- AddParam(theParams, "Point", aProj.GetPoint());
- AddParam(theParams, "Shape", aProj.GetShape());
+ break;
+ }
+ case PROJECTION_ON_CYLINDER:
+ {
+ theOperationName = "PROJ_ON_CYL";
+
+ GEOMImpl_IProjOnCyl aProj (function);
+ const Standard_Real aLengthAngle = aProj.GetAngleLength();
- break;
+ AddParam(theParams, "Shape", aProj.GetShape());
+ AddParam(theParams, "Radius", aProj.GetRadius());
+ AddParam(theParams, "Start angle", aProj.GetStartAngle());
+
+ if (aLengthAngle >= 0.) {
+ AddParam(theParams, "Length angle", aLengthAngle);
}
+
+ AddParam(theParams, "Rotation angle", aProj.GetAngleRotation());
+
+ break;
+ }
default:
return false;
}
-
+
return true;
}
+//================================================================================
+/*!
+ * \brief Performs projection of a planar wire or a face on a cylinder.
+ */
+//================================================================================
+
+TopoDS_Shape GEOMImpl_ProjectionDriver::projectOnCylinder
+ (const TopoDS_Shape &theShape,
+ const Standard_Real theRadius,
+ const Standard_Real theStartAngle,
+ const Standard_Real theAngleLength,
+ const Standard_Real theAngleRotation) const
+{
+ TopoDS_Shape aResult;
+
+ // Get the face.
+ const TopAbs_ShapeEnum aType = theShape.ShapeType();
+ TopoDS_Face aFace;
+
+ if (aType == TopAbs_WIRE) {
+ // Try to create a planar face.
+ TopoDS_Wire aWire = TopoDS::Wire(theShape);
+ BRepBuilderAPI_MakeFace aMkFace(aWire, Standard_True);
+
+ if (aMkFace.IsDone()) {
+ aFace = aMkFace.Face();
+ } else {
+ // Check if the wire is a straight line.
+ TopExp_Explorer anEExp(aWire, TopAbs_EDGE);
+ TopoDS_Edge anEdge;
+
+ for (; anEExp.More(); anEExp.Next()) {
+ anEdge = TopoDS::Edge(anEExp.Current());
+
+ if (!BRep_Tool::Degenerated(anEdge)) {
+ break;
+ }
+ }
+
+ if (anEExp.More()) {
+ // Not degenerated edge found. Try to create a plane.
+ Standard_Real aPar[2];
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aPar[0], aPar[1]);
+ gp_Pnt aP0 = aCurve->Value(aPar[0]);
+ gp_Pnt aP1 = aCurve->Value(0.5*(aPar[1] + aPar[0]));
+ gp_Vec aX(aP1.XYZ().Subtracted(aP0.XYZ()));
+ Standard_Real aTolConf = Precision::Confusion();
+
+ if (aX.Magnitude() > aTolConf) {
+ aX.Normalize();
+
+ // Get the plane normal ortogonal to Z axis.
+ gp_Vec aZ(0., 0., 1.);
+ gp_Vec aN = aX.Crossed(aZ);
+
+ if (aN.Magnitude() <= aTolConf) {
+ // aX is parallel to aZ. Get the plane normal ortogonal to Y axis.
+ gp_Vec aY(0., 1., 0.);
+
+ aN = aX.Crossed(aY);
+ }
+
+ if (aN.Magnitude() > aTolConf) {
+ gp_Ax3 anAxis(aP0, gp_Dir(aN), gp_Dir(aX));
+ Handle(Geom_Plane) aPlane = new Geom_Plane(anAxis);
+ BRepBuilderAPI_MakeFace aMkFace(aPlane, aWire);
+
+ if (aMkFace.IsDone()) {
+ aFace = aMkFace.Face();
+ }
+ }
+ }
+ }
+ }
+ } else if (aType == TopAbs_FACE) {
+ aFace = TopoDS::Face(theShape);
+ }
+
+ if (aFace.IsNull()) {
+ return aResult;
+ }
+
+ // Compute 2d translation transformation.
+ TopoDS_Wire anOuterWire = BRepTools::OuterWire(aFace);
+ BRepTools_WireExplorer aOWExp(anOuterWire, aFace);
+
+ if (!aOWExp.More()) {
+ // NEVERREACHED
+ return aResult;
+ }
+
+ // Rotate 2D presentation of face.
+ TopoDS_Vertex aFirstVertex = aOWExp.CurrentVertex();
+ TopoDS_Edge aFirstEdge = aOWExp.Current();
+ gp_Pnt aPnt = BRep_Tool::Pnt(aFirstVertex);
+ BRepAdaptor_Curve2d anAdaptorCurve(aFirstEdge, aFace);
+ Standard_Real aParam =
+ BRep_Tool::Parameter(aFirstVertex, aFirstEdge, aFace);
+ gp_Pnt2d aPntUV;
+ gp_Vec2d aVecUV;
+ gp_Vec2d aVecU0(1., 0);
+
+ anAdaptorCurve.D1(aParam, aPntUV, aVecUV);
+
+ if (aVecUV.Magnitude() <= gp::Resolution()) {
+ return aResult;
+ }
+
+ if (aFirstEdge.Orientation() == TopAbs_REVERSED) {
+ aVecUV.Reverse();
+ }
+
+ const Standard_Real anAngle = aVecUV.Angle(aVecU0) + theAngleRotation;
+ const Standard_Boolean isToRotate = Abs(anAngle) > Precision::Angular();
+ gp_Trsf2d aRotTrsf;
+ Bnd_Box2d aUVBox;
+ Standard_Real aPar[2];
+
+ if (isToRotate) {
+ aRotTrsf.SetRotation(aPntUV, anAngle);
+ }
+
+ for (; aOWExp.More(); aOWExp.Next()) {
+ TopoDS_Edge anEdge = aOWExp.Current();
+ Handle(Geom2d_Curve) aCurve =
+ BRep_Tool::CurveOnSurface(anEdge, aFace, aPar[0], aPar[1]);
+
+ if (aCurve.IsNull()) {
+ continue;
+ }
+
+ if (isToRotate) {
+ aCurve = Handle(Geom2d_Curve)::DownCast(aCurve->Transformed(aRotTrsf));
+ }
+
+ BndLib_Add2dCurve::Add(aCurve, aPar[0], aPar[1], 0., aUVBox);
+ }
+
+ Standard_Real aU[2];
+ Standard_Real aV[2];
+
+ aUVBox.Get(aU[0], aV[0], aU[1], aV[1]);
+
+ // Compute anisotropic transformation from a face's 2d space
+ // to cylinder's 2d space.
+ GEOMUtils::Trsf2d aTrsf2d
+ (1./theRadius, 0., theStartAngle - aU[0]/theRadius,
+ 0., 1., aPnt.Z() - aPntUV.Y());
+
+ // Compute scaling trsf.
+ const Standard_Boolean isToScale = theAngleLength >= Precision::Angular();
+ gp_Trsf2d aScaleTrsf;
+
+ if (isToScale) {
+ // Perform 2d scaling.
+ gp_Pnt2d aMidPnt(0.5*(aU[1] + aU[0]), 0.5*(aV[1] + aV[0]));
+ const Standard_Real aScaleFactor = theAngleLength*theRadius/(aU[1] - aU[0]);
+
+ aTrsf2d.TransformD0(aMidPnt);
+
+ aScaleTrsf.SetScale(aMidPnt, aScaleFactor);
+ }
+
+ // Get 2d presentation of a face.
+ Handle(Geom_Surface) aCylinder =
+ new Geom_CylindricalSurface(gp_Ax3(), theRadius);
+ GeomAdaptor_Surface aGACyl(aCylinder);
+ TopExp_Explorer anExp(aFace, TopAbs_WIRE);
+ TopTools_ListOfShape aWires;
+ Standard_Real aUResol = aGACyl.UResolution(Precision::Confusion());
+ Standard_Real aVResol = aGACyl.VResolution(Precision::Confusion());
+
+ for (; anExp.More(); anExp.Next()) {
+ TopoDS_Wire aWire = TopoDS::Wire(anExp.Current());
+ BRepTools_WireExplorer aWExp(aWire, aFace);
+ BRepBuilderAPI_MakeWire aMkWire;
+
+ for (; aWExp.More(); aWExp.Next()) {
+ TopoDS_Edge anEdge = aWExp.Current();
+ Handle(Geom2d_Curve) aCurve =
+ BRep_Tool::CurveOnSurface(anEdge, aFace, aPar[0], aPar[1]);
+
+ if (aCurve.IsNull()) {
+ continue;
+ }
+
+ if (isToRotate) {
+ aCurve = Handle(Geom2d_Curve)::DownCast(aCurve->Transformed(aRotTrsf));
+ }
+
+ // Transform the curve to cylinder's parametric space.
+ GEOMUtils::Handle(HTrsfCurve2d) aTrsfCurve =
+ new GEOMUtils::HTrsfCurve2d(aCurve, aPar[0], aPar[1], aTrsf2d);
+ Approx_Curve2d aConv (aTrsfCurve, aPar[0], aPar[1],
+ aUResol, aVResol, GeomAbs_C1,
+ 9, 1000);
+
+ if (!aConv.IsDone() && !aConv.HasResult()) {
+ return aResult;
+ }
+
+ Handle(Geom2d_Curve) aCylCurve = aConv.Curve();
+
+ if (isToScale) {
+ aCylCurve->Transform(aScaleTrsf);
+ }
+
+ // Create edge and add it to the wire.
+ BRepBuilderAPI_MakeEdge aMkEdge(aCylCurve, aCylinder);
+
+ if (!aMkEdge.IsDone()) {
+ return aResult;
+ }
+
+ aMkWire.Add(aMkEdge.Edge());
+
+ if (!aMkWire.IsDone()) {
+ return aResult;
+ }
+ }
+
+ if (aWire.IsSame(anOuterWire)) {
+ // Make the outer wire first.
+ aWires.Prepend(aMkWire.Wire());
+ } else {
+ aWires.Append(aMkWire.Wire());
+ }
+ }
+
+ // Create a face.
+ if (aWires.IsEmpty()) {
+ return aResult;
+ }
+
+ TopTools_ListIteratorOfListOfShape aWIter(aWires);
+ TopoDS_Wire aWire = TopoDS::Wire(aWIter.Value());
+ BRepBuilderAPI_MakeFace aMkFace(aCylinder, aWire);
+
+ if (!aMkFace.IsDone()) {
+ return aResult;
+ }
+
+ for (aWIter.Next(); aWIter.More(); aWIter.Next()) {
+ aWire = TopoDS::Wire(aWIter.Value());
+ aMkFace.Add(aWire);
+
+ if (!aMkFace.IsDone()) {
+ return aResult;
+ }
+ }
+
+ // Build 3D curves.
+ TopoDS_Face aCylFace = aMkFace.Face();
+ TopoDS_Shape aResShape;
+
+ BRepLib::BuildCurves3d(aCylFace);
+
+ // Check shape.
+ if (aType == TopAbs_WIRE) {
+ TopExp_Explorer aResExp(aCylFace, TopAbs_WIRE);
+
+ if (aResExp.More()) {
+ aResShape = aResExp.Current();
+ }
+ } else {
+ aResShape = aCylFace;
+ }
+
+ if (aResShape.IsNull() == Standard_False) {
+ if (!GEOMUtils::CheckShape(aResShape, true)) {
+ if (!GEOMUtils::FixShapeTolerance(aResShape)) {
+ return aResult;
+ }
+ }
+
+ aResult = aResShape;
+ }
+
+ return aResult;
+}
+
IMPLEMENT_STANDARD_HANDLE (GEOMImpl_ProjectionDriver,GEOM_BaseDriver);
IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ProjectionDriver,GEOM_BaseDriver);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#endif
class TColStd_SequenceOfExtendedString;
+class TopoDS_Shape;
#include "GEOM_BaseDriver.hxx"
bool GetCreationInformation(std::string& theOperationName,
std::vector<GEOM_Param>& params);
+private:
+
+ TopoDS_Shape projectOnCylinder(const TopoDS_Shape &theShape,
+ const Standard_Real theRadius,
+ const Standard_Real theStartAngle,
+ const Standard_Real theAngleLength,
+ const Standard_Real theAngleRotation) const;
+
+public:
+
DEFINE_STANDARD_RTTI( GEOMImpl_ProjectionDriver )
};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <Standard_Stream.hxx>
-
#include <GEOMImpl_ScaleDriver.hxx>
#include <GEOMImpl_IScale.hxx>
#include <GEOMImpl_Types.hxx>
+#include <GEOMUtils.hxx>
#include <GEOM_Function.hxx>
-#include <ShapeFix_Shape.hxx>
-#include <ShapeFix_ShapeTolerance.hxx>
-
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepBuilderAPI_GTransform.hxx>
#include <BRep_Tool.hxx>
-#include <BRepAlgo.hxx>
-#include <BRepCheck_Analyzer.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
-#include <TopoDS_Vertex.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <Precision.hxx>
if (aShape.IsNull()) return 0;
- BRepCheck_Analyzer ana (aShape, Standard_False);
- if (!ana.IsValid()) {
- ShapeFix_ShapeTolerance aSFT;
- aSFT.LimitTolerance(aShape,Precision::Confusion(),Precision::Confusion());
- Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
- aSfs->SetPrecision(Precision::Confusion());
- aSfs->Perform();
- aShape = aSfs->Shape();
-
- ana.Init(aShape, Standard_False);
- if (!ana.IsValid())
- Standard_ConstructionError::Raise("Scaling aborted : algorithm has produced an invalid shape result");
- }
+ if ( !GEOMUtils::CheckShape(aShape) && !GEOMUtils::FixShapeTolerance(aShape) )
+ Standard_ConstructionError::Raise("Scaling aborted : algorithm has produced an invalid shape result");
aFunction->SetValue(aShape);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GEOMImpl_IIsoline.hxx>
#include <GEOMImpl_IShapes.hxx>
+#include <GEOMImpl_IShapeExtend.hxx>
#include <GEOMImpl_IVector.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOMImpl_Block6Explorer.hxx>
#include <GEOM_Function.hxx>
#include <GEOMUtils_Hatcher.hxx>
+#include <GEOMAlgo_State.hxx>
// OCCT Includes
#include <ShapeFix_Wire.hxx>
#include <BRepAlgo_FaceRestrictor.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepBuilderAPI_Sewing.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeSolid.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
+#include <TNaming_CopyShape.hxx>
+
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <Geom_TrimmedCurve.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_Surface.hxx>
#include <GeomAbs_CurveType.hxx>
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
#include <GeomConvert.hxx>
#include <GeomLProp.hxx>
+#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <Standard_TypeMismatch.hxx>
#include <Standard_ConstructionError.hxx>
-// Uncomment this definition to check if type of created shape is the same
-// as expected. For further details please see the Mantis issue
-// http://salome.mantis.opencascade.com/view.php?id=22674
-//#define RESULT_TYPE_CHECK
+#include <BOPAlgo_PaveFiller.hxx>
+#include <BOPAlgo_MakerVolume.hxx>
+
+#include <list>
+
+namespace
+{
+ // check that compound includes only shapes of expected type
+ bool checkCompound( TopoDS_Shape& c, TopAbs_ShapeEnum t )
+ {
+ TopoDS_Iterator it( c, Standard_True, Standard_True );
+
+ // empty compound is OK only if we explicitly create a compound of shapes
+ bool result = true;
+
+ // => if expected type is TopAbs_SHAPE, we allow compound consisting of any shapes, this above check is enough
+ // => otherwise we have to check compound's content
+ // => compound sometimes can contain enclosed compound(s), we process them recursively and rebuild initial compound
+
+ if ( t != TopAbs_SHAPE ) {
+ result = it.More();
+ std::list<TopoDS_Shape> compounds, shapes;
+ compounds.push_back( c );
+ while ( !compounds.empty() && result ) {
+ // check that compound contains only shapes of expected type
+ TopoDS_Shape cc = compounds.front();
+ compounds.pop_front();
+ it.Initialize( cc, Standard_True, Standard_True );
+ for ( ; it.More() && result; it.Next() ) {
+ TopAbs_ShapeEnum tt = it.Value().ShapeType();
+ if ( tt == TopAbs_COMPOUND || tt == TopAbs_COMPSOLID ) {
+ compounds.push_back( it.Value() );
+ continue;
+ }
+ shapes.push_back( it.Value() );
+ result = tt == t;
+ }
+ }
+ if ( result ) {
+ if ( shapes.empty() ) {
+ result = false;
+ }
+ else if ( shapes.size() == 1 ) {
+ c = shapes.front();
+ }
+ else {
+ BRep_Builder b;
+ TopoDS_Compound newc;
+ b.MakeCompound( newc );
+ std::list<TopoDS_Shape> ::const_iterator sit;
+ for ( sit = shapes.begin(); sit != shapes.end(); ++sit )
+ b.Add( newc, *sit );
+ c = newc;
+ }
+ }
+ }
+
+ return result;
+ }
+}
//modified by NIZNHY-PKV Wed Dec 28 13:48:20 2011f
//static
TopoDS_Shape aShape;
TCollection_AsciiString aWarning;
-#ifdef RESULT_TYPE_CHECK
+
+ // this is an exact type of expected shape, or shape in a compound if compound is allowed as a result (see below)
TopAbs_ShapeEnum anExpectedType = TopAbs_SHAPE;
-#endif
+ // this should be true if result can be a compound of shapes of strict type (see above)
+ bool allowCompound = false;
BRep_Builder B;
if (aType == WIRE_EDGES) {
-#ifdef RESULT_TYPE_CHECK
+ // result may be only a single wire
anExpectedType = TopAbs_WIRE;
-#endif
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
aShape = MakeWireFromEdges(aShapes, aTolerance);
}
else if (aType == FACE_WIRE) {
-#ifdef RESULT_TYPE_CHECK
+ // result may be a face or a compound of faces
anExpectedType = TopAbs_FACE;
-#endif
+ allowCompound = true;
Handle(GEOM_Function) aRefBase = aCI.GetBase();
TopoDS_Shape aShapeBase = aRefBase->GetValue();
Standard_NullObject::Raise
("Shape for face construction is not closed");
}
- else if (aShapeBase.ShapeType() == TopAbs_EDGE && aShapeBase.Closed()) {
+ else if (aShapeBase.ShapeType() == TopAbs_EDGE && BRep_Tool::IsClosed(aShapeBase)) {
BRepBuilderAPI_MakeWire MW;
MW.Add(TopoDS::Edge(aShapeBase));
if (!MW.IsDone()) {
}
}
else if (aType == FACE_WIRES) {
-#ifdef RESULT_TYPE_CHECK
+ // result may be a face or a compound of faces
anExpectedType = TopAbs_FACE;
-#endif
+ allowCompound = true;
// Try to build a face from a set of wires and edges
int ind;
// 1. Extract all edges from the given arguments
TopTools_MapOfShape aMapEdges;
Handle(TopTools_HSequenceOfShape) aSeqEdgesIn = new TopTools_HSequenceOfShape;
+ TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
for (ind = 1; ind <= nbshapes; ind++) {
Handle(GEOM_Function) aRefSh_i = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
TopExp_Explorer anExpE_i (aSh_i, TopAbs_EDGE);
for (; anExpE_i.More(); anExpE_i.Next()) {
if (aMapEdges.Add(anExpE_i.Current())) {
- aSeqEdgesIn->Append(anExpE_i.Current());
+ // Copy the original shape.
+ TopoDS_Shape aShapeCopy;
+
+ TNaming_CopyShape::CopyTool
+ (anExpE_i.Current(), aMapTShapes, aShapeCopy);
+ aSeqEdgesIn->Append(aShapeCopy);
}
}
}
+ if (aSeqEdgesIn->IsEmpty()) {
+ Standard_ConstructionError::Raise("No edges given");
+ }
+
// 2. Connect edges to wires of maximum length
Handle(TopTools_HSequenceOfShape) aSeqWiresOut;
ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdgesIn, Precision::Confusion(),
aShape = C;
}
}
+ else if (aType == FACE_FROM_SURFACE) {
+ // result may be only a face
+ anExpectedType = TopAbs_FACE;
+
+ Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
+
+ if (aShapes.IsNull() == Standard_False) {
+ Standard_Integer aNbShapes = aShapes->Length();
+
+ if (aNbShapes == 2) {
+ Handle(GEOM_Function) aRefFace =
+ Handle(GEOM_Function)::DownCast(aShapes->Value(1));
+ Handle(GEOM_Function) aRefWire =
+ Handle(GEOM_Function)::DownCast(aShapes->Value(2));
+
+ if (aRefFace.IsNull() == Standard_False &&
+ aRefWire.IsNull() == Standard_False) {
+ TopoDS_Shape aShFace = aRefFace->GetValue();
+ TopoDS_Shape aShWire = aRefWire->GetValue();
+
+ if (aShFace.IsNull() == Standard_False &&
+ aShFace.ShapeType() == TopAbs_FACE &&
+ aShWire.IsNull() == Standard_False &&
+ aShWire.ShapeType() == TopAbs_WIRE) {
+ TopoDS_Face aFace = TopoDS::Face(aShFace);
+ TopoDS_Wire aWire = TopoDS::Wire(aShWire);
+ Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
+ BRepBuilderAPI_MakeFace aMkFace(aSurf, aWire);
+
+ if (aMkFace.IsDone()) {
+ aShape = aMkFace.Shape();
+ }
+ }
+ }
+ }
+ }
+ }
else if (aType == SHELL_FACES) {
-#ifdef RESULT_TYPE_CHECK
+ // result may be only a shell or a compound of shells
anExpectedType = TopAbs_SHELL;
-#endif
+ allowCompound = true;
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
unsigned int ind, nbshapes = aShapes->Length();
}
}
- }
- else if (aType == SOLID_SHELL) {
-#ifdef RESULT_TYPE_CHECK
- anExpectedType = TopAbs_SOLID;
-#endif
-
- Handle(GEOM_Function) aRefShell = aCI.GetBase();
- TopoDS_Shape aShapeShell = aRefShell->GetValue();
- if (!aShapeShell.IsNull() && aShapeShell.ShapeType() == TopAbs_COMPOUND) {
- TopoDS_Iterator It (aShapeShell, Standard_True, Standard_True);
- if (It.More()) aShapeShell = It.Value();
- }
- if (aShapeShell.IsNull() || aShapeShell.ShapeType() != TopAbs_SHELL) {
- Standard_NullObject::Raise("Shape for solid construction is null or not a shell");
- }
-
- BRepCheck_Shell chkShell(TopoDS::Shell(aShapeShell));
- if (chkShell.Closed() == BRepCheck_NotClosed) return 0;
-
- TopoDS_Solid Sol;
- B.MakeSolid(Sol);
- B.Add(Sol, aShapeShell);
- BRepClass3d_SolidClassifier SC (Sol);
- SC.PerformInfinitePoint(Precision::Confusion());
- if (SC.State() == TopAbs_IN) {
- B.MakeSolid(Sol);
- B.Add(Sol, aShapeShell.Reversed());
- }
-
- aShape = Sol;
-
}
else if (aType == SOLID_SHELLS) {
-#ifdef RESULT_TYPE_CHECK
+ // result may be only a solid or a compound of solids
anExpectedType = TopAbs_SOLID;
-#endif
+ allowCompound = true;
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
unsigned int ind, nbshapes = aShapes->Length();
}
if (aShapeShell.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Iterator It (aShapeShell, Standard_True, Standard_True);
- if (It.More()) aShapeShell = It.Value();
+ for (; It.More(); It.Next()) {
+ TopoDS_Shape aSubShape = It.Value();
+ if (aSubShape.ShapeType() == TopAbs_SHELL) {
+ aMkSolid.Add(TopoDS::Shell(aSubShape));
+ ish++;
+ }
+ else
+ Standard_TypeMismatch::Raise
+ ("Shape for solid construction is neither a shell nor a compound of shells");
+ }
}
- if (aShapeShell.ShapeType() == TopAbs_SHELL) {
+ else if (aShapeShell.ShapeType() == TopAbs_SHELL) {
aMkSolid.Add(TopoDS::Shell(aShapeShell));
ish++;
}
aShape = Sol;
}
else if (aType == COMPOUND_SHAPES) {
-#ifdef RESULT_TYPE_CHECK
- anExpectedType = TopAbs_COMPOUND;
-#endif
+ // result may be only a compound of any shapes
+ allowCompound = true;
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
unsigned int ind, nbshapes = aShapes->Length();
aShape = C;
}
- /*
- else if (aType == REVERSE_ORIENTATION) {
- Handle(GEOM_Function) aRefShape = aCI.GetBase();
- TopoDS_Shape aShape_i = aRefShape->GetValue();
- if (aShape_i.IsNull()) {
- Standard_NullObject::Raise("Shape for reverse is null");
- }
-
- BRepBuilderAPI_Copy Copy(aShape_i);
- if( Copy.IsDone() ) {
- TopoDS_Shape tds = Copy.Shape();
- if( tds.IsNull() ) {
- Standard_ConstructionError::Raise("Orientation aborted : Can not reverse the shape");
- }
-
- if( tds.Orientation() == TopAbs_FORWARD)
- tds.Orientation(TopAbs_REVERSED);
- else
- tds.Orientation(TopAbs_FORWARD);
-
- aShape = tds;
- }
- }
- */
else if (aType == EDGE_WIRE) {
-#ifdef RESULT_TYPE_CHECK
+ // result may be only an edge
anExpectedType = TopAbs_EDGE;
-#endif
Handle(GEOM_Function) aRefBase = aCI.GetBase();
TopoDS_Shape aWire = aRefBase->GetValue();
aShape = MakeEdgeFromWire(aWire, LinTol, AngTol);
}
+ else if (aType == SOLID_FACES) {
+ // result may be only a solid or a compound of solids
+ anExpectedType = TopAbs_SOLID;
+ allowCompound = true;
+
+ Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
+ unsigned int ind, nbshapes = aShapes->Length();
+
+ // add faces
+ BOPCol_ListOfShape aLS;
+ for (ind = 1; ind <= nbshapes; ind++) {
+ Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
+ TopoDS_Shape aShape_i = aRefShape->GetValue();
+ if (aShape_i.IsNull()) {
+ Standard_NullObject::Raise("Shape for solid construction is null");
+ }
+ if (aShape_i.ShapeType() == TopAbs_COMPOUND) {
+ TopoDS_Iterator It (aShape_i, Standard_True, Standard_True);
+ for (; It.More(); It.Next()) {
+ TopoDS_Shape aSubShape = It.Value();
+ if (aSubShape.ShapeType() == TopAbs_FACE || aSubShape.ShapeType() == TopAbs_SHELL)
+ aLS.Append(aSubShape);
+ else
+ Standard_TypeMismatch::Raise
+ ("Shape for solid construction is neither a list of faces and/or shells "
+ "nor a compound of faces and/or shells");
+ }
+ }
+ aLS.Append(aShape_i);
+ }
+
+ BOPAlgo_MakerVolume aMV;
+ aMV.SetArguments(aLS);
+ aMV.SetIntersect(aCI.GetIsIntersect());
+ aMV.Perform();
+ if (aMV.ErrorStatus()) return 0;
+
+ aShape = aMV.Shape();
+ }
else if (aType == EDGE_CURVE_LENGTH) {
-#ifdef RESULT_TYPE_CHECK
+ // result may be only an edge
anExpectedType = TopAbs_EDGE;
-#endif
GEOMImpl_IVector aVI (aFunction);
BRepBuilderAPI_MakeEdge aME (ReOrientedCurve, UFirst, aParam);
if (aME.IsDone())
aShape = aME.Shape();
- } else if (aType == SHAPE_ISOLINE) {
-#ifdef RESULT_TYPE_CHECK
+ }
+ else if (aType == SHAPE_ISOLINE) {
+ // result may be only an edge or compound of edges
anExpectedType = TopAbs_EDGE;
-#endif
+ allowCompound = true;
GEOMImpl_IIsoline aII (aFunction);
Handle(GEOM_Function) aRefFace = aII.GetFace();
("Shape for isoline construction is not a face");
}
}
+ else if (aType == EDGE_UV) {
+ // result may be only an edge
+ anExpectedType = TopAbs_EDGE;
+
+ GEOMImpl_IShapeExtend aSE (aFunction);
+ Handle(GEOM_Function) aRefEdge = aSE.GetShape();
+ TopoDS_Shape aShapeEdge = aRefEdge->GetValue();
+
+ if (aShapeEdge.ShapeType() == TopAbs_EDGE) {
+ TopoDS_Edge anEdge = TopoDS::Edge(aShapeEdge);
+
+ aShape = ExtendEdge(anEdge, aSE.GetUMin(), aSE.GetUMax());
+ }
+ }
+ else if (aType == FACE_UV) {
+ // result may be only a face
+ anExpectedType = TopAbs_FACE;
+
+ GEOMImpl_IShapeExtend aSE (aFunction);
+ Handle(GEOM_Function) aRefFace = aSE.GetShape();
+ TopoDS_Shape aShapeFace = aRefFace->GetValue();
+
+ if (aShapeFace.ShapeType() == TopAbs_FACE) {
+ TopoDS_Face aFace = TopoDS::Face(aShapeFace);
+
+ aFace.Orientation(TopAbs_FORWARD);
+ aShape = ExtendFace(aFace, aSE.GetUMin(), aSE.GetUMax(),
+ aSE.GetVMin(), aSE.GetVMax());
+ }
+ }
+ else if (aType == SURFACE_FROM_FACE) {
+ // result may be only a face
+ anExpectedType = TopAbs_FACE;
+
+ GEOMImpl_IShapeExtend aSE (aFunction);
+ Handle(GEOM_Function) aRefFace = aSE.GetShape();
+ TopoDS_Shape aShapeFace = aRefFace->GetValue();
+
+ if (aShapeFace.ShapeType() == TopAbs_FACE) {
+ TopoDS_Face aFace = TopoDS::Face(aShapeFace);
+ Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace);
+
+ if (aSurface.IsNull() == Standard_False) {
+ Handle(Standard_Type) aType = aSurface->DynamicType();
+ Standard_Real aU1;
+ Standard_Real aU2;
+ Standard_Real aV1;
+ Standard_Real aV2;
+
+ // Get U, V bounds of the face.
+ aFace.Orientation(TopAbs_FORWARD);
+ ShapeAnalysis::GetFaceUVBounds(aFace, aU1, aU2, aV1, aV2);
+
+ // Get the surface of original type
+ while (aType == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
+ Handle(Geom_RectangularTrimmedSurface) aTrSurface =
+ Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface);
+
+ aSurface = aTrSurface->BasisSurface();
+ aType = aSurface->DynamicType();
+ }
+
+ const Standard_Real aTol = BRep_Tool::Tolerance(aFace);
+ BRepBuilderAPI_MakeFace aMF(aSurface, aU1, aU2, aV1, aV2, aTol);
+
+ if (aMF.IsDone()) {
+ aShape = aMF.Shape();
+ }
+ }
+ }
+ }
else {
}
if (aShape.IsNull()) return 0;
// Check shape validity
- BRepCheck_Analyzer ana (aShape, false);
+ BRepCheck_Analyzer ana (aShape, true);
if (!ana.IsValid()) {
//Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
// For Mantis issue 0021772: EDF 2336 GEOM: Non valid face created from two circles
aShape = aSfs->Shape();
}
-#ifdef RESULT_TYPE_CHECK
- // Check if the result shape type is compatible with the expected.
+ // Check if the result shape is of expected type.
const TopAbs_ShapeEnum aShType = aShape.ShapeType();
- if (anExpectedType != TopAbs_SHAPE && anExpectedType != aShType) {
- if (aShType == TopAbs_COMPOUND) {
- // The result is compound. Check its sub-shapes.
- TopoDS_Iterator anIter(aShape);
-
- if (!anIter.More()) {
- // The result is an empty compound.
- Standard_ConstructionError::Raise("Result type check failed");
- }
-
- for (; anIter.More(); anIter.Next()) {
- const TopAbs_ShapeEnum aSubType = anIter.Value().ShapeType();
-
- if (anExpectedType != aSubType) {
- // There is an incompatible type.
- Standard_ConstructionError::Raise("Result type check failed");
- }
- }
- } else {
- // There is an incompatible type.
- Standard_ConstructionError::Raise("Result type check failed");
- }
+ bool ok = false;
+ if ( aShType == TopAbs_COMPOUND || aShType == TopAbs_COMPSOLID ) {
+ ok = allowCompound && checkCompound( aShape, anExpectedType );
}
-#endif
+ else {
+ ok = ( anExpectedType == TopAbs_SHAPE ) || ( aShType == anExpectedType );
+ }
+ if (!ok)
+ Standard_ConstructionError::Raise("Result type check failed");
aFunction->SetValue(aShape);
TColStd_SequenceOfReal TolSeq;
GeomAbs_CurveType CurType;
TopoDS_Vertex FirstVertex, LastVertex;
+ Standard_Real aPntShiftDist = 0.;
BRepTools_WireExplorer wexp(theWire) ;
for (; wexp.More(); wexp.Next())
{
Standard_Boolean Done = Standard_False;
Standard_Real NewFpar, NewLpar;
- GeomAdaptor_Curve GAprevcurve(CurveSeq.Last());
+ Handle(Geom_Geometry) aTrsfGeom = CurveSeq.Last()->Transformed
+ (LocSeq.Last().Location().Transformation());
+ GeomAdaptor_Curve GAprevcurve(Handle(Geom_Curve)::DownCast(aTrsfGeom));
TopoDS_Vertex CurVertex = wexp.CurrentVertex();
TopoDS_Vertex CurFirstVer = TopExp::FirstVertex(anEdge);
TopAbs_Orientation ConnectByOrigin = (CurVertex.IsSame(CurFirstVer))? TopAbs_FORWARD : TopAbs_REVERSED;
- if (aCurve == CurveSeq.Last())
+ if (aCurve == CurveSeq.Last() && aLoc.IsEqual(LocSeq.Last().Location()))
{
NewFpar = fpar;
NewLpar = lpar;
gp_Pnt P2 = ElCLib::Value(lpar, aLine);
NewFpar = ElCLib::Parameter(PrevLine, P1);
NewLpar = ElCLib::Parameter(PrevLine, P2);
+
+ // Compute shift
+ if (ConnectByOrigin == TopAbs_FORWARD) {
+ gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevLine);
+
+ aPntShiftDist += P2.Distance(aNewP2);
+ } else {
+ gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevLine);
+
+ aPntShiftDist += P1.Distance(aNewP1);
+ }
+
if (NewLpar < NewFpar)
{
Standard_Real MemNewFpar = NewFpar;
Abs(aCircle.Radius() - PrevCircle.Radius()) <= LinTol &&
aCircle.Axis().IsParallel(PrevCircle.Axis(), AngTol))
{
+ const Standard_Boolean isFwd = ConnectByOrigin == TopAbs_FORWARD;
+
if (aCircle.Axis().Direction() * PrevCircle.Axis().Direction() < 0.)
{
Standard_Real memfpar = fpar;
gp_Pnt P2 = ElCLib::Value(lpar, aCircle);
NewFpar = ElCLib::Parameter(PrevCircle, P1);
NewLpar = ElCLib::Parameter(PrevCircle, P2);
+
+ // Compute shift
+ if (isFwd) {
+ gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevCircle);
+
+ aPntShiftDist += P2.Distance(aNewP2);
+ } else {
+ gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevCircle);
+
+ aPntShiftDist += P1.Distance(aNewP1);
+ }
+
if (NewLpar < NewFpar)
NewLpar += 2.*M_PI;
//Standard_Real MemNewFpar = NewFpar, MemNewLpar = NewLpar;
Abs(anEllipse.MinorRadius() - PrevEllipse.MinorRadius()) <= LinTol &&
anEllipse.Axis().IsParallel(PrevEllipse.Axis(), AngTol))
{
+ const Standard_Boolean isFwd = ConnectByOrigin == TopAbs_FORWARD;
+
if (anEllipse.Axis().Direction() * PrevEllipse.Axis().Direction() < 0.)
{
Standard_Real memfpar = fpar;
gp_Pnt P2 = ElCLib::Value(lpar, anEllipse);
NewFpar = ElCLib::Parameter(PrevEllipse, P1);
NewLpar = ElCLib::Parameter(PrevEllipse, P2);
+
+ // Compute shift
+ if (isFwd) {
+ gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevEllipse);
+
+ aPntShiftDist += P2.Distance(aNewP2);
+ } else {
+ gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevEllipse);
+
+ aPntShiftDist += P1.Distance(aNewP1);
+ }
+
if (NewLpar < NewFpar)
NewLpar += 2.*M_PI;
if (ConnectByOrigin == TopAbs_FORWARD)
gp_Pnt P2 = ElCLib::Value(lpar, aHypr);
NewFpar = ElCLib::Parameter(PrevHypr, P1);
NewLpar = ElCLib::Parameter(PrevHypr, P2);
+
+ // Compute shift
+ if (ConnectByOrigin == TopAbs_FORWARD) {
+ gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevHypr);
+
+ aPntShiftDist += P2.Distance(aNewP2);
+ } else {
+ gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevHypr);
+
+ aPntShiftDist += P1.Distance(aNewP1);
+ }
+
if (NewLpar < NewFpar)
{
Standard_Real MemNewFpar = NewFpar;
gp_Pnt P2 = ElCLib::Value(lpar, aParab);
NewFpar = ElCLib::Parameter(PrevParab, P1);
NewLpar = ElCLib::Parameter(PrevParab, P2);
+
+ // Compute shift
+ if (ConnectByOrigin == TopAbs_FORWARD) {
+ gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevParab);
+
+ aPntShiftDist += P2.Distance(aNewP2);
+ } else {
+ gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevParab);
+
+ aPntShiftDist += P1.Distance(aNewP1);
+ }
+
if (NewLpar < NewFpar)
{
Standard_Real MemNewFpar = NewFpar;
LocSeq.Append(aLocShape);
FparSeq.Append(fpar);
LparSeq.Append(lpar);
- TolSeq.Append(BRep_Tool::Tolerance(CurVertex));
+ TolSeq.Append(aPntShiftDist + BRep_Tool::Tolerance(CurVertex));
+ aPntShiftDist = 0.;
CurType = aType;
}
} // end of else (CurveSeq.IsEmpty()) -> not first time
} // end for (; wexp.More(); wexp.Next())
LastVertex = wexp.CurrentVertex();
- TolSeq.Append(BRep_Tool::Tolerance(LastVertex));
+ TolSeq.Append(aPntShiftDist + BRep_Tool::Tolerance(LastVertex));
FirstVertex.Orientation(TopAbs_FORWARD);
LastVertex.Orientation(TopAbs_REVERSED);
return aResult;
}
+//=============================================================================
+/*!
+ * \brief Returns an extended edge.
+ */
+//=============================================================================
+
+TopoDS_Shape GEOMImpl_ShapeDriver::ExtendEdge
+ (const TopoDS_Edge &theEdge,
+ const Standard_Real theMin,
+ const Standard_Real theMax) const
+{
+ TopoDS_Shape aResult;
+ Standard_Real aF;
+ Standard_Real aL;
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aF, aL);
+ const Standard_Real aTol = BRep_Tool::Tolerance(theEdge);
+ Standard_Real aRange2d = aL - aF;
+
+ if (aCurve.IsNull() == Standard_False && aRange2d > aTol) {
+ Standard_Real aMin = aF + aRange2d*theMin;
+ Standard_Real aMax = aF + aRange2d*theMax;
+
+ Handle(Standard_Type) aType = aCurve->DynamicType();
+
+ // Get the curve of original type
+ while (aType == STANDARD_TYPE(Geom_TrimmedCurve)) {
+ Handle(Geom_TrimmedCurve) aTrCurve =
+ Handle(Geom_TrimmedCurve)::DownCast(aCurve);
+
+ aCurve = aTrCurve->BasisCurve();
+ aType = aCurve->DynamicType();
+ }
+
+ if (aCurve->IsPeriodic()) {
+ // The curve is periodic. Check if a new range is less then a period.
+ if (aMax - aMin > aCurve->Period()) {
+ aMax = aMin + aCurve->Period();
+ }
+ } else {
+ // The curve is not periodic. Check if aMin and aMax within bounds.
+ aMin = Max(aMin, aCurve->FirstParameter());
+ aMax = Min(aMax, aCurve->LastParameter());
+ }
+
+ if (aMax - aMin > aTol) {
+ // Create a new edge.
+ BRepBuilderAPI_MakeEdge aME (aCurve, aMin, aMax);
+
+ if (aME.IsDone()) {
+ aResult = aME.Shape();
+ }
+ }
+ }
+
+ return aResult;
+}
+
+//=============================================================================
+/*!
+ * \brief Returns an extended face.
+ */
+//=============================================================================
+
+TopoDS_Shape GEOMImpl_ShapeDriver::ExtendFace
+ (const TopoDS_Face &theFace,
+ const Standard_Real theUMin,
+ const Standard_Real theUMax,
+ const Standard_Real theVMin,
+ const Standard_Real theVMax) const
+{
+ TopoDS_Shape aResult;
+ Handle(Geom_Surface) aSurface = BRep_Tool::Surface(theFace);
+ const Standard_Real aTol = BRep_Tool::Tolerance(theFace);
+ Standard_Real aU1;
+ Standard_Real aU2;
+ Standard_Real aV1;
+ Standard_Real aV2;
+
+ // Get U, V bounds of the face.
+ ShapeAnalysis::GetFaceUVBounds(theFace, aU1, aU2, aV1, aV2);
+
+ const Standard_Real aURange = aU2 - aU1;
+ const Standard_Real aVRange = aV2 - aV1;
+
+ if (aSurface.IsNull() == Standard_False &&
+ aURange > aTol && aURange > aTol) {
+ Handle(Standard_Type) aType = aSurface->DynamicType();
+
+ // Get the surface of original type
+ while (aType == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
+ Handle(Geom_RectangularTrimmedSurface) aTrSurface =
+ Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface);
+
+ aSurface = aTrSurface->BasisSurface();
+ aType = aSurface->DynamicType();
+ }
+
+ Standard_Real aUMin = aU1 + aURange*theUMin;
+ Standard_Real aUMax = aU1 + aURange*theUMax;
+ Standard_Real aVMin = aV1 + aVRange*theVMin;
+ Standard_Real aVMax = aV1 + aVRange*theVMax;
+
+ aSurface->Bounds(aU1, aU2, aV1, aV2);
+
+ if (aSurface->IsUPeriodic()) {
+ // The surface is U-periodic. Check if a new U range is less
+ // then a period.
+ if (aUMax - aUMin > aSurface->UPeriod()) {
+ aUMax = aUMin + aSurface->UPeriod();
+ }
+ } else {
+ // The surface is not V-periodic. Check if aUMin and aUMax
+ // within bounds.
+ aUMin = Max(aUMin, aU1);
+ aUMax = Min(aUMax, aU2);
+ }
+
+ if (aSurface->IsVPeriodic()) {
+ // The surface is V-periodic. Check if a new V range is less
+ // then a period.
+ if (aVMax - aVMin > aSurface->VPeriod()) {
+ aVMax = aVMin + aSurface->VPeriod();
+ }
+ } else {
+ // The surface is not V-periodic. Check if aVMin and aVMax
+ // within bounds.
+ aVMin = Max(aVMin, aV1);
+ aVMax = Min(aVMax, aV2);
+ }
+
+ if (aUMax - aUMin > aTol && aVMax - aVMin > aTol) {
+ // Create a new edge.
+ BRepBuilderAPI_MakeFace aMF
+ (aSurface, aUMin, aUMax, aVMin, aVMax, aTol);
+
+ if (aMF.IsDone()) {
+ aResult = aMF.Shape();
+ }
+ }
+ }
+
+ return aResult;
+}
+
//================================================================================
/*!
* \brief Returns a name of creation operation and names and values of creation parameters
AddParam( theParams, "Wires/edges", aCI.GetShapes() );
AddParam( theParams, "Is planar wanted", aCI.GetIsPlanar() );
break;
+ case FACE_FROM_SURFACE:
+ {
+ theOperationName = "FACE";
+
+ Handle(TColStd_HSequenceOfTransient) shapes = aCI.GetShapes();
+
+ if (shapes.IsNull() == Standard_False) {
+ Standard_Integer aNbShapes = shapes->Length();
+
+ if (aNbShapes > 0) {
+ AddParam(theParams, "Face", shapes->Value(1));
+
+ if (aNbShapes > 1) {
+ AddParam(theParams, "Wire", shapes->Value(2));
+ }
+ }
+ }
+ break;
+ }
case SHELL_FACES:
theOperationName = "SHELL";
AddParam( theParams, "Objects", aCI.GetShapes() );
break;
- case SOLID_SHELL:
case SOLID_SHELLS:
theOperationName = "SOLID";
AddParam( theParams, "Objects", aCI.GetShapes() );
break;
+ case SOLID_FACES:
+ theOperationName = "SOLID_FROM_FACES";
+ AddParam( theParams, "Objects", aCI.GetShapes() );
+ AddParam( theParams, "Is intersect", aCI.GetIsIntersect() );
+ break;
case COMPOUND_SHAPES:
theOperationName = "COMPOUND";
AddParam( theParams, "Objects", aCI.GetShapes() );
if ( !shapes.IsNull() && shapes->Length() > 1 )
AddParam( theParams, "Shape", shapes->Value(2) );
AddParam( theParams, "Shape type", TopAbs_ShapeEnum( aCI.GetSubShapeType() ));
- AddParam( theParams, "State", TopAbs_State((int) aCI.GetTolerance() ));
+ AddParam( theParams, "State" );
+ GEOMAlgo_State st = GEOMAlgo_State( (int) ( aCI.GetTolerance()+0.1 ) );
+ const char* stName[] = { "UNKNOWN","IN","OUT","ON","ONIN","ONOUT","INOUT" };
+ if ( 0 <= st && st <= GEOMAlgo_ST_INOUT )
+ theParams.back() << stName[ st ];
+ else
+ theParams.back() << (int) st;
break;
}
case SHAPE_ISOLINE:
AddParam(theParams, "Parameter", aII.GetParameter());
break;
}
+ case EDGE_UV:
+ {
+ GEOMImpl_IShapeExtend aSE (function);
+
+ theOperationName = "EDGE_EXTEND";
+ AddParam(theParams, "Edge", aSE.GetShape());
+ AddParam(theParams, "Min", aSE.GetUMin());
+ AddParam(theParams, "Max", aSE.GetUMax());
+ break;
+ }
+ case FACE_UV:
+ {
+ GEOMImpl_IShapeExtend aSE (function);
+
+ theOperationName = "FACE_EXTEND";
+ AddParam(theParams, "Face", aSE.GetShape());
+ AddParam(theParams, "UMin", aSE.GetUMin());
+ AddParam(theParams, "UMax", aSE.GetUMax());
+ AddParam(theParams, "VMin", aSE.GetVMin());
+ AddParam(theParams, "VMax", aSE.GetVMax());
+ break;
+ }
+ case SURFACE_FROM_FACE:
+ {
+ GEOMImpl_IShapeExtend aSE (function);
+
+ theOperationName = "SURFACE_FROM_FACE";
+ AddParam(theParams, "Face", aSE.GetShape());
+ break;
+ }
default:
return false;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
const bool IsUIso,
const double theParameter) const;
+ TopoDS_Shape ExtendEdge(const TopoDS_Edge &theEdge,
+ const Standard_Real theMin,
+ const Standard_Real theMax) const;
+
+ TopoDS_Shape ExtendFace(const TopoDS_Face &theFace,
+ const Standard_Real theUMin,
+ const Standard_Real theUMax,
+ const Standard_Real theVMin,
+ const Standard_Real theVMax) const;
+
};
#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <Standard_NullObject.hxx>
+// Below macro specifies how the closed point set is processed (issue 0022885).
+// See below for more information.
+// Currently solution 4 is chosen!
+#define BSPLINE_PROCESS_CLOSED_PNTSET 2
+
+namespace
+{
+ /*!
+ \brief Generate list of points from the list of (x,y,z) coordinates
+ \param coords list of values specifying (x y z) coordinates of points
+ \return list of points
+ \internal
+ */
+ Handle(TColgp_HArray1OfPnt) pointsFromCoords(Handle(TColStd_HArray1OfReal) coords)
+ {
+ Standard_Integer length = coords->Length() / 3;
+
+ Handle(TColgp_HArray1OfPnt) points = new TColgp_HArray1OfPnt(1, length);
+
+ for (int i = 0; i < length; i ++) {
+ Standard_Real x = coords->Value( i*3+1 );
+ Standard_Real y = coords->Value( i*3+2 );
+ Standard_Real z = coords->Value( i*3+3 );
+ points->SetValue(i+1, gp_Pnt(x, y, z));
+ }
+
+ return points;
+ }
+
+ /*!
+ \brief Generate list of points from the sequence of input objects
+ \param coords list of objects as it is stored within the CAF tree
+ \return list of points
+ \internal
+ */
+ Handle(TColgp_HArray1OfPnt) pointsFromObjs(Handle(TColStd_HSequenceOfTransient) objects)
+ {
+ Standard_Integer length = objects->Length();
+
+ Handle(TColgp_HArray1OfPnt) points = new TColgp_HArray1OfPnt(1, length);
+
+ for (int i = 1; i <= length; i ++) {
+ TopoDS_Shape shape = Handle(GEOM_Function)::DownCast(objects->Value(i))->GetValue();
+ if (shape.ShapeType() != TopAbs_VERTEX)
+ // error: only vertices are allowed in the input
+ Standard_ConstructionError::Raise("Input should contain only vertices");
+ points->SetValue(i, BRep_Tool::Pnt(TopoDS::Vertex(shape)));
+ }
+
+ return points;
+ }
+}
+
//=======================================================================
//function : GetID
//purpose :
bool useCoords = aCI.GetConstructorType() == COORD_CONSTRUCTOR;
- Handle(TColStd_HArray1OfReal) aCoordsArray; // parametric case
- Handle(TColStd_HSequenceOfTransient) aPoints; // points case
-
- int aLen = 0;
- if (useCoords) {
- aCoordsArray = aCI.GetCoordinates();
- aLen = aCoordsArray->Length() / 3;
- }
- else {
- aPoints = aCI.GetPoints();
- aLen = aPoints->Length();
- }
-
- if (aLen < 2) return 0;
-
- TColgp_Array1OfPnt points (1, (useCoords ? aLen : 1));
- if (useCoords) {
- int anArrayLength = aCoordsArray->Length();
- for (int i = 0, j = 1; i <= (anArrayLength-3); i += 3) {
- gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3));
- points.SetValue(j, aPnt);
- j++;
- }
- }
-
- int aRealLen = aLen;
-
- if (aType == SPLINE_BEZIER && aCI.GetIsClosed()) {
- TopoDS_Vertex aV1;
- if (useCoords) {
- aV1 = BRepBuilderAPI_MakeVertex(points.Value(1));
- }
- else {
- Handle(GEOM_Function) aFPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(1));
- TopoDS_Shape aFirstPnt = aFPoint->GetValue();
- aV1 = TopoDS::Vertex(aFirstPnt);
- }
-
- TopoDS_Vertex aV2;
- if (useCoords) {
- aV2 = BRepBuilderAPI_MakeVertex(points.Value(aLen));
- }
- else {
- Handle(GEOM_Function) aLPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(aLen));
- TopoDS_Shape aLastPnt = aLPoint->GetValue();
- aV2 = TopoDS::Vertex(aLastPnt);
- }
-
- if (!aV1.IsNull() && !aV2.IsNull() && !aV1.IsSame(aV2)) {
- aRealLen++;
- }
- }
-
- int ind;
- Standard_Boolean isSeveral = Standard_False;
- gp_Pnt aPrevP;
-
- TColgp_Array1OfPnt CurvePoints (1, aRealLen);
- for (ind = 1; ind <= aLen; ind++) {
- gp_Pnt aP;
- if (useCoords) {
- aP = points.Value(ind);
- if (!isSeveral && ind > 1) {
- if (aP.Distance(aPrevP) > Precision::Confusion()) {
- isSeveral = Standard_True;
+ // collect points from input parameters: objects or coordinates
+ Handle(TColgp_HArray1OfPnt) points = useCoords ? pointsFromCoords(aCI.GetCoordinates()) : pointsFromObjs(aCI.GetPoints());
+ int length = points->Length();
+
+ if (length < 2) return 0; // error: not enough points in the input list
+
+ // reorder points if required (bspline only)
+ if ((aType == SPLINE_INTERPOLATION || aType == SPLINE_INTERPOL_TANGENTS) && aCI.GetDoReordering()) {
+ int nbDup = 0;
+ gp_Pnt pPrev = points->Value(1);
+ for (int i = 1; i < length - 1; i++) {
+ gp_Pnt pi = points->Value(i);
+ int nearest = 0;
+ double minDist = RealLast();
+ for (int j = i+1; j <= length; j++) {
+ double dist = pi.SquareDistance(points->Value(j));
+ if (dist < minDist && (minDist - dist) > Precision::Confusion()) {
+ nearest = j;
+ minDist = dist;
}
}
- CurvePoints.SetValue(ind, aP);
- aPrevP = aP;
+ if (nearest > 0 && nearest != i + 1) {
+ // Keep given order of points to use it in case of equidistant candidates
+ // .-<---<-.
+ // / \
+ // o o o c o->o->o->o->n o o
+ // | | |
+ // i i+1 nearest
+ gp_Pnt p = points->Value(nearest);
+ for (int j = nearest; j > i+1; j--)
+ points->SetValue(j, points->Value(j-1));
+ points->SetValue(i+1, p);
+ }
+ if ( pPrev.Distance(points->Value(i+1)) <= Precision::Confusion() )
+ nbDup++;
+ else
+ pPrev = points->Value(i+1);
}
- else {
- Handle(GEOM_Function) aRefPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(ind));
- TopoDS_Shape aShapePnt = aRefPoint->GetValue();
- if (aShapePnt.ShapeType() == TopAbs_VERTEX) {
- aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
- if (!isSeveral && ind > 1) {
- if (aP.Distance(aPrevP) > Precision::Confusion()) {
- isSeveral = Standard_True;
- }
+ if ( nbDup > 0 ) {
+ Handle(TColgp_HArray1OfPnt) tmpPoints = new TColgp_HArray1OfPnt(1, length-nbDup);
+ int j = 1;
+ for (int i = 1; i <= length; i++) {
+ if (i == 1 || pPrev.Distance(points->Value(i)) > Precision::Confusion() ) {
+ tmpPoints->SetValue(j++, points->Value(i));
+ pPrev = points->Value(i);
}
- CurvePoints.SetValue(ind, aP);
- aPrevP = aP;
}
+ points = tmpPoints;
+ length = points->Length();
}
- }
+ } // end of reordering
+
+ bool closed = points->Value(1).Distance(points->Value(length)) <= gp::Resolution();
if (aType == SPLINE_BEZIER) {
- if (!isSeveral) {
- Standard_ConstructionError::Raise("Points for Bezier Curve are too close");
+ // for Bezier curve we should append first point to the list if:
+ // a) "closed" flag is set, and
+ // b) first and last vertices are not too close
+ bool addFirst = aCI.GetIsClosed() && !closed;
+
+ // re-fill points and check that there's enough points to create a curve
+ bool isValid = false;
+ TColgp_Array1OfPnt curvePoints(1, length + (addFirst ? 1 : 0));
+ gp_Pnt pp;
+ for (int i = 1; i <= length; i++) {
+ gp_Pnt p = points->Value(i);
+ if (!isValid && i > 1 && p.Distance(pp) > Precision::Confusion())
+ isValid = true;
+ curvePoints.SetValue(i, p);
+ pp = p;
}
- if (aRealLen > aLen) { // set last point equal to first for the closed curve
- CurvePoints.SetValue(aRealLen, CurvePoints.Value(1));
- }
- Handle(Geom_BezierCurve) GBC = new Geom_BezierCurve (CurvePoints);
+
+ if (!isValid)
+ // error: not enough points to create curve
+ Standard_ConstructionError::Raise("Points for Bezier Curve are too close");
+
+ // set last point equal to first for the closed Bezier curve
+ if (addFirst) curvePoints.SetValue(length+1, curvePoints.Value(1));
+
+ // create Bezier curve
+ Handle(Geom_BezierCurve) GBC = new Geom_BezierCurve(curvePoints);
aShape = BRepBuilderAPI_MakeEdge(GBC).Edge();
}
else {
- //GeomAPI_PointsToBSpline GBC (CurvePoints);
- //aShape = BRepBuilderAPI_MakeEdge(GBC).Edge();
-
- if (aCI.GetDoReordering()) {
- for (int curInd = 1; curInd < aLen - 1; curInd++) {
- gp_Pnt curPnt = CurvePoints.Value(curInd);
- int nearInd = 0;
- double nearDist = RealLast();
- for (ind = curInd + 1; ind <= aLen; ind++) {
- double dist = curPnt.SquareDistance(CurvePoints.Value(ind));
- if (dist < nearDist && (nearDist - dist) > Precision::Confusion()) {
- nearInd = ind;
- nearDist = dist;
- }
- }
- if (nearInd > 0 && nearInd != curInd + 1) {
- // Keep given order of points to use it in case of equidistant candidates
- // .-<---<-.
- // / \
- // o o o c o->o->o->o->n o o
- // | | |
- // curInd curInd+1 nearInd
- gp_Pnt nearPnt = CurvePoints.Value(nearInd);
- for (ind = nearInd; ind > curInd + 1; ind--) {
- CurvePoints.SetValue(ind, CurvePoints.Value(ind - 1));
- }
- CurvePoints.SetValue(curInd + 1, nearPnt);
- }
- }
+ // Below described processing of closed points set case
+ // is not done for constrained bsplined
+ bool typeok = aType == SPLINE_INTERPOLATION;
+#if BSPLINE_PROCESS_CLOSED_PNTSET == 1
+ // Last point is removed from the list if:
+ // a) first and last vertices are equal;
+ // b) "closed" flag is not taken into account.
+ // If first and last points are equal, we force "closed" flag to be set to true.
+ // For the case when first and last vertices are equal, this approach causes
+ // result different that would be if last point had NOT be removed and "closed" flag is false.
+ bool isClosed = typeok && (aCI.GetIsClosed() || closed);
+ bool removeLast = typeok && closed;
+ bool addFirst = false;
+#elif BSPLINE_PROCESS_CLOSED_PNTSET == 2
+ // Last point is removed from the list if:
+ // a) first and last vertices are equal;
+ // b) "closed" flag is set to true.
+ // Flag "closed" is taken "as is".
+ // For the case when first and last vertices are equal, this approach causes
+ // different results with "closed" flag set to true and false.
+ bool isClosed = typeok && aCI.GetIsClosed();
+ bool removeLast = typeok && aCI.GetIsClosed() && closed;
+ bool addFirst = false;
+#elif BSPLINE_PROCESS_CLOSED_PNTSET == 3
+ // Points are passed "as is" to the creator.
+ // If first and last points are equal, we force "closed" flag to be set to false.
+ // For the case when first and last vertices are equal, this approach gives
+ // the same results with "closed" flag set to true and false.
+ bool isClosed = typeok && aCI.GetIsClosed() && !closed;
+ bool removeLast = false;
+ bool addFirst = false;
+#elif BSPLINE_PROCESS_CLOSED_PNTSET == 4
+ // First point is added to the list if:
+ // a) first and last vertices are not equal;
+ // b) "closed" flag is set to true.
+ // In this case "closed" flag is forcidly set to false - bspline creator is
+ // capable to create closed edge in this case.
+ // This approach gives the same results with "closed" flag set to true not
+ // depending on if set of points is closed or no.
+ // Also, it gives equal reqults in both case if set of points is closed or not
+ // and "closed" flag is set to true, in contrast to solution 3 above.
+ bool isClosed = false;
+ bool removeLast = false;
+ bool addFirst = typeok && aCI.GetIsClosed() && !closed;
+#else
+ // Points are passed "as is" to the creator.
+ // This causes an error when first point is equal to last one and
+ // "closed" flag is set to true; see bug 0022885.
+ bool isClosed = typeok && aCI.GetIsClosed();
+ bool removeLast = false;
+ bool addFirst = false;
+#endif
+
+ // remove last point or append first one if the conditions are observed (see above)
+ if (removeLast || addFirst) {
+ int extra = removeLast ? -1 : (addFirst ? 1 : 0 );
+ int nb = removeLast ? length-1 : length;
+ Handle(TColgp_HArray1OfPnt) curvePoints = new TColgp_HArray1OfPnt (1, length+extra);
+ for (int i = 1; i <= nb; i++)
+ curvePoints->SetValue(i, points->Value(i));
+ if (addFirst) curvePoints->SetValue(length+1, points->Value(1));
+ points = curvePoints;
}
- Handle(TColgp_HArray1OfPnt) aHCurvePoints = new TColgp_HArray1OfPnt (1, aLen);
- for (ind = 1; ind <= aLen; ind++) {
- aHCurvePoints->SetValue(ind, CurvePoints.Value(ind));
- }
-
- bool isClosed = Standard_False;
- if (aType == SPLINE_INTERPOLATION)
- isClosed = aCI.GetIsClosed();
-
- GeomAPI_Interpolate GBC (aHCurvePoints, isClosed, gp::Resolution());
+ // initial set-up of curve creator
+ GeomAPI_Interpolate GBC(points, isClosed, gp::Resolution());
+ // add tangent vectors constraints
if (aType == SPLINE_INTERPOL_TANGENTS) {
- Handle(GEOM_Function) aVec1Ref = aCI.GetFirstVector();
- Handle(GEOM_Function) aVec2Ref = aCI.GetLastVector();
+ Handle(GEOM_Function) aVec1Ref = aCI.GetFirstVector();
+ Handle(GEOM_Function) aVec2Ref = aCI.GetLastVector();
if (aVec1Ref.IsNull() || aVec2Ref.IsNull())
+ // error: bad vector parameter is specified
Standard_NullObject::Raise("Null object is given for a vector");
- TopoDS_Shape aVec1Sh = aVec1Ref->GetValue();
- TopoDS_Shape aVec2Sh = aVec2Ref->GetValue();
-
// take orientation of edge into account to avoid regressions, as it was implemented so
- gp_Vec aV1 = GEOMUtils::GetVector(aVec1Sh, Standard_True);
- gp_Vec aV2 = GEOMUtils::GetVector(aVec2Sh, Standard_True);
+ gp_Vec aV1 = GEOMUtils::GetVector(aVec1Ref->GetValue(), Standard_True);
+ gp_Vec aV2 = GEOMUtils::GetVector(aVec2Ref->GetValue(), Standard_True);
+ // push constraint vectors to the curve creator
GBC.Load(aV1, aV2, /*Scale*/Standard_True);
}
+ // create bspline curve
GBC.Perform();
if (GBC.IsDone())
aShape = BRepBuilderAPI_MakeEdge(GBC.Curve()).Edge();
- else
- return 0;
}
}
else {
}
- if (aShape.IsNull()) return 0;
+ if (aShape.IsNull()) return 0; // error: bad result
aFunction->SetValue(aShape);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <Standard_Stream.hxx>
-
#include <GEOMImpl_ThruSectionsDriver.hxx>
#include <GEOMImpl_IThruSections.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
+#include <GEOMUtils.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <Precision.hxx>
-#include <BRepCheck_Analyzer.hxx>
#include <BRepOffsetAPI_ThruSections.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
-#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopAbs.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx>
-#include <Standard_NullObject.hxx>
#include <Standard_TypeMismatch.hxx>
#include <Standard_ConstructionError.hxx>
-#include <ShapeFix_Shape.hxx>
-#include <ShapeFix_ShapeTolerance.hxx>
-#include <Precision.hxx>
+
//=======================================================================
//function : GetID
//purpose :
return 0;
}
- BRepCheck_Analyzer ana (aShape, Standard_False);
- if (!ana.IsValid()) {
+ if ( !GEOMUtils::CheckShape(aShape) && !GEOMUtils::FixShapeTolerance(aShape) ) {
//algoritm thru section creats on the arcs invalid shapes gka
- ShapeFix_ShapeTolerance aSFT;
- aSFT.LimitTolerance(aShape,Precision::Confusion(),Precision::Confusion());
- Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
- aSfs->SetPrecision(Precision::Confusion());
- aSfs->Perform();
- aShape = aSfs->Shape();
- //ana.Init(aShape, Standard_False);
- //if (!ana.IsValid())
// Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
}
-
aFunction->SetValue(aShape);
log.SetTouched(Label());
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <Standard_Stream.hxx>
-
#include <GEOMImpl_TranslateDriver.hxx>
#include <GEOMImpl_ITranslate.hxx>
-#include <GEOMImpl_ITransformOperations.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
#include <GEOMUtils.hxx>
-#include <ShapeFix_Shape.hxx>
-#include <ShapeFix_ShapeTolerance.hxx>
-
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
-#include <BRepCheck_Analyzer.hxx>
-#include <BRepBuilderAPI_Transform.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Compound.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Edge.hxx>
#include <gp_Trsf.hxx>
#include <gp_Pnt.hxx>
B.Add(aCompound, anOriginal.Located(aLocRes));
}
aShape = aCompound;
- //aShape = GEOMImpl_ITransformOperations::TranslateShape1D(anOriginal, &TI);
}
else if (aType == TRANSLATE_2D) {
Standard_Integer nbtimes1 = TI.GetNbIter1(), nbtimes2 = TI.GetNbIter2();
}
}
aShape = aCompound;
- //aShape = GEOMImpl_ITransformOperations::TranslateShape2D(anOriginal, &TI);
}
else return 0;
if (aShape.IsNull()) return 0;
- BRepCheck_Analyzer ana (aShape, Standard_True);
- if (!ana.IsValid()) {
- ShapeFix_ShapeTolerance aSFT;
- aSFT.LimitTolerance(aShape,Precision::Confusion(),Precision::Confusion());
- Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
- aSfs->SetPrecision(Precision::Confusion());
- aSfs->Perform();
- aShape = aSfs->Shape();
-
- ana.Init(aShape, Standard_False);
- if (!ana.IsValid())
- Standard_ConstructionError::Raise("Scaling aborted : algorithm has produced an invalid shape result");
- }
+ if ( !GEOMUtils::CheckShape(aShape, true) && !GEOMUtils::FixShapeTolerance(aShape) )
+ Standard_ConstructionError::Raise("Scaling aborted : algorithm has produced an invalid shape result");
aFunction->SetValue(aShape);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+#ifndef GEOMImpl_Types_HXX
+#define GEOMImpl_Types_HXX
+
+#include <TopAbs_ShapeEnum.hxx>
// GEOM_Object types
#define GEOM_POLYLINE2D 56
+#define GEOM_TRANSFER_DATA 57
+
//GEOM_Function types
#define COPY_WITH_REF 1
#define COPY_WITHOUT_REF 2
+#define TRANSFER_DATA 3
#define IMPORT_SHAPE 1
#define EXPORT_SHAPE 2
#define OFFSET_THICKENING 3
#define OFFSET_THICKENING_COPY 4
-#define PROJECTION_COPY 1
-#define PROJECTION_ON_WIRE 2
+#define PROJECTION_COPY 1
+#define PROJECTION_ON_WIRE 2
+#define PROJECTION_ON_CYLINDER 3
#define SCALE_SHAPE 1
#define SCALE_SHAPE_COPY 2
#define DISK_THREE_PNT 2
#define DISK_R 3
-#define CYLINDER_R_H 1
-#define CYLINDER_PNT_VEC_R_H 2
-#define CYLINDER_R_H_A 3
-#define CYLINDER_PNT_VEC_R_H_A 4
+#define CYLINDER_R_H 1
+#define CYLINDER_PNT_VEC_R_H 2
+#define CYLINDER_R_H_A 3
+#define CYLINDER_PNT_VEC_R_H_A 4
#define CONE_R1_R2_H 1
#define CONE_PNT_VEC_R1_R2_H 2
#define WIRE_EDGES 1
#define FACE_WIRE 2
#define SHELL_FACES 3
-#define SOLID_SHELL 4
+//#define SOLID_SHELL 4
#define SOLID_SHELLS 5
#define COMPOUND_SHAPES 6
#define SUBSHAPE_SORTED 7
#define EDGE_CURVE_LENGTH 12
#define SHAPES_ON_SHAPE 13
#define SHAPE_ISOLINE 14
-
+#define FACE_FROM_SURFACE 15
+#define EDGE_UV 16
+#define FACE_UV 17
+#define SURFACE_FROM_FACE 18
+#define SOLID_FACES 19
#define ARCHIMEDE_TYPE 1
#define FUSE_COLLINEAR_EDGES 10
#define SEWING_NON_MANIFOLD 11
#define REMOVE_INTERNAL_FACES 12
+#define DIVIDE_EDGE_BY_POINT 13
#define BASIC_FILLING 1
+#define FILLING_ON_CONSTRAINTS 2
#define GLUE_FACES 1
#define GLUE_FACES_BY_LIST 2
#define USER_TYPE 200 // Base type for GEOM advanced shapes
#define USER_TYPE_EX 1000 // Base type for GEOM plugins
+// Transfer data method type
+#define TD_GET_IN_PLACE 1
+#define TD_GET_IN_PLACE_OLD 2
+#define TD_GET_IN_PLACE_BY_HISTORY 3
-//Plugins specified constants
+// Plugins specified constants
#define PLUGIN_NAME "Plugin Name"
+
+// Flat type for TopAbs
+enum { TopAbs_FLAT = TopAbs_SHAPE+1 };
+
+#endif // GEOMImpl_Types_HXX
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <Standard_ConstructionError.hxx>
+namespace
+{
+ Handle(GEOM_Object) GetOwner( const TDF_Label& l )
+ {
+ TDF_Label label = l;
+ // object is stored on a grandfather label of a driver label
+ if ( !label.IsNull() )
+ label = label.Father();
+ if ( !label.IsNull() )
+ label = label.Father();
+
+ return GEOM_Object::GetObject( label );
+ }
+}
+
//=======================================================================
//function : GetID
//purpose :
AddParam( theParams, "Dz", aCI.GetDZ() );
break;
case VECTOR_TWO_PNT: {
- TDF_Label label = Label();
- Handle(GEOM_Object) obj = GEOM_Object::GetObject( label );
+ Handle(GEOM_Object) obj = GetOwner( Label() );
if ( !obj.IsNull() && obj->GetType() == GEOM_EDGE )
theOperationName = "EDGE";
else
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
GEOM
GEOMBase
Material
- DependencyTree
)
+
+IF(SALOME_USE_GRAPHICSVIEW)
+ LIST(APPEND _link_LIBRARIES
+ DependencyTree
+ )
+ENDIF()
# --- headers ---
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
case GEOMOp::OpDelete: // EDIT - DELETE
OnEditDelete();
break;
+#ifndef DISABLE_PYCONSOLE
case GEOMOp::OpCheckGeom: // TOOLS - CHECK GEOMETRY
OnCheckGeometry();
break;
+#endif
case GEOMOp::OpSelectVertex: // POPUP - SELECT ONLY - VERTEX
OnSelectOnly( GEOM_POINT );
break;
case GEOMOp::OpSortChildren:
OnSortChildren();
break;
+#ifndef DISABLE_GRAPHICSVIEW
case GEOMOp::OpShowDependencyTree:
OnShowDependencyTree();
break;
+#endif
case GEOMOp::OpReduceStudy:
OnReduceStudy();
break;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
void OnClsBringToFront();
void OnCreateFolder();
void OnSortChildren();
+#ifndef DISABLE_GRAPHICSVIEW
void OnShowDependencyTree();
+#endif
void OnReduceStudy();
// Shortcut commands
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// File : GEOMToolsGUI_1.cxx
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
+#ifndef DISABLE_PYCONSOLE
#include <PyConsole_Console.h>
+#endif
#include "GEOMToolsGUI.h"
#include "GEOMToolsGUI_TransparencyDlg.h"
#include <GEOMBase.h>
#include <GEOM_Actor.h>
+#ifndef DISABLE_GRAPHICSVIEW
#include <DependencyTree_ViewModel.h>
#include <DependencyTree_View.h>
#include <DependencyTree_Selector.h>
+#endif
#include <Basics_OCCTVersion.hxx>
#include <SUIT_MessageBox.h>
#include <SUIT_Tools.h>
+#include <STD_TabDesktop.h>
+
+#include <QtxWorkstack.h>
+
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#include <SalomeApp_Module.h>
#include "utilities.h"
// OCCT Includes
-#include <AIS_Drawer.hxx>
#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
// QT Includes
#include <QAction>
+#include <QApplication>
#include <QColorDialog>
#include <QInputDialog>
#include <QFileDialog>
// VTK includes
#include <vtkRenderer.h>
-class QtxDialog;
// If the next macro is defined, autocolor feature works for all sub-shapes;
// if it is undefined, autocolor feature works for groups only
#define GENERAL_AUTOCOLOR
// Below macro, when uncommented, switches on simplified (more performant) algorithm
// of auto-color picking up
#define SIMPLE_AUTOCOLOR
+// Below macro, when defined, switches on automatic layouting of OCC and Dependecy views
+// on Show Dependencies operation
+#define LAYOUT_DEPVIEW
+#ifndef DISABLE_PYCONSOLE
void GEOMToolsGUI::OnCheckGeometry()
{
SalomeApp_Application* app =
if (pyConsole)
pyConsole->exec("from GEOM_usinggeom import *");
}
+#endif
void GEOMToolsGUI::OnAutoColor()
{
QColor c( (int)( aColor.R * 255.0 ), (int)( aColor.G * 255.0 ), (int)( aColor.B * 255.0 ) );
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
- appStudy->setObjectProperty( aMgrId, aChildObject->GetEntry(), GEOM::propertyName( GEOM::Color ), c );
+ appStudy->setObjectProperty( aMgrId, aChildObject->GetStudyEntry(), GEOM::propertyName( GEOM::Color ), c );
Handle( SALOME_InteractiveObject ) io = new SALOME_InteractiveObject( aChildObject->GetStudyEntry(), "GEOM", "" );
if ( window->isVisible( io ) ) displayer.Redisplay( io, false );
}
color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
if ( !color.isValid() ) return;
+ SALOMEDS::Color aSColor;
+ aSColor.R = (double)color.red() / 255.0;
+ aSColor.G = (double)color.green() / 255.0;
+ aSColor.B = (double)color.blue() / 255.0;
+
// iterate through list of objects and assign new color
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Handle( SALOME_InteractiveObject ) io = It.Value();
+ GEOM::GEOM_Object_var aObject = GEOMBase::ConvertIOinGEOMObject( io );
+ if ( !CORBA::is_nil( aObject ) ) aObject->SetColor( aSColor );
appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::Color ), color );
if ( window->isVisible( io ) ) displayer.Redisplay( io, false );
}
NbIsosDlg->setV( VIso );
if ( NbIsosDlg->exec() ) {
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
newNbUIso = NbIsosDlg->getU();
newNbVIso = NbIsosDlg->getV();
} else //Cancel case
( SUIT_Session::session()->activeApplication()->desktop() );
DeflectionDlg->setTheDC( aDC );
if ( DeflectionDlg->exec() ) {
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
aDC = DeflectionDlg->getTheDC();
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Dlg->setTheLW( aWidth );
if ( Dlg->exec() ) {
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
aWidth = Dlg->getTheLW();
} else
return; //Cancel case
Dlg->setTheLW( aWidth );
if ( Dlg->exec() ) {
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
aWidth = Dlg->getTheLW();
} else
return; //Cancel case
app->updateObjectBrowser( true );
}
+#ifndef DISABLE_GRAPHICSVIEW
void GEOMToolsGUI::OnShowDependencyTree()
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( !app ) return;
- SUIT_ViewManager *svm = app->getViewManager( GraphicsView_Viewer::Type(), false );
+#ifdef LAYOUT_DEPVIEW
+ SUIT_ViewManager* occVm = app->getViewManager( OCCViewer_Viewer::Type(), true );
+ SUIT_ViewWindow* occVw = occVm->getActiveView();
+#endif
+ SUIT_ViewManager* depVm = app->getViewManager( GraphicsView_Viewer::Type(), false );
+ SUIT_ViewWindow* depVw = 0;
- if( !svm ) {
+ if ( !depVm ) {
DependencyTree_View* view = new DependencyTree_View();
DependencyTree_ViewModel* viewModel = new DependencyTree_ViewModel( GraphicsView_Viewer::Type(), view );
- SUIT_ViewManager *svm = app->createViewManager( viewModel );
+ depVm = app->createViewManager( viewModel );
LightApp_SelectionMgr* selMgr = app->selectionMgr();
new DependencyTree_Selector( viewModel, (SUIT_SelectionMgr*)selMgr );
- SUIT_ViewWindow* svw = svm->getActiveView();
+ depVw = depVm->getActiveView();
GraphicsView_ViewFrame* aViewFrame = 0;
- if (!svw) svw = svm->createViewWindow();
- if (svw) aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>(svw);
+ if ( !depVw ) depVw = depVm->createViewWindow();
+ if ( depVw ) aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>( depVw );
view->init( aViewFrame );
- svm->setTitle( view->getViewName() );
+ depVm->setTitle( view->getViewName() );
}
- else
- if( DependencyTree_ViewModel* viewModel = dynamic_cast<DependencyTree_ViewModel*>( svm->getViewModel() ) )
- if( DependencyTree_View* view = dynamic_cast<DependencyTree_View*>( viewModel->getActiveViewPort() ) ) {
- svm->getActiveView()->setFocus();
- view->updateModel();
- }
+ else if ( DependencyTree_ViewModel* viewModel = dynamic_cast<DependencyTree_ViewModel*>( depVm->getViewModel() ) ) {
+ if ( DependencyTree_View* view = dynamic_cast<DependencyTree_View*>( viewModel->getActiveViewPort() ) ) {
+ depVw = depVm->getActiveView();
+ view->updateModel();
+ }
+ }
+
+#ifdef LAYOUT_DEPVIEW
+ // layout views properly
+ STD_TabDesktop* d = dynamic_cast<STD_TabDesktop*>( app->desktop() );
+ if ( d && depVw && occVw ) {
+ QtxWorkstack* ws = d->workstack();
+ ws->stack();
+ QApplication::instance()->processEvents();
+ ws->Split( depVw, Qt::Horizontal, QtxWorkstack::SplitMove );
+ occVw->setFocus();
+ }
+#endif
+ depVw->setFocus();
}
+#endif
void GEOMToolsGUI::OnReduceStudy()
{
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
{
GEOMToolsGUI_TreeWidgetItem* item;
if( !theObject->IsMainShape() ) {
- GEOMToolsGUI_TreeWidgetItem* parentItem = addSubObject( theWidget, theObjects, theObject->GetMainShape() );
+ GEOM::GEOM_Object_var aMainShape = theObject->GetMainShape();
+ if ( CORBA::is_nil( aMainShape ) )
+ return NULL;
+ GEOMToolsGUI_TreeWidgetItem* parentItem = addSubObject( theWidget, theObjects, aMainShape );
item = findObjectInTree( theWidget, theObject );
if( !item )
item = new GEOMToolsGUI_TreeWidgetItem( parentItem, QStringList() << theObject->GetName(), theObject->GetStudyEntry() );
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
return;
}
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
aView->SetTransparency( It.Value(), newValue );
aStudy->setObjectProperty( aMgrId , It.Value()->getEntry(), GEOM::propertyName( GEOM::Transparency ) , newValue );
return;
}
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
if ( !vm )
return;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
${CAS_TKG3d}
${CAS_TKV3d}
${CAS_TKGeomBase}
+ ${CAS_TKBO}
${LIBXML2_LIBRARIES}
${KERNEL_SALOMELocalTrace}
)
SET(GEOMUtils_HEADERS
GEOMUtils.hxx
GEOMUtils_Hatcher.hxx
+ GEOMUtils_HTrsfCurve2d.hxx
+ GEOMUtils_ShapeStatistics.hxx
+ GEOMUtils_Trsf2d.hxx
+ GEOMUtils_TrsfCurve2d.hxx
GEOMUtils_XmlHandler.hxx
)
# --- sources ---
SET(GEOMUtils_SOURCES
GEOMUtils.cxx
GEOMUtils_Hatcher.cxx
+ GEOMUtils_HTrsfCurve2d.cxx
+ GEOMUtils_ShapeStatistics.cxx
+ GEOMUtils_Trsf2d.cxx
+ GEOMUtils_TrsfCurve2d.cxx
GEOMUtils_XmlHandler.cxx
)
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <Basics_OCCTVersion.hxx>
-#include <utilities.h>
#include <OpUtil.hxx>
#include <Utils_ExceptHandlers.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepBuilderAPI_Sewing.hxx>
+
+#include <BRepCheck_Analyzer.hxx>
#include <Bnd_Box.hxx>
+#include <BOPTools_AlgoTools.hxx>
+
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeFix_Shape.hxx>
+#include <ShapeFix_ShapeTolerance.hxx>
#include <ProjLib.hxx>
#include <ElSLib.hxx>
#include <vector>
#include <sstream>
+#include <algorithm>
#include <Standard_Failure.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+#define MAX2(X, Y) (Abs(X) > Abs(Y) ? Abs(X) : Abs(Y))
+#define MAX3(X, Y, Z) (MAX2(MAX2(X,Y), Z))
+
#define STD_SORT_ALGO 1
+#define DEFAULT_TOLERANCE_TOLERANCE 1.e-02
+#define DEFAULT_MAX_TOLERANCE_TOLERANCE 1.e-06
+
+// When the following macro is defined, ShapeFix_ShapeTolerance function is used to set max tolerance of curve
+// in GEOMUtils::FixShapeCurves function; otherwise less restrictive BRep_Builder::UpdateEdge/UpdateVertex
+// approach is used
+// VSR (29/12/2014): macro disabled
+//#define USE_LIMIT_TOLERANCE
+
namespace
{
/**
TopoDS_Shape &theModifiedShape,
Standard_Real &theAddDist)
{
- Standard_Boolean isModified = Standard_False;
TopExp_Explorer anExp;
int nbf = 0;
const Standard_Boolean isShell =
(sh.ShapeType()==TopAbs_SHELL || sh.ShapeType()==TopAbs_FACE);
- if( isShell || S->IsUPeriodic() ) {
- // non solid case or any periodic surface (Mantis 22454).
- double U1,U2,V1,V2;
- // changes for 0020677: EDF 1219 GEOM: MinDistance gives 0 instead of 20.88
- //S->Bounds(U1,U2,V1,V2); changed by
- ShapeAnalysis::GetFaceUVBounds(TopoDS::Face(theModifiedShape),U1,U2,V1,V2);
- // end of changes for 020677 (dmv)
- Handle(Geom_RectangularTrimmedSurface) TrS1 =
- new Geom_RectangularTrimmedSurface(S,U1,(U1+U2)/2.,V1,V2);
- Handle(Geom_RectangularTrimmedSurface) TrS2 =
- new Geom_RectangularTrimmedSurface(S,(U1+U2)/2.,U2,V1,V2);
+ if ( !isShell && S->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) ) {
+ Handle(Geom_SphericalSurface) SS = Handle(Geom_SphericalSurface)::DownCast(S);
+ gp_Pnt PC = SS->Location();
BRep_Builder B;
- TopoDS_Face F1,F2;
- TopoDS_Shape aMShape;
-
- if (isShell) {
- B.MakeCompound(TopoDS::Compound(aMShape));
- } else {
- B.MakeShell(TopoDS::Shell(aMShape));
- }
-
- B.MakeFace(F1,TrS1,1.e-7);
- B.Add(aMShape,F1);
- B.MakeFace(F2,TrS2,1.e-7);
- B.Add(aMShape,F2);
- Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
-
- if (!isShell) {
- // The original shape is a solid.
- TopoDS_Solid aSolid;
-
- B.MakeSolid(aSolid);
- B.Add(aSolid, aMShape);
- aMShape = aSolid;
- }
-
- sfs->Init(aMShape);
- sfs->SetPrecision(1.e-6);
- sfs->SetMaxTolerance(1.0);
- sfs->Perform();
- theModifiedShape = sfs->Shape();
- isModified = Standard_True;
+ TopoDS_Vertex V;
+ B.MakeVertex(V,PC,1.e-7);
+ theModifiedShape = V;
+ theAddDist = SS->Radius();
+ return Standard_True;
}
- else {
- if( S->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) ) {
- Handle(Geom_SphericalSurface) SS = Handle(Geom_SphericalSurface)::DownCast(S);
- gp_Pnt PC = SS->Location();
- BRep_Builder B;
- TopoDS_Vertex V;
- B.MakeVertex(V,PC,1.e-7);
- theModifiedShape = V;
- theAddDist = SS->Radius();
- isModified = Standard_True;
- }
- else {
- Handle(Geom_ToroidalSurface) TS = Handle(Geom_ToroidalSurface)::DownCast(S);
- gp_Ax3 ax3 = TS->Position();
- Handle(Geom_Circle) C = new Geom_Circle(ax3.Ax2(),TS->MajorRadius());
- BRep_Builder B;
- TopoDS_Edge E;
- B.MakeEdge(E,C,1.e-7);
- theModifiedShape = E;
- theAddDist = TS->MinorRadius();
- isModified = Standard_True;
- }
+ if ( !isShell && S->IsKind(STANDARD_TYPE(Geom_ToroidalSurface)) ) {
+ Handle(Geom_ToroidalSurface) TS = Handle(Geom_ToroidalSurface)::DownCast(S);
+ gp_Ax3 ax3 = TS->Position();
+ Handle(Geom_Circle) C = new Geom_Circle(ax3.Ax2(),TS->MajorRadius());
+ BRep_Builder B;
+ TopoDS_Edge E;
+ B.MakeEdge(E,C,1.e-7);
+ theModifiedShape = E;
+ theAddDist = TS->MinorRadius();
+ return Standard_True;
}
- } else {
- theModifiedShape = theShape;
- }
- }
- else
- theModifiedShape = theShape;
- return isModified;
- }
-
- //=======================================================================
- //function : ShapeToDouble
- //purpose : used by CompareShapes::operator()
- //=======================================================================
- std::pair<double, double> ShapeToDouble (const TopoDS_Shape& S, bool isOldSorting)
- {
- // Computing of CentreOfMass
- gp_Pnt GPoint;
- double Len;
-
- if (S.ShapeType() == TopAbs_VERTEX) {
- GPoint = BRep_Tool::Pnt(TopoDS::Vertex(S));
- Len = (double)S.Orientation();
- }
- else {
- GProp_GProps GPr;
- // BEGIN: fix for Mantis issue 0020842
- if (isOldSorting) {
- BRepGProp::LinearProperties(S, GPr);
- }
- else {
- if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) {
- BRepGProp::LinearProperties(S, GPr);
- }
- else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) {
- BRepGProp::SurfaceProperties(S, GPr);
- }
- else {
- BRepGProp::VolumeProperties(S, GPr);
+ // non solid case or any periodic surface (Mantis 22454).
+ double U1,U2,V1,V2;
+ // changes for 0020677: EDF 1219 GEOM: MinDistance gives 0 instead of 20.88
+ //S->Bounds(U1,U2,V1,V2); changed by
+ ShapeAnalysis::GetFaceUVBounds(TopoDS::Face(theModifiedShape),U1,U2,V1,V2);
+ // end of changes for 020677 (dmv)
+ Handle(Geom_RectangularTrimmedSurface) TrS1 =
+ new Geom_RectangularTrimmedSurface(S,U1,(U1+U2)/2.,V1,V2);
+ Handle(Geom_RectangularTrimmedSurface) TrS2 =
+ new Geom_RectangularTrimmedSurface(S,(U1+U2)/2.,U2,V1,V2);
+ TopoDS_Shape aMShape;
+
+ TopoDS_Face F1 = BRepBuilderAPI_MakeFace(TrS1, Precision::Confusion());
+ TopoDS_Face F2 = BRepBuilderAPI_MakeFace(TrS2, Precision::Confusion());
+
+ if (isShell) {
+ BRep_Builder B;
+ B.MakeCompound(TopoDS::Compound(aMShape));
+ B.Add(aMShape, F1);
+ B.Add(aMShape, F2);
+ } else {
+ // The original shape is a solid.
+ BRepBuilderAPI_Sewing aSewing (Precision::Confusion()*10.0);
+ aSewing.Add(F1);
+ aSewing.Add(F2);
+ aSewing.Perform();
+ aMShape = aSewing.SewedShape();
+ BRep_Builder B;
+ TopoDS_Solid aSolid;
+ B.MakeSolid(aSolid);
+ B.Add(aSolid, aMShape);
+ aMShape = aSolid;
}
+
+ Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
+ sfs->Init(aMShape);
+ sfs->SetPrecision(1.e-6);
+ sfs->SetMaxTolerance(1.0);
+ sfs->Perform();
+ theModifiedShape = sfs->Shape();
+ return Standard_True;
}
- // END: fix for Mantis issue 0020842
- GPoint = GPr.CentreOfMass();
- Len = GPr.Mass();
}
-
- double dMidXYZ = GPoint.X() * 999.0 + GPoint.Y() * 99.0 + GPoint.Z() * 0.9;
- return std::make_pair(dMidXYZ, Len);
+
+ theModifiedShape = theShape;
+ return Standard_False;
}
void parseWard( const GEOMUtils::LevelsList &theLevelList, std::string &treeStr )
}
+//=======================================================================
+//function : ShapeToDouble
+//purpose : used by CompareShapes::operator()
+//=======================================================================
+std::pair<double, double> GEOMUtils::ShapeToDouble (const TopoDS_Shape& S, bool isOldSorting)
+{
+ // Computing of CentreOfMass
+ gp_Pnt GPoint;
+ double Len;
+
+ if (S.ShapeType() == TopAbs_VERTEX) {
+ GPoint = BRep_Tool::Pnt(TopoDS::Vertex(S));
+ Len = (double)S.Orientation();
+ }
+ else {
+ GProp_GProps GPr;
+ // BEGIN: fix for Mantis issue 0020842
+ if (isOldSorting) {
+ BRepGProp::LinearProperties(S, GPr);
+ }
+ else {
+ if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) {
+ BRepGProp::LinearProperties(S, GPr);
+ }
+ else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) {
+ BRepGProp::SurfaceProperties(S, GPr);
+ }
+ else {
+ BRepGProp::VolumeProperties(S, GPr);
+ }
+ }
+ // END: fix for Mantis issue 0020842
+ GPoint = GPr.CentreOfMass();
+ Len = GPr.Mass();
+ }
+
+ double dMidXYZ = GPoint.X() * 999.0 + GPoint.Y() * 99.0 + GPoint.Z() * 0.9;
+ return std::make_pair(dMidXYZ, Len);
+}
+
//=======================================================================
//function : GetPosition
//purpose :
(const TopoDS_Shape &theShape, Bnd_Box &theBox)
{
if ( theBox.IsVoid() ) BRepBndLib::Add( theShape, theBox );
+ if ( theBox.IsVoid() ) return Standard_False;
Standard_Real aBound[6];
theBox.Get(aBound[0], aBound[2], aBound[4], aBound[1], aBound[3], aBound[5]);
// function : ConvertTreeToString()
// purpose : Returns the string representation of dependency tree
//=======================================================================
-void GEOMUtils::ConvertTreeToString( const TreeModel &tree,
- std::string &treeStr )
+void GEOMUtils::ConvertTreeToString( const TreeModel& tree,
+ std::string& dependencyStr )
{
TreeModel::const_iterator i;
for ( i = tree.begin(); i != tree.end(); ++i ) {
- treeStr.append( i->first );
- treeStr.append( "-" );
+ dependencyStr.append( i->first );
+ dependencyStr.append( "-" );
std::vector<LevelInfo> upLevelList = i->second.first;
- treeStr.append( "upward" );
- parseWard( upLevelList, treeStr );
+ dependencyStr.append( "upward" );
+ parseWard( upLevelList, dependencyStr );
std::vector<LevelInfo> downLevelList = i->second.second;
- treeStr.append( "downward" );
- parseWard( downLevelList, treeStr );
+ dependencyStr.append( "downward" );
+ parseWard( downLevelList, dependencyStr );
}
}
// function : ConvertStringToTree()
// purpose : Returns the dependency tree
//=======================================================================
-void GEOMUtils::ConvertStringToTree( const std::string &theData,
- TreeModel &tree )
+void GEOMUtils::ConvertStringToTree( const std::string& dependencyStr,
+ TreeModel& tree )
{
std::size_t cursor = 0;
- while( theData.find('-',cursor) != std::string::npos ) //find next selected object
+ while( dependencyStr.find('-',cursor) != std::string::npos ) //find next selected object
{
- std::size_t objectIndex = theData.find( '-', cursor );
- std::string objectEntry = theData.substr( cursor, objectIndex - cursor );
+ std::size_t objectIndex = dependencyStr.find( '-', cursor );
+ std::string objectEntry = dependencyStr.substr( cursor, objectIndex - cursor );
cursor = objectIndex;
- std::size_t upwardIndexBegin = theData.find("{",cursor) + 1;
- std::size_t upwardIndexFinish = theData.find("}",upwardIndexBegin);
- LevelsList upwardList = parseWard( theData, cursor );
+ std::size_t upwardIndexBegin = dependencyStr.find("{",cursor) + 1;
+ std::size_t upwardIndexFinish = dependencyStr.find("}",upwardIndexBegin);
+ LevelsList upwardList = parseWard( dependencyStr, cursor );
- LevelsList downwardList = parseWard( theData, cursor );
+ LevelsList downwardList = parseWard( dependencyStr, cursor );
tree[objectEntry] = std::pair<LevelsList,LevelsList>( upwardList, downwardList );
}
}
+
+bool GEOMUtils::CheckShape( TopoDS_Shape& shape,
+ bool checkGeometry )
+{
+ BRepCheck_Analyzer analyzer( shape, checkGeometry );
+ return analyzer.IsValid();
+}
+
+bool GEOMUtils::FixShapeTolerance( TopoDS_Shape& shape,
+ TopAbs_ShapeEnum type,
+ Standard_Real tolerance,
+ bool checkGeometry )
+{
+ ShapeFix_ShapeTolerance aSft;
+ aSft.LimitTolerance( shape, tolerance, tolerance, type );
+ Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape( shape );
+ aSfs->Perform();
+ shape = aSfs->Shape();
+ return CheckShape( shape, checkGeometry );
+}
+
+bool GEOMUtils::FixShapeTolerance( TopoDS_Shape& shape,
+ Standard_Real tolerance,
+ bool checkGeometry )
+{
+ return FixShapeTolerance( shape, TopAbs_SHAPE, tolerance, checkGeometry );
+}
+
+bool GEOMUtils::FixShapeTolerance( TopoDS_Shape& shape,
+ bool checkGeometry )
+{
+ return FixShapeTolerance( shape, Precision::Confusion(), checkGeometry );
+}
+
+bool GEOMUtils::FixShapeCurves( TopoDS_Shape& shape )
+{
+ Standard_Real aT, aTolE, aD, aDMax;
+ TopExp_Explorer aExpF, aExpE;
+ NCollection_DataMap<TopoDS_Edge, Standard_Real, TopTools_ShapeMapHasher> aDMETol;
+ aExpF.Init(shape, TopAbs_FACE);
+ for (; aExpF.More(); aExpF.Next()) {
+ const TopoDS_Face& aF = *(TopoDS_Face*)&aExpF.Current();
+ aExpE.Init(aF, TopAbs_EDGE);
+ for (; aExpE.More(); aExpE.Next()) {
+ const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExpE.Current();
+ try {
+ if (!BOPTools_AlgoTools::ComputeTolerance(aF, aE, aDMax, aT)) {
+ continue;
+ }
+ }
+ catch(...) {
+ continue;
+ }
+ aTolE = BRep_Tool::Tolerance(aE);
+ if (aDMax < aTolE) continue;
+ if (aDMETol.IsBound(aE)) {
+ aD = aDMETol.Find(aE);
+ if (aDMax > aD) {
+ aDMETol.UnBind(aE);
+ aDMETol.Bind(aE, aDMax);
+ }
+ }
+ else {
+ aDMETol.Bind(aE, aDMax);
+ }
+ }
+ }
+ NCollection_DataMap<TopoDS_Edge, Standard_Real, TopTools_ShapeMapHasher>::Iterator aDMETolIt(aDMETol);
+#ifdef USE_LIMIT_TOLERANCE
+ ShapeFix_ShapeTolerance sat;
+#else
+ BRep_Builder b;
+#endif
+ for (; aDMETolIt.More(); aDMETolIt.Next()) {
+#ifdef USE_LIMIT_TOLERANCE
+ sat.LimitTolerance(aDMETolIt.Key(), aDMETolIt.Value()*1.001);
+#else
+ TopoDS_Iterator itv(aDMETolIt.Key());
+ for (; itv.More(); itv.Next())
+ b.UpdateVertex(TopoDS::Vertex(itv.Value()), aDMETolIt.Value()*1.001);
+ b.UpdateEdge(aDMETolIt.Key(), aDMETolIt.Value()*1.001);
+#endif
+ }
+ return CheckShape( shape );
+}
+
+bool GEOMUtils::Write( const TopoDS_Shape& shape, const char* fileName )
+{
+ return BRepTools::Write( shape, fileName );
+}
+
+TopoDS_Shape GEOMUtils::ReduceCompound( const TopoDS_Shape& shape )
+{
+ TopoDS_Shape result = shape;
+
+ if ( shape.ShapeType() == TopAbs_COMPOUND ||
+ shape.ShapeType() == TopAbs_COMPSOLID ) {
+
+ TopTools_ListOfShape l;
+
+ TopoDS_Iterator it ( shape );
+ for ( ; it.More(); it.Next() )
+ l.Append( it.Value() );
+ if ( l.Extent() == 1 && l.First() != shape )
+ result = ReduceCompound( l.First() );
+ }
+
+ return result;
+}
+
+void GEOMUtils::MeshShape( const TopoDS_Shape shape,
+ double deflection, bool theForced )
+{
+ Standard_Real aDeflection = ( deflection <= 0 ) ? DefaultDeflection() : deflection;
+
+ // Is shape triangulated?
+ Standard_Boolean alreadyMeshed = true;
+ TopExp_Explorer ex;
+ TopLoc_Location aLoc;
+ for ( ex.Init( shape, TopAbs_FACE ); ex.More() && alreadyMeshed; ex.Next() ) {
+ const TopoDS_Face& aFace = TopoDS::Face( ex.Current() );
+ Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation( aFace, aLoc );
+ alreadyMeshed = !aPoly.IsNull();
+ }
+
+ if ( !alreadyMeshed || theForced ) {
+ // Compute bounding box
+ Bnd_Box B;
+ BRepBndLib::Add( shape, B );
+ if ( B.IsVoid() )
+ return; // NPAL15983 (Bug when displaying empty groups)
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ B.Get( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax );
+
+ // This magic line comes from Prs3d_ShadedShape.gxx in OCCT
+ aDeflection = MAX3(aXmax-aXmin, aYmax-aYmin, aZmax-aZmin) * aDeflection * 4;
+
+ // Clean triangulation before compute incremental mesh
+ BRepTools::Clean( shape );
+
+ // Compute triangulation
+ BRepMesh_IncrementalMesh mesh( shape, aDeflection );
+ }
+}
+
+double GEOMUtils::DefaultDeflection()
+{
+ return 0.001;
+}
+
+//=======================================================================
+//function : IsOpenPath
+//purpose :
+//=======================================================================
+bool GEOMUtils::IsOpenPath(const TopoDS_Shape &theShape)
+{
+ bool isOpen = true;
+
+ if (theShape.IsNull() == Standard_False) {
+ if (theShape.Closed()) {
+ // The shape is closed
+ isOpen = false;
+ } else {
+ const TopAbs_ShapeEnum aType = theShape.ShapeType();
+
+ if (aType == TopAbs_EDGE || aType == TopAbs_WIRE) {
+ // Check if path ends are coinsident.
+ TopoDS_Vertex aV[2];
+
+ if (aType == TopAbs_EDGE) {
+ // Edge
+ TopExp::Vertices(TopoDS::Edge(theShape), aV[0], aV[1]);
+ } else {
+ // Wire
+ TopExp::Vertices(TopoDS::Wire(theShape), aV[0], aV[1]);
+ }
+
+ if (aV[0].IsNull() == Standard_False &&
+ aV[1].IsNull() == Standard_False) {
+ if (aV[0].IsSame(aV[1])) {
+ // The shape is closed
+ isOpen = false;
+ } else {
+ const Standard_Real aTol1 = BRep_Tool::Tolerance(aV[0]);
+ const Standard_Real aTol2 = BRep_Tool::Tolerance(aV[1]);
+ const gp_Pnt aPnt1 = BRep_Tool::Pnt(aV[0]);
+ const gp_Pnt aPnt2 = BRep_Tool::Pnt(aV[1]);
+
+ if (aPnt1.Distance(aPnt2) <= aTol1 + aTol2) {
+ // The shape is closed
+ isOpen = false;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return isOpen;
+}
+
+//=======================================================================
+//function : CompareToleranceValues
+//purpose :
+//=======================================================================
+int GEOMUtils::CompareToleranceValues(const double theTolShape,
+ const double theTolRef)
+{
+ const double aTolTol = Min(DEFAULT_MAX_TOLERANCE_TOLERANCE,
+ theTolRef*DEFAULT_TOLERANCE_TOLERANCE);
+
+ int aResult = 0;
+
+ if (theTolShape < theTolRef - aTolTol) {
+ aResult = -1;
+ } else if (theTolShape > theTolRef + aTolTol) {
+ aResult = 1;
+ }
+
+ return aResult;
+}
+
+//=======================================================================
+//function : IsFitCondition
+//purpose :
+//=======================================================================
+bool GEOMUtils::IsFitCondition(const ComparisonCondition theCondition,
+ const double theTolShape,
+ const double theTolRef)
+{
+ const int aCompValue = CompareToleranceValues(theTolShape, theTolRef);
+ bool isFit = false;
+
+ switch (theCondition) {
+ case CC_GT:
+ isFit = aCompValue == 1;
+ break;
+ case GEOMUtils::CC_GE:
+ isFit = aCompValue != -1;
+ break;
+ case GEOMUtils::CC_LT:
+ isFit = aCompValue == -1;
+ break;
+ case GEOMUtils::CC_LE:
+ isFit = aCompValue != 1;
+ break;
+ default:
+ break;
+ }
+
+ return isFit;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
namespace GEOMUtils
{
+ /**
+ * This enumeration represents comparison conditions.
+ */
+ enum ComparisonCondition {
+ CC_GT, ///< Greater then
+ CC_GE, ///< Greater then or equal to
+ CC_LT, ///< Less then
+ CC_LE ///< Less then or equal to
+ };
+
typedef std::vector<std::string> NodeLinks;
typedef std::map<std::string, NodeLinks> LevelInfo;
typedef std::vector<LevelInfo> LevelsList;
typedef std::map<std::string,std::pair<LevelsList,LevelsList> > TreeModel;
+ /*!
+ * \brief Compute numerical functor for the shape.
+ *
+ * Resulting value can be used to sort out shapes according to some parameter.
+ *
+ * Returns a pair of two values (dist, functor) where
+ * - \a dist is a some value that is computed according to the center of mass of given shape;
+ * - \a functor is a numerical functor value
+ *
+ * The numerical functor is computed according to the shape's topological properties as follows:
+ * - orientation for vertices
+ * - length for edges and wires
+ * - area for faces and shells
+ * - volume for solids, compounds, compsolids
+ *
+ * If \a isOldSorting parameter is set to \c true, for all cases linear properties of the shape
+ * are used (to support backward compatibility in some methods). By default, this parameter is
+ * set to \c false.
+ */
+ Standard_EXPORT std::pair<double, double> ShapeToDouble (const TopoDS_Shape& theShape,
+ bool isOldSorting = false);
+
/*!
* \brief Get Local Coordinate System, corresponding to the given shape.
*
*/
Standard_EXPORT gp_Pnt ConvertClickToPoint( int x, int y, Handle(V3d_View) theView );
- Standard_EXPORT void ConvertTreeToString( const TreeModel &theTree,
- std::string &DependencyStr );
+ /*!
+ * \brief Convert dependency tree data to the string representation
+ *
+ * \param tree dependency tree data
+ * \param dependencyStr output string
+ */
+ Standard_EXPORT void ConvertTreeToString( const TreeModel& tree,
+ std::string& dependencyStr );
+
+ /*!
+ * \brief Restore dependency tree data from the string representation
+ *
+ * \param dependencyStr string representation of tree data
+ * \param tree output dependency tree data
+ */
+ Standard_EXPORT void ConvertStringToTree( const std::string& dependencyStr,
+ TreeModel& tree );
+
+ /*!
+ * \brief Check shape
+ *
+ * \param shape input shape object
+ * \param checkGeometry when set to \c true, causes check of underlying geometry
+ * in addition to the topology
+ * \return \c true if shape is valid or \c false otherwise
+ */
+ Standard_EXPORT bool CheckShape( TopoDS_Shape& shape, bool checkGeometry = false );
+
+ /*!
+ * \brief Limit shape tolerance to the given value
+ *
+ * \param shape shape being fixed
+ * \param type topology type which tolerance is to be limited; TopAbs_SHAPE means
+ * all types of topology
+ * \param tolerance expected tolerance value (1e-7 by default)
+ * \param checkGeometry check geometry validity of result
+ * \return \c true if resulting shape is valid
+ *
+ * \note Resulting tolerance of the shape is not mandatory equal to requested value
+ * as it might be changed by fixshape operation in order to get valid shape where possible
+ * \note By default, result only checked for topology validity; check of geometry can be done by
+ * passing \c true to \a checkGeometry parameter
+ */
+ Standard_EXPORT bool FixShapeTolerance( TopoDS_Shape& shape,
+ TopAbs_ShapeEnum type,
+ Standard_Real tolerance = Precision::Confusion(),
+ bool checkGeometry = false );
- Standard_EXPORT void ConvertStringToTree( const std::string &theDependencyStr,
- TreeModel &tree );
+ /*!
+ * \brief Limit shape tolerance to the given value
+ * This is overloaded function, it behaves exactly as previous one
+ */
+ Standard_EXPORT bool FixShapeTolerance( TopoDS_Shape& shape,
+ Standard_Real tolerance = Precision::Confusion(),
+ bool checkGeometry = false );
+
+ /*!
+ * \brief Limit shape tolerance to the given value
+ * This is overloaded function, it behaves exactly as previous one
+ */
+ Standard_EXPORT bool FixShapeTolerance( TopoDS_Shape& shape,
+ bool checkGeometry );
+
+ /*!
+ * \brief Fix curves of the given shape
+ *
+ * The function checks each curve of the input shape in the following way:
+ * - compute deviation of the curve from the underlying surface in a set of points
+ * computed with the certain discretization step value
+ * - find maximum tolerance between computed deviation values
+ * - limit tolerance of the curve with the computed maximum value
+ *
+ * \param shape shape being fixed
+ * \return \c true if resulting shape is valid
+ */
+ Standard_EXPORT bool FixShapeCurves( TopoDS_Shape& shape );
+
+ /*!
+ * \brief Write shape to the BREP file
+ *
+ * \param source shape
+ * \return \c true if file was written or \c false otherwise
+ */
+ Standard_EXPORT bool Write( const TopoDS_Shape& shape,
+ const char* fileName );
+
+ /*!
+ * \brief Extract single SOLID from COMPSOLID or COMPOUND.
+ *
+ * If the argument shape is a COMPUND or COMPSOLID and there's
+ * only single simple-shape type inside, this sub-shape is returned as a result;
+ * otherwise, the shape is not changed.
+ *
+ * \param shape compound or compsolid being processed.
+ * \retval TopoDS_Shape resulting shape
+ */
+ Standard_EXPORT TopoDS_Shape ReduceCompound( const TopoDS_Shape& shape );
+
+ /*!
+ * \brief Generate triangulation for the shape.
+ *
+ * \param shape shape being meshed
+ * \param deflection deflection coefficient to be used
+ * \param forced if \c true, causes generation of mesh regardless it is already present in the shape
+ */
+ Standard_EXPORT void MeshShape( const TopoDS_Shape shape,
+ double deflection, bool forced = true );
+
+ /*!
+ * \brief Get default deflection coefficient used for triangulation
+ * \return default deflection value
+ */
+ Standard_EXPORT double DefaultDeflection();
+
+ /**
+ * \brief Check if the shape is not a closed wire or edge.
+ *
+ * This function is used for pipe creation algorithm to test if
+ * the pipe path is not closed. It returns false if theShape is a wire or
+ * an edge with coincident end vertices. Otherwise it returns true.
+ *
+ * \param theShape the shape to be tested.
+ * \return true if theShape is not a closed wire or edge.
+ */
+ Standard_EXPORT bool IsOpenPath(const TopoDS_Shape &theShape);
+
+ /**
+ * This function compares two tolerances. The shape tolerance (the first
+ * argument) is considered less than the reference tolerance (the second
+ * argument) if theTolShape < theTolRef - Tolerance(theTolRef). theTolShape is
+ * considered greater than theTolRef if theTolShape > theTolRef +
+ * Tolerance(theTolRef). Otherwise these tolerances are equal.
+ * Tolerance(theTolRef) = theTolRef*DEFAULT_TOLERANCE_TOLERANCE. But this value
+ * should not be greated than DEFAULT_MAX_TOLERANCE_TOLERANCE.
+ *
+ * \param theTolShape the shape tolerance
+ * \param theTolRef the reference tolerance
+ * \return -1 if theTolShape is less than theTolRef; 1 if theTolShape is greater
+ * than theTolRef; 0 if they are equal
+ */
+ Standard_EXPORT int CompareToleranceValues(const double theTolShape,
+ const double theTolRef);
+
+ /**
+ * Check if the comarison of tolerances fit the condition. The comparison of
+ * tolerances is performed using the function CompareToleranceValues.
+ *
+ * \param theCondition the condition
+ * \param theTolShape the shape tolerance
+ * \param theTolRef the reference tolerance
+ * \return true if the shape tolerance fits the condition; false otherwise.
+ */
+ Standard_EXPORT bool IsFitCondition(const ComparisonCondition theCondition,
+ const double theTolShape,
+ const double theTolRef);
};
--- /dev/null
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 <GEOMUtils_HTrsfCurve2d.hxx>
+
+namespace GEOMUtils {
+ IMPLEMENT_STANDARD_HANDLE (HTrsfCurve2d, Adaptor2d_HCurve2d);
+ IMPLEMENT_STANDARD_RTTIEXT(HTrsfCurve2d, Adaptor2d_HCurve2d);
+}
+
+//=======================================================================
+//function : TrsfCurve2d
+//purpose :
+//=======================================================================
+GEOMUtils::HTrsfCurve2d::HTrsfCurve2d(const Handle(Geom2d_Curve) &theCurve,
+ const Trsf2d &theTrsf)
+: myCurve (theCurve, theTrsf)
+{
+}
+
+//=======================================================================
+//function : TrsfCurve2d
+//purpose :
+//=======================================================================
+GEOMUtils::HTrsfCurve2d::HTrsfCurve2d(const Handle(Geom2d_Curve) &theCurve,
+ const Standard_Real theUFirst,
+ const Standard_Real theULast,
+ const Trsf2d &theTrsf)
+: myCurve (theCurve, theUFirst, theULast, theTrsf)
+{
+}
--- /dev/null
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 _GEOMUtils_HTrsfCurve2d_HXX_
+#define _GEOMUtils_HTrsfCurve2d_HXX_
+
+
+#include <GEOMUtils_TrsfCurve2d.hxx>
+
+#include <Adaptor2d_HCurve2d.hxx>
+
+
+namespace GEOMUtils
+{
+
+ class HTrsfCurve2d;
+
+ DEFINE_STANDARD_HANDLE(HTrsfCurve2d, Adaptor2d_HCurve2d);
+
+ /*!
+ * This class represents an adaptor curve that represents an original curve
+ * transformed by an anisotropic transformation. This is a class manipulated
+ * by handle.
+ */
+ class HTrsfCurve2d : public Adaptor2d_HCurve2d
+ {
+
+ public:
+
+ /**
+ * Constructor. Initializes the object with the transformation parameters.
+ * Input parameters are not checked for validity. It is under responsibility
+ * of the caller.
+ */
+ Standard_EXPORT HTrsfCurve2d(const Handle(Geom2d_Curve) &theCurve,
+ const Trsf2d &theTrsf);
+
+ /**
+ * Constructor. Initializes the object with the curve, first and last
+ * parameters and transformation. Input parameters are not checked
+ * for validity. It is under responsibility of the caller.
+ */
+ Standard_EXPORT HTrsfCurve2d(const Handle(Geom2d_Curve) &theCurve,
+ const Standard_Real theUFirst,
+ const Standard_Real theULast,
+ const Trsf2d &theTrsf);
+
+ /**
+ * Redefined method from the base class.
+ */
+ const Adaptor2d_Curve2d &Curve2d() const
+ { return myCurve; }
+
+ private:
+
+ TrsfCurve2d myCurve;
+
+ public:
+
+ DEFINE_STANDARD_RTTI(HTrsfCurve2d);
+
+ };
+}
+
+#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
--- /dev/null
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+// File : GEOMUtils_ShapeStatisticsDlg.cxx
+// Author : Alexander KOVALEV, OPEN CASCADE S.A.S.
+
+#include "GEOMUtils_ShapeStatistics.hxx"
+
+#include <BRepGProp.hxx>
+#include <GProp_GProps.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
+namespace GEOMUtils
+{
+//=================================================================================
+// function : ComputeMeasures()
+// purpose : gets measures of the given type for list of shapes in the range
+//=================================================================================
+ std::map<int,double> ComputeMeasures( std::list<TopoDS_Shape> shapes,
+ TopAbs_ShapeEnum entity,
+ Range &range)
+{
+ bool hasRange = (range.min != -1.0); // -1.0 means that range must not be used
+ if ( !hasRange )
+ range.min = 1e+32, range.max = 0.0;
+ // list of measures of entities
+ std::map<int, double> measures;
+
+ std::list<TopoDS_Shape>::const_iterator it;
+ int shift = 0;
+ for ( it = shapes.begin(); it != shapes.end(); ++it ) {
+ double aMeasure;
+ TopTools_IndexedMapOfShape aSubShapesMap;
+ TopExp::MapShapes(*it, aSubShapesMap); // map of all global indices
+ TopTools_IndexedMapOfShape aMx;
+ TopExp::MapShapes( *it, entity, aMx ); // map of current type sub-shape indices
+ int aNbS = aMx.Extent();
+ int index = -1;
+ for ( int i = 1; i <= aNbS; ++i ) {
+ aMeasure = 0.0;
+ const TopoDS_Shape& aSubShape = aMx( i );
+ //Get the measure: length, area or volume
+ GProp_GProps LProps, SProps, VProps;
+ if ( entity == TopAbs_EDGE ) {
+ BRepGProp::LinearProperties( aSubShape, LProps );
+ aMeasure = LProps.Mass();
+ } else if ( entity == TopAbs_FACE ) {
+ BRepGProp::SurfaceProperties( aSubShape, SProps );
+ aMeasure = SProps.Mass();
+ } else if ( entity == TopAbs_SOLID ) {
+ BRepGProp::VolumeProperties( aSubShape, VProps );
+ aMeasure = VProps.Mass();
+ }
+ // Don't pass sub-shapes with out of range measure, if range is used
+ if ( hasRange ) {
+ if ( aMeasure < range.min || aMeasure > range.max )
+ continue;
+ } else {
+ // get range min and max
+ if ( aMeasure < range.min ) range.min = aMeasure;
+ if ( aMeasure > range.max ) range.max = aMeasure;
+ }
+ // get global index of sub-shape
+ index = aSubShapesMap.FindIndex( aSubShape );
+ // keep measures to distribute it
+ measures[shift+index] = aMeasure;
+ }
+ shift += aSubShapesMap.Extent();
+ }
+ return measures;
+}
+
+//=================================================================================
+// function : ComputeDistribution()
+// purpose : gets distribution data for single shape
+//=================================================================================
+Distribution ComputeDistribution( TopoDS_Shape shape,
+ TopAbs_ShapeEnum entity,
+ int intervals,
+ Range range)
+{
+ std::list<TopoDS_Shape> aShapes;
+ aShapes.push_back( shape );
+ return ComputeDistribution( aShapes, entity, intervals, range );
+}
+
+//=================================================================================
+// function : ComputeDistribution()
+// purpose : gets distribution data for list of shapes
+//=================================================================================
+Distribution ComputeDistribution( std::list<TopoDS_Shape> shapes,
+ TopAbs_ShapeEnum entity,
+ int nbIntervals,
+ Range range)
+{
+ // get list of measures and compute range (if it was not specified)
+ std::map<int,double> measures = ComputeMeasures( shapes, entity, range );
+
+ // compute a step
+ double aStep = (range.max - range.min) / nbIntervals;
+
+ // compute distribution in intervals
+ Distribution aDistr;
+ std::map<int,double>::iterator dit;
+ for ( int i = 0; i < nbIntervals; i++ ) {
+ Range localRange; // range of current interval
+ localRange.min = range.min + ( i * aStep );
+ localRange.max = range.min + ( (i+1) * aStep );
+ localRange.count = 0;
+
+ std::vector<int> indicesToErase;
+ for ( dit = measures.begin(); dit != measures.end(); dit++ ) {
+ if ( ( dit->second >= localRange.min && dit->second < localRange.max ) ||
+ ( i == nbIntervals-1 && dit->second == localRange.max ) ) {
+ localRange.count++;
+ localRange.indices.push_back( dit->first );
+ // measure is in interval, so remove it from map of search
+ indicesToErase.push_back( dit->first );
+ }
+ }
+ aDistr.push_back( localRange );
+ for( int j=0; j < indicesToErase.size(); j++ )
+ measures.erase( indicesToErase[j] );
+ }
+
+ return aDistr;
+}
+
+} //namespace GEOMUtils
--- /dev/null
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+// File : GEOMUtils_ShapeStatisticsDlg.hxx
+// Author : Alexander KOVALEV, OPEN CASCADE S.A.S.
+
+#ifndef _GEOMUtils_ShapeStatistics_HXX_
+#define _GEOMUtils_ShapeStatistics_HXX_
+
+#include <list>
+#include <map>
+#include <vector>
+
+#include <TopoDS_Shape.hxx>
+
+namespace GEOMUtils
+{
+ // struct to store range data
+ typedef struct { double min; double max; long count; std::list<long> indices; } Range;
+ // distribution is a set of ranges
+ typedef std::vector<Range> Distribution;
+
+ // function to get measures of entities and compute range for list of shapes
+ Standard_EXPORT std::map<int,double> ComputeMeasures(
+ std::list<TopoDS_Shape> shapes,
+ TopAbs_ShapeEnum entity,
+ Range &range );
+
+ // function to get distribution data for single shape
+ Standard_EXPORT Distribution ComputeDistribution(
+ TopoDS_Shape shape,
+ TopAbs_ShapeEnum entity,
+ int intervals,
+ Range range );
+
+ // function to get distribution data for list of shapes
+ Standard_EXPORT Distribution ComputeDistribution(
+ std::list<TopoDS_Shape> shapes,
+ TopAbs_ShapeEnum entity,
+ int intervals,
+ Range range );
+
+}
+
+#endif // _GEOMUtils_ShapeStatistics_HXX_
--- /dev/null
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 <GEOMUtils_Trsf2d.hxx>
+
+
+//=======================================================================
+//function : Trsf2d
+//purpose :
+//=======================================================================
+GEOMUtils::Trsf2d::Trsf2d(const Standard_Real a11,
+ const Standard_Real a12,
+ const Standard_Real a13,
+ const Standard_Real a21,
+ const Standard_Real a22,
+ const Standard_Real a23)
+: myA11(a11),
+ myA12(a12),
+ myA13(a13),
+ myA21(a21),
+ myA22(a22),
+ myA23(a23)
+{
+}
+
+//=======================================================================
+//function : TransformD0
+//purpose :
+//=======================================================================
+void GEOMUtils::Trsf2d::TransformD0(gp_Pnt2d &thePnt) const
+{
+ const Standard_Real aX = myA11*thePnt.X() + myA12*thePnt.Y() + myA13;
+ const Standard_Real aY = myA21*thePnt.X() + myA22*thePnt.Y() + myA23;
+
+ thePnt.SetCoord(aX, aY);
+}
+
+//=======================================================================
+//function : TransformD1
+//purpose :
+//=======================================================================
+void GEOMUtils::Trsf2d::TransformD1(gp_Pnt2d &thePnt,
+ gp_Vec2d &theVec1) const
+{
+ TransformVector(thePnt, theVec1);
+ TransformD0(thePnt);
+}
+
+//=======================================================================
+//function : TransformD2
+//purpose :
+//=======================================================================
+void GEOMUtils::Trsf2d::TransformD2(gp_Pnt2d &thePnt,
+ gp_Vec2d &theVec1,
+ gp_Vec2d &theVec2) const
+{
+ TransformVector(thePnt, theVec1);
+ TransformVector(thePnt, theVec2);
+ TransformD0(thePnt);
+}
+
+//=======================================================================
+//function : TransformD3
+//purpose :
+//=======================================================================
+void GEOMUtils::Trsf2d::TransformD3(gp_Pnt2d &thePnt,
+ gp_Vec2d &theVec1,
+ gp_Vec2d &theVec2,
+ gp_Vec2d &theVec3) const
+{
+ TransformVector(thePnt, theVec1);
+ TransformVector(thePnt, theVec2);
+ TransformVector(thePnt, theVec3);
+ TransformD0(thePnt);
+}
+
+//=======================================================================
+//function : TransformVector
+//purpose :
+//=======================================================================
+void GEOMUtils::Trsf2d::TransformVector(const gp_Pnt2d &thePnt,
+ gp_Vec2d &theVec) const
+{
+ gp_Pnt2d aP0(thePnt.XY());
+ gp_Pnt2d aP1(thePnt.XY().Added(theVec.XY()));
+
+ TransformD0(aP0);
+ TransformD0(aP1);
+ theVec.SetXY(aP1.XY().Subtracted(aP0.XY()));
+}
--- /dev/null
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 _GEOMUtils_Trsf2d_HXX_
+#define _GEOMUtils_Trsf2d_HXX_
+
+
+#include <Geom2dHatch_Hatcher.hxx>
+#include <GeomAbs_IsoType.hxx>
+#include <TColStd_HArray1OfInteger.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <TopoDS_Face.hxx>
+
+
+/*!
+ * This class represents a non-persistent transformation in 2D space.
+ * The transformations can be represented as follow :
+ *
+ * V1 V2 T XY XY
+ * | a11 a12 a13 | | x | | x'|
+ * | a21 a22 a23 | | y | | y'|
+ * | 0 0 1 | | 1 | | 1 |
+
+ * where {V1, V2} defines the vectorial part of the transformation
+ * and T defines the translation part of the transformation.
+ * This transformation can change the nature of the objects if it is
+ * anisotropic.
+ */
+namespace GEOMUtils
+{
+ class Trsf2d
+ {
+
+ public:
+
+ /**
+ * Constructor. Initializes the object with the transformation parameters.
+ * Input parameters are not checked for validity. It is under responsibility
+ * of the caller.
+ */
+ Standard_EXPORT Trsf2d(const Standard_Real a11,
+ const Standard_Real a12,
+ const Standard_Real a13,
+ const Standard_Real a21,
+ const Standard_Real a22,
+ const Standard_Real a23);
+
+ /**
+ * Transform the point. The passed parameter is modified to have
+ * a transformed value.
+ *
+ * \param thePnt the point.
+ */
+ Standard_EXPORT void TransformD0(gp_Pnt2d &thePnt)const;
+
+ /**
+ * Transform the point and the first derivative vector. The passed
+ * parameters are modified to have a transformed value.
+ *
+ * \param thePnt the point.
+ * \param theVec1 the first derivative vector.
+ */
+ Standard_EXPORT void TransformD1(gp_Pnt2d &thePnt,
+ gp_Vec2d &theVec1) const;
+
+ /**
+ * Transform the point, the first and second derivative vectors. The passed
+ * parameters are modified to have a transformed value.
+ *
+ * \param thePnt the point.
+ * \param theVec1 the first derivative vector.
+ * \param theVec2 the second derivative vector.
+ */
+ Standard_EXPORT void TransformD2(gp_Pnt2d &thePnt,
+ gp_Vec2d &theVec1,
+ gp_Vec2d &theVec2) const;
+
+ /**
+ * Transform the point, the first, second and third derivative vectors.
+ * The passed parameters are modified to have a transformed value.
+ *
+ * \param thePnt the point.
+ * \param theVec1 the first derivative vector.
+ * \param theVec2 the second derivative vector.
+ * \param theVec2 the third derivative vector.
+ */
+ Standard_EXPORT void TransformD3(gp_Pnt2d &thePnt,
+ gp_Vec2d &theVec1,
+ gp_Vec2d &theVec2,
+ gp_Vec2d &theVec3) const;
+
+ private:
+
+ /**
+ * Transform the vector.
+ *
+ * \param thePnt the point.
+ * \param theVec the vector.
+ */
+ void TransformVector(const gp_Pnt2d &thePnt,
+ gp_Vec2d &theVec) const;
+
+ private:
+
+ Standard_Real myA11;
+ Standard_Real myA12;
+ Standard_Real myA13;
+ Standard_Real myA21;
+ Standard_Real myA22;
+ Standard_Real myA23;
+
+ };
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 <GEOMUtils_TrsfCurve2d.hxx>
+#include <GEOMUtils_HTrsfCurve2d.hxx>
+
+//=======================================================================
+//function : TrsfCurve2d
+//purpose :
+//=======================================================================
+GEOMUtils::TrsfCurve2d::TrsfCurve2d(const Handle(Geom2d_Curve) &theCurve,
+ const Trsf2d &theTrsf)
+: myCurve (theCurve),
+ myTrsf (theTrsf)
+{
+}
+
+//=======================================================================
+//function : TrsfCurve2d
+//purpose :
+//=======================================================================
+GEOMUtils::TrsfCurve2d::TrsfCurve2d(const Handle(Geom2d_Curve) &theCurve,
+ const Standard_Real theUFirst,
+ const Standard_Real theULast,
+ const Trsf2d &theTrsf)
+: myCurve (theCurve, theUFirst, theULast),
+ myTrsf (theTrsf)
+{
+}
+
+//=======================================================================
+//function : FirstParameter
+//purpose :
+//=======================================================================
+Standard_Real GEOMUtils::TrsfCurve2d::FirstParameter() const
+{
+ return myCurve.FirstParameter();
+}
+
+//=======================================================================
+//function : LastParameter
+//purpose :
+//=======================================================================
+Standard_Real GEOMUtils::TrsfCurve2d::LastParameter() const
+{
+ return myCurve.LastParameter();
+}
+
+//=======================================================================
+//function : Curve
+//purpose :
+//=======================================================================
+const Handle(Geom2d_Curve) &GEOMUtils::TrsfCurve2d::Curve() const
+{
+ return myCurve.Curve();
+}
+
+//=======================================================================
+//function : GetType
+//purpose :
+//=======================================================================
+GeomAbs_CurveType GEOMUtils::TrsfCurve2d::GetType() const
+{
+ return GeomAbs_OtherCurve;
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void GEOMUtils::TrsfCurve2d::Load(const Handle(Geom2d_Curve) &C)
+{
+ myCurve.Load(C);
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void GEOMUtils::TrsfCurve2d::Load(const Handle(Geom2d_Curve) &C,
+ const Standard_Real UFirst,
+ const Standard_Real ULast)
+{
+ myCurve.Load(C, UFirst, ULast);
+}
+
+//=======================================================================
+//function : Continuity
+//purpose :
+//=======================================================================
+GeomAbs_Shape GEOMUtils::TrsfCurve2d::Continuity() const
+{
+ return myCurve.Continuity();
+}
+
+//=======================================================================
+//function : NbIntervals
+//purpose :
+//=======================================================================
+Standard_Integer GEOMUtils::TrsfCurve2d::NbIntervals
+ (const GeomAbs_Shape S) const
+{
+ return myCurve.NbIntervals(S);
+}
+
+//=======================================================================
+//function : Intervals
+//purpose :
+//=======================================================================
+void GEOMUtils::TrsfCurve2d::Intervals(TColStd_Array1OfReal &T,
+ const GeomAbs_Shape S) const
+{
+ myCurve.Intervals(T, S);
+}
+
+//=======================================================================
+//function : Trim
+//purpose :
+//=======================================================================
+Handle(Adaptor2d_HCurve2d) GEOMUtils::TrsfCurve2d::Trim
+ (const Standard_Real First, const Standard_Real Last,
+ const Standard_Real /*Tol*/) const
+{
+ Handle(Geom2d_Curve) aCurve = myCurve.Curve();
+ GEOMUtils::Handle(HTrsfCurve2d) aAHCurve =
+ new GEOMUtils::HTrsfCurve2d(aCurve, First, Last, myTrsf);
+
+ return aAHCurve;
+}
+
+//=======================================================================
+//function : IsClosed
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMUtils::TrsfCurve2d::IsClosed() const
+{
+ return myCurve.IsClosed();
+}
+
+//=======================================================================
+//function : IsPeriodic
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMUtils::TrsfCurve2d::IsPeriodic() const
+{
+ return myCurve.IsPeriodic();
+}
+
+//=======================================================================
+//function : Period
+//purpose :
+//=======================================================================
+Standard_Real GEOMUtils::TrsfCurve2d::Period() const
+{
+ return myCurve.Period();
+}
+
+//=======================================================================
+//function : Value
+//purpose :
+//=======================================================================
+gp_Pnt2d GEOMUtils::TrsfCurve2d::Value(const Standard_Real U) const
+{
+ gp_Pnt2d aPnt = myCurve.Value(U);
+
+ myTrsf.TransformD0(aPnt);
+
+ return aPnt;
+}
+
+//=======================================================================
+//function : D0
+//purpose :
+//=======================================================================
+void GEOMUtils::TrsfCurve2d::D0(const Standard_Real U, gp_Pnt2d &P) const
+{
+ myCurve.D0(U, P);
+ myTrsf.TransformD0(P);
+}
+
+//=======================================================================
+//function : D1
+//purpose :
+//=======================================================================
+void GEOMUtils::TrsfCurve2d::D1(const Standard_Real U,
+ gp_Pnt2d &P, gp_Vec2d &V) const
+{
+ myCurve.D1(U, P, V);
+ myTrsf.TransformD1(P, V);
+}
+
+//=======================================================================
+//function : D2
+//purpose :
+//=======================================================================
+void GEOMUtils::TrsfCurve2d::D2(const Standard_Real U, gp_Pnt2d &P,
+ gp_Vec2d &V1, gp_Vec2d &V2) const
+{
+ myCurve.D2(U, P, V1, V2);
+ myTrsf.TransformD2(P, V1, V2);
+}
+
+//=======================================================================
+//function : D3
+//purpose :
+//=======================================================================
+void GEOMUtils::TrsfCurve2d::D3(const Standard_Real U, gp_Pnt2d &P,
+ gp_Vec2d &V1, gp_Vec2d &V2, gp_Vec2d &V3) const
+{
+ myCurve.D3(U, P, V1, V2, V3);
+ myTrsf.TransformD3(P, V1, V2, V3);
+}
+
+//=======================================================================
+//function : DN
+//purpose :
+//=======================================================================
+gp_Vec2d GEOMUtils::TrsfCurve2d::DN(const Standard_Real U,
+ const Standard_Integer N) const
+{
+ gp_Pnt2d aPnt = myCurve.Value(U);
+ gp_Vec2d aVec = myCurve.DN(U, N);
+
+ myTrsf.TransformD1(aPnt, aVec);
+ return aVec;
+}
+
+//=======================================================================
+//function : Resolution
+//purpose :
+//=======================================================================
+Standard_Real GEOMUtils::TrsfCurve2d::Resolution(const Standard_Real Ruv) const
+{
+ return Precision::Parametric(Ruv);
+}
+
+//=======================================================================
+//function : Line
+//purpose :
+//=======================================================================
+gp_Lin2d GEOMUtils::TrsfCurve2d::Line() const
+{
+ Standard_NoSuchObject::Raise();
+
+ return gp_Lin2d();
+}
+
+//=======================================================================
+//function : Circle
+//purpose :
+//=======================================================================
+gp_Circ2d GEOMUtils::TrsfCurve2d::Circle() const
+{
+ Standard_NoSuchObject::Raise();
+
+ return gp_Circ2d();
+}
+
+//=======================================================================
+//function : Ellipse
+//purpose :
+//=======================================================================
+gp_Elips2d GEOMUtils::TrsfCurve2d::Ellipse() const
+{
+ Standard_NoSuchObject::Raise();
+
+ return gp_Elips2d();
+}
+
+//=======================================================================
+//function : Hyperbola
+//purpose :
+//=======================================================================
+gp_Hypr2d GEOMUtils::TrsfCurve2d::Hyperbola() const
+{
+ Standard_NoSuchObject::Raise();
+
+ return gp_Hypr2d();
+}
+
+//=======================================================================
+//function : Parabola
+//purpose :
+//=======================================================================
+gp_Parab2d GEOMUtils::TrsfCurve2d::Parabola() const
+{
+ Standard_NoSuchObject::Raise();
+
+ return gp_Parab2d();
+}
+
+//=======================================================================
+//function : Degree
+//purpose :
+//=======================================================================
+Standard_Integer GEOMUtils::TrsfCurve2d::Degree() const
+{
+ Standard_NoSuchObject::Raise();
+
+ return 0;
+}
+
+//=======================================================================
+//function : IsRational
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMUtils::TrsfCurve2d::IsRational() const
+{
+ return Standard_False;
+}
+
+//=======================================================================
+//function : NbPoles
+//purpose :
+//=======================================================================
+Standard_Integer GEOMUtils::TrsfCurve2d::NbPoles() const
+{
+ Standard_NoSuchObject::Raise();
+
+ return 0;
+}
+
+//=======================================================================
+//function : NbKnots
+//purpose :
+//=======================================================================
+Standard_Integer GEOMUtils::TrsfCurve2d::NbKnots() const
+{
+ Standard_NoSuchObject::Raise();
+
+ return 0;
+}
+
+//=======================================================================
+//function : Bezier
+//purpose :
+//=======================================================================
+Handle(Geom2d_BezierCurve) GEOMUtils::TrsfCurve2d::Bezier() const
+{
+ Standard_NoSuchObject::Raise();
+
+ return NULL;
+}
+
+//=======================================================================
+//function : BSpline
+//purpose :
+//=======================================================================
+Handle(Geom2d_BSplineCurve) GEOMUtils::TrsfCurve2d::BSpline() const
+{
+ Standard_NoSuchObject::Raise();
+
+ return NULL;
+}
+
+//=======================================================================
+//function : NbSamples
+//purpose :
+//=======================================================================
+Standard_Integer GEOMUtils::TrsfCurve2d::NbSamples() const
+{
+ return myCurve.NbSamples();
+}
--- /dev/null
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 _GEOMUtils_TrsfCurve2d_HXX_
+#define _GEOMUtils_TrsfCurve2d_HXX_
+
+
+#include <GEOMUtils_Trsf2d.hxx>
+
+#include <Geom2dHatch_Hatcher.hxx>
+#include <GeomAbs_IsoType.hxx>
+#include <TColStd_HArray1OfInteger.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <TopoDS_Face.hxx>
+
+
+namespace GEOMUtils
+{
+ /*!
+ * This class represents an adaptor curve that represents an original curve
+ * transformed by an anisotropic transformation.
+ */
+ class TrsfCurve2d : public Adaptor2d_Curve2d
+ {
+
+ public:
+
+ /**
+ * Constructor. Initializes the object with the transformation parameters.
+ * Input parameters are not checked for validity. It is under responsibility
+ * of the caller.
+ */
+ Standard_EXPORT TrsfCurve2d(const Handle(Geom2d_Curve) &theCurve,
+ const Trsf2d &theTrsf);
+
+ /**
+ * Constructor. Initializes the object with the curve, first and last
+ * parameters and transformation. Input parameters are not checked
+ * for validity. It is under responsibility of the caller.
+ */
+ Standard_EXPORT TrsfCurve2d(const Handle(Geom2d_Curve) &theCurve,
+ const Standard_Real theUFirst,
+ const Standard_Real theULast,
+ const Trsf2d &theTrsf);
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Standard_Real FirstParameter() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Standard_Real LastParameter() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT const Handle(Geom2d_Curve)& Curve() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT GeomAbs_CurveType GetType() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT void Load(const Handle(Geom2d_Curve) &C);
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT void Load(const Handle(Geom2d_Curve) &C,
+ const Standard_Real UFirst,
+ const Standard_Real ULast);
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT GeomAbs_Shape Continuity() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT void Intervals(TColStd_Array1OfReal &T,
+ const GeomAbs_Shape S) const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Handle(Adaptor2d_HCurve2d) Trim
+ (const Standard_Real First, const Standard_Real Last,
+ const Standard_Real ) const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Standard_Boolean IsClosed() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Standard_Boolean IsPeriodic() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Standard_Real Period() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT gp_Pnt2d Value(const Standard_Real U) const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT void D0(const Standard_Real U, gp_Pnt2d &P) const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT void D1(const Standard_Real U,
+ gp_Pnt2d &P, gp_Vec2d &V) const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT void D2(const Standard_Real U, gp_Pnt2d &P,
+ gp_Vec2d &V1, gp_Vec2d &V2) const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT void D3(const Standard_Real U, gp_Pnt2d &P,
+ gp_Vec2d &V1, gp_Vec2d &V2, gp_Vec2d &V3) const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT gp_Vec2d DN(const Standard_Real U,
+ const Standard_Integer N) const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Standard_Real Resolution(const Standard_Real Ruv) const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT gp_Lin2d Line() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT gp_Circ2d Circle() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT gp_Elips2d Ellipse() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT gp_Hypr2d Hyperbola() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT gp_Parab2d Parabola() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Standard_Integer Degree() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Standard_Boolean IsRational() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Standard_Integer NbPoles() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Standard_Integer NbKnots() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Handle(Geom2d_BezierCurve) Bezier() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Handle(Geom2d_BSplineCurve) BSpline() const;
+
+ /**
+ * Redefined method from the base class.
+ */
+ Standard_EXPORT Standard_Integer NbSamples() const;
+
+ private:
+
+ Geom2dAdaptor_Curve myCurve;
+ Trsf2d myTrsf;
+
+ };
+}
+
+#endif
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
${PROJECT_SOURCE_DIR}/src/GEOM
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
${PROJECT_SOURCE_DIR}/src/GEOMUtils
+ ${PROJECT_SOURCE_DIR}/src/ShHealOper
${PROJECT_BINARY_DIR}/idl
${CMAKE_CURRENT_SOURCE_DIR}
${PROJECT_BINARY_DIR}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
*/
//================================================================================
-GEOM::CreationInformation* GEOM_BaseObject_i::GetCreationInformation()
+GEOM::CreationInformationSeq* GEOM_BaseObject_i::GetCreationInformation()
{
- GEOM::CreationInformation_var info = new GEOM::CreationInformation;
+ GEOM::CreationInformationSeq_var info = new GEOM::CreationInformationSeq();
- Handle(GEOM_BaseDriver) driver =
- Handle(GEOM_BaseDriver)::DownCast( _impl->GetCreationDriver() );
- if ( !driver.IsNull() )
+ int nbFun = _impl->GetNbFunctions();
+ info->length( nbFun );
+ int nbI = 0;
+ for ( int i = 1; i <= nbFun; ++i )
{
- std::vector<GEOM_Param> params;
- std::string operationName;
- try
+ Handle(GEOM_BaseDriver) driver =
+ Handle(GEOM_BaseDriver)::DownCast( _impl->GetCreationDriver( i ));
+ if ( !driver.IsNull() )
{
- OCC_CATCH_SIGNALS;
- if ( driver->GetCreationInformation( operationName, params ))
+ std::vector<GEOM_Param> params;
+ std::string operationName;
+ try
{
- info->operationName = operationName.c_str();
- info->params.length( params.size() );
- for ( size_t i = 0; i < params.size(); ++i )
+ OCC_CATCH_SIGNALS;
+ if ( driver->GetCreationInformation( operationName, params ))
{
- info->params[i].name = params[i].name.c_str();
- info->params[i].value = params[i].value.c_str();
+ info[nbI].operationName = operationName.c_str();
+ info[nbI].params.length( params.size() );
+ for ( size_t i = 0; i < params.size(); ++i )
+ {
+ info[nbI].params[i].name = params[i].name.c_str();
+ info[nbI].params[i].value = params[i].value.c_str();
+ }
+ nbI++;
}
- }
#ifdef _DEBUG_
- if ( operationName.empty() )
- {
- cout << endl << endl << endl << "Warning: " << endl << "Dear developer!!!" << endl
- << " Consider implementing "
- << typeid(*(driver.operator->())).name() << "::GetCreationInformation() " << endl
- << " for the case of operation which has created '" << GetName() << "' object" << endl
- << "PLEEEEEEEASE" << endl
- << "\tPLEEEEEEEASE" << endl
- << "\t\tPLEEEEEEEASE" << endl
- << "\t\t\tPLEEEEEEEASE" << endl
- << "\t\t\t\tPLEEEEEEEASE" << endl;
- }
+ if ( operationName.empty() )
+ {
+ cout << endl << endl << endl << "Warning: " << endl << "Dear developer!!!" << endl
+ << " Consider implementing "
+ << typeid(*(driver.operator->())).name() << "::GetCreationInformation() " << endl
+ << " for the case of operation which has created '" << GetName() << "' object" << endl
+ << "PLEEEEEEEASE" << endl
+ << "\tPLEEEEEEEASE" << endl
+ << "\t\tPLEEEEEEEASE" << endl
+ << "\t\t\tPLEEEEEEEASE" << endl
+ << "\t\t\t\tPLEEEEEEEASE" << endl;
+ }
#endif
- }
- catch(...)
- {
+ }
+ catch(...)
+ {
#ifdef _DEBUG_
- cout << "Ecxeption in GEOM_BaseObject_i::GetCreationInformation()" << endl;
+ cout << "Ecxeption in GEOM_BaseObject_i::GetCreationInformation()" << endl;
#endif
+ }
}
}
+ info->length( nbI );
+
return info._retn();
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual char* GetParameters();
- virtual GEOM::CreationInformation* GetCreationInformation();
+ virtual GEOM::CreationInformationSeq* GetCreationInformation();
Handle(GEOM_BaseObject) GetImpl() { return _impl; }
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <SALOMEDS_Tool.hxx>
#include <SALOMEDS_wrap.hxx>
-#include <SALOME_DataContainer_i.hxx>
#include <Basics_DirUtils.hxx>
#include <set>
GEOM_Gen_i::~GEOM_Gen_i() {
delete name_service;
delete _impl;
+ std::map<std::string, GEOM_GenericOperationsCreator*>::const_iterator it;
+ for ( it = myOpCreatorMap.begin(); it != myOpCreatorMap.end(); ++it)
+ delete (*it).second;
}
aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_LCS");
aNamePrefix = "LocalCS_";
} else if ( mytype >= USER_TYPE_EX ) {
- char buf[20];
- sprintf( buf, "%d", aBaseObj->GetType() );
- GEOM::CreationInformation_var info = aBaseObj->GetCreationInformation();
- std::string plgId;
- for ( size_t i = 0; i < info->params.length(); ++i ) {
- std::string param_name = info->params[i].name.in();
- std::string param_value = info->params[i].value.in();
- if( param_name == PLUGIN_NAME) {
- plgId = param_value;
- break;
- }
- }
- if(plgId.length() > 0 ) {
- plgId += "::";
+ char buf[20];
+ sprintf( buf, "%d", aBaseObj->GetType() );
+ GEOM::CreationInformationSeq_var infoSeq = aBaseObj->GetCreationInformation();
+ std::string plgId;
+ for ( size_t j = 0; j < infoSeq->length(); ++j )
+ for ( size_t i = 0; i < infoSeq[j].params.length(); ++i ) {
+ std::string param_name = infoSeq[j].params[i].name.in();
+ std::string param_value = infoSeq[j].params[i].value.in();
+ if( param_name == PLUGIN_NAME) {
+ plgId = param_value;
+ break;
+ }
}
- plgId +="ICON_OBJBROWSER_";
- plgId += buf;
- aResultSO->SetAttrString("AttributePixMap",plgId.c_str());
+ if(plgId.length() > 0 ) {
+ plgId += "::";
+ }
+ plgId +="ICON_OBJBROWSER_";
+ plgId += buf;
+ aResultSO->SetAttrString("AttributePixMap",plgId.c_str());
} else if ( mytype > USER_TYPE ) {
char buf[20];
sprintf( buf, "%d", aBaseObj->GetType() );
useCaseBuilder->SetRootCurrent();
useCaseBuilder->Append( theComponent ); // component object is added as the top level item
}
-
- SALOMEDS::ChildIterator_wrap it = study->NewChildIterator( theComponent );
+
+ SALOMEDS::ChildIterator_wrap it = study->NewChildIterator( theComponent );
for ( it->InitEx(true); it->More(); it->Next() ) {
if ( !useCaseBuilder->IsUseCaseNode( it->Value() ) ) {
useCaseBuilder->AppendTo( it->Value()->GetFather(), it->Value() );
aServant = myOpCreatorMap[aLibName]->Create(_poa, theStudyID, engine, _impl);
// activate the CORBA servant
if (aServant)
- operations = aServant->_this();
+ operations = aServant->_this();
}
}
catch (SALOME_Exception& S_ex) {
aPlatformLibName += theLibName;
aPlatformLibName += ".so";
#endif
-
+
// check, if corresponding operations are already created
if (myOpCreatorMap.find(theLibName) == myOpCreatorMap.end()) {
// load plugin library
throw(SALOME_Exception(LOCALIZED( "Can't load server geometry plugin library" )));
#endif
}
-
+
// get method, returning operations creator
typedef GEOM_GenericOperationsCreator* (*GetOperationsCreator)();
GetOperationsCreator procHandle =
UnLoadLib(libHandle);
throw(SALOME_Exception(LOCALIZED("bad geometry plugin library")));
}
-
+
// get operations creator
GEOM_GenericOperationsCreator* aCreator = procHandle();
if (aCreator) {
// function : CreateFolder()
// purpose : Creates and returns a new folder object
//=================================================================================
-SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName,
- SALOMEDS::SObject_ptr theFather)
+SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName,
+ SALOMEDS::SObject_ptr theFather)
{
SALOMEDS::SObject_var aFolderSO;
// function : MoveToFolder()
// purpose : Moves GEOM object to the specified folder
//=================================================================================
-void GEOM_Gen_i::MoveToFolder(GEOM::GEOM_Object_ptr theObject,
- SALOMEDS::SObject_ptr theFolder) {
+void GEOM_Gen_i::MoveToFolder(GEOM::GEOM_Object_ptr theObject,
+ SALOMEDS::SObject_ptr theFolder) {
GEOM::object_list_var objects = new GEOM::object_list();
objects->length( 1 );
SALOMEDS::SObject_var aSO = theFolder->GetStudy()->FindObjectID( theObject->GetStudyEntry() );
// function : MoveListToFolder()
// purpose : Moves list of GEOM objects to the specified folder
//=================================================================================
-void GEOM_Gen_i::MoveListToFolder (const GEOM::ListOfGO& theListOfGO,
- SALOMEDS::SObject_ptr theFolder) {
+void GEOM_Gen_i::MoveListToFolder (const GEOM::ListOfGO& theListOfGO,
+ SALOMEDS::SObject_ptr theFolder) {
int aLen = theListOfGO.length();
GEOM::object_list_var objects = new GEOM::object_list();
objects->length( aLen );
//=================================================================================
// function : Move()
-// purpose : Moves objects to the specified position.
+// purpose : Moves objects to the specified position.
// Is used in the drag-n-drop functionality.
//=================================================================================
void GEOM_Gen_i::Move( const GEOM::object_list& what,
- SALOMEDS::SObject_ptr where,
- CORBA::Long row )
+ SALOMEDS::SObject_ptr where,
+ CORBA::Long row )
{
if ( CORBA::is_nil( where ) ) return;
SALOMEDS::SComponent_var father = where->GetFatherComponent();
std::string dataType = father->ComponentDataType();
if ( dataType != "GEOM" ) return; // not a GEOM component
-
+
SALOMEDS::SObject_var objAfter;
if ( row >= 0 && useCaseBuilder->HasChildren( where ) ) {
// insert at given row -> find insertion position
objAfter = useCaseIt->Value();
}
}
-
+
for ( int i = 0; i < what.length(); i++ ) {
SALOMEDS::SObject_var sobj = what[i];
if ( CORBA::is_nil( sobj ) ) continue; // skip bad object
}
}
-//=================================================================================
-// function : importData
-// purpose : imports geometrical data file into the GEOM internal data structure
-//=================================================================================
-Engines::ListOfIdentifiers* GEOM_Gen_i::importData(
- CORBA::Long studyId, Engines::DataContainer_ptr data, const Engines::ListOfOptions& options)
-{
- CORBA::Object_var aSMObject = name_service->Resolve( "/myStudyManager" );
- SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
- SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( studyId );
-
- Engines::ListOfIdentifiers_var aResult = new Engines::ListOfIdentifiers;
- GEOM::GEOM_IInsertOperations_var aInsOp = GetIInsertOperations(aStudy->StudyId());
- if (aInsOp->_is_nil()) {
- MESSAGE("No insert operations!");
- return aResult._retn();
- }
-
- // Get a temporary directory to store a file
- std::string aTmpDir = SALOMEDS_Tool::GetTmpDir();
- std::string aFileName("file");
- if (aFileName.rfind("/") != std::string::npos) { // remove folders from the name
- aFileName = aFileName.substr(aFileName.rfind("/") + 1);
- }
-
- std::string anExtension(data->extension());
- aFileName += "." + anExtension;
- // convert extension to upper case
- std::transform(anExtension.begin(), anExtension.end(), anExtension.begin(), ::toupper);
- std::string aFullPath = aTmpDir + aFileName;
-
- Engines::TMPFile* aFileStream = data->get();
- const char *aBuffer = (const char*)aFileStream->NP_data();
-#ifdef WIN32
- std::ofstream aFile(aFullPath.c_str(), std::ios::binary);
-#else
- std::ofstream aFile(aFullPath.c_str());
-#endif
- aFile.write(aBuffer, aFileStream->length());
- aFile.close();
-
- GEOM::ListOfGBO_var aObjects = aInsOp->ImportFile(aFullPath.c_str(), "XAO");
-
- if ( aObjects->length() > 0 && aInsOp->IsDone() ) {
- aResult->length(aObjects->length());
- // publish main object (first in the list of returned geom objects)
- CORBA::String_var aName = aObjects[0]->GetName();
- SALOMEDS::SObject_var aSO = PublishInStudy(aStudy.in(), SALOMEDS::SObject::_nil(), aObjects[0].in(), aName.in());
- aResult[0] = aSO->GetID();
- // publish groups && fields
- for (int i = 1; i < aObjects->length(); i++ ) {
- aName = aObjects[i]->GetName();
- aSO = AddInStudy(aStudy.in(), aObjects[0].in(), aName.in(), aObjects[0].in());
- aResult[i] = aSO->GetID();
- }
- }
- else {
- if (aObjects->length() == 0)
- MESSAGE("ImportXAO operation is failed for file "<<aFullPath.c_str());
- if (!aInsOp->IsDone())
- MESSAGE("Import operation is not done for file "<<aFullPath.c_str());
- return aResult._retn();
- }
-
- // remove temporary file and directory
- SALOMEDS::ListOfFileNames aTmpFiles;
- aTmpFiles.length(1);
- aTmpFiles[0] = aFileName.c_str();
- SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir, aTmpFiles, true);
-
- _impl->DocumentModified(studyId, false);
- return aResult._retn();
-}
-
-//=================================================================================
-// function : getModifiedData
-// purpose : exports all geometry of this GEOM module into one BRep file
-//=================================================================================
-Engines::ListOfData* GEOM_Gen_i::getModifiedData(CORBA::Long studyId)
-{
- Engines::ListOfData_var aResult = new Engines::ListOfData;
-
- if (!_impl->DocumentModified(studyId)) {
- MESSAGE("Document is not modified")
- return aResult._retn();
- }
-
- CORBA::Object_var aSMObject = name_service->Resolve("/myStudyManager");
- SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
- if (CORBA::is_nil(aStudyManager))
- return aResult._retn();
- SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( studyId );
- if (CORBA::is_nil(aStudy))
- return aResult._retn();
- SALOMEDS::SComponent_var aComponent = aStudy->FindComponent("GEOM");
- if (CORBA::is_nil(aComponent))
- return aResult._retn();
- SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(aComponent); // check only published shapes
-
- GEOM::GEOM_IInsertOperations_var aInsOp = GetIInsertOperations(aStudy->StudyId());
- if (aInsOp->_is_nil()) {
- MESSAGE("No insert operations!");
- return aResult._retn();
- }
-
- GEOM::GEOM_Object_var shapeObj;
-
- for(; anIter->More(); anIter->Next()) {
- SALOMEDS::SObject_var aSO = anIter->Value();
- SALOMEDS::SObject_var aRefSO;
- // export only not referenced objects, or referenced outside of GEOM
- if (!aSO->ReferencedObject(aRefSO) || aRefSO->GetFatherComponent()->GetID() != aComponent->GetID()) {
- CORBA::Object_var anObj = aSO->GetObject();
- if (!CORBA::is_nil(anObj)) {
- GEOM::GEOM_Object_var aCORBAMainShape = GEOM::GEOM_Object::_narrow(anObj);
- if(!aCORBAMainShape->_is_nil()) {
- CORBA::String_var entry = aCORBAMainShape->GetEntry();
- Handle(GEOM_Object) aMainShape = Handle(GEOM_Object)::DownCast(_impl->GetObject(studyId, entry));
-
- GEOM::shape_type aCORBAShapeType = aCORBAMainShape->GetShapeType();
- if (!aMainShape.IsNull() && !(aCORBAShapeType == GEOM::VERTEX) && !(aCORBAShapeType == GEOM::EDGE)) {
- shapeObj = aCORBAMainShape;
- break;
- }
- }
- }
- }
- }
-
- if (!CORBA::is_nil(shapeObj)) { // Shape is correct, write it to the temporary file
- std::string aPath = Kernel_Utils::GetTmpFileName() + ".xao";
- aInsOp->Export(shapeObj.in(), aPath.c_str(), "XAO");
- aResult->length(1);
- Engines::DataContainer_var aData = (new Engines_DataContainer_i(
- aPath.c_str(), "", "", true))->_this();
- aResult[0] = aData;
- } else {
- MESSAGE("No shapes to export");
- }
-
- return aResult._retn();
-}
-
//=======================================================================
// function : GetDependencyTree
// purpose : Collects dependencies of the given objects from other ones
//=======================================================================
SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy,
- const GEOM::string_array& theObjectEntries ) {
+ const GEOM::string_array& theObjectEntries ) {
// fill in the tree structure
GEOMUtils::TreeModel tree;
// translation the tree into string
std::string treeStr;
GEOMUtils::ConvertTreeToString( tree, treeStr );
-
+
// put string into stream
char* aBuffer = (char*)CORBA::string_dup(treeStr.c_str());
int aBufferSize = strlen((char*)aBuffer);
// function : getUpwardDependency
// purpose : Collects the entries of objects on that the given one depends
//=======================================================================
-void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
- GEOMUtils::LevelsList &upLevelList,
- std::map< std::string, std::set<std::string> > &passedEntries,
- int level ) {
+void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
+ GEOMUtils::LevelsList &upLevelList,
+ std::map< std::string, std::set<std::string> > &passedEntries,
+ int level ) {
std::string aGboEntry = gbo->GetEntry();
GEOMUtils::NodeLinks anEntries;
GEOMUtils::LevelInfo aLevelMap;
// get the existent map
aLevelMap = upLevelList.at(level-1);
if ( aLevelMap.count( aGboEntry ) > 0 ) {
- anEntries = aLevelMap[ aGboEntry ];
+ anEntries = aLevelMap[ aGboEntry ];
}
}
}
if ( depList[j]->_is_nil() )
continue;
aDepEntry = depList[j]->GetEntry();
- if ( passedEntries.count( aGboEntry ) > 0 &&
+ if ( passedEntries.count( aGboEntry ) > 0 &&
passedEntries[aGboEntry].count( aDepEntry ) > 0 ) {
//avoid checking the passed objects
continue;
// function : getDownwardDependency
// purpose : Collects the entries of objects that depends on the given one
//=======================================================================
-void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
- GEOMUtils::LevelsList &downLevelList,
- std::map< std::string, std::set<std::string> > &passedEntries,
- int level ) {
+void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
+ GEOMUtils::LevelsList &downLevelList,
+ std::map< std::string, std::set<std::string> > &passedEntries,
+ int level ) {
std::string aGboEntry = gbo->GetEntry();
Handle(TDocStd_Document) aDoc = GEOM_Engine::GetEngine()->GetDocument(gbo->GetStudyID());
Handle(TDataStd_TreeNode) aNode, aRoot;
continue;
if ( depList[i]->_is_equivalent( gbo ) ) {
// yes, the current object depends on the given object
- if ( passedEntries.count( aGoEntry ) > 0 &&
+ if ( passedEntries.count( aGoEntry ) > 0 &&
passedEntries[aGoEntry].count( aGboEntry ) > 0 ) {
//avoid checking the passed objects
continue;
// purpose : Fills 3 lists that is used to clean study of redundant objects
//==============================================================================
void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
- GEOM::string_array& theSelectedEntries,
- GEOM::string_array& theParentEntries,
- GEOM::string_array& theSubEntries,
- GEOM::string_array& theOtherEntries)
+ GEOM::string_array& theSelectedEntries,
+ GEOM::string_array& theParentEntries,
+ GEOM::string_array& theSubEntries,
+ GEOM::string_array& theOtherEntries)
{
std::set<std::string> aSelected, aParents, aChildren, anOthers;
for ( int i = 0; i < theSelectedEntries.length(); i++ ) {
if ( aSelected.count( anEntry ) > 0 &&
aParents.count( anEntry ) == 0 ) {
includeParentDependencies( geomObj, aSelected, aParents, aChildren, anOthers );
- } else if ( aParents.count( anEntry ) == 0 &&
+ } else if ( aParents.count( anEntry ) == 0 &&
aChildren.count( anEntry ) == 0 ) {
anOthers.insert( geomObj->GetEntry() );
}
}
// if some selected object is not a main shape,
- // we move it's main shapes into 'selected' list,
+ // we move it's main shapes into 'selected' list,
// because they could not be modified anyhow.
std::set<std::string> aToBeInSelected;
for ( it = aSelected.begin(); it != aSelected.end(); ++it ) {
//==============================================================================
// function : includeParentDependencies
-// purpose :
+// purpose :
//==============================================================================
void GEOM_Gen_i::includeParentDependencies(GEOM::GEOM_BaseObject_ptr geomObj,
- std::set<std::string>& aSelected,
- std::set<std::string>& aParents,
- std::set<std::string>& aChildren,
- std::set<std::string>& anOthers)
+ std::set<std::string>& aSelected,
+ std::set<std::string>& aParents,
+ std::set<std::string>& aChildren,
+ std::set<std::string>& anOthers)
{
std::string anEntry = geomObj->GetEntry();
if ( aSelected.count( anEntry ) == 0 ) {
for( int i = 0; i < depList->length(); i++ ) {
aDepEntry = depList[i]->GetEntry();
if ( depList[i]->_is_nil() ||
- aDepEntry == anEntry || // skip self-depending
- aSelected.count( aDepEntry ) > 0 || // skip selected objects
- aParents.count( aDepEntry ) > 0 // skip already processed objects
- )
+ aDepEntry == anEntry || // skip self-depending
+ aSelected.count( aDepEntry ) > 0 || // skip selected objects
+ aParents.count( aDepEntry ) > 0 // skip already processed objects
+ )
continue;
includeParentDependencies( depList[i], aSelected, aParents, aChildren, anOthers );
}
//==============================================================================
// function : includeSubObjects
-// purpose :
+// purpose :
//==============================================================================
void GEOM_Gen_i::includeSubObjects(SALOMEDS::Study_ptr theStudy,
- const std::string& aSelectedEntry,
- std::set<std::string>& aSelected,
- std::set<std::string>& aParents,
- std::set<std::string>& aChildren,
- std::set<std::string>& anOthers)
+ const std::string& aSelectedEntry,
+ std::set<std::string>& aSelected,
+ std::set<std::string>& aParents,
+ std::set<std::string>& aChildren,
+ std::set<std::string>& anOthers)
{
std::set<std::string>::iterator foundIt;
Handle(GEOM_BaseObject) handle_object = _impl->GetObject( theStudy->StudyId(), aSelectedEntry.c_str(), false);
if ( foundIt == aParents.end() ) { // add to sub-objects if it is not in parents list
foundIt = aSelected.find( aSubEntryStr );
if ( foundIt == aSelected.end() ) { // add to sub-objects if it is not in selected list
- aChildren.insert( aSubEntryStr );
- foundIt = anOthers.find( aSubEntryStr );
- if ( foundIt != anOthers.end() )
- anOthers.erase( foundIt );
+ aChildren.insert( aSubEntryStr );
+ foundIt = anOthers.find( aSubEntryStr );
+ if ( foundIt != anOthers.end() )
+ anOthers.erase( foundIt );
}
}
includeSubObjects( theStudy, aSubEntryStr, aSelected, aParents, aChildren, anOthers );
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//Collects dependencies of the given objects from other ones
SALOMEDS::TMPFile* GetDependencyTree(SALOMEDS::Study_ptr theStudy,
- const GEOM::string_array& theObjectEntries);
+ const GEOM::string_array& theObjectEntries);
//-----------------------------------------------------------------------//
// Transaction methods //
virtual char* getVersion();
// Create a new folder object
- SALOMEDS::SObject_ptr CreateFolder(const char* theName,
- SALOMEDS::SObject_ptr theFather);
+ SALOMEDS::SObject_ptr CreateFolder(const char* theName,
+ SALOMEDS::SObject_ptr theFather);
// Move GEOM object to the specified folder
- void MoveToFolder(GEOM::GEOM_Object_ptr theObject,
- SALOMEDS::SObject_ptr theFolder);
+ void MoveToFolder(GEOM::GEOM_Object_ptr theObject,
+ SALOMEDS::SObject_ptr theFolder);
// Move list of GEOM objects to the specified folder
- void MoveListToFolder (const GEOM::ListOfGO& theListOfGO,
- SALOMEDS::SObject_ptr theFolder);
+ void MoveListToFolder (const GEOM::ListOfGO& theListOfGO,
+ SALOMEDS::SObject_ptr theFolder);
// Move objects to the specified position
void Move( const GEOM::object_list& what,
- SALOMEDS::SObject_ptr where,
- CORBA::Long row );
-
- // SIMAN-related functions (check out/check in) : import data to study
- virtual Engines::ListOfIdentifiers* importData(CORBA::Long studyId,
- Engines::DataContainer_ptr data,
- const Engines::ListOfOptions& options);
- // SIMAN-related functions (check out/check in) : get modified data
- virtual Engines::ListOfData* getModifiedData(CORBA::Long studyId);
+ SALOMEDS::SObject_ptr where,
+ CORBA::Long row );
/*! \brief Fills 3 lists that is used to clean study of redundant objects.
* To be used from GUI.
*/
void GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
- GEOM::string_array& theSelectedEntries,
- GEOM::string_array& theParentEntries,
- GEOM::string_array& theSubEntries,
- GEOM::string_array& theOtherEntries);
+ GEOM::string_array& theSelectedEntries,
+ GEOM::string_array& theParentEntries,
+ GEOM::string_array& theSubEntries,
+ GEOM::string_array& theOtherEntries);
//-----------------------------------------------------------------------//
// Internal methods //
const Standard_CString& GrName,
GEOM::ListOfGO_var aResList);
- void getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
- GEOMUtils::LevelsList &upLevelList,
- std::map< std::string, std::set<std::string> > &passedEntries,
+ void getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
+ GEOMUtils::LevelsList &upLevelList,
+ std::map< std::string, std::set<std::string> > &passedEntries,
int level = 0 );
- void getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
- GEOMUtils::LevelsList &downLevelList,
- std::map< std::string, std::set<std::string> > &passedEntries,
+ void getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
+ GEOMUtils::LevelsList &downLevelList,
+ std::map< std::string, std::set<std::string> > &passedEntries,
int level = 0 );
void includeParentDependencies(GEOM::GEOM_BaseObject_ptr gbo,
- std::set<std::string>& aSelected,
- std::set<std::string>& aParents,
- std::set<std::string>& aChildren,
- std::set<std::string>& anOthers);
+ std::set<std::string>& aSelected,
+ std::set<std::string>& aParents,
+ std::set<std::string>& aChildren,
+ std::set<std::string>& anOthers);
void includeSubObjects(SALOMEDS::Study_ptr theStudy,
- const std::string& aSelectedEntry,
- std::set<std::string>& aSelected,
- std::set<std::string>& aParents,
- std::set<std::string>& aChildren,
- std::set<std::string>& anOthers);
+ const std::string& aSelectedEntry,
+ std::set<std::string>& aSelected,
+ std::set<std::string>& aParents,
+ std::set<std::string>& aChildren,
+ std::set<std::string>& anOthers);
void LoadPlugin(const std::string& theLibName);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
(GEOM::GEOM_Object_ptr theInitShape, GEOM::GEOM_Object_ptr theBase,
CORBA::Double theHeight,
CORBA::Double theAngle,
- CORBA::Boolean theFuse)
+ CORBA::Boolean theFuse,
+ CORBA::Boolean theInvert)
{
GEOM::GEOM_Object_var aGEOMObject;
if (aBase.IsNull() || aInit.IsNull()) return aGEOMObject._retn();
//Create the Prism
- Handle(GEOM_Object) anObject = GetOperations()->MakeDraftPrism(aInit, aBase, theHeight, theAngle, theFuse);
+ Handle(GEOM_Object) anObject = GetOperations()->MakeDraftPrism(aInit, aBase, theHeight, theAngle, theFuse, theInvert);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
* MakePipe
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
- (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
+GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipe
+ (GEOM::GEOM_Object_ptr theBase,
+ GEOM::GEOM_Object_ptr thePath,
+ CORBA::Boolean IsGenerateGroups)
{
- GEOM::GEOM_Object_var aGEOMObject;
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
//Set a not done flag
GetOperations()->SetNotDone();
Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
- if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
+ if (aBase.IsNull() || aPath.IsNull()) return aSeq._retn();
//Create the Pipe
- Handle(GEOM_Object) anObject =
- GetOperations()->MakePipe(aBase, aPath);
- if (!GetOperations()->IsDone() || anObject.IsNull())
- return aGEOMObject._retn();
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipe(aBase, aPath, IsGenerateGroups);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
- return GetObject(anObject);
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
}
//=============================================================================
*/
//=============================================================================
GEOM::GEOM_Object_ptr
-GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
- CORBA::Long theMinDeg,
- CORBA::Long theMaxDeg,
- CORBA::Double theTol2D,
- CORBA::Double theTol3D,
- CORBA::Long theNbIter,
+GEOM_I3DPrimOperations_i::MakeFilling(const GEOM::ListOfGO& theContours,
+ CORBA::Long theMinDeg,
+ CORBA::Long theMaxDeg,
+ CORBA::Double theTol2D,
+ CORBA::Double theTol3D,
+ CORBA::Long theNbIter,
GEOM::filling_oper_method theMethod,
- CORBA::Boolean theApprox)
+ CORBA::Boolean theApprox)
{
GEOM::GEOM_Object_var aGEOMObject;
GetOperations()->SetNotDone();
//Get the reference objects
- Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
-
- if (aShape.IsNull()) return aGEOMObject._retn();
+ std::list< Handle(GEOM_Object) > aShapes;
+ if (! GetListOfObjectsImpl( theContours, aShapes ))
+ return aGEOMObject._retn();
int aMethod = 0;
switch (theMethod) {
//Create the Solid
Handle(GEOM_Object) anObject = GetOperations()->MakeFilling
- (aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter,
- aMethod, theApprox);
+ (aShapes, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, aMethod, theApprox);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
* MakePipeWithDifferentSections
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections
- (const GEOM::ListOfGO& theBases,
- const GEOM::ListOfGO& theLocations,
- GEOM::GEOM_Object_ptr thePath,
- CORBA::Boolean theWithContact,
- CORBA::Boolean theWithCorrections)
+GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections
+ (const GEOM::ListOfGO &theBases,
+ const GEOM::ListOfGO &theLocations,
+ GEOM::GEOM_Object_ptr thePath,
+ CORBA::Boolean theWithContact,
+ CORBA::Boolean theWithCorrections,
+ CORBA::Boolean IsBySteps,
+ CORBA::Boolean IsGenerateGroups)
{
- GEOM::GEOM_Object_var aGEOMObject;
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
//Set a not done flag
GetOperations()->SetNotDone();
aNbLocs = theLocations.length();
if (aNbLocs && aNbBases != aNbLocs)
- return aGEOMObject._retn();
+ return aSeq._retn();
Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
if (aPath.IsNull())
- return aGEOMObject._retn();
+ return aSeq._retn();
for (ind = 0; ind < aNbBases; ind++) {
Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
aSeqBases->Append(aBase);
}
if (!aSeqBases->Length())
- return aGEOMObject._retn();
+ return aSeq._retn();
// Make pipe
- Handle(GEOM_Object) anObject =
- GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
- theWithContact,theWithCorrections);
- if (!GetOperations()->IsDone() || anObject.IsNull())
- return aGEOMObject._retn();
-
- return GetObject(anObject);
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeWithDifferentSections
+ (aSeqBases, aSeqLocations,
+ aPath, theWithContact,
+ theWithCorrections, IsBySteps, IsGenerateGroups);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
}
* MakePipeWithShellSections
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
- (const GEOM::ListOfGO& theBases,
- const GEOM::ListOfGO& theSubBases,
- const GEOM::ListOfGO& theLocations,
- GEOM::GEOM_Object_ptr thePath,
- CORBA::Boolean theWithContact,
- CORBA::Boolean theWithCorrections)
+GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipeWithShellSections
+ (const GEOM::ListOfGO &theBases,
+ const GEOM::ListOfGO &theSubBases,
+ const GEOM::ListOfGO &theLocations,
+ GEOM::GEOM_Object_ptr thePath,
+ CORBA::Boolean theWithContact,
+ CORBA::Boolean theWithCorrections,
+ CORBA::Boolean IsGenerateGroups)
{
- GEOM::GEOM_Object_var aGEOMObject;
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
//Set a not done flag
GetOperations()->SetNotDone();
aNbLocs = theLocations.length();
if (aNbLocs && aNbBases != aNbLocs)
- return aGEOMObject._retn();
+ return aSeq._retn();
Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
if (aPath.IsNull())
- return aGEOMObject._retn();
+ return aSeq._retn();
for (ind = 0; ind < aNbBases; ind++) {
Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
}
}
if (!aSeqBases->Length())
- return aGEOMObject._retn();
+ return aSeq._retn();
// Make pipe
- Handle(GEOM_Object) anObject =
- GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
- aSeqLocations, aPath,
- theWithContact, theWithCorrections);
- if (!GetOperations()->IsDone() || anObject.IsNull())
- return aGEOMObject._retn();
-
- return GetObject(anObject);
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeWithShellSections
+ (aSeqBases, aSeqSubBases,
+ aSeqLocations, aPath,
+ theWithContact, theWithCorrections, IsGenerateGroups);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
}
* MakePipeShellsWithoutPath
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
- (const GEOM::ListOfGO& theBases,
- const GEOM::ListOfGO& theLocations)
+GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
+ (const GEOM::ListOfGO &theBases,
+ const GEOM::ListOfGO &theLocations,
+ CORBA::Boolean IsGenerateGroups)
{
- GEOM::GEOM_Object_var aGEOMObject;
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
//Set a not done flag
GetOperations()->SetNotDone();
aNbLocs = theLocations.length();
if (aNbLocs && aNbBases != aNbLocs)
- return aGEOMObject._retn();
+ return aSeq._retn();
for (ind = 0; ind < aNbBases; ind++) {
Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
}
if (!aSeqBases->Length())
- return aGEOMObject._retn();
+ return aSeq._retn();
// Make pipe
- Handle(GEOM_Object) anObject =
- GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeShellsWithoutPath
+ (aSeqBases, aSeqLocations, IsGenerateGroups);
- if (!GetOperations()->IsDone() || anObject.IsNull())
- return aGEOMObject._retn();
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
- return GetObject(anObject);
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
}
//=============================================================================
* MakePipeBiNormalAlongVector
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
- (GEOM::GEOM_Object_ptr theBase,
- GEOM::GEOM_Object_ptr thePath,
- GEOM::GEOM_Object_ptr theVec)
+GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
+ (GEOM::GEOM_Object_ptr theBase,
+ GEOM::GEOM_Object_ptr thePath,
+ GEOM::GEOM_Object_ptr theVec,
+ CORBA::Boolean IsGenerateGroups)
{
- GEOM::GEOM_Object_var aGEOMObject;
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
//Set a not done flag
GetOperations()->SetNotDone();
Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
- if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
+ if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aSeq._retn();
//Create the Pipe
- Handle(GEOM_Object) anObject =
- GetOperations()->MakePipeBiNormalAlongVector(aBase, aPath, aVec);
- if (!GetOperations()->IsDone() || anObject.IsNull())
- return aGEOMObject._retn();
-
- return GetObject(anObject);
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeBiNormalAlongVector
+ (aBase, aPath, aVec, IsGenerateGroups);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
}
//=============================================================================
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThickening
- (GEOM::GEOM_Object_ptr theObject,
- CORBA::Double theOffset,
- CORBA::Boolean doCopy)
+ (GEOM::GEOM_Object_ptr theObject,
+ const GEOM::ListOfLong &theFacesIDs,
+ CORBA::Double theOffset,
+ CORBA::Boolean doCopy,
+ CORBA::Boolean theInside)
{
GEOM::GEOM_Object_var aGEOMObject;
//Set a not done flag
//Get the basic object
Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
if (aBasicObject.IsNull()) return aGEOMObject._retn();
-
+
+ // Get faces IDs.
+ Handle(TColStd_HArray1OfInteger) aFaceIDs;
+ Standard_Integer aNbIDs = theFacesIDs.length();
+ Standard_Integer i;
+
+ if (aNbIDs > 0) {
+ aFaceIDs = new TColStd_HArray1OfInteger (1, aNbIDs);
+
+ for (i = 0; i < aNbIDs; i++) {
+ aFaceIDs->SetValue(i + 1, theFacesIDs[i]);
+ }
+ }
+
//Create the thickened shape
if (doCopy)
{
Handle(GEOM_Object) anObject = GetOperations()->MakeThickening(
- aBasicObject, theOffset, doCopy);
+ aBasicObject, aFaceIDs, theOffset, doCopy, theInside);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
}
else
{
- GetOperations()->MakeThickening(aBasicObject, theOffset, doCopy);
+ GetOperations()->MakeThickening(aBasicObject, aFaceIDs, theOffset, doCopy, theInside);
// Update GUI.
UpdateGUIForObject(theObject);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
GEOM::GEOM_Object_ptr theBase,
CORBA::Double theHeight,
CORBA::Double theAngle,
- CORBA::Boolean theFuse);
-
- GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase,
- GEOM::GEOM_Object_ptr thePath);
+ CORBA::Boolean theFuse,
+ CORBA::Boolean theInvert);
+
+ GEOM::ListOfGO* MakePipe (GEOM::GEOM_Object_ptr theBase,
+ GEOM::GEOM_Object_ptr thePath,
+ CORBA::Boolean IsGenerateGroups);
GEOM::GEOM_Object_ptr MakeRevolutionAxisAngle (GEOM::GEOM_Object_ptr theBase,
GEOM::GEOM_Object_ptr theAxis,
GEOM::GEOM_Object_ptr theAxis,
CORBA::Double theAngle);
- GEOM::GEOM_Object_ptr MakeFilling(GEOM::GEOM_Object_ptr theShape,
+ GEOM::GEOM_Object_ptr MakeFilling(const GEOM::ListOfGO& theContours,
CORBA::Long theMinDeg, CORBA::Long theMaxDeg,
CORBA::Double theTol2D, CORBA::Double theTol3D,
CORBA::Long theNbIter,
CORBA::Boolean theModeSolid,
CORBA::Double thePreci,
CORBA::Boolean theRuled);
-
- GEOM::GEOM_Object_ptr MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
- const GEOM::ListOfGO& theLocations,
- GEOM::GEOM_Object_ptr thePath,
- CORBA::Boolean theWithContact,
- CORBA::Boolean theWithCorrections);
-
- GEOM::GEOM_Object_ptr MakePipeWithShellSections(const GEOM::ListOfGO& theBases,
- const GEOM::ListOfGO& theSubBases,
- const GEOM::ListOfGO& theLocations,
- GEOM::GEOM_Object_ptr thePath,
- CORBA::Boolean theWithContact,
- CORBA::Boolean theWithCorrections);
-
- GEOM::GEOM_Object_ptr MakePipeShellsWithoutPath(const GEOM::ListOfGO& theBases,
- const GEOM::ListOfGO& theLocations);
-
- GEOM::GEOM_Object_ptr MakePipeBiNormalAlongVector (GEOM::GEOM_Object_ptr theBase,
- GEOM::GEOM_Object_ptr thePath,
- GEOM::GEOM_Object_ptr theVec);
-
- GEOM::GEOM_Object_ptr MakeThickening (GEOM::GEOM_Object_ptr theObject,
- CORBA::Double theOffset,
- CORBA::Boolean isCopy);
+
+ GEOM::ListOfGO* MakePipeWithDifferentSections
+ (const GEOM::ListOfGO &theBases,
+ const GEOM::ListOfGO &theLocations,
+ GEOM::GEOM_Object_ptr thePath,
+ CORBA::Boolean theWithContact,
+ CORBA::Boolean theWithCorrections,
+ CORBA::Boolean IsBySteps,
+ CORBA::Boolean IsGenerateGroups);
+
+ GEOM::ListOfGO* MakePipeWithShellSections
+ (const GEOM::ListOfGO &theBases,
+ const GEOM::ListOfGO &theSubBases,
+ const GEOM::ListOfGO &theLocations,
+ GEOM::GEOM_Object_ptr thePath,
+ CORBA::Boolean theWithContact,
+ CORBA::Boolean theWithCorrections,
+ CORBA::Boolean IsGenerateGroups);
+
+ GEOM::ListOfGO* MakePipeShellsWithoutPath
+ (const GEOM::ListOfGO &theBases,
+ const GEOM::ListOfGO &theLocations,
+ CORBA::Boolean IsGenerateGroups);
+
+ GEOM::ListOfGO* MakePipeBiNormalAlongVector
+ (GEOM::GEOM_Object_ptr theBase,
+ GEOM::GEOM_Object_ptr thePath,
+ GEOM::GEOM_Object_ptr theVec,
+ CORBA::Boolean IsGenerateGroups);
+
+ GEOM::GEOM_Object_ptr MakeThickening (GEOM::GEOM_Object_ptr theObject,
+ const GEOM::ListOfLong &theFacesIDs,
+ CORBA::Double theOffset,
+ CORBA::Boolean isCopy,
+ CORBA::Boolean theInside);
GEOM::GEOM_Object_ptr RestorePath (GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr theBase1,
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve
- (GEOM::GEOM_Object_ptr theCurve, CORBA::Double theParameter)
+ (GEOM::GEOM_Object_ptr theCurve,
+ CORBA::Double theParameter,
+ CORBA::Boolean takeOrientationIntoAccount)
{
GEOM::GEOM_Object_var aGEOMObject;
if (aReference.IsNull()) return aGEOMObject._retn();
//Create the point
- Handle(GEOM_Object) anObject =
- GetOperations()->MakePointOnCurve(aReference, theParameter);
+ Handle(GEOM_Object) anObject = GetOperations()->MakePointOnCurve
+ (aReference, theParameter, takeOrientationIntoAccount);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
CORBA::Double theY,
CORBA::Double theZ);
- GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theCurve,
- CORBA::Double theParameter);
+ GEOM::GEOM_Object_ptr MakePointOnCurve
+ (GEOM::GEOM_Object_ptr theCurve,
+ CORBA::Double theParameter,
+ CORBA::Boolean takeOrientationIntoAccount);
GEOM::GEOM_Object_ptr MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theCurve,
CORBA::Double theLength,
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//=============================================================================
CORBA::Boolean GEOM_IBlocksOperations_i::CheckCompoundOfBlocks
(GEOM::GEOM_Object_ptr theCompound,
+ const CORBA::Double theToleranceC1,
GEOM::GEOM_IBlocksOperations::BCErrors_out theErrors)
{
CORBA::Boolean isComp = false;
//Check
std::list<GEOMImpl_IBlocksOperations::BCError> errList;
- isComp = GetOperations()->CheckCompoundOfBlocks(aCompound, errList);
+ isComp = GetOperations()->CheckCompoundOfBlocks
+ (aCompound, theToleranceC1, errList);
if (!GetOperations()->IsDone())
return isComp;
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetNonBlocks
(GEOM::GEOM_Object_ptr theShape,
+ const CORBA::Double theToleranceC1,
GEOM::GEOM_Object_out theNonQuads)
{
GEOM::GEOM_Object_var aGEOMObject;
//Get the result
Handle(GEOM_Object) aFaces;
- Handle(GEOM_Object) anObject = GetOperations()->GetNonBlocks(aShape, aFaces);
+ Handle(GEOM_Object) anObject =
+ GetOperations()->GetNonBlocks(aShape, theToleranceC1, aFaces);
if (!GetOperations()->IsDone())
return aGEOMObject._retn();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
CORBA::Long& theNbBlocks);
CORBA::Boolean CheckCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound,
+ const CORBA::Double theToleranceC1,
GEOM::GEOM_IBlocksOperations::BCErrors_out theErrors);
char* PrintBCErrors (GEOM::GEOM_Object_ptr theCompound,
const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors);
GEOM::GEOM_Object_ptr GetNonBlocks (GEOM::GEOM_Object_ptr theShape,
+ const CORBA::Double theToleranceC1,
GEOM::GEOM_Object_out theNonQuads);
GEOM::GEOM_Object_ptr RemoveExtraEdges (GEOM::GEOM_Object_ptr theShape,
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GEOM_IHealingOperations_i.hh"
#include "GEOM_Engine.hxx"
#include "GEOM_Object.hxx"
+#include "ShHealOper_ModifStats.hxx"
-#include "utilities.h"
-#include "OpUtil.hxx"
-#include "Utils_ExceptHandlers.hxx"
+#include <utilities.h>
+#include <OpUtil.hxx>
+#include <Utils_ExceptHandlers.hxx>
#include <Basics_Utils.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
* Sew
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::Sew (GEOM::GEOM_Object_ptr theObject,
- CORBA::Double theTolerance)
+GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::Sew (const GEOM::ListOfGO& theObjects,
+ CORBA::Double theTolerance)
{
GEOM::GEOM_Object_var aGEOMObject;
if (theTolerance < 0)
return aGEOMObject._retn();
- // Get the object itself
- Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
- if (anObject.IsNull())
+ //Get the shapes
+ std::list< Handle(GEOM_Object) > aShapes;
+ if (! GetListOfObjectsImpl( theObjects, aShapes ))
return aGEOMObject._retn();
// Perform
- Handle(GEOM_Object) aNewObject =
- GetOperations()->Sew( anObject, theTolerance, false );
+ Handle(GEOM_Object) aNewObject = GetOperations()->Sew( aShapes, theTolerance, false );
if (!GetOperations()->IsDone() || aNewObject.IsNull())
return aGEOMObject._retn();
* SewAllowNonManifold
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::SewAllowNonManifold (GEOM::GEOM_Object_ptr theObject,
- CORBA::Double theTolerance)
+GEOM::GEOM_Object_ptr
+GEOM_IHealingOperations_i::SewAllowNonManifold (const GEOM::ListOfGO& theObjects,
+ CORBA::Double theTolerance)
{
GEOM::GEOM_Object_var aGEOMObject;
if (theTolerance < 0)
return aGEOMObject._retn();
- // Get the object itself
- Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
- if (anObject.IsNull())
+ //Get the shapes
+ std::list< Handle(GEOM_Object) > aShapes;
+ if (! GetListOfObjectsImpl( theObjects, aShapes ))
return aGEOMObject._retn();
// Perform
- Handle(GEOM_Object) aNewObject =
- GetOperations()->Sew( anObject, theTolerance, true );
+ Handle(GEOM_Object) aNewObject = GetOperations()->Sew( aShapes, theTolerance, true );
if (!GetOperations()->IsDone() || aNewObject.IsNull())
return aGEOMObject._retn();
* RemoveInternalFaces
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::RemoveInternalFaces (GEOM::GEOM_Object_ptr theCompound)
+GEOM::GEOM_Object_ptr
+GEOM_IHealingOperations_i::RemoveInternalFaces (const GEOM::ListOfGO& theSolids)
{
GEOM::GEOM_Object_var aGEOMObject;
// Set a not done flag
GetOperations()->SetNotDone();
- // Get the object
- Handle(GEOM_Object) anObject = GetObjectImpl(theCompound);
- if (anObject.IsNull())
+ // Get the objects
+ std::list< Handle(GEOM_Object) > aShapes;
+ if (! GetListOfObjectsImpl( theSolids, aShapes ))
return aGEOMObject._retn();
// Perform
- Handle(GEOM_Object) aNewObject = GetOperations()->RemoveInternalFaces(anObject);
+ Handle(GEOM_Object) aNewObject = GetOperations()->RemoveInternalFaces(aShapes);
if (!GetOperations()->IsDone() || aNewObject.IsNull())
return aGEOMObject._retn();
return GetObject(aNewObject);
}
+//=============================================================================
+/*!
+ * DivideEdgeByPoint
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr
+GEOM_IHealingOperations_i::DivideEdgeByPoint (GEOM::GEOM_Object_ptr theObject,
+ CORBA::Short theIndex,
+ const GEOM::ListOfGO& thePoints)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ // Set a not done flag
+ GetOperations()->SetNotDone();
+
+ // Get the object itself
+ Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
+ if (anObject.IsNull())
+ return aGEOMObject._retn();
+
+ // Get the points
+ std::list< Handle(GEOM_Object) > aPoints;
+ if (! GetListOfObjectsImpl( thePoints, aPoints ))
+ return aGEOMObject._retn();
+
+ // Perform
+ Handle(GEOM_Object) aNewObject =
+ GetOperations()->DivideEdgeByPoint( anObject, theIndex, aPoints );
+ if (!GetOperations()->IsDone() || aNewObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(aNewObject);
+}
+
//=============================================================================
/*!
* FuseCollinearEdgesWithinWire
* GetFreeBoundary
*/
//=============================================================================
-CORBA::Boolean GEOM_IHealingOperations_i::GetFreeBoundary ( GEOM::GEOM_Object_ptr theObject,
- GEOM::ListOfGO_out theClosedWires,
- GEOM::ListOfGO_out theOpenWires )
+CORBA::Boolean
+GEOM_IHealingOperations_i::GetFreeBoundary ( const GEOM::ListOfGO & theObjects,
+ GEOM::ListOfGO_out theClosedWires,
+ GEOM::ListOfGO_out theOpenWires )
{
theClosedWires = new GEOM::ListOfGO;
theOpenWires = new GEOM::ListOfGO;
// Set a not done flag
GetOperations()->SetNotDone();
- // Get the object itself
- Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
- if (anObject.IsNull())
- return false;
+ // Get the objects
+ Handle(TColStd_HSequenceOfTransient) anObjects = new TColStd_HSequenceOfTransient();
+ for ( size_t i = 0; i < theObjects.length(); ++i )
+ {
+ Handle(GEOM_Object) anObject = GetObjectImpl(theObjects[i]);
+ if (anObject.IsNull())
+ return false;
+ anObjects->Append( anObject );
+ }
Handle(TColStd_HSequenceOfTransient) aClosed = new TColStd_HSequenceOfTransient();
Handle(TColStd_HSequenceOfTransient) anOpen = new TColStd_HSequenceOfTransient();
- bool res = GetOperations()->GetFreeBoundary( anObject, aClosed, anOpen );
+ bool res = GetOperations()->GetFreeBoundary( anObjects, aClosed, anOpen );
if ( !GetOperations()->IsDone() || !res )
return false;
return GetObject(aNewObject);
}
+
+//================================================================================
+/*!
+ * \brief Return information on what has been done by the last called healing method
+ */
+//================================================================================
+
+GEOM::ModifStatistics* GEOM_IHealingOperations_i::GetStatistics()
+{
+ const ShHealOper_ModifStats& stats = * GetOperations()->GetStatistics();
+ const std::set< ShHealOper_ModifStats::Datum >& modifs = stats.GetData();
+ std::set< ShHealOper_ModifStats::Datum >::const_iterator modif = modifs.begin();
+
+ GEOM::ModifStatistics_var statsVar = new GEOM::ModifStatistics();
+ statsVar->length( modifs.size() );
+ for ( int i = 0; modif != modifs.end(); ++modif, ++i )
+ {
+ statsVar[ i ].name = modif->myModif.c_str();
+ statsVar[ i ].count = modif->myCount;
+
+ // Cut off "Unknown message invoked with the keyword " at the beginning
+ const char* toRm = "Unknown message invoked with the keyword ";
+ const size_t lenToRm = strlen( toRm );
+ if ( modif->myModif.size() > lenToRm &&
+ modif->myModif.compare( 0, lenToRm, toRm ) == 0 )
+ statsVar[ i ].name = modif->myModif.substr( lenToRm ).c_str();
+ }
+
+ return statsVar._retn();
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
GEOM::GEOM_Object_ptr FillHoles (GEOM::GEOM_Object_ptr theObject,
const GEOM::short_array& theWires);
- GEOM::GEOM_Object_ptr Sew (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr Sew (const GEOM::ListOfGO & theObject,
CORBA::Double theTolerance);
- GEOM::GEOM_Object_ptr SewAllowNonManifold (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr SewAllowNonManifold (const GEOM::ListOfGO & theObject,
CORBA::Double theTolerance);
- GEOM::GEOM_Object_ptr RemoveInternalFaces (GEOM::GEOM_Object_ptr theCompound);
+ GEOM::GEOM_Object_ptr RemoveInternalFaces (const GEOM::ListOfGO& theSolids);
GEOM::GEOM_Object_ptr DivideEdge (GEOM::GEOM_Object_ptr theObject,
- CORBA::Short theIndex,
- CORBA::Double theValue,
- CORBA::Boolean isByParameter);
+ CORBA::Short theIndex,
+ CORBA::Double theValue,
+ CORBA::Boolean isByParameter);
+
+ GEOM::GEOM_Object_ptr DivideEdgeByPoint (GEOM::GEOM_Object_ptr theObject,
+ CORBA::Short theIndex,
+ const GEOM::ListOfGO& thePoints);
GEOM::GEOM_Object_ptr FuseCollinearEdgesWithinWire (GEOM::GEOM_Object_ptr theWire,
const GEOM::ListOfGO& theVertices);
- CORBA::Boolean GetFreeBoundary(GEOM::GEOM_Object_ptr theObject,
- GEOM::ListOfGO_out theClosedWires,
- GEOM::ListOfGO_out theOpenWires );
+ CORBA::Boolean GetFreeBoundary(const GEOM::ListOfGO& theObjects,
+ GEOM::ListOfGO_out theClosedWires,
+ GEOM::ListOfGO_out theOpenWires );
GEOM::GEOM_Object_ptr ChangeOrientation (GEOM::GEOM_Object_ptr theObject);
GEOM::GEOM_Object_ptr ChangeOrientationCopy (GEOM::GEOM_Object_ptr theObject);
::GEOMImpl_IHealingOperations* GetOperations() { return (::GEOMImpl_IHealingOperations*)GetImpl(); }
+ GEOM::ModifStatistics* GetStatistics();
+
private:
Handle(TColStd_HArray1OfInteger) Convert( const GEOM::short_array& );
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GEOM_Engine.hxx"
#include "GEOM_BaseObject.hxx"
+#include "GEOMImpl_Types.hxx"
#include <Basics_OCCTVersion.hxx>
return anIDs._retn();
}
+//=============================================================================
+/*!
+ * TransferData
+ */
+//=============================================================================
+CORBA::Boolean GEOM_IInsertOperations_i::TransferData
+ (GEOM::GEOM_Object_ptr theObjectFrom,
+ GEOM::GEOM_Object_ptr theObjectTo,
+ GEOM::find_shape_method theFindMethod,
+ GEOM::GEOM_IInsertOperations::ListOfTransferDatum_out theResult)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ if (CORBA::is_nil(theObjectFrom) || CORBA::is_nil(theObjectTo))
+ {
+ return false;
+ }
+
+ //Get the reference shape
+ Handle(GEOM_Object) aShapeFrom = GetObjectImpl(theObjectFrom);
+ Handle(GEOM_Object) aShapeTo = GetObjectImpl(theObjectTo);
+
+ if (aShapeFrom.IsNull() || aShapeTo.IsNull())
+ {
+ return false;
+ }
+ bool isOk = false;
+ std::list<GEOMImpl_IInsertOperations::TransferDatum> aData;
+ int aFindMethod = -1;
+
+ switch (theFindMethod) {
+ case GEOM::FSM_GetInPlace:
+ aFindMethod = TD_GET_IN_PLACE;
+ break;
+ case GEOM::FSM_GetInPlaceByHistory:
+ aFindMethod = TD_GET_IN_PLACE_BY_HISTORY;
+ break;
+ case GEOM::FSM_GetInPlace_Old:
+ aFindMethod = TD_GET_IN_PLACE_OLD;
+ break;
+ default:
+ break;
+ }
+
+ // Transfer data.
+ if (aFindMethod > 0) {
+ isOk = GetOperations()->TransferData
+ (aShapeFrom, aShapeTo, aFindMethod, aData);
+ }
+
+ if (isOk) {
+ // Copy results.
+ const int aNbDatum = aData.size();
+ GEOM::GEOM_IInsertOperations::ListOfTransferDatum_var aResult =
+ new GEOM::GEOM_IInsertOperations::ListOfTransferDatum;
+
+ aResult->length(aNbDatum);
+
+ // fill the local CORBA array with values from lists
+ std::list<GEOMImpl_IInsertOperations::TransferDatum>::const_iterator
+ anIt = aData.begin();
+ int i = 0;
+
+ for (; anIt != aData.end(); i++, anIt++) {
+ GEOM::GEOM_IInsertOperations::TransferDatum_var aDatum =
+ new GEOM::GEOM_IInsertOperations::TransferDatum;
+
+ aDatum->myName = CORBA::string_dup(anIt->myName.ToCString());
+ aDatum->myNumber = anIt->myNumber;
+ aDatum->myMaxNumber = anIt->myMaxNumber;
+ aResult[i] = aDatum;
+ }
+
+ theResult = aResult._retn();
+ }
+
+ return isOk;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
CORBA::Long& theHeight);
GEOM::ListOfLong* GetAllTextures();
-
+
+ CORBA::Boolean TransferData
+ (GEOM::GEOM_Object_ptr theObjectFrom,
+ GEOM::GEOM_Object_ptr theObjectTo,
+ GEOM::find_shape_method theFindMethod,
+ GEOM::GEOM_IInsertOperations::ListOfTransferDatum_out theResult);
+
::GEOMImpl_IInsertOperations* GetOperations()
{ return (::GEOMImpl_IInsertOperations*)GetImpl(); }
};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
*/
//=============================================================================
CORBA::Boolean GEOM_IMeasureOperations_i::CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Long theCheckLevel,
GEOM::ListOfLong_out theIntersections)
{
// Set a not done flag
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
if (!aShape.IsNull()) {
+ GEOMImpl_IMeasureOperations::SICheckLevel aCheckLevel;
+
+ switch(theCheckLevel) {
+ case GEOM::SI_V_V:
+ aCheckLevel = GEOMImpl_IMeasureOperations::SI_V_V;
+ break;
+ case GEOM::SI_V_E:
+ aCheckLevel = GEOMImpl_IMeasureOperations::SI_V_E;
+ break;
+ case GEOM::SI_E_E:
+ aCheckLevel = GEOMImpl_IMeasureOperations::SI_E_E;
+ break;
+ case GEOM::SI_V_F:
+ aCheckLevel = GEOMImpl_IMeasureOperations::SI_V_F;
+ break;
+ case GEOM::SI_E_F:
+ aCheckLevel = GEOMImpl_IMeasureOperations::SI_E_F;
+ break;
+ case GEOM::SI_ALL:
+ default:
+ aCheckLevel = GEOMImpl_IMeasureOperations::SI_ALL;
+ break;
+ }
+
Handle(TColStd_HSequenceOfInteger) anIntegers = new TColStd_HSequenceOfInteger;
// Detect self-intersections
- isGood = GetOperations()->CheckSelfIntersections(aShape, anIntegers);
+ isGood = GetOperations()->CheckSelfIntersections
+ (aShape, aCheckLevel, anIntegers);
int nbInts = anIntegers->Length();
return isGood;
}
+//=============================================================================
+/*!
+ * CheckSelfIntersectionsFast
+ */
+//=============================================================================
+CORBA::Boolean GEOM_IMeasureOperations_i::CheckSelfIntersectionsFast
+ (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Float theDeflection,
+ CORBA::Double theTolerance,
+ GEOM::ListOfLong_out theIntersections)
+{
+ // Set a not done flag
+ GetOperations()->SetNotDone();
+
+ bool isGood = false;
+
+ // Allocate the CORBA arrays
+ GEOM::ListOfLong_var anIntegersArray = new GEOM::ListOfLong();
+
+ // Get the reference shape
+ Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+
+ if (!aShape.IsNull()) {
+ Handle(TColStd_HSequenceOfInteger) anIntegers = new TColStd_HSequenceOfInteger;
+
+ // Detect self-intersections
+ isGood = GetOperations()->CheckSelfIntersectionsFast
+ (aShape, theDeflection, theTolerance, anIntegers);
+
+ int nbInts = anIntegers->Length();
+
+ anIntegersArray->length(nbInts);
+
+ for (int ii = 0; ii < nbInts; ii++) {
+ anIntegersArray[ii] = anIntegers->Value(ii + 1);
+ }
+ }
+
+ // Initialize out-parameters with local arrays
+ theIntersections = anIntegersArray._retn();
+ return isGood;
+}
+
+//=============================================================================
+/*!
+ * FastIntersect
+ */
+//=============================================================================
+CORBA::Boolean GEOM_IMeasureOperations_i::FastIntersect (GEOM::GEOM_Object_ptr theShape1,
+ GEOM::GEOM_Object_ptr theShape2,
+ CORBA::Double theTolerance,
+ CORBA::Float theDeflection,
+ GEOM::ListOfLong_out theIntersections1,
+ GEOM::ListOfLong_out theIntersections2)
+{
+ // Set a not done flag
+ GetOperations()->SetNotDone();
+
+ bool isGood = false;
+
+ // Allocate the CORBA arrays
+ GEOM::ListOfLong_var anIntegersArray1 = new GEOM::ListOfLong();
+ GEOM::ListOfLong_var anIntegersArray2 = new GEOM::ListOfLong();
+
+ // Get the reference shape
+ Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
+ Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
+
+ if (!aShape1.IsNull() && !aShape2.IsNull()) {
+ Handle(TColStd_HSequenceOfInteger) anIntegers1 = new TColStd_HSequenceOfInteger;
+ Handle(TColStd_HSequenceOfInteger) anIntegers2 = new TColStd_HSequenceOfInteger;
+
+ // Detect intersections
+ isGood = GetOperations()->FastIntersect
+ (aShape1, aShape2, theTolerance, theDeflection, anIntegers1, anIntegers2);
+
+ int nbInts1 = anIntegers1->Length();
+ int nbInts2 = anIntegers2->Length();
+
+ anIntegersArray1->length(nbInts1);
+ anIntegersArray2->length(nbInts2);
+
+ for (int ii = 0; ii < nbInts1; ii++) {
+ anIntegersArray1[ii] = anIntegers1->Value(ii + 1);
+ }
+ for (int ii = 0; ii < nbInts2; ii++) {
+ anIntegersArray2[ii] = anIntegers2->Value(ii + 1);
+ }
+ }
+
+ // Initialize out-parameters with local arrays
+ theIntersections1 = anIntegersArray1._retn();
+ theIntersections2 = anIntegersArray2._retn();
+ return isGood;
+}
+
//=============================================================================
/*!
* IsGoodForSolid
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
const GEOM::GEOM_IMeasureOperations::ShapeErrors &theErrors);
CORBA::Boolean CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Long theCheckLevel,
GEOM::ListOfLong_out theIntersections);
+ CORBA::Boolean CheckSelfIntersectionsFast (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Float theDeflection,
+ CORBA::Double theTolerance,
+ GEOM::ListOfLong_out theIntersections);
+
+ CORBA::Boolean FastIntersect (GEOM::GEOM_Object_ptr theShape1,
+ GEOM::GEOM_Object_ptr theShape2,
+ CORBA::Double theTolerance,
+ CORBA::Float theDeflection,
+ GEOM::ListOfLong_out theIntersections1,
+ GEOM::ListOfLong_out theIntersections2);
+
char* IsGoodForSolid (GEOM::GEOM_Object_ptr theShape);
char* WhatIs (GEOM::GEOM_Object_ptr theShape);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
return aResult;
}
+//=======================================================================
+//function : GetListOfObjectsImpl
+//purpose :
+//=======================================================================
+
+bool GEOM_IOperations_i::GetListOfObjectsImpl(const GEOM::ListOfGO& theObjects,
+ std::list< Handle(GEOM_Object) >& theList)
+{
+ int i;
+ int aNbObj = theObjects.length();
+
+ for (i = 0; i < aNbObj; i++) {
+ Handle(GEOM_Object) anObj = GetObjectImpl(theObjects[i]);
+
+ if (anObj.IsNull())
+ return false;
+
+ theList.push_back(anObj);
+ }
+
+ return true;
+}
+
//=============================================================================
/*!
* UpdateGUIForObject
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
Handle(TColStd_HSequenceOfTransient)
GetListOfObjectsImpl(const GEOM::ListOfGO& theObjects);
+ bool GetListOfObjectsImpl(const GEOM::ListOfGO& theObjects,
+ std::list< Handle(GEOM_Object) >& theList);
Handle(TColStd_HArray1OfExtendedString)
ConvertStringArray(const GEOM::string_array &theInArray);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TColStd_HSequenceOfTransient.hxx>
#include <TColStd_HArray1OfInteger.hxx>
+/**
+ * This function converts GEOM::comparison_condition type into
+ * GEOMUtils::ComparisonCondition type.
+ *
+ * \param theCondition the condition of GEOM::comparison_condition type
+ * \return the condition of GEOMUtils::ComparisonCondition type.
+ */
+static GEOMUtils::ComparisonCondition ComparisonCondition
+ (const GEOM::comparison_condition theCondition)
+{
+ GEOMUtils::ComparisonCondition aResult = GEOMUtils::CC_GT;
+
+ switch (theCondition) {
+ case GEOM::CC_GE:
+ aResult = GEOMUtils::CC_GE;
+ break;
+ case GEOM::CC_LT:
+ aResult = GEOMUtils::CC_LT;
+ break;
+ case GEOM::CC_LE:
+ aResult = GEOMUtils::CC_LE;
+ break;
+ default:
+ break;
+ }
+
+ return aResult;
+}
+
//=============================================================================
/*!
* constructor:
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeFaceFromSurface
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceFromSurface
+ (GEOM::GEOM_Object_ptr theFace,
+ GEOM::GEOM_Object_ptr theWire)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference face and wire
+ Handle(GEOM_Object) aFace = GetObjectImpl(theFace);
+ Handle(GEOM_Object) aWire = GetObjectImpl(theWire);
+
+ if (aFace.IsNull() || aWire.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ //Create the Face
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeFaceFromSurface(aFace, aWire);
+
+ if (anObject.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ * MakeFaceWithConstraints
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWithConstraints
+ (const GEOM::ListOfGO& theConstraints)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the shapes
+ std::list<Handle(GEOM_Object)> aConstraints;
+ for( int ind = 0; ind < theConstraints.length(); ind++ ) {
+ Handle(GEOM_Object) anObject = GetObjectImpl( theConstraints[ind] );
+ aConstraints.push_back(anObject);
+ }
+
+ // Make Face
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeFaceWithConstraints( aConstraints );
+
+ // enable warning status
+ if (anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* MakeShell
* MakeCompound
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound
- (const GEOM::ListOfGO& theShapes)
+GEOM::GEOM_Object_ptr
+GEOM_IShapesOperations_i::MakeCompound (const GEOM::ListOfGO& theShapes)
{
GEOM::GEOM_Object_var aGEOMObject;
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeSolidFromConnectedFaces
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidFromConnectedFaces
+ (const GEOM::ListOfGO& theFacesOrShells,
+ const CORBA::Boolean isIntersect)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ int ind, aLen;
+ std::list<Handle(GEOM_Object)> aShapes;
+
+ //Get the shapes
+ aLen = theFacesOrShells.length();
+ for (ind = 0; ind < aLen; ind++) {
+ Handle(GEOM_Object) aSh = GetObjectImpl(theFacesOrShells[ind]);
+ if (aSh.IsNull()) return aGEOMObject._retn();
+ aShapes.push_back(aSh);
+ }
+
+ // Make Solid
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeSolidFromConnectedFaces(aShapes, isIntersect);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* MakeGlueFaces
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
- (GEOM::GEOM_Object_ptr theShape,
- CORBA::Double theTolerance,
- CORBA::Boolean doKeepNonSolids)
+GEOM::GEOM_Object_ptr
+GEOM_IShapesOperations_i::MakeGlueFaces (const GEOM::ListOfGO& theShapes,
+ CORBA::Double theTolerance,
+ CORBA::Boolean doKeepNonSolids)
{
GEOM::GEOM_Object_var aGEOMObject;
GetOperations()->SetNotDone();
//Get the reference objects
- Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
- if (aShape.IsNull()) return aGEOMObject._retn();
+ std::list< Handle(GEOM_Object) > aShapes;
+ if (! GetListOfObjectsImpl( theShapes, aShapes ))
+ return aGEOMObject._retn();
//Perform the gluing
Handle(GEOM_Object) anObject =
- GetOperations()->MakeGlueFaces(aShape, theTolerance, doKeepNonSolids);
+ GetOperations()->MakeGlueFaces(aShapes, theTolerance, doKeepNonSolids);
//if (!GetOperations()->IsDone() || anObject.IsNull())
// to allow warning
if (anObject.IsNull())
* GetGlueFaces
*/
//=============================================================================
-GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces
- (GEOM::GEOM_Object_ptr theShape,
- const CORBA::Double theTolerance)
+GEOM::ListOfGO*
+GEOM_IShapesOperations_i::GetGlueFaces (const GEOM::ListOfGO& theShapes,
+ const CORBA::Double theTolerance)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
GetOperations()->SetNotDone();
//Get the reference objects
- Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
- if (aShape.IsNull()) return aSeq._retn();
+ std::list< Handle(GEOM_Object) > aShapes;
+ if (! GetListOfObjectsImpl( theShapes, aShapes ))
+ return aSeq._retn();
Handle(TColStd_HSequenceOfTransient) aHSeq =
- //GetOperations()->GetGlueFaces(aShape, theTolerance);
- GetOperations()->GetGlueShapes(aShape, theTolerance, TopAbs_FACE);
+ GetOperations()->GetGlueShapes(aShapes, theTolerance, TopAbs_FACE);
//if (!GetOperations()->IsDone() || aHSeq.IsNull())
// to allow warning
* MakeGlueFacesByList
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
- (GEOM::GEOM_Object_ptr theShape,
- CORBA::Double theTolerance,
- const GEOM::ListOfGO& theFaces,
- CORBA::Boolean doKeepNonSolids,
- CORBA::Boolean doGlueAllEdges)
+GEOM::GEOM_Object_ptr
+GEOM_IShapesOperations_i::MakeGlueFacesByList (const GEOM::ListOfGO& theShapes,
+ CORBA::Double theTolerance,
+ const GEOM::ListOfGO& theFaces,
+ CORBA::Boolean doKeepNonSolids,
+ CORBA::Boolean doGlueAllEdges)
{
GEOM::GEOM_Object_var aGEOMObject;
GetOperations()->SetNotDone();
//Get the reference objects
- Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
- if (aShape.IsNull()) return aGEOMObject._retn();
+ std::list< Handle(GEOM_Object) > aShapes;
+ if (! GetListOfObjectsImpl( theShapes, aShapes ))
+ return aGEOMObject._retn();
- int ind, aLen;
- std::list<Handle(GEOM_Object)> aFaces;
//Get the shapes
- aLen = theFaces.length();
- for (ind = 0; ind < aLen; ind++) {
- Handle(GEOM_Object) aSh = GetObjectImpl(theFaces[ind]);
- if (aSh.IsNull()) return aGEOMObject._retn();
- aFaces.push_back(aSh);
- }
+ std::list<Handle(GEOM_Object)> aFaces;
+ if (! GetListOfObjectsImpl( theFaces, aFaces ))
+ return aGEOMObject._retn();
//Perform the gluing
Handle(GEOM_Object) anObject =
- GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids, doGlueAllEdges);
+ GetOperations()->MakeGlueFacesByList(aShapes, theTolerance, aFaces,
+ doKeepNonSolids, doGlueAllEdges);
//if (!GetOperations()->IsDone() || anObject.IsNull())
// to allow warning
if (anObject.IsNull())
* MakeGlueEdges
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdges
- (GEOM::GEOM_Object_ptr theShape,
- CORBA::Double theTolerance)
+GEOM::GEOM_Object_ptr
+GEOM_IShapesOperations_i::MakeGlueEdges (const GEOM::ListOfGO& theShapes,
+ CORBA::Double theTolerance)
{
GEOM::GEOM_Object_var aGEOMObject;
GetOperations()->SetNotDone();
//Get the reference objects
- Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
- if (aShape.IsNull()) return aGEOMObject._retn();
+ std::list< Handle(GEOM_Object) > aShapes;
+ if (! GetListOfObjectsImpl( theShapes, aShapes ))
+ return aGEOMObject._retn();
//Perform the gluing
Handle(GEOM_Object) anObject =
- GetOperations()->MakeGlueEdges(aShape, theTolerance);
+ GetOperations()->MakeGlueEdges(aShapes, theTolerance);
//if (!GetOperations()->IsDone() || anObject.IsNull())
// to allow warning
if (anObject.IsNull())
* GetGlueEdges
*/
//=============================================================================
-GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueEdges
- (GEOM::GEOM_Object_ptr theShape,
- const CORBA::Double theTolerance)
+GEOM::ListOfGO*
+GEOM_IShapesOperations_i::GetGlueEdges (const GEOM::ListOfGO& theShapes,
+ const CORBA::Double theTolerance)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
GetOperations()->SetNotDone();
//Get the reference objects
- Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
- if (aShape.IsNull()) return aSeq._retn();
+ std::list< Handle(GEOM_Object) > aShapes;
+ if (! GetListOfObjectsImpl( theShapes, aShapes ))
+ return aSeq._retn();
Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->GetGlueShapes(aShape, theTolerance, TopAbs_EDGE);
+ GetOperations()->GetGlueShapes(aShapes, theTolerance, TopAbs_EDGE);
//if (!GetOperations()->IsDone() || aHSeq.IsNull())
// to allow warning
* MakeGlueEdgesByList
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdgesByList
- (GEOM::GEOM_Object_ptr theShape,
- CORBA::Double theTolerance,
- const GEOM::ListOfGO& theEdges)
+GEOM::GEOM_Object_ptr
+GEOM_IShapesOperations_i::MakeGlueEdgesByList (const GEOM::ListOfGO& theShapes,
+ CORBA::Double theTolerance,
+ const GEOM::ListOfGO& theEdges)
{
GEOM::GEOM_Object_var aGEOMObject;
GetOperations()->SetNotDone();
//Get the reference objects
- Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
- if (aShape.IsNull()) return aGEOMObject._retn();
+ std::list< Handle(GEOM_Object) > aShapes;
+ if (! GetListOfObjectsImpl( theShapes, aShapes ))
+ return aGEOMObject._retn();
- int ind, aLen;
- std::list<Handle(GEOM_Object)> anEdges;
//Get the shapes
- aLen = theEdges.length();
- for (ind = 0; ind < aLen; ind++) {
- Handle(GEOM_Object) aSh = GetObjectImpl(theEdges[ind]);
- if (aSh.IsNull()) return aGEOMObject._retn();
- anEdges.push_back(aSh);
- }
+ std::list<Handle(GEOM_Object)> anEdges;
+ if (! GetListOfObjectsImpl( theEdges, anEdges ))
+ return aGEOMObject._retn();
//Perform the gluing
Handle(GEOM_Object) anObject =
- GetOperations()->MakeGlueEdgesByList(aShape, theTolerance, anEdges);
+ GetOperations()->MakeGlueEdgesByList(aShapes, theTolerance, anEdges);
//if (!GetOperations()->IsDone() || anObject.IsNull())
// to allow warning
if (anObject.IsNull())
* GetExistingSubObjects
*/
//=============================================================================
-GEOM::ListOfGO* GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
- CORBA::Boolean theGroupsOnly)
+GEOM::ListOfGO*
+GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Boolean theGroupsOnly)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
if (aShape.IsNull()) return aSeq._retn();
Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->GetExistingSubObjects(aShape, theGroupsOnly);
+ GetOperations()->GetExistingSubObjects(aShape, (Standard_Boolean)theGroupsOnly);
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
return CORBA::string_dup(aDescription.ToCString());
}
+//=============================================================================
+/*!
+ * IsSubShapeBelongsTo
+ */
+//=============================================================================
+CORBA::Boolean GEOM_IShapesOperations_i::IsSubShapeBelongsTo( GEOM::GEOM_Object_ptr theSubObject,
+ const CORBA::Long theSubObjectIndex,
+ GEOM::GEOM_Object_ptr theObject,
+ const CORBA::Long theObjectIndex)
+{
+ Handle(GEOM_Object) aSubObject = GetObjectImpl( theSubObject );
+ Handle(GEOM_Object) anObject = GetObjectImpl( theObject );
+ if( anObject.IsNull() || aSubObject.IsNull() )
+ return false;
+
+ // Get parameters
+ return GetOperations()->IsSubShapeBelongsTo( aSubObject, theSubObjectIndex, anObject, theObjectIndex );
+}
+
//=============================================================================
/*!
* NumberOfFaces
//=============================================================================
GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapesMulti
(const GEOM::ListOfGO& theShapes,
- const CORBA::Long theShapeType)
+ const CORBA::Long theShapeType,
+ CORBA::Boolean theMultiShare)
{
//Set a not done flag
GetOperations()->SetNotDone();
//Get the shapes
std::list<Handle(GEOM_Object)> aShapes;
- int aLen = theShapes.length();
- for (int ind = 0; ind < aLen; ind++) {
- Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
- if (aSh.IsNull()) return aSeq._retn();
- aShapes.push_back(aSh);
- }
+ if (! GetListOfObjectsImpl( theShapes, aShapes ))
+ return aSeq._retn();
Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->GetSharedShapes(aShapes, theShapeType);
+ GetOperations()->GetSharedShapes(aShapes, theShapeType, theMultiShare);
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
return aSeq._retn();
}
+
+//=============================================================================
+/*!
+ * ExtendEdge
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ExtendEdge
+ (GEOM::GEOM_Object_ptr theEdge,
+ CORBA::Double theMin,
+ CORBA::Double theMax)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference objects
+ Handle(GEOM_Object) anEdge = GetObjectImpl(theEdge);
+
+ if (anEdge.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ //Get Shapes in place of aShapeWhat
+ Handle(GEOM_Object) aNewEdge =
+ GetOperations()->ExtendEdge(anEdge, theMin, theMax);
+
+ if (!GetOperations()->IsDone() || aNewEdge.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ return GetObject(aNewEdge);
+}
+
+//=============================================================================
+/*!
+ * ExtendFace
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ExtendFace
+ (GEOM::GEOM_Object_ptr theFace,
+ CORBA::Double theUMin,
+ CORBA::Double theUMax,
+ CORBA::Double theVMin,
+ CORBA::Double theVMax)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference objects
+ Handle(GEOM_Object) aFace = GetObjectImpl(theFace);
+
+ if (aFace.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ //Get Shapes in place of aShapeWhat
+ Handle(GEOM_Object) aNewFace =
+ GetOperations()->ExtendFace(aFace, theUMin, theUMax, theVMin, theVMax);
+
+ if (!GetOperations()->IsDone() || aNewFace.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ return GetObject(aNewFace);
+}
+
+//=============================================================================
+/*!
+ * MakeSurfaceFromFace
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSurfaceFromFace
+ (GEOM::GEOM_Object_ptr theFace)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference object
+ Handle(GEOM_Object) aFace = GetObjectImpl(theFace);
+
+ if (aFace.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ //Get Shapes in place of aShapeWhat
+ Handle(GEOM_Object) aNewFace = GetOperations()->MakeSurfaceFromFace(aFace);
+
+ if (!GetOperations()->IsDone() || aNewFace.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ return GetObject(aNewFace);
+}
+
+//=============================================================================
+/*!
+ * GetSubShapeEdgeSorted
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSubShapeEdgeSorted
+ (GEOM::GEOM_Object_ptr theShape,
+ GEOM::GEOM_Object_ptr theStartPoint)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference objects
+ Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+ Handle(GEOM_Object) aStartPoint = GetObjectImpl(theStartPoint);
+
+ if (aShape.IsNull() || aStartPoint.IsNull()) {
+ return aSeq._retn();
+ }
+
+ //Get Shapes On Shape
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->GetSubShapeEdgeSorted(aShape, aStartPoint);
+
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ const Standard_Integer aLength = aHSeq->Length();
+ Standard_Integer i;
+
+ aSeq->length(aLength);
+
+ for (i = 1; i <= aLength; i++) {
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+ }
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * GetSubShapesWithTolerance
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSubShapesWithTolerance
+ (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Short theShapeType,
+ GEOM::comparison_condition theCondition,
+ CORBA::Double theTolerance)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference objects
+ Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+
+ if (aShape.IsNull()) {
+ return aSeq._retn();
+ }
+
+ //Get Shapes On Shape
+ const GEOMUtils::ComparisonCondition aCondition =
+ ComparisonCondition(theCondition);
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->GetSubShapesWithTolerance
+ (aShape, theShapeType, aCondition, theTolerance);
+
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ const Standard_Integer aLength = aHSeq->Length();
+ Standard_Integer i;
+
+ aSeq->length(aLength);
+
+ for (i = 1; i <= aLength; i++) {
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+ }
+
+ return aSeq._retn();
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
GEOM::GEOM_Object_ptr MakeFaceWires (const GEOM::ListOfGO& theWires,
CORBA::Boolean isPlanarWanted);
+ GEOM::GEOM_Object_ptr MakeFaceFromSurface(GEOM::GEOM_Object_ptr theFace,
+ GEOM::GEOM_Object_ptr theWire);
+
+ GEOM::GEOM_Object_ptr MakeFaceWithConstraints (const GEOM::ListOfGO& theConstraints);
+
GEOM::GEOM_Object_ptr MakeShell (const GEOM::ListOfGO& theFacesAndShells);
GEOM::GEOM_Object_ptr MakeSolidShell (GEOM::GEOM_Object_ptr theShell);
GEOM::GEOM_Object_ptr MakeCompound (const GEOM::ListOfGO& theShapes);
- GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape,
+ GEOM::GEOM_Object_ptr MakeSolidFromConnectedFaces (const GEOM::ListOfGO& theFacesOrShells,
+ CORBA::Boolean isIntersect);
+
+ GEOM::GEOM_Object_ptr MakeGlueFaces (const GEOM::ListOfGO& theShape,
CORBA::Double theTolerance,
CORBA::Boolean doKeepNonSolids);
- GEOM::ListOfGO* GetGlueFaces (GEOM::GEOM_Object_ptr theShape,
+ GEOM::ListOfGO* GetGlueFaces (const GEOM::ListOfGO& theShape,
CORBA::Double theTolerance);
- GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
+ GEOM::GEOM_Object_ptr MakeGlueFacesByList (const GEOM::ListOfGO& theShape,
CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids,
CORBA::Boolean doGlueAllEdges);
- GEOM::GEOM_Object_ptr MakeGlueEdges (GEOM::GEOM_Object_ptr theShape,
+ GEOM::GEOM_Object_ptr MakeGlueEdges (const GEOM::ListOfGO& theShape,
CORBA::Double theTolerance);
- GEOM::ListOfGO* GetGlueEdges (GEOM::GEOM_Object_ptr theShape,
+ GEOM::ListOfGO* GetGlueEdges (const GEOM::ListOfGO& theShape,
CORBA::Double theTolerance);
- GEOM::GEOM_Object_ptr MakeGlueEdgesByList (GEOM::GEOM_Object_ptr theShape,
+ GEOM::GEOM_Object_ptr MakeGlueEdgesByList (const GEOM::ListOfGO& theShape,
CORBA::Double theTolerance,
const GEOM::ListOfGO& theEdges);
char* GetShapeTypeString (GEOM::GEOM_Object_ptr theShape);
+ CORBA::Boolean IsSubShapeBelongsTo( GEOM::GEOM_Object_ptr theSubobject,
+ const CORBA::Long theSubObjectIndex,
+ GEOM::GEOM_Object_ptr theObject,
+ const CORBA::Long theObjectIndex );
+
CORBA::Long NumberOfFaces (GEOM::GEOM_Object_ptr theShape);
CORBA::Long NumberOfEdges (GEOM::GEOM_Object_ptr theShape);
CORBA::Long NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType);
GEOM::ListOfGO* GetSharedShapesMulti (const GEOM::ListOfGO& theShapes,
- CORBA::Long theShapeType);
+ CORBA::Long theShapeType,
+ CORBA::Boolean theMultiShare);
GEOM::ListOfGO* GetShapesOnPlane (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
GEOM::ListOfLong* GetSameIDs (GEOM::GEOM_Object_ptr theShapeWhere,
GEOM::GEOM_Object_ptr theShapeWhat);
+ GEOM::GEOM_Object_ptr ExtendEdge(GEOM::GEOM_Object_ptr theEdge,
+ CORBA::Double theMin,
+ CORBA::Double theMax);
+
+ GEOM::GEOM_Object_ptr ExtendFace(GEOM::GEOM_Object_ptr theFace,
+ CORBA::Double theUMin,
+ CORBA::Double theUMax,
+ CORBA::Double theVMin,
+ CORBA::Double theVMax);
+
+ GEOM::GEOM_Object_ptr MakeSurfaceFromFace(GEOM::GEOM_Object_ptr theFace);
+
+ GEOM::ListOfGO* GetSubShapeEdgeSorted (GEOM::GEOM_Object_ptr theShape,
+ GEOM::GEOM_Object_ptr theStartPoint);
+
+ GEOM::ListOfGO* GetSubShapesWithTolerance
+ (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Short theShapeType,
+ GEOM::comparison_condition theCondition,
+ CORBA::Double theTolerance);
+
::GEOMImpl_IShapesOperations* GetOperations()
{ return (::GEOMImpl_IShapesOperations*)GetImpl(); }
};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
return aGEOMObject._retn();
}
+
+//=============================================================================
+/*!
+ * MakeProjectionOnCylinder
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MakeProjectionOnCylinder
+ (GEOM::GEOM_Object_ptr theObject,
+ CORBA::Double theRadius,
+ CORBA::Double theStartAngle,
+ CORBA::Double theAngleLength,
+ CORBA::Double theAngleRotation)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the object
+ Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
+
+ if (anObject.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ //Perform the transformation
+ Handle(GEOM_Object) aResObject = GetOperations()->MakeProjectionOnCylinder
+ (anObject, theRadius, theStartAngle, theAngleLength, theAngleRotation);
+
+ if (!GetOperations()->IsDone() || aResObject.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ return GetObject(aResObject);
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
GEOM::GEOM_Object_ptr RecomputeObject (GEOM::GEOM_Object_ptr theObject);
+ GEOM::GEOM_Object_ptr MakeProjectionOnCylinder
+ (GEOM::GEOM_Object_ptr theObject,
+ CORBA::Double theRadius,
+ CORBA::Double theStartAngle,
+ CORBA::Double theAngleLength,
+ CORBA::Double theAngleRotation);
::GEOMImpl_ITransformOperations* GetOperations() { return (::GEOMImpl_ITransformOperations*)GetImpl(); }
};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TCollection_AsciiString.hxx>
#include <TDF_Label.hxx>
#include <TDF_Tool.hxx>
+#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
#include <TopAbs.hxx>
#include <TopoDS_Iterator.hxx>
return getMinMaxShapeType( _impl->GetValue(), false );
}
+//================================================================================
+/*!
+ * GetSubShapeName
+ */
+//================================================================================
+
+char* GEOM_Object_i::GetSubShapeName(CORBA::Long subID)
+{
+ CORBA::String_var name("");
+
+ Handle(GEOM_Function) aMainFun = _impl->GetLastFunction();
+ if ( aMainFun.IsNull() ) return name._retn();
+
+ const TDataStd_ListOfExtendedString& aListEntries = aMainFun->GetSubShapeReferences();
+ TDataStd_ListIteratorOfListOfExtendedString anIt( aListEntries );
+ for (; anIt.More(); anIt.Next())
+ {
+ TCollection_AsciiString anEntry = anIt.Value();
+ Handle(GEOM_BaseObject) anObj =
+ GEOM_Engine::GetEngine()->GetObject( _impl->GetDocID(), anEntry.ToCString(), false );
+ if ( anObj.IsNull() ) continue;
+
+ TCollection_AsciiString aSubName = anObj->GetName();
+ if ( aSubName.IsEmpty() ) continue;
+
+ Handle(GEOM_Function) aFun = anObj->GetLastFunction();
+ if ( aFun.IsNull() ) continue;
+
+ GEOM_ISubShape ISS( aFun );
+ Handle(TColStd_HArray1OfInteger) subIDs = ISS.GetIndices();
+ if ( subIDs.IsNull() || subIDs->Length() != 1 ) continue;
+
+ if ( subIDs->Value( subIDs->Lower() ) == subID )
+ {
+ name = aSubName.ToCString();
+ break;
+ }
+ }
+ return name._retn();
+}
+
//=============================================================================
/*!
* SetColor
return !_impl->GetValue().IsNull() && _impl->GetType() != GEOM_MARKER;
}
-bool GEOM_Object_i::IsSame(GEOM::GEOM_Object_ptr other)
+bool GEOM_Object_i::IsSame(GEOM::GEOM_BaseObject_ptr other)
{
- TopoDS_Shape thisShape = _impl->GetValue();
- TopoDS_Shape otherShape;
- if ( !CORBA::is_nil( other ) ) {
+ bool result = false;
+
+ GEOM::GEOM_Object_var shapePtr = GEOM::GEOM_Object::_narrow( other );
+ if ( !CORBA::is_nil( shapePtr ) ) {
+ CORBA::String_var entry = shapePtr->GetEntry();
Handle(GEOM_Object) otherObject = Handle(GEOM_Object)::DownCast
- ( GEOM_Engine::GetEngine()->GetObject( other->GetStudyID(), other->GetEntry(), false ));
- if ( !otherObject.IsNull() )
- otherShape = otherObject->GetValue();
+ ( GEOM_Engine::GetEngine()->GetObject( shapePtr->GetStudyID(), entry, false ));
+ if ( !otherObject.IsNull() ) {
+ TopoDS_Shape thisShape = _impl->GetValue();
+ TopoDS_Shape otherShape = otherObject->GetValue();
+ result = !thisShape.IsNull() && !otherShape.IsNull() && thisShape.IsSame( otherShape );
+ }
}
- return thisShape.IsSame( otherShape );
+ return result;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::shape_type GetMaxShapeType();
+ virtual char* GetSubShapeName(CORBA::Long subID);
+
virtual void SetColor(const SALOMEDS::Color& theColor);
virtual SALOMEDS::Color GetColor();
virtual GEOM::GEOM_Object_ptr GetMainShape();
- virtual bool IsSame(GEOM::GEOM_Object_ptr other);
+ virtual bool IsSame(GEOM::GEOM_BaseObject_ptr other);
virtual bool IsShape();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
beginService( " GEOM_Superv_i::MakePointOnCurve" );
MESSAGE("GEOM_Superv_i::MakePointOnCurve");
getBasicOp();
- GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurve(theRefCurve, theParameter);
+ GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurve(theRefCurve, theParameter, false);
endService( " GEOM_Superv_i::MakePointOnCurve" );
return anObj;
}
beginService( " GEOM_Superv_i::MakePipe" );
MESSAGE("GEOM_Superv_i::MakePipe");
get3DPrimOp();
- GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakePipe(theBase, thePath);
+ GEOM::ListOfGO_var aList = my3DPrimOp->MakePipe(theBase, thePath, false);
endService( " GEOM_Superv_i::MakePipe" );
- return anObj;
+ return aList[0];
}
//=============================================================================
beginService( " GEOM_Superv_i::MakeFilling" );
MESSAGE("GEOM_Superv_i::MakeFilling");
get3DPrimOp();
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length( 1 );
+ objList[0] = theShape;
GEOM::GEOM_Object_ptr anObj =
- my3DPrimOp->MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D,
+ my3DPrimOp->MakeFilling(objList, theMinDeg, theMaxDeg, theTol2D, theTol3D,
theNbIter, theMethod, theApprox);
endService( " GEOM_Superv_i::MakeFilling" );
return anObj;
beginService( " GEOM_Superv_i::MakePipeWithDifferentSections" );
MESSAGE("GEOM_Superv_i::MakePipeWithDifferentSections");
get3DPrimOp();
- GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakePipeWithDifferentSections(theBases,theLocations, thePath,theWithContact,theWithCorrections);
+ GEOM::ListOfGO_var aList = my3DPrimOp->MakePipeWithDifferentSections(theBases,theLocations, thePath,theWithContact,theWithCorrections, false, false);
endService( " GEOM_Superv_i::MakePipeWithDifferentSections" );
- return anObj;
+ return aList[0];
}
beginService( " GEOM_Superv_i::MakePipeWithShellSections" );
MESSAGE("GEOM_Superv_i::MakePipeWithShellSections");
get3DPrimOp();
- GEOM::GEOM_Object_ptr anObj =
+ GEOM::ListOfGO_var aList =
my3DPrimOp->MakePipeWithShellSections(theBases, theSubBases,
theLocations, thePath,
- theWithContact, theWithCorrections);
+ theWithContact, theWithCorrections,
+ false);
endService( " GEOM_Superv_i::MakePipeWithShellSections" );
- return anObj;
+ return aList[0];
}
beginService( " GEOM_Superv_i::MakePipeShellsWithoutPath" );
MESSAGE("GEOM_Superv_i::MakePipeShellsWithoutPath");
get3DPrimOp();
- GEOM::GEOM_Object_ptr anObj =
- my3DPrimOp->MakePipeShellsWithoutPath(theBases,theLocations);
+ GEOM::ListOfGO_var aList =
+ my3DPrimOp->MakePipeShellsWithoutPath(theBases,theLocations, false);
endService( " GEOM_Superv_i::MakePipeShellsWithoutPath" );
- return anObj;
+ return aList[0];
}
beginService( " GEOM_Superv_i::MakePipeBiNormalAlongVector" );
MESSAGE("GEOM_Superv_i::MakePipeBiNormalAlongVector");
get3DPrimOp();
- GEOM::GEOM_Object_ptr anObj =
- my3DPrimOp->MakePipeBiNormalAlongVector(theBase, thePath, theVec);
+ GEOM::ListOfGO_var aList =
+ my3DPrimOp->MakePipeBiNormalAlongVector(theBase, thePath, theVec, false);
endService( " GEOM_Superv_i::MakePipeBiNormalAlongVector" );
- return anObj;
+ return aList[0];
}
return NULL;
}
+//=============================================================================
+// MakeFaceWithConstraints:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceWithConstraints (GEOM::GEOM_List_ptr theConstraints)
+{
+ beginService( " GEOM_Superv_i::MakeFaceWithConstraints" );
+ MESSAGE("GEOM_Superv_i::MakeFaceWithConstraints");
+ if (GEOM_List_i<GEOM::ListOfGO>* aConstraints =
+ dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(theConstraints, myPOA).in())) {
+ getShapesOp();
+ GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeFaceWithConstraints(aConstraints->GetList());
+ endService( " GEOM_Superv_i::MakeFaceWithConstraints" );
+ return anObj;
+ }
+ endService( " GEOM_Superv_i::MakeFaceWithConstraints" );
+ return NULL;
+}
+
//=============================================================================
// MakeShell:
//=============================================================================
return NULL;
}
+//=============================================================================
+// MakeSolidFromConnectedFaces:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSolidFromConnectedFaces (GEOM::GEOM_List_ptr theFacesOrShells,
+ CORBA::Boolean isIntersect)
+{
+ beginService( " GEOM_Superv_i::MakeSolidFromConnectedFaces" );
+ MESSAGE("GEOM_Superv_i::MakeSolidFromConnectedFaces");
+ if (GEOM_List_i<GEOM::ListOfGO>* aListImpl =
+ dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(theFacesOrShells, myPOA).in())) {
+ getShapesOp();
+ GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeSolidFromConnectedFaces(aListImpl->GetList(), isIntersect);
+ endService( " GEOM_Superv_i::MakeSolidFromConnectedFaces" );
+ return anObj;
+ }
+ endService( " GEOM_Superv_i::MakeSolidFromConnectedFaces" );
+ return NULL;
+}
+
//=============================================================================
// MakeGlueFaces:
//=============================================================================
beginService( " GEOM_Superv_i::MakeGlueFaces" );
MESSAGE("GEOM_Superv_i::MakeGlueFaces");
getShapesOp();
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length( 1 );
+ objList[0] = theShape;
GEOM::GEOM_Object_ptr anObj =
- myShapesOp->MakeGlueFaces(theShape, theTolerance, doKeepNonSolids);
+ myShapesOp->MakeGlueFaces(objList, theTolerance, doKeepNonSolids);
endService( " GEOM_Superv_i::MakeGlueFaces" );
return anObj;
}
beginService( " GEOM_Superv_i::GetGlueFaces" );
MESSAGE("GEOM_Superv_i::GetGlueFaces");
getShapesOp();
- GEOM::ListOfGO* aList = myShapesOp->GetGlueFaces(theShape, theTolerance);
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length( 1 );
+ objList[0] = theShape;
+ GEOM::ListOfGO* aList = myShapesOp->GetGlueFaces(objList, theTolerance);
GEOM_List_i<GEOM::ListOfGO>* aListPtr = new GEOM_List_i<GEOM::ListOfGO>(*(aList));
MESSAGE(" List of "<<aListPtr->GetList().length()<<" element(s)");
endService( " GEOM_Superv_i::GetGlueFaces" );
beginService( " GEOM_Superv_i::MakeGlueFacesByList" );
MESSAGE("GEOM_Superv_i::MakeGlueFacesByList");
getShapesOp();
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length( 1 );
+ objList[0] = theShape;
GEOM::GEOM_Object_ptr anObj =
- myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces,
+ myShapesOp->MakeGlueFacesByList(objList, theTolerance, theFaces,
doKeepNonSolids, doGlueAllEdges);
endService( " GEOM_Superv_i::MakeGlueFacesByList" );
return anObj;
beginService( " GEOM_Superv_i::CheckCompoundOfBlocks" );
MESSAGE("GEOM_Superv_i::CheckCompoundOfBlocks");
getBlocksOp();
- CORBA::Boolean aRes = myBlocksOp->CheckCompoundOfBlocks(theCompound, theErrors);
+ CORBA::Boolean aRes = myBlocksOp->CheckCompoundOfBlocks(theCompound, -1., theErrors);
endService( " GEOM_Superv_i::CheckCompoundOfBlocks" );
return aRes;
}
beginService( " GEOM_Superv_i::ExportSTEP" );
MESSAGE("GEOM_Superv_i::ExportSTEP");
getSTEPPluginOp();
- mySTEPOp->ExportSTEP( theObject, theFileName );
+
+ const GEOM::length_unit aUnit = GEOM::LU_METER;
+
+ mySTEPOp->ExportSTEP( theObject, theFileName, aUnit );
endService( " GEOM_Superv_i::ExportSTEP" );
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
CORBA::Boolean isPlanarWanted);
GEOM::GEOM_Object_ptr MakeFaceWires (GEOM::GEOM_List_ptr theWires,
CORBA::Boolean isPlanarWanted);
+ GEOM::GEOM_Object_ptr MakeFaceWithConstraints (GEOM::GEOM_List_ptr theConstraints);
GEOM::GEOM_Object_ptr MakeShell (GEOM::GEOM_List_ptr theFacesAndShells);
GEOM::GEOM_Object_ptr MakeSolidShell (GEOM::GEOM_Object_ptr theShell);
GEOM::GEOM_Object_ptr MakeSolidShells (GEOM::GEOM_List_ptr theShells);
GEOM::GEOM_Object_ptr MakeCompound (GEOM::GEOM_List_ptr theShapes);
+ GEOM::GEOM_Object_ptr MakeSolidFromConnectedFaces (GEOM::GEOM_List_ptr theFacesOrShells,
+ CORBA::Boolean isIntersect);
GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance,
CORBA::Boolean doKeepNonSolids);
CORBA::Short theShapeType,
GEOM::shape_state theState);
-
//-----------------------------------------------------------//
// BlocksOperations //
//-----------------------------------------------------------//
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
#
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
#
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
from salome.geom.structelem import parts
from salome.geom.structelem.parts import InvalidParameterError
+import GEOM
+
## This class manages the structural elements in the study. It is used to
# create a new structural element from a list of commands. The parameter
# \em studyId defines the ID of the study in which the manager will create
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
face2 = self.geom.MakeFace(wire2, True)
shell = self.geom.MakePipeWithDifferentSections([wire1, wire2],
[point1, point2],
- path, False, False)
+ path, False, False,
+ False)
closedShell = self.geom.MakeShell([face1, face2, shell])
solid = self.geom.MakeSolid([closedShell])
return solid
self.geom.ShapeType["FACE"])
for face in faces:
offsetFace = self._makeFaceOffset(face, offset)
- # get tangent plane on surface by parameters
+ # get the center of the face and the normal at the center
center = self.geom.MakeVertexOnSurface(offsetFace,
uParam, vParam)
- tangPlane = self.geom.MakeTangentPlaneOnFace(offsetFace,
- uParam, vParam,
- 1.0)
- normal = self.geom.GetNormal(tangPlane)
+ normal = self.geom.GetNormal(offsetFace, center)
marker = self._orientation.buildMarker(self.geom,
center, normal)
listMarkers.append(marker)
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
geompy.addToStudy(Fillet_1, "Fillet_1")
#Chamfer applying
-Chamfer_1 = geompy.MakeChamferEdge(Fillet_1, 10, 10, 16, 50 )
+Chamfer_1 = geompy.MakeChamferEdge(Fillet_1, 10, 10, 15, 49 )
geompy.addToStudy(Chamfer_1, "Chamfer_1")
-Chamfer_2 = geompy.MakeChamferEdge(Chamfer_1, 10, 10, 21, 31 )
+Chamfer_2 = geompy.MakeChamferEdge(Chamfer_1, 10, 10, 20, 30 )
geompy.addToStudy(Chamfer_2, "Chamfer_2")
#Import of the shape from "slots.brep"
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
th = 4.0
- ### BlocksOp ###
-
- BlocksOp = geompy.BlocksOp
-
### Basic points and directions ###
p0 = geompy.MakeVertex(0., 0., 0.)
Face22h = geompy.GetOppositeFace(Block2h, Face21h)
id_face22h = geompy.addToStudyInFather(Block2h, Face22h, "Face 2")
- Block3h = BlocksOp.GetBlockByParts(Handle, [Face11h, Face21h])
- if BlocksOp.IsDone() == 0:
- Block3h = BlocksOp.GetBlockByParts(Handle, [Face11h, Face22h])
- if BlocksOp.IsDone() == 0:
- Block3h = BlocksOp.GetBlockByParts(Handle, [Face12h, Face21h])
- if BlocksOp.IsDone() == 0:
- Block3h = BlocksOp.GetBlockByParts(Handle, [Face12h, Face22h])
- if BlocksOp.IsDone() == 0:
- print "ERROR: BlocksOp.GetBlockByParts() failed : ", BlocksOp.GetErrorCode()
- else:
- id_block3h = geompy.addToStudyInFather(Handle, Block3h, "Block 3 of Handle")
+ try:
+ Block3h = geompy.GetBlockByParts(Handle, [Face11h, Face21h])
+ except RuntimeError:
+ try:
+ Block3h = geompy.GetBlockByParts(Handle, [Face11h, Face22h])
+ except RuntimeError:
+ try:
+ Block3h = geompy.GetBlockByParts(Handle, [Face12h, Face21h])
+ except RuntimeError:
+ try:
+ Block3h = geompy.GetBlockByParts(Handle, [Face12h, Face22h])
+ except RuntimeError:
+ print "ERROR: BlocksOp.GetBlockByParts() failed : ", geompy.BlocksOp.GetErrorCode()
+ else:
+ id_block3h = geompy.addToStudyInFather(Handle, Block3h, "Block 3 of Handle")
### The whole shape ###
### Check the Spanner ###
- isCompOfBlocks6 = BlocksOp.CheckCompoundOfBlocks(Spanner)
+ isCompOfBlocks6 = geompy.CheckCompoundOfBlocks(Spanner)
if isCompOfBlocks6 == 0:
print "Spanner is not a compound of hexahedral solids"
(NonBlocks, NonQuads) = geompy.GetNonBlocks(Spanner)
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
Face2 = geompy.MakeFace(Sketcher, WantPlanarFace)
Face3 = geompy.MakeFaceHW (100., 200., 1) #(2 Doubles, 1 Int)->GEOM_Object
Face4 = geompy.MakeFaceObjHW (vz, 200., 100.) #(1 GEOM_Object, 2 Doubles)->GEOM_Object
+ Face5 = geompy.MakeFaceFromSurface(Face, Sketcher) #(2 GEOM_Objects)->GEOM_Object
+
+ Cut2 = geompy.MakeCutList(Sphere1, [Box1], True)
+ #(List of GEOM_Object)->GEOM_Object
+ Face6 = geompy.MakeFaceWithConstraints([geompy.GetSubShape(Cut2, [5]), geompy.GetSubShape(Cut2, [3]),
+ geompy.GetSubShape(Cut2, [11]), geompy.GetSubShape(Cut2, [3]),
+ geompy.GetSubShape(Cut2, [13]), geompy.GetSubShape(Cut2, [3])])
Disk = geompy.MakeDiskPntVecR (p0, vz, radius) #(2 GEOM_Object, 1 Double)->GEOM_Object
Disk2 = geompy.MakeDiskThreePnt(p0, p200, pz) #(3 GEOM_Object)->GEOM_Object
Disk3 = geompy.MakeDiskR(100., 1) #(1 Doubles, 1 Int)->GEOM_Object
prism1_faces[3], prism1_faces[4],
prism1_faces[5], prism1_faces[2]])
Solid = geompy.MakeSolid([Shell1]) #(List of GEOM_Object)->GEOM_Object
-
+
+ Box1_translation = geompy.MakeTranslation(Box1, 10, 0, 0)
+ Box1_shell = geompy.SubShapeAllSorted(Box1, geompy.ShapeType["SHELL"])[0]
+ Box1_translation_shell = geompy.SubShapeAllSorted(Box1_translation, geompy.ShapeType["SHELL"])[0]
+
+ Solid_from_shells = geompy.MakeSolidFromConnectedFaces([Box1_shell, Box1_translation_shell], 1) #(List of GEOM_Object, Boolean)->GEOM_Object
+
# Create Isoline
Isoline = geompy.MakeIsoline(Face1, True, 0.5) #(1 GEOM_Object, Boolean, Double)->GEOM_Object
Line3 = geompy.MakeLineTwoFaces(prism1_faces[0], prism1_faces[1]) #(2 GEOM_Object)->GEOM_Object
#Create advanced objects
- Copy = geompy.MakeCopy(Box) #(GEOM_Object)->GEOM_Object
Prism = geompy.MakePrismVecH(Face, vz, 100.0) #(2 GEOM_Object, Double)->GEOM_Object
Prism2Ways = geompy.MakePrismVecH2Ways(Face, vz, 10.0) #(2 GEOM_Object, Double)->GEOM_Object
PrismTwoPnt = geompy.MakePrism(Face2, p0, pxyz) #(3 GEOM_Object)->GEOM_Object
tol2d, tol3d, nbiter) #(GEOM_Object, 4 Doubles, Short)->GEOM_Object
Pipe = geompy.MakePipe(Wire, Edge) #(2 GEOM_Object)->GEOM_Object
Sewing = geompy.MakeSewing([Face, S], precision) #(List Of GEOM_Object, Double)->GEOM_Object
+ ThickSolid = geompy.MakeCopy(Box)
+ faces = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
+ shell = geompy.MakeShell([faces[0], faces[1], faces[2]])
+ faceIDs = geompy.SubShapeAllSortedCentresIDs(ThickSolid, geompy.ShapeType["FACE"])
+ ThickShell = geompy.MakeThickSolid(shell, 50) #(GEOM_Object, Double)->GEOM_Object
+ geompy.Thicken(ThickSolid, 50, [faceIDs[0], faceIDs[1]]) #(GEOM_Object) modification
+ Copy = geompy.MakeCopy(Box) #(GEOM_Object)->GEOM_Object
#Transform objects
Translation = geompy.MakeTranslationTwoPoints(Box, px, pz) #(3 GEOM_Object)->GEOM_Object
Position = geompy.MakePosition(Box, cs1, cs2) #(3 GEOM_Object)->GEOM_Object
Position2 = geompy.PositionAlongPath(Box, Arc, 0.5, 1, 0) #(2 GEOM_Object, 1 Double, 2 Bool)->GEOM_Object
Offset = geompy.MakeOffset(Box, 10.) #(GEOM_Object, Double)->GEOM_Object
- Orientation = geompy.ChangeOrientation(Box)
ProjOnWire = geompy.MakeProjectionOnWire(p0, Wire)
+ ProjOnCyl = geompy.MakeProjectionOnCylinder(Wire, 100)
+ Orientation = geompy.ChangeOrientation(Box)
+ ExtEdge = geompy.ExtendEdge(Edge1, -0.3, 1.3)
+ ExtFace = geompy.ExtendFace(Face5, -0.3, 1.3, -0.1, 1.1)
+ Surface = geompy.MakeSurfaceFromFace(Face5)
#IDList for Fillet/Chamfer
prism_edges = geompy.ExtractShapes(Prism, geompy.ShapeType["EDGE"], True)
id_Common = geompy.addToStudy(Common, "Common")
id_Cut = geompy.addToStudy(Cut, "Cut")
+ id_Cut2 = geompy.addToStudy(Cut2, "Cut2")
id_Fuse = geompy.addToStudy(Fuse, "Fuse")
id_Section = geompy.addToStudy(Section, "Section")
id_Face2 = geompy.addToStudy(Face2, "Face from Sketcher")
id_Face3 = geompy.addToStudy(Face3, "Face Height Width")
id_Face4 = geompy.addToStudy(Face4, "Face Plane_HW")
+ id_Face5 = geompy.addToStudy(Face5, "Face from surface and wire")
+ id_Face6 = geompy.addToStudy(Face6, "Face from edges with constraints")
id_Disk = geompy.addToStudy(Disk, "Disk PntVecR")
id_Disk2 = geompy.addToStudy(Disk2, "Disk Three Points")
id_Disk3 = geompy.addToStudy(Disk3, "Disk OXY Radius")
id_Prism1 = geompy.addToStudy(Prism1, "Prism by Two Pnt")
id_Shell1 = geompy.addToStudy(Shell1, "Shell from Prism1 faces")
id_Solid = geompy.addToStudy(Solid, "Solid")
+ id_Solid1 = geompy.addToStudy(Solid_from_shells, "Solid1")
+
id_Compound = geompy.addToStudy(Compound, "Compound")
id_Plane2 = geompy.addToStudy(Plane2, "Plane on Face")
id_Copy = geompy.addToStudy(Copy, "Copy")
+ id_ThickShell = geompy.addToStudy(ThickShell, "ThickShell")
+ id_ThickSolid = geompy.addToStudy(ThickSolid, "ThickSolid")
+
id_Prism = geompy.addToStudy(Prism, "Prism")
id_Prism2Ways = geompy.addToStudy(Prism2Ways, "Prism2Ways")
id_PrismTwoPnt = geompy.addToStudy(PrismTwoPnt, "PrismTwoPnt")
id_Offset = geompy.addToStudy(Offset, "Offset")
id_Orientation = geompy.addToStudy(Orientation, "Orientation")
id_ProjOnWire = geompy.addToStudy(ProjOnWire[1], "ProjOnWire")
+ id_ProjOnCyl = geompy.addToStudy(ProjOnCyl, "ProjOnCyl")
+ id_ExtEdge = geompy.addToStudy(ExtEdge, "ExtendedEdge")
+ id_ExtFace = geompy.addToStudy(ExtFace, "ExtendedFace")
+ id_Surface = geompy.addToStudy(Surface, "Surface From Face")
id_Fillet = geompy.addToStudy(Fillet, "Fillet")
id_Fillet2 = geompy.addToStudy(Fillet2, "Fillet2")
id_Partition = geompy.addToStudy(Partition, "Partition")
id_Partition1 = geompy.addToStudy(Partition1, "Half Partition")
-
+
#Decompose objects
# SubShape
geompy.RestoreSubShapes(Partition, [Box])
geompy.RestoreSubShapes(Partition1)
+ # GetSubShapeEdgeSorted
+ p1 = geompy.GetFirstVertex(Sketcher)
+ p2 = geompy.GetFirstVertex(Sketcher3d_1)
+ p3 = geompy.GetFirstVertex(Sketcher3d_2)
+ geompy.GetSubShapeEdgeSorted(Sketcher, p1, "OrderedEdges")
+ geompy.GetSubShapeEdgeSorted(Sketcher3d_1, p2, "OrderedEdges")
+ geompy.GetSubShapeEdgeSorted(Sketcher3d_2, p3, "OrderedEdges")
+
+ # GetSubShapesWithTolerance
+ geompy.GetSubShapesWithTolerance(Box, GEOM.FACE, GEOM.CC_GT, 1.e-8, "gt")
+ geompy.GetSubShapesWithTolerance(Box, GEOM.FACE, GEOM.CC_GE, 1.e-7, "ge")
+ geompy.GetSubShapesWithTolerance(Box, GEOM.FACE, GEOM.CC_LT, 2.e-7, "lt")
+ geompy.GetSubShapesWithTolerance(Box, GEOM.FACE, GEOM.CC_LE, 1.e-7, "le")
+
+
print "DONE"
- # Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
- #
- # 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
- #
-
- # Python API for field on geometry manipulations:
+# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+
+# Python API for field on geometry manipulations:
# field = geompy.CreateField(shape, name, type, dimension, componentNames)
# geompy.RemoveField(field)
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
Id_Box = geompy.addToStudy(Box, "Box")
Id_Divide = geompy.addToStudy(Divide, "Box with Divided Edge")
+ # using geompy.DivideEdgeByPoint()
+ p = geompy.MakeVertex( 30, -5, 10, theName="Point to project" )
+ edge = geompy.GetEdgeNearPoint( Box, p, theName="Edge to split")
+ div = geompy.DivideEdgeByPoint( Box, edge, p, theName="Box (edge divided)")
+ assert geompy.NumberOfEdges( Box ) == geompy.NumberOfEdges( div ) - 1
+
def TestFuseEdges (geompy):
# create vertices
Joined_1 = geompy.RemoveInternalFaces(Partition_1)
geompy.addToStudy(Joined_1, 'Joined_1')
+def TestSewGluing(geompy):
+
+ import GEOM
+ box1 = geompy.MakeBox(0,0,0, 1,1,1)
+ box2 = geompy.MakeBox(1,0,0, 2,1,1)
+ comp = geompy.MakeCompound( [box1, box2] )
+
+ # no sewing with AllowNonManifold=False
+ sew1 = geompy.MakeSewing( [box1,box2], 1e-5, AllowNonManifold=False)
+ assert not sew1
+ sew2 = geompy.MakeSewing( comp, 1e-5, AllowNonManifold=False)
+ assert not sew2
+ sew3 = geompy.MakeSewing( [comp], 1e-5, AllowNonManifold=False)
+ assert not sew3
+ sew1 = geompy.Sew( [box1,box2], 1e-5, AllowNonManifold=False)
+ assert not sew1
+ sew2 = geompy.Sew( comp, 1e-5, AllowNonManifold=False)
+ assert not sew2
+ sew3 = geompy.Sew( [comp], 1e-5, AllowNonManifold=False)
+ assert not sew3
+
+ # check MakeSewing()
+ sew1 = geompy.MakeSewing( [box1,box2], 1e-5, AllowNonManifold=True)
+ assert sew1.GetShapeType() == GEOM.SHELL
+ assert geompy.NumberOfFaces( sew1 ) == geompy.NumberOfFaces( comp )
+ assert geompy.NumberOfEdges( sew1 ) == geompy.NumberOfEdges( comp ) - 4
+ sew2 = geompy.MakeSewing( comp, 1e-5, AllowNonManifold=True)
+ assert sew2.GetShapeType() == GEOM.SHELL
+ assert geompy.NumberOfFaces( sew2 ) == geompy.NumberOfFaces( comp )
+ assert geompy.NumberOfEdges( sew2 ) == geompy.NumberOfEdges( comp ) - 4
+ sew3 = geompy.MakeSewing( [comp], 1e-5, AllowNonManifold=True)
+ assert sew3.GetShapeType() == GEOM.SHELL
+ assert geompy.NumberOfFaces( sew3 ) == geompy.NumberOfFaces( comp )
+ assert geompy.NumberOfEdges( sew3 ) == geompy.NumberOfEdges( comp ) - 4
+ # check Sew()
+ sew1 = geompy.Sew( [box1,box2], 1e-5, AllowNonManifold=True)
+ assert sew1.GetShapeType() == GEOM.SHELL
+ assert geompy.NumberOfFaces( sew1 ) == geompy.NumberOfFaces( comp )
+ assert geompy.NumberOfEdges( sew1 ) == geompy.NumberOfEdges( comp ) - 4
+ sew2 = geompy.Sew( comp, 1e-5, AllowNonManifold=True)
+ assert sew2.GetShapeType() == GEOM.SHELL
+ assert geompy.NumberOfFaces( sew2 ) == geompy.NumberOfFaces( comp )
+ assert geompy.NumberOfEdges( sew2 ) == geompy.NumberOfEdges( comp ) - 4
+ sew3 = geompy.Sew( [comp], 1e-5, AllowNonManifold=True)
+ assert sew3.GetShapeType() == GEOM.SHELL
+ assert geompy.NumberOfFaces( sew3 ) == geompy.NumberOfFaces( comp )
+ assert geompy.NumberOfEdges( sew3 ) == geompy.NumberOfEdges( comp ) - 4
+
+ # check MakeGlueFaces()
+ glueF1 = geompy.MakeGlueFaces( [box1,box2], 1e-5)
+ assert glueF1.GetShapeType() == GEOM.COMPOUND
+ assert geompy.NumberOfFaces( glueF1 ) == geompy.NumberOfFaces( comp ) - 1
+ assert geompy.NumberOfEdges( glueF1 ) == geompy.NumberOfEdges( comp ) - 4
+ glueF2 = geompy.MakeGlueFaces( [comp], 1e-5)
+ assert glueF2.GetShapeType() == GEOM.COMPOUND
+ assert geompy.NumberOfFaces( glueF2 ) == geompy.NumberOfFaces( comp ) - 1
+ assert geompy.NumberOfEdges( glueF2 ) == geompy.NumberOfEdges( comp ) - 4
+ glueF3 = geompy.MakeGlueFaces( comp, 1e-5)
+ assert glueF3.GetShapeType() == GEOM.COMPOUND
+ assert geompy.NumberOfFaces( glueF3 ) == geompy.NumberOfFaces( comp ) - 1
+ assert geompy.NumberOfEdges( glueF3 ) == geompy.NumberOfEdges( comp ) - 4
+
+ # check GetGlueFaces()
+ glueFF1 = geompy.GetGlueFaces( [box1,box2], 1e-5)
+ assert len( glueFF1 ) == 1 and glueFF1[0].GetShapeType() == GEOM.FACE
+ glueFF2 = geompy.GetGlueFaces( [comp], 1e-5)
+ assert len( glueFF2 ) == 1 and glueFF2[0].GetShapeType() == GEOM.FACE
+ glueFF3 = geompy.GetGlueFaces( comp, 1e-5)
+ assert len( glueFF3 ) == 1 and glueFF3[0].GetShapeType() == GEOM.FACE
+
+ #check MakeGlueFacesByList()
+ glueF1 = geompy.MakeGlueFacesByList( [box1,box2], 1e-5, glueFF1)
+ assert glueF1.GetShapeType() == GEOM.COMPOUND
+ assert geompy.NumberOfFaces( glueF1 ) == geompy.NumberOfFaces( comp ) - 1
+ assert geompy.NumberOfEdges( glueF1 ) == geompy.NumberOfEdges( comp ) - 4
+ glueF2 = geompy.MakeGlueFacesByList( [comp], 1e-5, glueFF2)
+ assert glueF2.GetShapeType() == GEOM.COMPOUND
+ assert geompy.NumberOfFaces( glueF2 ) == geompy.NumberOfFaces( comp ) - 1
+ assert geompy.NumberOfEdges( glueF2 ) == geompy.NumberOfEdges( comp ) - 4
+ glueF3 = geompy.MakeGlueFacesByList( comp, 1e-5, glueFF3 )
+ assert glueF3.GetShapeType() == GEOM.COMPOUND
+ assert geompy.NumberOfFaces( glueF3 ) == geompy.NumberOfFaces( comp ) - 1
+ assert geompy.NumberOfEdges( glueF3 ) == geompy.NumberOfEdges( comp ) - 4
+
+ # check MakeGlueEdges()
+ glueE1 = geompy.MakeGlueEdges( [box1,box2], 1e-5)
+ assert glueE1.GetShapeType() == GEOM.COMPOUND
+ assert geompy.NumberOfEdges( glueE1 ) == geompy.NumberOfEdges( comp ) - 4
+ glueE2 = geompy.MakeGlueEdges( [comp], 1e-5)
+ assert glueE2.GetShapeType() == GEOM.COMPOUND
+ assert geompy.NumberOfEdges( glueE2 ) == geompy.NumberOfEdges( comp ) - 4
+ glueE3 = geompy.MakeGlueEdges( comp, 1e-5)
+ assert glueE3.GetShapeType() == GEOM.COMPOUND
+ assert geompy.NumberOfEdges( glueE3 ) == geompy.NumberOfEdges( comp ) - 4
+
+ # check GetGlueEdges()
+ glueEE1 = geompy.GetGlueEdges( [box1,box2], 1e-5)
+ assert len( glueEE1 ) == 4 and glueEE1[0].GetShapeType() == GEOM.EDGE
+ glueEE2 = geompy.GetGlueEdges( [comp], 1e-5)
+ assert len( glueEE2 ) == 4 and glueEE2[0].GetShapeType() == GEOM.EDGE
+ glueEE3 = geompy.GetGlueEdges( comp, 1e-5)
+ assert len( glueEE3 ) == 4 and glueEE3[0].GetShapeType() == GEOM.EDGE
+
+ #check MakeGlueEdgesByList()
+ glueEL1 = geompy.MakeGlueEdgesByList( [box1,box2], 1e-5, glueEE1)
+ assert glueEL1.GetShapeType() == GEOM.COMPOUND
+ assert geompy.NumberOfEdges( glueEL1 ) == geompy.NumberOfEdges( comp ) - 4
+ glueEL2 = geompy.MakeGlueEdgesByList( [comp], 1e-5, glueEE2)
+ assert glueEL2.GetShapeType() == GEOM.COMPOUND
+ assert geompy.NumberOfEdges( glueEL2 ) == geompy.NumberOfEdges( comp ) - 4
+ glueEL3 = geompy.MakeGlueEdgesByList( comp, 1e-5, glueEE3 )
+ assert glueEL3.GetShapeType() == GEOM.COMPOUND
+ assert geompy.NumberOfEdges( glueEL3 ) == geompy.NumberOfEdges( comp ) - 4
+
+ # check GetSharedShapesMulti()
+ sharedEE = geompy.GetSharedShapesMulti( glueEL3, geompy.ShapeType["EDGE"])
+ assert len( sharedEE ) == 4
+ assert sharedEE[0].GetShapeType() == GEOM.EDGE
+ assert sharedEE[1].GetShapeType() == GEOM.EDGE
+ assert sharedEE[2].GetShapeType() == GEOM.EDGE
+ assert sharedEE[3].GetShapeType() == GEOM.EDGE
+
+ return
+
def TestHealingOperations (geompy, math):
+ TestSewGluing(geompy)
TestMakeSewing(geompy, math)
TestDivideEdge(geompy)
TestSuppressHoles(geompy)
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+import salome_version
+
def TestMeasureOperations (geompy, math):
p0 = geompy.MakeVertex(0 , 0, 0)
p678 = geompy.MakeVertex(60, 70, 80)
p789 = geompy.MakeVertex(70, 80, 90)
+ vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
cube = geompy.MakeBoxTwoPnt(p678, p789)
+ cylinder = geompy.MakeCylinder(p0, vz, 5, 70)
+
####### PointCoordinates #######
Coords = geompy.PointCoordinates(p137)
####### Detect Self-intersections #######
- [Face_1,Face_2] = geompy.SubShapes(box, [33, 23])
- Translation_1 = geompy.MakeTranslation(Face_1, 5, -15, -40)
- Compound_1 = geompy.MakeCompound([Face_2, Translation_1])
- if geompy.CheckSelfIntersections(Compound_1) == True:
+ selfIntersected = geompy.MakeCompound([box, cylinder])
+ if geompy.CheckSelfIntersections(selfIntersected):
raise RuntimeError, "Existing self-intersection is not detected"
+ ####### Detect Self-intersections fast #######
+
+ if salome_version.getXVersion() > "0x70600":
+ if geompy.CheckSelfIntersectionsFast(selfIntersected):
+ raise RuntimeError, "Existing self-intersection is not detected"
+
+ ####### Fast intersection #######
+
+ if not geompy.FastIntersect(box, cylinder)[0]:
+ raise RuntimeError, "Existing intersection is not detected"
+
####### WhatIs #######
Descr = geompy.WhatIs(box)
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
ind = ind + 1
pass
+ # TransferData
+ path = os.getenv("DATA_DIR")
+ fileName = path + "/Shapes/Step/black_and_white.step"
+ blackWhite = geompy.ImportSTEP(fileName)
+ blackWhiteCopy = geompy.MakeCopy(blackWhite[0])
+ subBlackWhite = geompy.SubShapeAll(blackWhiteCopy, GEOM.SOLID)
+ geompy.TransferData(blackWhite[0], blackWhiteCopy)
+ geompy.addToStudy(blackWhite[0], "blackWhite")
+ geompy.addToStudy(blackWhiteCopy, "blackWhiteCopy")
+ geompy.addToStudyInFather( blackWhiteCopy, subBlackWhite[0], "" )
+ geompy.addToStudyInFather( blackWhiteCopy, subBlackWhite[1], "" )
+
# CheckAndImprove
blocksComp = geompy.CheckAndImprove(part)
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#
from GEOM import ISTEPOperations
+import GEOM
# Engine Library Name
__libraryName__ = "STEPPluginEngine"
## Export the given shape into a file with given name in STEP format.
# @param theObject Shape to be stored in the file.
# @param theFileName Name of the file to store the given shape in.
+# @param theUnit the length unit (see GEOM::length_unit). In meters by default.
# @ingroup l2_import_export
-def ExportSTEP(self, theObject, theFileName):
+def ExportSTEP(self, theObject, theFileName, theUnit=GEOM.LU_METER):
"""
Export the given shape into a file with given name in STEP format.
Parameters:
theObject Shape to be stored in the file.
theFileName Name of the file to store the given shape in.
+ theUnit the length unit (see GEOM::length_unit). In meters by default.
"""
anOp = GetSTEPPluginOperations(self)
- anOp.ExportSTEP(theObject, theFileName)
+ anOp.ExportSTEP(theObject, theFileName, theUnit)
if anOp.IsDone() == 0:
raise RuntimeError, "Export : " + anOp.GetErrorCode()
pass
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
## # create and publish cylinder
## cyl = geompy.MakeCylinderRH(100, 100, "cylinder")
## # get non blocks from cylinder
-## g1, g2 = geompy.GetNonBlocks(cyl, "nonblock")
+## g1, g2 = geompy.GetNonBlocks(cyl, theName="nonblock")
## @endcode
##
## Above example will publish both result compounds (first with non-hexa solids and
## However, if second command is invoked as
##
## @code
-## g1, g2 = geompy.GetNonBlocks(cyl, ("nonhexa", "nonquad"))
+## g1, g2 = geompy.GetNonBlocks(cyl, theName=("nonhexa", "nonquad"))
## @endcode
##
## ... the first compound will be published with "nonhexa" name, and second will be named "nonquad".
## Raise an Error, containing the Method_name, if Operation is Failed
## @ingroup l1_geomBuilder_auxiliary
def RaiseIfFailed (Method_name, Operation):
- if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
+ if not Operation.IsDone() and Operation.GetErrorCode() != "NOT_FOUND_ANY":
raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
## Return list of variables value from salome notebook
if hasattr(theItem, "_v"): ret = theItem._v
return ret
+## Pack an argument into a list
+def ToList( arg ):
+ if isinstance( arg, list ):
+ return arg
+ if hasattr( arg, "__getitem__" ):
+ return list( arg )
+ return [ arg ]
+
## Information about closed/unclosed state of shell or wire
# @ingroup l1_geomBuilder_auxiliary
class info:
## Enumeration ShapeType as a dictionary. \n
## Topological types of shapes (like Open Cascade types). See GEOM::shape_type for details.
# @ingroup l1_geomBuilder_auxiliary
- ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
+ ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8, "FLAT":9}
## Kinds of shape in terms of <VAR>GEOM.GEOM_IKindOfShape.shape_kind</VAR> enumeration
# and a list of parameters, describing the shape.
# - EDGE: [nb_vertices]
#
# - VERTEX: [x y z]
+ #
+ # - LCS: [x y z xx xy xz yx yy yz zx zy zz]
# @ingroup l1_geomBuilder_auxiliary
kind = GEOM.GEOM_IKindOfShape
self.myUseCaseBuilder = self.myStudy.GetUseCaseBuilder()
self.myUseCaseBuilder.SetRootCurrent()
self.myUseCaseBuilder.Append(self.father)
+
+ # load data from the study file, if necessary
+ self.myBuilder.LoadWith(self.father, self)
pass
def GetPluginOperations(self, studyID, libraryName):
## Create a point, corresponding to the given parameter on the given curve.
# @param theRefCurve The referenced curve.
# @param theParameter Value of parameter on the referenced curve.
+ # @param takeOrientationIntoAccount flag that tells if it is necessary
+ # to take the curve's orientation into account for the
+ # operation. I.e. if this flag is set, the results for the same
+ # parameters (except the value 0.5) is different for forward
+ # and reversed curves. If it is not set the result is the same.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @ref tui_creation_point "Example"
@ManageTransactions("BasicOp")
- def MakeVertexOnCurve(self, theRefCurve, theParameter, theName=None):
+ def MakeVertexOnCurve(self, theRefCurve, theParameter,
+ takeOrientationIntoAccount=False, theName=None):
"""
Create a point, corresponding to the given parameter on the given curve.
Parameters:
theRefCurve The referenced curve.
theParameter Value of parameter on the referenced curve.
+ takeOrientationIntoAccount flag that tells if it is necessary
+ to take the curve's orientation into account for the
+ operation. I.e. if this flag is set, the results for
+ the same parameters (except the value 0.5) is different
+ for forward and reversed curves. If it is not set
+ the result is the same.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
"""
# Example: see GEOM_TestAll.py
- theParameter, Parameters = ParseParameters(theParameter)
- anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
+ theParameter, takeOrientationIntoAccount, Parameters = ParseParameters(
+ theParameter, takeOrientationIntoAccount)
+ anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter,
+ takeOrientationIntoAccount)
RaiseIfFailed("MakePointOnCurve", self.BasicOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "vertex")
anObj = self.CurvesOp.MakeCurveParametricNew(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
else:
anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
- RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
+ RaiseIfFailed("MakeCurveParametric", self.CurvesOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "curve")
return anObj
@ManageTransactions("PrimOp")
def MakeCylinderA(self, thePnt, theAxis, theR, theH, theA, theName=None):
"""
- Create a a portion of cylinder with given base point, axis, radius, height and angle.
+ Create a portion of cylinder with given base point, axis, radius, height and angle.
Parameters:
thePnt Central point of cylinder base.
theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
if flag:
theA = theA*math.pi/180.
- anObj = self.PrimOp.MakeCylinderPntVecRHA(thePnt, theAxis, theR, theH, theA)
- RaiseIfFailed("MakeCylinderPntVecRHA", self.PrimOp)
- anObj.SetParameters(Parameters)
- self._autoPublish(anObj, theName, "cylinder")
+ if theA<=0. or theA>=2*math.pi:
+ raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
+ anObj = self.PrimOp.MakeCylinderPntVecRHA(thePnt, theAxis, theR, theH, theA)
+ RaiseIfFailed("MakeCylinderPntVecRHA", self.PrimOp)
+ anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "cylinder")
return anObj
## Create a cylinder with given radius and height at
theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
if flag:
theA = theA*math.pi/180.
+ if theA<=0. or theA>=2*math.pi:
+ raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
anObj = self.PrimOp.MakeCylinderRHA(theR, theH, theA)
RaiseIfFailed("MakeCylinderRHA", self.PrimOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "revolution")
return anObj
- ## Create a filling from the given compound of contours.
- # @param theShape the compound of contours
- # @param theMinDeg a minimal degree of BSpline surface to create
- # @param theMaxDeg a maximal degree of BSpline surface to create
- # @param theTol2D a 2d tolerance to be reached
- # @param theTol3D a 3d tolerance to be reached
- # @param theNbIter a number of iteration of approximation algorithm
- # @param theMethod Kind of method to perform filling operation(see GEOM::filling_oper_method())
+ ## Create a face from a given set of contours.
+ # @param theContours either a list or a compound of edges/wires.
+ # @param theMinDeg a minimal degree of BSpline surface to create.
+ # @param theMaxDeg a maximal degree of BSpline surface to create.
+ # @param theTol2D a 2d tolerance to be reached.
+ # @param theTol3D a 3d tolerance to be reached.
+ # @param theNbIter a number of iteration of approximation algorithm.
+ # @param theMethod Kind of method to perform filling operation
+ # (see GEOM.filling_oper_method enum).
# @param isApprox if True, BSpline curves are generated in the process
# of surface construction. By default it is False, that means
# the surface is created using given curves. The usage of
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing the created filling surface.
+ # @return New GEOM.GEOM_Object (face), containing the created filling surface.
#
# @ref tui_creation_filling "Example"
@ManageTransactions("PrimOp")
- def MakeFilling(self, theShape, theMinDeg=2, theMaxDeg=5, theTol2D=0.0001,
+ def MakeFilling(self, theContours, theMinDeg=2, theMaxDeg=5, theTol2D=0.0001,
theTol3D=0.0001, theNbIter=0, theMethod=GEOM.FOM_Default, isApprox=0, theName=None):
"""
- Create a filling from the given compound of contours.
+ Create a face from a given set of contours.
Parameters:
- theShape the compound of contours
- theMinDeg a minimal degree of BSpline surface to create
- theMaxDeg a maximal degree of BSpline surface to create
- theTol2D a 2d tolerance to be reached
- theTol3D a 3d tolerance to be reached
- theNbIter a number of iteration of approximation algorithm
- theMethod Kind of method to perform filling operation(see GEOM::filling_oper_method())
+ theContours either a list or a compound of edges/wires.
+ theMinDeg a minimal degree of BSpline surface to create.
+ theMaxDeg a maximal degree of BSpline surface to create.
+ theTol2D a 2d tolerance to be reached.
+ theTol3D a 3d tolerance to be reached.
+ theNbIter a number of iteration of approximation algorithm.
+ theMethod Kind of method to perform filling operation
+ (see GEOM.filling_oper_method enum).
isApprox if True, BSpline curves are generated in the process
of surface construction. By default it is False, that means
the surface is created using given curves. The usage of
Approximation makes the algorithm work slower, but allows
- building the surface for rather complex cases
+ building the surface for rather complex cases.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing the created filling surface.
+ New GEOM.GEOM_Object (face), containing the created filling surface.
Example of usage:
filling = geompy.MakeFilling(compound, 2, 5, 0.0001, 0.0001, 5)
"""
# Example: see GEOM_TestAll.py
theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
- anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
+ anObj = self.PrimOp.MakeFilling(ToList(theContours), theMinDeg, theMaxDeg,
theTol2D, theTol3D, theNbIter,
theMethod, isApprox)
RaiseIfFailed("MakeFilling", self.PrimOp)
return anObj
- ## Create a filling from the given compound of contours.
- # This method corresponds to MakeFilling with isApprox=True
- # @param theShape the compound of contours
- # @param theMinDeg a minimal degree of BSpline surface to create
- # @param theMaxDeg a maximal degree of BSpline surface to create
- # @param theTol3D a 3d tolerance to be reached
+ ## Create a face from a given set of contours.
+ # This method corresponds to MakeFilling() with isApprox=True.
+ # @param theContours either a list or a compound of edges/wires.
+ # @param theMinDeg a minimal degree of BSpline surface to create.
+ # @param theMaxDeg a maximal degree of BSpline surface to create.
+ # @param theTol3D a 3d tolerance to be reached.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing the created filling surface.
+ # @return New GEOM.GEOM_Object (face), containing the created filling surface.
#
# @ref tui_creation_filling "Example"
@ManageTransactions("PrimOp")
- def MakeFillingNew(self, theShape, theMinDeg=2, theMaxDeg=5, theTol3D=0.0001, theName=None):
+ def MakeFillingNew(self, theContours, theMinDeg=2, theMaxDeg=5, theTol3D=0.0001, theName=None):
"""
Create a filling from the given compound of contours.
- This method corresponds to MakeFilling with isApprox=True
+ This method corresponds to MakeFilling() with isApprox=True.
Parameters:
- theShape the compound of contours
- theMinDeg a minimal degree of BSpline surface to create
- theMaxDeg a maximal degree of BSpline surface to create
- theTol3D a 3d tolerance to be reached
+ theContours either a list or a compound of edges/wires.
+ theMinDeg a minimal degree of BSpline surface to create.
+ theMaxDeg a maximal degree of BSpline surface to create.
+ theTol3D a 3d tolerance to be reached.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing the created filling surface.
+ New GEOM.GEOM_Object (face), containing the created filling surface.
Example of usage:
filling = geompy.MakeFillingNew(compound, 2, 5, 0.0001)
"""
# Example: see GEOM_TestAll.py
theMinDeg,theMaxDeg,theTol3D,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol3D)
- anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
+ anObj = self.PrimOp.MakeFilling(ToList(theContours), theMinDeg, theMaxDeg,
0, theTol3D, 0, GEOM.FOM_Default, True)
RaiseIfFailed("MakeFillingNew", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a shape by extrusion of the base shape along
- # the path shape. The path shape can be a wire or an edge.
+ # the path shape. The path shape can be a wire or an edge. It is
+ # possible to generate groups along with the result by means of
+ # setting the flag \a IsGenerateGroups.<BR>
+ # If \a thePath is a closed edge or wire and \a IsGenerateGroups is
+ # set, an error is occured. If \a thePath is not closed edge/wire,
+ # the following groups are returned:
+ # - If \a theBase is unclosed edge or wire: "Down", "Up", "Side1",
+ # "Side2";
+ # - If \a theBase is closed edge or wire, face or shell: "Down", "Up",
+ # "Other".
+ # .
+ # "Down" and "Up" groups contain:
+ # - Edges if \a theBase is edge or wire;
+ # - Faces if \a theBase is face or shell.<BR>
+ # .
+ # "Side1" and "Side2" groups contain edges generated from the first
+ # and last vertices of \a theBase. The first and last vertices are
+ # determined taking into account edge/wire orientation.<BR>
+ # "Other" group represents faces generated from the bounding edges of
+ # \a theBase.
+ #
# @param theBase Base shape to be extruded.
# @param thePath Path shape to extrude the base shape along it.
+ # @param IsGenerateGroups flag that tells if it is necessary to
+ # create groups. It is equal to False by default.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing the created pipe.
+ # @return New GEOM.GEOM_Object, containing the created pipe if
+ # \a IsGenerateGroups is not set. Otherwise it returns new
+ # GEOM.ListOfGO. Its first element is the created pipe, the
+ # remaining ones are created groups.
#
# @ref tui_creation_pipe "Example"
@ManageTransactions("PrimOp")
- def MakePipe(self, theBase, thePath, theName=None):
+ def MakePipe(self, theBase, thePath,
+ IsGenerateGroups=False, theName=None):
"""
Create a shape by extrusion of the base shape along
- the path shape. The path shape can be a wire or an edge.
+ the path shape. The path shape can be a wire or an edge. It is
+ possible to generate groups along with the result by means of
+ setting the flag IsGenerateGroups.
+ If thePath is a closed edge or wire and IsGenerateGroups is
+ set, an error is occured. If thePath is not closed edge/wire,
+ the following groups are returned:
+ - If theBase is unclosed edge or wire: "Down", "Up", "Side1",
+ "Side2";
+ - If theBase is closed edge or wire, face or shell: "Down", "Up",
+ "Other".
+ "Down" and "Up" groups contain:
+ - Edges if theBase is edge or wire;
+ - Faces if theBase is face or shell.
+ "Side1" and "Side2" groups contain edges generated from the first
+ and last vertices of theBase. The first and last vertices are
+ determined taking into account edge/wire orientation.
+ "Other" group represents faces generated from the bounding edges of
+ theBase.
Parameters:
theBase Base shape to be extruded.
thePath Path shape to extrude the base shape along it.
+ IsGenerateGroups flag that tells if it is necessary to
+ create groups. It is equal to False by default.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing the created pipe.
+ New GEOM.GEOM_Object, containing the created pipe if
+ IsGenerateGroups is not set. Otherwise it returns new
+ GEOM.ListOfGO. Its first element is the created pipe, the
+ remaining ones are created groups.
"""
# Example: see GEOM_TestAll.py
- anObj = self.PrimOp.MakePipe(theBase, thePath)
+ aList = self.PrimOp.MakePipe(theBase, thePath, IsGenerateGroups)
RaiseIfFailed("MakePipe", self.PrimOp)
- self._autoPublish(anObj, theName, "pipe")
- return anObj
+
+ if IsGenerateGroups:
+ self._autoPublish(aList, theName, "pipe")
+ return aList
+
+ self._autoPublish(aList[0], theName, "pipe")
+ return aList[0]
## Create a shape by extrusion of the profile shape along
# the path shape. The path shape can be a wire or an edge.
# the several profiles can be specified in the several locations of path.
+ # It is possible to generate groups along with the result by means of
+ # setting the flag \a IsGenerateGroups. For detailed information on
+ # groups that can be created please see the method MakePipe().
# @param theSeqBases - list of Bases shape to be extruded.
# @param theLocations - list of locations on the path corresponding
# specified list of the Bases shapes. Number of locations
# contact with the spine.
# @param theWithCorrection - defining that the section is rotated to be
# orthogonal to the spine tangent in the correspondent point
+ # @param IsGenerateGroups - flag that tells if it is necessary to
+ # create groups. It is equal to False by default.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing the created pipe.
+ # @return New GEOM.GEOM_Object, containing the created pipe if
+ # \a IsGenerateGroups is not set. Otherwise it returns new
+ # GEOM.ListOfGO. Its first element is the created pipe, the
+ # remaining ones are created groups.
#
# @ref tui_creation_pipe_with_diff_sec "Example"
@ManageTransactions("PrimOp")
def MakePipeWithDifferentSections(self, theSeqBases,
theLocations, thePath,
- theWithContact, theWithCorrection, theName=None):
+ theWithContact, theWithCorrection,
+ IsGenerateGroups=False, theName=None):
"""
Create a shape by extrusion of the profile shape along
the path shape. The path shape can be a wire or an edge.
the several profiles can be specified in the several locations of path.
+ It is possible to generate groups along with the result by means of
+ setting the flag IsGenerateGroups. For detailed information on
+ groups that can be created please see the method geompy.MakePipe().
Parameters:
theSeqBases - list of Bases shape to be extruded.
contact with the spine(0/1)
theWithCorrection - defining that the section is rotated to be
orthogonal to the spine tangent in the correspondent point (0/1)
+ IsGenerateGroups - flag that tells if it is necessary to
+ create groups. It is equal to False by default.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing the created pipe.
+ New GEOM.GEOM_Object, containing the created pipe if
+ IsGenerateGroups is not set. Otherwise it returns new
+ GEOM.ListOfGO. Its first element is the created pipe, the
+ remaining ones are created groups.
"""
- anObj = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
+ aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
theLocations, thePath,
- theWithContact, theWithCorrection)
+ theWithContact, theWithCorrection,
+ False, IsGenerateGroups)
RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
- self._autoPublish(anObj, theName, "pipe")
- return anObj
+
+ if IsGenerateGroups:
+ self._autoPublish(aList, theName, "pipe")
+ return aList
+
+ self._autoPublish(aList[0], theName, "pipe")
+ return aList[0]
## Create a shape by extrusion of the profile shape along
- # the path shape. The path shape can be a wire or a edge.
+ # the path shape. This function is a version of
+ # MakePipeWithDifferentSections() with the same parameters, except
+ # eliminated theWithContact and theWithCorrection. So it is
+ # possible to find the description of all parameters is in this
+ # method. The difference is that this method performs the operation
+ # step by step, i.e. it creates pipes between each pair of neighbor
+ # sections and fuses them into a single shape.
+ #
+ # @ref tui_creation_pipe_with_diff_sec "Example"
+ @ManageTransactions("PrimOp")
+ def MakePipeWithDifferentSectionsBySteps(self, theSeqBases,
+ theLocations, thePath,
+ IsGenerateGroups=False, theName=None):
+ """
+ Create a shape by extrusion of the profile shape along
+ the path shape. This function is a version of
+ MakePipeWithDifferentSections() with the same parameters, except
+ eliminated theWithContact and theWithCorrection. So it is
+ possible to find the description of all parameters is in this
+ method. The difference is that this method performs the operation
+ step by step, i.e. it creates pipes between each pair of neighbor
+ sections and fuses them into a single shape.
+ """
+ aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
+ theLocations, thePath,
+ False, False,
+ True, IsGenerateGroups)
+ RaiseIfFailed("MakePipeWithDifferentSectionsBySteps", self.PrimOp)
+
+ if IsGenerateGroups:
+ self._autoPublish(aList, theName, "pipe")
+ return aList
+
+ self._autoPublish(aList[0], theName, "pipe")
+ return aList[0]
+
+ ## Create a shape by extrusion of the profile shape along
+ # the path shape. The path shape can be a wire or an edge.
# the several profiles can be specified in the several locations of path.
+ # It is possible to generate groups along with the result by means of
+ # setting the flag \a IsGenerateGroups. For detailed information on
+ # groups that can be created please see the method MakePipe().
# @param theSeqBases - list of Bases shape to be extruded. Base shape must be
# shell or face. If number of faces in neighbour sections
# aren't coincided result solid between such sections will
# contact with the spine.
# @param theWithCorrection - defining that the section is rotated to be
# orthogonal to the spine tangent in the correspondent point
+ # @param IsGenerateGroups - flag that tells if it is necessary to
+ # create groups. It is equal to False by default.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing the created solids.
+ # @return New GEOM.GEOM_Object, containing the created solids if
+ # \a IsGenerateGroups is not set. Otherwise it returns new
+ # GEOM.ListOfGO. Its first element is the created solids, the
+ # remaining ones are created groups.
#
# @ref tui_creation_pipe_with_shell_sec "Example"
@ManageTransactions("PrimOp")
def MakePipeWithShellSections(self, theSeqBases, theSeqSubBases,
theLocations, thePath,
- theWithContact, theWithCorrection, theName=None):
+ theWithContact, theWithCorrection,
+ IsGenerateGroups=False, theName=None):
"""
Create a shape by extrusion of the profile shape along
- the path shape. The path shape can be a wire or a edge.
+ the path shape. The path shape can be a wire or an edge.
the several profiles can be specified in the several locations of path.
+ It is possible to generate groups along with the result by means of
+ setting the flag IsGenerateGroups. For detailed information on
+ groups that can be created please see the method geompy.MakePipe().
Parameters:
theSeqBases - list of Bases shape to be extruded. Base shape must be
contact with the spine (0/1)
theWithCorrection - defining that the section is rotated to be
orthogonal to the spine tangent in the correspondent point (0/1)
+ IsGenerateGroups - flag that tells if it is necessary to
+ create groups. It is equal to False by default.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing the created solids.
+ New GEOM.GEOM_Object, containing the created solids if
+ IsGenerateGroups is not set. Otherwise it returns new
+ GEOM.ListOfGO. Its first element is the created solids, the
+ remaining ones are created groups.
"""
- anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
+ aList = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
theLocations, thePath,
- theWithContact, theWithCorrection)
+ theWithContact, theWithCorrection,
+ IsGenerateGroups)
RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
- self._autoPublish(anObj, theName, "pipe")
- return anObj
+
+ if IsGenerateGroups:
+ self._autoPublish(aList, theName, "pipe")
+ return aList
+
+ self._autoPublish(aList[0], theName, "pipe")
+ return aList[0]
## Create a shape by extrusion of the profile shape along
# the path shape. This function is used only for debug pipe
@ManageTransactions("PrimOp")
def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
theLocations, thePath,
- theWithContact, theWithCorrection, theName=None):
+ theWithContact, theWithCorrection,
+ IsGenerateGroups=False, theName=None):
"""
Create a shape by extrusion of the profile shape along
the path shape. This function is used only for debug pipe
tmpLocations = [ theLocations[i-1], theLocations[i] ]
tmpSeqSubBases = []
if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
- anObj = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
+ aList = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
tmpLocations, thePath,
- theWithContact, theWithCorrection)
+ theWithContact, theWithCorrection,
+ IsGenerateGroups)
if self.PrimOp.IsDone() == 0:
print "Problems with pipe creation between ",i," and ",i+1," sections"
RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
break
else:
print "Pipe between ",i," and ",i+1," sections is OK"
- res.append(anObj)
+ res.append(aList[0])
pass
pass
self._autoPublish(resc, theName, "pipe")
return resc
- ## Create solids between given sections
+ ## Create solids between given sections.
+ # It is possible to generate groups along with the result by means of
+ # setting the flag \a IsGenerateGroups. For detailed information on
+ # groups that can be created please see the method MakePipe().
# @param theSeqBases - list of sections (shell or face).
# @param theLocations - list of corresponding vertexes
+ # @param IsGenerateGroups - flag that tells if it is necessary to
+ # create groups. It is equal to False by default.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing the created solids.
+ # @return New GEOM.GEOM_Object, containing the created solids if
+ # \a IsGenerateGroups is not set. Otherwise it returns new
+ # GEOM.ListOfGO. Its first element is the created solids, the
+ # remaining ones are created groups.
#
# @ref tui_creation_pipe_without_path "Example"
@ManageTransactions("PrimOp")
- def MakePipeShellsWithoutPath(self, theSeqBases, theLocations, theName=None):
+ def MakePipeShellsWithoutPath(self, theSeqBases, theLocations,
+ IsGenerateGroups=False, theName=None):
"""
- Create solids between given sections
+ Create solids between given sections.
+ It is possible to generate groups along with the result by means of
+ setting the flag IsGenerateGroups. For detailed information on
+ groups that can be created please see the method geompy.MakePipe().
Parameters:
theSeqBases - list of sections (shell or face).
theLocations - list of corresponding vertexes
+ IsGenerateGroups - flag that tells if it is necessary to
+ create groups. It is equal to False by default.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing the created solids.
+ New GEOM.GEOM_Object, containing the created solids if
+ IsGenerateGroups is not set. Otherwise it returns new
+ GEOM.ListOfGO. Its first element is the created solids, the
+ remaining ones are created groups.
"""
- anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
+ aList = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations,
+ IsGenerateGroups)
RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
- self._autoPublish(anObj, theName, "pipe")
- return anObj
+
+ if IsGenerateGroups:
+ self._autoPublish(aList, theName, "pipe")
+ return aList
+
+ self._autoPublish(aList[0], theName, "pipe")
+ return aList[0]
## Create a shape by extrusion of the base shape along
# the path shape with constant bi-normal direction along the given vector.
# The path shape can be a wire or an edge.
+ # It is possible to generate groups along with the result by means of
+ # setting the flag \a IsGenerateGroups. For detailed information on
+ # groups that can be created please see the method MakePipe().
# @param theBase Base shape to be extruded.
# @param thePath Path shape to extrude the base shape along it.
# @param theVec Vector defines a constant binormal direction to keep the
# same angle beetween the direction and the sections
# along the sweep surface.
+ # @param IsGenerateGroups flag that tells if it is necessary to
+ # create groups. It is equal to False by default.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing the created pipe.
+ # @return New GEOM.GEOM_Object, containing the created pipe if
+ # \a IsGenerateGroups is not set. Otherwise it returns new
+ # GEOM.ListOfGO. Its first element is the created pipe, the
+ # remaining ones are created groups.
#
# @ref tui_creation_pipe "Example"
@ManageTransactions("PrimOp")
- def MakePipeBiNormalAlongVector(self, theBase, thePath, theVec, theName=None):
+ def MakePipeBiNormalAlongVector(self, theBase, thePath, theVec,
+ IsGenerateGroups=False, theName=None):
"""
Create a shape by extrusion of the base shape along
the path shape with constant bi-normal direction along the given vector.
The path shape can be a wire or an edge.
+ It is possible to generate groups along with the result by means of
+ setting the flag IsGenerateGroups. For detailed information on
+ groups that can be created please see the method geompy.MakePipe().
Parameters:
theBase Base shape to be extruded.
theVec Vector defines a constant binormal direction to keep the
same angle beetween the direction and the sections
along the sweep surface.
+ IsGenerateGroups flag that tells if it is necessary to
+ create groups. It is equal to False by default.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing the created pipe.
+ New GEOM.GEOM_Object, containing the created pipe if
+ IsGenerateGroups is not set. Otherwise it returns new
+ GEOM.ListOfGO. Its first element is the created pipe, the
+ remaining ones are created groups.
"""
# Example: see GEOM_TestAll.py
- anObj = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath, theVec)
+ aList = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath,
+ theVec, IsGenerateGroups)
RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
- self._autoPublish(anObj, theName, "pipe")
- return anObj
- ## Makes a thick solid from a face or a shell
- # @param theShape Face or Shell to be thicken
+ if IsGenerateGroups:
+ self._autoPublish(aList, theName, "pipe")
+ return aList
+
+ self._autoPublish(aList[0], theName, "pipe")
+ return aList[0]
+
+ ## Makes a thick solid from a shape. If the input is a surface shape
+ # (face or shell) the result is a thick solid. If an input shape is
+ # a solid the result is a hollowed solid with removed faces.
+ # @param theShape Face or Shell to get thick solid or solid to get
+ # hollowed solid.
# @param theThickness Thickness of the resulting solid
+ # @param theFacesIDs the list of face IDs to be removed from the
+ # result. It is ignored if \a theShape is a face or a shell.
+ # It is empty by default.
+ # @param theInside If true the thickness is applied towards inside
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the created solid
#
+ # @ref tui_creation_thickness "Example"
@ManageTransactions("PrimOp")
- def MakeThickSolid(self, theShape, theThickness, theName=None):
+ def MakeThickSolid(self, theShape, theThickness,
+ theFacesIDs=[], theInside=False, theName=None):
"""
- Make a thick solid from a face or a shell
+ Make a thick solid from a shape. If the input is a surface shape
+ (face or shell) the result is a thick solid. If an input shape is
+ a solid the result is a hollowed solid with removed faces.
Parameters:
- theShape Face or Shell to be thicken
+ theShape Face or Shell to get thick solid or solid to get
+ hollowed solid.
theThickness Thickness of the resulting solid
+ theFacesIDs the list of face IDs to be removed from the
+ result. It is ignored if theShape is a face or a
+ shell. It is empty by default.
+ theInside If true the thickness is applied towards inside
theName Object name; when specified, this parameter is used
- for result publication in the study. Otherwise, if automatic
- publication is switched on, default value is used for result name.
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created solid
"""
# Example: see GEOM_TestAll.py
- anObj = self.PrimOp.MakeThickening(theShape, theThickness, True)
- RaiseIfFailed("MakeThickening", self.PrimOp)
- self._autoPublish(anObj, theName, "pipe")
+ theThickness,Parameters = ParseParameters(theThickness)
+ anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
+ theThickness, True, theInside)
+ RaiseIfFailed("MakeThickSolid", self.PrimOp)
+ anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "thickSolid")
return anObj
- ## Modifies a face or a shell to make it a thick solid
- # @param theShape Face or Shell to be thicken
+ ## Modifies a shape to make it a thick solid. If the input is a surface
+ # shape (face or shell) the result is a thick solid. If an input shape
+ # is a solid the result is a hollowed solid with removed faces.
+ # @param theShape Face or Shell to get thick solid or solid to get
+ # hollowed solid.
# @param theThickness Thickness of the resulting solid
+ # @param theFacesIDs the list of face IDs to be removed from the
+ # result. It is ignored if \a theShape is a face or a shell.
+ # It is empty by default.
+ # @param theInside If true the thickness is applied towards inside
#
# @return The modified shape
#
+ # @ref tui_creation_thickness "Example"
@ManageTransactions("PrimOp")
- def Thicken(self, theShape, theThickness):
+ def Thicken(self, theShape, theThickness, theFacesIDs=[], theInside=False):
"""
- Modifies a face or a shell to make it a thick solid
+ Modifies a shape to make it a thick solid. If the input is a
+ surface shape (face or shell) the result is a thick solid. If
+ an input shape is a solid the result is a hollowed solid with
+ removed faces.
Parameters:
- theBase Base shape to be extruded.
- thePath Path shape to extrude the base shape along it.
- theName Object name; when specified, this parameter is used
- for result publication in the study. Otherwise, if automatic
- publication is switched on, default value is used for result name.
+ theShape Face or Shell to get thick solid or solid to get
+ hollowed solid.
+ theThickness Thickness of the resulting solid
+ theFacesIDs the list of face IDs to be removed from the
+ result. It is ignored if \a theShape is a face or
+ a shell. It is empty by default.
+ theInside If true the thickness is applied towards inside
Returns:
The modified shape
"""
# Example: see GEOM_TestAll.py
- anObj = self.PrimOp.MakeThickening(theShape, theThickness, False)
- RaiseIfFailed("MakeThickening", self.PrimOp)
+ theThickness,Parameters = ParseParameters(theThickness)
+ anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
+ theThickness, False, theInside)
+ RaiseIfFailed("Thicken", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Build a middle path of a pipe-like shape.
# end of l3_complex
## @}
- ## @addtogroup l3_advanced
+ ## @addtogroup l3_basic_go
## @{
## Create a linear edge with specified ends.
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing the created face.
+ # @return New GEOM.GEOM_Object, containing the created face (compound of faces).
#
# @ref tui_creation_face "Example"
@ManageTransactions("ShapesOp")
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing the created face.
+ New GEOM.GEOM_Object, containing the created face (compound of faces).
"""
# Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing the created face.
+ # @return New GEOM.GEOM_Object, containing the created face (compound of faces).
#
# @ref tui_creation_face "Example"
@ManageTransactions("ShapesOp")
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing the created face.
+ New GEOM.GEOM_Object, containing the created face (compound of faces).
"""
# Example: see GEOM_TestAll.py
- anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
+ anObj = self.ShapesOp.MakeFaceWires(ToList(theWires), isPlanarWanted)
if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
print "WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built."
else:
anObj = self.MakeFaceWires(theWires, isPlanarWanted, theName)
return anObj
+ ## Create a face based on a surface from given face bounded
+ # by given wire.
+ # @param theFace the face whose surface is used to create a new face.
+ # @param theWire the wire that will bound a new face.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return New GEOM.GEOM_Object, containing the created face.
+ #
+ # @ref tui_creation_face "Example"
+ @ManageTransactions("ShapesOp")
+ def MakeFaceFromSurface(self, theFace, theWire, theName=None):
+ """
+ Create a face based on a surface from given face bounded
+ by given wire.
+
+ Parameters:
+ theFace the face whose surface is used to create a new face.
+ theWire the wire that will bound a new face.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the created face.
+ """
+ # Example: see GEOM_TestAll.py
+ anObj = self.ShapesOp.MakeFaceFromSurface(theFace, theWire)
+ RaiseIfFailed("MakeFaceFromSurface", self.ShapesOp)
+ self._autoPublish(anObj, theName, "face")
+ return anObj
+
+ ## Create a face from a set of edges with the given constraints.
+ # @param theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples):
+ # - edges should form a closed wire;
+ # - for each edge, constraint face is optional: if a constraint face is missing
+ # for some edge, this means that there no constraint associated with this edge.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return New GEOM.GEOM_Object, containing the created face.
+ #
+ # @ref tui_creation_face "Example"
+ @ManageTransactions("ShapesOp")
+ def MakeFaceWithConstraints(self, theConstraints, theName=None):
+ """
+ Create a face from a set of edges with the given constraints.
+
+ Parameters:
+ theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples):
+ - edges should form a closed wire;
+ - for each edge, constraint face is optional: if a constraint face is missing
+ for some edge, this means that there no constraint associated with this edge.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the created face.
+ """
+ # Example: see GEOM_TestAll.py
+ anObj = self.ShapesOp.MakeFaceWithConstraints(theConstraints)
+ if anObj is None:
+ RaiseIfFailed("MakeFaceWithConstraints", self.ShapesOp)
+ self._autoPublish(anObj, theName, "face")
+ return anObj
+
## Create a shell from the set of faces and shells.
# @param theFacesAndShells List of faces and/or shells.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing the created shell.
+ # @return New GEOM.GEOM_Object, containing the created shell (compound of shells).
#
# @ref tui_creation_shell "Example"
@ManageTransactions("ShapesOp")
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing the created shell.
+ New GEOM.GEOM_Object, containing the created shell (compound of shells).
"""
# Example: see GEOM_TestAll.py
- anObj = self.ShapesOp.MakeShell(theFacesAndShells)
+ anObj = self.ShapesOp.MakeShell( ToList( theFacesAndShells ))
RaiseIfFailed("MakeShell", self.ShapesOp)
self._autoPublish(anObj, theName, "shell")
return anObj
New GEOM.GEOM_Object, containing the created solid.
"""
# Example: see GEOM_TestAll.py
+ theShells = ToList(theShells)
if len(theShells) == 1:
descr = self._IsGoodForSolid(theShells[0])
#if len(descr) > 0:
New GEOM.GEOM_Object, containing the created compound.
"""
# Example: see GEOM_TestAll.py
- anObj = self.ShapesOp.MakeCompound(theShapes)
+ anObj = self.ShapesOp.MakeCompound(ToList(theShapes))
RaiseIfFailed("MakeCompound", self.ShapesOp)
self._autoPublish(anObj, theName, "compound")
return anObj
+
+ ## Create a solid (or solids) from the set of faces and/or shells.
+ # @param theFacesOrShells List of faces and/or shells.
+ # @param isIntersect If TRUE, forces performing intersections
+ # between arguments; otherwise (default) intersection is not performed.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return New GEOM.GEOM_Object, containing the created solid (or compound of solids).
+ #
+ # @ref tui_creation_solid_from_faces "Example"
+ @ManageTransactions("ShapesOp")
+ def MakeSolidFromConnectedFaces(self, theFacesOrShells, isIntersect = False, theName=None):
+ """
+ Create a solid (or solids) from the set of connected faces and/or shells.
+
+ Parameters:
+ theFacesOrShells List of faces and/or shells.
+ isIntersect If TRUE, forces performing intersections
+ between arguments; otherwise (default) intersection is not performed
+ theName Object name; when specified, this parameter is used.
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the created solid (or compound of solids).
+ """
+ # Example: see GEOM_TestAll.py
+ anObj = self.ShapesOp.MakeSolidFromConnectedFaces(theFacesOrShells, isIntersect)
+ RaiseIfFailed("MakeSolidFromConnectedFaces", self.ShapesOp)
+ self._autoPublish(anObj, theName, "solid")
+ return anObj
- # end of l3_advanced
+ # end of l3_basic_go
## @}
## @addtogroup l2_measure
# @param theShape Shape to find free faces in.
# @return List of IDs of all free faces, contained in theShape.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_free_faces_page "Example"
@ManageTransactions("ShapesOp")
def GetFreeFacesIDs(self,theShape):
"""
self._autoPublish(aList, theName, "shared")
return aList
- ## Get all sub-shapes, shared by all shapes in the list <VAR>theShapes</VAR>.
- # @param theShapes Shapes to find common sub-shapes of.
- # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
+ ## Get sub-shapes, shared by input shapes.
+ # @param theShapes Either a list or compound of shapes to find common sub-shapes of.
+ # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()).
+ # @param theMultiShare Specifies what type of shares should be checked:
+ # - @c True (default): search sub-shapes from 1st input shape shared with all other input shapes;
+ # - @c False: causes to search sub-shapes shared between couples of input shapes.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return List of objects, that are sub-shapes of all given shapes.
+ # @note If @a theShapes contains single compound, the shares between all possible couples of
+ # its top-level shapes are returned; otherwise, only shares between 1st input shape
+ # and all rest input shapes are returned.
#
- # @ref swig_GetSharedShapes "Example"
+ # @return List of all found sub-shapes.
+ #
+ # Examples:
+ # - @ref tui_shared_shapes "Example 1"
+ # - @ref swig_GetSharedShapes "Example 2"
@ManageTransactions("ShapesOp")
- def GetSharedShapesMulti(self, theShapes, theShapeType, theName=None):
+ def GetSharedShapesMulti(self, theShapes, theShapeType, theMultiShare=True, theName=None):
"""
- Get all sub-shapes, shared by all shapes in the list theShapes.
+ Get sub-shapes, shared by input shapes.
Parameters:
- theShapes Shapes to find common sub-shapes of.
- theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
+ theShapes Either a list or compound of shapes to find common sub-shapes of.
+ theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType).
+ theMultiShare Specifies what type of shares should be checked:
+ - True (default): search sub-shapes from 1st input shape shared with all other input shapes;
+ - False: causes to search sub-shapes shared between couples of input shapes.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
+ Note: if theShapes contains single compound, the shares between all possible couples of
+ its top-level shapes are returned; otherwise, only shares between 1st input shape
+ and all rest input shapes are returned.
+
Returns:
- List of GEOM.GEOM_Object, that are sub-shapes of all given shapes.
+ List of all found sub-shapes.
"""
# Example: see GEOM_TestOthers.py
- aList = self.ShapesOp.GetSharedShapesMulti(theShapes, theShapeType)
+ aList = self.ShapesOp.GetSharedShapesMulti(ToList(theShapes), theShapeType, theMultiShare)
RaiseIfFailed("GetSharedShapesMulti", self.ShapesOp)
self._autoPublish(aList, theName, "shared")
return aList
RaiseIfFailed("GetSameIDs", self.ShapesOp)
return anObj
+ ## Resize the input edge with the new Min and Max parameters.
+ # The input edge parameters range is [0, 1]. If theMin parameter is
+ # negative, the input edge is extended, otherwise it is shrinked by
+ # theMin parameter. If theMax is greater than 1, the edge is extended,
+ # otherwise it is shrinked by theMax parameter.
+ # @param theEdge the input edge to be resized.
+ # @param theMin the minimal parameter value.
+ # @param theMax the maximal parameter value.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ # @return New GEOM.GEOM_Object, containing the created edge.
+ #
+ # @ref tui_extend "Example"
+ @ManageTransactions("ShapesOp")
+ def ExtendEdge(self, theEdge, theMin, theMax, theName=None):
+ """
+ Resize the input edge with the new Min and Max parameters.
+ The input edge parameters range is [0, 1]. If theMin parameter is
+ negative, the input edge is extended, otherwise it is shrinked by
+ theMin parameter. If theMax is greater than 1, the edge is extended,
+ otherwise it is shrinked by theMax parameter.
+
+ Parameters:
+ theEdge the input edge to be resized.
+ theMin the minimal parameter value.
+ theMax the maximal parameter value.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the created edge.
+ """
+ theMin, theMax, Parameters = ParseParameters(theMin, theMax)
+ anObj = self.ShapesOp.ExtendEdge(theEdge, theMin, theMax)
+ RaiseIfFailed("ExtendEdge", self.ShapesOp)
+ anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "edge")
+ return anObj
+
+ ## Resize the input face with the new UMin, UMax, VMin and VMax
+ # parameters. The input face U and V parameters range is [0, 1]. If
+ # theUMin parameter is negative, the input face is extended, otherwise
+ # it is shrinked along U direction by theUMin parameter. If theUMax is
+ # greater than 1, the face is extended, otherwise it is shrinked along
+ # U direction by theUMax parameter. So as for theVMin, theVMax and
+ # V direction of the input face.
+ # @param theFace the input face to be resized.
+ # @param theUMin the minimal U parameter value.
+ # @param theUMax the maximal U parameter value.
+ # @param theVMin the minimal V parameter value.
+ # @param theVMax the maximal V parameter value.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ # @return New GEOM.GEOM_Object, containing the created face.
+ #
+ # @ref tui_extend "Example"
+ @ManageTransactions("ShapesOp")
+ def ExtendFace(self, theFace, theUMin, theUMax,
+ theVMin, theVMax, theName=None):
+ """
+ Resize the input face with the new UMin, UMax, VMin and VMax
+ parameters. The input face U and V parameters range is [0, 1]. If
+ theUMin parameter is negative, the input face is extended, otherwise
+ it is shrinked along U direction by theUMin parameter. If theUMax is
+ greater than 1, the face is extended, otherwise it is shrinked along
+ U direction by theUMax parameter. So as for theVMin, theVMax and
+ V direction of the input face.
+
+ Parameters:
+ theFace the input face to be resized.
+ theUMin the minimal U parameter value.
+ theUMax the maximal U parameter value.
+ theVMin the minimal V parameter value.
+ theVMax the maximal V parameter value.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the created face.
+ """
+ theUMin, theUMax, theVMin, theVMax, Parameters = ParseParameters(theUMin, theUMax, theVMin, theVMax)
+ anObj = self.ShapesOp.ExtendFace(theFace, theUMin, theUMax,
+ theVMin, theVMax)
+ RaiseIfFailed("ExtendFace", self.ShapesOp)
+ anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "face")
+ return anObj
+
+ ## This function takes some face as input parameter and creates new
+ # GEOM_Object, i.e. topological shape by extracting underlying surface
+ # of the source face and limiting it by the Umin, Umax, Vmin, Vmax
+ # parameters of the source face (in the parametrical space).
+ # @param theFace the input face.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ # @return New GEOM.GEOM_Object, containing the created face.
+ #
+ # @ref tui_creation_surface "Example"
+ @ManageTransactions("ShapesOp")
+ def MakeSurfaceFromFace(self, theFace, theName=None):
+ """
+ This function takes some face as input parameter and creates new
+ GEOM_Object, i.e. topological shape by extracting underlying surface
+ of the source face and limiting it by the Umin, Umax, Vmin, Vmax
+ parameters of the source face (in the parametrical space).
+
+ Parameters:
+ theFace the input face.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the created face.
+ """
+ anObj = self.ShapesOp.MakeSurfaceFromFace(theFace)
+ RaiseIfFailed("MakeSurfaceFromFace", self.ShapesOp)
+ self._autoPublish(anObj, theName, "surface")
+ return anObj
# end of l4_obtain
## @}
self._autoPublish(ListObj, theName, "subshape")
return ListObj
+ ## Explode a shape into edges sorted in a row from a starting point.
+ # @param theShape the shape to be exploded on edges.
+ # @param theStartPoint the starting point.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ # @return List of GEOM.GEOM_Object that is actually an ordered list
+ # of edges sorted in a row from a starting point.
+ #
+ # @ref swig_GetSubShapeEdgeSorted "Example"
+ @ManageTransactions("ShapesOp")
+ def GetSubShapeEdgeSorted(self, theShape, theStartPoint, theName=None):
+ """
+ Explode a shape into edges sorted in a row from a starting point.
+
+ Parameters:
+ theShape the shape to be exploded on edges.
+ theStartPoint the starting point.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ List of GEOM.GEOM_Object that is actually an ordered list
+ of edges sorted in a row from a starting point.
+ """
+ # Example: see GEOM_TestAll.py
+ ListObj = self.ShapesOp.GetSubShapeEdgeSorted(theShape, theStartPoint)
+ RaiseIfFailed("GetSubShapeEdgeSorted", self.ShapesOp)
+ self._autoPublish(ListObj, theName, "SortedEdges")
+ return ListObj
+
+ ##
+ # Return the list of subshapes that satisfies a certain tolerance
+ # criterion. The user defines the type of shapes to be returned, the
+ # condition and the tolerance value. The operation is defined for
+ # faces, edges and vertices only. E.g. for theShapeType FACE,
+ # theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
+ # all faces of theShape that have tolerances greater then 1.e7.
+ #
+ # @param theShape the shape to be exploded
+ # @param theShapeType the type of sub-shapes to be returned (see
+ # ShapeType()). Can have the values FACE, EDGE and VERTEX only.
+ # @param theCondition the condition type (see GEOM::comparison_condition).
+ # @param theTolerance the tolerance filter.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ # @return the list of shapes that satisfy the conditions.
+ #
+ # @ref swig_GetSubShapesWithTolerance "Example"
+ @ManageTransactions("ShapesOp")
+ def GetSubShapesWithTolerance(self, theShape, theShapeType,
+ theCondition, theTolerance, theName=None):
+ """
+ Return the list of subshapes that satisfies a certain tolerance
+ criterion. The user defines the type of shapes to be returned, the
+ condition and the tolerance value. The operation is defined for
+ faces, edges and vertices only. E.g. for theShapeType FACE,
+ theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
+ all faces of theShape that have tolerances greater then 1.e7.
+
+ Parameters:
+ theShape the shape to be exploded
+ theShapeType the type of sub-shapes to be returned (see
+ ShapeType()). Can have the values FACE,
+ EDGE and VERTEX only.
+ theCondition the condition type (see GEOM::comparison_condition).
+ theTolerance the tolerance filter.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ The list of shapes that satisfy the conditions.
+ """
+ # Example: see GEOM_TestAll.py
+ ListObj = self.ShapesOp.GetSubShapesWithTolerance(theShape, EnumToLong(theShapeType),
+ theCondition, theTolerance)
+ RaiseIfFailed("GetSubShapesWithTolerance", self.ShapesOp)
+ self._autoPublish(ListObj, theName, "SubShapeWithTolerance")
+ return ListObj
+
+ ## Check if the object is a sub-object of another GEOM object.
+ # @param aSubObject Checked sub-object (or its parent object, in case if
+ # \a theSubObjectIndex is non-zero).
+ # @param anObject An object that is checked for ownership (or its parent object,
+ # in case if \a theObjectIndex is non-zero).
+ # @param aSubObjectIndex When non-zero, specifies a sub-shape index that
+ # identifies a sub-object within its parent specified via \a theSubObject.
+ # @param anObjectIndex When non-zero, specifies a sub-shape index that
+ # identifies an object within its parent specified via \a theObject.
+ # @return TRUE, if the given object contains sub-object.
+ @ManageTransactions("ShapesOp")
+ def IsSubShapeBelongsTo(self, aSubObject, anObject, aSubObjectIndex = 0, anObjectIndex = 0):
+ """
+ Check if the object is a sub-object of another GEOM object.
+
+ Parameters:
+ aSubObject Checked sub-object (or its parent object, in case if
+ \a theSubObjectIndex is non-zero).
+ anObject An object that is checked for ownership (or its parent object,
+ in case if \a theObjectIndex is non-zero).
+ aSubObjectIndex When non-zero, specifies a sub-shape index that
+ identifies a sub-object within its parent specified via \a theSubObject.
+ anObjectIndex When non-zero, specifies a sub-shape index that
+ identifies an object within its parent specified via \a theObject.
+
+ Returns
+ TRUE, if the given object contains sub-object.
+ """
+ IsOk = self.ShapesOp.IsSubShapeBelongsTo(aSubObject, aSubObjectIndex, anObject, anObjectIndex)
+ RaiseIfFailed("IsSubShapeBelongsTo", self.ShapesOp)
+ return IsOk
+
# end of l4_decompose
## @}
# - \b FixFaceSize.Tolerance - defines minimum possible face size. \n
# - \b DropSmallEdges - removes edges, which merge with neighbouring edges. \n
# - \b DropSmallEdges.Tolerance3d - defines minimum possible distance between two parallel edges.\n
+ # - \b DropSmallSolids - either removes small solids or merges them with neighboring ones. \n
+ # - \b DropSmallSolids.WidthFactorThreshold - defines maximum value of <em>2V/S</em> of a solid which is considered small, where \a V is volume and \a S is surface area of the solid. \n
+ # - \b DropSmallSolids.VolumeThreshold - defines maximum volume of a solid which is considered small. If the both tolerances are privided a solid is considered small if it meets the both criteria. \n
+ # - \b DropSmallSolids.MergeSolids - if "1", small solids are removed; if "0" small solids are merged to adjacent non-small solids or left untouched if cannot be merged. \n
#
# * \b SplitAngle - splits faces based on conical surfaces, surfaces of revolution and cylindrical
# surfaces in segments using a certain angle. \n
theShape Shape to be processed.
theValues List of values of parameters, in the same order
as parameters are listed in theParameters list.
- theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
+ theOperators List of names of operators ('FixShape', 'SplitClosedFaces', etc.).
theParameters List of names of parameters
- ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
+ ('FixShape.Tolerance3d', 'SplitClosedFaces.NbSplitPoints', etc.).
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
* FixShape.MaxTolerance3d - maximal possible tolerance of the shape after correction.
* FixFaceSize - removes small faces, such as spots and strips.
* FixFaceSize.Tolerance - defines minimum possible face size.
- * DropSmallEdges - removes edges, which merge with neighbouring edges.
+ * DropSmallEdges - removes edges, which merge with neighbouring edges.
* DropSmallEdges.Tolerance3d - defines minimum possible distance between two parallel edges.
+ * DropSmallSolids - either removes small solids or merges them with neighboring ones.
+ * DropSmallSolids.WidthFactorThreshold - defines maximum value of 2V/S of a solid which is considered small, where V is volume and S is surface area of the solid.
+ * DropSmallSolids.VolumeThreshold - defines maximum volume of a solid which is considered small. If the both tolerances are privided a solid is considered small if it meets the both criteria.
+ * DropSmallSolids.MergeSolids - if '1', small solids are removed; if '0' small solids are merged to adjacent non-small solids or left untouched if cannot be merged.
+
* SplitAngle - splits faces based on conical surfaces, surfaces of revolution and cylindrical surfaces
in segments using a certain angle.
* SplitAngle.Angle - the central angle of the resulting segments (i.e. we obtain two segments
self._autoPublish(anObj, theName, "suppressFaces")
return anObj
- ## Sewing of some shapes into single shape.
+ ## Sewing of faces into a single shell.
# @param ListShape Shapes to be processed.
# @param theTolerance Required tolerance value.
# @param AllowNonManifold Flag that allows non-manifold sewing.
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing processed shape.
+ # @return New GEOM.GEOM_Object, containing a result shell.
#
# @ref tui_sewing "Example"
def MakeSewing(self, ListShape, theTolerance, AllowNonManifold=False, theName=None):
"""
- Sewing of some shapes into single shape.
+ Sewing of faces into a single shell.
Parameters:
ListShape Shapes to be processed.
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing processed shape.
+ New GEOM.GEOM_Object, containing containing a result shell.
"""
# Example: see GEOM_TestHealing.py
- comp = self.MakeCompound(ListShape)
# note: auto-publishing is done in self.Sew()
- anObj = self.Sew(comp, theTolerance, AllowNonManifold, theName)
+ anObj = self.Sew(ListShape, theTolerance, AllowNonManifold, theName)
return anObj
- ## Sewing of the given object.
- # @param theObject Shape to be processed.
+ ## Sewing of faces into a single shell.
+ # @param ListShape Shapes to be processed.
# @param theTolerance Required tolerance value.
# @param AllowNonManifold Flag that allows non-manifold sewing.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing processed shape.
+ # @return New GEOM.GEOM_Object, containing a result shell.
@ManageTransactions("HealOp")
- def Sew(self, theObject, theTolerance, AllowNonManifold=False, theName=None):
+ def Sew(self, ListShape, theTolerance, AllowNonManifold=False, theName=None):
"""
- Sewing of the given object.
+ Sewing of faces into a single shell.
Parameters:
- theObject Shape to be processed.
+ ListShape Shapes to be processed.
theTolerance Required tolerance value.
AllowNonManifold Flag that allows non-manifold sewing.
theName Object name; when specified, this parameter is used
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing processed shape.
+ New GEOM.GEOM_Object, containing a result shell.
"""
# Example: see MakeSewing() above
theTolerance,Parameters = ParseParameters(theTolerance)
if AllowNonManifold:
- anObj = self.HealOp.SewAllowNonManifold(theObject, theTolerance)
+ anObj = self.HealOp.SewAllowNonManifold( ToList( ListShape ), theTolerance)
else:
- anObj = self.HealOp.Sew(theObject, theTolerance)
+ anObj = self.HealOp.Sew( ToList( ListShape ), theTolerance)
# To avoid script failure in case of good argument shape
+ # (Fix of test cases geom/bugs11/L7,L8)
if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
- return theObject
+ return anObj
RaiseIfFailed("Sew", self.HealOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "sewed")
return anObj
- ## Rebuild the topology of theCompound of solids by removing
- # of the faces that are shared by several solids.
- # @param theCompound Shape to be processed.
+ ## Rebuild the topology of theSolids by removing
+ # the faces that are shared by several solids.
+ # @param theSolids A compound or a list of solids to be processed.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @ref tui_remove_webs "Example"
@ManageTransactions("HealOp")
- def RemoveInternalFaces (self, theCompound, theName=None):
+ def RemoveInternalFaces (self, theSolids, theName=None):
"""
- Rebuild the topology of theCompound of solids by removing
- of the faces that are shared by several solids.
+ Rebuild the topology of theSolids by removing
+ the faces that are shared by several solids.
Parameters:
- theCompound Shape to be processed.
+ theSolids A compound or a list of solids to be processed.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
New GEOM.GEOM_Object, containing processed shape.
"""
# Example: see GEOM_TestHealing.py
- anObj = self.HealOp.RemoveInternalFaces(theCompound)
+ anObj = self.HealOp.RemoveInternalFaces(ToList(theSolids))
RaiseIfFailed("RemoveInternalFaces", self.HealOp)
self._autoPublish(anObj, theName, "removeWebs")
return anObj
self._autoPublish(anObj, theName, "divideEdge")
return anObj
+ ## Addition of points to a given edge of \a theObject by projecting
+ # other points to the given edge.
+ # @param theObject Shape to be processed.
+ # @param theEdgeIndex Index of edge to be divided within theObject's shape,
+ # if -1, then theObject itself is the edge.
+ # @param thePoints List of points to project to theEdgeIndex-th edge.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return New GEOM.GEOM_Object, containing processed shape.
+ #
+ # @ref tui_add_point_on_edge "Example"
+ @ManageTransactions("HealOp")
+ def DivideEdgeByPoint(self, theObject, theEdgeIndex, thePoints, theName=None):
+ """
+ Addition of points to a given edge of \a theObject by projecting
+ other points to the given edge.
+
+ Parameters:
+ theObject Shape to be processed.
+ theEdgeIndex The edge or its index to be divided within theObject's shape,
+ if -1, then theObject itself is the edge.
+ thePoints List of points to project to theEdgeIndex-th edge.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing processed shape.
+ """
+ # Example: see GEOM_TestHealing.py
+ if isinstance( theEdgeIndex, GEOM._objref_GEOM_Object ):
+ theEdgeIndex = self.GetSubShapeID( theObject, theEdgeIndex )
+ anObj = self.HealOp.DivideEdgeByPoint(theObject, theEdgeIndex, ToList( thePoints ))
+ RaiseIfFailed("DivideEdgeByPoint", self.HealOp)
+ self._autoPublish(anObj, theName, "divideEdge")
+ return anObj
+
## Suppress the vertices in the wire in case if adjacent edges are C1 continuous.
# @param theWire Wire to minimize the number of C1 continuous edges in.
# @param theVertices A list of vertices to suppress. If the list
# \n \a theClosedWires: Closed wires on the free boundary of the given shape.
# \n \a theOpenWires: Open wires on the free boundary of the given shape.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_free_boundaries_page "Example"
@ManageTransactions("HealOp")
def GetFreeBoundary(self, theObject, theName=None):
"""
theOpenWires: Open wires on the free boundary of the given shape.
"""
# Example: see GEOM_TestHealing.py
- anObj = self.HealOp.GetFreeBoundary(theObject)
+ anObj = self.HealOp.GetFreeBoundary( ToList( theObject ))
RaiseIfFailed("GetFreeBoundary", self.HealOp)
self._autoPublish(anObj[1], theName, "closedWire")
self._autoPublish(anObj[2], theName, "openWire")
return anObj
- ## Replace coincident faces in theShape by one face.
- # @param theShape Initial shape.
+ ## Replace coincident faces in \a theShapes by one face.
+ # @param theShapes Initial shapes, either a list or compound of shapes.
# @param theTolerance Maximum distance between faces, which can be considered as coincident.
# @param doKeepNonSolids If FALSE, only solids will present in the result,
# otherwise all initial shapes.
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing a copy of theShape without coincident faces.
+ # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
#
# @ref tui_glue_faces "Example"
@ManageTransactions("ShapesOp")
- def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True, theName=None):
+ def MakeGlueFaces(self, theShapes, theTolerance, doKeepNonSolids=True, theName=None):
"""
- Replace coincident faces in theShape by one face.
+ Replace coincident faces in theShapes by one face.
Parameters:
- theShape Initial shape.
+ theShapes Initial shapes, either a list or compound of shapes.
theTolerance Maximum distance between faces, which can be considered as coincident.
doKeepNonSolids If FALSE, only solids will present in the result,
otherwise all initial shapes.
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing a copy of theShape without coincident faces.
+ New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
"""
# Example: see GEOM_Spanner.py
theTolerance,Parameters = ParseParameters(theTolerance)
- anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
+ anObj = self.ShapesOp.MakeGlueFaces(ToList(theShapes), theTolerance, doKeepNonSolids)
if anObj is None:
raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "glueFaces")
return anObj
- ## Find coincident faces in theShape for possible gluing.
- # @param theShape Initial shape.
+ ## Find coincident faces in \a theShapes for possible gluing.
+ # @param theShapes Initial shapes, either a list or compound of shapes.
# @param theTolerance Maximum distance between faces,
# which can be considered as coincident.
# @param theName Object name; when specified, this parameter is used
#
# @ref tui_glue_faces "Example"
@ManageTransactions("ShapesOp")
- def GetGlueFaces(self, theShape, theTolerance, theName=None):
+ def GetGlueFaces(self, theShapes, theTolerance, theName=None):
"""
- Find coincident faces in theShape for possible gluing.
+ Find coincident faces in theShapes for possible gluing.
Parameters:
- theShape Initial shape.
+ theShapes Initial shapes, either a list or compound of shapes.
theTolerance Maximum distance between faces,
which can be considered as coincident.
theName Object name; when specified, this parameter is used
Returns:
GEOM.ListOfGO
"""
- anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
+ anObj = self.ShapesOp.GetGlueFaces(ToList(theShapes), theTolerance)
RaiseIfFailed("GetGlueFaces", self.ShapesOp)
self._autoPublish(anObj, theName, "facesToGlue")
return anObj
- ## Replace coincident faces in theShape by one face
+ ## Replace coincident faces in \a theShapes by one face
# in compliance with given list of faces
- # @param theShape Initial shape.
+ # @param theShapes Initial shapes, either a list or compound of shapes.
# @param theTolerance Maximum distance between faces,
# which can be considered as coincident.
# @param theFaces List of faces for gluing.
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing a copy of theShape
- # without some faces.
+ # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
#
# @ref tui_glue_faces "Example"
@ManageTransactions("ShapesOp")
- def MakeGlueFacesByList(self, theShape, theTolerance, theFaces,
+ def MakeGlueFacesByList(self, theShapes, theTolerance, theFaces,
doKeepNonSolids=True, doGlueAllEdges=True, theName=None):
"""
- Replace coincident faces in theShape by one face
+ Replace coincident faces in theShapes by one face
in compliance with given list of faces
Parameters:
- theShape Initial shape.
+ theShapes theShapes Initial shapes, either a list or compound of shapes.
theTolerance Maximum distance between faces,
which can be considered as coincident.
theFaces List of faces for gluing.
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing a copy of theShape
- without some faces.
+ New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
"""
- anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces,
+ anObj = self.ShapesOp.MakeGlueFacesByList(ToList(theShapes), theTolerance, ToList(theFaces),
doKeepNonSolids, doGlueAllEdges)
if anObj is None:
raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
self._autoPublish(anObj, theName, "glueFaces")
return anObj
- ## Replace coincident edges in theShape by one edge.
- # @param theShape Initial shape.
+ ## Replace coincident edges in \a theShapes by one edge.
+ # @param theShapes Initial shapes, either a list or compound of shapes.
# @param theTolerance Maximum distance between edges, which can be considered as coincident.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing a copy of theShape without coincident edges.
+ # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
#
# @ref tui_glue_edges "Example"
@ManageTransactions("ShapesOp")
- def MakeGlueEdges(self, theShape, theTolerance, theName=None):
+ def MakeGlueEdges(self, theShapes, theTolerance, theName=None):
"""
- Replace coincident edges in theShape by one edge.
+ Replace coincident edges in theShapes by one edge.
Parameters:
- theShape Initial shape.
+ theShapes Initial shapes, either a list or compound of shapes.
theTolerance Maximum distance between edges, which can be considered as coincident.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing a copy of theShape without coincident edges.
+ New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
"""
theTolerance,Parameters = ParseParameters(theTolerance)
- anObj = self.ShapesOp.MakeGlueEdges(theShape, theTolerance)
+ anObj = self.ShapesOp.MakeGlueEdges(ToList(theShapes), theTolerance)
if anObj is None:
raise RuntimeError, "MakeGlueEdges : " + self.ShapesOp.GetErrorCode()
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "glueEdges")
return anObj
- ## Find coincident edges in theShape for possible gluing.
- # @param theShape Initial shape.
+ ## Find coincident edges in \a theShapes for possible gluing.
+ # @param theShapes Initial shapes, either a list or compound of shapes.
# @param theTolerance Maximum distance between edges,
# which can be considered as coincident.
# @param theName Object name; when specified, this parameter is used
#
# @ref tui_glue_edges "Example"
@ManageTransactions("ShapesOp")
- def GetGlueEdges(self, theShape, theTolerance, theName=None):
+ def GetGlueEdges(self, theShapes, theTolerance, theName=None):
"""
- Find coincident edges in theShape for possible gluing.
+ Find coincident edges in theShapes for possible gluing.
Parameters:
- theShape Initial shape.
+ theShapes Initial shapes, either a list or compound of shapes.
theTolerance Maximum distance between edges,
which can be considered as coincident.
theName Object name; when specified, this parameter is used
Returns:
GEOM.ListOfGO
"""
- anObj = self.ShapesOp.GetGlueEdges(theShape, theTolerance)
+ anObj = self.ShapesOp.GetGlueEdges(ToList(theShapes), theTolerance)
RaiseIfFailed("GetGlueEdges", self.ShapesOp)
self._autoPublish(anObj, theName, "edgesToGlue")
return anObj
- ## Replace coincident edges in theShape by one edge
+ ## Replace coincident edges in theShapes by one edge
# in compliance with given list of edges.
- # @param theShape Initial shape.
+ # @param theShapes Initial shapes, either a list or compound of shapes.
# @param theTolerance Maximum distance between edges,
# which can be considered as coincident.
# @param theEdges List of edges for gluing.
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return New GEOM.GEOM_Object, containing a copy of theShape
- # without some edges.
+ # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
#
# @ref tui_glue_edges "Example"
@ManageTransactions("ShapesOp")
- def MakeGlueEdgesByList(self, theShape, theTolerance, theEdges, theName=None):
+ def MakeGlueEdgesByList(self, theShapes, theTolerance, theEdges, theName=None):
"""
- Replace coincident edges in theShape by one edge
+ Replace coincident edges in theShapes by one edge
in compliance with given list of edges.
Parameters:
- theShape Initial shape.
+ theShapes Initial shapes, either a list or compound of shapes.
theTolerance Maximum distance between edges,
which can be considered as coincident.
theEdges List of edges for gluing.
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing a copy of theShape
- without some edges.
+ New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
"""
- anObj = self.ShapesOp.MakeGlueEdgesByList(theShape, theTolerance, theEdges)
+ anObj = self.ShapesOp.MakeGlueEdgesByList(ToList(theShapes), theTolerance, theEdges)
if anObj is None:
raise RuntimeError, "MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode()
self._autoPublish(anObj, theName, "glueEdges")
# @param theShape2 Second argument for boolean operation.
# @param checkSelfInte The flag that tells if the arguments should
# be checked for self-intersection prior to the operation.
+ # If a self-intersection detected the operation fails.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
- #
- # @note This algorithm doesn't find all types of self-intersections.
- # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
- # vertex/face and edge/face intersections. Face/face
- # intersections detection is switched off as it is a
- # time-consuming operation that gives an impact on performance.
- # To find all self-intersections please use
- # CheckSelfIntersections() method.
- #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_section "Example 1"
theShape1 First argument for boolean operation.
theShape2 Second argument for boolean operation.
checkSelfInte The flag that tells if the arguments should
- be checked for self-intersection prior to
- the operation.
+ be checked for self-intersection prior to the operation.
+ If a self-intersection detected the operation fails.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
-
- Note:
- This algorithm doesn't find all types of self-intersections.
- It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
- vertex/face and edge/face intersections. Face/face
- intersections detection is switched off as it is a
- time-consuming operation that gives an impact on performance.
- To find all self-intersections please use
- CheckSelfIntersections() method.
-
Returns:
New GEOM.GEOM_Object, containing the result shape.
#
# @return New GEOM.GEOM_Object, containing the result shape.
#
+ # @note This operation is a shortcut to the more general @ref MakePartition
+ # operation, where @a theShape specifies single "object" (shape being partitioned)
+ # and @a thePlane specifies single "tool" (intersector shape). Other parameters of
+ # @ref MakePartition operation have default values:
+ # - @a Limit: GEOM::SHAPE (shape limit corresponds to the type of @a theShape)
+ # - @a KeepNonlimitShapes: 0
+ # - @a KeepInside, @a RemoveInside, @a RemoveWebs,
+ # @a Materials (obsolete parameters): empty
+ #
+ # @note I.e. the following two operations are equivalent:
+ # @code
+ # Result = geompy.MakeHalfPartition(Object, Plane)
+ # Result = geompy.MakePartition([Object], [Plane])
+ # @endcode
+ #
+ # @sa MakePartition, MakePartitionNonSelfIntersectedShape
+ #
# @ref tui_partition "Example"
@ManageTransactions("BoolOp")
def MakeHalfPartition(self, theShape, thePlane, theName=None):
Returns:
New GEOM.GEOM_Object, containing the result shape.
+
+ Note: This operation is a shortcut to the more general MakePartition
+ operation, where theShape specifies single "object" (shape being partitioned)
+ and thePlane specifies single "tool" (intersector shape). Other parameters of
+ MakePartition operation have default values:
+ - Limit: GEOM::SHAPE (shape limit corresponds to the type of theShape)
+ - KeepNonlimitShapes: 0
+ - KeepInside, RemoveInside, RemoveWebs, Materials (obsolete parameters): empty
+
+ I.e. the following two operations are equivalent:
+ Result = geompy.MakeHalfPartition(Object, Plane)
+ Result = geompy.MakePartition([Object], [Plane])
"""
# Example: see GEOM_TestAll.py
anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
self._autoPublish(anObj, theName, "offset")
return anObj
- ## Create new object as projection of the given one on a 2D surface.
+ ## Create new object as projection of the given one on another.
# @param theSource The source object for the projection. It can be a point, edge or wire.
- # @param theTarget The target object. It can be planar or cylindrical face.
+ # Edge and wire are acceptable if @a theTarget is a face.
+ # @param theTarget The target object. It can be planar or cylindrical face, edge or wire.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
@ManageTransactions("TrsfOp")
def MakeProjection(self, theSource, theTarget, theName=None):
"""
- Create new object as projection of the given one on a 2D surface.
+ Create new object as projection of the given one on another.
Parameters:
theSource The source object for the projection. It can be a point, edge or wire.
- theTarget The target object. It can be planar or cylindrical face.
+ Edge and wire are acceptable if theTarget is a face.
+ theTarget The target object. It can be planar or cylindrical face, edge or wire.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
self._autoPublish(anObj, theName, "projection")
return anObj
- ## Create a projection projection of the given point on a wire or an edge.
+ ## Create a projection of the given point on a wire or an edge.
# If there are no solutions or there are 2 or more solutions It throws an
# exception.
# @param thePoint the point to be projected.
@ManageTransactions("TrsfOp")
def MakeProjectionOnWire(self, thePoint, theWire, theName=None):
"""
- Create a projection projection of the given point on a wire or an edge.
+ Create a projection of the given point on a wire or an edge.
If there are no solutions or there are 2 or more solutions It throws an
exception.
anObj = self.MultiRotate2DByStep(aShape, aVec, anAngle, nbtimes1, aStep, nbtimes2, theName)
return anObj
+ ##
+ # Compute a wire or a face that represents a projection of the source
+ # shape onto cylinder. The cylinder's coordinate system is the same
+ # as the global coordinate system.
+ #
+ # @param theObject The object to be projected. It can be either
+ # a planar wire or a face.
+ # @param theRadius The radius of the cylinder.
+ # @param theStartAngle The starting angle in radians from
+ # the cylinder's X axis around Z axis. The angle from which
+ # the projection is started.
+ # @param theAngleLength The projection length angle in radians.
+ # The angle in which to project the total length of the wire.
+ # If it is negative the projection is not scaled and natural
+ # wire length is kept for the projection.
+ # @param theAngleRotation The desired angle in radians between
+ # the tangent vector to the first curve at the first point of
+ # the theObject's projection in 2D space and U-direction of
+ # cylinder's 2D space.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return New GEOM.GEOM_Object, containing the result shape. The result
+ # represents a wire or a face that represents a projection of
+ # the source shape onto a cylinder.
+ #
+ # @ref tui_projection "Example"
+ def MakeProjectionOnCylinder (self, theObject, theRadius,
+ theStartAngle=0.0, theAngleLength=-1.0,
+ theAngleRotation=0.0,
+ theName=None):
+ """
+ Compute a wire or a face that represents a projection of the source
+ shape onto cylinder. The cylinder's coordinate system is the same
+ as the global coordinate system.
+
+ Parameters:
+ theObject The object to be projected. It can be either
+ a planar wire or a face.
+ theRadius The radius of the cylinder.
+ theStartAngle The starting angle in radians from the cylinder's X axis
+ around Z axis. The angle from which the projection is started.
+ theAngleLength The projection length angle in radians. The angle in which
+ to project the total length of the wire. If it is negative the
+ projection is not scaled and natural wire length is kept for
+ the projection.
+ theAngleRotation The desired angle in radians between
+ the tangent vector to the first curve at the first
+ point of the theObject's projection in 2D space and
+ U-direction of cylinder's 2D space.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the result shape. The result
+ represents a wire or a face that represents a projection of
+ the source shape onto a cylinder.
+ """
+ # Example: see GEOM_TestAll.py
+ flagStartAngle = False
+ if isinstance(theStartAngle,str):
+ flagStartAngle = True
+ flagAngleLength = False
+ if isinstance(theAngleLength,str):
+ flagAngleLength = True
+ flagAngleRotation = False
+ if isinstance(theAngleRotation,str):
+ flagAngleRotation = True
+ theRadius, theStartAngle, theAngleLength, theAngleRotation, Parameters = ParseParameters(
+ theRadius, theStartAngle, theAngleLength, theAngleRotation)
+ if flagStartAngle:
+ theStartAngle = theStartAngle*math.pi/180.
+ if flagAngleLength:
+ theAngleLength = theAngleLength*math.pi/180.
+ if flagAngleRotation:
+ theAngleRotation = theAngleRotation*math.pi/180.
+ anObj = self.TrsfOp.MakeProjectionOnCylinder(theObject, theRadius,
+ theStartAngle, theAngleLength, theAngleRotation)
+ RaiseIfFailed("MakeProjectionOnCylinder", self.TrsfOp)
+ anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "projection")
+ return anObj
+
# end of l3_transform
## @}
# @param theBase Closed edge or wire defining the base shape to be extruded.
# @param theH Prism dimension along the normal to theBase
# @param theAngle Draft angle in degrees.
+ # @param theInvert If true material changes the direction
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @ref tui_creation_prism "Example"
@ManageTransactions("PrimOp")
- def MakeExtrudedCut(self, theInit, theBase, theH, theAngle, theName=None):
+ def MakeExtrudedCut(self, theInit, theBase, theH, theAngle, theInvert=False, theName=None):
"""
Add material to a solid by extrusion of the base shape on the given distance.
theBase Closed edge or wire defining the base shape to be extruded.
theH Prism dimension along the normal to theBase
theAngle Draft angle in degrees.
+ theInvert If true material changes the direction.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
New GEOM.GEOM_Object, containing the initial shape with removed material.
"""
# Example: see GEOM_TestAll.py
- #theH,Parameters = ParseParameters(theH)
- anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False)
+ theH,theAngle,Parameters = ParseParameters(theH,theAngle)
+ anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False, theInvert)
RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
- #anObj.SetParameters(Parameters)
+ anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "extrudedCut")
return anObj
# @param theBase Closed edge or wire defining the base shape to be extruded.
# @param theH Prism dimension along the normal to theBase
# @param theAngle Draft angle in degrees.
+ # @param theInvert If true material changes the direction
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @ref tui_creation_prism "Example"
@ManageTransactions("PrimOp")
- def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle, theName=None):
+ def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle, theInvert=False, theName=None):
"""
Add material to a solid by extrusion of the base shape on the given distance.
theBase Closed edge or wire defining the base shape to be extruded.
theH Prism dimension along the normal to theBase
theAngle Draft angle in degrees.
+ theInvert If true material changes the direction.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
New GEOM.GEOM_Object, containing the initial shape with added material.
"""
# Example: see GEOM_TestAll.py
- #theH,Parameters = ParseParameters(theH)
- anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True)
+ theH,theAngle,Parameters = ParseParameters(theH,theAngle)
+ anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True, theInvert)
RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
- #anObj.SetParameters(Parameters)
+ anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "extrudedBoss")
return anObj
## Perform an Archimde operation on the given shape with given parameters.
# The object presenting the resulting face is returned.
# @param theShape Shape to be put in water.
- # @param theWeight Weight og the shape.
+ # @param theWeight Weight of the shape.
# @param theWaterDensity Density of the water.
# @param theMeshDeflection Deflection of the mesh, using to compute the section.
# @param theName Object name; when specified, this parameter is used
Parameters:
theShape Shape to be put in water.
- theWeight Weight og the shape.
+ theWeight Weight of the shape.
theWaterDensity Density of the water.
theMeshDeflection Deflection of the mesh, using to compute the section.
theName Object name; when specified, this parameter is used
## Get point coordinates
# @return [x, y, z]
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_point_coordinates_page "Example"
@ManageTransactions("MeasuOp")
def PointCoordinates(self,Point):
"""
# theSurfArea: Area of surface of the given shape.\n
# theVolume: Volume of the given shape.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_basic_properties_page "Example"
@ManageTransactions("MeasuOp")
def BasicProperties(self,theShape):
"""
# Ymin,Ymax: Limits of shape along OY axis.
# Zmin,Zmax: Limits of shape along OZ axis.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_bounding_box_page "Example"
@ManageTransactions("MeasuOp")
def BoundingBox (self, theShape, precise=False):
"""
#
# @return New GEOM.GEOM_Object, containing the created box.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_bounding_box_page "Example"
@ManageTransactions("MeasuOp")
def MakeBoundingBox (self, theShape, precise=False, theName=None):
"""
# I(1-3)(1-3): Components of the inertia matrix of the given shape.
# Ix,Iy,Iz: Moments of inertia of the given shape.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_inertia_page "Example"
@ManageTransactions("MeasuOp")
def Inertia(self,theShape):
"""
# @param theShape1,theShape2 Shapes to find minimal distance between.
# @return Value of the minimal distance between the given shapes.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_min_distance_page "Example"
@ManageTransactions("MeasuOp")
def MinDistance(self, theShape1, theShape2):
"""
# @return Value of the minimal distance between the given shapes, in form of list
# [Distance, DX, DY, DZ].
#
- # @ref swig_all_measure "Example"
+ # @ref tui_min_distance_page "Example"
@ManageTransactions("MeasuOp")
def MinDistanceComponents(self, theShape1, theShape2):
"""
# @return The number of found solutions (-1 in case of infinite number of
# solutions) and a list of (X, Y, Z) coordinates for all couples of points.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_min_distance_page "Example"
@ManageTransactions("MeasuOp")
def ClosestPoints (self, theShape1, theShape2):
"""
# with their orientations, otherwise the minimum angle is computed.
# @return Value of the angle between the given shapes in degrees.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_angle_page "Example"
@ManageTransactions("MeasuOp")
def GetAngle(self, theShape1, theShape2):
"""
# with their orientations, otherwise the minimum angle is computed.
# @return Value of the angle between the given shapes in radians.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_angle_page "Example"
@ManageTransactions("MeasuOp")
def GetAngleRadians(self, theShape1, theShape2):
"""
# if False, the opposite vector to the normal vector is used.
# @return Value of the angle between the given vectors in degrees.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_angle_page "Example"
@ManageTransactions("MeasuOp")
def GetAngleVectors(self, theShape1, theShape2, theFlag = True):
"""
# EdgeMin,EdgeMax: Min and max tolerances of the edges.\n
# VertMin,VertMax: Min and max tolerances of the vertices.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_tolerance_page "Example"
@ManageTransactions("MeasuOp")
def Tolerance(self,theShape):
"""
# @param theShape Shape to be described.
# @return Description of the given shape.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_whatis_page "Example"
@ManageTransactions("MeasuOp")
def WhatIs(self,theShape):
"""
return aDict
def GetCreationInformation(self, theShape):
- info = theShape.GetCreationInformation()
- # operationName
- opName = info.operationName
- if not opName: opName = "no info available"
- res = "Operation: " + opName
- # parameters
- for parVal in info.params:
- res += " \n %s = %s" % ( parVal.name, parVal.value )
+ res = ''
+ infos = theShape.GetCreationInformation()
+ for info in infos:
+ # operationName
+ opName = info.operationName
+ if not opName: opName = "no info available"
+ if res: res += "\n"
+ res += "Operation: " + opName
+ # parameters
+ for parVal in info.params:
+ res += "\n \t%s = %s" % ( parVal.name, parVal.value )
return res
## Get a point, situated at the centre of mass of theShape.
#
# @return New GEOM.GEOM_Object, containing the created point.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_center_of_mass_page "Example"
@ManageTransactions("MeasuOp")
def MakeCDG(self, theShape, theName=None):
"""
# @return If theReturnStatus is equal to 1 the description is returned.
# Otherwise doesn't return anything.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_check_shape_page "Example"
@ManageTransactions("MeasuOp")
def PrintShapeErrors(self, theShape, theShapeErrors, theReturnStatus = 0):
"""
# If theReturnStatus is equal to 2 the list of error data is
# returned along with IsValid flag.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_check_shape_page "Example"
@ManageTransactions("MeasuOp")
def CheckShape(self,theShape, theIsCheckGeom = 0, theReturnStatus = 0):
"""
## Detect self-intersections in the given shape.
# @param theShape Shape to check.
+ # @param theCheckLevel is the level of self-intersection check.
+ # Possible input values are:
+ # - GEOM.SI_V_V(0) - only V/V interferences
+ # - GEOM.SI_V_E(1) - V/V and V/E interferences
+ # - GEOM.SI_E_E(2) - V/V, V/E and E/E interferences
+ # - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences
+ # - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences
+ # - GEOM.SI_ALL(5) - all interferences.
# @return TRUE, if the shape contains no self-intersections.
#
- # @ref tui_measurement_tools_page "Example"
+ # @ref tui_check_self_intersections_page "Example"
@ManageTransactions("MeasuOp")
- def CheckSelfIntersections(self, theShape):
+ def CheckSelfIntersections(self, theShape, theCheckLevel = GEOM.SI_ALL):
"""
Detect self-intersections in the given shape.
Parameters:
theShape Shape to check.
-
+ theCheckLevel is the level of self-intersection check.
+ Possible input values are:
+ - GEOM.SI_V_V(0) - only V/V interferences
+ - GEOM.SI_V_E(1) - V/V and V/E interferences
+ - GEOM.SI_E_E(2) - V/V, V/E and E/E interferences
+ - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences
+ - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences
+ - GEOM.SI_ALL(5) - all interferences.
+
Returns:
TRUE, if the shape contains no self-intersections.
"""
# Example: see GEOM_TestMeasures.py
- (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersections(theShape)
+ (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersections(theShape, EnumToLong(theCheckLevel))
RaiseIfFailed("CheckSelfIntersections", self.MeasuOp)
return IsValid
+ ## Detect self-intersections of the given shape with algorithm based on mesh intersections.
+ # @param theShape Shape to check.
+ # @param theDeflection Linear deflection coefficient that specifies quality of tesselation:
+ # - if \a theDeflection <= 0, default deflection 0.001 is used
+ # @param theTolerance Specifies a distance between sub-shapes used for detecting gaps:
+ # - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
+ # - if \a theTolerance > 0, algorithm detects gaps
+ # @return TRUE, if the shape contains no self-intersections.
+ #
+ # @ref tui_check_self_intersections_fast_page "Example"
+ @ManageTransactions("MeasuOp")
+ def CheckSelfIntersectionsFast(self, theShape, theDeflection = 0.001, theTolerance = 0.0):
+ """
+ Detect self-intersections of the given shape with algorithm based on mesh intersections.
+
+ Parameters:
+ theShape Shape to check.
+ theDeflection Linear deflection coefficient that specifies quality of tesselation:
+ - if theDeflection <= 0, default deflection 0.001 is used
+ theTolerance Specifies a distance between shapes used for detecting gaps:
+ - if theTolerance <= 0, algorithm detects intersections (default behavior)
+ - if theTolerance > 0, algorithm detects gaps
+
+ Returns:
+ TRUE, if the shape contains no self-intersections.
+ """
+ # Example: see GEOM_TestMeasures.py
+ (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersectionsFast(theShape, theDeflection, theTolerance)
+ RaiseIfFailed("CheckSelfIntersectionsFast", self.MeasuOp)
+ return IsValid
+
+ ## Detect intersections of the given shapes with algorithm based on mesh intersections.
+ # @param theShape1 First source object
+ # @param theShape2 Second source object
+ # @param theTolerance Specifies a distance between shapes used for detecting gaps:
+ # - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
+ # - if \a theTolerance > 0, algorithm detects gaps
+ # @param theDeflection Linear deflection coefficient that specifies quality of tesselation:
+ # - if \a theDeflection <= 0, default deflection 0.001 is used
+ # @return TRUE, if there are intersections (gaps) between source shapes
+ # @return List of sub-shapes IDs from 1st shape that localize intersection.
+ # @return List of sub-shapes IDs from 2nd shape that localize intersection.
+ #
+ # @ref tui_fast_intersection_page "Example"
+ @ManageTransactions("MeasuOp")
+ def FastIntersect(self, theShape1, theShape2, theTolerance = 0.0, theDeflection = 0.001):
+ """
+ Detect intersections of the given shapes with algorithm based on mesh intersections.
+
+ Parameters:
+ theShape1 First source object
+ theShape2 Second source object
+ theTolerance Specifies a distance between shapes used for detecting gaps:
+ - if theTolerance <= 0, algorithm detects intersections (default behavior)
+ - if theTolerance > 0, algorithm detects gaps
+ theDeflection Linear deflection coefficient that specifies quality of tesselation:
+ - if theDeflection <= 0, default deflection 0.001 is used
+
+ Returns:
+ TRUE, if there are intersections (gaps) between source shapes
+ List of sub-shapes IDs from 1st shape that localize intersection.
+ List of sub-shapes IDs from 2nd shape that localize intersection.
+ """
+ # Example: see GEOM_TestMeasures.py
+ IsOk, Res1, Res2 = self.MeasuOp.FastIntersect(theShape1, theShape2, theTolerance, theDeflection)
+ RaiseIfFailed("FastIntersect", self.MeasuOp)
+ return IsOk, Res1, Res2
+
## Get position (LCS) of theShape.
#
# Origin of the LCS is situated at the shape's center of mass.
## Check, if the compound of blocks is given.
# To be considered as a compound of blocks, the
# given shape must satisfy the following conditions:
- # - Each element of the compound should be a Block (6 faces and 12 edges).
+ # - Each element of the compound should be a Block (6 faces).
+ # - Each face should be a quadrangle, i.e. it should have only 1 wire
+ # with 4 edges. If <VAR>theIsUseC1</VAR> is set to True and
+ # there are more than 4 edges in the only wire of a face,
+ # this face is considered to be quadrangle if it has 4 bounds
+ # (1 or more edge) of C1 continuity.
# - A connection between two Blocks should be an entire quadrangle face or an entire edge.
# - The compound should be connexe.
# - The glue between two quadrangle faces should be applied.
# @param theCompound The compound to check.
+ # @param theIsUseC1 Flag to check if there are 4 bounds on a face
+ # taking into account C1 continuity.
+ # @param theAngTolerance the angular tolerance to check if two neighbor
+ # edges are codirectional in the common vertex with this
+ # tolerance. This parameter is used only if
+ # <VAR>theIsUseC1</VAR> is set to True.
# @return TRUE, if the given shape is a compound of blocks.
# If theCompound is not valid, prints all discovered errors.
#
- # @ref tui_measurement_tools_page "Example 1"
+ # @ref tui_check_compound_of_blocks_page "Example 1"
# \n @ref swig_CheckCompoundOfBlocks "Example 2"
@ManageTransactions("BlocksOp")
- def CheckCompoundOfBlocks(self,theCompound):
+ def CheckCompoundOfBlocks(self,theCompound, theIsUseC1 = False,
+ theAngTolerance = 1.e-12):
"""
Check, if the compound of blocks is given.
To be considered as a compound of blocks, the
given shape must satisfy the following conditions:
- - Each element of the compound should be a Block (6 faces and 12 edges).
+ - Each element of the compound should be a Block (6 faces).
+ - Each face should be a quadrangle, i.e. it should have only 1 wire
+ with 4 edges. If theIsUseC1 is set to True and
+ there are more than 4 edges in the only wire of a face,
+ this face is considered to be quadrangle if it has 4 bounds
+ (1 or more edge) of C1 continuity.
- A connection between two Blocks should be an entire quadrangle face or an entire edge.
- The compound should be connexe.
- The glue between two quadrangle faces should be applied.
Parameters:
theCompound The compound to check.
+ theIsUseC1 Flag to check if there are 4 bounds on a face
+ taking into account C1 continuity.
+ theAngTolerance the angular tolerance to check if two neighbor
+ edges are codirectional in the common vertex with this
+ tolerance. This parameter is used only if
+ theIsUseC1 is set to True.
Returns:
TRUE, if the given shape is a compound of blocks.
If theCompound is not valid, prints all discovered errors.
"""
# Example: see GEOM_Spanner.py
- (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound)
+ aTolerance = -1.0
+ if theIsUseC1:
+ aTolerance = theAngTolerance
+ (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound, aTolerance)
RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
if IsValid == 0:
Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
## Retrieve all non blocks solids and faces from \a theShape.
# @param theShape The shape to explore.
+ # @param theIsUseC1 Flag to check if there are 4 bounds on a face
+ # taking into account C1 continuity.
+ # @param theAngTolerance the angular tolerance to check if two neighbor
+ # edges are codirectional in the common vertex with this
+ # tolerance. This parameter is used only if
+ # <VAR>theIsUseC1</VAR> is set to True.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
# @return A tuple of two GEOM_Objects. The first object is a group of all
# non block solids (= not 6 faces, or with 6 faces, but with the
# presence of non-quadrangular faces). The second object is a
- # group of all non quadrangular faces.
+ # group of all non quadrangular faces (= faces with more then
+ # 1 wire or, if <VAR>theIsUseC1</VAR> is set to True, faces
+ # with 1 wire with not 4 edges that do not form 4 bounds of
+ # C1 continuity).
#
- # @ref tui_measurement_tools_page "Example 1"
+ # @ref tui_get_non_blocks_page "Example 1"
# \n @ref swig_GetNonBlocks "Example 2"
@ManageTransactions("BlocksOp")
- def GetNonBlocks (self, theShape, theName=None):
+ def GetNonBlocks (self, theShape, theIsUseC1 = False,
+ theAngTolerance = 1.e-12, theName=None):
"""
Retrieve all non blocks solids and faces from theShape.
Parameters:
theShape The shape to explore.
+ theIsUseC1 Flag to check if there are 4 bounds on a face
+ taking into account C1 continuity.
+ theAngTolerance the angular tolerance to check if two neighbor
+ edges are codirectional in the common vertex with this
+ tolerance. This parameter is used only if
+ theIsUseC1 is set to True.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
A tuple of two GEOM_Objects. The first object is a group of all
non block solids (= not 6 faces, or with 6 faces, but with the
presence of non-quadrangular faces). The second object is a
- group of all non quadrangular faces.
+ group of all non quadrangular faces (= faces with more then
+ 1 wire or, if <VAR>theIsUseC1</VAR> is set to True, faces
+ with 1 wire with not 4 edges that do not form 4 bounds of
+ C1 continuity).
Usage:
(res_sols, res_faces) = geompy.GetNonBlocks(myShape1)
"""
# Example: see GEOM_Spanner.py
- aTuple = self.BlocksOp.GetNonBlocks(theShape)
+ aTolerance = -1.0
+ if theIsUseC1:
+ aTolerance = theAngTolerance
+ aTuple = self.BlocksOp.GetNonBlocks(theShape, aTolerance)
RaiseIfFailed("GetNonBlocks", self.BlocksOp)
self._autoPublish(aTuple, theName, ("groupNonHexas", "groupNonQuads"))
return aTuple
RaiseIfFailed("AddTexture", self.InsertOp)
return ID
+ ## Transfer not topological data from one GEOM object to another.
+ #
+ # @param theObjectFrom the source object of non-topological data
+ # @param theObjectTo the destination object of non-topological data
+ # @param theFindMethod method to search sub-shapes of theObjectFrom
+ # in shape theObjectTo. Possible values are: GEOM.FSM_GetInPlace,
+ # GEOM.FSM_GetInPlaceByHistory and GEOM.FSM_GetInPlace_Old.
+ # Other values of GEOM.find_shape_method are not supported.
+ #
+ # @return True in case of success; False otherwise.
+ #
+ # @ingroup l1_geomBuilder_auxiliary
+ #
+ # @ref swig_TransferData "Example"
+ @ManageTransactions("InsertOp")
+ def TransferData(self, theObjectFrom, theObjectTo,
+ theFindMethod=GEOM.FSM_GetInPlace):
+ """
+ Transfer not topological data from one GEOM object to another.
+
+ Parameters:
+ theObjectFrom the source object of non-topological data
+ theObjectTo the destination object of non-topological data
+ theFindMethod method to search sub-shapes of theObjectFrom
+ in shape theObjectTo. Possible values are:
+ GEOM.FSM_GetInPlace, GEOM.FSM_GetInPlaceByHistory
+ and GEOM.FSM_GetInPlace_Old. Other values of
+ GEOM.find_shape_method are not supported.
+
+ Returns:
+ True in case of success; False otherwise.
+
+ # Example: see GEOM_TestOthers.py
+ """
+ # Example: see GEOM_TestAll.py
+ isOk = self.InsertOp.TransferData(theObjectFrom,
+ theObjectTo, theFindMethod)
+ RaiseIfFailed("TransferData", self.InsertOp)
+ return isOk
+
## Creates a new folder object. It is a container for any GEOM objects.
# @param Name name of the container
# @param Father parent object. If None,
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
if self.closed:
self.myCommand = self.myCommand + ":WW"
+ from salome.geom.geomBuilder import ParseSketcherCommand, RaiseIfFailed
+ Command,Parameters = ParseSketcherCommand(self.myCommand)
+
import GEOM
- if isinstance(WorkingPlane, list): wire = self.geompyD.CurvesOp.MakeSketcher(self.myCommand, WorkingPlane)
- if isinstance(WorkingPlane, GEOM._objref_GEOM_Object): wire = self.geompyD.CurvesOp.MakeSketcherOnPlane(self.myCommand, WorkingPlane)
+ if isinstance(WorkingPlane, list): wire = self.geompyD.CurvesOp.MakeSketcher(Command, WorkingPlane)
+ if isinstance(WorkingPlane, GEOM._objref_GEOM_Object): wire = self.geompyD.CurvesOp.MakeSketcherOnPlane(Command, WorkingPlane)
self.myCommand = "Sketcher"
+ RaiseIfFailed("Sketcher", self.geompyD.CurvesOp)
+ wire.SetParameters(Parameters)
self.geompyD._autoPublish(wire, theName, "wire")
return wire
else:
raise RuntimeError, "Sketcher2D.close() : can't build face on unclosed wire"
+ from salome.geom.geomBuilder import ParseSketcherCommand, RaiseIfFailed
+ Command,Parameters = ParseSketcherCommand(self.myCommand)
+
import GEOM
- if isinstance(WorkingPlane, list): face = self.geompyD.CurvesOp.MakeSketcher(self.myCommand, WorkingPlane)
- if isinstance(WorkingPlane, GEOM._objref_GEOM_Object): face = self.geompyD.CurvesOp.MakeSketcherOnPlane(self.myCommand, WorkingPlane)
+ if isinstance(WorkingPlane, list): face = self.geompyD.CurvesOp.MakeSketcher(Command, WorkingPlane)
+ if isinstance(WorkingPlane, GEOM._objref_GEOM_Object): face = self.geompyD.CurvesOp.MakeSketcherOnPlane(Command, WorkingPlane)
self.myCommand = "Sketcher"
+ RaiseIfFailed("Sketcher", self.geompyD.CurvesOp)
+ face.SetParameters(Parameters)
self.geompyD._autoPublish(face, theName, "face")
return face
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
theOn, theUpdateViewer ) );
}
+/*!
+ \brief Show / hide name of shape for the presentation
+ \param theEntry geometry object's entry
+ \param theOn \c true to show name or \c false otherwise
+ \param theUpdateViewer \c true to update active view's contents
+*/
+void GEOM_Swig::setNameMode( const char* theEntry, bool theOn, bool theUpdateViewer )
+{
+ ProcessVoidEvent( new TSetPropertyEvent( theEntry, GEOM::propertyName( GEOM::ShowName ),
+ theOn, theUpdateViewer ) );
+}
+
/*!
\brief Change color of the presentation
\param theEntry geometry object's entry
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
void setDisplayMode( const char* theEntry, int theMode, bool theUpdateViewer = true );
void setVectorsMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
void setVerticesMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
+ void setNameMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
void setColor( const char* theEntry, int theRed, int theGreen, int theBlue, bool theUpdateViewer = true );
void setTransparency( const char* theEntry, float theTransparency, bool theUpdateViewer = true );
void setIsos( const char* theEntry, int theNbU, int theNbV, bool theUpdateViewer = true );
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
void setDisplayMode( const char* theEntry, int theMode, bool theUpdateViewer = true );
void setVectorsMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
void setVerticesMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
+ void setNameMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
void setColor( const char* theEntry, int theRed, int theGreen, int theBlue, bool theUpdateViewer = true );
void setTransparency( const char* theEntry, float theTransparency, bool theUpdateViewer = true );
void setIsos( const char* theEntry, int theNbU, int theNbV, bool theUpdateViewer = true );
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
${PROJECT_SOURCE_DIR}/src/GEOMImpl
${PROJECT_SOURCE_DIR}/src/GEOMGUI
${PROJECT_SOURCE_DIR}/src/GEOMBase
+ ${PROJECT_SOURCE_DIR}/src/GEOMUtils
${PROJECT_SOURCE_DIR}/src/DlgRef
${PROJECT_BINARY_DIR}/src/DlgRef
${CMAKE_CURRENT_SOURCE_DIR}
${QT_DEFINITIONS}
)
+IF(WIN32)
+ ADD_DEFINITIONS(-DNOGDI)
+ENDIF(WIN32)
+
# libraries to link to
SET(_link_LIBRARIES
GEOMObject
GEOMClient
GEOMImpl
GEOMBase
+ GEOMUtils
GEOM
DlgRef
)
GenerationGUI_FillingDlg.h
GenerationGUI_PipeDlg.h
GenerationGUI_PipePathDlg.h
+ GenerationGUI_ThicknessDlg.h
)
# header files / to be processed by moc
GenerationGUI_FillingDlg.h
GenerationGUI_PipeDlg.h
GenerationGUI_PipePathDlg.h
+ GenerationGUI_ThicknessDlg.h
)
# --- sources ---
GenerationGUI_FillingDlg.cxx
GenerationGUI_PipeDlg.cxx
GenerationGUI_PipePathDlg.cxx
+ GenerationGUI_ThicknessDlg.cxx
${_moc_SOURCES}
)
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GenerationGUI_FillingDlg.h" // Method FILLING
#include "GenerationGUI_PipeDlg.h" // Method PIPE
#include "GenerationGUI_PipePathDlg.h" // Method RESTORE PATH
+#include "GenerationGUI_ThicknessDlg.h" // Method THICKNESS
//=======================================================================
// function : GenerationGUI()
QDialog* aDlg = NULL;
switch ( theCommandID ) {
- case GEOMOp::OpPrism: aDlg = new GenerationGUI_PrismDlg ( getGeometryGUI(), parent ); break;
- case GEOMOp::OpRevolution: aDlg = new GenerationGUI_RevolDlg ( getGeometryGUI(), parent ); break;
- case GEOMOp::OpFilling: aDlg = new GenerationGUI_FillingDlg ( getGeometryGUI(), parent ); break;
- case GEOMOp::OpPipe: aDlg = new GenerationGUI_PipeDlg ( getGeometryGUI(), parent ); break;
- case GEOMOp::OpPipePath: aDlg = new GenerationGUI_PipePathDlg( getGeometryGUI(), parent ); break;
+ case GEOMOp::OpPrism: aDlg = new GenerationGUI_PrismDlg ( getGeometryGUI(), parent ); break;
+ case GEOMOp::OpRevolution: aDlg = new GenerationGUI_RevolDlg ( getGeometryGUI(), parent ); break;
+ case GEOMOp::OpFilling: aDlg = new GenerationGUI_FillingDlg ( getGeometryGUI(), parent ); break;
+ case GEOMOp::OpPipe: aDlg = new GenerationGUI_PipeDlg ( getGeometryGUI(), parent ); break;
+ case GEOMOp::OpPipePath: aDlg = new GenerationGUI_PipePathDlg ( getGeometryGUI(), parent ); break;
+ case GEOMOp::OpThickness: aDlg = new GenerationGUI_ThicknessDlg( getGeometryGUI(), parent ); break;
default: app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
-#include <TopoDS_Iterator.hxx>
+#include <TColStd_MapOfInteger.hxx>
+
#include <GEOMImpl_Types.hxx>
//=================================================================================
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setReadOnly(true);
- globalSelection(GEOM_COMPOUND);
+ initSelection();
int SpecificStep1 = 1;
double SpecificStep2 = 0.0001;
return false;
initName();
+ initSelection();
+
return true;
}
+//=================================================================================
+// function : initSelection
+// purpose :
+//=================================================================================
+void GenerationGUI_FillingDlg::initSelection()
+{
+ TColStd_MapOfInteger aTypes;
+ aTypes.Add( GEOM_EDGE );
+ aTypes.Add( GEOM_WIRE );
+ aTypes.Add( GEOM_COMPOUND );
+
+ std::list<int> needTypes;
+ needTypes.push_back( TopAbs_EDGE );
+ needTypes.push_back( TopAbs_WIRE );
+ needTypes.push_back( TopAbs_COMPOUND );
+
+ globalSelection( aTypes );
+ localSelection( needTypes );
+}
+
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
myEditCurrentArgument->setText("");
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
- myCompound = getSelected(TopAbs_COMPOUND);
- if (myCompound) {
- if (myCompound->GetMaxShapeType() < GEOM::WIRE || myCompound->GetMinShapeType() > GEOM::EDGE) {
- myCompound.nullify();
- }
- else {
- QString aName = GEOMBase::GetName(myCompound.get());
- myEditCurrentArgument->setText(aName);
- }
+ QList<GEOM::GeomObjPtr> objs = getSelected(TopAbs_SHAPE, -1);
+ GEOMBase::Synchronize(myObjects, objs);
+ if ( !myObjects.isEmpty() ) {
+ QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
+ myEditCurrentArgument->setText( aName );
}
}
-
processPreview();
}
void GenerationGUI_FillingDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
- globalSelection(GEOM_ALLSHAPES);
if (send == GroupPoints->PushButton1) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection(GEOM_COMPOUND);
+ initSelection();
this->SelectionIntoArgument();
}
}
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
- globalSelection(GEOM_COMPOUND);
+ initSelection();
processPreview();
}
//=================================================================================
bool GenerationGUI_FillingDlg::isValid(QString& msg)
{
- bool ok = GroupPoints->SpinBox1->isValid(msg, !IsPreview()) &&
- GroupPoints->SpinBox2->isValid(msg, !IsPreview()) &&
- GroupPoints->SpinBox3->isValid(msg, !IsPreview()) &&
- GroupPoints->SpinBox4->isValid(msg, !IsPreview()) &&
- GroupPoints->SpinBox5->isValid(msg, !IsPreview()) &&
- myCompound;
+ bool ok = ( GroupPoints->SpinBox1->isValid(msg, !IsPreview()) &&
+ GroupPoints->SpinBox2->isValid(msg, !IsPreview()) &&
+ GroupPoints->SpinBox3->isValid(msg, !IsPreview()) &&
+ GroupPoints->SpinBox4->isValid(msg, !IsPreview()) &&
+ GroupPoints->SpinBox5->isValid(msg, !IsPreview()) &&
+ myObjects.count() );
return ok;
}
GEOM::filling_oper_method aMethod;
switch (GroupPoints->ComboBox1->currentIndex())
{
- case 0: aMethod = GEOM::FOM_Default; break;
- case 1: aMethod = GEOM::FOM_UseOri; break;
- case 2: aMethod = GEOM::FOM_AutoCorrect; break;
- default: break;
+ case 0: aMethod = GEOM::FOM_Default; break;
+ case 1: aMethod = GEOM::FOM_UseOri; break;
+ case 2: aMethod = GEOM::FOM_AutoCorrect; break;
+ default: break;
}
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length( myObjects.count() );
+ for ( int i = 0; i < myObjects.count(); ++i )
+ objList[i] = myObjects[i].copy();
+
GEOM::GEOM_Object_var anObj =
- anOper->MakeFilling(myCompound.get(),
- GroupPoints->SpinBox1->value(),
- GroupPoints->SpinBox4->value(),
- GroupPoints->SpinBox2->value(),
- GroupPoints->SpinBox5->value(),
- GroupPoints->SpinBox3->value(),
- aMethod,
- GroupPoints->CheckBox1->isChecked());
+ anOper->MakeFilling(objList,
+ GroupPoints->SpinBox1->value(),
+ GroupPoints->SpinBox4->value(),
+ GroupPoints->SpinBox2->value(),
+ GroupPoints->SpinBox5->value(),
+ GroupPoints->SpinBox3->value(),
+ aMethod,
+ GroupPoints->CheckBox1->isChecked());
if (!anObj->_is_nil())
{
if (!IsPreview())
return true;
}
+
+//=================================================================================
+// function : addSubshapesToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void GenerationGUI_FillingDlg::addSubshapesToStudy()
+{
+ foreach( GEOM::GeomObjPtr o, myObjects )
+ GEOMBase::PublishSubObject( o.get() );
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> GenerationGUI_FillingDlg::getSourceObjects()
+{
+ return myObjects;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
void enterEvent( QEvent* );
+ void initSelection();
private:
- GEOM::GeomObjPtr myCompound; /* compound of curves */
+ QList<GEOM::GeomObjPtr> myObjects;/* lit or compound of curves */
DlgRef_1Sel5Spin1Check* GroupPoints;
private slots:
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
+#include <GEOMUtils.hxx>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <LightApp_SelectionMgr.h>
#include <TopoDS_Shape.hxx>
-#include <TopoDS.hxx>
-#include <TopExp.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <GEOMImpl_Types.hxx>
//=================================================================================
GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
bool modal, Qt::WindowFlags fl)
- : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl)
+ : GEOMBase_Skeleton (theGeometryGUI, parent, modal, fl),
+ myGenGroupCheckGP (0),
+ myPrefixLblGP (0),
+ myPrefixEditGP (0),
+ myStepByStepCheckGMP (0),
+ myGenGroupCheckGMP (0),
+ myPrefixLblGMP (0),
+ myPrefixEditGMP (0)
{
QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE")));
QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
GroupPoints->PushButton3->setIcon(image1);
GroupPoints->CheckButton1->setText(tr("GEOM_SELECT_UNPUBLISHED_EDGES"));
+ // Add widgets for group generation
+ QGridLayout *aLayoutGP = (QGridLayout *)GroupPoints->GroupBox1->layout();
+
+ myGenGroupCheckGP =
+ new QCheckBox(tr("GEOM_GENERATE_GROUPS"), GroupPoints->GroupBox1);
+ myPrefixLblGP =
+ new QLabel (tr("GEOM_GROUP_NAME_PREFIX"), GroupPoints->GroupBox1);
+ myPrefixEditGP = new QLineEdit(GroupPoints->GroupBox1);
+
+ aLayoutGP->addWidget(myGenGroupCheckGP, 4, 0, 1, 3);
+ aLayoutGP->addWidget(myPrefixLblGP, 5, 0, 1, 2);
+ aLayoutGP->addWidget(myPrefixEditGP, 5, 2);
+
GroupMakePoints = new DlgRef_3Sel2Check3Spin(centralWidget());
GroupMakePoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupMakePoints->PushButton3->setIcon(image1);
GroupMakePoints->CheckBox1->setText(tr("GEOM_WITH_CONTACT"));
GroupMakePoints->CheckBox2->setText(tr("GEOM_WITH_CORRECTION"));
+ GroupMakePoints->SpinBox1->setAttribute(Qt::WA_DeleteOnClose);
+ GroupMakePoints->SpinBox2->setAttribute(Qt::WA_DeleteOnClose);
+ GroupMakePoints->SpinBox3->setAttribute(Qt::WA_DeleteOnClose);
+ GroupMakePoints->TextLabel4->setAttribute(Qt::WA_DeleteOnClose);
+ GroupMakePoints->TextLabel5->setAttribute(Qt::WA_DeleteOnClose);
+ GroupMakePoints->TextLabel6->setAttribute(Qt::WA_DeleteOnClose);
GroupMakePoints->SpinBox1->close();
GroupMakePoints->SpinBox2->close();
GroupMakePoints->SpinBox3->close();
GroupMakePoints->TextLabel5->close();
GroupMakePoints->TextLabel6->close();
+ // Add widgets for group generation
+ QGridLayout *aLayoutGMP = (QGridLayout *)GroupMakePoints->GroupBox1->layout();
+
+ myStepByStepCheckGMP =
+ new QCheckBox(tr("GEOM_STEP_BY_STEP"), GroupMakePoints->GroupBox1);
+ myGenGroupCheckGMP =
+ new QCheckBox(tr("GEOM_GENERATE_GROUPS"), GroupMakePoints->GroupBox1);
+ myPrefixLblGMP =
+ new QLabel (tr("GEOM_GROUP_NAME_PREFIX"), GroupMakePoints->GroupBox1);
+ myPrefixEditGMP = new QLineEdit(GroupMakePoints->GroupBox1);
+
+ aLayoutGMP->addWidget(myStepByStepCheckGMP, 8, 0, 1, 3);
+ aLayoutGMP->addWidget(myGenGroupCheckGMP, 9, 0, 1, 3);
+ aLayoutGMP->addWidget(myPrefixLblGMP, 10, 0, 1, 2);
+ aLayoutGMP->addWidget(myPrefixEditGMP, 10, 2);
+
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupPoints);
connect(GroupMakePoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupMakePoints->CheckBox1, SIGNAL(clicked()), this, SLOT(processPreview()));
connect(GroupMakePoints->CheckBox2, SIGNAL(clicked()), this, SLOT(processPreview()));
+ connect(myStepByStepCheckGMP, SIGNAL(clicked()), this, SLOT(processPreview()));
+ connect(myGenGroupCheckGP, SIGNAL(toggled(bool)), this, SLOT(GenGroupClicked(bool)));
+ connect(myGenGroupCheckGMP, SIGNAL(toggled(bool)), this, SLOT(GenGroupClicked(bool)));
+ connect(myStepByStepCheckGMP, SIGNAL(toggled(bool)), this, SLOT(StepByStepClicked(bool)));
initName(tr("GEOM_PIPE"));
resize(100,100);
GroupPoints->PushButton1->click();
SelectionIntoArgument();
+ updateGenGroup();
}
//=================================================================================
GroupPoints->PushButton3->hide();
GroupPoints->LineEdit3->hide();
GroupPoints->PushButton1->click();
+ myGenGroupCheckGP->setChecked(false);
+ resetGenGroup(myGenGroupCheckGP, false, true);
break;
case 1:
GroupMakePoints->hide();
GroupPoints->PushButton3->show();
GroupPoints->LineEdit3->show();
GroupPoints->PushButton1->click();
+ myGenGroupCheckGP->setChecked(false);
+ resetGenGroup(myGenGroupCheckGP, false, true);
break;
case 2:
GroupPoints->hide();
GroupMakePoints->show();
GroupMakePoints->PushButton1->click();
+ myStepByStepCheckGMP->setChecked(false);
+ myGenGroupCheckGMP->setChecked(false);
+ resetGenGroup(myGenGroupCheckGMP, false, true);
break;
default:
break;
{
globalSelection();
if ( GroupPoints->CheckButton1->isChecked() ) {
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
} else {
TColStd_MapOfInteger aMap;
aMap.Add(GEOM_COMPOUND);
if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
myEditCurrentArgument->setText("");
myPath.nullify();
+ updateGenGroup();
}
processPreview();
}
else if ( myBaseObjects.isEmpty() )
GroupPoints->PushButton1->click();
}
+ updateGenGroup();
}
else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
myVec = getSelected( TopAbs_EDGE );
}
}
else if ( myEditCurrentArgument == GroupMakePoints->LineEdit2 ) {
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_VERTEX, -1 );
GEOMBase::Synchronize( myLocations, objects );
if ( !myLocations.isEmpty() ) {
QString aName = GEOMBase::GetName( myPath.get() );
myEditCurrentArgument->setText( aName );
}
+ updateGenGroup();
}
processPreview();
myEditCurrentArgument = GroupPoints->LineEdit2;
if ( GroupPoints->CheckButton1->isChecked() ) {
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
} else {
TColStd_MapOfInteger aMap;
aMap.Add(GEOM_COMPOUND);
else if(send == GroupPoints->PushButton3) {
myEditCurrentArgument = GroupPoints->LineEdit3;
GroupPoints->CheckButton1->setEnabled(false);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
GroupMakePoints->PushButton1->setDown(false);
//=================================================================================
bool GenerationGUI_PipeDlg::execute (ObjectList& objects)
{
- GEOM::GEOM_Object_var anObj;
+ GEOM::ListOfGO_var aList;
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
+ bool doGroups = !IsPreview();
+
+ myGroupObjectsMap.clear();
+
switch( getConstructorId() ) {
case 0:
case 1:
+ if (doGroups) {
+ doGroups = myGenGroupCheckGP->isEnabled() &&
+ myGenGroupCheckGP->isChecked();
+ }
+
for (int i = 0; i < myBaseObjects.count(); i++) {
switch ( getConstructorId() ) {
case 0 :
- anObj = anOper->MakePipe(myBaseObjects[i].get(), myPath.get());
- break;
+ aList = anOper->MakePipe(myBaseObjects[i].get(),
+ myPath.get(), doGroups);
+ break;
case 1 :
- anObj = anOper->MakePipeBiNormalAlongVector(myBaseObjects[i].get(), myPath.get(), myVec.get());
- break;
+ aList = anOper->MakePipeBiNormalAlongVector
+ (myBaseObjects[i].get(), myPath.get(), myVec.get(), doGroups);
+ break;
+ }
+
+ if (aList->length() > 0) {
+ if (doGroups) {
+ addGroups(aList);
+ }
+
+ if (!aList[0]->_is_nil()) {
+ objects.push_back(aList[0]._retn());
+ }
}
-
- if (!anObj->_is_nil())
- objects.push_back(anObj._retn());
}
break;
case 2:
myBaseGO->length( myBaseObjects.count() );
myLocationsGO->length( myLocations.count() );
for (int i = 0; i < myBaseObjects.count(); i++) {
- myBaseGO[i] = myBaseObjects[i].copy();
+ myBaseGO[i] = myBaseObjects[i].copy();
}
for (int i = 0; i < myLocations.count(); i++) {
- myLocationsGO[i] = myLocations[i].copy();
+ myLocationsGO[i] = myLocations[i].copy();
+ }
+
+ if (doGroups) {
+ doGroups = myGenGroupCheckGMP->isEnabled() &&
+ myGenGroupCheckGMP->isChecked();
+ }
+
+ bool isWithContact = GroupMakePoints->CheckBox1->isEnabled() &&
+ GroupMakePoints->CheckBox1->isChecked();
+ bool isWithCorrection = GroupMakePoints->CheckBox2->isEnabled() &&
+ GroupMakePoints->CheckBox2->isChecked();
+
+ aList = anOper->MakePipeWithDifferentSections
+ (myBaseGO.in(), myLocationsGO.in(), myPath.get(),
+ isWithContact, isWithCorrection,
+ myStepByStepCheckGMP->isChecked(),
+ doGroups);
+
+ if (aList->length() > 0) {
+ if (doGroups) {
+ addGroups(aList);
+ }
+
+ if (!aList[0]->_is_nil()) {
+ objects.push_back(aList[0]._retn());
+ }
}
-
- anObj = anOper->MakePipeWithDifferentSections(myBaseGO.in(), myLocationsGO.in(), myPath.get(),
- GroupMakePoints->CheckBox1->isChecked(),
- GroupMakePoints->CheckBox2->isChecked());
- if (!anObj->_is_nil())
- objects.push_back(anObj._retn());
}
break;
default:
{
return myBaseObjects.count() > 1;
}
+
+//=================================================================================
+// function : restoreSubShapes
+// purpose : virtual method to restore tree of argument's sub-shapes under
+// the resulting shape. Redefined from GEOMBase_Helper class.
+//=================================================================================
+void GenerationGUI_PipeDlg::restoreSubShapes
+ (SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject)
+{
+ QCheckBox *aGenGroupCheck = NULL;
+ QLineEdit *aPrefixEdit = NULL;
+
+ switch (getConstructorId()) {
+ case 0 :
+ case 1 :
+ aGenGroupCheck = myGenGroupCheckGP;
+ aPrefixEdit = myPrefixEditGP;
+ break;
+ case 2 :
+ aGenGroupCheck = myGenGroupCheckGMP;
+ aPrefixEdit = myPrefixEditGMP;
+ break;
+ default:
+ break;
+ }
+
+ if (aGenGroupCheck == NULL || !aGenGroupCheck->isChecked()) {
+ return;
+ }
+
+ // get Object from SObject
+ GEOM::GEOM_Object_var aFather = GEOM::GEOM_Object::_narrow
+ (theSObject->GetObject());
+
+ if (CORBA::is_nil(aFather)) {
+ return;
+ }
+
+ ObjectMap::const_iterator anIter =
+ myGroupObjectsMap.find(aFather->GetEntry());
+ QString aPrefix = aPrefixEdit->text();
+ bool hasPrefix = !aPrefix.isEmpty();
+
+ if (anIter != myGroupObjectsMap.end()) {
+ QList<GEOM::GeomObjPtr>::const_iterator it = anIter->second.begin();
+
+ for (; it != anIter->second.end(); it++) {
+ // Compose the name
+ QString aName;
+
+ if (hasPrefix) {
+ aName = aPrefix + "_";
+ }
+
+ aName += tr((*it)->GetName());
+ getGeomEngine()->AddInStudy(theStudy, (*it).get(),
+ aName.toStdString().c_str(), aFather);
+ }
+ }
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> GenerationGUI_PipeDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myBaseObjects);
+ res << myPath << myVec;
+ for (int i = 0; i < myLocations.count(); i++)
+ res << myLocations[i];
+ return res;
+}
+
+//=================================================================================
+// function : GenGroupClicked
+// purpose : Slot to treat checking "Generate groups" check box.
+//=================================================================================
+void GenerationGUI_PipeDlg::GenGroupClicked(bool isChecked)
+{
+ resetGenGroup((QCheckBox *)sender(), isChecked, false);
+}
+
+//=================================================================================
+// function : StepByStepClicked
+// purpose : Slot to treat checking "Step-by-step generation" check box.
+//=================================================================================
+void GenerationGUI_PipeDlg::StepByStepClicked(bool isChecked)
+{
+ GroupMakePoints->CheckBox1->setEnabled(!isChecked);
+ GroupMakePoints->CheckBox2->setEnabled(!isChecked);
+}
+
+//=================================================================================
+// function : updateGenGroup
+// purpose : Update "Generate groups" widgets depending on the path.
+//=================================================================================
+void GenerationGUI_PipeDlg::updateGenGroup()
+{
+ bool isEnable = true;
+
+ if (myPath) {
+ // Check if the path is closed.
+ TopoDS_Shape aShapePath;
+
+ if (GEOMBase::GetShape(myPath.get(), aShapePath)) {
+ isEnable = GEOMUtils::IsOpenPath(aShapePath);
+ }
+ }
+
+ QCheckBox *aGenGroupCheck = NULL;
+
+ switch (getConstructorId()) {
+ case 0 :
+ case 1 :
+ aGenGroupCheck = myGenGroupCheckGP;
+ break;
+ case 2 :
+ aGenGroupCheck = myGenGroupCheckGMP;
+ break;
+ default:
+ break;
+ }
+
+ if (aGenGroupCheck != NULL) {
+ const bool isChecked = aGenGroupCheck->isChecked();
+
+ aGenGroupCheck->setEnabled(isEnable);
+ resetGenGroup(aGenGroupCheck, isEnable && isChecked, false);
+ }
+}
+
+//=================================================================================
+// function : resetGenGroup
+// purpose : Resets data of "Generate groups" widgets.
+//=================================================================================
+void GenerationGUI_PipeDlg::resetGenGroup(QCheckBox *theGenGroup,
+ const bool isChecked,
+ const bool isClearPrefix)
+{
+ QLabel *aPrefixLbl = NULL;
+ QLineEdit *aPrefixEdit = NULL;
+
+ if (theGenGroup == myGenGroupCheckGP) {
+ aPrefixLbl = myPrefixLblGP;
+ aPrefixEdit = myPrefixEditGP;
+ } else if (theGenGroup == myGenGroupCheckGMP) {
+ aPrefixLbl = myPrefixLblGMP;
+ aPrefixEdit = myPrefixEditGMP;
+ }
+
+ if (aPrefixLbl != NULL) {
+ aPrefixLbl->setEnabled(isChecked);
+ aPrefixEdit->setEnabled(isChecked);
+
+ if (isClearPrefix) {
+ aPrefixEdit->setText("");
+ }
+ }
+}
+
+//=================================================================================
+// function : addGroups
+// purpose : Add result groups to the list of groups.
+//=================================================================================
+void GenerationGUI_PipeDlg::addGroups(GEOM::ListOfGO_var &theResult)
+{
+ const int aNbObj = theResult->length();
+
+ if (aNbObj > 0) {
+ if (!theResult[0]->_is_nil()) {
+ QString anEntry = theResult[0]->GetEntry();
+ int i;
+
+ for (i = 1; i < aNbObj; ++i) {
+ if (!theResult[i]->_is_nil()) {
+ myGroupObjectsMap[anEntry].append(GEOM::GeomObjPtr(theResult[i]));
+ }
+ }
+ }
+ }
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GEOMBase_Skeleton.h"
#include "GEOM_GenericObjPtr.h"
+typedef std::map<QString, QList<GEOM::GeomObjPtr> > ObjectMap;
+
+
class DlgRef_3Sel1Check;
class DlgRef_3Sel2Check3Spin;
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
virtual bool extractPrefix() const;
+ virtual void restoreSubShapes
+ (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
void enterEvent( QEvent* );
+ void updateGenGroup();
+ void resetGenGroup
+ (QCheckBox *theGenGroup,
+ const bool isChecked,
+ const bool isClearPrefix);
+ void addGroups
+ (GEOM::ListOfGO_var &theResult);
private:
QList<GEOM::GeomObjPtr> myBaseObjects; /* Base shapes */
DlgRef_3Sel1Check* GroupPoints;
DlgRef_3Sel2Check3Spin* GroupMakePoints;
+ QCheckBox *myGenGroupCheckGP;
+ QLabel *myPrefixLblGP;
+ QLineEdit *myPrefixEditGP;
+ QCheckBox *myStepByStepCheckGMP;
+ QCheckBox *myGenGroupCheckGMP;
+ QLabel *myPrefixLblGMP;
+ QLineEdit *myPrefixEditGMP;
+ ObjectMap myGroupObjectsMap;
private slots:
void ClickOnOk();
void SetEditCurrentArgument();
void ConstructorsClicked( int );
void SelectionTypeButtonClicked();
+ void GenGroupClicked(bool);
+ void StepByStepClicked(bool);
};
#endif // GENERATIONGUI_PIPEDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
{
globalSelection();
if (GroupPoints->CheckButton1->isChecked()) {
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
else {
TColStd_MapOfInteger aMap;
myEditCurrentArgument = GroupPoints->LineEdit2;
if (GroupPoints->CheckButton1->isChecked()) {
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
else {
TColStd_MapOfInteger aMap;
myEditCurrentArgument = GroupPoints->LineEdit3;
if (GroupPoints->CheckButton1->isChecked()) {
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
else {
TColStd_MapOfInteger aMap;
for (i = 0; i < myBase2Objects.count(); i++)
GEOMBase::PublishSubObject(myBase2Objects[i].get());
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> GenerationGUI_PipePathDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myBase1Objects);
+ res << myShape ;
+ for (int i = 0; i < myBase2Objects.count(); i++)
+ res << myBase2Objects[i];
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
myEditCurrentArgument = GroupVecH->LineEdit2;
GroupVecH->PushButton1->setDown(false);
GroupVecH->LineEdit1->setEnabled(false);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
else if (send == Group2Points->PushButton1) {
myEditCurrentArgument = Group2Points->LineEdit1;
Group2Points->PushButton3->setDown(false);
Group2Points->LineEdit1->setEnabled(false);
Group2Points->LineEdit3->setEnabled(false);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
else if (send == Group2Points->PushButton3) {
myEditCurrentArgument = Group2Points->LineEdit3;
Group2Points->PushButton2->setDown(false);
Group2Points->LineEdit1->setEnabled(false);
Group2Points->LineEdit2->setEnabled(false);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
else if (send == GroupDXDYDZ->PushButton1) {
myEditCurrentArgument = GroupDXDYDZ->LineEdit1;
if(GroupThickening->checkButton1->isChecked())
{
double aThickness = GroupThickening->SpinBox_DX->value();
- if (GroupThickening->checkButton2->isChecked())
- {
- aThickness = -aThickness;
- }
-
- anObj = anotherOper->MakeThickening(anObj, aThickness, /*copy=*/false);
+ bool isInside = GroupThickening->checkButton2->isChecked();
+
+ GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
+
+ anObj = anotherOper->MakeThickening
+ (anObj, anArray, aThickness, /*copy=*/false, isInside);
+
+ if (!anObj->_is_nil() && !IsPreview())
+ anObj->SetParameters(GroupThickening->SpinBox_DX->text().toUtf8().constData());
}
if (!anObj->_is_nil())
{
return myBaseObjects.count() > 1;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> GenerationGUI_PrismDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myBaseObjects);
+ res << myVec << myPoint1 << myPoint2 ;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
virtual bool extractPrefix() const;
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
myEditCurrentArgument = GroupPoints->LineEdit2;
GroupPoints->PushButton1->setDown(false);
GroupPoints->LineEdit1->setEnabled(false);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
{
return myBaseObjects.count() > 1;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> GenerationGUI_RevolDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myBaseObjects);
+ res << myAxis;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
virtual bool extractPrefix() const;
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : GenerationGUI_ThicknessDlg.cxx
+// Author : Sergey KHROMOV, Open CASCADE S.A.S.
+
+#include "GenerationGUI_ThicknessDlg.h"
+
+#include <GEOMBase.h>
+#include <GeometryGUI.h>
+
+#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_DoubleSpinBox.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+
+#include <QApplication>
+#include <QCheckBox>
+#include <QGridLayout>
+#include <QGroupBox>
+#include <QLabel>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QRadioButton>
+
+#include <TopExp.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <Precision.hxx>
+
+#define GEOM_SOLID_THICK 0
+#define GEOM_SOLID_HOLLOWED 1
+
+//==============================================================================
+// class : GenerationGUI_ThicknessDlg()
+// purpose :
+//==============================================================================
+GenerationGUI_ThicknessDlg::GenerationGUI_ThicknessDlg
+ (GeometryGUI* theGeometryGUI, QWidget* parent,
+ bool modal, Qt::WindowFlags fl)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
+ myFacesLbl (0),
+ myObjSelBtn (0),
+ myFacesSelBtn (0),
+ myObjEdit (0),
+ myFacesEdit (0),
+ myThicknessSpin (0),
+ myInsideCheck (0)
+{
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ QPixmap image0(aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
+ QPixmap image1(aResMgr->loadPixmap("GEOM", tr("ICON_DLG_THICKNESS")));
+ QPixmap image2
+ (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_THICKNESS_HOLLOWED")));
+
+ setWindowTitle(tr("GEOM_THICKNESS_TITLE"));
+
+ /***************************************************************/
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_THICKNESS"));
+ mainFrame()->RadioButton1->setIcon(image1);
+ mainFrame()->RadioButton2->setIcon(image2);
+
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton3->close();
+
+ mainFrame()->RadioButton1->setChecked(true);
+
+ QGroupBox *aMainGrp = new QGroupBox (tr("GEOM_ARGUMENTS"), this);
+ QGridLayout *aParamsLayout = new QGridLayout(aMainGrp);
+ QLabel *anObjLbl = new QLabel (tr("GEOM_OBJECT"), aMainGrp);
+ QLabel *aThicknessLbl = new QLabel (tr("GEOM_THICKNESS"), aMainGrp);
+
+ myFacesLbl = new QLabel (tr("GEOM_FACES"), aMainGrp);
+ myObjSelBtn = new QPushButton(aMainGrp);
+ myFacesSelBtn = new QPushButton(aMainGrp);
+ myObjEdit = new QLineEdit(aMainGrp);
+ myFacesEdit = new QLineEdit(aMainGrp);
+ myThicknessSpin = new SalomeApp_DoubleSpinBox(aMainGrp);
+ myInsideCheck = new QCheckBox(tr("GEOM_TOWARDS_INSIDE"), aMainGrp);
+
+ myObjSelBtn->setIcon(image0);
+ myFacesSelBtn->setIcon(image0);
+ myObjEdit->setReadOnly(true);
+ myObjEdit->setSizePolicy
+ (QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+ myFacesEdit->setReadOnly(true);
+ myFacesEdit->setSizePolicy
+ (QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+
+ aParamsLayout->setMargin(9);
+ aParamsLayout->setSpacing(6);
+ aParamsLayout->addWidget(anObjLbl, 0, 0);
+ aParamsLayout->addWidget(myObjSelBtn, 0, 1);
+ aParamsLayout->addWidget(myObjEdit, 0, 2);
+ aParamsLayout->addWidget(myFacesLbl, 1, 0);
+ aParamsLayout->addWidget(myFacesSelBtn, 1, 1);
+ aParamsLayout->addWidget(myFacesEdit, 1, 2);
+ aParamsLayout->addWidget(aThicknessLbl, 2, 0);
+ aParamsLayout->addWidget(myThicknessSpin, 2, 1, 1, 2);
+ aParamsLayout->addWidget(myInsideCheck, 3, 0, 1, 3);
+
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+
+ layout->setMargin(0);
+ layout->setSpacing(6);
+ layout->addWidget(aMainGrp);
+
+ myHelpFileName = "create_thickness_page.html";
+
+ /* Initialisation */
+ Init();
+}
+
+//==============================================================================
+// function : ~GenerationGUI_ThicknessDlg()
+// purpose :
+//==============================================================================
+GenerationGUI_ThicknessDlg::~GenerationGUI_ThicknessDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+//==============================================================================
+// function : Init()
+// purpose :
+//==============================================================================
+void GenerationGUI_ThicknessDlg::Init()
+{
+ // Get setting of step value from file configuration
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ double aStep = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
+ double aThickness = 10.;
+ double aThicknessMin = Precision::Confusion() * 10.0;
+
+ initSpinBox(myThicknessSpin, aThicknessMin,
+ COORD_MAX, aStep, "length_precision");
+ myThicknessSpin->setValue(aThickness);
+ myObject.nullify();
+ myFaces.clear();
+
+ showOnlyPreviewControl();
+
+ // signals and slots connections
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(this, SIGNAL(constructorsClicked(int)),
+ this, SLOT(ConstructorsClicked(int)));
+ connect(myObjSelBtn, SIGNAL(clicked()),
+ this, SLOT(SetEditCurrentArgument()));
+ connect(myFacesSelBtn, SIGNAL(clicked()),
+ this, SLOT(SetEditCurrentArgument()));
+ connect(myThicknessSpin, SIGNAL(valueChanged(double)),
+ this, SLOT(ValueChangedInSpinBox()));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ this, SLOT(SetDoubleSpinBoxStep(double)));
+ connect(myInsideCheck, SIGNAL(toggled(bool)),
+ this, SLOT(onChangeDirection(bool)));
+
+ connect(myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ initName(tr("GEOM_THICKNESS"));
+
+ ConstructorsClicked(0);
+}
+
+//==============================================================================
+// function : SetDoubleSpinBoxStep()
+// purpose : Double spin box management
+//==============================================================================
+void GenerationGUI_ThicknessDlg::SetDoubleSpinBoxStep (double step)
+{
+ myThicknessSpin->setSingleStep(step);
+}
+
+//==============================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//==============================================================================
+void GenerationGUI_ThicknessDlg::ConstructorsClicked (int constructorId)
+{
+ switch (constructorId) {
+ case GEOM_SOLID_THICK:
+ myObjSelBtn->setDown(false);
+ myFacesLbl->hide();
+ myFacesSelBtn->hide();
+ myFacesEdit->hide();
+ myFaces.clear();
+ break;
+ case GEOM_SOLID_HOLLOWED:
+ myObjSelBtn->setDown(true);
+ myFacesLbl->show();
+ myFacesSelBtn->show();
+ myFacesEdit->show();
+ break;
+ default:
+ break;
+ }
+
+ myEditCurrentArgument = myObjEdit;
+ qApp->processEvents();
+ updateGeometry();
+ resize(minimumSizeHint());
+
+ SelectionIntoArgument();
+}
+
+//==============================================================================
+// function : ClickOnOk()
+// purpose :
+//==============================================================================
+void GenerationGUI_ThicknessDlg::ClickOnOk()
+{
+ setIsApplyAndClose(true);
+
+ if (ClickOnApply()) {
+ ClickOnCancel();
+ }
+}
+
+//==============================================================================
+// function : ClickOnApply()
+// purpose :
+//==============================================================================
+bool GenerationGUI_ThicknessDlg::ClickOnApply()
+{
+ if (!onAccept()) {
+ return false;
+ }
+
+ initName();
+
+ // activate selection and connect selection manager
+ ConstructorsClicked(getConstructorId());
+
+ return true;
+}
+
+//==============================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection is changed or on dialog initialization or
+// activation
+//==============================================================================
+void GenerationGUI_ThicknessDlg::SelectionIntoArgument()
+{
+ erasePreview();
+ myEditCurrentArgument->setText("");
+
+ if (myEditCurrentArgument == myObjEdit) {
+ QList<TopAbs_ShapeEnum> aTypes;
+ const int anID = getConstructorId();
+
+ if (anID == GEOM_SOLID_THICK) {
+ aTypes << TopAbs_SHELL << TopAbs_FACE;
+ } else if (anID == GEOM_SOLID_HOLLOWED) {
+ aTypes << TopAbs_SOLID;
+ }
+
+ myObject = getSelected(aTypes);
+
+ if (myObject) {
+ QString aName = GEOMBase::GetName(myObject.get());
+
+ myEditCurrentArgument->setText(aName);
+
+ if (anID == GEOM_SOLID_HOLLOWED && myFaces.empty()) {
+ myFacesSelBtn->click();
+ }
+ }
+ } else if (myEditCurrentArgument == myFacesEdit) {
+ myFaces.clear();
+ myFaces = getSelected(TopAbs_FACE, -1);
+
+ int i = myFaces.count();
+
+ if (i == 1) {
+ myEditCurrentArgument->setText(GEOMBase::GetName(myFaces.first().get()));
+ } else if (i > 0) {
+ myEditCurrentArgument->setText
+ (QString::number( i ) + "_" + tr("GEOM_OBJECTS"));
+ }
+ }
+
+ processPreview();
+}
+
+//==============================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//==============================================================================
+void GenerationGUI_ThicknessDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ if (send == myObjSelBtn) {
+ myFacesSelBtn->setDown(false);
+ myEditCurrentArgument = myObjEdit;
+ globalSelection(GEOM_ALLSHAPES);
+ } else if (send == myFacesSelBtn) {
+ myObjSelBtn->setDown(false);
+ myEditCurrentArgument = myFacesEdit;
+ globalSelection(); // close local contexts, if any
+ localSelection(myObject.get(), TopAbs_FACE);
+ }
+
+ myEditCurrentArgument->setFocus();
+
+ const int anID = getConstructorId();
+
+ // after setFocus(), because it will be setDown(false) when loses focus
+ send->setDown(anID == GEOM_SOLID_HOLLOWED);
+
+ // seems we need it only to avoid preview disappearing, caused by selection
+ // mode change
+ processPreview();
+}
+
+//==============================================================================
+// function : ActivateThisDialog()
+// purpose :
+//==============================================================================
+void GenerationGUI_ThicknessDlg::ActivateThisDialog()
+{
+ GEOMBase_Skeleton::ActivateThisDialog();
+
+ connect(myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ ConstructorsClicked(getConstructorId());
+}
+
+//==============================================================================
+// function : enterEvent()
+// purpose : when mouse enter onto the QWidget
+//==============================================================================
+void GenerationGUI_ThicknessDlg::enterEvent (QEvent*)
+{
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
+}
+
+//==============================================================================
+// function : ValueChangedInSpinBox()
+// purpose :
+//==============================================================================
+void GenerationGUI_ThicknessDlg::ValueChangedInSpinBox()
+{
+ processPreview();
+}
+
+//==============================================================================
+// function : createOperation
+// purpose :
+//==============================================================================
+GEOM::GEOM_IOperations_ptr GenerationGUI_ThicknessDlg::createOperation()
+{
+ return getGeomEngine()->GetI3DPrimOperations(getStudyId());
+}
+
+//==============================================================================
+// function : isValid
+// purpose :
+//==============================================================================
+bool GenerationGUI_ThicknessDlg::isValid (QString& msg)
+{
+ bool isOk = false;
+
+ switch (getConstructorId()) {
+ case GEOM_SOLID_THICK:
+ isOk = myThicknessSpin->isValid(msg, !IsPreview()) && myObject;
+ break;
+ case GEOM_SOLID_HOLLOWED:
+ isOk = myThicknessSpin->isValid(msg, !IsPreview()) &&
+ myObject && !myFaces.empty();
+ break;
+ default:
+ break;
+ }
+
+ return isOk;
+}
+
+//==============================================================================
+// function : onChangeDirection(bool)
+// purpose :
+//==============================================================================
+void GenerationGUI_ThicknessDlg::onChangeDirection(bool)
+{
+ processPreview();
+}
+
+//==============================================================================
+// function : execute
+// purpose :
+//==============================================================================
+bool GenerationGUI_ThicknessDlg::execute (ObjectList& objects)
+{
+ GEOM::GEOM_Object_var anObj;
+ GEOM::GEOM_I3DPrimOperations_var anOper =
+ GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
+ double aThickness = myThicknessSpin->value();
+ bool anInside = myInsideCheck->isChecked();
+ GEOM::ListOfLong_var anObjIDsList = new GEOM::ListOfLong();
+ TopoDS_Shape aShape;
+
+ if (GEOMBase::GetShape(myObject.get(), aShape)) {
+ TopTools_IndexedMapOfShape aMainMap;
+ QList<int> aListIDs;
+
+ TopExp::MapShapes(aShape, aMainMap);
+
+ for (int i = 0; i < myFaces.count(); i++) {
+ TopoDS_Shape aFace;
+
+ if (GEOMBase::GetShape(myFaces[i].get(), aFace)) {
+ int anIndex = aMainMap.FindIndex(aFace);
+
+ if (anIndex >= 0) {
+ aListIDs << anIndex;
+ }
+ }
+ }
+
+
+ if (!aListIDs.empty()) {
+ anObjIDsList->length(aListIDs.length());
+
+ for (int i = 0; i < aListIDs.length(); i++) {
+ anObjIDsList[i] = aListIDs[i];
+ }
+ }
+ }
+
+ anObj = anOper->MakeThickening
+ (myObject.get(), anObjIDsList.in(), aThickness, true, anInside);
+
+ if (!anObj->_is_nil()) {
+ if (!IsPreview()) {
+ QStringList aParameters;
+ aParameters << myThicknessSpin->text();
+ anObj->SetParameters(aParameters.join(":").toUtf8().constData());
+ }
+ objects.push_back(anObj._retn());
+ }
+
+ return true;
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> GenerationGUI_ThicknessDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myFaces);
+ res << myObject;
+ return res;
+}
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : GenerationGUI_ThicknessDlg.h
+// Author : Sergey KHROMOV, Open CASCADE S.A.S.
+
+#ifndef GENERATIONGUI_THICKNESSDLG_H
+#define GENERATIONGUI_THICKNESSDLG_H
+
+#include "GEOMBase_Skeleton.h"
+
+
+//=================================================================================
+// class : GenerationGUI_ThicknessDlg
+// purpose :
+//=================================================================================
+class GenerationGUI_ThicknessDlg : public GEOMBase_Skeleton
+{
+ Q_OBJECT
+
+public:
+
+ GenerationGUI_ThicknessDlg(GeometryGUI*, QWidget* = 0,
+ bool = false, Qt::WindowFlags = 0);
+ ~GenerationGUI_ThicknessDlg();
+
+protected:
+
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid( QString& );
+ virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
+
+private:
+ void Init();
+ void enterEvent( QEvent* );
+
+private:
+ GEOM::GeomObjPtr myObject;
+ QList<GEOM::GeomObjPtr> myFaces;
+
+ QLabel *myFacesLbl;
+ QPushButton *myObjSelBtn;
+ QPushButton *myFacesSelBtn;
+ QLineEdit *myObjEdit;
+ QLineEdit *myFacesEdit;
+ SalomeApp_DoubleSpinBox *myThicknessSpin;
+ QCheckBox *myInsideCheck;
+
+
+private slots:
+ void ClickOnOk();
+ bool ClickOnApply();
+ void ActivateThisDialog();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
+ void ConstructorsClicked(int);
+ void ValueChangedInSpinBox();
+ void SetDoubleSpinBoxStep(double);
+ void onChangeDirection(bool);
+};
+
+#endif // GENERATIONGUI_THICKNESSDLG_H
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
${PROJECT_BINARY_DIR}/idl
${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/src/OBJECT
+ ${PROJECT_SOURCE_DIR}/src/GEOMUtils
${PROJECT_SOURCE_DIR}/src/GEOMClient
${PROJECT_SOURCE_DIR}/src/GEOMImpl
${PROJECT_SOURCE_DIR}/src/GEOMGUI
${PROJECT_SOURCE_DIR}/src/GEOMBase
+ ${PROJECT_SOURCE_DIR}/src/MeasureGUI
${PROJECT_SOURCE_DIR}/src/DlgRef
${PROJECT_BINARY_DIR}/src/DlgRef
${CMAKE_CURRENT_SOURCE_DIR}
# libraries to link to
SET(_link_LIBRARIES
GEOMBase
+ GEOMUtils
+ MeasureGUI
)
# --- resources ---
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
}
return aFatherObj._retn();
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> GroupGUI_BooleanDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ for (int i = 0; i < myListShapes.length(); i++) {
+ GEOM::GeomObjPtr aGeomObjPtr(myListShapes[i]);
+ res << aGeomObjPtr;
+ }
+ for (int i = 0; i < myListTools.length(); i++) {
+ GEOM::GeomObjPtr aGeomObjPtr(myListTools[i]);
+ res << aGeomObjPtr;
+ }
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GEOMBase.h>
#include <GeometryGUI.h>
#include <GEOM_Displayer.h>
+#include <GEOMUtils.hxx>
+#ifndef DISABLE_PLOT2DVIEWER
+#include <MeasureGUI_ShapeStatisticsDlg.h>
+#endif
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#include <SalomeApp_Tools.h>
#include <LightApp_SelectionMgr.h>
+#include "utilities.h"
#include <OCCViewer_ViewModel.h>
#include <OCCViewer_ViewManager.h>
#include <SVTK_ViewModel.h>
#include <SALOME_Prs.h>
#include <SALOME_ListIO.hxx>
+#include "utilities.h"
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#define GROUP_IDLST_COLOR Qt::blue // Specific color for the IDs of subShapes in the dialog box
#define GROUP_NEWIDLST_COLOR Qt::red // Specific color for the new IDs of subShapes in the dialog box
-enum { ALL_SUBSHAPES = 0, GET_IN_PLACE, SUBSHAPES_OF_SHAPE2, SUBSHAPES_OF_INVISIBLE_SHAPE2 };
+namespace {
+ enum { ALL_SUBSHAPES = 0, GET_IN_PLACE, SUBSHAPES_OF_SHAPE2, SUBSHAPES_OF_INVISIBLE_SHAPE2 };
+ enum { Filter_LT, Filter_LE, Filter_GT, Filter_GE };
+}
GroupGUI_GroupDlg::GroupGUI_GroupDlg (Mode mode, GeometryGUI* theGeometryGUI, QWidget* parent)
: GEOMBase_Skeleton(theGeometryGUI, parent, false),
myBusy(false),
myIsShapeType(false),
myIsHiddenMain(false),
- myWasHiddenMain(true)
+ myWasHiddenMain(true),
+ myIsAccept(false)
{
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
aMedLayout->setRowStretch(5, 5);
aMedLayout->setRowStretch(8, 5);
+ //filter group
+
+ myFilterGrp = new QGroupBox(tr("GEOM_FILTER"), centralWidget());
+ myLessFilterCheck = new QCheckBox(myFilterGrp);
+ myLessFilterCombo = new QComboBox(myFilterGrp);
+ myLessFilterCombo->addItem( tr("GEOM_LESS_THAN"), Filter_LT );
+ myLessFilterCombo->addItem( tr("GEOM_LESSOREQUAL_THAN"), Filter_LE );
+ myGreaterFilterCheck = new QCheckBox(myFilterGrp);
+ myGreaterFilterCombo = new QComboBox(myFilterGrp);
+ myGreaterFilterCombo->addItem( tr("GEOM_GREAT_THAN"), Filter_GT );
+ myGreaterFilterCombo->addItem( tr("GEOM_GREATOREQUAL_THAN"), Filter_GE );
+ myLessFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp);
+ myGreaterFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp);
+ myApplyFilterButton = new QPushButton(tr("GEOM_BUT_APPLY"), myFilterGrp);
+#ifndef DISABLE_PLOT2DVIEWER
+ myPlotDistributionButton = new QPushButton(tr("GEOM_PLOT_DISTRIBUTION"), myFilterGrp);
+#endif
+
+ QGridLayout* filterLayout = new QGridLayout(myFilterGrp);
+ filterLayout->addWidget(myLessFilterCheck, 0, 0);
+ filterLayout->addWidget(myLessFilterCombo, 0, 1);
+ filterLayout->addWidget(myLessFilterSpin, 0, 2);
+ filterLayout->addWidget(myGreaterFilterCheck, 1, 0);
+ filterLayout->addWidget(myGreaterFilterCombo, 1, 1);
+ filterLayout->addWidget(myGreaterFilterSpin, 1, 2);
+ filterLayout->addWidget(myApplyFilterButton, 0, 3);
+#ifndef DISABLE_PLOT2DVIEWER
+ filterLayout->addWidget(myPlotDistributionButton, 1, 3);
+#endif
+
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupMedium);
+ layout->addWidget(myFilterGrp);
setHelpFileName("work_with_groups_page.html");
GroupGUI_GroupDlg::~GroupGUI_GroupDlg()
{
GEOM_Displayer* aDisplayer = getDisplayer();
- if (myWasHiddenMain) {
- aDisplayer->Erase(myMainObj);
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ bool isHideObjects = resMgr->booleanValue( "Geometry", "hide_input_object", true);
+ if (myWasHiddenMain || ( isHideObjects && myIsAccept ) ) {
myIsHiddenMain = true;
- } else {
+ }
+ else {
aDisplayer->Display(myMainObj);
myIsHiddenMain = false;
}
//=================================================================================
void GroupGUI_GroupDlg::Init()
{
+ // Get setting of step value from file configuration
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
+
+ // min, max, step and decimals for spin boxes
+ initSpinBox(myLessFilterSpin, 0., COORD_MAX, step, "length_precision" );
+ initSpinBox(myGreaterFilterSpin, 0., COORD_MAX, step, "length_precision" );
+ myLessFilterSpin->setValue( 0. );
+ myGreaterFilterSpin->setValue( 0. );
+
myDmMode = -1;
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
connect(myShowAllBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
connect(myIdList, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));
+ connect(myApplyFilterButton, SIGNAL(clicked()), this, SLOT(ClickOnOkFilter()));
+#ifndef DISABLE_PLOT2DVIEWER
+ connect(myPlotDistributionButton, SIGNAL(clicked()), this, SLOT(ClickOnPlot()));
+#endif
+ connect(myLessFilterCheck, SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled()));
+ connect(myGreaterFilterCheck, SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled()));
+
setInPlaceObj(GEOM::GEOM_Object::_nil());
myBusy = true; // just activate but do not select in the list
activateSelection();
myBusy = false;
+ MeasureToggled();
}
//=================================================================================
setIsDisplayResult( false );
}
- if (!onAccept(myMode == CreateGroup, true, isApplyAndClose()))
+ myIsAccept = onAccept(myMode == CreateGroup, true, isApplyAndClose());
+ if (!myIsAccept)
return false;
if(!isApplyAndClose()) {
//=================================================================================
void GroupGUI_GroupDlg::SetEditCurrentArgument()
{
- QPushButton* send = (QPushButton*)sender();
+ QPushButton* send = qobject_cast<QPushButton*>( sender() );
if (send == mySelBtn) {
myEditCurrentArgument = myMainName;
myShape2Name->setText("");
+ mySelBtn->setDown(true);
+ mySelBtn2->setDown(false);
}
else if (send == mySelBtn2 || sender() == myRestrictGroup) {
setInPlaceObj(GEOM::GEOM_Object::_nil());
myShape2Name->setText("");
- if (subSelectionWay() != ALL_SUBSHAPES) {
+ if ( send == mySelBtn2 ) {
+ mySelBtn2->setDown(true);
+ mySelBtn->setDown(false);
+ }
+ if (subSelectionWay() != ALL_SUBSHAPES) {
myEditCurrentArgument = myShape2Name;
}
else {
}
}
- activateSelection();
+ // activateSelection();
+ if(myEditCurrentArgument) {
+ myEditCurrentArgument->setFocus();
+ if ( send )
+ send->setDown(true);
+ }
updateState();
}
{
if (subSelectionWay() != ALL_SUBSHAPES && myEditCurrentArgument == myShape2Name) {
onGetInPlace();
+ if( !myInPlaceObj->_is_nil() ) {
+ mySelBtn2->setDown(false);
+ }
return;
}
}
myMainObj = anObj;
if (!CORBA::is_nil(myMainObj)) {
+ mySelBtn->setDown(false);
SALOME_View* view = GEOM_Displayer::GetActiveView();
if (view) {
CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
TopoDS_Shape aShape;
if (GEOMBase::GetShape(aGeomObj, aShape)) {
if (aGeomObj->GetType() == GEOM_GROUP || aShape.ShapeType() == getShapeType()) {
+ if (subSelectionWay() != ALL_SUBSHAPES &&
+ GEOMBase::GetName(aGeomObj) == myShape2Name->text()) {
+ // Skip selected in place object.
+ continue;
+ }
+
TopTools_IndexedMapOfShape aMainMap;
TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
TopExp::MapShapes(aMainShape, aMainMap);
myRemBtn->setEnabled(hasSel);
myRestrictGroupBox->setEnabled(!CORBA::is_nil(myMainObj));
mySelAllBtn->setEnabled(!CORBA::is_nil(myMainObj));
-
+
mySelBtn2->setEnabled(subSelectionWay() != ALL_SUBSHAPES);
myShape2Name->setEnabled(subSelectionWay() != ALL_SUBSHAPES);
+ myFilterGrp->setEnabled(!CORBA::is_nil(myMainObj) &&
+ subSelectionWay() == ALL_SUBSHAPES &&
+ myIsShapeType &&
+ getShapeType() != TopAbs_VERTEX);
+ // manage of 'Plot' button access
+ GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
+ GEOM::ListOfLong_var aSubShapes = aShOp->SubShapeAllIDs( myMainObj, getShapeType(), false );
+ bool hasCurrentEntities = aSubShapes->length() > 0;
+#ifndef DISABLE_PLOT2DVIEWER
+ myPlotDistributionButton->setEnabled( myFilterGrp->isEnabled() &&
+ myIsShapeType &&
+ ( getShapeType() == TopAbs_EDGE ||
+ getShapeType() == TopAbs_FACE ||
+ getShapeType() == TopAbs_SOLID ) &&
+ hasCurrentEntities );
+#endif
if (subSelectionWay() == ALL_SUBSHAPES)
setInPlaceObj(GEOM::GEOM_Object::_nil());
}
}
return aFatherObj._retn();
}
+
+void GroupGUI_GroupDlg::ClickOnOkFilter()
+{
+ if (CORBA::is_nil(myMainObj) || subSelectionWay() != ALL_SUBSHAPES || !myIsShapeType || getShapeType() == TopAbs_VERTEX)
+ return;
+
+ TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
+ TopTools_IndexedMapOfShape aSubShapesMap;
+ TopExp::MapShapes(aMainShape, aSubShapesMap);
+ SALOME_View* view = GEOM_Displayer::GetActiveView();
+ getDisplayer()->Erase(myMainObj, false, false);
+ CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
+ QString anEntryBase = aMainEntry.in();
+
+ SALOME_ListIO toSelect;
+
+ TopExp_Explorer anExp (aMainShape, (TopAbs_ShapeEnum)getShapeType());
+ for (; anExp.More(); anExp.Next())
+ {
+ TopoDS_Shape aSubShape = anExp.Current();
+ int index = aSubShapesMap.FindIndex(aSubShape);
+ QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
+ if ( !getDisplayer()->IsDisplayed( anEntry ) )
+ continue;
+
+ double factor = GEOMUtils::ShapeToDouble(aSubShape).second;
+ double v1 = myLessFilterSpin->value();
+ double v2 = myGreaterFilterSpin->value();
+ bool isLess = myLessFilterCombo->itemData(myLessFilterCombo->currentIndex()).toInt() == Filter_LT ? factor < v1 : factor <= v1;
+ bool isGreater = myGreaterFilterCombo->itemData(myGreaterFilterCombo->currentIndex()).toInt() == Filter_GT ? factor > v2 : factor >= v2;
+ if ( ( myLessFilterCheck->isChecked() && myGreaterFilterCheck->isChecked() && isLess && isGreater ) ||
+ ( myLessFilterCheck->isChecked() && !myGreaterFilterCheck->isChecked() && isLess ) ||
+ ( myGreaterFilterCheck->isChecked() && !myLessFilterCheck->isChecked() && isGreater ) ) {
+ Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject();
+ io->setEntry( anEntry.toLatin1().constData() );
+ toSelect.Append(io);
+ }
+ }
+ if ( toSelect.Extent() > 0 ) {
+ myGeomGUI->getApp()->selectionMgr()->setSelectedObjects(toSelect);
+ SUIT_MessageBox::information( this,
+ tr( "INF_INFO" ),
+ tr( "GEOM_SOME_SHAPES_SELECTED").arg( toSelect.Extent() ),
+ tr( "BUT_OK" ) );
+ }
+ else {
+ SUIT_MessageBox::information( this,
+ tr( "INF_INFO" ),
+ tr( "GEOM_NO_SHAPES_SELECTED" ),
+ tr( "BUT_OK" ) );
+ }
+ updateState(true);
+}
+
+#ifndef DISABLE_PLOT2DVIEWER
+//=================================================================================
+// function : ClickOnPlot()
+// purpose : opens "Shape Statistics" dialog box in order to plot sub-shapes distribution.
+//=================================================================================
+void GroupGUI_GroupDlg::ClickOnPlot()
+{
+ TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
+ QDialog* dlg = new MeasureGUI_ShapeStatisticsDlg( this, aMainShape, getShapeType() );
+ if ( dlg ) {
+ dlg->show();
+ }
+}
+#endif
+
+void GroupGUI_GroupDlg::MeasureToggled()
+{
+ myLessFilterSpin->setEnabled(myLessFilterCheck->isChecked());
+ myLessFilterCombo->setEnabled(myLessFilterCheck->isChecked());
+ myGreaterFilterSpin->setEnabled(myGreaterFilterCheck->isChecked());
+ myGreaterFilterCombo->setEnabled(myGreaterFilterCheck->isChecked());
+ myApplyFilterButton->setEnabled(myLessFilterCheck->isChecked() || myGreaterFilterCheck->isChecked());
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> GroupGUI_GroupDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr1(myMainObj), aGeomObjPtr2(myInPlaceObj);
+ res << aGeomObjPtr1 << aGeomObjPtr2;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TColStd_DataMapOfIntegerInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
+class QCheckBox;
+class QComboBox;
+class QPushButton;
class QGroupBox;
class QLineEdit;
class QListWidget;
class QButtonGroup;
+class SalomeApp_DoubleSpinBox;
//=================================================================================
// class : GroupGUI_GroupDlg
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
void closeEvent (QCloseEvent*);
void remove();
void showOnlySelected();
void selectionChanged();
+ void ClickOnOkFilter();
+#ifndef DISABLE_PLOT2DVIEWER
+ void ClickOnPlot();
+#endif
+ void MeasureToggled();
private:
void Init();
TColStd_DataMapOfIntegerInteger myMain2InPlaceIndices;
QList<int> myGroupIdList;
int myDmMode;
+ bool myIsAccept;
QPushButton* mySelBtn;
QLineEdit* myMainName;
QPushButton* myHideSelBtn;
QPushButton* myShowAllBtn;
QListWidget* myIdList;
+ QCheckBox* myLessFilterCheck;
+ QCheckBox* myGreaterFilterCheck;
+ QComboBox* myLessFilterCombo;
+ QComboBox* myGreaterFilterCombo;
+ SalomeApp_DoubleSpinBox* myLessFilterSpin;
+ SalomeApp_DoubleSpinBox* myGreaterFilterSpin;
+ QPushButton* myApplyFilterButton;
+ QPushButton* myPlotDistributionButton;
+ QGroupBox* myFilterGrp;
};
#endif
-# Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "GEOM_Operation.h"
#include "GEOMBase.h"
#include "GEOM_Displayer.h"
+#include "GEOM_GenericObjPtr.h"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(IGESPlugin)
+typedef GEOM::GenericObjPtr<GEOM::IIGESOperations> IGESOpPtr;
+
//=======================================================================
// function : IGESPlugin_GUI()
// purpose : Constructor
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "IGESPluginEngine" );
- GEOM::IIGESOperations_var igesOp = GEOM::IIGESOperations::_narrow( op );
- if ( CORBA::is_nil( igesOp ) ) return false;
+ IGESOpPtr igesOp = GEOM::IIGESOperations::_narrow( op );
+ if ( igesOp.isNull() ) return false;
QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""),
tr( "IGES_FILES" ),
{
QString fileName = fileNames.at( i );
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, igesOp.in() );
+ GEOM_Operation transaction( app, igesOp.get() );
bool ignoreUnits = false;
try
entryList.append( so->GetID() );
transaction.commit();
GEOM_Displayer( study ).Display( main.in() );
+ main->UnRegister();
}
else
{
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "IGESPluginEngine" );
- GEOM::IIGESOperations_var igesOp = GEOM::IIGESOperations::_narrow( op );
- if ( CORBA::is_nil( igesOp ) ) return false;
+ IGESOpPtr igesOp = GEOM::IIGESOperations::_narrow( op );
+ if ( igesOp.isNull() ) return false;
LightApp_SelectionMgr* sm = app->selectionMgr();
if ( !sm ) return false;
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, igesOp.in() );
+ GEOM_Operation transaction( app, igesOp.get() );
try
{
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="ja" sourcelanguage="en">
-<context>
+ <context>
<name>@default</name>
<message>
- <source>MEN_EXPORTIGES</source>
- <translation type="unfinished">IGES</translation>
+ <source>MEN_EXPORTIGES</source>
+ <translation>IGESエクスポート</translation>
</message>
<message>
- <source>TOP_EXPORTIGES</source>
- <translation type="unfinished">Export IGES</translation>
+ <source>TOP_EXPORTIGES</source>
+ <translation>IGESエクスポート</translation>
</message>
<message>
- <source>STB_EXPORTIGES</source>
- <translation type="unfinished">Export IGES</translation>
+ <source>STB_EXPORTIGES</source>
+ <translation>IGESエクスポート</translation>
</message>
<message>
- <source>MEN_IMPORTIGES</source>
- <translation type="unfinished">IGES</translation>
+ <source>MEN_IMPORTIGES</source>
+ <translation>IGESインポート</translation>
</message>
<message>
- <source>TOP_IMPORTIGES</source>
- <translation type="unfinished">Import IGES</translation>
+ <source>TOP_IMPORTIGES</source>
+ <translation>IGESインポート</translation>
</message>
<message>
- <source>STB_IMPORTIGES</source>
- <translation type="unfinished">Import IGES</translation>
+ <source>STB_IMPORTIGES</source>
+ <translation>IGESインポート</translation>
</message>
-</context>
-<context>
+ </context>
+ <context>
<name>IGESPlugin_GUI</name>
<message>
- <source>IGES_FILES</source>
- <translation type="unfinished">IGES Files ( *.iges *.igs )</translation>
+ <source>IGES_FILES</source>
+ <translation>IGES ファイル ( *.iges *.igs )</translation>
</message>
<message>
- <source>EXPORT_TITLE</source>
- <translation type="unfinished">Export IGES</translation>
+ <source>EXPORT_TITLE</source>
+ <translation>IGESエクスポート</translation>
</message>
<message>
- <source>IMPORT_TITLE</source>
- <translation type="unfinished">Import IGES</translation>
+ <source>IMPORT_TITLE</source>
+ <translation>IGESインポート</translation>
</message>
<message>
- <source>SCALE_DIMENSIONS</source>
- <translation>インポートしたファイルの単位をミリメートルからメートルに変換しますか?いいえを選んだ場合、メートル単位として解釈します。</translation>
+ <source>SCALE_DIMENSIONS</source>
+ <translation>インポートしたファイルの単位をミリメートルからメートルに変換しますか?いいえを選んだ場合、メートル単位として解釈します。</translation>
</message>
-</context>
-<context>
+ </context>
+ <context>
<name>IGESPlugin_ExportDlg</name>
<message>
- <source>IGES_VERSION</source>
- <translation type="unfinished">Version</translation>
+ <source>IGES_VERSION</source>
+ <translation>IGESバージョン</translation>
</message>
-</context>
+ </context>
</TS>
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
<!--
- Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+ Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
MeasureGUI_CheckCompoundOfBlocksDlg.h
MeasureGUI_GetNonBlocksDlg.h
MeasureGUI_CheckSelfIntersectionsDlg.h
+ MeasureGUI_FastCheckIntersectionsDlg.h
MeasureGUI_PointDlg.h
MeasureGUI_ManageDimensionsDlg.h
MeasureGUI_CreateDimensionDlg.h
MeasureGUI_DimensionCreateTool.h
MeasureGUI_DimensionInteractor.h
MeasureGUI_DimensionFilter.h
+ MeasureGUI_definitions.h
)
# header files / to be processed by moc
MeasureGUI_CheckCompoundOfBlocksDlg.h
MeasureGUI_GetNonBlocksDlg.h
MeasureGUI_CheckSelfIntersectionsDlg.h
+ MeasureGUI_FastCheckIntersectionsDlg.h
MeasureGUI_PointDlg.h
MeasureGUI_ManageDimensionsDlg.h
MeasureGUI_CreateDimensionDlg.h
MeasureGUI_DimensionInteractor.h
)
+
+IF(SALOME_USE_PLOT2DVIEWER)
+ LIST(APPEND _moc_HEADERS
+ MeasureGUI_ShapeStatisticsDlg.h
+ )
+ENDIF()
# header files / uic wrappings
QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
MeasureGUI_CheckCompoundOfBlocksDlg.cxx
MeasureGUI_GetNonBlocksDlg.cxx
MeasureGUI_CheckSelfIntersectionsDlg.cxx
+ MeasureGUI_FastCheckIntersectionsDlg.cxx
MeasureGUI_PointDlg.cxx
MeasureGUI_ManageDimensionsDlg.cxx
MeasureGUI_CreateDimensionDlg.cxx
${_uic_files}
)
+IF(SALOME_USE_PLOT2DVIEWER)
+ LIST(APPEND MeasureGUI_SOURCES
+ MeasureGUI_ShapeStatisticsDlg.cxx
+ )
+ENDIF()
+
# --- rules ---
ADD_LIBRARY(MeasureGUI ${MeasureGUI_SOURCES})
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "MeasureGUI_CheckCompoundOfBlocksDlg.h" // Method CHECKCOMPOUND
#include "MeasureGUI_GetNonBlocksDlg.h" // Method GET NON BLOCKS
#include "MeasureGUI_CheckSelfIntersectionsDlg.h" // Method CHECK SELF INTERSCTIONS
+#include "MeasureGUI_FastCheckIntersectionsDlg.h" // Method FAST CHECK INTERSCTIONS
#include "MeasureGUI_PointDlg.h" // Method POINTCOORDINATES
#include "MeasureGUI_ManageDimensionsDlg.h" // Method MANAGEDIMENSIONS
+#ifndef DISABLE_PLOT2DVIEWER
+#include "MeasureGUI_ShapeStatisticsDlg.h" // Method SHAPE STATISTICS
+#endif
#include <QApplication>
case GEOMOp::OpCheckSelfInters:
dlg = new MeasureGUI_CheckSelfIntersectionsDlg( getGeometryGUI(), parent );
break; // CHECK SELF INTERSCTIONS
+ case GEOMOp::OpFastCheckInters:
+ dlg = new MeasureGUI_FastCheckIntersectionsDlg( getGeometryGUI(), parent );
+ break; // FAST CHECK INTERSCTIONS
+#ifndef DISABLE_PLOT2DVIEWER
+ case GEOMOp::OpShapeStatistics:
+ dlg = new MeasureGUI_ShapeStatisticsDlg( parent );
+ break; // SHAPE STATISTICS
+#endif
case GEOMOp::OpPointCoordinates:
dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent );
break; // POINT COORDINATES
return;
}
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
GEOMGUI_DimensionProperty aDimensions( anActiveStudy, anIObject->getEntry() );
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <gce_MakePln.hxx>
#include <Precision.hxx>
#include <AIS.hxx>
-#include <AIS_Drawer.hxx>
#include <Prs3d_LineAspect.hxx>
#include <IntTools_EdgeEdge.hxx>
#include <IntTools_SequenceOfCommonPrts.hxx>
// init variables
myGrp->LineEdit1->setText("");
myGrp->LineEdit2->setText("");
- myObj = myObj2 = GEOM::GEOM_Object::_nil();
+ myGrp->LineEdit1->setEnabled(true);
+ myGrp->LineEdit2->setEnabled(false);
+ myObj.nullify();
+ myObj2.nullify();
mySelBtn = myGrp->PushButton1;
mySelEdit = myGrp->LineEdit1;
connect(mySelEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- globalSelection(GEOM_LINE);
+ activateSelection();
MeasureGUI_Skeleton::Init();
}
//=================================================================================
void MeasureGUI_AngleDlg::SelectionIntoArgument()
{
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
-
- GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
-
- if (aSelList.Extent() > 0) {
- aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
- }
+ GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_EDGE );
// clear selection
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
if (myEditCurrentArgument == mySelEdit) {
myObj = aSelectedObject;
- if (!myObj->_is_nil() && myObj2->_is_nil())
+ if (myObj && !myObj2)
myGrp->PushButton2->click();
}
else {
myObj2 = aSelectedObject;
- if (!myObj2->_is_nil() && myObj->_is_nil())
+ if (myObj2 && !myObj)
myGrp->PushButton1->click();
}
//=================================================================================
void MeasureGUI_AngleDlg::processObject()
{
- myGrp->LineEdit1->setText(!myObj->_is_nil() ? GEOMBase::GetName(myObj ) : "");
- myGrp->LineEdit2->setText(!myObj2->_is_nil() ? GEOMBase::GetName(myObj2) : "");
+ myGrp->LineEdit1->setText(myObj ? GEOMBase::GetName(myObj.get()) : "");
+ myGrp->LineEdit2->setText(myObj2 ? GEOMBase::GetName(myObj2.get()) : "");
double anAngle = 0.;
if (getParameters(anAngle)) {
if (isValid(msg)) {
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
try {
- theAngle = anOper->GetAngle(myObj, myObj2);
+ theAngle = anOper->GetAngle(myObj.get(), myObj2.get());
}
catch(const SALOME::SALOME_Exception& e) {
SalomeApp_Tools::QtCatchCorbaException(e);
}
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
- globalSelection(GEOM_LINE);
+ activateSelection();
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
SALOME_Prs* MeasureGUI_AngleDlg::buildPrs()
{
double anAngle = 0.;
+ myGrp->LineEdit3->setText("");
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
- if (myObj->_is_nil() || myObj2->_is_nil() || !getParameters(anAngle) ||
+ if (!myObj || !myObj2 || !getParameters(anAngle) ||
vw->getViewManager()->getType() != OCCViewer_Viewer::Type())
return 0;
try {
OCC_CATCH_SIGNALS;
TopoDS_Shape S1, S2;
- if (GEOMBase::GetShape(myObj , S1, TopAbs_EDGE) &&
- GEOMBase::GetShape(myObj2, S2, TopAbs_EDGE)) {
+ if (GEOMBase::GetShape(myObj.get() , S1, TopAbs_EDGE) &&
+ GEOMBase::GetShape(myObj2.get(), S2, TopAbs_EDGE)) {
TopoDS_Edge anEdge1 = TopoDS::Edge(S1);
TopoDS_Edge anEdge2 = TopoDS::Edge(S2);
//=================================================================================
bool MeasureGUI_AngleDlg::isValid (QString& msg)
{
- return MeasureGUI_Skeleton::isValid(msg) && !myObj2->_is_nil();
+ return MeasureGUI_Skeleton::isValid(msg) && myObj2;
+}
+
+//=================================================================================
+// function : activateSelection()
+// purpose :
+//=================================================================================
+void MeasureGUI_AngleDlg::activateSelection()
+{
+ globalSelection(GEOM_LINE);
+ localSelection( TopAbs_EDGE );
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
private:
void Init();
bool getParameters( double& );
+ void activateSelection();
private:
QLineEdit* myEditCurrentArgument;
QPushButton* mySelBtn2;
MeasureGUI_2Sel1LineEdit* myGrp;
- GEOM::GEOM_Object_var myObj2;
+ GEOM::GeomObjPtr myObj2;
};
#endif // MEASUREGUI_ANGLEDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
this, SLOT(SelectionIntoArgument()));
initName(tr("GEOM_BNDBOX"));
- globalSelection();
+ activateSelection();
SelectionIntoArgument();
}
return false;
initName();
+ activateSelection();
return true;
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
- globalSelection();
+ activateSelection();
redisplayPreview();
}
double& theYmin, double& theYmax,
double& theZmin, double& theZmax)
{
- if (myObj->_is_nil())
+ if (!myObj)
return false;
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
- anOper->GetBoundingBox(myObj, true, theXmin, theXmax, theYmin, theYmax, theZmin, theZmax);
+ anOper->GetBoundingBox(myObj.get(), true, theXmin, theXmax, theYmin, theYmax, theZmin, theZmax);
return anOper->IsDone();
}
void MeasureGUI_BndBoxDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
- myObj = GEOM::GEOM_Object::_nil();
+ myObj.nullify();
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
+ QList<TopAbs_ShapeEnum> aTypes;
+ aTypes << TopAbs_VERTEX << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE << TopAbs_SHELL << TopAbs_SOLID << TopAbs_COMPSOLID << TopAbs_COMPOUND << TopAbs_SHAPE;
+ myObj = getSelected( aTypes );
- if (aSelList.Extent() != 1) {
+ if ( !myObj ) {
processObject();
erasePreview();
return;
}
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First());
-
- if (aSelectedObject->_is_nil()) {
- processObject();
- erasePreview();
- return;
- }
-
- myObj = aSelectedObject;
- myEditCurrentArgument->setText(GEOMBase::GetName(myObj));
+ myEditCurrentArgument->setText(GEOMBase::GetName(myObj.get()));
processObject();
redisplayPreview();
}
//=================================================================================
bool MeasureGUI_BndBoxDlg::isValid (QString&)
{
- return !myObj->_is_nil();
+ return myObj;
}
//=================================================================================
bool MeasureGUI_BndBoxDlg::execute (ObjectList& objects)
{
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
- GEOM::GEOM_Object_var anObj = anOper->MakeBoundingBox(myObj, true);
+ GEOM::GEOM_Object_var anObj = anOper->MakeBoundingBox(myObj.get(), true);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
return true;
}
+//=================================================================================
+// function : activateSelection()
+// purpose :
+//=================================================================================
+void MeasureGUI_BndBoxDlg::activateSelection()
+{
+ globalSelection( GEOM_ALLSHAPES );
+ localSelection( TopAbs_SHAPE );
+}
+
//=================================================================================
// function : redisplayPreview()
// purpose :
erasePreview(false);
try {
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
getDisplayer()->SetColor(Quantity_NOC_VIOLET);
getDisplayer()->SetToActivate(false);
catch (...) {
}
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void MeasureGUI_BndBoxDlg::addSubshapesToStudy()
+{
+ GEOMBase::PublishSubObject( myObj.get() );
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> MeasureGUI_BndBoxDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myObj;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
-
+ virtual void addSubshapesToStudy();
void redisplayPreview();
virtual void processObject();
virtual SALOME_Prs* buildPrs();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
void enterEvent (QEvent*);
+ void activateSelection();
bool getParameters (double&, double&, double&, double&, double&, double&);
private:
- GEOM::GEOM_Object_var myObj;
+ GEOM::GeomObjPtr myObj;
MeasureGUI_1Sel6LineEdit* myGrp;
private slots:
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_POINT") );
- globalSelection();
+ activateSelection();
SelectionIntoArgument();
}
+//=================================================================================
+// function : activateSelection
+// purpose :
+//=================================================================================
+void MeasureGUI_CenterMassDlg::activateSelection()
+{
+ globalSelection( GEOM_ALLSHAPES );
+ localSelection( TopAbs_SHAPE );
+}
//=================================================================================
// function : ClickOnOk()
return false;
initName();
+ activateSelection();
return true;
// myMeasureGUI->MakeCDGAndDisplay( myGeomShape );
void MeasureGUI_CenterMassDlg::SelectionIntoArgument()
{
erasePreview();
- myObj = GEOM::GEOM_Object::_nil();
-
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
- if (aSelList.Extent() != 1) {
- processObject();
- return;
- }
+ myObj.nullify();
+ QList<TopAbs_ShapeEnum> aTypes;
+ aTypes << TopAbs_VERTEX << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE << TopAbs_SHELL << TopAbs_SOLID << TopAbs_COMPSOLID << TopAbs_COMPOUND << TopAbs_SHAPE;
+ myObj = getSelected( aTypes );
- GEOM::GEOM_Object_var aSelectedObject =
- GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-
- if ( aSelectedObject->_is_nil() ) {
+ if ( !myObj ) {
processObject();
return;
}
- myObj = aSelectedObject;
processObject();
displayPreview(true);
}
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL(currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- globalSelection();
+ activateSelection();
displayPreview(true);
}
//=================================================================================
void MeasureGUI_CenterMassDlg::processObject()
{
- if ( myObj->_is_nil() ) {
+ if ( !myObj ) {
myGrp->LineEdit1->setText( "" );
myGrp->LineEdit2->setText( "" );
myGrp->LineEdit3->setText( "" );
getParameters( x, y, z );
- myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) );
+ myGrp->LineEdit1->setText( GEOMBase::GetName( myObj.get() ) );
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
//=================================================================================
bool MeasureGUI_CenterMassDlg::isValid( QString& )
{
- return !myObj->_is_nil();
+ return myObj;
}
//=================================================================================
//=================================================================================
bool MeasureGUI_CenterMassDlg::getParameters( double& theX, double& theY, double& theZ )
{
- if ( myObj->_is_nil() )
+ if ( !myObj )
return false;
else {
try {
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
- GEOM::GEOM_Object_var anObj = anOper->GetCentreOfMass( myObj );
+ GEOM::GEOM_Object_var anObj = anOper->GetCentreOfMass( myObj.get() );
if ( !anOper->IsDone() )
return false;
bool MeasureGUI_CenterMassDlg::execute( ObjectList& objects )
{
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
- GEOM::GEOM_Object_var anObj = anOper->GetCentreOfMass( myObj );
+ GEOM::GEOM_Object_var anObj = anOper->GetCentreOfMass( myObj.get() );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
return true;
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void MeasureGUI_CenterMassDlg::addSubshapesToStudy()
+{
+ GEOMBase::PublishSubObject( myObj.get() );
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> MeasureGUI_CenterMassDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myObj;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
+ virtual void addSubshapesToStudy();
virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private slots:
void ClickOnOk();
void Init();
void enterEvent( QEvent* );
void processObject();
+ void activateSelection();
bool getParameters( double&, double&, double& );
private:
- GEOM::GEOM_Object_var myObj;
+ GEOM::GeomObjPtr myObj;
MeasureGUI_1Sel3LineEdit* myGrp;
};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
#include "MeasureGUI.h"
#include "MeasureGUI_CheckCompoundOfBlocksDlg.h"
-#include "MeasureGUI_Widgets.h"
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <GEOMBase.h>
#include <GEOMImpl_Types.hxx>
+#include <QListWidget>
+
#define TEXTEDIT_FONT_FAMILY "Courier"
#define TEXTEDIT_FONT_SIZE 11
// true to construct a modal dialog.
//=================================================================================
MeasureGUI_CheckCompoundOfBlocksDlg::MeasureGUI_CheckCompoundOfBlocksDlg( GeometryGUI* GUI, QWidget* parent )
- : GEOMBase_Skeleton( GUI, parent, false )
+ : GEOMBase_Skeleton(GUI, parent, false),
+ myObjectName (0),
+ mySelButton (0),
+ myUseC1Check (0),
+ myTolLbl (0),
+ mySpinTol (0),
+ myTextView (0),
+ myListBox1 (0),
+ myListBox2 (0)
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_CHECK_COMPOUND_OF_BLOCKS" ) ) );
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
- myGrp = new MeasureGUI_1Sel1TextView2ListBox( centralWidget() );
- myGrp->GroupBox1->setTitle( tr( "GEOM_CHECK_INFOS" ) );
- myGrp->TextLabel1->setText( tr( "GEOM_OBJECT" ) );
-
- myGrp->TextView1->setReadOnly( true );
- QFont aFont( TEXTEDIT_FONT_FAMILY, TEXTEDIT_FONT_SIZE );
- aFont.setStyleHint( QFont::TypeWriter, QFont::PreferAntialias );
- myGrp->TextView1->setFont( aFont );
-
- myGrp->PushButton1->setIcon( image1 );
- myGrp->LineEdit1->setReadOnly( true );
-
- myGrp->TextLabel2->setText( tr( "GEOM_CHECK_BLOCKS_COMPOUND_ERRORS" ) );
- myGrp->TextLabel3->setText( tr( "GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES" ) );
-
- myGrp->ListBox2->setSelectionMode( QAbstractItemView::ExtendedSelection );
+ QGroupBox *aGrpParams =
+ new QGroupBox(tr("GEOM_CHECK_INFOS"), centralWidget());
+ QGridLayout *aParamsLayout = new QGridLayout(aGrpParams);
+ QLabel *anObjLbl = new QLabel(tr("GEOM_OBJECT"), aGrpParams);
+ QLabel *anErrorsLbl =
+ new QLabel(tr("GEOM_CHECK_BLOCKS_COMPOUND_ERRORS"), aGrpParams);
+ QLabel *aNonBlocksLbl =
+ new QLabel(tr("GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES"), aGrpParams);
+
+ myObjectName = new QLineEdit(aGrpParams);
+ mySelButton = new QPushButton(aGrpParams);
+ myUseC1Check = new QCheckBox(tr("GEOM_USE_C1_CRITERION"), aGrpParams);
+ myTolLbl = new QLabel(tr("GEOM_ANGULAR_TOLERANCE"), aGrpParams);
+ mySpinTol = new SalomeApp_DoubleSpinBox(aGrpParams);
+ myTextView = new QTextBrowser(aGrpParams);
+ myListBox1 = new QListWidget(aGrpParams);
+ myListBox2 = new QListWidget(aGrpParams);
+
+ myObjectName->setReadOnly(true);
+ mySelButton->setIcon(image1);
+ mySelButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ myUseC1Check->setText(tr("GEOM_USE_C1_CRITERION"));
+ myUseC1Check->setChecked(true);
+ myTextView->setReadOnly(true);
+ myListBox2->setSelectionMode(QAbstractItemView::ExtendedSelection);
+
+ // Set text view font.
+ QFont aFont(TEXTEDIT_FONT_FAMILY, TEXTEDIT_FONT_SIZE);
+
+ aFont.setStyleHint(QFont::TypeWriter, QFont::PreferAntialias);
+ myTextView->setFont(aFont);
+
+ aParamsLayout->setMargin(9);
+ aParamsLayout->setSpacing(6);
+ aParamsLayout->addWidget(anObjLbl, 0, 0);
+ aParamsLayout->addWidget(mySelButton, 0, 1);
+ aParamsLayout->addWidget(myObjectName, 0, 2);
+ aParamsLayout->addWidget(myUseC1Check, 1, 0, 1, 3);
+ aParamsLayout->addWidget(myTolLbl, 2, 0);
+ aParamsLayout->addWidget(mySpinTol, 2, 1, 1, 2);
+ aParamsLayout->addWidget(myTextView, 3, 0, 1, 3);
+ aParamsLayout->addWidget(anErrorsLbl, 4, 0);
+ aParamsLayout->addWidget(myListBox1, 5, 0, 1, 2);
+ aParamsLayout->addWidget(aNonBlocksLbl, 4, 2);
+ aParamsLayout->addWidget(myListBox2, 5, 2);
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
- layout->addWidget( myGrp );
-
- connect( myGrp->ListBox1, SIGNAL( itemSelectionChanged() ), SLOT( onErrorsListSelectionChanged() ) );
- connect( myGrp->ListBox2, SIGNAL( itemSelectionChanged() ), SLOT( onSubShapesListSelectionChanged() ) );
+ layout->addWidget( aGrpParams );
/***************************************************************/
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::Init()
{
- myEditCurrentArgument = myGrp->LineEdit1;
+ /* init variables */
+ double SpecificStep = 0.0001;
+ double aDefaultTol = Precision::Angular();
+
+ initSpinBox(mySpinTol, aDefaultTol, MAX_NUMBER, SpecificStep, "ang_tol_precision");
+ mySpinTol->setValue(aDefaultTol);
+ myEditCurrentArgument = myObjectName;
// signals and slots connections
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
- connect( myGrp->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
- connect( myGrp->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect(myObjectName, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(mySelButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(myListBox1, SIGNAL(itemSelectionChanged()), this, SLOT(onErrorsListSelectionChanged()));
+ connect(myListBox2, SIGNAL(itemSelectionChanged()), this, SLOT(onSubShapesListSelectionChanged()));
+ connect(myUseC1Check, SIGNAL(clicked()), this, SLOT(SetUseC1Tolerance()));
+ connect(mySpinTol, SIGNAL(valueChanged(double)), this, SLOT(processObject()));
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
this, SLOT( SelectionIntoArgument() ) );
aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() != 1) {
- myGrp->LineEdit1->setText( "" );
+ myObjectName->setText( "" );
processObject();
return;
}
GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( aSelectedObject->_is_nil() ) {
- myGrp->LineEdit1->setText( "" );
+ myObjectName->setText( "" );
processObject();
return;
}
myObj = aSelectedObject;
- myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) );
+ myObjectName->setText( GEOMBase::GetName( myObj ) );
processObject();
DISPLAY_PREVIEW_MACRO;
}
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::SetEditCurrentArgument()
{
- myGrp->LineEdit1->setFocus();
- myEditCurrentArgument = myGrp->LineEdit1;
+ myObjectName->setFocus();
+ myEditCurrentArgument = myObjectName;
SelectionIntoArgument();
}
+//=================================================================================
+// function : SetUseC1Tolerance()
+// purpose :
+//=================================================================================
+void MeasureGUI_CheckCompoundOfBlocksDlg::SetUseC1Tolerance()
+{
+ myTolLbl->setEnabled(myUseC1Check->isChecked());
+ mySpinTol->setEnabled(myUseC1Check->isChecked());
+ processObject();
+}
+
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
void MeasureGUI_CheckCompoundOfBlocksDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
- if ( send == myGrp->LineEdit1 ) {
- myEditCurrentArgument = myGrp->LineEdit1;
+ if ( send == myObjectName ) {
+ myEditCurrentArgument = myObjectName;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() );
try {
GEOM::GEOM_IBlocksOperations::BCErrors_var aErrs;
- theIsCompoundOfBlocks = anOper->CheckCompoundOfBlocks( myObj, aErrs );
+ double aC1Tol = -1.;
+
+ if (myUseC1Check->isChecked()) {
+ aC1Tol = mySpinTol->value();
+ }
+
+ theIsCompoundOfBlocks = anOper->CheckCompoundOfBlocks( myObj, aC1Tol, aErrs );
if (anOper->IsDone() && aErrs->length() > 0)
//if (anOper->IsDone() && !aErrs._is_nil())
theErrors = aErrs;
GEOM::GEOM_IBlocksOperations::BCErrors aErrs;
if ( !getBCErrors( isCompoundOfBlocks, aErrs ) ) {
aMsg += tr( "GEOM_CHECK_BLOCKS_COMPOUND_FAILED" );
- myGrp->TextView1->setText( aMsg );
- myGrp->ListBox1->clear();
- myGrp->ListBox2->clear();
+ myTextView->setText( aMsg );
+ myListBox1->clear();
+ myListBox2->clear();
erasePreview();
return;
}
buttonOk()->setEnabled( true );
buttonApply()->setEnabled( true );
}
- myGrp->TextView1->setText( aMsg );
+ myTextView->setText( aMsg );
QStringList aErrList;
QString aErrStr( "" );
aErrList.append( aErrStr );
}
- myGrp->ListBox1->clear();
- myGrp->ListBox2->clear();
- myGrp->ListBox1->addItems( aErrList );
+ myListBox1->clear();
+ myListBox2->clear();
+ myListBox1->addItems( aErrList );
}
//=================================================================================
void MeasureGUI_CheckCompoundOfBlocksDlg::onErrorsListSelectionChanged()
{
erasePreview();
- int aCurItem = myGrp->ListBox1->currentRow();
+ int aCurItem = myListBox1->currentRow();
if ( aCurItem < 0 )
return;
bool isCompoundOfBlocks;
GEOM::GEOM_IBlocksOperations::BCErrors aErrs;
if ( !getBCErrors( isCompoundOfBlocks, aErrs ) ) {
- myGrp->TextView1->setText( "" );
- myGrp->ListBox1->clear();
- myGrp->ListBox2->clear();
+ myTextView->setText( "" );
+ myListBox1->clear();
+ myListBox2->clear();
return;
}
- myGrp->ListBox2->clear();
+ myListBox2->clear();
if (aCurItem < aErrs.length()) {
GEOM::GEOM_IBlocksOperations::BCError aErr = aErrs[aCurItem];
aSubShapeList.append( QString( "%1_%2" ).arg( aType ).arg( aObjLst[i] ) );
}
}
- myGrp->ListBox2->addItems( aSubShapeList );
+ myListBox2->addItems( aSubShapeList );
}
}
void MeasureGUI_CheckCompoundOfBlocksDlg::onSubShapesListSelectionChanged()
{
erasePreview();
- int aErrCurItem = myGrp->ListBox1->currentRow();
+ int aErrCurItem = myListBox1->currentRow();
if ( aErrCurItem < 0 )
return;
QList<int> aIds;
- for ( int i = 0, n = myGrp->ListBox2->count(); i < n; i++ ) {
- if ( myGrp->ListBox2->item( i )->isSelected() )
+ for ( int i = 0, n = myListBox2->count(); i < n; i++ ) {
+ if ( myListBox2->item( i )->isSelected() )
aIds.append( i );
}
if ( aIds.count() < 1 )
bool isCompoundOfBlocks;
GEOM::GEOM_IBlocksOperations::BCErrors aErrs;
if ( !getBCErrors( isCompoundOfBlocks, aErrs ) ) {
- myGrp->TextView1->setText( "" );
- myGrp->ListBox1->clear();
- myGrp->ListBox2->clear();
+ myTextView->setText( "" );
+ myListBox1->clear();
+ myListBox2->clear();
return;
}
for ( it = aIds.begin(); it != aIds.end(); ++it ) {
aSubShape = anIndices.FindKey(aObjLst[(*it)]);
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- int w = resMgr->integerValue("Geometry", "measures_line_width", 1);
+ int w = resMgr->integerValue("Geometry", "preview_edge_width", 1);
try {
getDisplayer()->SetColor( Quantity_NOC_RED );
getDisplayer()->SetWidth( w );
}
}
+//=================================================================================
+// function : onDisplayPreview
+// purpose :
+//=================================================================================
+void MeasureGUI_CheckCompoundOfBlocksDlg::onDisplayPreview()
+{
+ DISPLAY_PREVIEW_MACRO;
+}
+
//=================================================================================
// function : activateSelection
// purpose : activate selection of faces, shells, and solids
// function : isValid
// purpose :
//=================================================================================
-bool MeasureGUI_CheckCompoundOfBlocksDlg::isValid( QString& )
+bool MeasureGUI_CheckCompoundOfBlocksDlg::isValid( QString &msg)
{
- return !myObj->_is_nil();
+ return !myObj->_is_nil() && mySpinTol->isValid(msg, !IsPreview());
}
//=================================================================================
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GEOMBase_Skeleton.h>
-class MeasureGUI_1Sel1TextView2ListBox;
+class QCheckBox;
+class QLabel;
+class QLineEdit;
+class QListWidget;
+class QPushButton;
+class QTextBrowser;
+class SalomeApp_DoubleSpinBox;
//=================================================================================
// class : MeasureGUI_CheckCompoundOfBlocksDlg
protected:
// redefined from GEOMBase_Helper and GEOMBase_Skeleton
virtual GEOM::GEOM_IOperations_ptr createOperation();
- virtual bool isValid( QString& );
+ virtual bool isValid( QString &msg );
virtual bool execute( ObjectList& );
virtual void processObject();
void onErrorsListSelectionChanged();
void onSubShapesListSelectionChanged();
+ void SetUseC1Tolerance();
+ void onDisplayPreview();
private:
void Init();
private:
GEOM::GEOM_Object_var myObj;
- MeasureGUI_1Sel1TextView2ListBox* myGrp;
+ QLineEdit *myObjectName;
+ QPushButton *mySelButton;
+ QCheckBox *myUseC1Check;
+ QLabel *myTolLbl;
+ SalomeApp_DoubleSpinBox *mySpinTol;
+ QTextBrowser *myTextView;
+ QListWidget *myListBox1;
+ QListWidget *myListBox2;
};
#endif // MEASUREGUI_CHECKCOMPOUNDOFBLOCKSDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// File : MeasureGUI_CheckSelfIntersectionsDlg.cxx
#include "MeasureGUI_CheckSelfIntersectionsDlg.h"
-#include "MeasureGUI_Widgets.h"
+#include "MeasureGUI.h"
+#include <SUIT_MessageBox.h>
+#include <SUIT_OverrideCursor.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <LightApp_SelectionMgr.h>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <GEOMImpl_Types.hxx>
+#include <GEOM_GenericObjPtr.h>
+
+#include <QListWidget>
#define TEXTEDIT_FONT_FAMILY "Courier"
#define TEXTEDIT_FONT_SIZE 11
// true to construct a modal dialog.
//=================================================================================
MeasureGUI_CheckSelfIntersectionsDlg::MeasureGUI_CheckSelfIntersectionsDlg (GeometryGUI* GUI, QWidget* parent)
- : MeasureGUI_Skeleton(GUI, parent, false)
+ : GEOMBase_Skeleton (GUI, parent, false),
+ myTextView1 (0),
+ myTextView2 (0),
+ mySelButton1 (0),
+ mySelButton2 (0),
+ myEditObjName1 (0),
+ myEditObjName2 (0),
+ myLevelBox (0),
+ myComputeButton1 (0),
+ myComputeButton2 (0),
+ myInteList1 (0),
+ myShapeList1 (0),
+ myInteList2 (0),
+ myShapeList2 (0),
+ myCurrConstrId (-1)
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_CHECK_SELF_INTERSECTIONS")));
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
+ QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FAST_CHECK_INTERSECTIONS")));
setWindowTitle(tr("GEOM_CHECK_SELF_INTERSECTIONS"));
/***************************************************************/
- mainFrame()->GroupConstructors->setTitle(tr("GEOM_CHECK_SELF_INTERSECTIONS"));
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_CHECK_INTERSECT_TYPE"));
mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setIcon(image2);;
+ mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton3->close();
- myGrp = new MeasureGUI_1Sel1TextView2ListBox (centralWidget());
- myGrp->GroupBox1->setTitle(tr("GEOM_CHECK_INFOS"));
- myGrp->TextLabel1->setText(tr("GEOM_OBJECT"));
+ /***************************************************************/
+ /* SIMPLE SELF-INTERSECTION constructor
+ /***************************************************************/
+ mySimpleGrp = new QGroupBox(tr("GEOM_CHECK_INFOS"));
+ QLabel *anObjLbl = new QLabel(tr("GEOM_OBJECT"));
+ QLabel *anInteLbl = new QLabel(tr("GEOM_CHECK_INTE_INTERSECTIONS"));
+ QLabel *aShapeLbl = new QLabel(tr("GEOM_CHECK_INTE_SUBSHAPES"));
+ QLabel *aLevelLbl = new QLabel(tr("GEOM_CHECK_INTE_CHECK_LEVEL"));
+ QLabel *aSummaryLbl1 = new QLabel(tr("GEOM_CHECK_INTE_SUMMARY"));
+ QFont aFont (TEXTEDIT_FONT_FAMILY, TEXTEDIT_FONT_SIZE);
- myGrp->TextView1->setReadOnly(true);
- QFont aFont (TEXTEDIT_FONT_FAMILY, TEXTEDIT_FONT_SIZE);
aFont.setStyleHint(QFont::TypeWriter, QFont::PreferAntialias);
- myGrp->TextView1->setFont(aFont);
+ myTextView1 = new QTextBrowser;
+ myTextView1->setReadOnly(true);
+ myTextView1->setFont(aFont);
+
+ mySelButton1 = new QPushButton;
+ mySelButton1->setIcon(image1);
+ mySelButton1->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+
+ myEditObjName1 = new QLineEdit;
+ myEditObjName1->setReadOnly(true);
+
+ myLevelBox = new QComboBox;
+
+ myComputeButton1 = new QPushButton(tr("GEOM_CHECK_INTE_COMPUTE"));
- myGrp->PushButton1->setIcon(image1);
- myGrp->LineEdit1->setReadOnly(true);
- myGrp->TextLabel2->setText(tr("GEOM_CHECK_BLOCKS_COMPOUND_ERRORS"));
- myGrp->TextLabel3->setText(tr("GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES"));
+ myInteList1 = new QListWidget;
+ myInteList1->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ myShapeList1 = new QListWidget;
+ myShapeList1->setSelectionMode(QAbstractItemView::ExtendedSelection);
- myGrp->ListBox2->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ QGridLayout *aGrpLayout1 = new QGridLayout(mySimpleGrp);
- QVBoxLayout* layout = new QVBoxLayout (centralWidget());
- layout->setMargin(0); layout->setSpacing(6);
- layout->addWidget(myGrp);
+ aGrpLayout1->setMargin(9);
+ aGrpLayout1->setSpacing(6);
+ aGrpLayout1->addWidget(anObjLbl, 0, 0);
+ aGrpLayout1->addWidget(mySelButton1, 0, 1);
+ aGrpLayout1->addWidget(myEditObjName1, 0, 2);
+ aGrpLayout1->addWidget(aLevelLbl, 1, 0);
+ aGrpLayout1->addWidget(myLevelBox, 1, 1, 1, 2);
+ aGrpLayout1->addWidget(myComputeButton1, 2, 0, 1, 3);
+ aGrpLayout1->addWidget(aSummaryLbl1, 3, 0);
+ aGrpLayout1->addWidget(myTextView1, 4, 0, 1, 3);
+ aGrpLayout1->addWidget(anInteLbl, 5, 0);
+ aGrpLayout1->addWidget(aShapeLbl, 5, 2);
+ aGrpLayout1->addWidget(myInteList1, 6, 0, 1, 2);
+ aGrpLayout1->addWidget(myShapeList1, 6, 2);
/***************************************************************/
+ /* FAST SELF-INTERSECTION constructor
+ /***************************************************************/
+
+ myFastGrp = new QGroupBox(tr("GEOM_CHECK_INFOS"), centralWidget());
+ QLabel *anObjLbl2 = new QLabel(tr("GEOM_OBJECT"), myFastGrp);
+ QLabel *aDeflectLbl = new QLabel(tr("GEOM_CHECK_INT_DEFLECT"), myFastGrp);
+ QLabel *aSummaryLbl2 = new QLabel(tr("GEOM_CHECK_INTE_SUMMARY"));
+ QLabel *anInteLbl2 = new QLabel(tr("GEOM_CHECK_INTE_INTERSECTIONS"), myFastGrp);
+ QLabel *aShapeLbl2 = new QLabel(tr("GEOM_CHECK_INTE_SUBSHAPES"), myFastGrp);
+
+ mySelButton2 = new QPushButton(myFastGrp);
+ mySelButton2->setIcon(image1);
+ mySelButton2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+
+ myEditObjName2 = new QLineEdit(myFastGrp);
+ myEditObjName2->setReadOnly(true);
+
+ myDeflection = new SalomeApp_DoubleSpinBox(myFastGrp);
+ myDetGaps = new QCheckBox(tr( "GEOM_CHECK_INT_DETECT_GAPS" ));
+ myTolerance = new SalomeApp_DoubleSpinBox(myFastGrp);
+
+ myComputeButton2 = new QPushButton(tr("GEOM_CHECK_INTE_COMPUTE"));
+
+ myTextView2 = new QTextBrowser;
+ myTextView2->setReadOnly(true);
+ myTextView2->setFont(aFont);
+
+ myInteList2 = new QListWidget(myFastGrp);
+ myInteList2->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ myShapeList2 = new QListWidget(myFastGrp);
+ myShapeList2->setSelectionMode(QAbstractItemView::ExtendedSelection);
+
+ QGridLayout *aGrpLayout2 = new QGridLayout(myFastGrp);
+ aGrpLayout2->setMargin(9);
+ aGrpLayout2->setSpacing(6);
+ aGrpLayout2->addWidget(anObjLbl2, 0, 0);
+ aGrpLayout2->addWidget(mySelButton2, 0, 1);
+ aGrpLayout2->addWidget(myEditObjName2, 0, 2);
+ aGrpLayout2->addWidget(aDeflectLbl, 1, 0);
+ aGrpLayout2->addWidget(myDeflection, 1, 1, 1, 2);
+ aGrpLayout2->addWidget(myDetGaps, 2, 0);
+ aGrpLayout2->addWidget(myTolerance, 2, 1, 1, 2);
+ aGrpLayout2->addWidget(myComputeButton2, 3, 0, 1, 3);
+ aGrpLayout2->addWidget(aSummaryLbl2, 4, 0);
+ aGrpLayout2->addWidget(myTextView2, 5, 0, 1, 3);
+ aGrpLayout2->addWidget(anInteLbl2, 6, 0);
+ aGrpLayout2->addWidget(aShapeLbl2, 6, 1, 1, 2);
+ aGrpLayout2->addWidget(myInteList2, 7, 0);
+ aGrpLayout2->addWidget(myShapeList2, 7, 1, 1, 2);
+
+ /***************************************************************/
+
+ QVBoxLayout* layout2 = new QVBoxLayout (centralWidget());
+ layout2->setMargin(0); layout2->setSpacing(6);
+ layout2->addWidget(mySimpleGrp);
+ layout2->addWidget(myFastGrp);
+
+ /***************************************************************/
myHelpFileName = "check_self_intersections_page.html";
//=================================================================================
void MeasureGUI_CheckSelfIntersectionsDlg::Init()
{
- mySelBtn = myGrp->PushButton1;
- mySelEdit = myGrp->LineEdit1;
- MeasureGUI_Skeleton::Init();
+ // Fill in the combo box.
+ myLevelBox->insertItem(GEOM::SI_V_V, tr("GEOM_CHECK_INTE_V_V"));
+ myLevelBox->insertItem(GEOM::SI_V_E, tr("GEOM_CHECK_INTE_V_E"));
+ myLevelBox->insertItem(GEOM::SI_E_E, tr("GEOM_CHECK_INTE_E_E"));
+ myLevelBox->insertItem(GEOM::SI_V_F, tr("GEOM_CHECK_INTE_V_F"));
+ myLevelBox->insertItem(GEOM::SI_E_F, tr("GEOM_CHECK_INTE_E_F"));
+ myLevelBox->insertItem(GEOM::SI_ALL, tr("GEOM_CHECK_INTE_ALL"));
+ myLevelBox->setCurrentIndex(GEOM::SI_ALL);
+ myComputeButton1->setEnabled(false);
+
+ connect(mySelButton1, SIGNAL(clicked()),
+ this, SLOT(SetEditCurrentArgument()));
+ connect(myInteList1, SIGNAL(itemSelectionChanged()),
+ SLOT(onInteListSelectionChanged()));
+ connect(myShapeList1, SIGNAL(itemSelectionChanged()),
+ SLOT(onSubShapesListSelectionChanged()));
+ connect(myLevelBox, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(clear()));
+ connect(myComputeButton1, SIGNAL(clicked()), this, SLOT(onCompute()));
- connect(myGrp->ListBox1, SIGNAL(itemSelectionChanged()), SLOT(onErrorsListSelectionChanged()));
- connect(myGrp->ListBox2, SIGNAL(itemSelectionChanged()), SLOT(onSubShapesListSelectionChanged()));
+ /***************************************************************/
+ myObj2.nullify();
+ myEditObjName2->setText("");
+ myEditObjName2->setEnabled(true);
+
+ myDetGaps->setChecked(false);
+ initSpinBox(myTolerance, 0, MAX_NUMBER, 1);
+ myTolerance->setValue(0);
+ myTolerance->setEnabled(false);
+ myComputeButton2->setEnabled(false);
+
+ // Obtain deflection from preferences
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ initSpinBox(myDeflection, 1e-3, 1.0, 1e-3);
+ myDeflection->setValue(qMax(1e-3, resMgr->doubleValue("Geometry", "deflection_coeff", 1e-3)));
+
+ connect( mySelButton2, SIGNAL(clicked()),
+ this, SLOT(SetEditCurrentArgument()));
+ connect( myDetGaps, SIGNAL(toggled(bool)), this, SLOT(OnGaps(bool)));
+ connect( myTolerance, SIGNAL(valueChanged(double)), this, SLOT(clear()));
+ connect( myDeflection, SIGNAL(valueChanged(double)), this, SLOT(clear()));
+ connect( myInteList2, SIGNAL(itemSelectionChanged()),
+ SLOT(onInteListSelectionChanged()));
+ connect( myShapeList2, SIGNAL(itemSelectionChanged()),
+ SLOT(onSubShapesListSelectionChanged()));
+ connect( myComputeButton2, SIGNAL(clicked()), this, SLOT(onCompute()));
+
+ /***************************************************************/
+
+ connect(this, SIGNAL(constructorsClicked(int)),
+ this, SLOT(ConstructorsClicked(int)));
+ connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()),
+ this, SLOT(DeactivateActiveDialog()));
+ connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()),
+ this, SLOT(ClickOnCancel()));
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ LightApp_SelectionMgr* aSel = myGeomGUI->getApp()->selectionMgr();
+ connect(aSel, SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ initName( tr( "GEOM_SELF_INTERSECTION_NAME") );
+ buttonOk()->setEnabled(false);
+ buttonApply()->setEnabled(false);
+
+ ConstructorsClicked(0);
+
+ activateSelection();
+ SelectionIntoArgument();
}
//=================================================================================
-// function : processObject
+// function : clear
// purpose :
//=================================================================================
-void MeasureGUI_CheckSelfIntersectionsDlg::processObject()
+void MeasureGUI_CheckSelfIntersectionsDlg::clear()
{
- myGrp->ListBox1->clear();
- myGrp->ListBox2->clear();
+ getTextView()->setText("");
+ getComputeButton()->setEnabled(true);
+
+ getInteList()->blockSignals(true);
+ getShapeList()->blockSignals(true);
+ getInteList()->clear();
+ getShapeList()->clear();
+ getInteList()->blockSignals(false);
+ getShapeList()->blockSignals(false);
+
erasePreview();
+ buttonOk()->setEnabled(false);
+ buttonApply()->setEnabled(false);
+}
- if (myObj->_is_nil())
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void MeasureGUI_CheckSelfIntersectionsDlg::ConstructorsClicked(int constructorId)
+{
+ if (myCurrConstrId == constructorId)
return;
- QString aMsg ("");
- GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
- bool isGood = false, isFailed = false;
- int nbPairs = 0;
- try {
- isGood = anOper->CheckSelfIntersections(myObj, myInters);
- nbPairs = myInters->length()/2;
- if (nbPairs*2 != myInters->length()) {
- isFailed = true;
- }
- }
- catch (const SALOME::SALOME_Exception& e) {
- SalomeApp_Tools::QtCatchCorbaException(e);
- isFailed = true;
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+
+ switch (constructorId) {
+ case 0:
+ mySimpleGrp->show();
+ myFastGrp->hide();
+ break;
+ case 1:
+ mySimpleGrp->hide();
+ myFastGrp->show();
+ break;
}
- if (!anOper->IsDone() && myInters->length() == 0) {
- aMsg += tr(anOper->GetErrorCode());
- myGrp->TextView1->setText(aMsg);
- return;
- }
- else if (isFailed) {
- aMsg += tr("GEOM_CHECK_SELF_INTERSECTIONS_FAILED");
- myGrp->TextView1->setText(aMsg);
+ myCurrConstrId = constructorId;
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ qApp->processEvents();
+ updateGeometry();
+ resize(minimumSizeHint());
+
+ processPreview();
+ //updateButtonState();
+ activateSelection();
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : onCompute
+// purpose :
+//=================================================================================
+void MeasureGUI_CheckSelfIntersectionsDlg::onCompute()
+{
+ bool hasSelfInte = false;
+ QString anErrMsg("");
+
+ if (!findSelfIntersections(hasSelfInte, anErrMsg)) {
+ getTextView()->setText(anErrMsg);
return;
}
- // Status
- if (isGood) {
- aMsg += tr("GEOM_NO_SELF_INTERSECTIONS");
- }
- else {
+ // Status and apply buttons
+ QString aMsg("");
+
+ if (hasSelfInte) {
aMsg += tr("GEOM_SELF_INTERSECTIONS_FOUND");
+ buttonOk()->setEnabled(true);
+ buttonApply()->setEnabled(true);
+ } else {
+ aMsg += tr("GEOM_NO_SELF_INTERSECTIONS");
}
- if (!anOper->IsDone()) {
+ if (!anErrMsg.isEmpty()) {
aMsg += "\n\n";
- aMsg += tr("GEOM_CHECK_SELF_INTERSECTIONS_ERRORS");
+ aMsg += anErrMsg;
}
- myGrp->TextView1->setText(aMsg);
+ getTextView()->setText(aMsg);
// Pairs
- QStringList aErrList;
- QString aErrStr ("");
+ QStringList anInteList;
+ QString anInteStr ("");
+ int nbPairs = getInters()->length()/2;
+
for (int i = 1; i <= nbPairs; i++) {
- aErrStr = "Intersection # ";
- aErrStr += QString::number(i);
- aErrList.append(aErrStr);
+ anInteStr = "Intersection # ";
+ anInteStr += QString::number(i);
+ anInteList.append(anInteStr);
}
- myGrp->ListBox1->addItems(aErrList);
+ getInteList()->addItems(anInteList);
+ getComputeButton()->setEnabled(false);
}
//=================================================================================
-// function : onErrorsListSelectionChanged
+// function : ActivateThisDialog
// purpose :
//=================================================================================
-void MeasureGUI_CheckSelfIntersectionsDlg::onErrorsListSelectionChanged()
+void MeasureGUI_CheckSelfIntersectionsDlg::ActivateThisDialog()
{
- erasePreview();
- int aCurItem = myGrp->ListBox1->currentRow();
- if (aCurItem < 0)
- return;
+ GEOMBase_Skeleton::ActivateThisDialog();
+
+ LightApp_SelectionMgr* aSel = myGeomGUI->getApp()->selectionMgr();
+ if ( aSel )
+ connect( aSel, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- //int nbPairs = myInters->length()/2;
+ activateSelection();
+ DISPLAY_PREVIEW_MACRO
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose : public slot to deactivate if active
+//=================================================================================
+void MeasureGUI_CheckSelfIntersectionsDlg::DeactivateActiveDialog()
+{
+ GEOMBase_Skeleton::DeactivateActiveDialog();
+}
+
+//=================================================================================
+// function : activateSelection
+// purpose :
+//=================================================================================
+void MeasureGUI_CheckSelfIntersectionsDlg::activateSelection()
+{
+ switch (getConstructorId()) {
+ case 0:
+ globalSelection(GEOM_ALLSHAPES);
+ break;
+ case 1:
+ TColStd_MapOfInteger aTypes;
+ aTypes.Add(GEOM_COMPOUND );
+ aTypes.Add(GEOM_SOLID );
+ aTypes.Add(GEOM_SHELL);
+ aTypes.Add(GEOM_FACE);
+ globalSelection(aTypes);
+
+ std::list<int> needTypes;
+ needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ), needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPOUND );
+ localSelection( needTypes );
+ break;
+ }
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void MeasureGUI_CheckSelfIntersectionsDlg::ClickOnOk()
+{
+ if ( ClickOnApply() )
+ ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool MeasureGUI_CheckSelfIntersectionsDlg::ClickOnApply()
+{
+ if ( !onAccept() )
+ return false;
+
+ clear();
+ initName();
+
+ ConstructorsClicked(getConstructorId());
+
+ return true;
+}
+
+//=================================================================================
+// function : extractPrefix
+// purpose :
+//=================================================================================
+bool MeasureGUI_CheckSelfIntersectionsDlg::extractPrefix() const
+{
+ return true;
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr MeasureGUI_CheckSelfIntersectionsDlg::createOperation()
+{
+ return getGeomEngine()->GetIMeasureOperations( getStudyId() );
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool MeasureGUI_CheckSelfIntersectionsDlg::isValid( QString& )
+{
+ return !getObj().isNull();
+}
+
+//=================================================================================
+// function : SetEditCurrentArgument
+// purpose :
+//=================================================================================
+void MeasureGUI_CheckSelfIntersectionsDlg::SetEditCurrentArgument()
+{
+ getEditObjName()->setFocus();
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : OnGaps()
+// purpose :
+//=================================================================================
+void MeasureGUI_CheckSelfIntersectionsDlg::OnGaps(bool checked)
+{
+ clear();
+ myTolerance->setEnabled(checked);
+}
+//=================================================================================
+// function : SelectionIntoArgument
+// purpose :
+//=================================================================================
+void MeasureGUI_CheckSelfIntersectionsDlg::SelectionIntoArgument()
+{
+ QList<TopAbs_ShapeEnum> typesLst;
+
+ if ( getConstructorId() == 0 ) {
+ typesLst << TopAbs_COMPOUND
+ << TopAbs_COMPSOLID
+ << TopAbs_SOLID
+ << TopAbs_SHELL
+ << TopAbs_FACE
+ << TopAbs_WIRE
+ << TopAbs_EDGE
+ << TopAbs_VERTEX
+ << TopAbs_SHAPE;
+ } else {
+ typesLst << TopAbs_FACE
+ << TopAbs_SHELL
+ << TopAbs_SOLID
+ << TopAbs_COMPOUND;
+ }
+
+ // Clear the dialog.
+ clear();
+
+ GEOM::GeomObjPtr aSelectedObject = getSelected( typesLst );
+
+ (getConstructorId() == 0 ? myObj1 :myObj2) = aSelectedObject;
+ getEditObjName()->setText(getObj() ? GEOMBase::GetName(getObj().get()) : "");
+}
+
+//=================================================================================
+// function : enterEvent
+// purpose :
+//=================================================================================
+void MeasureGUI_CheckSelfIntersectionsDlg::enterEvent(QEvent *)
+{
+ if ( !mainFrame()->GroupConstructors->isEnabled() )
+ ActivateThisDialog();
+}
+
+//=================================================================================
+// function : findSelfIntersections
+// purpose :
+//=================================================================================
+bool MeasureGUI_CheckSelfIntersectionsDlg::findSelfIntersections
+ (bool &HasSelfInte, QString &theErrMsg)
+{
+ if (getObj()->_is_nil()) {
+ return false;
+ }
+
+ GEOM::GEOM_IMeasureOperations_var anOper =
+ GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
+ bool isOK = true;
+ int nbPairs = 0;
+ int aLevel = myLevelBox->currentIndex();
+
+ SUIT_OverrideCursor wc;
+
+ try {
+ if ( getConstructorId() == 0 ) {
+ HasSelfInte = !anOper->CheckSelfIntersections(myObj1.get(), aLevel, myInters1);
+ } else {
+ HasSelfInte = !anOper->CheckSelfIntersectionsFast(myObj2.get(), getDeflection(), getTolerance(), myInters2);
+ }
+ nbPairs = getInters()->length()/2;
+
+ if (nbPairs*2 != getInters()->length()) {
+ isOK = false;
+ }
+ }
+ catch (const SALOME::SALOME_Exception& e) {
+ SalomeApp_Tools::QtCatchCorbaException(e);
+ isOK = false;
+ }
+
+ if (!anOper->IsDone()) {
+ if (getInters()->length() == 0) {
+ theErrMsg = tr(anOper->GetErrorCode());
+ isOK = false;
+ } else {
+ // Valid case. Display all computed self-intersections
+ theErrMsg = tr("GEOM_CHECK_SELF_INTERSECTIONS_ERRORS");
+ }
+ } else if (!isOK) {
+ theErrMsg = tr("GEOM_CHECK_SELF_INTERSECTIONS_FAILED");
+ }
+
+ return isOK;
+}
+
+//=================================================================================
+// function : onInteListSelectionChanged
+// purpose :
+//=================================================================================
+void MeasureGUI_CheckSelfIntersectionsDlg::onInteListSelectionChanged()
+{
+ erasePreview();
+ getShapeList()->clear();
- QStringList aSubShapeList;
TopoDS_Shape aSelShape;
- if (!myObj->_is_nil() && GEOMBase::GetShape(myObj, aSelShape)) {
+ if (!getObj()->_is_nil() && GEOMBase::GetShape(getObj().get(), aSelShape)) {
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aSelShape, anIndices);
- TopoDS_Shape aSubShape = anIndices.FindKey(myInters[aCurItem*2]);
- QString aType = GEOMBase::GetShapeTypeString(aSubShape);
- if (!aType.isEmpty())
- aSubShapeList.append(QString("%1_%2").arg(aType).arg(myInters[aCurItem*2]));
- aSubShape = anIndices.FindKey(myInters[aCurItem*2 + 1]);
- aType = GEOMBase::GetShapeTypeString(aSubShape);
- if (!aType.isEmpty())
- aSubShapeList.append(QString("%1_%2").arg(aType).arg(myInters[aCurItem*2 + 1]));
+ int nbSelected = getInteList()->selectedItems().size();
+
+ for (int i = 0; i < getInteList()->count(); i++) {
+ if ( getInteList()->item(i)->isSelected() ) {
+ if ( nbSelected > 1 )
+ getShapeList()->addItem(QString("--- #%1 ---").arg(i+1));
+ for (int j = 0; j < 2; j++) {
+ TopoDS_Shape aSubShape = anIndices.FindKey(getInters()[i*2+j]);
+ QString aType = GEOMBase::GetShapeTypeString(aSubShape);
+ getShapeList()->addItem(QString("%1_%2").arg(aType).arg(getInters()[i*2+j]));
+ getShapeList()->item(getShapeList()->count()-1)->setData(Qt::UserRole, getInters()[i*2+j]);
+ }
+ }
+ }
}
- myGrp->ListBox2->clear();
- myGrp->ListBox2->addItems(aSubShapeList);
}
//=================================================================================
{
erasePreview();
- // Current pair
- int aErrCurItem = myGrp->ListBox1->currentRow();
- if (aErrCurItem < 0)
- return;
-
// Selected IDs
+ QList<QListWidgetItem*> selected = getShapeList()->selectedItems();
QList<int> aIds;
- for (int i = 0, n = myGrp->ListBox2->count(); i < n; i++) {
- if (myGrp->ListBox2->item(i)->isSelected())
- aIds.append(i);
+ foreach(QListWidgetItem* item, selected) {
+ int idx = item->data(Qt::UserRole).toInt();
+ if (idx > 0 && aIds.indexOf(idx) < 0) aIds.append(idx);
}
- if (aIds.count() < 1)
- return;
+
+ if (aIds.empty()) return;
TopoDS_Shape aSelShape;
TopoDS_Shape aSubShape;
TopTools_IndexedMapOfShape anIndices;
- if (!myObj->_is_nil() && GEOMBase::GetShape(myObj, aSelShape)) {
- SALOME_Prs* aPrs = 0;
+ if (!getObj()->_is_nil() && GEOMBase::GetShape(getObj().get(), aSelShape)) {
TopExp::MapShapes(aSelShape, anIndices);
- QList<int>::iterator it;
- for (it = aIds.begin(); it != aIds.end(); ++it) {
- aSubShape = anIndices.FindKey(myInters[aErrCurItem*2 + (*it)]);
+ getDisplayer()->SetColor(Quantity_NOC_RED);
+ getDisplayer()->SetWidth(3);
+ getDisplayer()->SetToActivate(false);
+ foreach(int idx, aIds) {
+ aSubShape = anIndices.FindKey(idx);
try {
- getDisplayer()->SetColor(Quantity_NOC_RED);
- getDisplayer()->SetWidth(3);
- getDisplayer()->SetToActivate(false);
- aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs(aSubShape) : 0;
- if (aPrs)
- displayPreview(aPrs, true);
+ SALOME_Prs* aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs(aSubShape) : 0;
+ if (aPrs) displayPreview(aPrs, true);
}
catch (const SALOME::SALOME_Exception& e) {
- SalomeApp_Tools::QtCatchCorbaException(e);
+ SalomeApp_Tools::QtCatchCorbaException(e);
}
}
}
}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool MeasureGUI_CheckSelfIntersectionsDlg::execute(ObjectList& objects)
+{
+ bool hasSelfInte;
+ QString anErrMsg;
+
+ if (!findSelfIntersections(hasSelfInte, anErrMsg)) {
+ return false;
+ }
+
+ TColStd_IndexedMapOfInteger aMapIndex;
+ QList<int> pairs;
+
+ int nbSelected = getInteList()->selectedItems().size();
+
+ // Collect the map of indices
+ for (int i = 0; i < getInteList()->count(); i++) {
+ if ( nbSelected < 1 || getInteList()->item(i)->isSelected() ) {
+ aMapIndex.Add(getInters()[i*2]);
+ aMapIndex.Add(getInters()[i*2 + 1]);
+ pairs << getInters()[i*2];
+ pairs << getInters()[i*2 + 1];
+ }
+ }
+
+ GEOM::ShapesOpPtr shapesOper = getGeomEngine()->GetIShapesOperations(getStudyId());
+
+ // Explode sub-shapes
+ GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
+ anArray->length(aMapIndex.Extent());
+
+ for (int i = 1; i <= aMapIndex.Extent(); i++)
+ anArray[i-1] = aMapIndex.FindKey(i);
+
+ GEOM::ListOfGO_var aList = shapesOper->MakeSubShapes(getObj().get(), anArray);
+
+ // Make compounds
+ for (int i = 0; i < pairs.count()/2; i++) {
+ GEOM::ListOfGO_var aPair = new GEOM::ListOfGO();
+ aPair->length(2);
+ aPair[0] = aList[ aMapIndex.FindIndex(pairs[i*2]) - 1 ];
+ aPair[1] = aList[ aMapIndex.FindIndex(pairs[i*2+1]) - 1 ];
+ GEOM::GEOM_Object_var aCompound = shapesOper->MakeCompound( aPair );
+ objects.push_back(aCompound._retn());
+ }
+
+ return true;
+}
+
+//=================================================================================
+// function : getDeflection
+// purpose :
+//=================================================================================
+float MeasureGUI_CheckSelfIntersectionsDlg::getDeflection()
+{
+ return (float)myDeflection->value();
+}
+
+//=================================================================================
+// function : getTolerance
+// purpose :
+//=================================================================================
+double MeasureGUI_CheckSelfIntersectionsDlg::getTolerance()
+{
+ double aVal = myTolerance->value();
+ if (!myDetGaps->isChecked() || aVal < 0.0)
+ return 0.0;
+ return aVal;
+}
+
+//================================================================
+// Function : getFather
+// Purpose : Get father object for object to be added in study
+// (called with addInStudy method)
+//================================================================
+GEOM::GEOM_Object_ptr MeasureGUI_CheckSelfIntersectionsDlg::getFather
+ (GEOM::GEOM_Object_ptr)
+{
+ return getObj().get();
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> MeasureGUI_CheckSelfIntersectionsDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << getObj();
+ return res;
+}
+
+//=================================================================================
+// GETTERS
+//=================================================================================
+QTextBrowser* MeasureGUI_CheckSelfIntersectionsDlg::getTextView()
+{
+ return ( getConstructorId() == 0 ? myTextView1 : myTextView2 );
+}
+
+QListWidget* MeasureGUI_CheckSelfIntersectionsDlg::getInteList()
+{
+ return ( getConstructorId() == 0 ? myInteList1 : myInteList2 );
+}
+
+QListWidget* MeasureGUI_CheckSelfIntersectionsDlg::getShapeList()
+{
+ return ( getConstructorId() == 0 ? myShapeList1 : myShapeList2 );
+}
+
+QPushButton* MeasureGUI_CheckSelfIntersectionsDlg::getComputeButton()
+{
+ return ( getConstructorId() == 0 ? myComputeButton1 : myComputeButton2 );
+}
+
+QLineEdit* MeasureGUI_CheckSelfIntersectionsDlg::getEditObjName()
+{
+ return ( getConstructorId() == 0 ? myEditObjName1 : myEditObjName2 );
+}
+
+GEOM::GeomObjPtr MeasureGUI_CheckSelfIntersectionsDlg::getObj()
+{
+ return ( getConstructorId() == 0 ? myObj1 : myObj2 );
+}
+
+GEOM::ListOfLong_var MeasureGUI_CheckSelfIntersectionsDlg::getInters()
+{
+ return ( getConstructorId() == 0 ? myInters1 : myInters2 );
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#ifndef MEASUREGUI_CHECKSELFINTERDLG_H
#define MEASUREGUI_CHECKSELFINTERDLG_H
-#include <MeasureGUI_Skeleton.h>
+#include <GEOMBase_Skeleton.h>
+
+class QComboBox;
+class QListWidget;
+class QTextBrowser;
-class MeasureGUI_1Sel1TextView2ListBox;
//=================================================================================
// class : MeasureGUI_CheckSelfIntersectionsDlg
// purpose :
//=================================================================================
-class MeasureGUI_CheckSelfIntersectionsDlg : public MeasureGUI_Skeleton
+class MeasureGUI_CheckSelfIntersectionsDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
+
MeasureGUI_CheckSelfIntersectionsDlg(GeometryGUI*, QWidget*);
~MeasureGUI_CheckSelfIntersectionsDlg();
protected:
- // redefined from GEOMBase_Helper and MeasureGUI_Skeleton
- virtual void processObject();
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid(QString &);
+ virtual bool execute(ObjectList &);
+ virtual bool extractPrefix() const;
+ virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private slots:
- void onErrorsListSelectionChanged();
+
+ void onInteListSelectionChanged();
void onSubShapesListSelectionChanged();
+ void clear();
+ void onCompute();
+ void ClickOnOk();
+ bool ClickOnApply();
+ void ActivateThisDialog();
+ void DeactivateActiveDialog();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
+ void ConstructorsClicked (int);
+ void OnGaps(bool);
+
private:
+
void Init();
+ void activateSelection();
+ void enterEvent(QEvent *);
+ bool findSelfIntersections
+ (bool &HasSelfInte,
+ QString &theErrMsg);
+ float getDeflection();
+ double getTolerance();
+
+// Getters
+ QTextBrowser* getTextView();
+ QListWidget* getInteList();
+ QListWidget* getShapeList();
+ QPushButton* getComputeButton();
+ QLineEdit* getEditObjName();
+ GEOM::GeomObjPtr getObj();
+ GEOM::ListOfLong_var getInters();
-private:
- MeasureGUI_1Sel1TextView2ListBox* myGrp;
- GEOM::ListOfLong_var myInters;
+private:
+ int myCurrConstrId;
+ // simple
+ QPushButton *myComputeButton1;
+ QGroupBox *mySimpleGrp;
+ QTextBrowser *myTextView1;
+ QPushButton *mySelButton1;
+ QLineEdit *myEditObjName1;
+ QComboBox *myLevelBox;
+ QListWidget *myInteList1;
+ QListWidget *myShapeList1;
+ GEOM::GeomObjPtr myObj1;
+ GEOM::ListOfLong_var myInters1;
+ // fast
+ QPushButton *myComputeButton2;
+ QGroupBox *myFastGrp;
+ QTextBrowser *myTextView2;
+ QPushButton *mySelButton2;
+ QLineEdit *myEditObjName2;
+ QCheckBox *myDetGaps;
+ SalomeApp_DoubleSpinBox *myTolerance;
+ SalomeApp_DoubleSpinBox *myDeflection;
+ QListWidget *myInteList2;
+ QListWidget *myShapeList2;
+ GEOM::GeomObjPtr myObj2;
+ GEOM::ListOfLong_var myInters2;
+ GEOM::GEOM_IShapesOperations_var myShapesOper;
};
#endif // MEASUREGUI_CHECKSELFINTERDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
QColor aQColor = aResMgr->colorValue ( "Geometry", "dimensions_color", QColor( 0, 255, 0 ) );
int aLineWidth = aResMgr->integerValue( "Geometry", "dimensions_line_width", 1 );
- double aFontHeight = aResMgr->doubleValue ( "Geometry", "dimensions_font_height", 10 );
+ QFont aFont = aResMgr->fontValue ( "Geometry", "dimensions_font", QFont("Y14.5M-2009", 14) );
double anArrowLength = aResMgr->doubleValue ( "Geometry", "dimensions_arrow_length", 5 );
double aDefFlyout = aResMgr->doubleValue ( "Geometry", "dimensions_default_flyout", 20 );
bool isUnitsShown = aResMgr->booleanValue( "Geometry", "dimensions_show_units", false );
QString aUnitsLength = aResMgr->stringValue ( "Geometry", "dimensions_length_units", "m" );
QString aUnitsAngle = aResMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" );
+ bool aUseText3d = aResMgr->booleanValue( "Geometry", "dimensions_use_text3d", false );
OCCViewer_ViewWindow* anActiveView = NULL;
aStyle->SetCommonColor( aColor );
aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown );
- aStyle->MakeText3d( Standard_True );
+ aStyle->MakeText3d( aUseText3d );
aStyle->MakeTextShaded( Standard_True );
- aStyle->SetExtensionSize( aFontHeight * 0.5 );
- aStyle->TextAspect()->SetHeight( aFontHeight );
+ int fsize = aFont.pixelSize() != -1 ? aFont.pixelSize() : aFont.pointSize();
+ aStyle->SetExtensionSize( fsize * 0.5 );
+ aStyle->TextAspect()->SetFont( aFont.family().toLatin1().data() );
+ aStyle->TextAspect()->SetHeight( fsize );
aStyle->ArrowAspect()->SetLength( anArrowLength );
aStyle->LineAspect()->SetWidth( aLineWidth );
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
return false;
}
+ // commented by mpa 18.03.2015: since OCCT version 6.8.0 it's impossible
+ // to change position of the dimensions presentations (flyout, text),
+ // because anAISContext has 2 detected objects.
+
// check that there is only one detected entity
- anAISContext->InitDetected();
- if ( anAISContext->MoreDetected() )
+ //anAISContext->InitDetected();
+ //if ( anAISContext->MoreDetected() )
+ //{
+ // return false;
+ //}
+
+ Handle(SelectMgr_EntityOwner) aDetectedOwner = anAISContext->DetectedOwner();
+ if( aDetectedOwner.IsNull() )
{
return false;
}
- Handle(SelectMgr_EntityOwner) aDetectedOwner = anAISContext->DetectedOwner();
-
myInteractedIO = Handle(AIS_Dimension)::DownCast( aDetectedOwner->Selectable() );
// try to start operation for the detected entity
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// OCCT Includes
#include <Geom_Plane.hxx>
#include <AIS_LengthDimension.hxx>
-#include <AIS_Drawer.hxx>
#include <Prs3d_LineAspect.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
myEditCurrentArgument = myGrp->LineEdit1;
myDbls = new GEOM::ListOfDouble();
+ myGrp->LineEdit1->setEnabled(true);
+ myGrp->LineEdit2->setEnabled(false);
+
+ myObj1.nullify();
+ myObj2.nullify();
+
// signals and slots connections
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
- globalSelection();
+ activateSelection();
SelectionIntoArgument();
}
return false;
initName();
+ activateSelection();
return true;
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
- globalSelection();
+ activateSelection();
redisplayPreview();
}
//=================================================================================
void MeasureGUI_DistanceDlg::SelectionIntoArgument()
{
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
-
- GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
-
- if (aSelList.Extent() > 0) {
- aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First());
- }
+ QList<TopAbs_ShapeEnum> aTypes;
+ aTypes << TopAbs_VERTEX << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE << TopAbs_SHELL << TopAbs_SOLID << TopAbs_COMPSOLID << TopAbs_COMPOUND << TopAbs_SHAPE;
+ GEOM::GeomObjPtr aSelectedObject = getSelected( aTypes );
// clear selection
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
if (myEditCurrentArgument == myGrp->LineEdit1) {
myObj1 = aSelectedObject;
- if (!myObj1->_is_nil() && myObj2->_is_nil())
+ if (myObj1 && !myObj2)
myGrp->PushButton2->click();
}
else {
myObj2 = aSelectedObject;
- if (!myObj2->_is_nil() && myObj1->_is_nil())
+ if (myObj2 && !myObj1)
myGrp->PushButton1->click();
}
//=================================================================================
void MeasureGUI_DistanceDlg::processObject()
{
- myGrp->LineEdit1->setText(!myObj1->_is_nil() ? GEOMBase::GetName(myObj1) : "");
- myGrp->LineEdit2->setText(!myObj2->_is_nil() ? GEOMBase::GetName(myObj2) : "");
+ myGrp->LineEdit1->setText(myObj1 ? GEOMBase::GetName(myObj1.get()) : "");
+ myGrp->LineEdit2->setText(myObj2 ? GEOMBase::GetName(myObj2.get()) : "");
myGrp->ComboBox1->clear();
myDbls->length(0);
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
try {
- nbSols = anOper->ClosestPoints(myObj1, myObj2, myDbls);
+ nbSols = anOper->ClosestPoints(myObj1.get(), myObj2.get(), myDbls);
}
catch (const SALOME::SALOME_Exception& e) {
SalomeApp_Tools::QtCatchCorbaException(e);
int currSol = myGrp->ComboBox1->currentIndex();
- if (myObj1->_is_nil() || myObj2->_is_nil() ||
+ if (!myObj1 || !myObj2 ||
currSol == -1 || (currSol+1)*6 > myDbls->length() ||
vw->getViewManager()->getType() != OCCViewer_Viewer::Type())
return 0;
//=================================================================================
bool MeasureGUI_DistanceDlg::isValid (QString& msg)
{
- return !myObj1->_is_nil() && !myObj2->_is_nil();
+ return myObj1 && myObj2;
}
//=================================================================================
GEOM::GEOM_IBasicOperations_var aBasicOper = getGeomEngine()->GetIBasicOperations(getStudyId());
GEOM::ListOfDouble_var aDbls;
- int nbSols = anOper->ClosestPoints(myObj1, myObj2, aDbls);
+ int nbSols = anOper->ClosestPoints(myObj1.get(), myObj2.get(), aDbls);
if (anOper->IsDone()) {
bool doPublishAll = true;
return true;
}
+//=================================================================================
+// function : activateSelection()
+// purpose :
+//=================================================================================
+void MeasureGUI_DistanceDlg::activateSelection()
+{
+ globalSelection( GEOM_ALLSHAPES );
+ localSelection( TopAbs_SHAPE );
+}
+
//=================================================================================
// function : redisplayPreview()
// purpose :
erasePreview(false);
try {
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
getDisplayer()->SetColor(Quantity_NOC_VIOLET);
getDisplayer()->SetToActivate(false);
QString MeasureGUI_DistanceDlg::getNewObjectName (int currObj) const
{
QString aName = tr("GEOM_MINDIST_NAME") + QString("_%1_").arg((currObj+1)/2);
- aName += GEOMBase::GetName(currObj%2 ? myObj1 : myObj2);
+ aName += GEOMBase::GetName(currObj%2 ? myObj1.get() : myObj2.get());
return aName;
}
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void MeasureGUI_DistanceDlg::addSubshapesToStudy()
+{
+ GEOMBase::PublishSubObject( myObj1.get() );
+ GEOMBase::PublishSubObject( myObj2.get() );
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> MeasureGUI_DistanceDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myObj1 << myObj2;
+ return res;
+}
+
//=================================================================================
// function : MeasureGUI_DistanceGroup
// purpose :
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
+ virtual void addSubshapesToStudy();
virtual QString getNewObjectName (int CurrObj = -1) const;
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
void redisplayPreview();
virtual void processObject();
private:
void Init();
void enterEvent (QEvent*);
+ void activateSelection();
private:
- GEOM::GEOM_Object_var myObj1;
- GEOM::GEOM_Object_var myObj2;
+ GEOM::GeomObjPtr myObj1;
+ GEOM::GeomObjPtr myObj2;
MeasureGUI_DistanceGroup* myGrp;
GEOM::ListOfDouble_var myDbls;
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : MeasureGUI_FastCheckIntersectionsDlg.cxx
+
+#include "MeasureGUI_FastCheckIntersectionsDlg.h"
+#include "MeasureGUI.h"
+
+#include <SUIT_OverrideCursor.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_MessageBox.h>
+#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Tools.h>
+#include <SalomeApp_Application.h>
+
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
+
+#include <DlgRef.h>
+#include <GeometryGUI.h>
+#include <GEOMBase.h>
+#include <GEOMImpl_Types.hxx>
+
+#include <QListWidget>
+
+#define TEXTEDIT_FONT_FAMILY "Courier"
+#define TEXTEDIT_FONT_SIZE 11
+//=================================================================================
+// class : MeasureGUI_FastCheckIntersectionsDlg()
+// purpose : Constructs a MeasureGUI_FastCheckIntersectionsDlg which is a child of 'parent', with the
+// name 'name' and widget flags set to 'f'.
+// The dialog will by default be modeless, unless you set 'modal' to
+// true to construct a modal dialog.
+//=================================================================================
+MeasureGUI_FastCheckIntersectionsDlg::MeasureGUI_FastCheckIntersectionsDlg (GeometryGUI* GUI, QWidget* parent)
+ : GEOMBase_Skeleton (GUI, parent, false)
+{
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FAST_CHECK_INTERSECTIONS")));
+ QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
+
+ setWindowTitle(tr("GEOM_FAST_CHECK_INTERSECTIONS"));
+
+ /***************************************************************/
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_FAST_CHECK_INTERSECTIONS"));
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton3->close();
+
+ QGroupBox* aGrp = new QGroupBox(tr("GEOM_FAST_CHECK_OBJ"), centralWidget());
+ QLabel* anObjLbl1 = new QLabel(tr("GEOM_OBJECT_I").arg("1"), aGrp);
+ QLabel* anObjLbl2 = new QLabel(tr("GEOM_OBJECT_I").arg("2"), aGrp);
+ QLabel* aShapeLbl1 = new QLabel(tr("GEOM_FAST_CHECK_INT_SUBSHAPES").arg("1"), aGrp);
+ QLabel* aShapeLbl2 = new QLabel(tr("GEOM_FAST_CHECK_INT_SUBSHAPES").arg("2"), aGrp);
+ QLabel* aDeflectLbl = new QLabel(tr("GEOM_FAST_CHECK_INT_DEFLECT"), aGrp);
+
+ mySelButton1 = new QPushButton(aGrp);
+ mySelButton1->setIcon(image1);
+ mySelButton1->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ mySelButton2 = new QPushButton(aGrp);
+ mySelButton2->setIcon(image1);
+ mySelButton2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+
+ myEditObjName1 = new QLineEdit(aGrp);
+ myEditObjName1->setReadOnly(true);
+ myEditObjName2 = new QLineEdit(aGrp);
+ myEditObjName2->setReadOnly(true);
+
+ myDetGaps = new QCheckBox(tr( "GEOM_FAST_CHECK_INT_DETECT_GAPS" ));
+ myTolerance = new SalomeApp_DoubleSpinBox(aGrp);
+ myDeflection = new SalomeApp_DoubleSpinBox(aGrp);
+ myShapeList1 = new QListWidget(aGrp);
+ myShapeList2 = new QListWidget(aGrp);
+ myShapeList1->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ myShapeList2->setSelectionMode(QAbstractItemView::ExtendedSelection);
+
+ myComputeButton = new QPushButton(tr("GEOM_FAST_CHECK_INT_COMPUTE"));
+
+ QGridLayout *aGrpLayout = new QGridLayout(aGrp);
+ aGrpLayout->setMargin(9);
+ aGrpLayout->setSpacing(6);
+ aGrpLayout->addWidget(anObjLbl1, 0, 0);
+ aGrpLayout->addWidget(mySelButton1, 0, 1);
+ aGrpLayout->addWidget(myEditObjName1, 0, 2);
+ aGrpLayout->addWidget(anObjLbl2, 1, 0);
+ aGrpLayout->addWidget(mySelButton2, 1, 1);
+ aGrpLayout->addWidget(myEditObjName2, 1, 2);
+ aGrpLayout->addWidget(aDeflectLbl, 2, 0);
+ aGrpLayout->addWidget(myDeflection, 2, 1, 1, 2);
+ aGrpLayout->addWidget(myDetGaps, 3, 0);
+ aGrpLayout->addWidget(myTolerance, 3, 1, 1, 2);
+ aGrpLayout->addWidget(myComputeButton, 4, 0, 1, 3);
+
+ QGridLayout *aGrpLayout2 = new QGridLayout();
+ aGrpLayout->addLayout(aGrpLayout2, 5, 0, 1, 3);
+ aGrpLayout2->addWidget(aShapeLbl1, 0, 0);
+ aGrpLayout2->addWidget(aShapeLbl2, 0, 1);
+ aGrpLayout2->addWidget(myShapeList1, 1, 0);
+ aGrpLayout2->addWidget(myShapeList2, 1, 1);
+
+ QVBoxLayout* layout = new QVBoxLayout (centralWidget());
+ layout->setMargin(0); layout->setSpacing(6);
+ layout->addWidget(aGrp);
+
+ /***************************************************************/
+
+ myHelpFileName = "fast_intersection_page.html";
+
+ // Initialisation
+ Init();
+}
+
+//=================================================================================
+// function : ~MeasureGUI_FastCheckIntersectionsDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+MeasureGUI_FastCheckIntersectionsDlg::~MeasureGUI_FastCheckIntersectionsDlg()
+{
+}
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::Init()
+{
+ myObj1.nullify();
+ myObj2.nullify();
+ myEditObjName1->setText("");
+ myEditObjName2->setText("");
+ myEditObjName1->setEnabled(true);
+ myEditObjName2->setEnabled(false);
+
+ myDetGaps->setChecked(false);
+ initSpinBox(myTolerance, 0, MAX_NUMBER, 1);
+ myTolerance->setValue(0);
+ myTolerance->setEnabled(false);
+
+ // Obtain deflection from preferences
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ initSpinBox(myDeflection, 1e-3, 1.0, 1e-3);
+ myDeflection->setValue(qMax(1e-3, resMgr->doubleValue("Geometry", "deflection_coeff", 1e-3)));
+
+ myEditCurrentArgument = myEditObjName1;
+
+ connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()),
+ this, SLOT(DeactivateActiveDialog()));
+ connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()),
+ this, SLOT(ClickOnCancel()));
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(mySelButton1, SIGNAL(clicked()),
+ this, SLOT(SetEditCurrentArgument()));
+ connect(mySelButton2, SIGNAL(clicked()),
+ this, SLOT(SetEditCurrentArgument()));
+ connect(myDetGaps, SIGNAL(toggled(bool)), this, SLOT(OnGaps(bool)));
+ connect( myTolerance, SIGNAL(valueChanged(double)), this, SLOT(clear()));
+ connect( myDeflection, SIGNAL(valueChanged(double)), this, SLOT(clear()));
+ connect(myShapeList1, SIGNAL(itemSelectionChanged()),
+ SLOT(onSubShapesListSelectionChanged()));
+ connect(myShapeList2, SIGNAL(itemSelectionChanged()),
+ SLOT(onSubShapesListSelectionChanged()));
+ connect(myComputeButton, SIGNAL(clicked()), this, SLOT(onCompute()));
+
+ LightApp_SelectionMgr* aSel = myGeomGUI->getApp()->selectionMgr();
+
+ connect(aSel, SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ initName(tr("GEOM_FAST_INTERSECTION_NAME"));
+ buttonOk()->setEnabled(false);
+ buttonApply()->setEnabled(false);
+ myComputeButton->setEnabled(false);
+ activateSelection();
+
+ mySelButton1->click();
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : clear
+// purpose :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::clear()
+{
+ disconnect(myShapeList1, SIGNAL(itemSelectionChanged()), this, 0);
+ disconnect(myShapeList2, SIGNAL(itemSelectionChanged()), this, 0);
+ myShapeList1->clear();
+ myShapeList2->clear();
+ connect(myShapeList1, SIGNAL(itemSelectionChanged()),
+ SLOT(onSubShapesListSelectionChanged()));
+ connect(myShapeList2, SIGNAL(itemSelectionChanged()),
+ SLOT(onSubShapesListSelectionChanged()));
+ erasePreview();
+ buttonOk()->setEnabled(false);
+ buttonApply()->setEnabled(false);
+ myComputeButton->setEnabled(true);
+}
+
+//=================================================================================
+// function : onCompute
+// purpose :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::onCompute()
+{
+ SUIT_OverrideCursor wc;
+
+ myShapeList1->clear();
+ myShapeList2->clear();
+
+ if (!findIntersections()) {
+ myShapeList1->addItem(tr("GEOM_FAST_INTERSECTION_FAILS"));
+ myShapeList1->setEnabled(false);
+ myShapeList2->addItem(tr("GEOM_FAST_INTERSECTION_FAILS"));
+ myShapeList2->setEnabled(false);
+ return;
+ }
+
+ myShapeList1->setEnabled(true);
+ myShapeList2->setEnabled(true);
+ QStringList aSubShapeList1, aSubShapeList2;
+ TopoDS_Shape aSelShape1, aSelShape2;
+ if (myObj1 && GEOMBase::GetShape(myObj1.get(), aSelShape1) && myObj2
+ && GEOMBase::GetShape(myObj2.get(), aSelShape2)) {
+ TopTools_IndexedMapOfShape anIndices1, anIndices2;
+ TopExp::MapShapes(aSelShape1, anIndices1);
+ TopExp::MapShapes(aSelShape2, anIndices2);
+
+ //Sub-shapes of 1st Object
+ for (int i = 0; i < myInters1->length(); i++) {
+ TopoDS_Shape aSubShape = anIndices1.FindKey(myInters1[i]);
+ QString aType = GEOMBase::GetShapeTypeString(aSubShape);
+ if (!aType.isEmpty())
+ aSubShapeList1.append(QString("%1_%2").arg(aType).arg(myInters1[i]));
+ }
+ myShapeList1->addItems(aSubShapeList1);
+ myShapeList1->selectAll();
+
+ //Sub-shapes of second Object
+ for (int i = 0; i < myInters2->length(); i++) {
+ TopoDS_Shape aSubShape = anIndices2.FindKey(myInters2[i]);
+ QString aType = GEOMBase::GetShapeTypeString(aSubShape);
+ if (!aType.isEmpty())
+ aSubShapeList2.append(QString("%1_%2").arg(aType).arg(myInters2[i]));
+ }
+ myShapeList2->addItems(aSubShapeList2);
+ myShapeList2->selectAll();
+ }
+
+ buttonOk()->setEnabled(true);
+ buttonApply()->setEnabled(true);
+ myComputeButton->setEnabled(false);
+}
+
+//=================================================================================
+// function : ActivateThisDialog
+// purpose :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::ActivateThisDialog()
+{
+ GEOMBase_Skeleton::ActivateThisDialog();
+
+ LightApp_SelectionMgr* aSel = myGeomGUI->getApp()->selectionMgr();
+ if ( aSel )
+ connect( aSel, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+
+ activateSelection();
+ DISPLAY_PREVIEW_MACRO
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose : public slot to deactivate if active
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::DeactivateActiveDialog()
+{
+ GEOMBase_Skeleton::DeactivateActiveDialog();
+}
+
+//=================================================================================
+// function : activateSelection
+// purpose :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::activateSelection()
+{
+ TColStd_MapOfInteger aTypes;
+ aTypes.Add(GEOM_COMPOUND );
+ aTypes.Add(GEOM_SOLID );
+ aTypes.Add(GEOM_SHELL);
+ aTypes.Add(GEOM_FACE);
+ globalSelection(aTypes);
+
+ std::list<int> needTypes;
+ needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ), needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPOUND );
+ localSelection( needTypes );
+
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::ClickOnOk()
+{
+ if ( ClickOnApply() )
+ ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool MeasureGUI_FastCheckIntersectionsDlg::ClickOnApply()
+{
+ if ( !onAccept() )
+ return false;
+
+ clear();
+ initName();
+ return true;
+}
+
+//=================================================================================
+// function : extractPrefix
+// purpose :
+//=================================================================================
+bool MeasureGUI_FastCheckIntersectionsDlg::extractPrefix() const
+{
+ return true;
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr MeasureGUI_FastCheckIntersectionsDlg::createOperation()
+{
+ return getGeomEngine()->GetIMeasureOperations( getStudyId() );
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool MeasureGUI_FastCheckIntersectionsDlg::isValid( QString& )
+{
+ return myObj1 && myObj2;
+}
+
+//=================================================================================
+// function : SetEditCurrentArgument
+// purpose :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ if (send == mySelButton1) {
+ myEditCurrentArgument = myEditObjName1;
+
+ mySelButton2->setDown(false);
+ myEditObjName2->setEnabled(false);
+ myObj1.nullify();
+ }
+ else {
+ myEditCurrentArgument = myEditObjName2;
+
+ mySelButton1->setDown(false);
+ myEditObjName1->setEnabled(false);
+ myObj2.nullify();
+ }
+
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ activateSelection();
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ // enable line edit
+ myEditCurrentArgument->setEnabled(true);
+ myEditCurrentArgument->setFocus();
+ // after setFocus(), because it will be setDown(false) when loses focus
+ send->setDown(true);
+
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : OnGaps()
+// purpose :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::OnGaps(bool cheked)
+{
+ clear();
+ myTolerance->setEnabled(cheked);
+}
+//=================================================================================
+// function : SelectionIntoArgument
+// purpose :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::SelectionIntoArgument()
+{
+ myEditCurrentArgument->setText("");
+ // Clear the dialog.
+ clear();
+
+ QList<TopAbs_ShapeEnum> typesLst;
+ typesLst << TopAbs_FACE << TopAbs_SHELL << TopAbs_SOLID << TopAbs_COMPOUND;
+ GEOM::GeomObjPtr aSelectedObject = getSelected( typesLst );
+
+ // clear selection
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ myGeomGUI->getApp()->selectionMgr()->clearSelected();
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ if (myEditCurrentArgument == myEditObjName1) {
+ myObj1 = aSelectedObject;
+ if (myObj1 && !myObj2)
+ mySelButton2->click();
+ }
+ else {
+ myObj2 = aSelectedObject;
+ if (myObj2 && !myObj1)
+ mySelButton1->click();
+ }
+ myEditObjName1->setText(myObj1 ? GEOMBase::GetName(myObj1.get()) : "");
+ myEditObjName2->setText(myObj2 ? GEOMBase::GetName(myObj2.get()) : "");
+}
+
+//=================================================================================
+// function : enterEvent
+// purpose :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::enterEvent(QEvent *)
+{
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
+}
+
+//=================================================================================
+// function : findIntersections
+// purpose :
+//=================================================================================
+bool MeasureGUI_FastCheckIntersectionsDlg::findIntersections()
+{
+ if (!myObj1 || !myObj2)
+ return false;
+
+ GEOM::GEOM_IMeasureOperations_var anOper =
+ GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
+ bool isOK = true;
+
+ bool HasInte;
+ try {
+ HasInte = anOper->FastIntersect(myObj1.get(), myObj2.get(), getTolerance(), getDeflection(), myInters1, myInters2);
+ }
+ catch (const SALOME::SALOME_Exception& e) {
+ SalomeApp_Tools::QtCatchCorbaException(e);
+ isOK = false;
+ }
+
+ bool isDone = anOper->IsDone();
+ if (!isDone) {
+ CORBA::String_var aMsg = anOper->GetErrorCode();
+ SUIT_MessageBox::warning(this,
+ QObject::tr("WRN_WARNING"),
+ QObject::tr(aMsg.in()));
+ }
+
+ if ( !HasInte || myInters1->length() == 0 || myInters2->length() == 0)
+ isOK = false;
+
+ return isOK;
+}
+
+//=================================================================================
+// function : onSubShapesListSelectionChanged
+// purpose :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::onSubShapesListSelectionChanged()
+{
+ erasePreview();
+ previewSubShapesListSelection(myShapeList1);
+ previewSubShapesListSelection(myShapeList2);
+}
+
+//=================================================================================
+// function : previewSubShapesListSelection
+// purpose :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::previewSubShapesListSelection(QListWidget* theWidget)
+{
+ GEOM::ListOfLong_var anInters;
+ GEOM::GeomObjPtr anObj;
+
+ if (theWidget == myShapeList1) { // Sub-Shapes of Object 1
+ anObj = myObj1;
+ anInters = myInters1;
+ }
+ else {
+ if (theWidget == myShapeList2) { // Sub-Shapes of Object 2
+ anObj = myObj2;
+ anInters = myInters2;
+ }
+ else return;
+ }
+ // Selected IDs
+ QList<int> aIds;
+ for (int i = 0, n = theWidget->count(); i < n; i++) {
+ if (theWidget->item(i)->isSelected())
+ aIds.append(i);
+ }
+ if (aIds.count() < 1)
+ return;
+
+ TopoDS_Shape aSelShape;
+ TopoDS_Shape aSubShape;
+ TopTools_IndexedMapOfShape anIndices;
+ if (anObj && GEOMBase::GetShape(anObj.get(), aSelShape)) {
+ SALOME_Prs* aPrs = 0;
+ TopExp::MapShapes(aSelShape, anIndices);
+ QList<int>::iterator it;
+ getDisplayer()->SetColor(theWidget == myShapeList1 ? Quantity_NOC_RED : Quantity_NOC_GREEN);
+ getDisplayer()->SetWidth(3);
+ getDisplayer()->SetToActivate(false);
+ for (it = aIds.begin(); it != aIds.end(); ++it) {
+ aSubShape = anIndices.FindKey(anInters[(*it)]);
+ try {
+ aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs(aSubShape) : 0;
+ if (aPrs)
+ displayPreview(aPrs, true);
+ }
+ catch (const SALOME::SALOME_Exception& e) {
+ SalomeApp_Tools::QtCatchCorbaException(e);
+ }
+ }
+ }
+}
+
+//=================================================================================
+// function : getLstObjFromListSelection
+// purpose :
+//=================================================================================
+GEOM::ListOfGO_var MeasureGUI_FastCheckIntersectionsDlg::getLstObjFromListSelection(QListWidget* theWidget)
+{
+ GEOM::ListOfLong_var anInters;
+ GEOM::GeomObjPtr anObj;
+ GEOM::ListOfGO_var anObjLst = new GEOM::ListOfGO();
+
+ if (theWidget == myShapeList1) { // Sub-Shapes of Object 1
+ anObj = myObj1;
+ anInters = myInters1;
+ }
+ else {
+ if (theWidget == myShapeList2) { // Sub-Shapes of Object 2
+ anObj = myObj2;
+ anInters = myInters2;
+ }
+ else
+ return anObjLst;
+ }
+ //Add in study myObj if local selection
+ GEOMBase::PublishSubObject( anObj.get() );
+ // Collect the map of indices and already publised objects
+ TColStd_IndexedMapOfInteger aMapIndex;
+ ObjectList aObjLstExist;
+ for (int i = 0, n = theWidget->count(); i < n; i++) {
+ if (theWidget->item(i)->isSelected()) {
+ GEOM::GEOM_Object_var aTmpObj = GEOMBase_Helper::findObjectInFather(anObj.get(), anInters[i]);
+ if (aTmpObj->_is_nil())
+ aMapIndex.Add(anInters[i]);
+ else
+ aObjLstExist.push_back( GEOM::GEOM_Object::_duplicate(aTmpObj));
+ }
+ }
+
+ if (aMapIndex.IsEmpty() && aObjLstExist.empty())
+ return anObjLst;
+
+ // Create objects.
+ GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
+ const int aNbShapes = aMapIndex.Extent();
+ anArray->length(aNbShapes);
+ for (int i = 1; i <= aNbShapes; i++) {
+ anArray[i - 1] = aMapIndex.FindKey(i);
+ }
+
+ if (myShapesOper->_is_nil())
+ myShapesOper = getGeomEngine()->GetIShapesOperations(getStudyId());
+
+ GEOM::ListOfGO_var aObjLstCreate = myShapesOper->MakeSubShapes(anObj.get(), anArray);
+
+ //Collect all objects in list
+ anObjLst->length(aObjLstCreate->length() + aObjLstExist.size());
+
+ ObjectList::iterator anIter;
+ int i;
+ for (i=0, anIter = aObjLstExist.begin(); anIter != aObjLstExist.end(); i++, ++anIter) {
+ anObjLst[i] = *anIter;
+ }
+ for (int j = 0; j < aObjLstCreate->length(); j++) {
+ anObjLst[aObjLstExist.size()+j]=aObjLstCreate[j];
+ }
+ return anObjLst._retn();
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool MeasureGUI_FastCheckIntersectionsDlg::execute(ObjectList& objects)
+{
+ GEOM::ListOfGO_var aList1 = getLstObjFromListSelection(myShapeList1);
+ GEOM::ListOfGO_var aList2 = getLstObjFromListSelection(myShapeList2);
+ GEOM::ListOfGO_var aCompList = new GEOM::ListOfGO();
+ const int nbObj = aList1->length() + aList2->length();
+ if (nbObj <= 0)
+ return true;
+
+ //Collect general intersection list
+ aCompList->length(nbObj);
+ int i;
+ for (i = 0; i < aList1->length(); i++) {
+ GEOMBase::PublishSubObject( aList1[i] );
+ aCompList[i]=aList1[i];
+ }
+ for (int j = 0; j < aList2->length(); j++) {
+ GEOMBase::PublishSubObject( aList2[j] );
+ aCompList[i+j]=aList2[j];
+ }
+
+ // make compound
+ objects.push_back(myShapesOper->MakeCompound(aCompList));
+ return true;
+}
+
+//=================================================================================
+// function : getDeflection
+// purpose :
+//=================================================================================
+float MeasureGUI_FastCheckIntersectionsDlg::getDeflection()
+{
+ return (float)myDeflection->value();
+}
+
+//=================================================================================
+// function : getTolerance
+// purpose :
+//=================================================================================
+double MeasureGUI_FastCheckIntersectionsDlg::getTolerance()
+{
+ double aVal = myTolerance->value();
+ if (!myDetGaps->isChecked() || aVal < 0.0)
+ return 0.0;
+ return aVal;
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> MeasureGUI_FastCheckIntersectionsDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myObj1 << myObj2;
+ return res;
+}
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : MeasureGUI_FastCheckIntersectionsDlg.h
+
+#ifndef MEASUREGUI_FASTCHECKINTERDLG_H
+#define MEASUREGUI_FASTCHECKINTERDLG_H
+
+#include <GEOMBase_Skeleton.h>
+
+class QListWidget;
+
+//=================================================================================
+// class : MeasureGUI_FastCheckIntersectionsDlg
+// purpose :
+//=================================================================================
+
+class MeasureGUI_FastCheckIntersectionsDlg : public GEOMBase_Skeleton
+{
+ Q_OBJECT
+
+public:
+
+ MeasureGUI_FastCheckIntersectionsDlg(GeometryGUI*, QWidget*);
+ ~MeasureGUI_FastCheckIntersectionsDlg();
+
+protected:
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid(QString &);
+ virtual bool execute(ObjectList &);
+ virtual bool extractPrefix() const;
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
+
+private slots:
+
+ void onSubShapesListSelectionChanged();
+ void clear();
+ void onCompute();
+ void ClickOnOk();
+ bool ClickOnApply();
+ void ActivateThisDialog();
+ void DeactivateActiveDialog();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
+ void OnGaps(bool);
+
+private:
+
+ void Init();
+ void activateSelection();
+ void enterEvent(QEvent *);
+ bool findIntersections();
+ float getDeflection();
+ double getTolerance();
+ void previewSubShapesListSelection(QListWidget*);
+ GEOM::ListOfGO_var getLstObjFromListSelection(QListWidget*);
+
+private:
+
+ QPushButton *mySelButton1;
+ QPushButton *mySelButton2;
+ QLineEdit *myEditObjName1;
+ QLineEdit *myEditObjName2;
+ QLineEdit *myEditCurrentArgument;
+ QCheckBox *myDetGaps;
+ SalomeApp_DoubleSpinBox *myTolerance;
+ SalomeApp_DoubleSpinBox *myDeflection;
+ QPushButton *myComputeButton;
+ QListWidget *myShapeList1;
+ QListWidget *myShapeList2;
+ GEOM::GeomObjPtr myObj1;
+ GEOM::GeomObjPtr myObj2;
+ GEOM::ListOfLong_var myInters1;
+ GEOM::ListOfLong_var myInters2;
+ GEOM::GEOM_IShapesOperations_var myShapesOper;
+};
+
+#endif // MEASUREGUI_FASTCHECKINTERDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "MeasureGUI_GetNonBlocksDlg.h"
-#include <DlgRef.h>
#include <GEOMBase.h>
#include <GeometryGUI.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
+#include <SalomeApp_DoubleSpinBox.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Tools.h>
+#include <QCheckBox>
+#include <QGridLayout>
+#include <QGroupBox>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QRadioButton>
+#include <QVBoxLayout>
+
//=================================================================================
// class : MeasureGUI_GetNonBlocksDlg()
// purpose : Constructs a MeasureGUI_GetNonBlocksDlg which is a child of 'parent',
// true to construct a modal dialog.
//=================================================================================
MeasureGUI_GetNonBlocksDlg::MeasureGUI_GetNonBlocksDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
- : GEOMBase_Skeleton(theGeometryGUI, parent, false)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, false),
+ myObjectName (0),
+ mySelButton (0),
+ myUseC1Check (0),
+ myTolLbl (0),
+ mySpinTol (0)
{
QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GETNONBLOCKS")));
QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
-
- myGrp = new DlgRef_1Sel (centralWidget());
- myGrp->GroupBox1->setTitle(tr("GEOM_GETNONBLOCKS"));
- myGrp->TextLabel1->setText(tr("GEOM_OBJECT"));
- myGrp->PushButton1->setIcon(image1);
- myGrp->LineEdit1->setReadOnly(true);
+
+ QGroupBox *aGrpParams =
+ new QGroupBox(tr("GEOM_GETNONBLOCKS"), centralWidget());
+ QGridLayout *aParamsLayout = new QGridLayout(aGrpParams);
+ QLabel *anObjLbl = new QLabel(tr("GEOM_OBJECT"), aGrpParams);
+
+ myObjectName = new QLineEdit(aGrpParams);
+ mySelButton = new QPushButton(aGrpParams);
+ myUseC1Check = new QCheckBox(tr("GEOM_USE_C1_CRITERION"), aGrpParams);
+ myTolLbl = new QLabel(tr("GEOM_ANGULAR_TOLERANCE"), aGrpParams);
+ mySpinTol = new SalomeApp_DoubleSpinBox(aGrpParams);
+
+ myObjectName->setReadOnly(true);
+ mySelButton->setIcon(image1);
+ mySelButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ myUseC1Check->setText(tr("GEOM_USE_C1_CRITERION"));
+ myUseC1Check->setChecked(true);
+
+ aParamsLayout->setMargin(9);
+ aParamsLayout->setSpacing(6);
+ aParamsLayout->addWidget(anObjLbl, 0, 0);
+ aParamsLayout->addWidget(mySelButton, 0, 1);
+ aParamsLayout->addWidget(myObjectName, 0, 2);
+ aParamsLayout->addWidget(myUseC1Check, 1, 0, 1, 3);
+ aParamsLayout->addWidget(myTolLbl, 2, 0);
+ aParamsLayout->addWidget(mySpinTol, 2, 1, 1, 2);
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
- layout->addWidget(myGrp);
+ layout->addWidget(aGrpParams);
/***************************************************************/
showOnlyPreviewControl();
/* init variables */
- myEditCurrentArgument = myGrp->LineEdit1;
+ double SpecificStep = 0.0001;
+ double aDefaultTol = Precision::Angular();
- /* signals and slots connections */
- connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
- connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ initSpinBox(mySpinTol, aDefaultTol, MAX_NUMBER, SpecificStep, "ang_tol_precision");
+ mySpinTol->setValue(aDefaultTol);
+ myEditCurrentArgument = myObjectName;
- connect(myGrp->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect(myGrp->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ /* signals and slots connections */
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(myUseC1Check, SIGNAL(clicked()), this, SLOT(SetUseC1Tolerance()));
+ connect(mySpinTol, SIGNAL(valueChanged(double)), this, SLOT(processPreview()));
+ connect(myObjectName, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(mySelButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
//=================================================================================
void MeasureGUI_GetNonBlocksDlg::SetEditCurrentArgument()
{
- myGrp->LineEdit1->setFocus();
- myEditCurrentArgument = myGrp->LineEdit1;
+ myObjectName->setFocus();
+ myEditCurrentArgument = myObjectName;
SelectionIntoArgument();
}
+//=================================================================================
+// function : SetUseC1Tolerance()
+// purpose :
+//=================================================================================
+void MeasureGUI_GetNonBlocksDlg::SetUseC1Tolerance()
+{
+ myTolLbl->setEnabled(myUseC1Check->isChecked());
+ mySpinTol->setEnabled(myUseC1Check->isChecked());
+ processPreview();
+}
+
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
void MeasureGUI_GetNonBlocksDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
- if (send == myGrp->LineEdit1) {
- myEditCurrentArgument = myGrp->LineEdit1;
+ if (send == myObjectName) {
+ myEditCurrentArgument = myObjectName;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
void MeasureGUI_GetNonBlocksDlg::processObject()
{
if (myObj->_is_nil()) {
+ myObjectName->setText("");
erasePreview();
}
else {
- myGrp->LineEdit1->setText(GEOMBase::GetName(myObj));
+ myObjectName->setText(GEOMBase::GetName(myObj));
processPreview();
}
// function : isValid
// purpose :
//=================================================================================
-bool MeasureGUI_GetNonBlocksDlg::isValid (QString&)
+bool MeasureGUI_GetNonBlocksDlg::isValid (QString &msg)
{
- return !myObj->_is_nil();
+ return !myObj->_is_nil() && mySpinTol->isValid(msg, !IsPreview());
}
//=================================================================================
{
GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow(getOperation());
GEOM::GEOM_Object_var aNonQuads;
- GEOM::GEOM_Object_var anObj = anOper->GetNonBlocks(myObj, aNonQuads);
+ double aC1Tol = -1.;
+
+ if (myUseC1Check->isChecked()) {
+ aC1Tol = mySpinTol->value();
+ }
+
+ GEOM::GEOM_Object_var anObj = anOper->GetNonBlocks(myObj, aC1Tol, aNonQuads);
//mainFrame()->ResultName->setText(tr("GEOM_NONBLOCKS"));
if (!anObj->_is_nil())
{
return myObj;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> MeasureGUI_GetNonBlocksDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myObj);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GEOMBase_Skeleton.h>
-class DlgRef_1Sel;
+class QCheckBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class SalomeApp_DoubleSpinBox;
//=================================================================================
// class : MeasureGUI_GetNonBlocksDlg
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
- virtual bool isValid (QString&);
+ virtual bool isValid (QString &msg);
virtual bool execute (ObjectList&);
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private slots:
void ClickOnOk();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
+ void SetUseC1Tolerance();
private:
void Init();
private:
GEOM::GEOM_Object_var myObj;
- DlgRef_1Sel* myGrp;
+ QLineEdit *myObjectName;
+ QPushButton *mySelButton;
+ QCheckBox *myUseC1Check;
+ QLabel *myTolLbl;
+ SalomeApp_DoubleSpinBox *mySpinTol;
};
#endif // MEASUREGUI_GETNONBLOCKSDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
MeasureGUI_Skeleton::Init();
}
+//=================================================================================
+// function : activateSelection()
+// purpose :
+//=================================================================================
+void MeasureGUI_InertiaDlg::activateSelection()
+{
+ MeasureGUI_Skeleton::activateSelection();
+ localSelection( TopAbs_SHAPE );
+}
+
+
//=================================================================================
// function : processObject
// purpose :
bool MeasureGUI_InertiaDlg::getParameters( gp_Mat& I,
gp_XYZ& theIXYZ )
{
- if ( myObj->_is_nil() )
+ if ( !myObj )
return false;
else {
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
try {
double x, y, z;
- anOper->GetInertia( myObj,
+ anOper->GetInertia( myObj.get(),
I( 1, 1 ), I( 1, 2 ), I( 1, 3 ),
I( 2, 1 ), I( 2, 2 ), I( 2, 3 ),
I( 3, 1 ), I( 3, 2 ), I( 3, 3 ),
return anOper->IsDone();
}
}
+
+void MeasureGUI_InertiaDlg::SelectionIntoArgument()
+{
+ myObj.nullify();
+ QList<TopAbs_ShapeEnum> aTypes;
+ aTypes << TopAbs_VERTEX << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE << TopAbs_SHELL << TopAbs_SOLID << TopAbs_COMPSOLID << TopAbs_COMPOUND << TopAbs_SHAPE;
+ myObj = getSelected( aTypes );
+
+ if (!myObj) {
+ mySelEdit->setText("");
+ processObject();
+ erasePreview();
+ return;
+ }
+
+ mySelEdit->setText(GEOMBase::GetName(myObj.get()));
+ processObject();
+ redisplayPreview();
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
protected:
// redefined from GEOMBase_Helper and MeasureGUI_Skeleton
virtual void processObject();
+ virtual void activateSelection();
+ virtual void SelectionIntoArgument();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "MeasureGUI_DimensionFilter.h"
#include <GEOMGUI_DimensionProperty.h>
+#include <GEOMGUI_TextTreeWdg.h>
#include <GEOMUtils.hxx>
#include <GEOMGUI_OCCSelector.h>
#include <GEOM_AISDimension.hxx>
{
myObjectSelector->PushButton1->click();
}
-
+ myIsNeedRedisplay = false;
setHelpFileName("managing_dimensions_page.html");
}
mySavedPropertyState.SaveToAttribute( aStudy, myEditObject->GetStudyEntry() );
+ myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) );
+
return true;
}
GEOM::propertyName( GEOM::Dimensions ),
QVariant() );
- redisplay( myEditObject.get() );
+ if ( myIsNeedRedisplay ) {
+ redisplay( myEditObject.get() );
+ }
+
+ myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) );
}
//=================================================================================
if ( myEditObject.isNull() )
{
+ myDimensionView->TreeWidget->clear();
myDimensionView->setEnabled( false );
-
return;
}
myEditObject->GetStudyEntry(),
GEOM::propertyName( GEOM::Dimensions ),
QVariant() );
-
- RedisplayObject();
}
//=================================================================================
tr( "WRN_MSG_CHANGES_LOST" ),
QMessageBox::Ok,
QMessageBox::Cancel );
-
- return aResponse == QMessageBox::Ok;
+ myIsNeedRedisplay = ( aResponse == QMessageBox::Ok );
+ return myIsNeedRedisplay;
}
//=================================================================================
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
private:
GEOM::GeomObjPtr myEditObject;
-
+ bool myIsNeedRedisplay;
private:
DlgRef_1Sel* myObjectSelector;
MeasureGUI_1TreeWidget_4Button* myDimensionView;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
#include "MeasureGUI_MaxToleranceDlg.h"
#include "MeasureGUI_Widgets.h"
+#include <GEOMBase.h>
#include "DlgRef.h"
#include <SUIT_Session.h>
else {
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
try {
- anOper->GetTolerance( myObj,
+ anOper->GetTolerance( myObj.get(),
theMinFaceToler, theMaxFaceToler, theMinEdgeToler,
theMaxEdgeToler, theMinVertexToler, theMaxVertexToler );
}
return anOper->IsDone();
}
}
+
+//=================================================================================
+// function : activateSelection()
+// purpose :
+//=================================================================================
+void MeasureGUI_MaxToleranceDlg::activateSelection()
+{
+ globalSelection( GEOM_ALLSHAPES );
+ localSelection( TopAbs_SHAPE );
+}
+
+void MeasureGUI_MaxToleranceDlg::SelectionIntoArgument()
+{
+ myObj.nullify();
+ QList<TopAbs_ShapeEnum> aTypes;
+ aTypes << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE << TopAbs_SHELL << TopAbs_SOLID << TopAbs_COMPSOLID << TopAbs_COMPOUND << TopAbs_SHAPE;
+ myObj = getSelected( aTypes );
+
+ if (!myObj) {
+ mySelEdit->setText("");
+ processObject();
+ erasePreview();
+ return;
+ }
+
+ mySelEdit->setText(GEOMBase::GetName(myObj.get()));
+ processObject();
+ redisplayPreview();
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
protected:
// redefined from GEOMBase_Helper and MeasureGUI_Skeleton
virtual void processObject();
+ virtual void SelectionIntoArgument();
private:
void Init();
+ void activateSelection();
bool getParameters( double&, double&, double&,
double&, double&, double& );
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
GroupArgs->PushButton2->setDown(false);
GroupArgs->LineEdit2->setEnabled(false);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE);
+ localSelection(TopAbs_FACE);
}
else if (send == GroupArgs->PushButton2) {
myEditCurrentArgument = GroupArgs->LineEdit2;
GroupArgs->PushButton1->setDown(false);
GroupArgs->LineEdit1->setEnabled(false);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
return true;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> MeasureGUI_NormaleDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr1(myFace), aGeomObjPtr2(myPoint);
+ res << aGeomObjPtr1 << aGeomObjPtr2;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//=================================================================================
void MeasureGUI_PointDlg::activateSelection()
{
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
}
//=================================================================================
void MeasureGUI_PointDlg::SelectionIntoArgument()
{
try {
- myObj = GEOM::GEOM_Object::_nil();
+ myObj.nullify();
myGrp->LineEdit1->setText( "" );
myGrp->LineEdit2->setText( "" );
myGrp->LineEdit3->setText( "" );
if (aSelList.Extent() < 1)
return;
- GEOM::GEOM_Object_var aSelectedObject =
- GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
+ myObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
- if ( aSelectedObject->_is_nil() )
+ if ( !myObj )
return;
- myObj = aSelectedObject;
-
TColStd_IndexedMapOfInteger anIndexes;
aSelMgr->GetIndexes(aSelList.First(), anIndexes);
TopoDS_Shape aShape;
- if ( anIndexes.Extent() > 1 || !GEOMBase::GetShape( myObj, aShape ) || aShape.IsNull() )
+ if ( anIndexes.Extent() > 1 || !GEOMBase::GetShape( myObj.get(), aShape ) || aShape.IsNull() )
return;
TopoDS_Vertex aPoint;
- QString aName = GEOMBase::GetName( myObj );
+ QString aName = GEOMBase::GetName( myObj.get() );
if ( anIndexes.Extent() == 0 ) {
if ( aShape.ShapeType() == TopAbs_VERTEX )
aPoint = TopoDS::Vertex( aShape );
}
catch( ... )
{
- myObj = GEOM::GEOM_Object::_nil();
+ myObj.nullify();
myGrp->LineEdit1->setText( "" );
myGrp->LineEdit2->setText( "" );
myGrp->LineEdit3->setText( "" );
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
}
globalSelection( aTypes );
+
+ std::list<int> needTypes;
+ needTypes.push_back( TopAbs_EDGE ), needTypes.push_back( TopAbs_WIRE ), needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ), needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPOUND );
+ localSelection( needTypes );
}
+void MeasureGUI_PropertiesDlg::SelectionIntoArgument()
+{
+ myObj.nullify();
+ QList<TopAbs_ShapeEnum> aTypes;
+ aTypes << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE << TopAbs_SHELL << TopAbs_SOLID << TopAbs_COMPOUND;
+ myObj = getSelected( aTypes );
+
+ if (!myObj) {
+ mySelEdit->setText("");
+ processObject();
+ erasePreview();
+ return;
+ }
+
+ mySelEdit->setText(GEOMBase::GetName(myObj.get()));
+ processObject();
+ redisplayPreview();
+}
//=================================================================================
// function : processObject
// purpose :
double& theArea,
double& theVolume )
{
- if ( myObj->_is_nil() )
+ if ( !myObj )
return false;
else {
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
try {
- anOper->GetBasicProperties( myObj, theLength, theArea, theVolume );
+ anOper->GetBasicProperties( myObj.get(), theLength, theArea, theVolume );
}
catch( const SALOME::SALOME_Exception& e ) {
SalomeApp_Tools::QtCatchCorbaException( e );
SALOME_Prs* prs = 0;
TopoDS_Shape shape;
- if ( GEOMBase::GetShape( myObj, shape, TopAbs_EDGE ) &&
- getDisplayer()->IsDisplayed( GEOMBase::GetEntry(myObj) ) ) {
+ if ( GEOMBase::GetShape( myObj.get(), shape, TopAbs_EDGE ) &&
+ getDisplayer()->IsDisplayed( GEOMBase::GetEntry(myObj.get()) ) ) {
shape = GEOMBase::CreateArrowForLinearEdge( shape );
if ( !shape.IsNull() )
prs = getDisplayer()->BuildPrs( shape );
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// redefined from GEOMBase_Helper and MeasureGUI_Skeleton
virtual void processObject();
virtual void activateSelection();
+ virtual void SelectionIntoArgument();
virtual SALOME_Prs* buildPrs();
private:
--- /dev/null
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+// File : MeasureGUI_ShapeStatisticsDlg.cxx
+// Author : Alexander KOVALEV, OPEN CASCADE S.A.S.
+
+// internal includes
+#include "MeasureGUI_ShapeStatisticsDlg.h"
+
+// GEOM includes
+#include <GEOMBase.h>
+#include <GEOMUtils_ShapeStatistics.hxx>
+#include <GeometryGUI.h>
+#include <DlgRef.h>
+
+// GUI includes
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_ViewManager.h>
+#include <SUIT_ViewWindow.h>
+
+#include <LightApp_SelectionMgr.h>
+
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Study.h>
+
+#include <Plot2d_Histogram.h>
+#include <Plot2d_ViewFrame.h>
+#include <Plot2d_ViewModel.h>
+#include <Plot2d_ViewWindow.h>
+
+// Qt includes
+#include <QIcon>
+#include <QGridLayout>
+#include <QPushButton>
+#include <QLabel>
+
+// Qtx includes
+#include <QtxValidator.h>
+
+// OCC includes
+#include <TopoDS_Shape.hxx>
+
+#include <GEOMImpl_Types.hxx>
+
+//===========================================================================
+// class : MeasureGUI_ShapeStatisticsDlg()
+//===========================================================================
+MeasureGUI_ShapeStatisticsDlg::MeasureGUI_ShapeStatisticsDlg( QWidget* parent, TopoDS_Shape aShape, TopAbs_ShapeEnum aSubShapeType )
+ : GEOMBase_Helper( SUIT_Session::session()->activeApplication()->desktop() ),
+ QDialog( parent ),
+ myHistogram ( 0 )
+{
+ myShapes.push_back( aShape );
+
+ QIcon iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+
+ setWindowTitle( tr( "GEOM_SHAPE_STATISTICS" ) );
+ setAttribute( Qt::WA_DeleteOnClose );
+
+ myApp = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+
+ QVBoxLayout* topLayout = new QVBoxLayout( this );
+
+ QGridLayout* settingsLayout = new QGridLayout();
+
+ /********************** Selected Objects **********************/
+
+ QLabel* objsLabel = new QLabel( tr( "GEOM_SELECTED_OBJECTS" ), this );
+ QPushButton* selBtn = new QPushButton( this );
+ selBtn->setIcon( iconSelect );
+ myEditMainShape = new QLineEdit( this );
+ myEditMainShape->setReadOnly(true);
+
+ settingsLayout->addWidget( objsLabel, 0, 0 );
+ settingsLayout->addWidget( selBtn, 0, 1 );
+ settingsLayout->addWidget( myEditMainShape, 0, 2 );
+
+ if ( !aShape.IsNull() ) {
+ objsLabel->hide();
+ selBtn->hide();
+ myEditMainShape->hide();
+ }
+
+ /********************** Type **********************/
+
+ QLabel* typeLabel = new QLabel( tr( "GEOM_SHAPE_STATISTICS_TYPE" ), this );
+ myCBTypes = new QtxComboBox( this );
+ myCBTypes->setCleared( true );
+ if ( aSubShapeType != TopAbs_SHAPE ) {
+ fillTypes( aSubShapeType == TopAbs_EDGE,
+ aSubShapeType == TopAbs_FACE,
+ aSubShapeType == TopAbs_SOLID );
+ myCBTypes->setEnabled( false );
+ }
+
+ settingsLayout->addWidget( typeLabel, 1, 0 );
+ settingsLayout->addWidget( myCBTypes, 1, 2 );
+
+ /********************** Number of intervals **********************/
+
+ QLabel* nbIntervalsLabel = new QLabel( tr( "GEOM_SHAPE_STATISTICS_NB_INTERVALS" ), this );
+ myNbIntervals = new QtxIntSpinBox( 1, 1000, 1, this );
+ myNbIntervals->setValue( 10 );
+
+ settingsLayout->addWidget( nbIntervalsLabel, 2, 0 );
+ settingsLayout->addWidget( myNbIntervals, 2, 2 );
+
+ /********************** Scalar Range **********************/
+
+ myScalarRangeBox = new QGroupBox( tr( "GEOM_SHAPE_STATISTICS_SCALAR_RANGE" ), this );
+ myScalarRangeBox->setCheckable( true );
+ myScalarRangeBox->setChecked( false );
+ QLabel* minLabel = new QLabel( tr( "GEOM_SHAPE_STATISTICS_MIN" ), this );
+ myMin = new QLineEdit( this );
+ QtxDoubleValidator* aValid = new QtxDoubleValidator( this );
+ aValid->setBottom( 0.0 );
+ myMin->setValidator( aValid );
+ QLabel* maxLabel = new QLabel( tr( "GEOM_SHAPE_STATISTICS_MAX" ), this );
+ myMax = new QLineEdit( this );
+ myMax->setValidator( aValid );
+
+ QPushButton* buttonCompute = new QPushButton( tr( "GEOM_SHAPE_STATISTICS_COMPUTE" ), this );
+ connect( buttonCompute, SIGNAL( clicked() ), this, SLOT( clickOnCompute() ) );
+
+ QGridLayout* scalarRangeLayout = new QGridLayout();
+ scalarRangeLayout->setMargin( 11 ); settingsLayout->setSpacing( 6 );
+
+ scalarRangeLayout->addWidget( minLabel, 0, 0 );
+ scalarRangeLayout->addWidget( myMin, 0, 1 );
+ scalarRangeLayout->addWidget( maxLabel, 1, 0 );
+ scalarRangeLayout->addWidget( myMax, 1, 1 );
+ scalarRangeLayout->addWidget( buttonCompute, 0, 2, 2, 1 );
+
+ myScalarRangeBox->setLayout( scalarRangeLayout );
+
+ /********************** Buttons **********************/
+
+ myButtonPlot = new QPushButton( tr( "GEOM_PLOT_DISTRIBUTION" ), this );
+ myButtonPlot->setDefault( true );
+ myButtonCreateGr = new QPushButton( tr( "GEOM_SHAPE_STATISTICS_CREATE_GROUPS" ), this );
+ QPushButton* buttonClose = new QPushButton( tr( "GEOM_BUT_CLOSE" ), this );
+ QPushButton* buttonHelp = new QPushButton( tr( "GEOM_BUT_HELP" ), this );
+
+ QHBoxLayout* buttonsLayout = new QHBoxLayout();
+ buttonsLayout->addWidget( myButtonPlot );
+ buttonsLayout->addWidget( myButtonCreateGr );
+ buttonsLayout->addWidget( buttonClose );
+ buttonsLayout->addWidget( buttonHelp );
+
+ if ( !aShape.IsNull() ) {
+ myButtonCreateGr->hide();
+ }
+ /********************** Layouting **********************/
+
+ topLayout->addLayout( settingsLayout );
+ topLayout->addWidget( myScalarRangeBox );
+ topLayout->addLayout( buttonsLayout );
+
+ // Signals and slots connections
+
+ connect( selBtn, SIGNAL( clicked() ), this, SLOT( onEditMainShape() ) );
+
+ connect( myButtonPlot, SIGNAL( clicked() ), this, SLOT( clickOnPlot() ) );
+ connect( myButtonCreateGr, SIGNAL( clicked() ), this, SLOT( clickOnCreateGroups() ) );
+
+ connect( buttonClose, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( clickOnHelp() ) );
+
+ connect(myApp->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT(onEditMainShape()));
+
+ if ( aShape.IsNull() )
+ onEditMainShape();
+}
+
+//===========================================================================
+// function : ~MeasureGUI_ShapeStatisticsDlg()
+// purpose : Destroys the object and frees any allocated resources
+//===========================================================================
+MeasureGUI_ShapeStatisticsDlg::~MeasureGUI_ShapeStatisticsDlg()
+{
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr MeasureGUI_ShapeStatisticsDlg::createOperation()
+{
+ return getGeomEngine()->GetIGroupOperations(getStudyId());
+}
+
+#define RETURN_WITH_MSG(a, b) \
+ if (!(a)) { \
+ theMessage += (b); \
+ return false; \
+ }
+
+//================================================================
+// Function : getFather
+// Purpose : Get father object for object to be added in study
+// (called with addInStudy method)
+//================================================================
+GEOM::GEOM_Object_ptr MeasureGUI_ShapeStatisticsDlg::getFather(GEOM::GEOM_Object_ptr theObj)
+{
+ GEOM::GEOM_Object_var aFatherObj;
+ if (theObj->GetType() == GEOM_GROUP) {
+ GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
+ aFatherObj = anOper->GetMainShape(theObj);
+ }
+ return aFatherObj._retn();
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> MeasureGUI_ShapeStatisticsDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myMainObj;
+ return res;
+}
+
+//=================================================================================
+// function : onEditMainShape()
+// purpose : called when selection button was clicked
+//=================================================================================
+void MeasureGUI_ShapeStatisticsDlg::onEditMainShape()
+{
+ // restore initial parameters for dialog box
+ myEditMainShape->setText("");
+ myEditMainShape->setFocus();
+
+ //get shapes from selection
+ QList<GEOM::GeomObjPtr> selShapes = getSelected( TopAbs_SHAPE, -1 );
+
+ myButtonPlot->setEnabled( !selShapes.isEmpty() );
+ myButtonCreateGr->setEnabled( selShapes.count() == 1 );
+
+ if ( !selShapes.isEmpty() ) {
+ if ( selShapes.count() == 1 )
+ myMainObj = selShapes[0];
+ QString aName = selShapes.count() > 1 ? QString( "%1_objects").arg( selShapes.count() ) : GEOMBase::GetName( myMainObj.get() );
+ myEditMainShape->setText( aName );
+ }
+
+ updateTypes( selShapes );
+}
+
+//=================================================================================
+// function : currentType()
+// purpose : returns currently selected type of shapes in 'Type' combobox
+//=================================================================================
+void MeasureGUI_ShapeStatisticsDlg::fillTypes( bool hasEdges, bool hasFaces, bool hasSolids )
+{
+ if ( hasEdges )
+ myCBTypes->addItem( tr("GEOM_SHAPE_STATISTICS_LENGTH"), (int)TopAbs_EDGE );
+ if ( hasFaces )
+ myCBTypes->addItem( tr("GEOM_SHAPE_STATISTICS_AREA"), (int)TopAbs_FACE );
+ if ( hasSolids )
+ myCBTypes->addItem( tr("GEOM_SHAPE_STATISTICS_VOLUME"), (int)TopAbs_SOLID );
+
+ myCBTypes->setEnabled( myCBTypes->count() > 0 );
+}
+
+//=================================================================================
+// function : updateTypes()
+// purpose : update 'Type' combobox with available types
+//=================================================================================
+void MeasureGUI_ShapeStatisticsDlg::updateTypes( QList<GEOM::GeomObjPtr> theShapes )
+{
+ myCBTypes->clear();
+ myCBTypes->setEnabled( false );
+
+ int hasEdges = -1, hasFaces = -1, hasSolids = -1;
+
+ myShapes.clear();
+ // get types of the shapes and its sub-shapes
+ foreach( GEOM::GeomObjPtr aShapePtr, theShapes ) {
+ if ( !aShapePtr )
+ return;
+
+ TopoDS_Shape aShape;
+ if ( !GEOMBase::GetShape( aShapePtr.get(), aShape ) || aShape.IsNull() )
+ return;
+
+ myShapes.push_back( aShape );
+
+ GEOM::ListOfLong_var aSubShapes;
+ GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
+ if ( hasEdges != 0 )
+ hasEdges = aShOp->NumberOfSubShapes( aShapePtr.get(), TopAbs_EDGE ) > 0;
+ if ( hasFaces != 0 )
+ hasFaces = aShOp->NumberOfSubShapes( aShapePtr.get(), TopAbs_FACE ) > 0;
+ if ( hasSolids != 0 )
+ hasSolids = aShOp->NumberOfSubShapes( aShapePtr.get(), TopAbs_SOLID ) > 0;
+ }
+ fillTypes( hasEdges, hasFaces, hasSolids );
+}
+
+//=================================================================================
+// function : currentType()
+// purpose : returns currently selected type of shapes in 'Type' combobox
+//=================================================================================
+TopAbs_ShapeEnum MeasureGUI_ShapeStatisticsDlg::currentType()
+{
+ return (TopAbs_ShapeEnum)( myCBTypes->itemData( myCBTypes->currentIndex() ).toInt() );
+}
+
+//=================================================================================
+// function : clickOnPlot()
+// purpose : called when Plot button was clicked
+//=================================================================================
+bool MeasureGUI_ShapeStatisticsDlg::isValid(QString& theMessage)
+{
+ if ( myScalarRangeBox->isChecked() ) {
+ RETURN_WITH_MSG( !myMin->text().isEmpty(), tr("GEOM_SHAPE_STATISTICS_MIN_ERROR") )
+ RETURN_WITH_MSG( !myMax->text().isEmpty(), tr("GEOM_SHAPE_STATISTICS_MAX_ERROR") )
+ RETURN_WITH_MSG( myMin->text().toDouble() <= myMax->text().toDouble(), tr("GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR") )
+ }
+ return true;
+}
+//=================================================================================
+// function : clickOnPlot()
+// purpose : called when Plot button was clicked
+//=================================================================================
+void MeasureGUI_ShapeStatisticsDlg::clickOnPlot()
+{
+ GEOMUtils::Range aRange;
+ if ( myScalarRangeBox->isChecked() ) {
+ QString msg;
+ if ( !isValid( msg ) ) {
+ showError( msg );
+ return;
+ }
+ aRange.min = myMin->text().toDouble();
+ aRange.max = myMax->text().toDouble();
+ } else {
+ aRange.min = -1.0; // flag that range is empty
+ aRange.max = -1.0; // flag that range is empty
+ }
+
+ GEOMUtils::Distribution aShapesDistr =
+ GEOMUtils::ComputeDistribution( myShapes, currentType(), myNbIntervals->value(), aRange );
+
+ QList<double> xVals, yVals;
+ double width = -1, min = -1;
+ double xmin = 1e+32, xmax = 0.0, ymax = 0.0;
+ int i=0;
+ GEOMUtils::Distribution::const_iterator it;
+ for (it = aShapesDistr.begin(); it != aShapesDistr.end(); it++) {
+ GEOMUtils::Range ran = *it;
+ if ( width < 0 ) width = ran.max - ran.min; // bar width
+ if ( min < 0 ) min = ran.min; // global min
+ xVals << width / 2. + i*width + min; // get a middle of bar
+ yVals << ran.count;
+ // get global boundary max values
+ if ( ran.min < xmin ) xmin = ran.min;
+ if ( ran.max > xmax ) xmax = ran.max;
+ if ( ran.count > ymax ) ymax = ran.count;
+ i++;
+ }
+
+ // plot the computed distribution
+ SUIT_ViewManager* aViewManager = myApp->getViewManager( Plot2d_Viewer::Type(), true ); // create if necessary
+ if( !aViewManager )
+ return;
+ Plot2d_ViewWindow* aViewWnd = dynamic_cast<Plot2d_ViewWindow*>(aViewManager->getActiveView());
+ if( !aViewWnd )
+ return;
+ Plot2d_ViewFrame* aPlot = aViewWnd->getViewFrame();
+ if ( !aPlot )
+ return;
+
+ aPlot->EraseAll();
+
+ // create or reuse histogram
+ if( !myHistogram )
+ myHistogram = new Plot2d_Histogram();
+ else
+ myHistogram->clearAllPoints();
+ // set histogram parameters
+ myHistogram->setData( xVals, yVals );
+ if ( width != 0.0 )
+ myHistogram->setWidth( width );
+ myHistogram->setAutoAssign(true);
+ myHistogram->setName( myEditMainShape->text() );
+ myHistogram->setHorTitle( myCBTypes->currentText() );
+ myHistogram->setVerTitle( tr("GEOM_SHAPE_STATISTICS_DISTRIBUTION_NB_ENT") );
+ myHistogram->setColor( QColor(0, 85, 0) );
+ // display histogram
+ aPlot->displayObject( myHistogram, true );
+ if ( width == 0.0 ) // only one X value
+ aPlot->fitAll();
+ else
+ aPlot->fitData( 0, xmin, xmax, 0.0, ymax );
+}
+
+//=================================================================================
+// function : clickOnCompute()
+// purpose : called when Compute button was clicked
+//=================================================================================
+void MeasureGUI_ShapeStatisticsDlg::clickOnCompute()
+{
+ GEOMUtils::Range aRange;
+ aRange.min = -1.0; // flag that range is empty
+ aRange.max = -1.0; // flag that range is empty
+ std::map<int,double> measures = GEOMUtils::ComputeMeasures( myShapes, currentType(), aRange );
+ if ( measures.size() != 0 ) {
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
+ myMin->setText( DlgRef::PrintDoubleValue( aRange.min, aPrecision ) );
+ myMax->setText( DlgRef::PrintDoubleValue( aRange.max, aPrecision ) );
+ }
+}
+
+//=================================================================================
+// function : clickOnCreateGroups()
+// purpose : called when Create Groups button was clicked
+//=================================================================================
+void MeasureGUI_ShapeStatisticsDlg::clickOnCreateGroups()
+{
+ onAccept(false, false, false);
+}
+
+//=================================================================================
+// function : execute(ObjectList& objects)
+// purpose :
+//=================================================================================
+bool MeasureGUI_ShapeStatisticsDlg::execute(ObjectList& objects)
+{
+ if ( myMainObj.isNull() )
+ return false;
+
+ GEOM::GroupOpPtr anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
+
+ GEOMUtils::Range aRange;
+ if ( myScalarRangeBox->isChecked() ) {
+ QString msg;
+ if ( !isValid( msg ) ) {
+ showError( msg );
+ return false;
+ }
+ aRange.min = myMin->text().toDouble();
+ aRange.max = myMax->text().toDouble();
+ } else {
+ aRange.min = -1.0; // flag that range is empty
+ aRange.max = -1.0; // flag that range is empty
+ }
+
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
+ QString aTypePrefix = myCBTypes->currentText().replace(' ', '_');
+ QString objIOR, aMin, aMax, aGroupName;
+ SalomeApp_Study* study = getStudy();
+
+ GEOMUtils::Distribution aShapesDistr =
+ GEOMUtils::ComputeDistribution( myShapes, currentType(), myNbIntervals->value(), aRange );
+
+ int nbGroups = 0;
+
+ GEOMUtils::Distribution::const_iterator it;
+ for (it = aShapesDistr.begin(); it != aShapesDistr.end(); it++) {
+ std::list<long> idList = (*it).indices;
+ int nn = idList.size();
+ if ( nn > 0 ) {
+ GEOM::ListOfLong_var aNewList = new GEOM::ListOfLong;
+ aNewList->length(nn);
+ int ii = 0;
+ std::list<long>::const_iterator id_it;
+ for ( id_it = idList.begin(); id_it != idList.end(); id_it++ ) {
+ aNewList[ii++] = *id_it;
+ }
+
+ // Create an empty group
+ GEOM::GEOM_Object_var aGroup;
+ aGroup = anOper->CreateGroup( myMainObj.get(), currentType() );
+
+ if (CORBA::is_nil(aGroup) || !anOper->IsDone())
+ return false;
+
+ // Add sub-shapes into group
+ anOper->UnionIDs(aGroup, aNewList);
+ if (!anOper->IsDone())
+ return false;
+
+ // publish group
+ aMin = DlgRef::PrintDoubleValue( (*it).min, aPrecision );
+ aMax = DlgRef::PrintDoubleValue( (*it).max, aPrecision );
+ aGroupName = aTypePrefix + "_" + aMin + "_" + aMax;
+ GEOMBase::PublishSubObject( aGroup, aGroupName );
+
+ // this is needed just to avoid error message
+ objects.push_back(aGroup._retn());
+
+ nbGroups++;
+ }
+ }
+
+ SUIT_MessageBox::information( this, tr( "INF_INFO" ), tr( "GEOM_MSG_GROUPS_CREATED" ).arg( nbGroups ) );
+
+ return true;
+}
+
+//=================================================================================
+// function : clickOnHelp()
+// purpose : called when Help button was clicked
+//=================================================================================
+void MeasureGUI_ShapeStatisticsDlg::clickOnHelp()
+{
+ GeometryGUI* aGeomGUI = dynamic_cast<GeometryGUI*>( myApp->module( "Geometry" ) );
+ myApp->onHelpContextModule( aGeomGUI ? myApp->moduleName( aGeomGUI->moduleName() ) : QString(""), "shape_statistics_operation_page.html" );
+}
--- /dev/null
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : MeasureGUI_ShapeStatisticsDlg.h
+// Author : Alexander KOVALEV, Open CASCADE (alexander.kovalev@opencascade.com)
+//
+#ifndef MEASUREGUI_SHAPESTATISTICSDLG_H
+#define MEASUREGUI_SHAPESTATISTICSDLG_H
+
+// GEOM includes
+#include <GEOMBase_Helper.h>
+#include "GEOM_GenericObjPtr.h"
+#include "MeasureGUI_definitions.h"
+
+// Qt includes
+#include <QDialog>
+#include <QLineEdit>
+#include <QPointer>
+#include <QGroupBox>
+
+// Qtx includes
+#include <QtxIntSpinBox.h>
+#include <QtxComboBox.h>
+
+class Plot2d_Histogram;
+
+//==========================================================================
+// class : MeasureGUI_ShapeStatisticsDlg
+// purpose :
+//==========================================================================
+
+class MEASUREGUI_EXPORT MeasureGUI_ShapeStatisticsDlg : public QDialog, public GEOMBase_Helper
+{
+ Q_OBJECT
+
+public:
+ MeasureGUI_ShapeStatisticsDlg( QWidget*, TopoDS_Shape aShape = TopoDS_Shape(), TopAbs_ShapeEnum aSubShapeType = TopAbs_SHAPE );
+ ~MeasureGUI_ShapeStatisticsDlg();
+
+protected:
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid (QString&);
+ virtual bool execute (ObjectList&);
+ virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
+
+private slots:
+ void onEditMainShape();
+ void clickOnCompute();
+ void clickOnPlot();
+ void clickOnCreateGroups();
+ void clickOnHelp();
+
+private:
+ void fillTypes( bool, bool, bool );
+ void updateTypes( QList<GEOM::GeomObjPtr> theShapes );
+ TopAbs_ShapeEnum currentType();
+
+private:
+ SalomeApp_Application* myApp;
+ QLineEdit* myEditMainShape;
+ QtxComboBox* myCBTypes;
+ std::list<TopoDS_Shape> myShapes;
+ GEOM::GeomObjPtr myMainObj;
+ QtxIntSpinBox* myNbIntervals;
+ QGroupBox* myScalarRangeBox;
+ QLineEdit* myMin;
+ QLineEdit* myMax;
+ QPushButton* myButtonPlot;
+ QPushButton* myButtonCreateGr;
+ Plot2d_Histogram* myHistogram;
+
+};
+
+#endif // MEASUREGUI_SHAPESTATISTICSDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//=================================================================================
void MeasureGUI_Skeleton::SelectionIntoArgument()
{
- myObj = GEOM::GEOM_Object::_nil();
+ myObj.nullify();
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
- GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
-
if (aSelList.Extent() > 0) {
- aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
+ myObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
}
- if (aSelectedObject->_is_nil()) {
+ if ( !myObj ) {
mySelEdit->setText("");
processObject();
erasePreview();
return;
}
- myObj = aSelectedObject;
- mySelEdit->setText(GEOMBase::GetName(myObj));
+ mySelEdit->setText(GEOMBase::GetName(myObj.get()));
processObject();
redisplayPreview();
}
erasePreview( false );
try {
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
getDisplayer()->SetColor( Quantity_NOC_VIOLET );
getDisplayer()->SetToActivate( false );
//=================================================================================
bool MeasureGUI_Skeleton::isValid( QString& )
{
- return !myObj->_is_nil();
+ return myObj;
}
//================================================================
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
protected:
QPushButton* mySelBtn;
QLineEdit* mySelEdit;
- GEOM::GEOM_Object_var myObj;
+ GEOM::GeomObjPtr myObj;
GeometryGUI* myGeomGUI;
GEOM_Displayer* myDisplayer;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
myGrp->LineEdit1->setReadOnly( true );
myGrp->TextEdit1->setReadOnly( true );
- // fix height to fit all text
- myGrp->TextEdit1->setLineWrapMode( QTextEdit::NoWrap );
- // myGrp->TextEdit1->setTextFormat( Qt::PlainText ); // VSR : TODO
- QString allLines ("\n\n\n\n\n\n\n\n\n"); // 10 lines
- myGrp->TextEdit1->setText( allLines );
- int sbHeight = myGrp->TextEdit1->horizontalScrollBar()->height();
- myGrp->TextEdit1->setFixedHeight( myGrp->TextEdit1->document()->size().height() + sbHeight );
+ myGrp->TextEdit1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
+ QFontMetrics fm( myGrp->TextEdit1->font() );
+ myGrp->TextEdit1->setMinimumHeight( fm.height()*20 );
myGrp->TextLabel2->setText( tr( "GEOM_KIND_OF_SHAPE" ) );
myGrp->LineEdit2->setReadOnly( true );
myParamsDlg->adjustSize();
}
+//=================================================================================
+// function : activateSelection()
+// purpose :
+//=================================================================================
+void MeasureGUI_WhatisDlg::activateSelection()
+{
+ globalSelection(); // all types of objects
+ localSelection(TopAbs_SHAPE); // all types of sub-shapes
+}
+
//=================================================================================
// function : ClickOnProperties()
// purpose :
//=================================================================================
bool MeasureGUI_WhatisDlg::getParameters( QString& theText )
{
- if ( myObj->_is_nil() )
+ if ( !myObj )
return false;
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
try
{
- theText = anOper->WhatIs( myObj );
+ theText = anOper->WhatIs( myObj.get() );
}
catch( const SALOME::SALOME_Exception& e )
{
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int aLenPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
- if ( myObj->_is_nil() )
+ if ( !myObj )
return aKindStr;
GEOM::GEOM_IKindOfShape::shape_kind aKind;
try
{
- aKind = anOper->KindOfShape( myObj, anInts, aDbls );
+ aKind = anOper->KindOfShape( myObj.get(), anInts, aDbls );
}
catch( const SALOME::SALOME_Exception& e ) {
SalomeApp_Tools::QtCatchCorbaException( e );
if ( !anOper->IsDone() )
return aKindStr;
-#define PRINT_DOUBLE(val, tol) DlgRef::PrintDoubleValue( val, tol )
+#define PRINT_DOUBLE(val, tol) QString(" %1").arg( DlgRef::PrintDoubleValue( val, tol ) )
+#define TITLE(val) QString("<b>%1</b>").arg(tr(val))
+#define TITLE_I(val, i) QString("<b>%1</b>").arg(tr(val).arg(i))
switch ( aKind )
{
case GEOM::GEOM_IKindOfShape::COMPOUND:
// SOLIDs
case GEOM::GEOM_IKindOfShape::SPHERE:
aKindStr = tr( "GEOM_SPHERE" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::CYLINDER:
aKindStr = tr( "GEOM_CYLINDER" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_AXIS" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
- "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_AXIS" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::BOX:
aKindStr = tr( "GEOM_BOX" );
- theParameters = tr( "GEOM_CENTER") +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + "Ax :" + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + "Ay :" + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + "Az :" + PRINT_DOUBLE( aDbls[5], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + "Ax :" + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + "Ay :" + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + "Az :" + PRINT_DOUBLE( aDbls[5], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::ROTATED_BOX:
aKindStr = tr( "GEOM_BOX" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\nZ Axis:" +
- "\n" + "Zx :" + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + "Zy :" + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + "Zz :" + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
- "\nX Axis:" +
- "\n" + tr( "GEOM_X_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
- "\n" + tr( "GEOM_X_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
- "\n" + tr( "GEOM_X_I" ).arg( "z" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
- "\nDimensions along local axes:" +
- "\n" + "Ax :" + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
- "\n" + "Ay :" + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
- "\n" + "Az :" + PRINT_DOUBLE( aDbls[11], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_Z_AXIS") +
+ "<br>" + tr( "GEOM_Z_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( "z" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_X_AXIS") +
+ "<br>" + tr( "GEOM_X_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( "z" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIM_AXES") +
+ "<br>" + tr( "GEOM_A_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
+ "<br>" + tr( "GEOM_A_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
+ "<br>" + tr( "GEOM_A_I" ).arg( "z" ) + PRINT_DOUBLE( aDbls[11], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::TORUS:
aKindStr = tr( "GEOM_TORUS" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_AXIS" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
- "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_AXIS" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::CONE:
aKindStr = tr( "GEOM_CONE" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_AXIS" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
- "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
- "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_AXIS" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+ "<br>" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::POLYHEDRON:
aKindStr = tr( "GEOM_POLYHEDRON" );
// FACEs
case GEOM::GEOM_IKindOfShape::SPHERE2D:
aKindStr = tr( "GEOM_SURFSPHERE" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::CYLINDER2D:
aKindStr = tr( "GEOM_SURFCYLINDER" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_AXIS" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
- "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_AXIS" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::TORUS2D:
aKindStr = tr( "GEOM_SURFTORUS" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_AXIS" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
- "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_AXIS" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::CONE2D:
aKindStr = tr( "GEOM_SURFCONE" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_AXIS" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
- "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
- "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_AXIS" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+ "<br>" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::DISK_CIRCLE:
aKindStr = tr( "GEOM_DISK_CIRCLE" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_NORMAL" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::DISK_ELLIPSE:
aKindStr = tr( "GEOM_DISK_ELLIPSE" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_NORMAL" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
- "\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::POLYGON:
aKindStr = tr( "GEOM_POLYGON" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_NORMAL" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::PLANE:
aKindStr = tr( "GEOM_PLANE" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_NORMAL" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::PLANAR:
aKindStr = tr( "GEOM_PLANAR_FACE" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_NORMAL" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::FACE:
aKindStr = tr( "GEOM_FACE" );
// EDGEs
case GEOM::GEOM_IKindOfShape::CIRCLE:
aKindStr = tr( "GEOM_CIRCLE" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_NORMAL" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::ARC_CIRCLE:
aKindStr = tr( "GEOM_ARC" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_NORMAL" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
- "\n" + tr( "GEOM_POINT_I" ).arg( 1 ) +
- "\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
- "\n" + tr( "GEOM_POINT_I" ).arg( 2 ) +
- "\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + TITLE_I( "GEOM_POINT_I", 1 ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
+ "<br>" + TITLE_I( "GEOM_POINT_I", 2 ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::ELLIPSE:
aKindStr = tr( "GEOM_ELLIPSE" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_NORMAL" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
- "\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::ARC_ELLIPSE:
aKindStr = tr( "GEOM_ARC_ELLIPSE" );
- theParameters = tr( "GEOM_CENTER" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_NORMAL" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
- "\n" + tr( "GEOM_DIMENSIONS" ) +
- "\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
- "\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
- "\n" + tr( "GEOM_POINT_I" ).arg( 1 ) +
- "\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
- "\n" + tr( "GEOM_POINT_I" ).arg( 2 ) +
- "\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[13], aLenPrecision );
+ theParameters = TITLE( "GEOM_CENTER" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+ "<br>" + TITLE_I( "GEOM_POINT_I", 1 ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
+ "<br>" + TITLE_I( "GEOM_POINT_I", 2 ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[13], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::LINE:
aKindStr = tr( "GEOM_LINE" );
- theParameters = tr( "GEOM_POSITION" ) +
- "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_DIRECTION" ) +
- "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
+ theParameters = TITLE( "GEOM_POSITION" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIRECTION" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::SEGMENT:
aKindStr = tr( "GEOM_SEGMENT" );
- theParameters = tr( "GEOM_POINT_I" ).arg( 1 ) +
- "\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
- "\n" + tr( "GEOM_POINT_I" ).arg( 2 ) +
- "\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
- "\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
- "\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
+ theParameters = TITLE_I( "GEOM_POINT_I", 1 ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE_I( "GEOM_POINT_I", 2 ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::EDGE:
aKindStr = tr( "GEOM_EDGE" );
break;
case GEOM::GEOM_IKindOfShape::VERTEX:
aKindStr = tr( "GEOM_VERTEX" );
- theParameters = tr( "GEOM_COORDINATES" ) +
- "\n" + tr( "GEOM_X" ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
- "\n" + tr( "GEOM_Y" ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
- "\n" + tr( "GEOM_Z" ) + PRINT_DOUBLE( aDbls[2], aLenPrecision );
+ theParameters = TITLE( "GEOM_COORDINATES" ) +
+ "<br>" + tr( "GEOM_X" ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y" ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z" ) + PRINT_DOUBLE( aDbls[2], aLenPrecision );
+ break;
+ case GEOM::GEOM_IKindOfShape::LCS:
+ aKindStr = tr( "GEOM_LCS" );
+ theParameters = TITLE("GEOM_POSITION") +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_X_AXIS") +
+ "<br>" + "Xx :" + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + "Xy :" + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + "Xz :" + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_Y_AXIS") +
+ "<br>" + "Yx :" + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + "Yy :" + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+ "<br>" + "Yz :" + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_Z_AXIS") +
+ "<br>" + "Zx :" + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
+ "<br>" + "Zy :" + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
+ "<br>" + "Zz :" + PRINT_DOUBLE( aDbls[11], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::ADVANCED:
{
return aKindStr;
}
+
+void MeasureGUI_WhatisDlg::SelectionIntoArgument()
+{
+ myObj.nullify();
+ myObj = getSelected( TopAbs_SHAPE );
+
+ if (!myObj) {
+ mySelEdit->setText("");
+ processObject();
+ erasePreview();
+ return;
+ }
+
+ mySelEdit->setText(GEOMBase::GetName(myObj.get()));
+ processObject();
+ redisplayPreview();
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
protected:
// redefined from GEOMBase_Helper and MeasureGUI_Skeleton
virtual void processObject();
+ virtual void activateSelection();
+ virtual void SelectionIntoArgument();
protected slots:
virtual void ClickOnProperties();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
--- /dev/null
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 MEASUREGUI_DEF_HXX
+#define MEASUREGUI_DEF_HXX
+
+#ifdef WIN32
+# if defined MEASUREGUI_EXPORTS || defined MeasureGUI_EXPORTS
+# define MEASUREGUI_EXPORT __declspec( dllexport )
+# else
+# define MEASUREGUI_EXPORT __declspec( dllimport )
+# endif
+#else
+# define MEASUREGUI_EXPORT
+#endif
+
+#endif
\ No newline at end of file
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GEOM_AISShape.hxx"
#include "GEOM_AISVector.hxx"
+#include <GEOMUtils.hxx>
+
#include <Basics_OCCTVersion.hxx>
// Open CASCADE Includes
-#include <AIS_Drawer.hxx>
#include <AIS_InteractiveContext.hxx>
#include <BRep_Tool.hxx>
#include <GCPnts_AbscissaPoint.hxx>
Handle(SelectMgr_Selection) sel = theObj->Selection( m );
for ( sel->Init(); sel->More(); sel->Next() ) {
+#if OCC_VERSION_LARGE > 0x06080100
+ const Handle(SelectMgr_SensitiveEntity) aHSenEntity = sel->Sensitive();
+ if( aHSenEntity.IsNull() )
+ continue;
+
+ Handle(SelectBasics_SensitiveEntity) entity = aHSenEntity->BaseSensitive();
+#else
Handle(SelectBasics_SensitiveEntity) entity = sel->Sensitive();
+#endif
if ( entity.IsNull() )
continue;
-
Handle(SelectMgr_EntityOwner) owner =
Handle(SelectMgr_EntityOwner)::DownCast(entity->OwnerId());
if ( !owner.IsNull() )
}
case ShadingWithEdges:
{
- shadingMode(aPresentationManager, aPrs, Shading);
myDrawer->SetFaceBoundaryDraw( Standard_True );
- Handle(Prs3d_LineAspect) aBoundaryAspect =
- new Prs3d_LineAspect ( myEdgesInShadingColor, Aspect_TOL_SOLID, myOwnWidth );
- myDrawer->SetFaceBoundaryAspect (aBoundaryAspect);
+ shadingMode(aPresentationManager, aPrs, Shading);
+ if( anIsColorField && myFieldDimension == 1 ) {
+ myDrawer->SetFaceBoundaryDraw( Standard_False );
+ drawField( aPrs );
+ }
break;
}
case TexturedShape:
{
- if(!isTopLev)
#ifdef USE_TEXTURED_SHAPE
AIS_TexturedShape::Compute(aPresentationManager, aPrs, aMode);
#else
AIS_Shape::Compute(aPresentationManager, aPrs, aMode);
#endif
- else
- shadingMode(aPresentationManager, aPrs, Shading);
- break;
}
}
if (isShowVectors())
if( anIsTextField )
drawField( aPrs, true );
+ if( isShowName() )
+ drawName( aPrs );
+
// aPrs->ReCompute(); // for hidden line recomputation if necessary...
}
myEdgesInShadingColor = aCol;
}
+void GEOM_AISShape::SetLabelColor(const Quantity_Color &aCol) {
+ myLabelColor = aCol;
+}
+
void GEOM_AISShape::highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap,
const Standard_Boolean aHighlight )
{
myDisplayVertices = isDisplayed;
}
+void GEOM_AISShape::SetDisplayName(bool isDisplayed)
+{
+ myDisplayName = isDisplayed;
+}
+
void GEOM_AISShape::shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPrs,
const Standard_Integer aMode)
myPrevDisplayMode = DisplayMode();
Standard_Integer dm;
switch(topLevelDisplayMode()) {
- case TopKeepCurrent : dm = myPrevDisplayMode; break;
- case TopWireFrame : dm = Wireframe; break;
+ case TopWireFrame : dm = Wireframe; break;
+ case TopShading : dm = Shading; break;
case TopShadingWithEdges : dm = ShadingWithEdges; break;
- default : dm = Shading; break;
+ default : dm = myPrevDisplayMode; break;
}
SetDisplayMode(dm);
} else {
Handle(Graphic3d_AspectText3d) anAspectText3d = new Graphic3d_AspectText3d();
anAspectText3d->SetStyle( Aspect_TOST_ANNOTATION );
+ anAspectText3d->SetColor( myLabelColor );
aGroup->SetPrimitivesAspect( anAspectText3d );
aGroup->Text( aString.toLatin1().constData(), aVertex, 14 );
}
}
+void GEOM_AISShape::drawName( const Handle(Prs3d_Presentation)& thePrs )
+{
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup( thePrs );
+
+ gp_Ax3 anAx3 = GEOMUtils::GetPosition(myshape);
+ gp_Pnt aCenter = anAx3.Location();
+
+ Graphic3d_Vertex aVertex( aCenter.X(), aCenter.Y(), aCenter.Z() );
+
+ Handle(Graphic3d_AspectText3d) anAspectText3d = new Graphic3d_AspectText3d();
+ anAspectText3d->SetStyle( Aspect_TOST_ANNOTATION );
+ anAspectText3d->SetColor( myLabelColor );
+ aGroup->SetPrimitivesAspect( anAspectText3d );
+
+ const char* aName = getIO()->getName();
+ aGroup->Text( TCollection_ExtendedString( aName ), aVertex, 16 );
+}
+
Standard_Boolean GEOM_AISShape::computeMassCenter( const TopoDS_Shape& theShape,
gp_Pnt& theCenter )
{
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
Standard_EXPORT void SetShadingColor(const Quantity_Color &aCol);
Standard_EXPORT void SetEdgesInShadingColor(const Quantity_Color &aCol);
+ Standard_EXPORT void SetLabelColor(const Quantity_Color &aCol);
Standard_EXPORT void SetDisplayVectors(bool isShow);
Standard_EXPORT void SetDisplayVertices(bool isShow);
+ Standard_EXPORT void SetDisplayName(bool isShow);
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
Standard_EXPORT virtual bool isShowVectors() { return myDisplayVectors; }
Standard_EXPORT virtual bool isShowVertices() { return myDisplayVertices; }
+ Standard_EXPORT virtual bool isShowName() { return myDisplayName; }
Standard_EXPORT virtual Standard_Boolean switchTopLevel();
Standard_EXPORT virtual Standard_Boolean toActivate();
const bool theIsText = false,
const bool theIsHighlight = false );
+ // Displaying the name of shape
+ Standard_EXPORT void drawName( const Handle(Prs3d_Presentation)& thePrs );
+
// Auxiliary method to compute a center of mass for the specified shape
Standard_EXPORT static Standard_Boolean computeMassCenter( const TopoDS_Shape& theShape,
gp_Pnt& theCenter );
private:
Quantity_Color myShadingColor;
Quantity_Color myEdgesInShadingColor;
+ Quantity_Color myLabelColor;
TCollection_AsciiString myName;
bool myDisplayVectors;
bool myDisplayVertices;
+ bool myDisplayName;
Standard_Boolean myTopLevel;
Standard_Integer myPrevDisplayMode;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GEOM_WireframeFace.h"
#include "GEOM_ShadingFace.h"
#include "GEOM_PainterPolyDataMapper.h"
+#include "GEOMUtils.hxx"
#include "SVTK_Actor.h"
#include <OCC2VTK_Tools.h>
+#include <GEOMUtils.hxx>
#include <vtkObjectFactory.h>
#include <vtkRenderer.h>
+#include <vtkTextActor.h>
+#include <vtkTextProperty.h>
#include <vtkProperty.h>
#include <vtkPointPicker.h>
#include <vtkCellPicker.h>
myIsSelected(false),
myVectorMode(false),
myVerticesMode(false),
+ myNameMode(false),
myVertexActor(GEOM_DeviceActor::New(),true),
myVertexSource(GEOM_VertexSource::New(),true),
// defined in this class !!!
myPolyDataMapper(GEOM_PainterPolyDataMapper::New(),true),
+ myTextActor( vtkTextActor::New() ),
+
myHighlightProp(vtkProperty::New()),
myPreHighlightProp(vtkProperty::New()),
myShadingFaceProp(vtkProperty::New()),
setDisplayMode(0); // WIRE FRAME
SetVectorMode(0); //
SetVerticesMode(0); //
+ SetNameMode(0);
}
this->mySharedEdgeSource->Modified();
this->myWireframeFaceSource->Modified();
this->myShadingFaceSource->Modified();
+ this->myTextActor->Modified();
}
void
myVertexActor->AddToRender(theRenderer);
myStandaloneVertexActor->AddToRender(theRenderer);
+
+ theRenderer->AddActor( myTextActor );
}
void
myVertexActor->RemoveFromRender(theRenderer);
myStandaloneVertexActor->RemoveFromRender(theRenderer);
+ theRenderer->RemoveActor( myTextActor );
SetSelected(false);
SetVisibility(false);
myIsolatedEdgeActor->GetProperty()->SetColor(myIsolatedEdgeColor[0],
myIsolatedEdgeColor[1],
myIsolatedEdgeColor[2]);
- mySharedEdgeActor->GetProperty()->SetColor(myIsolatedEdgeColor[0],
- myIsolatedEdgeColor[1],
- myIsolatedEdgeColor[2]);
+ mySharedEdgeActor->GetProperty()->SetColor(mySharedEdgeColor[0],
+ mySharedEdgeColor[1],
+ mySharedEdgeColor[2]);
myOneFaceEdgeActor->GetProperty()->SetColor(myOneFaceEdgeColor[0],
myOneFaceEdgeColor[1],
myOneFaceEdgeColor[2]);
myVertexActor->SetVisibility(theVisibility && (isOnlyVertex || (myVerticesMode && (!myIsSelected && !myIsPreselected))));// must be added new mode points
myStandaloneVertexActor->SetVisibility(theVisibility);
+
+ myTextActor->SetVisibility( theVisibility && myNameMode );
}
return myVerticesMode;
}
+void
+GEOM_Actor
+::SetShapeName()
+{
+ if( !getIO() || myShape.IsNull() )
+ return;
+
+ gp_Ax3 anAx3 = GEOMUtils::GetPosition(myShape);
+ double center[3] = { anAx3.Location().X(),
+ anAx3.Location().Y(),
+ anAx3.Location().Z() };
+ double* pos = center;
+ myTextActor->GetTextProperty()->SetFontSize( 16 );
+ myTextActor->GetTextProperty()->ShadowOn();
+ myTextActor->GetPositionCoordinate()->SetCoordinateSystemToWorld();
+ myTextActor->GetPositionCoordinate()->SetValue(pos);
+ myTextActor->SetInput( getIO()->getName() );
+}
+
+void
+GEOM_Actor
+::SetNameMode(bool theMode)
+{
+ myNameMode = theMode;
+ myTextActor->SetVisibility(theMode);
+ SetModified();
+}
+
+bool
+GEOM_Actor
+::GetNameMode()
+{
+ return myNameMode;
+}
+
void
GEOM_Actor::
-SetDeflection(float theDeflection)
+SetDeflection(double theDeflection)
{
- if( myDeflection == theDeflection )
- return;
-
- myDeflection = theDeflection;
-
- GEOM::MeshShape(myShape,myDeflection);
-
- SetModified();
+ double aDeflection = ( theDeflection <= 0 ) ? GEOMUtils::DefaultDeflection() : theDeflection;
+
+ if ( myDeflection != aDeflection ) {
+ myDeflection = aDeflection;
+ GEOMUtils::MeshShape( myShape, myDeflection );
+ SetModified();
+ }
}
void GEOM_Actor::SetShape (const TopoDS_Shape& theShape,
- float theDeflection,
+ double theDeflection,
bool theIsVector)
{
myShape = theShape;
TopTools_IndexedDataMapOfShapeListOfShape anEdgeMap;
TopExp::MapShapesAndAncestors(theShape,TopAbs_EDGE,TopAbs_FACE,anEdgeMap);
- GEOM::SetShape(theShape,anEdgeMap,theIsVector,
- myStandaloneVertexSource.Get(),
- myIsolatedEdgeSource.Get(),
- myOneFaceEdgeSource.Get(),
- mySharedEdgeSource.Get(),
- myWireframeFaceSource.Get(),
- myShadingFaceSource.Get());
+ GEOM::ShapeToVTK(theShape,anEdgeMap,theIsVector,
+ myStandaloneVertexSource.Get(),
+ myIsolatedEdgeSource.Get(),
+ myOneFaceEdgeSource.Get(),
+ mySharedEdgeSource.Get(),
+ myWireframeFaceSource.Get(),
+ myShadingFaceSource.Get());
isOnlyVertex =
myIsolatedEdgeSource->IsEmpty() &&
myOneFaceEdgeSource->IsEmpty() &&
myHighlightActor->GetDeviceActor()->SetInfinitive(true);
}
+ SetShapeName();
+
// 0051777: TC7.2.0: Element could not be selected in Hypothesis Construction
myAppendFilter->Update();
}
-// OLD METHODS
-void GEOM_Actor::setDeflection(double adef) {
-#ifdef MYDEBUG
- MESSAGE ( "GEOM_Actor::setDeflection" );
-#endif
- SetDeflection((float)adef);
-}
-
-
// warning! must be checked!
// SetHighlightProperty
// SetWireframeProperty
#endif
}
-double GEOM_Actor::getDeflection()
-{
-#ifdef MYDEBUG
- MESSAGE ( "GEOM_Actor::getDeflection" );
-#endif
- return (double) GetDeflection();
-}
-
-
double GEOM_Actor::isVector()
{
#ifdef MYDEBUG
myWireframeFaceActor->GetProperty()->SetColor(r, g, b);
}
+/*!
+ \brief Set color of labels
+ This actor is shown only if 'Show name' is switched-on, see SetVisibility()
+*/
+void GEOM_Actor::SetLabelColor(double r, double g, double b)
+{
+ myTextActor->GetTextProperty()->SetColor(r, g, b);
+}
+
void GEOM_Actor::SetMaterial(std::vector<vtkProperty*> theProps)
{
// we set material properties as back and front material
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
typedef GEOM_SmartPtr<GEOM_ShadingFace> PSFaceSource;
class vtkRenderer;
+class vtkTextActor;
class vtkAppendPolyData;
typedef GEOM_SmartPtr<vtkAppendPolyData> PAppendFilter;
static GEOM_Actor* New();
void SetShape(const TopoDS_Shape& theShape,
- float theDeflection,
+ double theDeflection,
bool theIsVector = false);
- void SetDeflection(float theDeflection);
- float GetDeflection() const{ return myDeflection;}
+ void SetDeflection(double theDeflection);
+ double GetDeflection() const{ return myDeflection;}
void AddToRender(vtkRenderer* theRenderer);
void RemoveFromRender(vtkRenderer* theRenderer);
vtkProperty* GetSharedEdgeProperty();
vtkProperty* GetFaceEdgeProperty();
- void setDeflection(double adef);
virtual void setDisplayMode(int thenewmode);
// Description:
const TopoDS_Shape& getTopo();
void setInputShape(const TopoDS_Shape& ashape, double adef1,
int imode, bool isVector = false);
- double getDeflection();
double isVector();
// SubShape
void SetEdgesInShadingColor(double r, double g, double b);
// Color of iso-lines
void SetIsosColor(double r, double g, double b);
+ // Color of labels
+ void SetLabelColor(double r, double g, double b);
// Material
bool
GetVerticesMode();
+ //! Name mode management
+ virtual
+ void
+ SetNameMode(const bool theMode);
+
+ virtual
+ bool
+ GetNameMode();
+
protected:
void SetModified();
void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result);
+ void SetShapeName();
GEOM_Actor();
~GEOM_Actor();
TopoDS_Shape myShape;
bool isOnlyVertex;
- float myDeflection;
+ double myDeflection;
bool myIsForced;
// EDisplayMode myDisplayMode;
bool myIsSelected;
bool myVectorMode;
bool myVerticesMode;
+ bool myNameMode;
PDeviceActor myVertexActor;
PVertexSource myVertexSource;
PSFaceSource myShadingFaceSource;
PDeviceActor myHighlightActor;
+
+ vtkTextActor* myTextActor;
+
vtkSmartPointer<vtkProperty> myHighlightProp;
vtkSmartPointer<vtkProperty> myPreHighlightProp;
vtkSmartPointer<vtkProperty> myShadingFaceProp;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
"VectorMode", // VECTOR_MODE_PROP
// "show vertices" flag
"VerticesMode", // VERTICES_MODE_PROP
+ // "show name" flag
+ "NameMode", // NAME_MODE_PROP
// deflection coefficient
"DeflectionCoeff", // DEFLECTION_COEFF_PROP
// point marker data
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
Color,
EdgesDirection,
Vertices,
+ ShowName,
Deflection,
PointMarker,
Material,
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <SALOME_InteractiveObject.hxx>
//Open CASCADE includes
-#include <AIS_Drawer.hxx>
#include <TopoDS_Shape.hxx>
#include <Prs3d_IsoAspect.hxx>
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
aRes->AddInputConnection( aSrcZ->GetOutputPort() );
myMapper->SetInputConnection( aRes->GetOutputPort() );
+ aRes->Update();
SALOME_Actor::SetMapper( myMapper );
aSrcX->Delete();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
pt2.Transform(edgeTransf);
}
- float aCoord1[3] = {pt1.X(), pt1.Y(), pt1.Z()};
+ float aCoord1[3] = {(float)pt1.X(), (float)pt1.Y(), (float)pt1.Z()};
vtkIdType anIds[2];
anIds[0] = thePts->InsertNextPoint(aCoord1);
- float aCoord2[3] = {pt2.X(), pt2.Y(), pt2.Z()};
+ float aCoord2[3] = {(float)pt2.X(), (float)pt2.Y(), (float)pt2.Z()};
anIds[1] = thePts->InsertNextPoint(aCoord2);
thePolyData->InsertNextCell(VTK_LINE,2,anIds);
pt2.Transform(edgeTransf);
}
- float aCoord1[3] = {pt1.X(), pt1.Y(), pt1.Z()};
+ float aCoord1[3] = {(float)pt1.X(), (float)pt1.Y(), (float)pt1.Z()};
vtkIdType anIds[2];
anIds[0] = thePts->InsertNextPoint(aCoord1);
- float aCoord2[3] = {pt2.X(), pt2.Y(), pt2.Z()};
+ float aCoord2[3] = {(float)pt2.X(), (float)pt2.Y(), (float)pt2.Z()};
anIds[1] = thePts->InsertNextPoint(aCoord2);
thePolyData->InsertNextCell(VTK_LINE,2,anIds);
// Add points and segments, composing the arrow
Standard_Real cosinus, sinus, Tg = tan(anAngle);
- float coord[3] = {xo, yo, zo};
+ float coord[3] = {(float)xo, (float)yo, (float)zo};
vtkIdType ptLoc = thePts->InsertNextPoint(coord);
vtkIdType ptFirst = 0;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "GEOM_EdgeSource.h"
#include "GEOM_WireframeFace.h"
#include "GEOM_ShadingFace.h"
+#include "GEOMUtils.hxx"
#include <Bnd_Box.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <TopTools_ListOfShape.hxx>
-#define MAX2(X, Y) (Abs(X) > Abs(Y) ? Abs(X) : Abs(Y))
-#define MAX3(X, Y, Z) (MAX2(MAX2(X,Y), Z))
-
-#define DEFAULT_DEFLECTION 0.001
+#include <TopExp.hxx>
+#include <vtkAppendPolyData.h>
+#include <vtkPolyData.h>
+#include <BRepBuilderAPI_Copy.hxx>
namespace GEOM
{
- void MeshShape(const TopoDS_Shape theShape,
- float& theDeflection,
- bool theForced ) {
-
- Standard_Real aDeflection = theDeflection <= 0 ? DEFAULT_DEFLECTION : theDeflection;
-
- //If deflection <= 0, than return default deflection
- if(theDeflection <= 0)
- theDeflection = aDeflection;
-
- // Is shape triangulated?
- Standard_Boolean alreadymeshed = Standard_True;
- TopExp_Explorer ex;
- TopLoc_Location aLoc;
- for (ex.Init(theShape, TopAbs_FACE); ex.More(); ex.Next()) {
- const TopoDS_Face& aFace = TopoDS::Face(ex.Current());
- Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(aFace,aLoc);
- if(aPoly.IsNull()) {
- alreadymeshed = Standard_False;
- break;
- }
- }
-
- if(!alreadymeshed || theForced) {
- Bnd_Box B;
- BRepBndLib::Add(theShape, B);
- if ( B.IsVoid() )
- return; // NPAL15983 (Bug when displaying empty groups)
- Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
- B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
-
- // This magic line comes from Prs3d_ShadedShape.gxx in OCCT
- aDeflection = MAX3(aXmax-aXmin, aYmax-aYmin, aZmax-aZmin) * aDeflection * 4;
-
- //Clean triangulation before compute incremental mesh
- BRepTools::Clean(theShape);
-
- //Compute triangulation
- BRepMesh_IncrementalMesh MESH(theShape,aDeflection);
- }
- }
-
- void SetShape(const TopoDS_Shape& theShape,
- const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap,
- bool theIsVector,
- GEOM_VertexSource* theStandaloneVertexSource,
- GEOM_EdgeSource* theIsolatedEdgeSource,
- GEOM_EdgeSource* theOneFaceEdgeSource,
- GEOM_EdgeSource* theSharedEdgeSource,
- GEOM_WireframeFace* theWireframeFaceSource,
- GEOM_ShadingFace* theShadingFaceSource)
+ void ShapeToVTK( const TopoDS_Shape& theShape,
+ const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap,
+ bool theIsVector,
+ GEOM_VertexSource* theStandaloneVertexSource,
+ GEOM_EdgeSource* theIsolatedEdgeSource,
+ GEOM_EdgeSource* theOneFaceEdgeSource,
+ GEOM_EdgeSource* theSharedEdgeSource,
+ GEOM_WireframeFace* theWireframeFaceSource,
+ GEOM_ShadingFace* theShadingFaceSource )
{
if (theShape.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Iterator anItr(theShape);
for (; anItr.More(); anItr.Next()) {
- SetShape(anItr.Value(),theEdgeMap,theIsVector,
- theStandaloneVertexSource,
- theIsolatedEdgeSource,
- theOneFaceEdgeSource,
- theSharedEdgeSource,
- theWireframeFaceSource,
- theShadingFaceSource);
+ ShapeToVTK( anItr.Value(),theEdgeMap,theIsVector,
+ theStandaloneVertexSource,
+ theIsolatedEdgeSource,
+ theOneFaceEdgeSource,
+ theSharedEdgeSource,
+ theWireframeFaceSource,
+ theShadingFaceSource );
}
}
}
}
}
+
+ vtkPolyData* GetVTKData( const TopoDS_Shape& theShape, float theDeflection )
+ {
+ vtkPolyData* ret = 0;
+
+ BRepBuilderAPI_Copy aCopy(theShape);
+ if (aCopy.IsDone() ) {
+
+ TopoDS_Shape aShape = aCopy.Shape();
+
+ try {
+ GEOM_VertexSource* myVertexSource = GEOM_VertexSource::New();
+ GEOM_EdgeSource* myIsolatedEdgeSource = GEOM_EdgeSource::New();
+ GEOM_EdgeSource* myOneFaceEdgeSource = GEOM_EdgeSource::New();
+ GEOM_EdgeSource* mySharedEdgeSource = GEOM_EdgeSource::New();
+ GEOM_WireframeFace* myWireframeFaceSource = GEOM_WireframeFace::New();
+ GEOM_ShadingFace* myShadingFaceSource = GEOM_ShadingFace::New();
+
+ vtkAppendPolyData* myAppendFilter = vtkAppendPolyData::New();
+ myAppendFilter->AddInputConnection( myVertexSource->GetOutputPort() );
+ myAppendFilter->AddInputConnection( myIsolatedEdgeSource->GetOutputPort() );
+ myAppendFilter->AddInputConnection( myOneFaceEdgeSource->GetOutputPort() );
+ myAppendFilter->AddInputConnection( mySharedEdgeSource->GetOutputPort() );
+ myAppendFilter->AddInputConnection( myShadingFaceSource->GetOutputPort() );
+
+ bool anIsVector = false;
+
+ GEOMUtils::MeshShape( aShape, theDeflection );
+ TopExp_Explorer aVertexExp( aShape, TopAbs_VERTEX );
+ for( ; aVertexExp.More(); aVertexExp.Next() ) {
+ const TopoDS_Vertex& aVertex = TopoDS::Vertex( aVertexExp.Current() );
+ myVertexSource->AddVertex( aVertex );
+ }
+
+ TopTools_IndexedDataMapOfShapeListOfShape anEdgeMap;
+ TopExp::MapShapesAndAncestors( aShape, TopAbs_EDGE, TopAbs_FACE, anEdgeMap );
+
+ ShapeToVTK( aShape,
+ anEdgeMap,
+ anIsVector,
+ 0,
+ myIsolatedEdgeSource,
+ myOneFaceEdgeSource,
+ mySharedEdgeSource,
+ myWireframeFaceSource,
+ myShadingFaceSource );
+
+ myAppendFilter->Update();
+
+ myVertexSource->Delete();
+ myIsolatedEdgeSource->Delete();
+ myOneFaceEdgeSource->Delete();
+ mySharedEdgeSource->Delete();
+ myWireframeFaceSource->Delete();
+ myShadingFaceSource->Delete();
+
+ ret = vtkPolyData::New();
+ ret->ShallowCopy(myAppendFilter->GetOutput());
+ myAppendFilter->Delete();
+ }
+ catch(Standard_Failure) {
+ }
+ }
+ return ret;
+ }
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
class GEOM_EdgeSource;
class GEOM_WireframeFace;
class GEOM_ShadingFace;
+class vtkPolyData;
namespace GEOM
{
- // moved from GEOM_AssemblyBuilder
- OCC2VTK_EXPORT void MeshShape(const TopoDS_Shape theShape,
- float& theDeflection,
- bool theForced = true);
-
- // moved from GEOM_Actor
- OCC2VTK_EXPORT void SetShape(const TopoDS_Shape& theShape,
- const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap,
- bool theIsVector,
- GEOM_VertexSource* theStandaloneVertexSource,
- GEOM_EdgeSource* theIsolatedEdgeSource,
- GEOM_EdgeSource* theOneFaceEdgeSource,
- GEOM_EdgeSource* theSharedEdgeSource,
- GEOM_WireframeFace* theWireframeFaceSource,
- GEOM_ShadingFace* theShadingFaceSource);
+ /*!
+ * \brief Convert shape to the VTK data sources
+ * \param theShape shape
+ * \param theEdgeMape map that stores face-to-edge relations
+ * \param theIsVector boolen flag, when \c true causes generating additional
+ * dataset for edges orientation vectors
+ * \param theStandaloneVertexSource output standalone vertices data source
+ * \param theIsolatedEdgeSource output standalone edges data source
+ * \param theOneFaceEdgeSource output face edges data source
+ * \param theSharedEdgeSource output face shared edges data source
+ * \param theWireframeFaceSource output wireframe mode faces data source
+ * \param theShadingFaceSource output shading mode faces data source
+ */
+ OCC2VTK_EXPORT void ShapeToVTK( const TopoDS_Shape& theShape,
+ const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap,
+ bool theIsVector,
+ GEOM_VertexSource* theStandaloneVertexSource,
+ GEOM_EdgeSource* theIsolatedEdgeSource,
+ GEOM_EdgeSource* theOneFaceEdgeSource,
+ GEOM_EdgeSource* theSharedEdgeSource,
+ GEOM_WireframeFace* theWireframeFaceSource,
+ GEOM_ShadingFace* theShadingFaceSource );
+
+ /*!
+ * \brief Get VTK mesh data from the shape
+ * \param theShape shape
+ * \param theDeflection requested deflection coefficient
+ * \return VTK data set
+ */
+ OCC2VTK_EXPORT vtkPolyData* GetVTKData( const TopoDS_Shape& theShape, float theDeflection );
}
#endif // OCC2VTK_TOOLS_H
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
OperationGUI_GetSharedShapesDlg.h
OperationGUI_ExtrudedFeatureDlg.h
OperationGUI_ClippingDlg.h
+ OperationGUI_TransferDataDlg.h
)
# header files / to be processed by moc
OperationGUI_GetSharedShapesDlg.h
OperationGUI_ExtrudedFeatureDlg.h
OperationGUI_ClippingDlg.h
+ OperationGUI_TransferDataDlg.h
)
# header files / uic wrappings
OperationGUI_ChamferDlg.cxx
OperationGUI_ExtrudedFeatureDlg.cxx
OperationGUI_ClippingDlg.cxx
+ OperationGUI_TransferDataDlg.cxx
${_moc_SOURCES}
${_uic_files}
)
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "OperationGUI_GetShapesOnShapeDlg.h"
#include "OperationGUI_GetSharedShapesDlg.h"
#include "OperationGUI_ExtrudedFeatureDlg.h" // Methods EXTRUDED BOSS / CUT
+#include "OperationGUI_TransferDataDlg.h"
//=======================================================================
// function : OperationGUI()
case GEOMOp::OpExtrudedCut: (new OperationGUI_ExtrudedFeatureDlg (CUT, getGeometryGUI(), parent))->show(); break;
case GEOMOp::OpFillet1d: (new OperationGUI_Fillet1d2dDlg (getGeometryGUI(), parent, true))->show(); break;
case GEOMOp::OpFillet2d: (new OperationGUI_Fillet1d2dDlg (getGeometryGUI(), parent, false))->show(); break;
+ case GEOMOp::OpTransferData: (new OperationGUI_TransferDataDlg (getGeometryGUI(), parent))->show(); break;
default:
app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
{
processPreview();
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> OperationGUI_ArchimedeDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myShape);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
- virtual bool execute( ObjectList& );
+ virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
processPreview();
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> OperationGUI_ChamferDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myShape);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private slots:
void ClickOnOk();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
if (myGroup->PushButton3->isChecked())
angle=myGroup->SpinBox_DY->value();
-
- if (myGroup->PushButton4->isChecked())
- {
- aHeight = -aHeight;
- angle = -angle;
- }
- bool isProtrusion = (myOperation == OperationGUI::BOSS);
+ bool isProtrusion = (myOperation == OperationGUI::BOSS);
+ bool isInvert = myGroup->PushButton4->isChecked();
// Hide the initial shape in order to see the modifications on the preview
erase(myObject1.get(),false);
GEOM::GEOM_Object_var anObj = anOper->MakeDraftPrism(myObject1.get(), myObject2.get(),
aHeight,
angle,
- isProtrusion);
- if (!anObj->_is_nil())
+ isProtrusion,
+ isInvert);
+ if (!anObj->_is_nil()) {
+ if (!IsPreview()) {
+ QStringList aParameters;
+ aParameters << myGroup->SpinBox_DX->text();
+ if (myGroup->PushButton3->isChecked())
+ aParameters << myGroup->SpinBox_DY->text();
+ anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+ }
objects.push_back(anObj._retn());
+ }
return true;
}
// {
// GEOMBase::PublishSubObject( myObject2.get() );
// }
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> OperationGUI_ExtrudedFeatureDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myObject1 << myObject2;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
// virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
anOper->MakeFillet1D(myShape, getRadius(), aListOfIndexes, GroupVertexes->CheckButton1->isChecked()) :
anOper->MakeFillet2D(myShape, getRadius(), aListOfIndexes);
- if (!anObj->_is_nil())
+ if (!anObj->_is_nil()) {
+ if (!IsPreview()) {
+ QStringList aParameters;
+ aParameters << GroupVertexes->SpinBox_DX->text();
+ anObj->SetParameters(aParameters.join(":").toUtf8().constData());
+ }
objects.push_back(anObj._retn());
+ }
return true;
}
{
return GroupVertexes->SpinBox_DX->value();
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> OperationGUI_Fillet1d2dDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myShape);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private slots:
void ClickOnOk();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
processPreview();
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> OperationGUI_FilletDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myShape);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private slots:
void ClickOnOk();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//bool IsEnabled = GroupPoints->ComboBox1->currentIndex() < 3;
processPreview();
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> OperationGUI_GetShapesOnShapeDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr1(myObject1), aGeomObjPtr2(myObject2);
+ res << aGeomObjPtr1 << aGeomObjPtr2;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
+namespace
+{
+ GEOM::shape_type maxShapeType(const GEOM::ListOfGO& objs)
+ {
+ GEOM::shape_type r = GEOM::SHAPE;
+ for ( int i = 0; i < objs.length(); i++ ) {
+ GEOM::shape_type t = objs[i]->GetShapeType();
+ if ( t == GEOM::COMPOUND || t == GEOM::COMPSOLID )
+ t = objs[i]->GetMaxShapeType();
+ else if ( t < GEOM::VERTEX )
+ t = GEOM::shape_type( (int)t+1 );
+ r = qMin( r, t );
+ if ( r <= GEOM::SOLID ) break;
+ }
+ return r;
+ }
+}
+
//=================================================================================
// class : OperationGUI_GetSharedShapesDlg()
// purpose : Constructs a OperationGUI_GetSharedShapesDlg which is a child of 'parent', with the
GroupPoints->LineEdit1->setReadOnly(true);
GroupPoints->LineEdit2->hide();
GroupPoints->LineEdit1->setEnabled(true);
- GroupPoints->CheckButton1->hide();
+ GroupPoints->CheckButton1->setText(tr("GEOM_SHARED_SHAPES_MULTISHARE"));
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
//=================================================================================
void OperationGUI_GetSharedShapesDlg::Init()
{
- /* type for sub-shape selection */
- GroupPoints->ComboBox1->addItem(tr("GEOM_SOLID"));
- GroupPoints->ComboBox1->addItem(tr("GEOM_SHELL"));
- GroupPoints->ComboBox1->addItem(tr("GEOM_FACE"));
- GroupPoints->ComboBox1->addItem(tr("GEOM_WIRE"));
- GroupPoints->ComboBox1->addItem(tr("GEOM_EDGE"));
- GroupPoints->ComboBox1->addItem(tr("GEOM_VERTEX"));
-
- GroupPoints->ComboBox1->setCurrentIndex(0);
+ initTypes();
showOnlyPreviewControl();
connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
+ connect(GroupPoints->CheckButton1, SIGNAL(clicked()), this, SLOT(processPreview()));
+
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
GroupPoints->PushButton1->click();
}
+void OperationGUI_GetSharedShapesDlg::initTypes()
+{
+ GEOM::shape_type t = maxShapeType( myListShapes );
+
+ int idx = GroupPoints->ComboBox1->count() > 0 ?
+ GroupPoints->ComboBox1->itemData( GroupPoints->ComboBox1->currentIndex() ).toInt() : -1;
+
+ GroupPoints->ComboBox1->clear();
+
+ if ( t == GEOM::SHAPE || t <= GEOM::SOLID )
+ GroupPoints->ComboBox1->addItem( tr( "GEOM_SOLID" ), int( GEOM::SOLID ) );
+ if ( t == GEOM::SHAPE || t <= GEOM::SHELL )
+ GroupPoints->ComboBox1->addItem( tr( "GEOM_SHELL" ), int( GEOM::SHELL ) );
+ if ( t == GEOM::SHAPE || t <= GEOM::FACE )
+ GroupPoints->ComboBox1->addItem( tr( "GEOM_FACE" ), int( GEOM::FACE ) );
+ if ( t == GEOM::SHAPE || t <= GEOM::WIRE )
+ GroupPoints->ComboBox1->addItem( tr( "GEOM_WIRE" ), int( GEOM::WIRE ) );
+ if ( t == GEOM::SHAPE || t <= GEOM::EDGE )
+ GroupPoints->ComboBox1->addItem( tr( "GEOM_EDGE" ), int( GEOM::EDGE ) );
+ if ( t == GEOM::SHAPE || t <= GEOM::VERTEX )
+ GroupPoints->ComboBox1->addItem( tr( "GEOM_VERTEX" ), int( GEOM::VERTEX ) );
+
+ idx = GroupPoints->ComboBox1->findData( idx );
+ GroupPoints->ComboBox1->setCurrentIndex( idx >= 0 ? idx : 0 );
+
+ if ( idx < 0 )
+ ComboTextChanged();
+}
+
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
myListShapes.length(0);
- GroupPoints->ComboBox1->setCurrentIndex(0);
GroupPoints->PushButton1->setDown(true);
myEditCurrentArgument = GroupPoints->LineEdit1;
}
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true);
+
+ initTypes();
+
if (!myListShapes.length())
return;
//=================================================================================
int OperationGUI_GetSharedShapesDlg::GetType() const
{
- int aLimit = GroupPoints->ComboBox1->currentIndex();
-
- switch (aLimit) {
- case 0: aLimit = GEOM::SOLID ; break;
- case 1: aLimit = GEOM::SHELL ; break;
- case 2: aLimit = GEOM::FACE ; break;
- case 3: aLimit = GEOM::WIRE ; break;
- case 4: aLimit = GEOM::EDGE ; break;
- case 5: aLimit = GEOM::VERTEX; break;
- default: aLimit = GEOM::SHAPE ;
- }
-
- return aLimit;
+ return GroupPoints->ComboBox1->count() > 0 ?
+ GroupPoints->ComboBox1->itemData( GroupPoints->ComboBox1->currentIndex() ).toInt() : (int)GEOM::SHAPE;
}
//=================================================================================
//=================================================================================
bool OperationGUI_GetSharedShapesDlg::isValid (QString& msg)
{
- if (myListShapes.length() < 2) {
+ bool isOK = myListShapes.length() > 1 ||
+ ( myListShapes.length() > 0 && myListShapes[0]->GetShapeType() == GEOM::COMPOUND );
+
+ if ( !isOK )
msg = tr("MSG_SHARED_SHAPES_TOO_FEW_SHAPES");
- return false;
- }
- return true;
+
+ return isOK;
}
//=================================================================================
bool OperationGUI_GetSharedShapesDlg::execute (ObjectList& objects)
{
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
- GEOM::ListOfGO_var aList = anOper->GetSharedShapesMulti(myListShapes, GetType());
+ GEOM::ListOfGO_var aList = anOper->GetSharedShapesMulti(myListShapes, GetType(), GroupPoints->CheckButton1->isChecked());
if (!aList->length())
return false;
{
QString aPref;
- int aLimit = GroupPoints->ComboBox1->currentIndex();
-
- switch (aLimit) {
- case 0: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SOLID")) ; break;
- case 1: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SHELL")) ; break;
- case 2: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_FACE")) ; break;
- case 3: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_WIRE")) ; break;
- case 4: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_EDGE")) ; break;
- case 5: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_VERTEX")); break;
- default: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SHAPE")) ;
+ switch ( GetType() ) {
+ case GEOM::SOLID: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SOLID")) ; break;
+ case GEOM::SHELL: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SHELL")) ; break;
+ case GEOM::FACE: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_FACE")) ; break;
+ case GEOM::WIRE: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_WIRE")) ; break;
+ case GEOM::EDGE: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_EDGE")) ; break;
+ case GEOM::VERTEX: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_VERTEX")); break;
+ default: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SHAPE")) ; break;
}
return aPref;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> OperationGUI_GetSharedShapesDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::ListOfGO aListPtr(myListShapes);
+ for (int i = 0; i < aListPtr.length(); i++) {
+ GEOM::GeomObjPtr aGeomObjPtr(aListPtr[i]);
+ res << aGeomObjPtr;
+ }
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool execute (ObjectList&);
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
QString getPrefixByType() const;
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
void enterEvent (QEvent*);
int GetType() const;
+ void initTypes();
private:
GEOM::ListOfGO myListShapes;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PARTITION" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setIcon( image1 );
+ mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
return aLimit;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> OperationGUI_PartitionDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ for (int i = 0; i < myListShapes.length(); i++) {
+ GEOM::GeomObjPtr aGeomObjPtr(myListShapes[i]);
+ res << aGeomObjPtr;
+ }
+ for (int i = 0; i < myListTools.length(); i++) {
+ GEOM::GeomObjPtr aGeomObjPtr(myListTools[i]);
+ res << aGeomObjPtr;
+ }
+ for (int i = 0; i < myListRemoveInside.length(); i++) {
+ GEOM::GeomObjPtr aGeomObjPtr(myListRemoveInside[i]);
+ res << aGeomObjPtr;
+ }
+ for (int i = 0; i < myListKeepInside.length(); i++) {
+ GEOM::GeomObjPtr aGeomObjPtr(myListKeepInside[i]);
+ res << aGeomObjPtr;
+ }
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 "OperationGUI_TransferDataDlg.h"
+
+#include <DlgRef.h>
+#include <GeometryGUI.h>
+#include <GEOMBase.h>
+
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SalomeApp_Application.h>
+#include <LightApp_SelectionMgr.h>
+
+//==============================================================================
+// class : OperationGUI_TransferDataDlg()
+// purpose : Constructs a OperationGUI_TransferDataDlg which is a child of
+// 'parent'.
+//=================================================================================
+OperationGUI_TransferDataDlg::OperationGUI_TransferDataDlg (GeometryGUI* theGeometryGUI,
+ QWidget* parent)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, false),
+ myGroup(NULL)
+{
+ SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
+ QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSFER_DATA")));
+ QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
+
+ setWindowTitle(tr("GEOM_TRANSFER_DATA_TITLE"));
+
+ /***************************************************************/
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_TRANSFER_DATA"));
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton3->close();
+
+ mainFrame()->GroupBoxName->hide();
+
+ myGroup = new DlgRef_2Sel1List(centralWidget());
+ myGroup->GroupBox1->setTitle(tr("GEOM_PARAMETERS"));
+ myGroup->TextLabel1->setText(tr("GEOM_TRANSFER_DATA_FROM"));
+ myGroup->TextLabel2->setText(tr("GEOM_TRANSFER_DATA_TO"));
+ myGroup->TextLabel3->setText(tr("GEOM_TRANSFER_DATA_METHOD"));
+ myGroup->PushButton1->setIcon(image1);
+ myGroup->PushButton2->setIcon(image1);
+ myGroup->LineEdit1->setReadOnly(true);
+ myGroup->LineEdit2->setReadOnly(true);
+
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ layout->setMargin(0); layout->setSpacing(6);
+ layout->addWidget(myGroup);
+ /***************************************************************/
+
+ setHelpFileName("transfer_data_page.html");
+
+ Init();
+}
+
+//=================================================================================
+// function : ~OperationGUI_TransferDataDlg
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+OperationGUI_TransferDataDlg::~OperationGUI_TransferDataDlg()
+{
+}
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void OperationGUI_TransferDataDlg::Init()
+{
+ // type for detection
+ myGroup->ComboBox1->addItem(tr("GEOM_TD_METHOD_GETINPLACE"));
+ myGroup->ComboBox1->addItem(tr("GEOM_TD_METHOD_GETINPLACE_OLD"));
+ myGroup->ComboBox1->addItem(tr("GEOM_TD_METHOD_GETINPLACE_HISTORY"));
+
+ myGroup->LineEdit1->clear();
+ myGroup->LineEdit2->clear();
+ myObject1.nullify();
+ myObject2.nullify();
+
+ // signals and slots connections
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+
+ connect(myGroup->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+ connect(myGroup->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(myGroup->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+
+ connect(myGroup->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ myGroup->TextLabel3->show();
+ myGroup->ComboBox1->show();
+ myGroup->ComboBox1->setCurrentIndex(0);
+
+ globalSelection(GEOM_ALLSHAPES);
+
+ myGroup->PushButton1->click();
+ SelectionIntoArgument();
+ resize(100,100);
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void OperationGUI_TransferDataDlg::ClickOnOk()
+{
+ setIsApplyAndClose( true );
+ if (ClickOnApply())
+ ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool OperationGUI_TransferDataDlg::ClickOnApply()
+{
+ if (!onAccept(false))
+ return false;
+ // activate first line edit
+ myGroup->PushButton1->click();
+ return true;
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection is changed or on dialog initialization or activation
+//=================================================================================
+void OperationGUI_TransferDataDlg::SelectionIntoArgument()
+{
+ GEOM::GeomObjPtr aSelectedObject = getSelected(TopAbs_SHAPE);
+
+ if (aSelectedObject) {
+ myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject.get()));
+
+ if (myEditCurrentArgument == myGroup->LineEdit1) {
+ myObject1 = aSelectedObject;
+
+ if (!myObject2) {
+ myGroup->PushButton2->click();
+ }
+ } else if (myEditCurrentArgument == myGroup->LineEdit2) {
+ myObject2 = aSelectedObject;
+
+ if (!myObject1) {
+ myGroup->PushButton1->click();
+ }
+ }
+ } else {
+ myEditCurrentArgument->setText("");
+
+ if (myEditCurrentArgument == myGroup->LineEdit1) {
+ myObject1.nullify();
+ } else if (myEditCurrentArgument == myGroup->LineEdit2) {
+ myObject2.nullify();
+ }
+ }
+}
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void OperationGUI_TransferDataDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ if (send == myGroup->PushButton1) {
+ myEditCurrentArgument = myGroup->LineEdit1;
+
+ myGroup->PushButton2->setDown(false);
+ myGroup->LineEdit2->setEnabled(false);
+ }
+ else if (send == myGroup->PushButton2) {
+ myEditCurrentArgument = myGroup->LineEdit2;
+
+ myGroup->PushButton1->setDown(false);
+ myGroup->LineEdit1->setEnabled(false);
+ }
+
+ // enable line edit
+ myEditCurrentArgument->setEnabled(true);
+ myEditCurrentArgument->setFocus();
+ // after setFocus(), because it will be setDown(false) when loses focus
+ send->setDown(true);
+}
+
+//=================================================================================
+// function : LineEditReturnPressed()
+// purpose :
+//=================================================================================
+void OperationGUI_TransferDataDlg::LineEditReturnPressed()
+{
+ QLineEdit* send = (QLineEdit*)sender();
+ if (send == myGroup->LineEdit1 || send == myGroup->LineEdit2)
+ {
+ myEditCurrentArgument = send;
+ GEOMBase_Skeleton::LineEditReturnPressed();
+ }
+}
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void OperationGUI_TransferDataDlg::ActivateThisDialog()
+{
+ GEOMBase_Skeleton::ActivateThisDialog();
+ globalSelection(GEOM_ALLSHAPES);
+ connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( SelectionIntoArgument() ) );
+}
+
+//=================================================================================
+// function : enterEvent()
+// purpose : when mouse enter onto the QWidget
+//=================================================================================
+void OperationGUI_TransferDataDlg::enterEvent (QEvent*)
+{
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr OperationGUI_TransferDataDlg::createOperation()
+{
+ return getGeomEngine()->GetIInsertOperations(getStudyId());
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool OperationGUI_TransferDataDlg::isValid(QString&)
+{
+ return myObject1 && myObject2;
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool OperationGUI_TransferDataDlg::execute (ObjectList& objects)
+{
+ const int aLimit = myGroup->ComboBox1->currentIndex();
+ GEOM::find_shape_method aMethod;
+
+ switch (aLimit)
+ {
+ case 0:
+ aMethod = GEOM::FSM_GetInPlace;
+ break;
+ case 1:
+ aMethod = GEOM::FSM_GetInPlace_Old;
+ break;
+ case 2:
+ default:
+ aMethod = GEOM::FSM_GetInPlaceByHistory;
+ break;
+ }
+
+ GEOM::GEOM_IInsertOperations_var anOper =
+ GEOM::GEOM_IInsertOperations::_narrow(getOperation());
+ GEOM::GEOM_IInsertOperations::ListOfTransferDatum_var aResult;
+
+ bool isOK = anOper->TransferData
+ (myObject1.get(), myObject2.get(), aMethod, aResult);
+
+ if (isOK) {
+ // Construct info message.
+ QString aMsg;
+ int aNbTypes = aResult->length();
+
+ if (aNbTypes == 0) {
+ aMsg = tr("GEOM_TRANSFER_DATA_NOT_COPIED");
+ } else {
+ aMsg = tr("GEOM_TRANSFER_DATA_COPIED");
+ aMsg += "\n";
+ int i;
+
+ for (i = 0; i < aNbTypes; i++ ) {
+ if (i > 0) {
+ aMsg += "\n";
+ }
+
+ aMsg += tr(aResult[i].myName).
+ arg(aResult[i].myNumber).arg(aResult[i].myMaxNumber);
+ }
+ }
+
+ // Show info message.
+ SUIT_MessageBox::information
+ (SUIT_Session::session()->activeApplication()->desktop(),
+ tr("GEOM_TRANSFER_DATA_INFO"), aMsg, tr("BUT_OK"));
+
+ objects.push_back(myObject2.copy());
+ }
+
+ return isOK;
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> OperationGUI_TransferDataDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myObject1;
+ return res;
+}
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 OPERATIONGUI_TRANSFERDATADLG_H
+#define OPERATIONGUI_TRANSFERDATADLG_H
+
+
+#include <GEOMBase_Skeleton.h>
+
+class DlgRef_2Sel1List;
+
+//=================================================================================
+// class : OperationGUI_TransferDataDlg
+// purpose :
+//=================================================================================
+class OperationGUI_TransferDataDlg : public GEOMBase_Skeleton
+{
+ Q_OBJECT
+
+public:
+ OperationGUI_TransferDataDlg
+ ( GeometryGUI* theGeometryGUI, QWidget* parent = 0 );
+ ~OperationGUI_TransferDataDlg();
+
+protected:
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid( QString& );
+ virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
+
+private:
+ void Init();
+ void enterEvent( QEvent* );
+
+private:
+ GEOM::GeomObjPtr myObject1;
+ GEOM::GeomObjPtr myObject2;
+ int myShapeType;
+
+ DlgRef_2Sel1List* myGroup;
+
+private slots:
+ void ClickOnOk();
+ bool ClickOnApply();
+ void SetEditCurrentArgument();
+ void SelectionIntoArgument();
+ void LineEditReturnPressed();
+ void ActivateThisDialog();
+};
+
+#endif // OPERATIONGUI_GETSHAPESONSHAPEDLG_H
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
{
GEOMBase_Skeleton::ActivateThisDialog();
if (getConstructorId() == 0) {
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
}
GEOMBase::PublishSubObject( myPoint2.get() );
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> PrimitiveGUI_BoxDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myPoint1 << myPoint2;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
GroupPoints->LineEdit2->setEnabled(false);
globalSelection(GEOM_POINT); // to break previous local selection
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
GroupPoints->LineEdit1->setEnabled(false);
globalSelection(GEOM_LINE);// to break previous local selection
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
GEOMBase::PublishSubObject( myDir.get() );
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> PrimitiveGUI_ConeDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myPoint << myDir;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
GroupPoints->LineEdit2->setEnabled(false);
globalSelection(GEOM_POINT); // to break previous local selection
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
GroupPoints->LineEdit1->setEnabled(false);
globalSelection(GEOM_LINE); // to break previous local selection
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
{
ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) &&
- ( GroupDimensions->checkBox->isChecked() || GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) );
+ ( !GroupDimensions->checkBox->isChecked() || GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) );
if ( GroupDimensions->checkBox->isChecked() &&
( GroupDimensions->SpinBox_DZ->value() <= 0. || GroupDimensions->SpinBox_DZ->value() >= 360. ) ) {
msg += tr("GEOM_CYLINDER_ANGLE_ERR") + "\n";
}
}
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> PrimitiveGUI_CylinderDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myPoint << myDir;
+ return res;
+}
+
//=================================================================================
// function : ActivateAngle()
// purpose : enable the
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
if (myEditCurrentArgument == GroupPntVecR->LineEdit2) {
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
else {
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
break;
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> PrimitiveGUI_DiskDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myPoint << myDir << myPoint1 << myPoint2 << myPoint3;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
-
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
myEdge.nullify();
myFace.nullify();
globalSelection(); // close local contexts, if any
- // localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ // localSelection( TopAbs_EDGE );
myOrientationType = 1;
{
if ( GroupType->RadioButton1->isChecked() ) {
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
GroupPlane->TextLabel1->setText( tr( "GEOM_EDGE" ) );
}
else if ( GroupType->RadioButton2->isChecked() ) {
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
+ localSelection( TopAbs_FACE );
GroupPlane->TextLabel1->setText( tr( "GEOM_FACE" ) );
}
myEditCurrentArgument = GroupPlane->LineEdit1;
case 1:
{
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
myEditCurrentArgument = GroupPlane->LineEdit1;
myEditCurrentArgument->setText("");
myEdge.nullify();
if ( send == GroupPlane->PushButton1 ) {
myEditCurrentArgument = GroupPlane->LineEdit1;
if (GroupType->RadioButton1->isChecked())
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
else if (GroupType->RadioButton1->isChecked())
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
+ localSelection( TopAbs_FACE );
}
myEditCurrentArgument->setFocus();
GEOMBase::PublishSubObject( myFace.get() );
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> PrimitiveGUI_FaceDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myEdge << myFace;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
case 0:
{
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
GroupDimensions->hide();
GroupPoints->show();
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
SelectionIntoArgument();
}
}
GEOMBase::PublishSubObject( myPoint.get() );
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> PrimitiveGUI_SphereDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myPoint;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
GroupPoints->LineEdit2->setEnabled(false);
globalSelection(GEOM_POINT); // to break previous local selection
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
GroupPoints->LineEdit1->setEnabled(false);
globalSelection(GEOM_LINE); // to break previous local selection
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
GEOMBase::PublishSubObject( myDir.get() );
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> PrimitiveGUI_TorusDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myPoint << myDir;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
${PROJECT_SOURCE_DIR}/src/DlgRef
${PROJECT_BINARY_DIR}/src/DlgRef
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
+ ${PROJECT_SOURCE_DIR}/src/GEOMUtils
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
# libraries to link to
SET(_link_LIBRARIES
GEOMBase
+ GEOMUtils
)
# --- resources ---
RepairGUI_RemoveExtraEdgesDlg.h
RepairGUI_UnionFacesDlg.h
RepairGUI_FuseEdgesDlg.h
+ RepairGUI_InspectObjectDlg.h
)
# header files / to be processed by moc
RepairGUI_RemoveExtraEdgesDlg.h
RepairGUI_UnionFacesDlg.h
RepairGUI_FuseEdgesDlg.h
+ RepairGUI_InspectObjectDlg.h
)
# header files / uic wrappings
RepairGUI_RemoveExtraEdgesDlg.cxx
RepairGUI_UnionFacesDlg.cxx
RepairGUI_FuseEdgesDlg.cxx
+ RepairGUI_InspectObjectDlg.cxx
${_moc_SOURCES}
${_uic_files}
)
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
+#include <SUIT_OverrideCursor.h>
#include <SalomeApp_Application.h>
#include "RepairGUI_SewingDlg.h" // Method SEWING
#include "RepairGUI_RemoveExtraEdgesDlg.h" // Method REMOVE EXTRA EDGES
#include "RepairGUI_FuseEdgesDlg.h" // Method FUSE COLLINEAR EDGES
#include "RepairGUI_UnionFacesDlg.h" // Method UNION FACES
+#include "RepairGUI_InspectObjectDlg.h" // Method INSPECT OBJECT
//=======================================================================
// function : RepairGUI()
case GEOMOp::OpRemoveExtraEdges: aDlg = new RepairGUI_RemoveExtraEdgesDlg (getGeometryGUI(), parent); break;
case GEOMOp::OpFuseEdges: aDlg = new RepairGUI_FuseEdgesDlg (getGeometryGUI(), parent); break;
case GEOMOp::OpUnionFaces: aDlg = new RepairGUI_UnionFacesDlg (getGeometryGUI(), parent); break;
+ case GEOMOp::OpInspectObj: aDlg = new RepairGUI_InspectObjectDlg (getGeometryGUI(), parent); break;
default:
app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break;
return new RepairGUI( parent );
}
}
+
+//=====================================================================================
+// Statistics dialog
+//=====================================================================================
+
+#include <QDialog>
+#include <QHBoxLayout>
+#include <QHeaderView>
+#include <QPushButton>
+#include <QString>
+#include <QStringList>
+#include <QTableWidget>
+#include <QTableWidget>
+#include <QTableWidgetItem>
+#include <QVBoxLayout>
+
+namespace
+{
+ class StatsDlg : public QDialog
+ {
+ public:
+ StatsDlg( GEOM::ModifStatistics_var stats, QWidget* parent );
+ };
+
+ StatsDlg::StatsDlg( GEOM::ModifStatistics_var stats, QWidget* parent ): QDialog( parent )
+ {
+ setModal( true );
+ setWindowTitle( tr( "GEOM_HEALING_STATS_TITLE" ) );
+ setMinimumWidth( 500 );
+
+ const int nbRows = stats->length();
+ const int nbCols = 2;
+ QTableWidget* table = new QTableWidget( nbRows, nbCols, this );
+ table->setEditTriggers( QAbstractItemView::NoEditTriggers );
+ table->horizontalHeader()->setResizeMode( 1, QHeaderView::Interactive );
+ table->horizontalHeader()->setStretchLastSection( true );
+
+ QStringList headers;
+ headers << tr( "GEOM_HEALING_STATS_COL_1" );
+ headers << tr( "GEOM_HEALING_STATS_COL_2" );
+ table->setHorizontalHeaderLabels( headers );
+
+ // buttons
+
+ QPushButton* okBtn = new QPushButton( tr( "GEOM_BUT_OK" ), this );
+ okBtn->setAutoDefault( true );
+ okBtn->setDefault( true );
+ okBtn->setFocus();
+ // QPushButton* helpBtn = new QPushButton( tr( "GEOM_BUT_HELP" ), this );
+ // helpBtn->setAutoDefault( true );
+
+ QHBoxLayout* btnLayout = new QHBoxLayout;
+ btnLayout->setMargin( 0 );
+ btnLayout->setSpacing( 6 );
+
+ btnLayout->addStretch();
+ btnLayout->addWidget( okBtn );
+ btnLayout->addStretch();
+ // btnLayout->addWidget( helpBtn );
+
+ QVBoxLayout* aLay = new QVBoxLayout( this );
+ aLay->setMargin( 9 );
+ aLay->setSpacing( 6 );
+ aLay->addWidget( table );
+ aLay->addLayout( btnLayout );
+
+ // fill the table
+ for ( int row = 0; row < nbRows; ++row )
+ {
+ table->setItem( row, 0, new QTableWidgetItem( QString::number( stats[ row ].count )));
+ table->setItem( row, 1, new QTableWidgetItem( tr( stats[ row ].name.in() )));
+ }
+
+ connect( okBtn, SIGNAL( clicked() ), this, SLOT( reject() ));
+ //connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ));
+ }
+}
+
+//================================================================================
+/*!
+ * \brief Show a dialog providing info on what is done by healing
+ */
+//================================================================================
+
+void RepairGUI::ShowStatistics( GEOM::GEOM_IHealingOperations_var anOper, QWidget* parent )
+{
+ GEOM::ModifStatistics_var stats = anOper->GetStatistics();
+
+ if ( ! &stats.in() || stats->length() == 0 )
+ return;
+
+ SUIT_OverrideCursor wc;
+ wc.suspend();
+
+ StatsDlg dlg( stats, parent );
+ dlg.exec();
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GEOMGUI.h>
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(GEOM_Gen)
+
//=================================================================================
// class : RepairGUI
// purpose :
~RepairGUI();
bool OnGUIEvent( int, SUIT_Desktop* );
-};
+ static void ShowStatistics( GEOM::GEOM_IHealingOperations_var anOper, QWidget* parent );
+};
#endif // REPAIRGUI_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
#include "RepairGUI_ChangeOrientationDlg.h"
-#include <DlgRef.h>
-#include <GeometryGUI.h>
-#include <GEOMBase.h>
+#include "DlgRef.h"
+#include "GeometryGUI.h"
+#include "GEOMBase.h"
+#include "RepairGUI.h"
-#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
-#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <SalomeApp_Application.h>
+#include <TopAbs.hxx>
-#include <GEOMImpl_Types.hxx>
+#include "GEOMImpl_Types.hxx"
-#include <TopAbs.hxx>
//=================================================================================
// class : RepairGUI_ChangeOrientationDlg()
}
if ( !anObj->_is_nil() )
+ {
+ if ( !IsPreview() )
+ RepairGUI::ShowStatistics( anOper, this );
objects.push_back( anObj._retn() );
+ }
return true;
}
{
mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_ChangeOrientationDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ if ( GroupPoints->CheckButton1->isChecked() ) {
+ GEOM::GeomObjPtr aGeomObjPtr(myObject);
+ res << aGeomObjPtr;
+ }
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
#include "RepairGUI_CloseContourDlg.h"
-#include <DlgRef.h>
-#include <GeometryGUI.h>
-#include <GEOMBase.h>
+#include "DlgRef.h"
+#include "GeometryGUI.h"
+#include "GEOMBase.h"
+#include "RepairGUI.h"
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
bool aResult = !anObj->_is_nil();
if (aResult)
+ {
+ if ( !IsPreview() )
+ RepairGUI::ShowStatistics( anOper, this );
objects.push_back(anObj._retn());
-
+ }
return aResult;
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_CloseContourDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myObject);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
#include "RepairGUI_DivideEdgeDlg.h"
-#include <DlgRef.h>
-#include <GeometryGUI.h>
-#include <GEOMBase.h>
-#include <SalomeApp_DoubleSpinBox.h>
+#include "DlgRef.h"
+#include "GeometryGUI.h"
+#include "GEOMBase.h"
+#include "RepairGUI.h"
+#include <SalomeApp_DoubleSpinBox.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Session.h>
#include <GEOMImpl_Types.hxx>
-#include <TopAbs.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <Geom_Curve.hxx>
-#include <gp_Pnt.hxx>
-#include <TopoDS.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopAbs.hxx>
#include <TopExp.hxx>
-#include <TopoDS_Edge.hxx>
-#include <BRep_Tool.hxx>
+#include <TopExp_Explorer.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
-#include <BRepBuilderAPI_MakeVertex.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Edge.hxx>
+#include <gp_Pnt.hxx>
+
+enum { BY_PARAM, BY_POINT_PROJ };
//=================================================================================
// class : RepairGUI_DivideEdgeDlg()
: GEOMBase_Skeleton( theGeometryGUI, parent, modal )
{
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_DIVIDE_EDGE" ) ) );
+ QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_DIVIDE_EDGE_BY_PNT" ) ) );
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setWindowTitle( tr( "GEOM_DIVIDE_EDGE_TITLE" ) );
/***************************************************************/
mainFrame()->GroupConstructors->setTitle(tr("GEOM_DIVIDE_EDGE_TITLE"));
mainFrame()->RadioButton1->setIcon( image0 );
- mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
- mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton2->setIcon( image2 );
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
- GroupPoints = new DlgRef_1SelExt( centralWidget() );
+ GroupPoints = new DlgRef_2SelExt( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_ADD_POINT" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_EDGE" ) );
GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true );
+ GroupPoints->TextLabel2->setText( tr( "DEVIDE_EDGE_BY_PROJ_POINT" ) );
+ GroupPoints->PushButton2->setIcon( image1 );
+ GroupPoints->LineEdit2->setReadOnly( true );
QRadioButton* rb1 = new QRadioButton( tr( "GEOM_BY_PARAMETER" ), GroupPoints->Box );
QRadioButton* rb2 = new QRadioButton( tr( "GEOM_BY_LENGTH" ), GroupPoints->Box );
myValEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box );
initSpinBox( myValEdt, 0., 1., 0.1, "parametric_precision" );
myValEdt->setValue( 0.5 );
- QLabel* aLbl1 = new QLabel( tr( "GEOM_VALUE" ), GroupPoints->Box );
+ myValLbl = new QLabel( tr( "GEOM_VALUE" ), GroupPoints->Box );
QGridLayout* l = new QGridLayout( GroupPoints->Box );
l->setMargin( 0 ); l->setSpacing( 6 );
l->addWidget( rb1, 0, 0, 1, 2 );
l->addWidget( rb2, 1, 0, 1, 2 );
- l->addWidget( aLbl1, 2, 0 );
+ l->addWidget( myValLbl, 2, 0 );
l->addWidget( myValEdt, 2, 1 );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
Init();
}
+//=======================================================================
+//function : ConstructorsClicked
+//purpose : hide/show widgets depending on a selected constructor
+//=======================================================================
+void RepairGUI_DivideEdgeDlg::ConstructorsClicked( int constructorId )
+{
+ myIsParameterGr->button( 0 )->setShown( constructorId == BY_PARAM );
+ myIsParameterGr->button( 1 )->setShown( constructorId == BY_PARAM );
+ myValEdt ->setShown( constructorId == BY_PARAM );
+ myValLbl ->setShown( constructorId == BY_PARAM );
+ GroupPoints->TextLabel2 ->setShown( constructorId == BY_POINT_PROJ );
+ GroupPoints->PushButton2 ->setShown( constructorId == BY_POINT_PROJ );
+ GroupPoints->LineEdit2 ->setShown( constructorId == BY_POINT_PROJ );
+
+ initSelection();
+
+ if ( constructorId == BY_PARAM &&
+ !GroupPoints->PushButton1->isDown() )
+ GroupPoints->PushButton1->click();
+
+ displayPreview();
+}
+
//=================================================================================
// function : ~RepairGUI_DivideEdgeDlg()
// purpose : Destroys the object and frees any allocated resources
myEditCurrentArgument = GroupPoints->LineEdit1;
myObject = GEOM::GEOM_Object::_nil();
- myIndex = -1;
+ myPoints.clear();
+ myIndex = -1;
+ myProjectionOK = false;
//myGeomGUI->SetState( 0 );
- initSelection();
/* signals and slots connections */
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+ connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
+
connect( myValEdt, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+ connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "DEVIDE_EDGE_NEW_OBJECT_NAME" ) );
resize(100,100);
+ ConstructorsClicked( BY_PARAM );
SelectionIntoArgument();
}
//=================================================================================
void RepairGUI_DivideEdgeDlg::displayPreview()
{
+ myProjectionOK = false;
erasePreview();
if ( myObject->_is_nil() )
return;
gp_Pnt aPnt;
GEOMBase::GetShape( myObject, aShape, TopAbs_SHAPE );
- if ( myIndex != -1) {
+ if ( myIndex != -1 ) {
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes(aShape, aShapes);
aShape = aShapes.FindKey(myIndex);
if (aShape.ShapeType() == TopAbs_EDGE) {
Standard_Real aFP, aLP, aP;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aShape), aFP, aLP);
- aP = aFP + (aLP - aFP) * myValEdt->value();
- aPnt = aCurve->Value(aP);
- BRepBuilderAPI_MakeVertex mkVertex (aPnt);
- aShape = mkVertex.Shape();
+ if ( aCurve.IsNull() ) return;
+
+ if ( getConstructorId() == BY_PARAM )
+ {
+ aP = aFP + (aLP - aFP) * myValEdt->value();
+ aPnt = aCurve->Value(aP);
+ BRepBuilderAPI_MakeVertex mkVertex (aPnt);
+ aShape = mkVertex.Shape();
+ }
+ else if ( getConstructorId() == BY_POINT_PROJ && !myPoints.empty() )
+ {
+ BRep_Builder builder;
+ TopoDS_Compound compoundOfVV;
+ builder.MakeCompound(compoundOfVV);
+ aShape = compoundOfVV;
+
+ GeomAPI_ProjectPointOnCurve aProjector;
+ aProjector.Init( aCurve, aFP, aLP );
+
+ TopTools_MapOfShape vMap;
+ for ( int i = 0; i < myPoints.count(); ++i )
+ {
+ TopoDS_Shape aPoint;
+ GEOMBase::GetShape( myPoints[i].get(), aPoint, TopAbs_VERTEX );
+ if ( !vMap.Add( aPoint )) continue;
+
+ gp_Pnt p = BRep_Tool::Pnt( TopoDS::Vertex( aPoint ));
+ aProjector.Perform( p );
+ if ( aProjector.NbPoints() > 0 )
+ {
+ double u = aProjector.LowerDistanceParameter();
+ if ( Min( u - aFP, aLP - u ) > Precision::Confusion() )
+ {
+ builder.Add( compoundOfVV, BRepBuilderAPI_MakeVertex( aProjector.NearestPoint()));
+ myProjectionOK = true;
+ }
+ }
+ }
+ }
+ else
+ {
+ return;
+ }
// Build prs
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aShape );
if ( aPrs != 0 && !aPrs->IsNull() )
GEOMBase_Helper::displayPreview( aPrs, false, true );
- }
+ }
}
//=================================================================================
initName();
- myEditCurrentArgument->setText( "" );
+ GroupPoints->LineEdit1->setText( "" );
+ GroupPoints->LineEdit2->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
+ myPoints.clear();
myIndex = -1;
+ myProjectionOK = false;
- initSelection();
+ GroupPoints->PushButton1->click();
return true;
}
{
myEditCurrentArgument->setText( "" );
- myObject = GEOM::GEOM_Object::_nil();
- myIndex = -1;
+ const bool toSelectObject = ( myEditCurrentArgument == GroupPoints->LineEdit1 );
+ if ( toSelectObject )
+ {
+ myObject = GEOM::GEOM_Object::_nil();
+ myIndex = -1;
+ myProjectionOK = false;
+ }
+ else //if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
+ {
+ myPoints.clear();
+ myProjectionOK = false;
+ }
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
- if ( aSelList.Extent() == 1 ) {
+ if ( toSelectObject && aSelList.Extent() == 1 ) {
Handle(SALOME_InteractiveObject) anIO = aSelList.First();
GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO );
if ( !CORBA::is_nil( aSelectedObj ) )
}
}
}
+ if ( !toSelectObject )
+ {
+ myPoints = getSelected( TopAbs_VERTEX, -1, /*strict=*/true );
+ if ( myPoints.empty() )
+ myEditCurrentArgument->setText( "" );
+ else if ( myPoints.count() == 1 )
+ myEditCurrentArgument->setText( GEOMBase::GetName( myPoints[0].get() ));
+ else
+ myEditCurrentArgument->setText( QObject::tr( "%1_vertices" ).arg( myPoints.count() ));
+ }
displayPreview();
}
//=================================================================================
void RepairGUI_DivideEdgeDlg::SetEditCurrentArgument()
{
- if ( sender() == GroupPoints->PushButton1 ) {
+ QPushButton* send = (QPushButton*)sender();
+
+ if ( send == GroupPoints->PushButton1 ) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
+
+ GroupPoints->PushButton2->setDown(false);
+ GroupPoints->LineEdit2->setEnabled(false);
+ }
+ if ( send == GroupPoints->PushButton2 ) {
+ GroupPoints->LineEdit2->setFocus();
+ myEditCurrentArgument = GroupPoints->LineEdit2;
+
+ GroupPoints->PushButton1->setDown(false);
+ GroupPoints->LineEdit1->setEnabled(false);
}
+ // enable line edit
+ myEditCurrentArgument->setEnabled(true);
+ myEditCurrentArgument->setFocus();
+ // after setFocus(), because it will be setDown(false) when loses focus
+ send->setDown(true);
+
+ initSelection();
SelectionIntoArgument();
}
myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed();
}
+ if ( sender() == GroupPoints->LineEdit2 &&
+ !GroupPoints->LineEdit2->isHidden() ) {
+ myEditCurrentArgument = GroupPoints->LineEdit2;
+ GEOMBase_Skeleton::LineEditReturnPressed();
+ }
}
myIndex = -1;
//myGeomGUI->SetState( 0 );
- initSelection();
+ ConstructorsClicked(getConstructorId());
}
//=================================================================================
//=================================================================================
bool RepairGUI_DivideEdgeDlg::isValid( QString& msg )
{
- bool ok = myValEdt->isValid( msg, !IsPreview() );
+ bool ok = false;
+ if ( getConstructorId() == BY_PARAM )
+ {
+ ok = myValEdt->isValid( msg, !IsPreview() );
+ }
+ else if ( getConstructorId() == BY_POINT_PROJ )
+ {
+ if (( ok = myPoints.count() ) && !( ok = myProjectionOK ))
+ msg = tr("DEVIDE_EDGE_BAD_PROJ_MSG");
+ }
return !myObject->_is_nil() && ok;
}
bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects )
{
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );
- GEOM::GEOM_Object_var anObj = anOper->DivideEdge( myObject, myIndex, myValEdt->value(), getIsByParameter() );
+ GEOM::GEOM_Object_var anObj;
+ if ( getConstructorId() == BY_PARAM )
+ {
+ anObj = anOper->DivideEdge( myObject, myIndex, myValEdt->value(), getIsByParameter() );
+ }
+ else
+ {
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length( myPoints.count() );
+ for ( int i = 0; i < myPoints.count(); ++i )
+ objList[i] = myPoints[i].copy();
+ anObj = anOper->DivideEdgeByPoint( myObject, myIndex, objList );
+ }
bool aResult = !anObj->_is_nil();
if ( aResult )
{
- if ( !IsPreview() )
+ if ( !IsPreview() && ( getConstructorId() == BY_PARAM ))
{
QStringList aParameters;
aParameters << "";
aParameters << "";
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
+ if ( !IsPreview() )
+ RepairGUI::ShowStatistics( anOper, this );
objects.push_back( anObj._retn() );
}
//=================================================================================
void RepairGUI_DivideEdgeDlg::initSelection()
{
- GEOM::GEOM_Object_var aNullGeomObject;
- localSelection( aNullGeomObject, TopAbs_EDGE ); // load local selection on ALL objects
+ // close local contexts
+ globalSelection();
+ // load local selection on ALL objects
+ localSelection( myEditCurrentArgument == GroupPoints->LineEdit2 ? TopAbs_VERTEX : TopAbs_EDGE );
+}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void RepairGUI_DivideEdgeDlg::addSubshapesToStudy()
+{
+ for ( int i = 0; i < myPoints.count(); ++i )
+ GEOMBase::PublishSubObject( myPoints[i].get() );
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_DivideEdgeDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myPoints);
+ GEOM::GeomObjPtr aGeomObjPtr(myObject);
+ res << aGeomObjPtr;
+ return res;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GEOMBase_Skeleton.h>
-class DlgRef_1SelExt;
+class DlgRef_2SelExt;
class SalomeApp_DoubleSpinBox;
class QButtonGroup;
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
-
+ virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
+
private:
void Init();
void enterEvent( QEvent* );
bool getIsByParameter() const;
int myIndex;
-
+
private:
GEOM::GEOM_Object_var myObject;
-
- DlgRef_1SelExt* GroupPoints;
+ QList<GEOM::GeomObjPtr> myPoints;
+ bool myProjectionOK;
+
+ DlgRef_2SelExt* GroupPoints;
QButtonGroup* myIsParameterGr;
SalomeApp_DoubleSpinBox* myValEdt;
+ QLabel* myValLbl;
protected slots:
void ClickOnOk();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
+ void ConstructorsClicked( int );
};
#endif // REPAIRGUI_DIVIDEEDGEDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
{
GEOM::ListOfGO_var aClosed, anOpen;
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length(1);
+ objList[0] = myObj;
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
- bool result = anOper->GetFreeBoundary(myObj, aClosed, anOpen);
+ bool result = anOper->GetFreeBoundary(objList, aClosed, anOpen);
if (result) {
myNbClosed = aClosed->length();
{
return myObj;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_FreeBoundDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myObj);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool execute (ObjectList&);
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
virtual QString getNewObjectName (int CurrObj = -1) const;
-
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
+
private:
void Init();
void enterEvent (QEvent*);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
#include "RepairGUI_FreeFacesDlg.h"
+#include <GEOMBase.h>
+#include <GeometryGUI.h>
+#include <GEOMImpl_Types.hxx>
+#include <GEOM_Constants.h>
+
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Application.h>
-#include <SalomeApp_Tools.h>
#include <SalomeApp_Study.h>
-
-#include <SUIT_MessageBox.h>
-#include <SUIT_Session.h>
-#include <SUIT_OverrideCursor.h>
+#include <SalomeApp_Tools.h>
#include <SUIT_Desktop.h>
+#include <SUIT_OverrideCursor.h>
#include <SUIT_ResourceMgr.h>
-#include <SUIT_ViewWindow.h>
+#include <SUIT_Session.h>
#include <SUIT_ViewManager.h>
+#include <SUIT_ViewWindow.h>
-#include <GEOMImpl_Types.hxx>
-#include <GEOM_Constants.h>
-
-#include <TopTools_IndexedMapOfShape.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TopExp.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
-#include <GEOMBase.h>
-#include <GeometryGUI.h>
-#include <GEOM_Displayer.h>
-
-#include <QLineEdit>
-#include <QLabel>
#include <QGroupBox>
-#include <QPushButton>
#include <QHBoxLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QRadioButton>
#include <QVBoxLayout>
-#include <QKeyEvent>
+
#define SPACING 6
#define MARGIN 9
// TRUE to construct a modal dialog.
//=================================================================================
RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg( GeometryGUI* GUI, QWidget* parent,
- bool modal )
- : QDialog( parent, 0 ),
- GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
- myGeomGUI( GUI ),
- myDisplayer( 0 )
+ bool modal)
+ : GEOMBase_Skeleton(GUI, parent, modal),
+ myDisplayer (0),
+ myEdit (0)
{
- setAttribute( Qt::WA_DeleteOnClose );
-
- setSizeGripEnabled( true );
-
+ QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_FREE_FACES")));
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setWindowTitle( tr( "GEOM_FREE_FACES_TITLE" ) );
/***************************************************************/
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_FREE_FACES"));
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton3->close();
+
+ mainFrame()->GroupBoxName->hide();
+
QGroupBox* aMainGrp = new QGroupBox( tr( "GEOM_SELECTED_SHAPE" ), this );
QLabel* lab = new QLabel( tr( "GEOM_OBJECT" ), aMainGrp );
- mySelBtn = new QPushButton( aMainGrp );
- mySelBtn->setIcon( image1 );
+ QPushButton *aSelBtn = new QPushButton( aMainGrp );
+ aSelBtn->setIcon( image1 );
myEdit = new QLineEdit( aMainGrp );
myEdit->setReadOnly( true );
myEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
aMainLay->setSpacing( SPACING );
aMainLay->setMargin( MARGIN );
aMainLay->addWidget( lab );
- aMainLay->addWidget( mySelBtn );
+ aMainLay->addWidget( aSelBtn );
aMainLay->addWidget( myEdit );
- QFrame* aFrame = new QFrame( this );
- aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
- QPushButton* aCloseBtn = new QPushButton( tr( "GEOM_BUT_CLOSE" ), aFrame );
- QPushButton* aHelpBtn = new QPushButton( tr( "GEOM_BUT_HELP" ), aFrame );
-
- QHBoxLayout* aBtnLay = new QHBoxLayout( aFrame );
- aBtnLay->setSpacing( SPACING );
- aBtnLay->setMargin( MARGIN );
- aBtnLay->addWidget( aCloseBtn );
- aBtnLay->addSpacing( SPACING );
- aBtnLay->addStretch();
- aBtnLay->addWidget( aHelpBtn );
-
- QVBoxLayout* aLay = new QVBoxLayout( this );
- aLay->setSpacing( SPACING );
- aLay->setMargin( MARGIN );
- aLay->addWidget( aMainGrp );
- aLay->addStretch();
- aLay->addWidget( aFrame );
+ QVBoxLayout* aLay = new QVBoxLayout (centralWidget());
+ aLay->setSpacing(SPACING);
+ aLay->setMargin(MARGIN);
+ aLay->addWidget(aMainGrp);
- myHelpFileName = "free_faces_page.html";
-
- connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) );
- connect( aHelpBtn, SIGNAL( clicked() ), SLOT( onHelp() ) );
- connect( mySelBtn, SIGNAL( clicked() ),
- this, SLOT ( onSetEditCurrentArgument() ) );
+ resize(minimumSizeHint());
/***************************************************************/
+ myHelpFileName = "free_faces_page.html";
+
Init();
}
//=================================================================================
-// function : onClose
-// purpose : SLOT. Called when "close" button pressed. Close dialog
+// function : Init()
+// purpose :
//=================================================================================
-void RepairGUI_FreeFacesDlg::onClose()
+void RepairGUI_FreeFacesDlg::Init()
{
- globalSelection();
- disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 );
- myGeomGUI->SetActiveDialogBox( 0 );
- reject();
- erasePreview();
+ myObj = GEOM::GEOM_Object::_nil();
+ myEditCurrentArgument = myEdit;
+
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ initName(tr("GEOM_FREE_FACES_NAME"));
+ buttonOk()->setEnabled(false);
+ buttonApply()->setEnabled(false);
+ activateSelection();
+ SelectionIntoArgument();
}
//=================================================================================
-// function : onHelp()
+// function : ClickOnOk()
// purpose :
//=================================================================================
-void RepairGUI_FreeFacesDlg::onHelp()
+void RepairGUI_FreeFacesDlg::ClickOnOk()
{
- LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
- if ( app )
- app->onHelpContextModule( myGeomGUI ? app->moduleName( myGeomGUI->moduleName() ) : QString(""), myHelpFileName );
- else {
- QString platform;
-#ifdef WIN32
- platform = "winapplication";
-#else
- platform = "application";
-#endif
- SUIT_MessageBox::warning( this,
- tr( "WRN_WARNING" ),
- tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
- arg( app->resourceMgr()->stringValue( "ExternalBrowser",
- platform ) ).
- arg( myHelpFileName ) );
- }
+ if (ClickOnApply())
+ ClickOnCancel();
}
//=================================================================================
-// function : onDeactivate
-// purpose : Deactivate this dialog
+// function : ClickOnApply()
+// purpose :
//=================================================================================
-void RepairGUI_FreeFacesDlg::onDeactivate()
+bool RepairGUI_FreeFacesDlg::ClickOnApply()
{
- setEnabled( false );
- globalSelection();
- disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 );
- myGeomGUI->SetActiveDialogBox( 0 );
+ if (!onAccept())
+ return false;
+
+ initName();
+ return true;
}
//=================================================================================
-// function : onActivate
-// purpose : Activate this dialog
+// function : ActivateThisDialog()
+// purpose :
//=================================================================================
-void RepairGUI_FreeFacesDlg::onActivate()
+void RepairGUI_FreeFacesDlg::ActivateThisDialog()
{
- myGeomGUI->EmitSignalDeactivateDialog();
- setEnabled( true );
- myGeomGUI->SetActiveDialogBox( this );
- connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
+ GEOMBase_Skeleton::ActivateThisDialog();
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
activateSelection();
+ displayPreview(true);
}
//=================================================================================
-// function : Init()
+// function : enterEvent()
// purpose :
//=================================================================================
-void RepairGUI_FreeFacesDlg::Init()
+void RepairGUI_FreeFacesDlg::enterEvent(QEvent*)
{
- myObj = GEOM::GEOM_Object::_nil();
-
- /* signals and slots connections */
- connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) );
- connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) );
-
- activateSelection();
- onSelectionDone();
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
}
//=================================================================================
-// function : onSelectionDone
+// function : SelectionIntoArgument
// purpose : SLOT. Called when selection changed.
//=================================================================================
-void RepairGUI_FreeFacesDlg::onSelectionDone()
+void RepairGUI_FreeFacesDlg::SelectionIntoArgument()
{
+ myEditCurrentArgument->setText("");
+ myObj = GEOM::GEOM_Object::_nil();
erasePreview();
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
aSelMgr->selectedObjects(aSelList);
if ( aSelList.Extent() != 1 ) {
- myEdit->setText( "" );
+ buttonOk()->setEnabled(false);
+ buttonApply()->setEnabled(false);
return;
}
GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !GEOMBase::IsShape( anObj ) ) {
- myEdit->setText( "" );
+ buttonOk()->setEnabled(false);
+ buttonApply()->setEnabled(false);
return;
- }
- else {
+ } else {
myObj = anObj;
+ myEditCurrentArgument->setText(GEOMBase::GetName(myObj));
displayPreview( true, false, true, true, 3 );
}
}
-//=================================================================================
-// function : enterEvent()
-// purpose : Mouse enter onto the dialog to activate it
-//=================================================================================
-void RepairGUI_FreeFacesDlg::enterEvent( QEvent* )
-{
- onActivate();
-}
-
//=================================================================================
// function : activateSelection
-// purpose : activate selection of faces, shells, and solids
+// purpose : activate selection of solids
//=================================================================================
void RepairGUI_FreeFacesDlg::activateSelection()
{
globalSelection( aMap );
}
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void RepairGUI_FreeFacesDlg::closeEvent( QCloseEvent* )
-{
- onClose();
-}
-
//=================================================================================
// function : createOperation
// purpose :
TopoDS_Shape aSelShape;
TopoDS_Shape aFace;
TopTools_IndexedMapOfShape anIndices;
+ int aNbObj = 0;
+
if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) ) {
myEdit->setText( GEOMBase::GetName( myObj ) );
QString aMess;
if ( !isValid( aMess ) ) {
erasePreview( true );
+ buttonOk()->setEnabled(false);
+ buttonApply()->setEnabled(false);
return false;
}
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
TopExp::MapShapes( aSelShape, anIndices);
SALOME_Prs* aPrs = 0;
}
}
}
-
- for ( int i = 0, n = aFaceLst->length(); i < n; i++ ) {
+
+ int i;
+ int n = aFaceLst->length();
+
+ for (i = 0; i < n; i++ ) {
aFace = anIndices.FindKey( aFaceLst[i] );
try {
getDisplayer()->SetColor( Quantity_NOC_RED );
- getDisplayer()->SetToActivate( false );
getDisplayer()->SetTransparency( transparency );
+ getDisplayer()->SetWidth( 2 );
+ getDisplayer()->SetNbIsos( 1 );
+ getDisplayer()->SetIsosWidth( 1 );
+ getDisplayer()->SetIsosColor( Quantity_NOC_RED );
+ getDisplayer()->SetDisplayMode( 0 );
+ getDisplayer()->SetToActivate( false );
aPrs = !aFace.IsNull() ? getDisplayer()->BuildPrs( aFace ) : 0;
if ( aPrs )
displayPreview( aPrs, true );
catch( const SALOME::SALOME_Exception& e )
{
SalomeApp_Tools::QtCatchCorbaException( e );
+ buttonOk()->setEnabled(false);
+ buttonApply()->setEnabled(false);
+ return false;
}
}
+
+ // Create sub-objects
+ GEOM::ListOfGO_var aList = anOper->MakeSubShapes(myObj, aFaceLst);
+
+ aNbObj = aList->length();
+
+ for (i = 0; i < aNbObj; i++) {
+ objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
+ }
+
+ aResult = true;
}
+
+ buttonOk()->setEnabled(aNbObj > 0);
+ buttonApply()->setEnabled(aNbObj > 0);
+
return aResult;
}
return myDisplayer;
}
-//=================================================================================
-// function : SetEditCurrentArgument
-// purpose :
-//=================================================================================
-void RepairGUI_FreeFacesDlg::onSetEditCurrentArgument()
+//================================================================
+// Function : getFather
+// Purpose : Get father object for object to be added in study
+// (called with addInStudy method)
+//================================================================
+GEOM::GEOM_Object_ptr RepairGUI_FreeFacesDlg::getFather (GEOM::GEOM_Object_ptr)
{
- myEdit->setFocus();
- onSelectionDone();
+ return myObj;
}
//=================================================================================
-// function : keyPressEvent()
-// purpose :
+// function : getSourceObjects
+// purpose : virtual method to get source objects
//=================================================================================
-void RepairGUI_FreeFacesDlg::keyPressEvent( QKeyEvent* e )
+QList<GEOM::GeomObjPtr> RepairGUI_FreeFacesDlg::getSourceObjects()
{
- QDialog::keyPressEvent( e );
- if ( e->isAccepted() )
- return;
-
- if ( e->key() == Qt::Key_F1 ) {
- e->accept();
- onHelp();
- }
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myObj);
+ res << aGeomObjPtr;
+ return res;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#ifndef REPAIRGUI_FREEFACESDLG_H
#define REPAIRGUI_FREEFACESDLG_H
-#include <QDialog>
-#include <GEOMBase_Helper.h>
+#include <GEOMBase_Skeleton.h>
class GEOM_Displayer;
-class QPushButton;
class QLineEdit;
class GeometryGUI;
// class : RepairGUI_FreeFacesDlg
// purpose :
//=================================================================================
-class RepairGUI_FreeFacesDlg : public QDialog,
- public GEOMBase_Helper
+class RepairGUI_FreeFacesDlg : public GEOMBase_Skeleton
{
Q_OBJECT
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
-
+ virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
+
private:
void Init();
void enterEvent( QEvent* );
- void closeEvent( QCloseEvent* );
- void keyPressEvent( QKeyEvent* );
void activateSelection();
GEOM_Displayer* getDisplayer();
private slots:
- void onClose();
- void onHelp();
- void onDeactivate();
- void onActivate();
- void onSelectionDone();
- void onSetEditCurrentArgument();
+ void ClickOnOk();
+ bool ClickOnApply();
+ void SelectionIntoArgument();
+ void ActivateThisDialog();
private:
GEOM_Displayer* myDisplayer;
GEOM::GEOM_Object_var myObj;
- QPushButton* mySelBtn;
QLineEdit* myEdit;
- GeometryGUI* myGeomGUI;
- QString myHelpFileName;
};
#endif // REPAIRGUI_FREEFACESDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
for (int i = 0; i < myPoints.count(); i++)
GEOMBase::PublishSubObject(myPoints[i].get());
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_FuseEdgesDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myPoints);
+ GEOM::GeomObjPtr aGeomObjPtr(myShape);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private slots:
void ClickOnOk();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <SalomeApp_DoubleSpinBox.h>
+#include "utilities.h"
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#include <SUIT_ViewManager.h>
#include <OCCViewer_ViewModel.h>
#include <SALOME_ListIO.hxx>
+#include "utilities.h"
#include <GEOMImpl_Types.hxx>
GroupPoints = new DlgRef_1SelExt(centralWidget());
GroupPoints->GroupBox1->setTitle(tr("GEOM_GLUE"));
- GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
+ GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPES"));
GroupPoints->PushButton1->setIcon(image0);
GroupPoints->LineEdit1->setReadOnly(true);
GroupPoints2 = new DlgRef_1SelExt(centralWidget());
GroupPoints2->GroupBox1->setTitle(tr("GEOM_GLUE"));
- GroupPoints2->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
+ GroupPoints2->TextLabel1->setText(tr("GEOM_SELECTED_SHAPES"));
GroupPoints2->PushButton1->setIcon(image0);
GroupPoints2->LineEdit1->setReadOnly(true);
/* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1;
- myObject = GEOM::GEOM_Object::_nil();
+ myObjects.clear();
//myGeomGUI->SetState(0);
//globalSelection(GEOM_COMPOUND);
erasePreview();
myEditCurrentArgument->setText("");
- myObject = GEOM::GEOM_Object::_nil();
+ myObjects.clear();
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
+ myObjects = getSelected( TopAbs_SHAPE, -1 );
- if (aSelList.Extent() == 1) {
- Handle(SALOME_InteractiveObject) anIO = aSelList.First();
- myObject = GEOMBase::ConvertIOinGEOMObject(anIO);
- if (!CORBA::is_nil(myObject))
- myEditCurrentArgument->setText(GEOMBase::GetName(myObject));
+ if ( !myObjects.isEmpty() ) {
+ QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
+ myEditCurrentArgument->setText( aName );
}
updateButtonState();
}
ok = myTolEdt2->isValid(msg, !IsPreview());
break;
}
- return !myObject->_is_nil() && (IsPreview() || v > 0.) && ok;
+ return !myObjects.isEmpty() && (IsPreview() || v > 0.) && ok;
}
//=================================================================================
bool aResult = false;
objects.clear();
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length( myObjects.count() );
+ for ( int i = 0; i < myObjects.count(); ++i )
+ objList[i] = myObjects[i].copy();
+
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
switch (getConstructorId()) {
case 0:
{
GEOM::GEOM_Object_var anObj;
if (myGlueMode == TopAbs_FACE)
- anObj = anOper->MakeGlueFaces(myObject, myTolEdt->value(), true);
+ anObj = anOper->MakeGlueFaces( objList, myTolEdt->value(), true);
else if (myGlueMode == TopAbs_EDGE)
- anObj = anOper->MakeGlueEdges(myObject, myTolEdt->value());
+ anObj = anOper->MakeGlueEdges( objList, myTolEdt->value());
aResult = !anObj->_is_nil();
if (aResult && !IsPreview())
GEOM::GEOM_Object_var anObj;
if (myGlueMode == TopAbs_FACE) {
bool doGlueAllEdges = myGlueAllEdgesChk->isChecked();
- anObj = anOper->MakeGlueFacesByList(myObject, myTolEdt2->value(), aListForGlue.in(),
+ anObj = anOper->MakeGlueFacesByList( objList, myTolEdt2->value(), aListForGlue.in(),
true, doGlueAllEdges);
}
else if (myGlueMode == TopAbs_EDGE)
- anObj = anOper->MakeGlueEdgesByList(myObject, myTolEdt2->value(), aListForGlue.in());
+ anObj = anOper->MakeGlueEdgesByList( objList, myTolEdt2->value(), aListForGlue.in());
aResult = !anObj->_is_nil();
return false;
}
- erasePreview(false);
-
try {
if (openCommand()) {
SUIT_OverrideCursor wc;
abortCommand();
}
+ erasePreview(false);
+
updateViewer();
activateSelection();
updateButtonState();
buttonApply()->setEnabled(false);
globalSelection(GEOM_ALLSHAPES);
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length( myObjects.count() );
+ for ( int i = 0; i < myObjects.count(); ++i )
+ objList[i] = myObjects[i].copy();
+
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
GEOM::ListOfGO_var aList;
if (myGlueMode == TopAbs_FACE)
- aList = anOper->GetGlueFaces(myObject.in(), myTolEdt2->value());
+ aList = anOper->GetGlueFaces( objList, myTolEdt2->value());
else if (myGlueMode == TopAbs_EDGE)
- aList = anOper->GetGlueEdges(myObject.in(), myTolEdt2->value());
+ aList = anOper->GetGlueEdges( objList, myTolEdt2->value());
for (int i = 0, n = aList->length(); i < n; i++)
myTmpObjs << GEOM::GeomObjPtr(aList[i].in());
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument())) ;
- SUIT_MessageBox::information(this, tr("GEOM_FREE_BOUNDS_TLT"), msg, tr("Close"));
+ if ( myGlueMode == TopAbs_FACE )
+ SUIT_MessageBox::information(this, tr("GEOM_GLUE_FACES_DETECT_TITLE"), msg, tr("Close"));
+ else
+ SUIT_MessageBox::information(this, tr("GEOM_GLUE_EDGES_DETECT_TITLE"), msg, tr("Close"));
updateButtonState();
activateSelection();
}
this, SLOT(SelectionIntoArgument()));
globalSelection(GEOM_ALLSHAPES);
- if (myObject->_is_nil())
+ if ( myObjects.isEmpty() )
SelectionIntoArgument();
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
void RepairGUI_GlueDlg::updateButtonState()
{
int anId = getConstructorId();
- bool hasMainObj = !myObject->_is_nil();
+ bool hasMainObj = !myObjects.isEmpty();
if (anId == 0) {
buttonOk()->setEnabled(hasMainObj);
buttonApply()->setEnabled(hasMainObj);
clearTemporary();
GEOMBase_Skeleton::ClickOnCancel();
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_GlueDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myObjects);
+ for (int i = 0; i < myTmpObjs.count(); i++)
+ res << myTmpObjs[i];
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
void selectTmpInViewer();
private:
- GEOM::GEOM_Object_var myObject;
+ QList<GEOM::GeomObjPtr> myObjects;
QList<GEOM::GeomObjPtr> myTmpObjs;
DlgRef_1SelExt* GroupPoints;
--- /dev/null
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+// internal includes
+#include "RepairGUI_InspectObjectDlg.h"
+
+// GEOM includes
+#include <GEOMBase.h>
+#include <GEOM_Constants.h>
+#include <GeometryGUI.h>
+#include <GEOMUtils.hxx>
+
+// GUI includes
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_ViewManager.h>
+#include <SUIT_ViewWindow.h>
+
+#include <LightApp_SelectionMgr.h>
+
+#include <SalomeApp_Application.h>
+#include <SalomeApp_DoubleSpinBox.h>
+#include <SalomeApp_Study.h>
+
+#include <OCCViewer_ViewModel.h>
+#include <SVTK_ViewModel.h>
+
+// OCCT includes
+#include <BRep_Tool.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
+
+// Qt includes
+#include <QButtonGroup>
+#include <QComboBox>
+#include <QGridLayout>
+#include <QGroupBox>
+#include <QPushButton>
+#include <QHeaderView>
+#include <QItemDelegate>
+#include <QLineEdit>
+#include <QRadioButton>
+#include <QStackedLayout>
+#include <QTreeWidgetItem>
+
+// Shape type definitions (values are equal to corresponding types of TopAbs_ShapeEnum).
+#define TYPE_FACE 4
+#define TYPE_EDGE 6
+#define TYPE_VERTEX 7
+
+// Comparison type definitions
+#define COMPARE_GT 0
+#define COMPARE_GE 1
+#define COMPARE_LT 2
+#define COMPARE_LE 3
+
+// Default tolerance values
+#define DEFAULT_TOLERANCE_VALUE 1.e-07
+
+//=================================================================================
+// class : RepairGUI_InspectObjectDlg::TreeWidgetItem
+// purpose : class for "Inspect Object" tree item creation
+//=================================================================================
+class RepairGUI_InspectObjectDlg::TreeWidgetItem : public QTreeWidgetItem
+{
+public:
+ TreeWidgetItem(QTreeWidget*,
+ const QStringList&,
+ const TopoDS_Shape&,
+ const Handle(SALOME_InteractiveObject)&,
+ double = DEFAULT_TOLERANCE_VALUE,
+ int = Type);
+
+ TreeWidgetItem(QTreeWidgetItem*,
+ const QStringList&,
+ const TopoDS_Shape&,
+ const QString&,
+ double = DEFAULT_TOLERANCE_VALUE,
+ int = Type);
+
+ ~TreeWidgetItem();
+
+ bool isVisible();
+ void setVisible( bool, QIcon& );
+
+ TopoDS_Shape getShape() const;
+ Handle(SALOME_InteractiveObject) getIO() const;
+
+ double getTolerance() const;
+ void setTolerance(double theTolerance);
+
+private:
+ bool myIsVisible;
+ TopoDS_Shape myShape;
+ Handle(SALOME_InteractiveObject) myIO;
+ double myTolerance;
+
+};
+
+RepairGUI_InspectObjectDlg::TreeWidgetItem::TreeWidgetItem
+ (QTreeWidget *view,
+ const QStringList &strings,
+ const TopoDS_Shape &shape,
+ const Handle(SALOME_InteractiveObject) &io,
+ double theTolerance,
+ int type)
+: QTreeWidgetItem( view, strings, type ),
+ myIsVisible( false ),
+ myShape( shape ),
+ myIO( io ),
+ myTolerance (theTolerance)
+{
+}
+
+RepairGUI_InspectObjectDlg::TreeWidgetItem::TreeWidgetItem
+ (QTreeWidgetItem *parent,
+ const QStringList &strings,
+ const TopoDS_Shape &shape,
+ const QString &entry,
+ double theTolerance,
+ int type)
+: QTreeWidgetItem( parent, strings, type ),
+ myIsVisible( false ),
+ myShape( shape ),
+ myTolerance (theTolerance)
+{
+ myIO = new SALOME_InteractiveObject( entry.toAscii(), "GEOM", "TEMP_IO" );
+ setFlags( flags() | Qt::ItemIsEditable );
+}
+
+RepairGUI_InspectObjectDlg::TreeWidgetItem::~TreeWidgetItem()
+{
+}
+
+bool RepairGUI_InspectObjectDlg::TreeWidgetItem::isVisible()
+{
+ return myIsVisible;
+}
+
+void RepairGUI_InspectObjectDlg::TreeWidgetItem::setVisible( bool isVisible, QIcon& icon )
+{
+ myIsVisible = isVisible;
+ setIcon( 1, icon );
+}
+
+TopoDS_Shape RepairGUI_InspectObjectDlg::TreeWidgetItem::getShape() const
+{
+ return myShape;
+}
+
+Handle(SALOME_InteractiveObject) RepairGUI_InspectObjectDlg::TreeWidgetItem::getIO() const
+{
+ return myIO;
+}
+
+double RepairGUI_InspectObjectDlg::TreeWidgetItem::getTolerance() const
+{
+ return myTolerance;
+}
+
+void RepairGUI_InspectObjectDlg::TreeWidgetItem::setTolerance(double theTolerance)
+{
+ myTolerance = theTolerance;
+}
+
+//=================================================================================
+// class : RepairGUI_InspectObjectDlg::Delegate
+// purpose : class for "Inspect Object" tree item editing
+//=================================================================================
+class RepairGUI_InspectObjectDlg::Delegate : public QItemDelegate
+{
+public:
+ Delegate( QObject* = 0 );
+ ~Delegate();
+
+ void setEditorData( QWidget*, const QModelIndex& ) const;
+ void setModelData( QWidget*, QAbstractItemModel*, const QModelIndex& ) const;
+ QWidget* createEditor( QWidget*, const QStyleOptionViewItem&, const QModelIndex& ) const;
+};
+
+RepairGUI_InspectObjectDlg::Delegate::Delegate( QObject* parent )
+: QItemDelegate( parent )
+{
+}
+
+RepairGUI_InspectObjectDlg::Delegate::~Delegate()
+{
+}
+
+void RepairGUI_InspectObjectDlg::Delegate::setEditorData( QWidget* editor,
+ const QModelIndex& index ) const
+{
+ QItemDelegate::setEditorData( editor, index );
+ editor->setProperty( "___name___", editor->property( "text" ) );
+}
+
+void RepairGUI_InspectObjectDlg::Delegate::setModelData( QWidget* editor,
+ QAbstractItemModel* model,
+ const QModelIndex& index ) const
+{
+ QString aNewName = editor->property( "text" ).toString();
+ if ( aNewName.trimmed().isEmpty() )
+ editor->setProperty( "text", editor->property( "___name___" ) );
+ QItemDelegate::setModelData( editor, model, index );
+}
+
+QWidget* RepairGUI_InspectObjectDlg::Delegate::createEditor( QWidget* parent,
+ const QStyleOptionViewItem& option,
+ const QModelIndex& index ) const
+{
+ return index.column() == 1 ? 0 : QItemDelegate::createEditor( parent, option, index );
+}
+
+//=================================================================================
+// class : RepairGUI_InspectObjectDlg()
+// purpose : Constructs a RepairGUI_InspectObjectDlg which is a child of 'parent'.
+//=================================================================================
+RepairGUI_InspectObjectDlg::RepairGUI_InspectObjectDlg(GeometryGUI *theGeomGUI, SUIT_Desktop* parent )
+: GEOMBase_Helper (parent),
+ QDialog (parent),
+ myGeomGUI (theGeomGUI),
+ myTreeObjects (0),
+ myFilteredTreeObjects (0),
+ myCurrentTreeObjects (0),
+ myEditMainShape (0),
+ myTolFilterGrp (0),
+ myShapeTypeBtnGrp (0),
+ myComparisonCompo (0),
+ myMinTolValLabel (0),
+ myMaxTolValLabel (0),
+ myTolEdit (0),
+ myTreesLayout (0),
+ myTransparency (0.0),
+ myIsSelectAll (false),
+ myMaxTol (-1.),
+ myMinTol (-1.)
+{
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ QIcon iconSelect( resMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ myVisible = QIcon( resMgr->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_VISIBLE" ) ) );
+ myInvisible = QIcon( resMgr->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_INVISIBLE" ) ) );
+
+ QPixmap anImageVtx(resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_VERTEX")));
+ QPixmap anImageEdge(resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_EDGE")));
+ QPixmap anImageFace(resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_FACE")));
+
+ setWindowTitle( tr( "GEOM_INSPECT_OBJECT_TITLE" ) );
+ setAttribute( Qt::WA_DeleteOnClose );
+
+ myViewWindow = myGeomGUI->getApp()->desktop()->activeWindow();
+
+ QGridLayout* topLayout = new QGridLayout( this );
+ topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
+
+ /********************** Inspected Object **********************/
+
+ QHBoxLayout* mainShapeLayout = new QHBoxLayout(this);
+
+ QLabel* label = new QLabel( tr( "GEOM_INSPECT_OBJECT_MAIN_SHAPE" ), this );
+ QPushButton* selBtn = new QPushButton(this);
+ selBtn->setIcon( iconSelect );
+ myEditMainShape = new QLineEdit(this);
+ myEditMainShape->setReadOnly(true);
+
+ mainShapeLayout->addWidget( label );
+ mainShapeLayout->addWidget( selBtn );
+ mainShapeLayout->addWidget( myEditMainShape );
+
+ /********************** Tolerance filter **********************/
+
+ myTolFilterGrp = new QGroupBox (tr("GEOM_INSPECT_TOLERANCE_FILTER"), this);
+ myShapeTypeBtnGrp = new QButtonGroup(myTolFilterGrp);
+
+ // Filter on shape type
+ QRadioButton *aVtx = new QRadioButton(tr("GEOM_VERTEX"), myTolFilterGrp);
+ QRadioButton *anEdge = new QRadioButton(tr("GEOM_EDGE"), myTolFilterGrp);
+ QRadioButton *aFace = new QRadioButton(tr("GEOM_FACE"), myTolFilterGrp);
+
+ aVtx->setIcon(anImageVtx);
+ anEdge->setIcon(anImageEdge);
+ aFace->setIcon(anImageFace);
+ myShapeTypeBtnGrp->addButton(aVtx, TYPE_VERTEX);
+ myShapeTypeBtnGrp->addButton(anEdge, TYPE_EDGE);
+ myShapeTypeBtnGrp->addButton(aFace, TYPE_FACE);
+
+ // Filter on sub-shape tolerance
+ QLabel *aTolLabel = new QLabel(tr("GEOM_TOLERANCE"), myTolFilterGrp);
+ QLabel *aMinTolLabel = new QLabel(tr("GEOM_MIN"), myTolFilterGrp);
+ QLabel *aMaxTolLabel = new QLabel(tr("GEOM_MAX"), myTolFilterGrp);
+ QGridLayout *aFilterLayout = new QGridLayout(myTolFilterGrp);
+
+ myMinTolValLabel = new QLabel(myTolFilterGrp);
+ myMaxTolValLabel = new QLabel(myTolFilterGrp);
+ myMinTolResetBtn = new QPushButton(tr("GEOM_INSPECT_RESET_MIN"), myTolFilterGrp);
+ myMaxTolResetBtn = new QPushButton(tr("GEOM_INSPECT_RESET_MAX"), myTolFilterGrp);
+ myComparisonCompo = new QComboBox(myTolFilterGrp);
+ myTolEdit = new SalomeApp_DoubleSpinBox(myTolFilterGrp);
+ myTolEdit->setMinimumWidth(120);
+ aFilterLayout->addWidget(aVtx, 0, 0);
+ aFilterLayout->addWidget(anEdge, 0, 1);
+ aFilterLayout->addWidget(aFace, 0, 2);
+ aFilterLayout->addWidget(aMaxTolLabel, 1, 0, Qt::AlignRight);
+ aFilterLayout->addWidget(aTolLabel, 2, 0);
+ aFilterLayout->addWidget(aMinTolLabel, 3, 0, Qt::AlignRight);
+ aFilterLayout->addWidget(myMaxTolValLabel, 1, 1);
+ aFilterLayout->addWidget(myComparisonCompo, 2, 1);
+ aFilterLayout->addWidget(myMinTolValLabel, 3, 1);
+ aFilterLayout->addWidget(myMaxTolResetBtn, 1, 2);
+ aFilterLayout->addWidget(myTolEdit, 2, 2);
+ aFilterLayout->addWidget(myMinTolResetBtn, 3, 2);
+ aFilterLayout->setRowMinimumHeight(0, 30);
+
+ myTolFilterGrp->setCheckable(true);
+
+ /********************** Sub-objects trees **********************/
+ createTreeWidget(myTreeObjects);
+ createTreeWidget(myFilteredTreeObjects);
+
+ myTreesLayout = new QStackedLayout(this);
+ myTreesLayout->addWidget(myTreeObjects);
+ myTreesLayout->addWidget(myFilteredTreeObjects);
+
+ /********************** Buttons **********************/
+
+ QVBoxLayout* buttonsLayout1 = new QVBoxLayout(this);
+
+ QPushButton* buttonShow = new QPushButton( tr( "GEOM_INSPECT_OBJECT_SHOW" ), this );
+ QPushButton* buttonShowOnly = new QPushButton( tr( "GEOM_INSPECT_OBJECT_SHOW_ONLY" ), this );
+ QPushButton* buttonHide = new QPushButton( tr( "GEOM_INSPECT_OBJECT_HIDE" ), this );
+ QPushButton* buttonPublish = new QPushButton( tr( "GEOM_INSPECT_OBJECT_PUBLISH" ), this );
+ QPushButton* aShowAllBtn = new QPushButton(tr("SHOW_ALL_BTN"), this);
+ QPushButton* aHideAllBtn = new QPushButton(tr("HIDE_ALL_BTN"), this);
+
+
+ buttonsLayout1->addWidget( buttonShow );
+ buttonsLayout1->addWidget( buttonShowOnly );
+ buttonsLayout1->addWidget( buttonHide );
+ buttonsLayout1->addWidget( aShowAllBtn );
+ buttonsLayout1->addWidget( aHideAllBtn );
+ buttonsLayout1->addWidget( buttonPublish );
+ buttonsLayout1->addStretch();
+
+ QHBoxLayout* buttonsLayout2 = new QHBoxLayout(this);
+
+ QPushButton* buttonClose = new QPushButton( tr( "GEOM_BUT_CLOSE" ), this );
+ QPushButton* buttonHelp = new QPushButton( tr( "GEOM_BUT_HELP" ), this );
+
+ buttonsLayout2->addWidget( buttonClose );
+ buttonsLayout2->addStretch();
+ buttonsLayout2->addWidget( buttonHelp );
+
+ topLayout->addLayout( mainShapeLayout, 0, 0 );
+ topLayout->addWidget( myTolFilterGrp, 1, 0);
+ topLayout->addLayout( myTreesLayout, 2, 0 );
+ topLayout->addLayout( buttonsLayout1, 0, 1, 3, 1 );
+ topLayout->addLayout( buttonsLayout2, 3, 0, 1, 2 );
+
+ connect( selBtn, SIGNAL( clicked() ), this, SLOT( onEditMainShape() ) );
+
+ connect( buttonShow, SIGNAL( clicked() ), this, SLOT( clickOnShow() ) );
+ connect( buttonShowOnly, SIGNAL( clicked() ), this, SLOT( clickOnShowOnly() ) );
+ connect( buttonHide, SIGNAL( clicked() ), this, SLOT( clickOnHide() ) );
+ connect( buttonPublish, SIGNAL( clicked() ), this, SLOT( clickOnPublish() ) );
+ connect( buttonClose, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( clickOnHelp() ) );
+ connect( aShowAllBtn, SIGNAL( clicked() ), this, SLOT( clickOnShowAll() ) );
+ connect( aHideAllBtn, SIGNAL( clicked() ), this, SLOT( clickOnHideAll() ) );
+
+ init();
+}
+
+RepairGUI_InspectObjectDlg::~RepairGUI_InspectObjectDlg()
+{
+ if ( myViewWindow )
+ onEditMainShape();
+ // restore initial parameters for viewer
+ getDisplayer()->UnsetColor();
+ getDisplayer()->UnsetWidth();
+ // no need to delete child widgets, Qt does it all for us
+}
+
+//=================================================================================
+// function : createTreeWidget()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::createTreeWidget(QTreeWidget *&theTreeObjects)
+{
+ theTreeObjects = new QTreeWidget(this);
+ theTreeObjects->setColumnCount(2);
+ QStringList columnNames;
+ columnNames.append(tr("GEOM_INSPECT_OBJECT_NAME"));
+ columnNames.append("");
+ theTreeObjects->setHeaderLabels(columnNames);
+ QTreeWidgetItem* headerItem = new QTreeWidgetItem(columnNames);
+
+ headerItem->setIcon(1, myInvisible);
+ theTreeObjects->setHeaderItem(headerItem);
+ theTreeObjects->header()->moveSection(1, 0);
+ theTreeObjects->header()->setClickable(true);
+ theTreeObjects->header()->setMovable(false);
+ theTreeObjects->header()->setResizeMode( 1, QHeaderView::ResizeToContents);
+ theTreeObjects->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ theTreeObjects->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed);
+ // set custom item delegate
+ theTreeObjects->setItemDelegate(new Delegate(theTreeObjects));
+}
+
+//=================================================================================
+// function : init()
+// purpose : initialize dialog data
+//=================================================================================
+void RepairGUI_InspectObjectDlg::init()
+{
+ myTolFilterGrp->setChecked(false);
+ myComparisonCompo->addItem(">", GEOMUtils::CC_GT);
+ myComparisonCompo->addItem(">=", GEOMUtils::CC_GE);
+ myComparisonCompo->addItem("<", GEOMUtils::CC_LT);
+ myComparisonCompo->addItem("<=", GEOMUtils::CC_LE);
+
+ initSpinBox(myTolEdit, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision");
+ myTolEdit->setValue(DEFAULT_TOLERANCE_VALUE);
+
+ // Signals and slots connections
+ initTreeWidget(myTreeObjects);
+ initTreeWidget(myFilteredTreeObjects);
+ myCurrentTreeObjects = myTreeObjects;
+ myMaxTolResetBtn->setEnabled(false);
+ myMinTolResetBtn->setEnabled(false);
+
+ connect(myMinTolResetBtn, SIGNAL(clicked()), this, SLOT(clickOnResetToMin()));
+ connect(myMaxTolResetBtn, SIGNAL(clicked()), this, SLOT(clickOnResetToMax()));
+ connect(myShapeTypeBtnGrp, SIGNAL(buttonClicked(int)), this, SLOT(onInitFilteredData()));
+ connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+ connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
+
+ connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onViewSelectionChanged() ) );
+
+ connect( myGeomGUI->getApp()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
+ this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
+
+ // Connect signals and slots for filter group box elements.
+ connect(myTolFilterGrp, SIGNAL(toggled(bool)),
+ this, SLOT(onFilterToggled(bool)));
+ connect(myComparisonCompo, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(onFilterData()));
+ connect(myTolEdit, SIGNAL(valueChanged(double)),
+ this, SLOT(onFilterData()));
+
+ if ( myViewWindow )
+ connect( myViewWindow->getViewManager(), SIGNAL( deleteView( SUIT_ViewWindow* ) ),
+ this, SLOT( onCloseView( SUIT_ViewWindow* ) ), Qt::UniqueConnection );
+
+ // Initialize the dialog with current selection.
+ onViewSelectionChanged();
+}
+
+//=================================================================================
+// function : initSpinBox()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::initSpinBox(SalomeApp_DoubleSpinBox* spinBox,
+ double min, double max,
+ double step, const char* quantity)
+{
+ // Obtain precision from preferences
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ int aPrecision = resMgr->integerValue( "Geometry", quantity, 6 );
+
+ spinBox->setPrecision( aPrecision );
+ spinBox->setDecimals( qAbs( aPrecision ) ); // it's necessary to set decimals before the range setting,
+ // by default Qt rounds boundaries to 2 decimals at setRange
+ spinBox->setRange( min, max );
+ spinBox->setSingleStep( step );
+
+ // Add a hint for the user saying how to tune precision
+ QString userPropName = QObject::tr( QString( "GEOM_PREF_%1" ).arg( quantity ).toLatin1().constData() );
+ spinBox->setProperty( "validity_tune_hint",
+ QVariant( QObject::tr( "GEOM_PRECISION_HINT" ).arg( userPropName ) ) );
+}
+
+//=================================================================================
+// function : initTreeWidget()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::initTreeWidget(QTreeWidget *theTreeObjects)
+{
+ connect(theTreeObjects, SIGNAL(itemClicked (QTreeWidgetItem *, int)),
+ this, SLOT(onItemClicked(QTreeWidgetItem *, int)));
+ connect(theTreeObjects, SIGNAL(itemChanged (QTreeWidgetItem *, int)),
+ this, SLOT(onItemChanged(QTreeWidgetItem *, int)));
+ connect(theTreeObjects, SIGNAL(itemExpanded (QTreeWidgetItem *)),
+ this, SLOT(onItemExpanded(QTreeWidgetItem *)));
+ connect(theTreeObjects, SIGNAL(itemSelectionChanged()),
+ this, SLOT(onItemSelectionChanged()));
+
+ connect(theTreeObjects->header(), SIGNAL(sectionClicked(int)),
+ this, SLOT(onHeaderClicked(int)));
+}
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::enterEvent (QEvent*)
+{
+ if (!myTolFilterGrp->isEnabled())
+ ActivateThisDialog();
+}
+
+//=================================================================================
+// function : checkVisibleIcon()
+// purpose : set visible or invisible icon in the header of tree
+//=================================================================================
+void RepairGUI_InspectObjectDlg::checkVisibleIcon()
+{
+ bool isInvisible = false;
+ QTreeWidgetItemIterator it( myCurrentTreeObjects );
+ while ( *it ) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
+ if ( !anItem->isHidden() && !anItem->isVisible() ) {
+ isInvisible = true;
+ break;
+ }
+ ++it;
+ }
+
+ if ( isInvisible ) {
+ myCurrentTreeObjects->headerItem()->setIcon( 1, myInvisible );
+ myIsSelectAll = false;
+ }
+ else {
+ myCurrentTreeObjects->headerItem()->setIcon( 1, myVisible );
+ myIsSelectAll = true;
+ }
+}
+
+//=================================================================================
+// function : addSubObjects()
+// purpose : add sub-objects to parent object in the tree
+//=================================================================================
+void RepairGUI_InspectObjectDlg::addSubObjects
+ (TreeWidgetItem *theParentItem,
+ const TopTools_IndexedMapOfShape &theIndices)
+{
+ TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myTreeObjects->topLevelItem(0) );
+ TopoDS_Iterator it( theParentItem->getShape() );
+ for ( ; it.More(); it.Next() ) {
+ TopoDS_Shape aSubShape = it.Value();
+ int anIndex = theIndices.FindIndex(aSubShape);
+ QString anEntry = QString( "TEMP_" ) + aMainItem->getIO()->getEntry() + QString("_%1").arg( anIndex );
+ TreeWidgetItem* anItem = new TreeWidgetItem( theParentItem, QStringList(), aSubShape, anEntry);
+ anItem->setVisible( false, myInvisible );
+ addSubObjects(anItem, theIndices);
+ }
+}
+
+//=================================================================================
+// function : onInitFilteredData()
+// purpose : add sub-objects to parent object in the filtered tree
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onInitFilteredData()
+{
+ TreeWidgetItem *aMainItem =
+ dynamic_cast<TreeWidgetItem*>(myFilteredTreeObjects->topLevelItem(0));
+
+ if (!aMainItem) {
+ return;
+ }
+
+ // Remove the children.
+ SALOME_ListIO aListOfIO;
+ QTreeWidgetItemIterator it(aMainItem);
+
+ while (*it) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
+ if (aMainItem != anItem && (anItem->flags() & Qt::ItemIsSelectable) &&
+ anItem->isVisible() && !anItem->isHidden()) {
+ aListOfIO.Append(anItem->getIO());
+ }
+
+ ++it;
+ }
+
+ myFilteredTreeObjects->clearSelection();
+ myFilteredTreeObjects->headerItem()->setIcon(1, myInvisible);
+ getDisplayer()->Erase(aListOfIO);
+ getDisplayer()->UpdateViewer();
+
+ // Delete child items.
+ QList<QTreeWidgetItem *> aListItems = aMainItem->takeChildren();
+
+ foreach (QTreeWidgetItem *anItem, aListItems) {
+ delete anItem;
+ }
+
+ // Initialize the tree with a new list.
+ TopoDS_Shape aShape = aMainItem->getShape();
+ TopAbs_ShapeEnum aShapeType = aShape.ShapeType();
+
+ myShapeTypeBtnGrp->button(TYPE_FACE)->setVisible(aShapeType < TYPE_FACE);
+ myShapeTypeBtnGrp->button(TYPE_EDGE)->setVisible(aShapeType < TYPE_EDGE);
+ myShapeTypeBtnGrp->button(TYPE_VERTEX)->setVisible(aShapeType < TYPE_VERTEX);
+
+ int anId = myShapeTypeBtnGrp->checkedId();
+
+ myMaxTol = -RealLast();
+ myMinTol = RealLast();
+
+ if (anId != -1 && myShapeTypeBtnGrp->checkedButton()->isVisible()) {
+ // Get sub-shapes
+ TopTools_MapOfShape aMapFence;
+ TopExp_Explorer anExp(aShape, (TopAbs_ShapeEnum)anId);
+ TopTools_IndexedMapOfShape anIndices;
+
+ TopExp::MapShapes(aShape, anIndices);
+
+ for (; anExp.More(); anExp.Next()) {
+ const TopoDS_Shape &aSubShape = anExp.Current();
+
+ if (aMapFence.Add(aSubShape)) {
+ // Compute tolerance
+ Standard_Real aTolerance = -1.;
+
+ switch (aSubShape.ShapeType()) {
+ case TYPE_FACE:
+ aTolerance = BRep_Tool::Tolerance(TopoDS::Face(aSubShape));
+ break;
+ case TYPE_EDGE:
+ aTolerance = BRep_Tool::Tolerance(TopoDS::Edge(aSubShape));
+ break;
+ case TYPE_VERTEX:
+ aTolerance = BRep_Tool::Tolerance(TopoDS::Vertex(aSubShape));
+ break;
+ default:
+ break;
+ }
+
+ if (aTolerance < 0.) {
+ continue;
+ }
+
+ if (aTolerance > myMaxTol) {
+ myMaxTol = aTolerance;
+ }
+
+ if (aTolerance < myMinTol) {
+ myMinTol = aTolerance;
+ }
+
+ int anIndex = anIndices.FindIndex(aSubShape);
+ QString anEntry = QString( "TEMP_" ) +
+ aMainItem->getIO()->getEntry() +
+ QString::number(anIndex);
+ TreeWidgetItem* anItem =
+ new TreeWidgetItem(aMainItem, QStringList(),
+ aSubShape, anEntry, aTolerance);
+ anItem->setVisible( false, myInvisible );
+ }
+ }
+ }
+
+ // Compose names of sub-items if the main item is expanded.
+ if (aMainItem->isExpanded()) {
+ onItemExpanded(aMainItem);
+ }
+
+ myMaxTolResetBtn->setEnabled(myMaxTol >= myMinTol);
+ myMinTolResetBtn->setEnabled(myMaxTol >= myMinTol);
+
+ if (myMaxTol < myMinTol) {
+ myMinTol = DEFAULT_TOLERANCE_VALUE;
+ myMaxTol = DEFAULT_TOLERANCE_VALUE;
+ myMinTolValLabel->setText(QString::number(DEFAULT_TOLERANCE_VALUE));
+ myMaxTolValLabel->setText(QString::number(DEFAULT_TOLERANCE_VALUE));
+ myTolEdit->setValue(DEFAULT_TOLERANCE_VALUE);
+ } else {
+ myMinTolValLabel->setText(QString::number(myMinTol));
+ myMaxTolValLabel->setText(QString::number(myMaxTol));
+
+ if (GEOMUtils::CompareToleranceValues(myMinTol, myTolEdit->value()) == 1) {
+ clickOnResetToMin();
+ } else if (GEOMUtils::CompareToleranceValues
+ (myMaxTol, myTolEdit->value()) == -1) {
+ clickOnResetToMax();
+ } else {
+ onFilterData();
+ }
+ }
+}
+
+//=================================================================================
+// function : onFilterData()
+// purpose : filter objects in the filtered tree
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onFilterData()
+{
+ TreeWidgetItem *aMainItem =
+ dynamic_cast<TreeWidgetItem*>(myFilteredTreeObjects->topLevelItem(0));
+
+ if (!aMainItem) {
+ return;
+ }
+
+ SALOME_ListIO aListOfIOToHide;
+ QTreeWidgetItemIterator anIt(aMainItem);
+ const int aCompValue =
+ myComparisonCompo->itemData(myComparisonCompo->currentIndex()).toInt();
+ const double aTolValue = myTolEdit->value();
+
+ while (*anIt) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*anIt);
+
+ if (aMainItem != anItem) {
+ const bool isToFilter = !GEOMUtils::IsFitCondition
+ ((GEOMUtils::ComparisonCondition) aCompValue,
+ anItem->getTolerance(), aTolValue);
+
+ if (isToFilter && !anItem->isHidden()) {
+ if (anItem->isVisible()) {
+ aListOfIOToHide.Append(anItem->getIO());
+ }
+
+ anItem->setVisible(false, myInvisible);
+ }
+
+ anItem->setHidden(isToFilter);
+ }
+
+ ++anIt;
+ }
+
+ if (!aListOfIOToHide.IsEmpty()) {
+ getDisplayer()->Erase(aListOfIOToHide);
+ getDisplayer()->UpdateViewer();
+ }
+
+ checkVisibleIcon();
+}
+
+//=================================================================================
+// function : displayItem()
+// purpose : display sub-object of inspected object according its tree item
+//=================================================================================
+void RepairGUI_InspectObjectDlg::displayItem( TreeWidgetItem* theItem )
+{
+ GEOM_Displayer* aDisplayer = getDisplayer();
+ if ( theItem == myCurrentTreeObjects->topLevelItem(0) ) {
+ aDisplayer->UnsetColor();
+ aDisplayer->UnsetWidth();
+ }
+ else if ( aDisplayer->GetColor() != Quantity_NOC_VIOLET && aDisplayer->GetWidth() != 2.0 ) {
+ aDisplayer->SetColor( Quantity_NOC_VIOLET );
+ aDisplayer->SetWidth( 2.0 );
+ }
+
+ SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation( theItem->getShape(), theItem->getIO()->getEntry(),
+ GEOM_Displayer::GetActiveView() );
+ if ( aPrs )
+ displayPreview( aPrs, true, false );
+}
+
+//=================================================================================
+// function : setItemDisplayStatus()
+// purpose : set visible or invisible status for the same items in the tree
+//=================================================================================
+void RepairGUI_InspectObjectDlg::setItemDisplayStatus( TreeWidgetItem* theItem, bool theIsVisible )
+{
+ QTreeWidgetItemIterator it( myCurrentTreeObjects );
+ while (*it) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
+ if ( anItem->getShape().IsSame( theItem->getShape() ) )
+ anItem->setVisible( theIsVisible, theIsVisible ? myVisible : myInvisible );
+ ++it;
+ }
+}
+
+//=================================================================================
+// function : setMainObjectTransparency()
+// purpose : set transparency for the inspected object
+//=================================================================================
+void RepairGUI_InspectObjectDlg::setMainObjectTransparency( double theTransparency )
+{
+ SUIT_ViewManager* aViewMan = myViewWindow->getViewManager();
+ SALOME_View* aView = dynamic_cast<SALOME_View*>( aViewMan->getViewModel() );
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( myGeomGUI->getApp()->activeStudy() );
+
+ TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myCurrentTreeObjects->topLevelItem(0) );
+
+ if (!aMainItem) {
+ return;
+ }
+
+ aStudy->setObjectProperty( myViewWindow->getViewManager()->getGlobalId(),
+ QString( aMainItem->getIO()->getEntry() ),
+ GEOM::propertyName( GEOM::Transparency ), theTransparency );
+
+ if ( aView->isVisible( aMainItem->getIO() ) )
+ getDisplayer()->Redisplay( aMainItem->getIO(), true, aView );
+}
+
+//=================================================================================
+// function : restoreParam()
+// purpose : restore initial parameters of the dialog and the viewer
+//=================================================================================
+void RepairGUI_InspectObjectDlg::restoreParam()
+{
+ SUIT_ViewManager* aViewMan = myViewWindow->getViewManager();
+ SALOME_View* aView = dynamic_cast<SALOME_View*>( aViewMan->getViewModel() );
+ GEOM_Displayer* aDisplayer = getDisplayer();
+ // restore initial parameters for viewer
+ aDisplayer->UnsetColor();
+ aDisplayer->UnsetWidth();
+
+ // restore transparency of main object
+ setMainObjectTransparency( myTransparency );
+
+ // erase sub-shapes
+ TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myCurrentTreeObjects->topLevelItem(0) );
+ QTreeWidgetItemIterator it( myCurrentTreeObjects );
+ while (*it) {
+ if ( *it != aMainItem ) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
+ aDisplayer->Erase( anItem->getIO(), false, false, aView );
+ anItem->setVisible( false, myInvisible );
+ }
+ ++it;
+ }
+}
+
+//=================================================================================
+// function : onEditMainShape()
+// purpose : called when selection button was clicked
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onEditMainShape()
+{
+ if ( myEditMainShape->text().isEmpty() || !myViewWindow )
+ return;
+
+ restoreParam();
+
+ // restore initial parameters for dialog box
+ myEditMainShape->setEnabled( true );
+ myEditMainShape->setText("");
+ myEditMainShape->setFocus();
+ myTreeObjects->clear();
+ myFilteredTreeObjects->clear();
+}
+
+//=================================================================================
+// function : onItemClicked()
+// purpose : called when tree item was clicked
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onItemClicked( QTreeWidgetItem* theItem, int theColumn )
+{
+ if ( theColumn!= 1 || !( theItem->flags() & Qt::ItemIsSelectable ) || !myViewWindow )
+ return;
+
+ GEOM_Displayer* aDisplayer = getDisplayer();
+
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>( theItem );
+
+ if ( anItem->isVisible() ) {
+ aDisplayer->Erase( anItem->getIO(), false, true );
+ setItemDisplayStatus( anItem, false );
+ }
+ else {
+ displayItem( anItem );
+ setItemDisplayStatus( anItem, true );
+ }
+ aDisplayer->UpdateViewer();
+ checkVisibleIcon();
+}
+
+//=================================================================================
+// function : onItemChanged()
+// purpose : called when tree item was changed
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onItemChanged( QTreeWidgetItem* theItem, int theColumn )
+{
+ if ( theColumn!= 0 || !( theItem->flags() & Qt::ItemIsEditable ) )
+ return;
+
+ // rename the same items in the tree
+ QTreeWidgetItemIterator it( myCurrentTreeObjects );
+ while ( *it ) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
+ if ( anItem->getShape().IsSame( dynamic_cast<TreeWidgetItem*>( theItem )->getShape() ) )
+ anItem->setText( 0, theItem->text(0) );
+ ++it;
+ }
+}
+
+//=================================================================================
+// function : onItemExpanded()
+// purpose : called when tree item was expanded
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onItemExpanded( QTreeWidgetItem* theItem )
+{
+ TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myCurrentTreeObjects->topLevelItem(0) );
+ GEOM::GEOM_Object_var aMainObject = GEOMBase::ConvertIOinGEOMObject( aMainItem->getIO() );
+
+ for ( int i = 0; i < theItem->childCount(); i++ ) {
+ TreeWidgetItem* aSubItem = dynamic_cast<TreeWidgetItem*>( theItem->child(i) );
+ int anIndex = GEOMBase::GetIndex( aSubItem->getShape(), aMainItem->getShape() );
+ if ( aSubItem->text(0).isEmpty() ) {
+ char* aName = aMainObject->GetSubShapeName( anIndex );
+ if ( !QString( aName ).isEmpty() )
+ aSubItem->setText( 0, QString( aName ) );
+ else
+ aSubItem->setText( 0, QString("%1_%2").arg( GEOMBase::TypeName( aSubItem->getShape().ShapeType(), true ) ).arg( anIndex ) );
+ }
+ }
+}
+
+//=================================================================================
+// function : onItemSelectionChanged()
+// purpose : called when tree item was selected
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onItemSelectionChanged()
+{
+ if ( !myViewWindow )
+ return;
+
+ QList<QTreeWidgetItem*> listItem = myCurrentTreeObjects->selectedItems();
+ SALOME_ListIO aSelected;
+ for ( int i = 0; i < listItem.size(); i++ ) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>( listItem.at(i) );
+ aSelected.Append( anItem->getIO() );
+ }
+ myGeomGUI->getApp()->selectionMgr()->setSelectedObjects( aSelected );
+}
+
+//=================================================================================
+// function : onHeaderClicked()
+// purpose : called when header item of tree was clicked
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onHeaderClicked( int theColumn )
+{
+ if ( theColumn != 1 || !myViewWindow )
+ return;
+
+ GEOM_Displayer* aDisplayer = getDisplayer();
+
+ if ( myIsSelectAll ) {
+ myIsSelectAll = false;
+ myCurrentTreeObjects->headerItem()->setIcon( 1, myInvisible );
+ SALOME_ListIO aListOfIO;
+ QTreeWidgetItemIterator it( myCurrentTreeObjects );
+ while ( *it ) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
+ if ( !anItem->isHidden() && ( anItem->flags() & Qt::ItemIsSelectable ) &&
+ anItem->isVisible() ) {
+ aListOfIO.Append( anItem->getIO() );
+ anItem->setVisible( false, myInvisible );
+ }
+ ++it;
+ }
+ aDisplayer->Erase( aListOfIO );
+ }
+ else {
+ myIsSelectAll = true;
+ myCurrentTreeObjects->headerItem()->setIcon( 1, myVisible );
+ QTreeWidgetItemIterator it( myCurrentTreeObjects );
+ while ( *it ) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
+ if ( !anItem->isHidden() && ( anItem->flags() & Qt::ItemIsSelectable ) &&
+ !anItem->isVisible() ) {
+ displayItem( anItem );
+ anItem->setVisible( true, myVisible );
+ }
+ ++it;
+ }
+ }
+
+ aDisplayer->UpdateViewer();
+}
+
+//=================================================================================
+// function : onViewSelectionChanged()
+// purpose : called when selection of object browser was changed
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onViewSelectionChanged()
+{
+ if (!myEditMainShape->isEnabled())
+ return;
+
+ //get shape from selection
+ SALOME_ListIO selected;
+ myGeomGUI->getApp()->selectionMgr()->selectedObjects(selected);
+
+ if ( selected.Extent() != 1 )
+ return;
+
+ if ( !myViewWindow ) {
+ SUIT_ViewManager* occVm = myGeomGUI->getApp()->getViewManager( OCCViewer_Viewer::Type(), true );
+ myViewWindow = occVm->getActiveView();
+ connect( occVm, SIGNAL( deleteView( SUIT_ViewWindow* ) ),
+ this, SLOT( onCloseView( SUIT_ViewWindow* ) ), Qt::UniqueConnection );
+ }
+
+ TopoDS_Shape aShape = GEOMBase::GetTopoFromSelection( selected );
+ if ( aShape.IsNull() )
+ return;
+
+ Handle(SALOME_InteractiveObject) anIO = selected.First();
+ GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( anIO );
+ QString aName = anObject->GetName();
+ CORBA::String_var anEntry = anObject->GetStudyEntry();
+
+ myEditMainShape->setText( aName );
+ myEditMainShape->setEnabled( false );
+
+ // remember initial transparency value
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( myGeomGUI->getApp()->activeStudy() );
+ QVariant v = aStudy->getObjectProperty( myViewWindow->getViewManager()->getGlobalId(),
+ QString( anEntry.in() ),
+ GEOM::propertyName( GEOM::Transparency ), myTransparency );
+ if ( v.canConvert( QVariant::Double ) )
+ myTransparency = v.toDouble();
+
+ TreeWidgetItem* anItem = new TreeWidgetItem
+ (myTreeObjects, QStringList() << aName, aShape, anIO);
+ TreeWidgetItem* anItemFiltered = new TreeWidgetItem
+ (myFilteredTreeObjects, QStringList() << aName, aShape, anIO);
+
+ if ( getDisplayer()->IsDisplayed( anEntry.in() ) ) {
+ anItem->setVisible( true, myVisible );
+ anItemFiltered->setVisible( true, myVisible );
+ } else {
+ anItem->setVisible( false, myInvisible );
+ anItemFiltered->setVisible( false, myInvisible );
+ }
+
+ setMainObjectTransparency( 0.5 );
+
+ // add sub-objects in the tree
+ TopTools_IndexedMapOfShape anIndices;
+
+ TopExp::MapShapes(aShape, anIndices);
+ addSubObjects(anItem, anIndices);
+ onInitFilteredData();
+ updateViewer(false);
+
+ // check icon for tree header
+ checkVisibleIcon();
+}
+
+//=================================================================================
+// function : onWindowActivated()
+// purpose : called when other window was activated
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onWindowActivated( SUIT_ViewWindow* theViewWindow )
+{
+ if ( myViewWindow )
+ restoreParam();
+
+ connect( theViewWindow->getViewManager(), SIGNAL( deleteView( SUIT_ViewWindow* ) ),
+ this, SLOT( onCloseView( SUIT_ViewWindow* ) ), Qt::UniqueConnection );
+
+ if ( theViewWindow->getViewManager()->getType() != OCCViewer_Viewer::Type() &&
+ theViewWindow->getViewManager()->getType() != SVTK_Viewer::Type() ) {
+ myViewWindow = 0;
+ return;
+ }
+ myViewWindow = theViewWindow;
+
+ if ( myCurrentTreeObjects->topLevelItemCount() > 0 ) {
+ setMainObjectTransparency( 0.5 );
+ TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myCurrentTreeObjects->topLevelItem(0) );
+ if ( getDisplayer()->IsDisplayed( aMainItem->getIO()->getEntry() ) )
+ aMainItem->setVisible( true, myVisible );
+ else
+ aMainItem->setVisible( false, myInvisible );
+ }
+ checkVisibleIcon();
+}
+
+//=================================================================================
+// function : onCloseView()
+// purpose : called when last view was closed
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onCloseView( SUIT_ViewWindow* )
+{
+ if ( myGeomGUI->getApp()->desktop()->windows().size() == 0 ) {
+ restoreParam();
+ myViewWindow = 0;
+ }
+}
+
+//=================================================================================
+// function : clickOnShow()
+// purpose : called when "Show selected" button was clicked
+//=================================================================================
+void RepairGUI_InspectObjectDlg::clickOnShow()
+{
+ if ( !myViewWindow )
+ return;
+
+ QList<QTreeWidgetItem*> listItem = myCurrentTreeObjects->selectedItems();
+ for ( int i = 0; i < listItem.size(); i++ ) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>( listItem.at(i) );
+ if ( !anItem->isVisible() ) {
+ displayItem( anItem );
+ setItemDisplayStatus( anItem, true );
+ }
+ }
+ getDisplayer()->UpdateViewer();
+ checkVisibleIcon();
+}
+
+//=================================================================================
+// function : clickOnShowOnly()
+// purpose : called when "Show only selected" button was clicked
+//=================================================================================
+void RepairGUI_InspectObjectDlg::clickOnShowOnly()
+{
+ if ( !myViewWindow )
+ return;
+
+ SALOME_ListIO aListOfIO;
+ QTreeWidgetItemIterator it( myCurrentTreeObjects );
+ while ( *it ) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
+ if ( !anItem->isHidden() && ( anItem->flags() & Qt::ItemIsSelectable ) &&
+ anItem->isVisible() ) {
+ aListOfIO.Append( anItem->getIO() );
+ anItem->setVisible( false, myInvisible );
+ }
+ ++it;
+ }
+ getDisplayer()->Erase( aListOfIO );
+
+ clickOnShow();
+}
+
+//=================================================================================
+// function : clickOnHide()
+// purpose : called when "Hide selected" button was clicked
+//=================================================================================
+void RepairGUI_InspectObjectDlg::clickOnHide()
+{
+ if ( !myViewWindow )
+ return;
+
+ QList<QTreeWidgetItem*> listItem = myCurrentTreeObjects->selectedItems();
+ for ( int i = 0; i < listItem.size(); i++ ) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>( listItem.at(i) );
+ if ( anItem->isVisible() ) {
+ getDisplayer()->Erase( anItem->getIO(), false, false );
+ setItemDisplayStatus( anItem, false );
+ }
+ }
+ getDisplayer()->UpdateViewer();
+ checkVisibleIcon();
+}
+
+//=================================================================================
+// function : clickOnPublish()
+// purpose : called when "Publish selected" button was clicked
+//=================================================================================
+void RepairGUI_InspectObjectDlg::clickOnPublish()
+{
+ _PTR(Study) studyDS = dynamic_cast<SalomeApp_Study*>( myGeomGUI->getApp()->activeStudy() )->studyDS();
+
+ // find main object
+ TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myCurrentTreeObjects->topLevelItem(0) );
+
+ if (!aMainItem) {
+ return;
+ }
+
+ GEOM::GEOM_Object_var aMainObject = GEOMBase::ConvertIOinGEOMObject( aMainItem->getIO() );
+
+ // find unique indices of selected objects
+ QList<QTreeWidgetItem*> selectedItems = myCurrentTreeObjects->selectedItems();
+ QMap< int, QString > anIndices;
+ GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
+ anArray->length( selectedItems.size() );
+ int j = 0;
+ for ( int i = 0; i < selectedItems.size(); i++ ) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>( selectedItems.at(i) );
+ int anIndex = GEOMBase::GetIndex( anItem->getShape(), aMainItem->getShape() );
+ if ( anIndices.find( anIndex ) == anIndices.end() &&
+ anItem != aMainItem ) {
+ anIndices[ anIndex ] = anItem->text(0);
+ anArray[j++] = anIndex;
+ }
+ }
+ anArray->length(j);
+
+ // get selected sub-shapes
+ GEOM::GEOM_IShapesOperations_var anOper = getGeomEngine()->GetIShapesOperations( getStudyId() );
+ GEOM::ListOfGO_var aList = anOper->MakeSubShapes( aMainObject, anArray );
+
+ // publish sub-shapes
+ for ( int i = 0; i < aList->length(); i++ )
+ GeometryGUI::GetGeomGen()->AddInStudy( GeometryGUI::ClientStudyToStudy( studyDS ), aList[i],
+ anIndices.values().at(i).toStdString().c_str(), aMainObject );
+
+ updateObjBrowser();
+}
+
+//=================================================================================
+// function : clickOnHelp()
+// purpose : called when Help button was clicked to open a help page
+//=================================================================================
+void RepairGUI_InspectObjectDlg::clickOnHelp()
+{
+ myGeomGUI->getApp()->onHelpContextModule( "GEOM", "inspect_object_operation_page.html" );
+}
+
+//=================================================================================
+// function : clickOnResetToMin()
+// purpose : called when Reset button was clicked to reset tolerance filter to minimal value.
+//=================================================================================
+void RepairGUI_InspectObjectDlg::clickOnResetToMin()
+{
+ if (myMinTol >= myTolEdit->minimum() && myMinTol <= myTolEdit->maximum()) {
+ myTolEdit->setValue(myMinTol);
+ }
+}
+
+//=================================================================================
+// function : clickOnResetToMax()
+// purpose : called when Reset button was clicked to reset tolerance filter to maximal value.
+//=================================================================================
+void RepairGUI_InspectObjectDlg::clickOnResetToMax()
+{
+ if (myMaxTol >= myTolEdit->minimum() && myMaxTol <= myTolEdit->maximum()) {
+ myTolEdit->setValue(myMaxTol);
+ }
+}
+
+//=================================================================================
+// function : clickOnShowAll()
+// purpose : called when Help button was clicked to show all shapes
+//=================================================================================
+void RepairGUI_InspectObjectDlg::clickOnShowAll()
+{
+ myIsSelectAll = false;
+ onHeaderClicked(1);
+}
+
+//=================================================================================
+// function : clickOnHideAll()
+// purpose : called when Help button was clicked to hide all shapes
+//=================================================================================
+void RepairGUI_InspectObjectDlg::clickOnHideAll()
+{
+ myIsSelectAll = true;
+ onHeaderClicked(1);
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::DeactivateActiveDialog()
+{
+ setEnabled(false);
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ myGeomGUI->SetActiveDialogBox(0);
+ globalSelection();
+ erasePreview();
+}
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::ActivateThisDialog()
+{
+ /* Emit a signal to deactivate the active dialog */
+ myGeomGUI->EmitSignalDeactivateDialog();
+ setEnabled(true);
+ myGeomGUI->SetActiveDialogBox( (QDialog*)this );
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(onViewSelectionChanged()));
+
+ updateViewer(false);
+}
+
+//=================================================================================
+// function : onFilterToggled()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onFilterToggled(bool isOn)
+{
+ if (isOn) {
+ myCurrentTreeObjects = myFilteredTreeObjects;
+ myTreesLayout->setCurrentIndex(1);
+ } else {
+ myCurrentTreeObjects = myTreeObjects;
+ myTreesLayout->setCurrentIndex(0);
+ }
+
+ updateViewer(true);
+}
+
+//=================================================================================
+// function : updateViewer()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::updateViewer(const bool theIsHideOtherTree)
+{
+ GEOM_Displayer *aDisplayer = getDisplayer();
+
+ if (theIsHideOtherTree) {
+ QTreeWidget *aTreeToHide = myCurrentTreeObjects == myTreeObjects ?
+ myFilteredTreeObjects: myTreeObjects;
+
+ // Hide the objects of disappeared tree, do not switch off flags.
+ SALOME_ListIO aListOfIO;
+ QTreeWidgetItemIterator it(aTreeToHide);
+
+ while (*it) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
+ if ((anItem->flags() & Qt::ItemIsSelectable) &&
+ anItem->isVisible() && !anItem->isHidden()) {
+ aListOfIO.Append(anItem->getIO());
+ }
+
+ ++it;
+ }
+
+ aDisplayer->Erase(aListOfIO);
+ }
+
+ // Show the objects that are marked as shown in the appeared tree.
+ QTreeWidgetItemIterator it2(myCurrentTreeObjects);
+
+ while (*it2) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it2);
+ if ((anItem->flags() & Qt::ItemIsSelectable) &&
+ anItem->isVisible() && !anItem->isHidden()) {
+ displayItem(anItem);
+ }
+
+ ++it2;
+ }
+
+ aDisplayer->UpdateViewer();
+}
--- /dev/null
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 RepairGUI_InspectObjectDlg_H
+#define RepairGUI_InspectObjectDlg_H
+
+// GEOM includes
+#include <GEOMBase_Helper.h>
+
+// Qt includes
+#include <QDialog>
+#include <QPointer>
+#include <QIcon>
+
+class GeometryGUI;
+class SalomeApp_DoubleSpinBox;
+
+class QButtonGroup;
+class QComboBox;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QStackedLayout;
+class QTreeWidget;
+class QTreeWidgetItem;
+
+class TopTools_IndexedMapOfShape;
+
+class RepairGUI_InspectObjectDlg : public QDialog, public GEOMBase_Helper
+{
+ Q_OBJECT
+
+ class TreeWidgetItem;
+ class Delegate;
+
+public:
+ RepairGUI_InspectObjectDlg(GeometryGUI*, SUIT_Desktop* );
+ ~RepairGUI_InspectObjectDlg();
+
+private slots:
+ void onEditMainShape();
+
+ void onItemClicked( QTreeWidgetItem*, int );
+ void onItemChanged( QTreeWidgetItem*, int );
+ void onItemSelectionChanged();
+ void onItemExpanded( QTreeWidgetItem* );
+ void onHeaderClicked( int );
+
+ void onViewSelectionChanged();
+
+ void onWindowActivated( SUIT_ViewWindow* );
+ void onCloseView( SUIT_ViewWindow* );
+
+ void clickOnShow();
+ void clickOnShowOnly();
+ void clickOnHide();
+ void clickOnPublish();
+ void clickOnHelp();
+ void clickOnResetToMin();
+ void clickOnResetToMax();
+ void clickOnShowAll();
+ void clickOnHideAll();
+ void DeactivateActiveDialog();
+ void ActivateThisDialog();
+ void onFilterToggled(bool);
+ void onInitFilteredData();
+ void onFilterData();
+
+private:
+ void createTreeWidget(QTreeWidget *&theTreeObjects);
+ void init();
+ void initSpinBox(SalomeApp_DoubleSpinBox* spinBox,
+ double min, double max,
+ double step, const char* quantity);
+ void initTreeWidget(QTreeWidget *theTopLevelItem);
+ void enterEvent( QEvent* );
+ void checkVisibleIcon();
+ void addSubObjects( TreeWidgetItem*, const TopTools_IndexedMapOfShape &);
+
+ void displayItem( TreeWidgetItem* );
+ void setItemDisplayStatus( TreeWidgetItem* theItem, bool theIsVisible );
+ void setMainObjectTransparency( double );
+ void restoreParam();
+ void updateViewer(const bool theIsHideOtherTree);
+
+ QPointer<SUIT_ViewWindow> myViewWindow;
+ GeometryGUI* myGeomGUI;
+
+ QIcon myVisible;
+ QIcon myInvisible;
+
+ QTreeWidget *myTreeObjects;
+ QTreeWidget *myFilteredTreeObjects;
+ QTreeWidget *myCurrentTreeObjects;
+ QLineEdit *myEditMainShape;
+ QGroupBox *myTolFilterGrp;
+ QButtonGroup *myShapeTypeBtnGrp;
+ QComboBox *myComparisonCompo;
+ SalomeApp_DoubleSpinBox *myTolEdit;
+ QLabel *myMinTolValLabel;
+ QLabel *myMaxTolValLabel;
+ QStackedLayout *myTreesLayout;
+ QPushButton *myMinTolResetBtn;
+ QPushButton *myMaxTolResetBtn;
+ double myMaxTol;
+ double myMinTol;
+ bool myIsSelectAll;
+ double myTransparency;
+
+};
+
+#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "RepairGUI_LimitToleranceDlg.h"
-#include <DlgRef.h>
-#include <GeometryGUI.h>
-#include <GEOMBase.h>
-#include <SalomeApp_DoubleSpinBox.h>
+#include "DlgRef.h"
+#include "GeometryGUI.h"
+#include "GEOMBase.h"
+#include "RepairGUI.h"
+#include <SalomeApp_DoubleSpinBox.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Study.h>
#include <SUIT_ViewManager.h>
#include <OCCViewer_ViewModel.h>
#include <SALOME_ListIO.hxx>
+#include "utilities.h"
#include <GEOMImpl_Types.hxx>
QStringList aParameters;
aParameters << myTolEdt->text();
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+ if ( !IsPreview() )
+ RepairGUI::ShowStatistics( anOper, this );
objects.push_back(anObj._retn());
}
bool aLocked = aStudy->GetProperties()->IsLocked();
if (aLocked) {
- MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
SUIT_MessageBox::warning(this, tr("WRN_WARNING"), tr("WRN_STUDY_LOCKED"), tr("BUT_OK"));
return false;
}
mainFrame()->CheckBoxAddPrefix->isChecked());
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_LimitToleranceDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myObject);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
mainFrame()->CheckBoxAddPrefix->isChecked() );
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_RemoveExtraEdgesDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myObject);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
#include "RepairGUI_RemoveHolesDlg.h"
-#include <DlgRef.h>
-#include <GeometryGUI.h>
-#include <GEOMBase.h>
+#include "DlgRef.h"
+#include "GeometryGUI.h"
+#include "GEOMBase.h"
+#include "RepairGUI.h"
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
// highlight them (add to objects), display message dialog
GEOM::ListOfGO_var aClosed, anOpen;
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length(1);
+ objList[0] = myObject;
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
- aResult = anOper->GetFreeBoundary(myObject, aClosed, anOpen);
+ aResult = anOper->GetFreeBoundary(objList, aClosed, anOpen);
if (aResult) {
myClosed = aClosed->length();
GEOM::GEOM_Object_var anObj = anOper->FillHoles(myObject, myWiresInd);
aResult = !anObj->_is_nil();
if (aResult)
+ {
+ if ( !IsPreview() )
+ RepairGUI::ShowStatistics( anOper, this );
objects.push_back(anObj._retn());
+ }
}
return aResult;
msg = tr("GEOM_FREE_BOUNDS_ERROR");
SUIT_MessageBox::information(this, tr("GEOM_FREE_BOUNDS_TLT"), msg);
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_RemoveHolesDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myObject);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
#include "RepairGUI_RemoveIntWiresDlg.h"
-#include <DlgRef.h>
-#include <GeometryGUI.h>
-#include <GEOMBase.h>
+#include "DlgRef.h"
+#include "GeometryGUI.h"
+#include "GEOMBase.h"
+#include "RepairGUI.h"
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
bool aResult = !anObj->_is_nil();
if (aResult)
+ {
+ if ( !IsPreview() )
+ RepairGUI::ShowStatistics( anOper, this );
objects.push_back(anObj._retn());
-
+ }
return aResult;
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_RemoveIntWiresDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myObject);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
GroupPoints = new DlgRef_1Sel( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_REMOVE_WEBS" ) );
- GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
+ GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPES" ) );
GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true );
initName();
myEditCurrentArgument->setText("");
- myObject = GEOM::GEOM_Object::_nil();
+ myObjects.clear();
myOkObject = false;
void RepairGUI_RemoveWebsDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText( "" );
- QString aName;
-
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
-
- if (myEditCurrentArgument == GroupPoints->LineEdit1) {
- if (aSelList.Extent() != 1) {
- if (myEditCurrentArgument == GroupPoints->LineEdit1)
- myOkObject = false;
- return;
- }
- }
-
- // nbSel == 1
- GEOM::GEOM_Object_ptr aSelectedObject =
- GEOMBase::ConvertIOinGEOMObject(aSelList.First());
+ myObjects.clear();
+ myOkObject = false;
- if (CORBA::is_nil(aSelectedObject))
- return;
+ myObjects = getSelected( TopAbs_SHAPE, -1 );
- if (myEditCurrentArgument == GroupPoints->LineEdit1) {
- myObject = aSelectedObject;
+ if ( !myObjects.isEmpty() ) {
+ QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
myOkObject = true;
+ myEditCurrentArgument->setText( aName );
}
-
- myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
}
//=================================================================================
void RepairGUI_RemoveWebsDlg::activateSelection()
{
TColStd_MapOfInteger aTypes;
- //aTypes.Add( GEOM_SOLID );
+ aTypes.Add( GEOM_SOLID );
aTypes.Add( GEOM_COMPOUND );
globalSelection( aTypes );
}
//=================================================================================
bool RepairGUI_RemoveWebsDlg::execute (ObjectList& objects)
{
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length( myObjects.count() );
+ for ( int i = 0; i < myObjects.count(); ++i )
+ objList[i] = myObjects[i].copy();
+
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
- GEOM::GEOM_Object_var anObj = anOper->RemoveInternalFaces(myObject);
+ GEOM::GEOM_Object_var anObj = anOper->RemoveInternalFaces(objList);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
mainFrame()->CheckBoxAddPrefix->isChecked());
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_RemoveWebsDlg::getSourceObjects()
+{
+ return myObjects;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
void activateSelection();
private:
- GEOM::GEOM_Object_var myObject;
+ QList<GEOM::GeomObjPtr> myObjects;
bool myOkObject;
DlgRef_1Sel* GroupPoints;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
GroupPoints = new DlgRef_1SelExt( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_SEWING" ) );
- GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
+ GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPES" ) );
GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true );
/* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1;
- myObject = GEOM::GEOM_Object::_nil();
+ myObjects.clear();
//myGeomGUI->SetState( 0 );
initSelection();
initName();
GroupPoints->LineEdit1->setText( "" );
- myObject = GEOM::GEOM_Object::_nil();
+ myObjects.clear();
initSelection();
{
erasePreview();
myEditCurrentArgument->setText( "" );
- myObject = GEOM::GEOM_Object::_nil();
+ myObjects.clear();
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
+ myObjects = getSelected( TopAbs_SHAPE, -1 );
- if ( aSelList.Extent() == 1 ) {
- Handle(SALOME_InteractiveObject) anIO = aSelList.First();
- myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
- if ( !CORBA::is_nil( myObject ) )
- myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
+ if ( !myObjects.isEmpty() ) {
+ QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
+ myEditCurrentArgument->setText( aName );
}
}
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
GroupPoints->LineEdit1->setText( "" );
- myObject = GEOM::GEOM_Object::_nil();
+ myObjects.clear();
myClosed = -1;
myOpen = -1;
{
myClosed = -1;
bool ok = myTolEdt->isValid( msg, !IsPreview() );
- return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. ) && ok;
+ return !myObjects.isEmpty() && ( IsPreview() || myTolEdt->value() > 0. ) && ok;
}
//=================================================================================
bool aResult = false;
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length( myObjects.count() );
+ for ( int i = 0; i < myObjects.count(); ++i )
+ objList[i] = myObjects[i].copy();
+
if ( IsPreview() ) { // called from onDetect(): detect free boundary edges, highlight them (add to objects), display message dialog
GEOM::ListOfGO_var aClosed, anOpen;
- aResult = anOper->GetFreeBoundary( myObject, aClosed, anOpen );
+ aResult = anOper->GetFreeBoundary( objList, aClosed, anOpen );
if ( aResult ) {
myClosed = aClosed->length();
GEOM::GEOM_Object_var anObj;
if (myAllowNonManifoldChk->isChecked()) {
- anObj = anOper->SewAllowNonManifold( myObject, myTolEdt->value() );
+ anObj = anOper->SewAllowNonManifold( objList, myTolEdt->value() );
} else {
- anObj = anOper->Sew( myObject, myTolEdt->value() );
+ anObj = anOper->Sew( objList, myTolEdt->value() );
}
aResult = !anObj->_is_nil();
void RepairGUI_SewingDlg::initSelection()
{
TColStd_MapOfInteger aTypes;
+ aTypes.Add( GEOM_FACE );
aTypes.Add( GEOM_SHELL );
aTypes.Add( GEOM_SOLID );
aTypes.Add( GEOM_COMPOUND );
msg = tr( "GEOM_FREE_BOUNDS_ERROR" );
SUIT_MessageBox::information( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg );
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_SewingDlg::getSourceObjects()
+{
+ return myObjects;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
{
Q_OBJECT
-public:
+ public:
RepairGUI_SewingDlg( GeometryGUI*, QWidget* = 0, bool = false );
~RepairGUI_SewingDlg();
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
-
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
+
private:
void Init();
void enterEvent( QEvent* );
void initSelection();
private:
- GEOM::GEOM_Object_var myObject;
+ QList<GEOM::GeomObjPtr> myObjects;
DlgRef_1SelExt* GroupPoints;
QCheckBox* myAllowNonManifoldChk;
SalomeApp_DoubleSpinBox* myTolEdt;
QPushButton* myFreeBoundBtn;
-
+
int myClosed; // Number of free closed boundaries detected. Calculated in execute(), used in onDetect().
int myOpen; // Number of free open boundaries detected. Calculated in execute(), used in onDetect().
-
+
private slots:
void ClickOnOk();
bool ClickOnApply();
-
+
void ActivateThisDialog();
-
+
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
-
+
void onDetect();
};
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "RepairGUI_ShapeProcessDlg.h"
-#include <DlgRef.h>
-#include <GeometryGUI.h>
-#include <GEOMBase.h>
-#include <GEOMImpl_Types.hxx>
+#include "DlgRef.h"
+#include "GeometryGUI.h"
+#include "GEOMBase.h"
+#include "GEOMImpl_Types.hxx"
+#include "RepairGUI.h"
#include <SalomeApp_Application.h>
#include <SalomeApp_DoubleSpinBox.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_MessageBox.h>
#include <SALOME_ListIO.hxx>
+#include "utilities.h"
#include <Basics_Utils.hxx>
+#include "utilities.h"
#include <TCollection_AsciiString.hxx>
#include <TColStd_MapOfInteger.hxx>
initParamsValues();
initSelection();
- setWindowTitle( tr( "GEOM_SHAPEPROCESS_TITLE" ) );
+ setWindowTitle( tr( "GEOM_SHAPEPROCESS_TITLE" ));
mainFrame()->GroupConstructors->hide();
// select widget on the top
mySelectWdgt = new DlgRef_1Sel( centralWidget() );
- mySelectWdgt->GroupBox1->setTitle( tr( "GEOM_SHAPE" ) );
- mySelectWdgt->TextLabel1->setText( tr( "GEOM_SELECTED_OBJECTS" ) );
- mySelectWdgt->PushButton1->setIcon( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ mySelectWdgt->GroupBox1->setTitle( tr( "GEOM_SHAPE" ));
+ mySelectWdgt->TextLabel1->setText( tr( "GEOM_SELECTED_OBJECTS" ));
+ mySelectWdgt->PushButton1->setIcon( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" )));
mySelectWdgt->LineEdit1->setReadOnly( true );
// layout the two group boxes in the middle, add a list of operations
QGroupBox* anOperGr = new QGroupBox( tr( "GEOM_OPERATIONS" ), centralWidget() );
+ // "select all" button
+ mySelectAll = new QCheckBox( tr( "SELECT_ALL" ), anOperGr );
+ mySelectAll->setTristate( true );
+
// operations list widget
myOpList = new QListWidget( anOperGr );
myOpList->setSortingEnabled( false );
- myOpList->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
+ myOpList->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ));
QVBoxLayout* aOperLay = new QVBoxLayout( anOperGr );
aOperLay->setMargin( 9 );
+ aOperLay->addWidget( mySelectAll );
aOperLay->addWidget( myOpList );
QGroupBox* aParamsGr = new QGroupBox( tr( "GEOM_PARAMETERS" ), centralWidget() );
// add a widget stack to the parameters group box
- QStackedLayout* aStack = new QStackedLayout( aParamsGr );
+ myStack = new QStackedLayout( aParamsGr );
// continueties values..
QStringList aContinueties = QString( "C0,G1,C1,G2,C2,C3,CN" ).split( "," );
aLay->addWidget( myFixFaceSizeTol, 0, 1 );
aLay->setRowStretch( aLay->rowCount(), 5 );
}
+ else if ( myOpLst[i] == "DropSmallSolids" ) {
+ // DropSmallSolids
+ w = new QWidget( aParamsGr );
+ QGridLayout* aLay = new QGridLayout( w );
+ aLay->setMargin( 9 ); aLay->setSpacing( 6 );
+
+ myDropSmallSolidsWidChk = new QCheckBox( tr("WIDTH_FACTOR_TOL"), w );
+ myDropSmallSolidsVolChk = new QCheckBox( tr("VOLUME_TOL"), w );
+ myDropSmallSolidsWidTol = new SalomeApp_DoubleSpinBox( w );
+ myDropSmallSolidsVolTol = new SalomeApp_DoubleSpinBox( w );
+ initSpinBox( myDropSmallSolidsWidTol, 0., 1e3, 1., "len_tol_precision" );
+ initSpinBox( myDropSmallSolidsVolTol, 0., 1e9, 1., "len_tol_precision" );
+ myDropSmallSolidsWidTol->setValue( 1 );
+ myDropSmallSolidsVolTol->setValue( 1e3 );
+ myDropSmallSolidsVolChk->setChecked( true );
+ myDropSmallSolidsWidTol->setEnabled( false );
+ myDropSmallSolidsMergeChk = new QCheckBox( tr("TO_MERGE_SOLIDS"), w );
+
+ aLay->addWidget( myDropSmallSolidsWidChk, 0, 0 );
+ aLay->addWidget( myDropSmallSolidsWidTol, 0, 1 );
+ aLay->addWidget( myDropSmallSolidsVolChk, 1, 0 );
+ aLay->addWidget( myDropSmallSolidsVolTol, 1, 1 );
+ aLay->addWidget( myDropSmallSolidsMergeChk, 2, 0, 1, 2 );
+
+ aLay->setRowStretch( aLay->rowCount(), 5 );
+ }
else if ( myOpLst[i] == "DropSmallEdges" ) {
// DropSmallEdges
w = new QWidget( aParamsGr );
myBSplineDegree = new SalomeApp_IntSpinBox( w );
myBSplineSegments = new SalomeApp_IntSpinBox( w );
+ initSpinBox( myBSplineSegments, 1, 1000, 1);
myBSpline2DCont = new QComboBox( w );
myBSpline2DCont->addItems( aContinueties );
myBSpline3DCont = new QComboBox( w );
else {
w = new QWidget( aParamsGr ); // dumb widget
}
- aStack->insertWidget( i, w );
+ myStack->insertWidget( i, w );
}
QGridLayout* layout = new QGridLayout( centralWidget() );
layout->addWidget( aParamsGr, 1, 1 );
// signals and slots connections
- connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( onOk() ) );
- connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( onApply() ) );
+ connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( onOk() ));
+ connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( onApply() ));
- connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) );
+ connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ))->selectionMgr(),
+ SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ));
- connect( mySelectWdgt->PushButton1, SIGNAL( clicked() ), this, SLOT( selectClicked() ) );
- connect( mySelectWdgt->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( lineEditReturnPressed() ) );
+ connect( mySelectWdgt->PushButton1, SIGNAL( clicked() ), this, SLOT( selectClicked() ));
+ connect( mySelectWdgt->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( lineEditReturnPressed() ));
- connect( myToBezierSurfModeChk, SIGNAL( toggled( bool ) ), this, SLOT( advOptionToggled( bool ) ) );
+ connect( myToBezierSurfModeChk, SIGNAL( toggled( bool )), this, SLOT( advOptionToggled( bool )));
+ connect( myDropSmallSolidsWidChk, SIGNAL( toggled( bool )), this, SLOT( advOptionToggled( bool )));
+ connect( myDropSmallSolidsVolChk, SIGNAL( toggled( bool )), this, SLOT( advOptionToggled( bool )));
- connect( myOpList, SIGNAL( currentRowChanged( int ) ), aStack, SLOT( setCurrentIndex( int ) ) );
+ connect( myOpList, SIGNAL( currentRowChanged( int )), myStack, SLOT( setCurrentIndex( int )));
+ connect( myOpList, SIGNAL( itemChanged( QListWidgetItem* )), this, SLOT( operatorChecked( QListWidgetItem* )));
+ connect( mySelectAll, SIGNAL( stateChanged( int ) ), this, SLOT( onSelectAll( int )));
adjustSize();
loadDefaults(); // init dialog fields with values from resource file
//myOpList->setCurrentRow( myOpList->findItem( 0 );
reset();
- initName( tr( "PROCESS_SHAPE_NEW_OBJ_NAME" ) );
+ myOpList->setCurrentRow(0);
+
+ initName( tr( "PROCESS_SHAPE_NEW_OBJ_NAME" ));
selectionChanged();
+ updateSelectAll();
}
//=================================================================================
myObjects->length(aSelList.Extent());
for (SALOME_ListIteratorOfListIO anIt (aSelList); anIt.More(); anIt.Next()) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value() );
- if ( !CORBA::is_nil( aSelectedObject ) )
+ if ( !CORBA::is_nil( aSelectedObject ))
myObjects[i++] = aSelectedObject;
}
myObjects->length( i );
if ( i == 1 )
- mySelectWdgt->LineEdit1->setText( GEOMBase::GetName( myObjects[0] ) );
+ mySelectWdgt->LineEdit1->setText( GEOMBase::GetName( myObjects[0] ));
else if ( i > 0 )
- mySelectWdgt->LineEdit1->setText( QString::number( i ) + "_" + tr( "GEOM_OBJECTS" ) );
+ mySelectWdgt->LineEdit1->setText( QString::number( i ) + "_" + tr( "GEOM_OBJECTS" ));
}
void RepairGUI_ShapeProcessDlg::activate()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication( ) ))->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) );
+ connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication( )))->selectionMgr(),
+ SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ));
reset();
//myGeomGUI->SetState( 0 );
//=================================================================================
const char* get_convert( const char* theParam, const QString& theValue )
{
- if ( !strcmp( theParam, "SplitAngle.Angle" ) ) {
+ if ( !strcmp( theParam, "SplitAngle.Angle" )) {
double doubleValue = theValue.toDouble() * M_PI / 180.;
return CORBA::string_dup( QString::number( doubleValue ).toLatin1().constData() );
}
//=================================================================================
QString set_convert( const char* theParam, const char* theValue )
{
- if ( !strcmp( theParam, "SplitAngle.Angle" ) ) {
+ if ( !strcmp( theParam, "SplitAngle.Angle" )) {
Kernel_Utils::Localizer loc;
double doubleValue = atof( theValue ) * 180. / M_PI;
return QString::number( doubleValue );
for ( int j = 0; j < aParams->length(); j++ ) {
QWidget* aCtrl = getControl( (const char*)aParams[j] );
- setValue( aCtrl, set_convert( (const char*)aParams[j], aValues[j] ) );
+ setValue( aCtrl, set_convert( (const char*)aParams[j], aValues[j] ));
}
}
}
void RepairGUI_ShapeProcessDlg::setValue( QWidget* theControl, const QString& theValue )
{
if ( theControl && !theValue.isNull() ) {
- if ( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl ) )
+ if ( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl ))
qobject_cast<SalomeApp_DoubleSpinBox*>( theControl )->setValue( theValue.toDouble() );
- else if ( qobject_cast<SalomeApp_IntSpinBox*>( theControl ) )
+ else if ( qobject_cast<SalomeApp_IntSpinBox*>( theControl ))
qobject_cast<SalomeApp_IntSpinBox*>( theControl )->setValue( theValue.toInt() );
- else if ( qobject_cast<QComboBox*>( theControl ) )
+ else if ( qobject_cast<QComboBox*>( theControl ))
qobject_cast<QComboBox*>( theControl )->setEditText( theValue );
- else if ( qobject_cast<QCheckBox*>( theControl ) )
+ else if ( qobject_cast<QCheckBox*>( theControl ))
qobject_cast<QCheckBox*>( theControl )->setChecked( theValue.toInt() != 0 );
}
}
QString RepairGUI_ShapeProcessDlg::getValue( QWidget* theControl ) const
{
if ( theControl ) {
- if ( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl ) )
+ if ( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl )) {
+ if ( ( theControl == myDropSmallSolidsWidTol || theControl == myDropSmallSolidsVolTol ) && !theControl->isEnabled() ) {
+ // VSR: stupid workaround about ShapeProcessAPI:
+ // specific processing for optional parameters of DropSmallSolids operator
+ return QString::number( Precision::Infinite() );
+ }
return QString::number( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl )->value() );
- else if ( qobject_cast<SalomeApp_IntSpinBox*>( theControl ) )
+ }
+ else if ( qobject_cast<SalomeApp_IntSpinBox*>( theControl )) {
return QString::number( qobject_cast<SalomeApp_IntSpinBox*>( theControl )->value() );
- else if ( qobject_cast<QComboBox*>( theControl ) )
+ }
+ else if ( qobject_cast<QComboBox*>( theControl )) {
return qobject_cast<QComboBox*>( theControl )->currentText();
- else if ( qobject_cast<QCheckBox*>( theControl ) )
+ }
+ else if ( qobject_cast<QCheckBox*>( theControl )) {
return qobject_cast<QCheckBox*>( theControl )->isChecked() ? "1" : "0";
+ }
}
return 0;
}
QString RepairGUI_ShapeProcessDlg::getText( QWidget* theControl ) const
{
if ( theControl ) {
- if ( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl ) )
+ if ( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl ))
return qobject_cast<SalomeApp_DoubleSpinBox*>( theControl )->text();
- else if ( qobject_cast<SalomeApp_IntSpinBox*>( theControl ) )
+ else if ( qobject_cast<SalomeApp_IntSpinBox*>( theControl ))
return qobject_cast<SalomeApp_IntSpinBox*>( theControl )->text();
}
return QString::null;
while( aListIter.hasNext() ) {
const QString& aParam = aListIter.next();
QWidget* aControl = getControl( aParam );
- if ( qobject_cast<SalomeApp_DoubleSpinBox*>( aControl ) )
+ if ( !aControl->isEnabled() ) continue;
+ if ( qobject_cast<SalomeApp_DoubleSpinBox*>( aControl ))
ok = qobject_cast<SalomeApp_DoubleSpinBox*>( aControl )->isValid( msg, !IsPreview() ) && ok;
- else if ( qobject_cast<SalomeApp_IntSpinBox*>( aControl ) )
+ else if ( qobject_cast<SalomeApp_IntSpinBox*>( aControl ))
ok = qobject_cast<SalomeApp_IntSpinBox*>( aControl )->isValid( msg, !IsPreview() ) && ok;
}
}
aParameters << getTexts( aParams );
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+
+ RepairGUI::ShowStatistics( anOper, this );
}
objects.push_back( anObj._retn() );
}
GEOM::string_array* RepairGUI_ShapeProcessDlg::getActiveOperators()
{
GEOM::string_array_var anOperators = new GEOM::string_array();
- QStringList aCheckedList;
- for ( int i = 0; i < myOpList->count(); i++ ) {
+ int j = 0, n = myOpList->count();
+ anOperators->length( n );
+ for ( int i = 0; i < n; i++ ) {
if ( myOpList->item( i )->checkState() == Qt::Checked )
- aCheckedList << myOpList->item( i )->text();
+ anOperators[j++] = myOpList->item( i )->text().toLatin1().constData();
}
-
- anOperators->length( aCheckedList.count() );
-
- for ( int i = 0; i < aCheckedList.count(); i++ )
- anOperators[i] = aCheckedList[i].toLatin1().constData();
+ anOperators->length( j );
return anOperators._retn();
}
else if ( theParam == "SplitClosedFaces.NbSplitPoints" ) return mySplitClosedFacesNum;
else if ( theParam == "FixFaceSize.Tolerance" ) return myFixFaceSizeTol;
else if ( theParam == "DropSmallEdges.Tolerance3d" ) return myDropSmallEdgesTol3D;
+ else if ( theParam == "DropSmallSolids.WidthFactorThreshold" ) return myDropSmallSolidsWidTol;
+ else if ( theParam == "DropSmallSolids.VolumeThreshold" ) return myDropSmallSolidsVolTol;
+ else if ( theParam == "DropSmallSolids.MergeSolids" ) return myDropSmallSolidsMergeChk;
else if ( theParam == "BSplineRestriction.SurfaceMode" ) return myBSplineSurfModeChk;
else if ( theParam == "BSplineRestriction.Curve3dMode" ) return myBSpline3DCurveChk;
else if ( theParam == "BSplineRestriction.Curve2dMode" ) return myBSpline2DCurveChk;
myOpLst << "DropSmallEdges";
myValMap["DropSmallEdges"] << "DropSmallEdges.Tolerance3d";
+ myOpLst << "DropSmallSolids";
+ myValMap["DropSmallSolids"] << "DropSmallSolids.WidthFactorThreshold";
+ myValMap["DropSmallSolids"] << "DropSmallSolids.VolumeThreshold";
+ myValMap["DropSmallSolids"] << "DropSmallSolids.MergeSolids";
+
myOpLst << "SplitAngle";
myValMap["SplitAngle"] << "SplitAngle.Angle";
myValMap["SplitAngle"] << "SplitAngle.MaxTolerance";
// calculate the length of parameters
for ( i = 0, j = 0; i < theOperators.length(); i++ )
- j += myValMap[ QString( theOperators[i] ) ].size();
+ j += myValMap[ QString( theOperators[i].in() ) ].size();
// set the new length of paremeters
aParams->length( j );
// fill the parameters
for ( i = 0, j = 0; i < theOperators.length(); i++ ) {
- QStringList aValLst = myValMap[ QString( theOperators[i] ) ];
- for ( QStringList::Iterator it = aValLst.begin(); it != aValLst.end(); ++it )
- aParams[j++] = CORBA::string_dup( (*it).toLatin1().constData() );
+ QStringList aParamLst = myValMap[ QString( theOperators[i].in() ) ];
+ foreach ( QString aParam, aParamLst ) {
+ aParams[j++] = CORBA::string_dup( aParam.toLatin1().constData() );
+ }
}
+ aParams->length( j );
+
return aParams._retn();
}
{
GEOM::string_array_var aValues = new GEOM::string_array();
aValues->length( theParams.length() );
-
+
for ( int i = 0; i < theParams.length(); i++ ) {
QWidget* aCtrl = getControl( (const char*)theParams[i] );
if ( aCtrl )
- aValues[i] = get_convert( (const char*)theParams[i], getValue( aCtrl ) );
+ aValues[i] = get_convert( (const char*)theParams[i], getValue( aCtrl ));
}
-
+
return aValues._retn();
}
void RepairGUI_ShapeProcessDlg::advOptionToggled( bool on )
{
QAbstractButton* btn = (QAbstractButton*)sender();
- if ( on && btn->isCheckable() &&
- SUIT_MessageBox::warning( this,
- tr( "GEOM_WRN_WARNING" ), tr( "TIME_CONSUMING" ),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No ) == SUIT_MessageBox::No )
- btn->toggle();
+ if ( btn == myToBezierSurfModeChk )
+ {
+ if ( on && btn->isCheckable() &&
+ SUIT_MessageBox::warning( this,
+ tr( "GEOM_WRN_WARNING" ), tr( "TIME_CONSUMING" ),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No ) == SUIT_MessageBox::No )
+ btn->toggle();
+ }
+
+ // either myDropSmallSolidsWidChk or myDropSmallSolidsVolChk must be checked
+ if ( btn == myDropSmallSolidsWidChk )
+ {
+ myDropSmallSolidsWidTol->setEnabled( on );
+ if ( !on ) {
+ myDropSmallSolidsVolChk->setChecked( true );
+ myDropSmallSolidsVolTol->setEnabled( true );
+ }
+ }
+ if ( btn == myDropSmallSolidsVolChk )
+ {
+ myDropSmallSolidsVolTol->setEnabled( on );
+ if ( !on ) {
+ myDropSmallSolidsWidChk->setChecked( true );
+ myDropSmallSolidsWidTol->setEnabled( true );
+ }
+ }
+}
+
+//=======================================================================
+//function : operatorChecked
+//purpose : show parameters of a selected operator
+//=======================================================================
+
+void RepairGUI_ShapeProcessDlg::operatorChecked( QListWidgetItem * item )
+{
+ if ( item && item->checkState() == Qt::Checked )
+ {
+ item->setSelected(true);
+ myStack->setCurrentIndex( myOpList->row( item ));
+ }
+ updateSelectAll();
+}
+
+void RepairGUI_ShapeProcessDlg::updateSelectAll()
+{
+ Qt::CheckState state = myOpList->count() > 0 ? myOpList->item(0)->checkState() : Qt::Unchecked;
+ for ( int i = 1; i < myOpList->count(); i++ ) {
+ if ( myOpList->item(i)->checkState() != state ) {
+ state = Qt::PartiallyChecked;
+ break;
+ }
+ }
+ mySelectAll->blockSignals( true );
+ mySelectAll->setCheckState( state );
+ mySelectAll->blockSignals( false );
+}
+
+void RepairGUI_ShapeProcessDlg::onSelectAll( int state )
+{
+ if ( state == Qt::PartiallyChecked ) {
+ mySelectAll->setCheckState( Qt::Checked );
+ return;
+ }
+ myOpList->blockSignals( true );
+ for ( int i = 0; i < myOpList->count(); i++ ) {
+ myOpList->item(i)->setCheckState( (Qt::CheckState)state );
+ }
+ myOpList->blockSignals( false );
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_ShapeProcessDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::ListOfGO aListPtr(myObjects);
+ for (int i = 0; i < aListPtr.length(); i++) {
+ GEOM::GeomObjPtr aGeomObjPtr(aListPtr[i]);
+ res << aGeomObjPtr;
+ }
+ return res;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
class DlgRef_1Sel;
class SalomeApp_IntSpinBox;
class SalomeApp_DoubleSpinBox;
-class QComboBox;
class QCheckBox;
+class QComboBox;
class QListWidget;
+class QListWidgetItem;
+class QStackedLayout;
//=================================================================================
// class : RepairGUI_ShapeProcessDlg
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void init();
//QDict<QString,QWidget*> myCtrlMap; // map of controls (values) of parameters
void initParamsValues(); // initialize the data structures
void initSelection();
+ void updateSelectAll();
private:
QStringList myOpLst; // list of available Shape Healing Operators
GEOM::ListOfGO_var myObjects; // selected objects
DlgRef_1Sel* mySelectWdgt;
+ QCheckBox* mySelectAll;
QListWidget* myOpList;
+ QStackedLayout* myStack;
SalomeApp_DoubleSpinBox* myFixShapeTol3D;
SalomeApp_DoubleSpinBox* myFixShapeMaxTol3D;
SalomeApp_DoubleSpinBox* myToBezierMaxTol;
SalomeApp_DoubleSpinBox* mySameParameterTol3D;
-
+
+ QCheckBox* myDropSmallSolidsWidChk;
+ QCheckBox* myDropSmallSolidsVolChk;
+ SalomeApp_DoubleSpinBox* myDropSmallSolidsWidTol;
+ SalomeApp_DoubleSpinBox* myDropSmallSolidsVolTol;
+ QCheckBox* myDropSmallSolidsMergeChk;
+
private slots:
void onOk();
bool onApply();
void selectionChanged();
void selectClicked();
void advOptionToggled( bool );
-};
+ void operatorChecked( QListWidgetItem * item );
+ void onSelectAll( int );
+};
#endif // REPAIRGUI_SHAPEPROCESSDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "RepairGUI_SuppressFacesDlg.h"
-#include <DlgRef.h>
-#include <GeometryGUI.h>
-#include <GEOMBase.h>
+#include "DlgRef.h"
+#include "GeometryGUI.h"
+#include "GEOMBase.h"
+#include "RepairGUI.h"
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
bool aResult = !anObj->_is_nil();
if (aResult)
+ {
+ if ( !IsPreview() )
+ RepairGUI::ShowStatistics( anOper, this );
objects.push_back(anObj._retn());
-
+ }
return aResult;
}
mainFrame()->CheckBoxAddPrefix->isChecked());
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_SuppressFacesDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myObject);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
mainFrame()->CheckBoxAddPrefix->isChecked() );
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_UnionFacesDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr(myObject);
+ res << aGeomObjPtr;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <BRepBuilderAPI_MakeWire.hxx>
#include <ElSLib.hxx>
#include <GeomAPI_Interpolate.hxx>
+#include <TColgp_Array1OfVec.hxx>
#include <TColgp_HArray1OfPnt.hxx>
+#include <TColStd_HArray1OfBoolean.hxx>
#include <TopoDS_Wire.hxx>
const double POINT_CONFUSION_TOLERANCE = 0.0001;
}
//=======================================================================
-// function : MakeInterpolation
-// purpose :
+// function : constructBSpline
+// purpose : See function 'constructBSpline' in file 'CurveCreator_Utils.cxx'.
//=======================================================================
-TopoDS_Shape Sketcher_Utils::MakeInterpolation
- (const std::list <double> &theCoords2D,
- const Standard_Boolean IsClosed,
- const gp_Ax3 &thePlane)
+static bool constructBSpline(
+ const Handle(TColgp_HArray1OfPnt)& thePoints,
+ const Standard_Boolean theIsClosed,
+ Handle(Geom_BSplineCurve)& theBSpline)
{
- std::list <gp_Pnt> aPoints;
- TopoDS_Shape aResult;
-
- To3D(theCoords2D, thePlane, aPoints);
-
- Standard_Integer aNbPnts = aPoints.size();
-
- if (aNbPnts > 1) {
- if (IsClosed &&
- aPoints.front().IsEqual(aPoints.back(), POINT_CONFUSION_TOLERANCE)) {
- // The polyline should be closed, first and last points are confused.
- // Remove the last point.
- aPoints.pop_back();
- --aNbPnts;
- }
+ const int aPointCount = thePoints->Length();
+ if (aPointCount <= 1)
+ {
+ return false;
}
- if (aNbPnts == 1) {
- // The result is vertex.
- aResult = BRepBuilderAPI_MakeVertex(aPoints.front()).Vertex();
- } else if (aNbPnts > 1) {
- std::list <gp_Pnt>::const_iterator anIter = aPoints.begin();
- Handle(TColgp_HArray1OfPnt) aHCurvePoints =
- new TColgp_HArray1OfPnt(1, aNbPnts);
- Standard_Integer i;
-
- for (i = 1; anIter != aPoints.end(); ++anIter, ++i) {
- aHCurvePoints->SetValue(i, *anIter);
+ // Calculate the tangents.
+ TColgp_Array1OfVec aTangents(1, aPointCount);
+ Handle(TColStd_HArray1OfBoolean) aTangentFlags =
+ new TColStd_HArray1OfBoolean(1, aPointCount);
+ GeomAPI_Interpolate aInterpolator(thePoints, theIsClosed, 0);
+ if (aPointCount == 2)
+ {
+ aTangentFlags->SetValue(1, Standard_False);
+ aTangentFlags->SetValue(2, Standard_False);
+ }
+ else
+ {
+ for (Standard_Integer aPN = 1; aPN <= aPointCount; ++aPN)
+ {
+ gp_Vec aTangent;
+ if (aPN != 1 || theIsClosed)
+ {
+ const Standard_Integer aPN1 = (aPN != 1) ? (aPN - 1) : aPointCount;
+ aTangent = gp_Vec(thePoints->Value(aPN1),
+ thePoints->Value(aPN)).Normalized();
+ }
+ if (aPN < aPointCount || theIsClosed)
+ {
+ const Standard_Integer aPN2 = (aPN != aPointCount) ? (aPN + 1) : 1;
+ const gp_Vec aTangent2 = aTangent +
+ gp_Vec(thePoints->Value(aPN), thePoints->Value(aPN2)).Normalized();
+ if (aTangent2.SquareMagnitude() >= Precision::SquareConfusion())
+ {
+ aTangent = aTangent2.Normalized();
+ }
+ else
+ {
+ aTangent = -aTangent;
+ }
+ }
+ aTangents.SetValue(aPN, aTangent);
+ aTangentFlags->SetValue(aPN, Standard_True);
}
+ }
- // Compute BSpline
- Standard_Real aTol = Precision::Confusion();
- GeomAPI_Interpolate aGBC(aHCurvePoints, IsClosed, aTol);
+ // Interpolate.
+ aInterpolator.Load(aTangents, aTangentFlags, Standard_False);
+ aInterpolator.Perform();
+ const bool aResult = (aInterpolator.IsDone() == Standard_True);
+ if (aResult)
+ {
+ theBSpline = aInterpolator.Curve();
+ }
+ return aResult;
+}
- aGBC.Perform();
+//=======================================================================
+// function : MakeInterpolation
+// purpose :
+//=======================================================================
+TopoDS_Shape Sketcher_Utils::MakeInterpolation(
+ const std::list<double>& theCoords2D,
+ const Standard_Boolean theIsClosed,
+ const gp_Ax3& thePlane)
+{
+ if (theCoords2D.size() == 0)
+ {
+ return TopoDS_Shape();
+ }
- if (aGBC.IsDone()) {
- TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(aGBC.Curve()).Edge();
- aResult = BRepBuilderAPI_MakeWire(anEdge).Wire();
+ // Get the different points.
+ std::list<gp_Pnt> aTmpPoints;
+ To3D(theCoords2D, thePlane, aTmpPoints);
+ gp_Pnt aFirstPoint = aTmpPoints.front();
+ gp_Pnt aPoint = aFirstPoint;
+ std::list<gp_Pnt>::iterator aPIt = aTmpPoints.begin();
+ for (++aPIt; aPIt != aTmpPoints.end();)
+ {
+ const gp_Pnt aPoint2 = *aPIt;
+ if (!aPoint.IsEqual(aPoint2, POINT_CONFUSION_TOLERANCE))
+ {
+ aPoint = aPoint2;
+ ++aPIt;
+ }
+ else
+ {
+ aTmpPoints.erase(aPIt);
+ }
+ }
+ if (theIsClosed)
+ {
+ while (--aPIt != aTmpPoints.begin() &&
+ aFirstPoint.IsEqual(*aPIt, POINT_CONFUSION_TOLERANCE))
+ {
+ aTmpPoints.erase(aPIt);
}
}
- return aResult;
+ // Process the single point case.
+ const int aPointCount = aTmpPoints.size();
+ if (aPointCount == 1)
+ {
+ return BRepBuilderAPI_MakeVertex(aTmpPoints.front());
+ }
+
+ // Process the other cases.
+ Handle(TColgp_HArray1OfPnt) aPoints =
+ new TColgp_HArray1OfPnt(1, aPointCount);
+ aPIt = aTmpPoints.begin();
+ for (Standard_Integer aPN = 1; aPIt != aTmpPoints.end(); ++aPIt, ++aPN)
+ {
+ aPoints->SetValue(aPN, *aPIt);
+ }
+ Handle(Geom_BSplineCurve) aBSpline;
+ if (constructBSpline(aPoints, theIsClosed, aBSpline))
+ {
+ return BRepBuilderAPI_MakeWire(BRepBuilderAPI_MakeEdge(aBSpline));
+ }
+ return TopoDS_Shape();
}
//=======================================================================
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
STEPPlugin_IExport.hxx
STEPPlugin_IImport.hxx
STEPPlugin_ImportDriver.hxx
+ STEPPlugin_ExportDlg.h
STEPPlugin_ExportDriver.hxx
STEPPlugin_IECallBack.hxx
)
# header files / to be processed by moc
SET(_moc_HEADERS
STEPPlugin_GUI.h
+ STEPPlugin_ExportDlg.h
)
ENDIF()
SET(STEPPluginGUI_SOURCES
STEPPlugin_GUI.cxx
+ STEPPlugin_ExportDlg.cxx
${_moc_SOURCES}
)
ENDIF()
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
--- /dev/null
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 "STEPPlugin_ExportDlg.h"
+
+#include <QApplication>
+#include <QLabel>
+#include <QLayout>
+#include <QComboBox>
+
+//=============================================================================
+// Constructor
+//=============================================================================
+STEPPlugin_ExportDlg::STEPPlugin_ExportDlg(QWidget *parent)
+ : SUIT_FileDlg (parent, false, true, true),
+ myUnitCB (0)
+{
+ QLabel* aUnitLabel = new QLabel(tr("STEP_LENGTH_UNITS"), this);
+
+ myUnitCB = new QComboBox(this);
+ myUnitCB->addItem(tr("STEP_UNITS_KILOMETER"), GEOM::LU_KILOMETER);
+ myUnitCB->addItem(tr("STEP_UNITS_METER"), GEOM::LU_METER);
+ myUnitCB->addItem(tr("STEP_UNITS_CENTIMETER"), GEOM::LU_CENTIMETER);
+ myUnitCB->addItem(tr("STEP_UNITS_MILLIMETER"), GEOM::LU_MILLIMETER);
+ myUnitCB->addItem(tr("STEP_UNITS_MICROMETER"), GEOM::LU_MICROMETER);
+ myUnitCB->addItem(tr("STEP_UNITS_MILE"), GEOM::LU_MILE);
+ myUnitCB->addItem(tr("STEP_UNITS_FOOT"), GEOM::LU_FOOT);
+ myUnitCB->addItem(tr("STEP_UNITS_INCH"), GEOM::LU_INCH);
+ myUnitCB->addItem(tr("STEP_UNITS_MILLIINCH"), GEOM::LU_MILLIINCH);
+ myUnitCB->addItem(tr("STEP_UNITS_MICROINCH"), GEOM::LU_MICROINCH);
+
+ // Meters by default.
+ myUnitCB->setCurrentIndex(1);
+
+ layout()->addWidget(aUnitLabel);
+ layout()->addWidget(myUnitCB);
+}
+
+//=============================================================================
+// Destructor
+//=============================================================================
+STEPPlugin_ExportDlg::~STEPPlugin_ExportDlg()
+{
+}
+
+//=============================================================================
+// getUnits
+//=============================================================================
+GEOM::length_unit STEPPlugin_ExportDlg::getUnits() const
+{
+ const GEOM::length_unit anUnit =
+ (GEOM::length_unit) myUnitCB->itemData(myUnitCB->currentIndex()).toInt();
+
+ return anUnit;
+}
+
+//=============================================================================
+// getFileName
+//=============================================================================
+QString STEPPlugin_ExportDlg::getFileName(const QString &theInitial,
+ const QString &theFilters,
+ const QString &theCaption,
+ QWidget *theParent,
+ GEOM::length_unit &theUnits)
+{
+ QStringList aFls = theFilters.split(";;", QString::SkipEmptyParts);
+ QString aTmpFileName = theInitial;
+
+ aTmpFileName = aTmpFileName.simplified();
+ aTmpFileName =
+ aTmpFileName.replace(QRegExp("\\*"), "").replace(QRegExp("\\?"), "");
+
+ STEPPlugin_ExportDlg aDlg(theParent);
+
+ aDlg.setFileMode(AnyFile);
+ aDlg.setFilters(aFls);
+ aDlg.setWindowTitle(theCaption);
+
+ if (!aTmpFileName.isEmpty()) {
+ aDlg.processPath(aTmpFileName);
+ }
+
+ QString aFileName;
+
+ if (aDlg.exec() == QDialog::Accepted) {
+ aFileName = aDlg.selectedFile();
+ theUnits = aDlg.getUnits();
+ }
+
+ QApplication::processEvents();
+
+ return aFileName;
+}
--- /dev/null
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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 STEPPlugin_ExportDlg_H
+#define STEPPlugin_ExportDlg_H
+
+#include <SUIT_FileDlg.h>
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(STEPPlugin)
+
+class QComboBox;
+
+class STEPPlugin_ExportDlg: public SUIT_FileDlg
+{
+ Q_OBJECT
+
+public:
+
+ STEPPlugin_ExportDlg(QWidget *parent);
+ ~STEPPlugin_ExportDlg();
+
+ GEOM::length_unit getUnits() const;
+
+ static QString getFileName(const QString &theInitial,
+ const QString &theFilters,
+ const QString &theCaption,
+ QWidget *theParent,
+ GEOM::length_unit &theUnits);
+
+private:
+
+ QComboBox *myUnitCB;
+
+};
+
+#endif // STEPPlugin_ExportDlg_H
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// internal includes
#include "STEPPlugin_ExportDriver.hxx"
#include "STEPPlugin_IExport.hxx"
+#include "STEPPlugin_IOperations.hxx"
// KERNEL includes
#include <utilities.h>
aFunction->SetValue( aShape );
TCollection_AsciiString aFileName = aData.GetFileName();
+ Standard_Integer anUnit = aData.GetUnit();
+ TCollection_AsciiString aWriteUnit;
+
+ switch (anUnit) {
+ case STEPPlugin_IOperations::LengthUnit_Inch:
+ aWriteUnit = "INCH";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Millimeter:
+ aWriteUnit = "MM";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Foot:
+ aWriteUnit = "FT";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Mile:
+ aWriteUnit = "MI";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Meter:
+ aWriteUnit = "M";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Kilometer:
+ aWriteUnit = "KM";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Milliinch:
+ aWriteUnit = "MIL";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Micrometer:
+ aWriteUnit = "UM";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Centimeter:
+ aWriteUnit = "CM";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Microinch:
+ aWriteUnit = "UIN";
+ break;
+ default:
+ return 0;
+ }
MESSAGE("Export STEP into file " << aFileName.ToCString());
//VRV: OCC 4.0 migration
STEPControl_Writer aWriter;
Interface_Static::SetCVal("xstep.cascade.unit","M");
- Interface_Static::SetCVal("write.step.unit", "M");
+ Interface_Static::SetCVal("write.step.unit", aWriteUnit.ToCString());
Interface_Static::SetIVal("write.step.nonmanifold", 1);
status = aWriter.Transfer( aShape, STEPControl_AsIs );
//VRV: OCC 4.0 migration
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "GEOM_Operation.h"
#include "GEOMBase.h"
#include "GEOM_Displayer.h"
+#include "GEOM_GenericObjPtr.h"
+#include "STEPPlugin_ExportDlg.h"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(STEPPlugin)
+typedef GEOM::GenericObjPtr<GEOM::ISTEPOperations> STEPOpPtr;
+
//=======================================================================
// function : STEPPlugin_GUI()
// purpose : Constructor
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "STEPPluginEngine" );
- GEOM::ISTEPOperations_var stepOp = GEOM::ISTEPOperations::_narrow( op );
- if ( CORBA::is_nil( stepOp ) ) return false;
+ STEPOpPtr stepOp = GEOM::ISTEPOperations::_narrow( op );
+ if ( stepOp.isNull() ) return false;
QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""),
tr( "STEP_FILES" ),
{
QString fileName = fileNames.at( i );
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, stepOp.in() );
+ GEOM_Operation transaction( app, stepOp.get() );
bool ignoreUnits = false;
try
}
transaction.commit();
GEOM_Displayer( study ).Display( main.in() );
+ main->UnRegister();
}
else
{
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "STEPPluginEngine" );
- GEOM::ISTEPOperations_var stepOp = GEOM::ISTEPOperations::_narrow( op );
- if ( CORBA::is_nil( stepOp ) ) return false;
+ STEPOpPtr stepOp = GEOM::ISTEPOperations::_narrow( op );
+ if ( stepOp.isNull() ) return false;
LightApp_SelectionMgr* sm = app->selectionMgr();
if ( !sm ) return false;
if ( CORBA::is_nil( obj ) ) continue;
- QString fileName = app->getFileName( false,
- QString( io->getName() ),
+ GEOM::length_unit anUnit;
+ QString fileName = STEPPlugin_ExportDlg::getFileName
+ (QString( io->getName() ),
tr( "STEP_FILES" ),
tr( "EXPORT_TITLE" ),
- parent );
+ parent, anUnit);
if ( fileName.isEmpty() )
return false;
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, stepOp.in() );
+ GEOM_Operation transaction( app, stepOp.get() );
try
{
app->putInfo( tr( "GEOM_PRP_EXPORT" ).arg( fileName ) );
transaction.start();
- stepOp->ExportSTEP( obj, fileName.toUtf8().constData() );
+ stepOp->ExportSTEP( obj, fileName.toUtf8().constData(), anUnit);
if ( stepOp->IsDone() )
{
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
const TCollection_AsciiString& theFormatName )
{
STEPPlugin_IOperations* aPluginOperations = STEPPlugin_OperationsCreator::get( GetEngine(), theDocId );
- aPluginOperations->ExportSTEP( theOriginal, theFileName );
+ const STEPPlugin_IOperations::LengthUnit aUnit = STEPPlugin_IOperations::LengthUnit_Meter;
+
+ aPluginOperations->ExportSTEP( theOriginal, theFileName, aUnit );
return true;
}
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#define EXPORTSTEP_ARG_ORIGINAL 1
#define EXPORTSTEP_ARG_FILENAME 2
+#define EXPORTSTEP_ARG_UNIT 3
class STEPPlugin_IExport
{
{ _func->SetString( EXPORTSTEP_ARG_FILENAME, theFileName ); }
TCollection_AsciiString GetFileName()
{ return _func->GetString( EXPORTSTEP_ARG_FILENAME ); }
+
+ void SetUnit(const Standard_Integer theUnit)
+ { _func->SetInteger(EXPORTSTEP_ARG_UNIT, theUnit); }
+ Standard_Integer GetUnit()
+ { return _func->GetInteger(EXPORTSTEP_ARG_UNIT); }
private:
Handle(GEOM_Function) _func;
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
MESSAGE( "STEPPlugin_IOperations::~STEPPlugin_IOperations" );
}
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+static GEOM::TPythonDump& operator<<
+ (GEOM::TPythonDump &theDump,
+ const STEPPlugin_IOperations::LengthUnit theState)
+{
+ switch (theState) {
+ case STEPPlugin_IOperations::LengthUnit_Inch:
+ theDump << "GEOM.LU_INCH";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Millimeter:
+ theDump << "GEOM.LU_MILLIMETER";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Foot:
+ theDump << "GEOM.LU_FOOT";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Mile:
+ theDump << "GEOM.LU_MILE";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Meter:
+ theDump << "GEOM.LU_METER";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Kilometer:
+ theDump << "GEOM.LU_KILOMETER";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Milliinch:
+ theDump << "GEOM.LU_MILLIINCH";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Micrometer:
+ theDump << "GEOM.LU_MICROMETER";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Centimeter:
+ theDump << "GEOM.LU_CENTIMETER";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Microinch:
+ theDump << "GEOM.LU_MICROINCH";
+ break;
+ default:
+ break;
+ }
+
+ return theDump;
+}
+
//=============================================================================
/*!
* ExportSTEP
* Export a shape to STEP format
* \param theOriginal The shape to export
* \param theFileName The name of the file to exported
- * \param theIsASCII The format of the exported file (ASCII or Binary)
- * \param theDeflection The deflection of the shape to exported
+ * \param theUnit the length unit
*/
//=============================================================================
-void STEPPlugin_IOperations::ExportSTEP( const Handle(GEOM_Object) theOriginal,
- const TCollection_AsciiString& theFileName )
+void STEPPlugin_IOperations::ExportSTEP
+ (const Handle(GEOM_Object) theOriginal,
+ const TCollection_AsciiString &theFileName,
+ const LengthUnit theUnit)
{
SetErrorCode(KO);
if( theOriginal.IsNull() ) return;
STEPPlugin_IExport aCI( aFunction );
aCI.SetOriginal( aRefFunction );
aCI.SetFileName( theFileName );
+ aCI.SetUnit( theUnit );
//Perform the Export
try {
//Make a Python command
GEOM::TPythonDump(aFunction) << "geompy.ExportSTEP(" << theOriginal << ", \""
- << theFileName.ToCString() << "\" )";
+ << theFileName.ToCString() << "\", " << theUnit << " )";
SetErrorCode(OK);
}
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
class STEPPLUGINENGINE_EXPORT STEPPlugin_IOperations: public GEOMImpl_IBaseIEOperations
{
+
+public:
+
+ /*!
+ * \brief Units of length
+ */
+ enum LengthUnit
+ {
+ LengthUnit_Inch,
+ LengthUnit_Millimeter,
+ LengthUnit_Foot,
+ LengthUnit_Mile,
+ LengthUnit_Meter,
+ LengthUnit_Kilometer,
+ LengthUnit_Milliinch,
+ LengthUnit_Micrometer,
+ LengthUnit_Centimeter,
+ LengthUnit_Microinch
+ };
+
+
public:
STEPPlugin_IOperations( GEOM_Engine*, int );
~STEPPlugin_IOperations();
void ExportSTEP( const Handle(GEOM_Object),
- const TCollection_AsciiString& );
+ const TCollection_AsciiString&, const LengthUnit );
Handle(TColStd_HSequenceOfTransient) ImportSTEP( const TCollection_AsciiString&,
const bool );
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
* Export a shape to STEP format
* \param theOriginal The shape to export
* \param theFileName The name of the exported file
+ * \param theUnit the length unit.
*/
//=============================================================================
-void STEPPlugin_IOperations_i::ExportSTEP( GEOM::GEOM_Object_ptr theOriginal,
- const char* theFileName )
+void STEPPlugin_IOperations_i::ExportSTEP(GEOM::GEOM_Object_ptr theOriginal,
+ const char* theFileName,
+ GEOM::length_unit theUnit)
{
// duplicate the original shape
GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate( theOriginal );
Handle(GEOM_Object) anOriginal = GetObjectImpl( theOriginal );
if (anOriginal.IsNull()) return;
+ STEPPlugin_IOperations::LengthUnit aUnit;
+
+ switch (theUnit) {
+ case GEOM::LU_INCH:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Inch;
+ break;
+ case GEOM::LU_MILLIMETER:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Millimeter;
+ break;
+ case GEOM::LU_FOOT:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Foot;
+ break;
+ case GEOM::LU_MILE:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Mile;
+ break;
+ case GEOM::LU_METER:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Meter;
+ break;
+ case GEOM::LU_KILOMETER:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Kilometer;
+ break;
+ case GEOM::LU_MILLIINCH:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Milliinch;
+ break;
+ case GEOM::LU_MICROMETER:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Micrometer;
+ break;
+ case GEOM::LU_CENTIMETER:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Centimeter;
+ break;
+ case GEOM::LU_MICROINCH:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Microinch;
+ break;
+ default:
+ return;
+ }
+
//Export the shape to the file
- GetOperations()->ExportSTEP( anOriginal, theFileName );
+ GetOperations()->ExportSTEP( anOriginal, theFileName, aUnit );
}
//=============================================================================
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
STEPPlugin_IOperations* theImpl );
~STEPPlugin_IOperations_i();
- void ExportSTEP( GEOM::GEOM_Object_ptr, const char* );
+ void ExportSTEP( GEOM::GEOM_Object_ptr, const char*,
+ GEOM::length_unit );
GEOM::ListOfGO* ImportSTEP( const char*, const bool );
char* ReadValue( const char*, const char* );
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
-//=============================================================================
-/*!
- * GetShape()
- */
-//=============================================================================
-
-TopoDS_Shape GetShape(const Handle(Standard_Transient) &theEnti,
- const Handle(Transfer_TransientProcess) &theTP)
+namespace
{
- TopoDS_Shape aResult;
- Handle(Transfer_Binder) aBinder = theTP->Find(theEnti);
-
- if (aBinder.IsNull()) {
+ //=============================================================================
+ /*!
+ * GetShape()
+ */
+ //=============================================================================
+
+ TopoDS_Shape GetShape(const Handle(Standard_Transient) &theEnti,
+ const Handle(Transfer_TransientProcess) &theTP)
+ {
+ TopoDS_Shape aResult;
+ Handle(Transfer_Binder) aBinder = theTP->Find(theEnti);
+
+ if (aBinder.IsNull()) {
+ return aResult;
+ }
+
+ aResult = TransferBRep::ShapeResult(aBinder);
+
return aResult;
}
-
- aResult = TransferBRep::ShapeResult(aBinder);
-
- return aResult;
-}
-
-//=============================================================================
-/*!
- * GetLabel()
- */
-//=============================================================================
-
-TDF_Label GetLabel(const Handle(Standard_Transient) &theEnti,
- const TDF_Label &theShapeLabel,
- const TopoDS_Shape &aShape)
-{
- TDF_Label aResult;
-
- if (theEnti->IsKind
- (STANDARD_TYPE(StepGeom_GeometricRepresentationItem))) {
- // check all named shapes using iterator
- TDF_ChildIDIterator anIt
- (theShapeLabel, TDataStd_Name::GetID(), Standard_True);
-
- for (; anIt.More(); anIt.Next()) {
- Handle(TDataStd_Name) nameAttr =
- Handle(TDataStd_Name)::DownCast(anIt.Value());
-
- if (nameAttr.IsNull()) {
- continue;
- }
-
- TDF_Label aLab = nameAttr->Label();
- Handle(TNaming_NamedShape) shAttr;
-
- if (aLab.FindAttribute(TNaming_NamedShape::GetID(), shAttr) &&
- shAttr->Get().IsEqual(aShape)) {
- aResult = aLab;
+
+ //=============================================================================
+ /*!
+ * GetLabel()
+ */
+ //=============================================================================
+
+ TDF_Label GetLabel(const Handle(Standard_Transient) &theEnti,
+ const TDF_Label &theShapeLabel,
+ const TopoDS_Shape &aShape)
+ {
+ TDF_Label aResult;
+
+ if (theEnti->IsKind
+ (STANDARD_TYPE(StepGeom_GeometricRepresentationItem))) {
+ // check all named shapes using iterator
+ TDF_ChildIDIterator anIt
+ (theShapeLabel, TDataStd_Name::GetID(), Standard_True);
+
+ for (; anIt.More(); anIt.Next()) {
+ Handle(TDataStd_Name) nameAttr =
+ Handle(TDataStd_Name)::DownCast(anIt.Value());
+
+ if (nameAttr.IsNull()) {
+ continue;
+ }
+
+ TDF_Label aLab = nameAttr->Label();
+ Handle(TNaming_NamedShape) shAttr;
+
+ if (aLab.FindAttribute(TNaming_NamedShape::GetID(), shAttr) &&
+ shAttr->Get().IsEqual(aShape)) {
+ aResult = aLab;
+ }
}
}
- }
-
- // create label and set shape
- if (aResult.IsNull()) {
- TDF_TagSource aTag;
-
- aResult = aTag.NewChild(theShapeLabel);
-
- TNaming_Builder tnBuild (aResult);
-
- tnBuild.Generated(aShape);
- }
-
- return aResult;
-}
-
-//=============================================================================
-/*!
- * StoreName()
- */
-//=============================================================================
-
-void StoreName( const Handle(Standard_Transient) &theEnti,
- const TopTools_IndexedMapOfShape &theIndices,
- const Handle(Transfer_TransientProcess) &theTP,
- const TDF_Label &theShapeLabel)
-{
- Handle(TCollection_HAsciiString) aName;
-
- if (theEnti->IsKind(STANDARD_TYPE(StepShape_TopologicalRepresentationItem)) ||
- theEnti->IsKind(STANDARD_TYPE(StepGeom_GeometricRepresentationItem))) {
- aName = Handle(StepRepr_RepresentationItem)::DownCast(theEnti)->Name();
- } else {
- Handle(StepBasic_ProductDefinition) PD =
- Handle(StepBasic_ProductDefinition)::DownCast(theEnti);
-
- if (PD.IsNull() == Standard_False) {
- Handle(StepBasic_Product) Prod = PD->Formation()->OfProduct();
- aName = Prod->Name();
+
+ // create label and set shape
+ if (aResult.IsNull()) {
+ TDF_TagSource aTag;
+
+ aResult = aTag.NewChild(theShapeLabel);
+
+ TNaming_Builder tnBuild (aResult);
+
+ tnBuild.Generated(aShape);
}
+
+ return aResult;
}
- bool isValidName = false;
-
- if (aName.IsNull() == Standard_False) {
- isValidName = true;
-
- if (aName->UsefullLength() < 1) {
- isValidName = false;
- } else if (aName->UsefullLength() == 4 &&
- toupper (aName->Value(1)) == 'N' &&
- toupper (aName->Value(2)) == 'O' &&
- toupper (aName->Value(3)) == 'N' &&
- toupper (aName->Value(4)) == 'E') {
- // skip 'N0NE' name
- isValidName = false;
+ //=============================================================================
+ /*!
+ * StoreName()
+ */
+ //=============================================================================
+
+ void StoreName( const Handle(Standard_Transient) &theEnti,
+ const TopTools_IndexedMapOfShape &theIndices,
+ const Handle(Transfer_TransientProcess) &theTP,
+ const TDF_Label &theShapeLabel)
+ {
+ Handle(TCollection_HAsciiString) aName;
+
+ if (theEnti->IsKind(STANDARD_TYPE(StepShape_TopologicalRepresentationItem)) ||
+ theEnti->IsKind(STANDARD_TYPE(StepGeom_GeometricRepresentationItem))) {
+ aName = Handle(StepRepr_RepresentationItem)::DownCast(theEnti)->Name();
} else {
- // special check to pass names like "Open CASCADE STEP translator 6.3 1"
- TCollection_AsciiString aSkipName ("Open CASCADE STEP translator");
-
- if (aName->Length() >= aSkipName.Length()) {
- if (aName->String().SubString
- (1, aSkipName.Length()).IsEqual(aSkipName)) {
- isValidName = false;
+ Handle(StepBasic_ProductDefinition) PD =
+ Handle(StepBasic_ProductDefinition)::DownCast(theEnti);
+
+ if (PD.IsNull() == Standard_False) {
+ Handle(StepBasic_Product) Prod = PD->Formation()->OfProduct();
+ aName = Prod->Name();
+ }
+ }
+
+ bool isValidName = false;
+
+ if (aName.IsNull() == Standard_False) {
+ isValidName = true;
+
+ if (aName->UsefullLength() < 1) {
+ isValidName = false;
+ } else if (aName->UsefullLength() == 4 &&
+ toupper (aName->Value(1)) == 'N' &&
+ toupper (aName->Value(2)) == 'O' &&
+ toupper (aName->Value(3)) == 'N' &&
+ toupper (aName->Value(4)) == 'E') {
+ // skip 'N0NE' name
+ isValidName = false;
+ } else {
+ // special check to pass names like "Open CASCADE STEP translator 6.3 1"
+ TCollection_AsciiString aSkipName ("Open CASCADE STEP translator");
+
+ if (aName->Length() >= aSkipName.Length()) {
+ if (aName->String().SubString
+ (1, aSkipName.Length()).IsEqual(aSkipName)) {
+ isValidName = false;
+ }
}
}
}
- }
- if (isValidName) {
- TCollection_ExtendedString aNameExt (aName->ToCString());
+ if (isValidName) {
+ TCollection_ExtendedString aNameExt (aName->ToCString());
- // find target shape
- TopoDS_Shape S = GetShape(theEnti, theTP);
+ // find target shape
+ TopoDS_Shape S = GetShape(theEnti, theTP);
- if (S.IsNull()) {
- return;
- }
+ if (S.IsNull()) {
+ return;
+ }
- // as PRODUCT can be included in the main shape
- // several times, we look here for all iclusions.
- Standard_Integer isub, nbSubs = theIndices.Extent();
+ // as PRODUCT can be included in the main shape
+ // several times, we look here for all iclusions.
+ Standard_Integer isub, nbSubs = theIndices.Extent();
- for (isub = 1; isub <= nbSubs; isub++) {
- TopoDS_Shape aSub = theIndices.FindKey(isub);
+ for (isub = 1; isub <= nbSubs; isub++) {
+ TopoDS_Shape aSub = theIndices.FindKey(isub);
- if (aSub.IsPartner(S)) {
- TDF_Label L = GetLabel(theEnti, theShapeLabel, aSub);
+ if (aSub.IsPartner(S)) {
+ TDF_Label L = GetLabel(theEnti, theShapeLabel, aSub);
- // set a name
- TDataStd_Name::Set(L, aNameExt);
+ // set a name
+ TDataStd_Name::Set(L, aNameExt);
+ }
}
}
}
-}
-//=============================================================================
-/*!
- * StoreMaterial()
- */
-//=============================================================================
+ //=============================================================================
+ /*!
+ * StoreMaterial()
+ */
+ //=============================================================================
-void StoreMaterial( const Handle(Standard_Transient) &theEnti,
- const TopTools_IndexedMapOfShape &theIndices,
- const Handle(Transfer_TransientProcess) &theTP,
- const TDF_Label &theShapeLabel )
-{
- // Treat Product Definition Shape only.
- Handle(StepRepr_ProductDefinitionShape) aPDS =
+ void StoreMaterial( const Handle(Standard_Transient) &theEnti,
+ const TopTools_IndexedMapOfShape &theIndices,
+ const Handle(Transfer_TransientProcess) &theTP,
+ const TDF_Label &theShapeLabel )
+ {
+ // Treat Product Definition Shape only.
+ Handle(StepRepr_ProductDefinitionShape) aPDS =
Handle(StepRepr_ProductDefinitionShape)::DownCast(theEnti);
- Handle(StepBasic_ProductDefinition) aProdDef;
+ Handle(StepBasic_ProductDefinition) aProdDef;
- if(aPDS.IsNull() == Standard_False) {
- // Product Definition Shape ==> Product Definition
- aProdDef = aPDS->Definition().ProductDefinition();
- }
+ if(aPDS.IsNull() == Standard_False) {
+ // Product Definition Shape ==> Product Definition
+ aProdDef = aPDS->Definition().ProductDefinition();
+ }
- if (aProdDef.IsNull() == Standard_False) {
- // Product Definition ==> Property Definition
- const Interface_Graph &aGraph = theTP->Graph();
- Interface_EntityIterator aSubs = aGraph.Sharings(aProdDef);
- TopoDS_Shape aShape;
+ if (aProdDef.IsNull() == Standard_False) {
+ // Product Definition ==> Property Definition
+ const Interface_Graph &aGraph = theTP->Graph();
+ Interface_EntityIterator aSubs = aGraph.Sharings(aProdDef);
+ TopoDS_Shape aShape;
- for(aSubs.Start(); aSubs.More(); aSubs.Next()) {
- Handle(StepRepr_PropertyDefinition) aPropD =
- Handle(StepRepr_PropertyDefinition)::DownCast(aSubs.Value());
+ for(aSubs.Start(); aSubs.More(); aSubs.Next()) {
+ Handle(StepRepr_PropertyDefinition) aPropD =
+ Handle(StepRepr_PropertyDefinition)::DownCast(aSubs.Value());
- if(aPropD.IsNull() == Standard_False) {
- // Property Definition ==> Representation.
- Interface_EntityIterator aSubs1 = aGraph.Sharings(aPropD);
+ if(aPropD.IsNull() == Standard_False) {
+ // Property Definition ==> Representation.
+ Interface_EntityIterator aSubs1 = aGraph.Sharings(aPropD);
- for(aSubs1.Start(); aSubs1.More(); aSubs1.Next()) {
- Handle(StepRepr_PropertyDefinitionRepresentation) aPDR =
- Handle(StepRepr_PropertyDefinitionRepresentation)::
+ for(aSubs1.Start(); aSubs1.More(); aSubs1.Next()) {
+ Handle(StepRepr_PropertyDefinitionRepresentation) aPDR =
+ Handle(StepRepr_PropertyDefinitionRepresentation)::
DownCast(aSubs1.Value());
- if(aPDR.IsNull() == Standard_False) {
- // Property Definition ==> Material Name.
- Handle(StepRepr_Representation) aRepr = aPDR->UsedRepresentation();
+ if(aPDR.IsNull() == Standard_False) {
+ // Property Definition ==> Material Name.
+ Handle(StepRepr_Representation) aRepr = aPDR->UsedRepresentation();
- if(aRepr.IsNull() == Standard_False) {
- Standard_Integer ir;
+ if(aRepr.IsNull() == Standard_False) {
+ Standard_Integer ir;
- for(ir = 1; ir <= aRepr->NbItems(); ir++) {
- Handle(StepRepr_RepresentationItem) aRI = aRepr->ItemsValue(ir);
- Handle(StepRepr_DescriptiveRepresentationItem) aDRI =
- Handle(StepRepr_DescriptiveRepresentationItem)::DownCast(aRI);
+ for(ir = 1; ir <= aRepr->NbItems(); ir++) {
+ Handle(StepRepr_RepresentationItem) aRI = aRepr->ItemsValue(ir);
+ Handle(StepRepr_DescriptiveRepresentationItem) aDRI =
+ Handle(StepRepr_DescriptiveRepresentationItem)::DownCast(aRI);
- if(aDRI.IsNull() == Standard_False) {
- // Get shape from Product Definition
- Handle(TCollection_HAsciiString) aMatName = aDRI->Name();
+ if(aDRI.IsNull() == Standard_False) {
+ // Get shape from Product Definition
+ Handle(TCollection_HAsciiString) aMatName = aDRI->Name();
- if(aMatName.IsNull() == Standard_False) {
- TCollection_ExtendedString
- aMatNameExt (aMatName->ToCString());
-
- if (aShape.IsNull()) {
- // Get the shape.
- aShape = GetShape(aProdDef, theTP);
+ if(aMatName.IsNull() == Standard_False) {
+ TCollection_ExtendedString
+ aMatNameExt (aMatName->ToCString());
if (aShape.IsNull()) {
- return;
+ // Get the shape.
+ aShape = GetShape(aProdDef, theTP);
+
+ if (aShape.IsNull()) {
+ return;
+ }
}
- }
- // as PRODUCT can be included in the main shape
- // several times, we look here for all iclusions.
- Standard_Integer isub, nbSubs = theIndices.Extent();
+ // as PRODUCT can be included in the main shape
+ // several times, we look here for all iclusions.
+ Standard_Integer isub, nbSubs = theIndices.Extent();
- for (isub = 1; isub <= nbSubs; isub++) {
- TopoDS_Shape aSub = theIndices.FindKey(isub);
+ for (isub = 1; isub <= nbSubs; isub++) {
+ TopoDS_Shape aSub = theIndices.FindKey(isub);
- if (aSub.IsPartner(aShape)) {
- TDF_Label aLabel =
- GetLabel(aProdDef, theShapeLabel, aSub);
+ if (aSub.IsPartner(aShape)) {
+ TDF_Label aLabel =
+ GetLabel(aProdDef, theShapeLabel, aSub);
- // set a name
- TDataStd_Comment::Set(aLabel, aMatNameExt);
+ // set a name
+ TDataStd_Comment::Set(aLabel, aMatNameExt);
+ }
}
}
}
}
}
}
-}
+
+ TCollection_AsciiString ToNamedUnit( const TCollection_AsciiString& unit )
+ {
+ TCollection_AsciiString result = unit;
+ result.LowerCase();
+ if ( result == "mil" ) result = "milliinch";
+ return result;
+ }
+
+ TCollection_AsciiString ToOcctUnit( const TCollection_AsciiString& unit, TCollection_AsciiString& error )
+ {
+ TCollection_AsciiString result = "M", u = ToNamedUnit(unit);
+ u.LowerCase();
+
+ if (u == "inch")
+ result = "INCH";
+ else if (u == "milliinch")
+ result = "MIL";
+ else if (u == "microinch")
+ result = "UIN";
+ else if (u == "foot")
+ result = "FT";
+ else if (u == "mile")
+ result = "MI";
+ else if (u == "metre")
+ result = "M";
+ else if (u == "kilometre")
+ result = "KM";
+ else if (u == "millimetre")
+ result = "MM";
+ else if (u == "centimetre")
+ result = "CM";
+ else if (u == "micrometre")
+ result = "UM";
+ else if (u.IsEmpty())
+ result = "M";
+ else
+ error = "The file contains not supported units";
+
+ // TODO (for other units)
+ // else
+ // result = "??"
+
+ return result;
+ }
+
+} // end of namespace
//=======================================================================
//function : GetID
TColStd_SequenceOfAsciiString anUnitSolidAngleNames;
aReader.FileUnits(anUnitLengthNames, anUnitAngleNames, anUnitSolidAngleNames);
if (anUnitLengthNames.Length() > 0) {
- TCollection_AsciiString aLenUnits = anUnitLengthNames.First();
- if (aLenUnits == "millimetre")
- Interface_Static::SetCVal("xstep.cascade.unit", "MM");
- else if (aLenUnits == "centimetre")
- Interface_Static::SetCVal("xstep.cascade.unit", "CM");
- else if (aLenUnits == "metre" || aLenUnits.IsEmpty())
- Interface_Static::SetCVal("xstep.cascade.unit", "M");
- else if (aLenUnits == "INCH")
- Interface_Static::SetCVal("xstep.cascade.unit", "INCH");
- else {
- anError = "The file contains not supported units.";
- }
- // TODO (for other units than mm, cm, m or inch)
- // else if (aLenUnits == "")
- // Interface_Static::SetCVal("xstep.cascade.unit", "???");
+ TCollection_AsciiString aLenUnits = ToOcctUnit(anUnitLengthNames.First(), anError);
+ Interface_Static::SetCVal("xstep.cascade.unit", aLenUnits.ToCString());
}
}
else {
// Check if any BRep entity has been read, there must be at least a vertex
if ( !TopExp_Explorer( aResShape, TopAbs_VERTEX ).More() )
- anError = "No geometrical data in the imported file.";
+ StdFail_NotDone::Raise( "No geometrical data in the imported file." );
// BEGIN: Store names and materials of sub-shapes from file
TopTools_IndexedMapOfShape anIndices;
TCollection_AsciiString
STEPPlugin_ImportDriver::GetValue( const TCollection_AsciiString& theFileName,
- const TCollection_AsciiString& theParameterName,
- TCollection_AsciiString& theError )
+ const TCollection_AsciiString& theParameterName,
+ TCollection_AsciiString& theError )
{
- Handle(TCollection_HAsciiString) aValue;
+ TCollection_AsciiString aValue;
if (theParameterName != "LEN_UNITS") {
theError = theParameterName + " parameter reading is not supported by STEP plugin";
TColStd_SequenceOfAsciiString anUnitAngleNames;
TColStd_SequenceOfAsciiString anUnitSolidAngleNames;
aReader.FileUnits(anUnitLengthNames, anUnitAngleNames, anUnitSolidAngleNames);
- if (anUnitLengthNames.Length() > 0) {
- aValue = new TCollection_HAsciiString( anUnitLengthNames.First() );
- /*
- TCollection_AsciiString aLenUnits = anUnitLengthNames.First();
- if (aLenUnits == "millimetre")
- aValue = new TCollection_HAsciiString ("MM");
- else if (aLenUnits == "centimetre")
- aValue = new TCollection_HAsciiString ("CM");
- else if (aLenUnits == "metre")
- aValue = new TCollection_HAsciiString ("M");
- else if (aLenUnits == "INCH")
- aValue = new TCollection_HAsciiString ("INCH");
- // TODO (for other units than mm, cm, m or inch)
- //else if (aLenUnits == "")
- // aValue = new TCollection_HAsciiString ("");
- */
- }
+ if (anUnitLengthNames.Length() > 0)
+ aValue = ToNamedUnit( anUnitLengthNames.First() );
}
else {
theError = theFileName + " reading failed";
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
theError = aFail->GetMessageString();
}
- if (!aValue.IsNull())
- return aValue->String();
- else
- return TCollection_AsciiString();
+ return aValue;
}
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
Ignoring units will cause model scaling (as dimensions are supposed to be specified in meters).</translation>
</message>
</context>
+<context>
+ <name>STEPPlugin_ExportDlg</name>
+ <message>
+ <source>STEP_LENGTH_UNITS</source>
+ <translation>Length units</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_INCH</source>
+ <translation>inch</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_MILLIMETER</source>
+ <translation>millimeter</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_FOOT</source>
+ <translation>foot</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_MILE</source>
+ <translation>mile</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_METER</source>
+ <translation>meter</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_KILOMETER</source>
+ <translation>kilometer</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_MILLIINCH</source>
+ <translation>milliinch</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_MICROMETER</source>
+ <translation>micrometer</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_CENTIMETER</source>
+ <translation>centimeter</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_MICROINCH</source>
+ <translation>microinch</translation>
+ </message>
+</context>
</TS>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="ja" sourcelanguage="en">
-<context>
+ <context>
<name>@default</name>
<message>
- <source>MEN_EXPORTSTEP</source>
- <translation type="unfinished">STEP</translation>
+ <source>MEN_EXPORTSTEP</source>
+ <translation>STEPエクスポート</translation>
</message>
<message>
- <source>TOP_EXPORTSTEP</source>
- <translation type="unfinished">Export STEP</translation>
+ <source>TOP_EXPORTSTEP</source>
+ <translation>STEPエクスポート</translation>
</message>
<message>
- <source>STB_EXPORTSTEP</source>
- <translation type="unfinished">Export STEP</translation>
+ <source>STB_EXPORTSTEP</source>
+ <translation>STEPエクスポート</translation>
</message>
<message>
- <source>MEN_IMPORTSTEP</source>
- <translation type="unfinished">STEP</translation>
+ <source>MEN_IMPORTSTEP</source>
+ <translation>STEPインポート</translation>
</message>
<message>
- <source>TOP_IMPORTSTEP</source>
- <translation type="unfinished">Import STEP</translation>
+ <source>TOP_IMPORTSTEP</source>
+ <translation>STEPインポート</translation>
</message>
<message>
- <source>STB_IMPORTSTEP</source>
- <translation type="unfinished">Import STEP</translation>
+ <source>STB_IMPORTSTEP</source>
+ <translation>STEPインポート</translation>
</message>
-</context>
-<context>
+ </context>
+ <context>
<name>STEPPlugin_GUI</name>
<message>
- <source>STEP_FILES</source>
- <translation type="unfinished">STEP Files ( *.step *.stp )</translation>
+ <source>STEP_FILES</source>
+ <translation>STEP ファイル ( *.step *.stp )</translation>
</message>
<message>
- <source>EXPORT_TITLE</source>
- <translation type="unfinished">Export STEP</translation>
+ <source>EXPORT_TITLE</source>
+ <translation>STEPエクスポート</translation>
</message>
<message>
- <source>IMPORT_TITLE</source>
- <translation type="unfinished">Import STEP</translation>
+ <source>IMPORT_TITLE</source>
+ <translation>STEPインポート</translation>
</message>
<message>
- <source>SCALE_DIMENSIONS</source>
- <translation>インポートしたファイルの単位をミリメートルからメートルに変換しますか?いいえを選んだ場合、メートル単位として解釈します。</translation>
+ <source>SCALE_DIMENSIONS</source>
+ <translation>インポートしたファイルの単位をミリメートルからメートルに変換しますか?いいえを選んだ場合、メートル単位として解釈します。</translation>
</message>
-</context>
+ </context>
</TS>
-# Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// KERNEL includes
#include <utilities.h>
#include <Basics_Utils.hxx>
+#include <Basics_OCCTVersion.hxx>
// GEOM includes
#include "GEOM_Function.hxx"
#include <BRepBuilderAPI_Copy.hxx>
#include <StlAPI_Writer.hxx>
#include <TopoDS_Shape.hxx>
+#include <Bnd_Box.hxx>
+#include <BRepBndLib.hxx>
+#include <BRepTools.hxx>
+#include <BRepMesh_IncrementalMesh.hxx>
+
+#define MAX2(X, Y) ( Abs(X) > Abs(Y) ? Abs(X) : Abs(Y) )
+#define MAX3(X, Y, Z) ( MAX2 ( MAX2(X, Y) , Z ) )
//=======================================================================
//function : GetID
try
{
StlAPI_Writer aWriter;
+ // copy source shape
+ BRepBuilderAPI_Copy aCopy( aShape, Standard_False );
+ TopoDS_Shape aCopyShape = aCopy.Shape();
+ // ASCII mode
+ aWriter.ASCIIMode() = anIsASCII;
+#if OCC_VERSION_LARGE > 0x06080000
+ if ( anIsRelative ) {
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ Bnd_Box bndBox;
+ BRepBndLib::Add( aShape, bndBox );
+ bndBox.Get( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax );
+ aDeflection = MAX3( aXmax-aXmin, aYmax-aYmin, aZmax-aZmin ) * aDeflection;
+ }
+ //Compute triangulation
+ BRepTools::Clean( aCopyShape );
+ BRepMesh_IncrementalMesh aMesh( aCopyShape, aDeflection );
+#else
// set relative mode on false for using custom deflection coefficient
aWriter.RelativeMode( ) = anIsRelative;
- aWriter.ASCIIMode() = anIsASCII;
if( anIsRelative )
aWriter.SetCoefficient( aDeflection );
else
aWriter.SetDeflection( aDeflection );
- BRepBuilderAPI_Copy aCopy( aShape, Standard_False );
- aWriter.Write( aCopy.Shape(), aFileName.ToCString() );
+#endif
+ aWriter.Write( aCopyShape, aFileName.ToCString() );
log.SetTouched( Label() );
return 1;
}
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "GEOM_Operation.h"
#include "GEOMBase.h"
#include "GEOM_Displayer.h"
+#include "GEOM_GenericObjPtr.h"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(STLPlugin)
+typedef GEOM::GenericObjPtr<GEOM::ISTLOperations> STLOpPtr;
+
//=======================================================================
// function : STLPlugin_GUI()
// purpose : Constructor
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "STLPluginEngine" );
- GEOM::ISTLOperations_var stlOp = GEOM::ISTLOperations::_narrow( op );
- if ( CORBA::is_nil( stlOp ) ) return false;
+ STLOpPtr stlOp = GEOM::ISTLOperations::_narrow( op );
+ if ( stlOp.isNull() ) return false;
QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""),
tr( "STL_FILES" ),
foreach( QString fileName, fileNames )
{
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, stlOp.in() );
+ GEOM_Operation transaction( app, stlOp.get() );
try
{
entryList.append( so->GetID() );
transaction.commit();
GEOM_Displayer( study ).Display( main.in() );
+ main->UnRegister();
}
else
{
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "STLPluginEngine" );
- GEOM::ISTLOperations_var stlOp = GEOM::ISTLOperations::_narrow( op );
- if ( CORBA::is_nil( stlOp ) ) return false;
+ STLOpPtr stlOp = GEOM::ISTLOperations::_narrow( op );
+ if ( stlOp.isNull() ) return false;
LightApp_SelectionMgr* sm = app->selectionMgr();
if ( !sm ) return false;
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, stlOp.in() );
+ GEOM_Operation transaction( app, stlOp.get() );
try
{
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="2.0" language="fr_US">
+<TS version="2.0" language="fr_FR">
<context>
<name>@default</name>
<message>
<name>STLPlugin_ExportDlg</name>
<message>
<source>ASCII</source>
- <translation type="unfinished">Save as ASCII</translation>
+ <translation>Sauver au format ASCII</translation>
</message>
<message>
<source>RELATIVE</source>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="ja" sourcelanguage="en">
-<context>
+ <context>
<name>@default</name>
<message>
- <source>MEN_EXPORTSTL</source>
- <translation type="unfinished">STL</translation>
+ <source>MEN_EXPORTSTL</source>
+ <translation>STLエクスポート</translation>
</message>
<message>
- <source>TOP_EXPORTSTL</source>
- <translation type="unfinished">Export STL</translation>
+ <source>TOP_EXPORTSTL</source>
+ <translation>STLエクスポート</translation>
</message>
<message>
- <source>STB_EXPORTSTL</source>
- <translation type="unfinished">Export STL</translation>
+ <source>STB_EXPORTSTL</source>
+ <translation>STLエクスポート</translation>
</message>
<message>
- <source>MEN_IMPORTSTL</source>
- <translation type="unfinished">STL</translation>
+ <source>MEN_IMPORTSTL</source>
+ <translation>STLインポート</translation>
</message>
<message>
- <source>TOP_IMPORTSTL</source>
- <translation type="unfinished">Import STL</translation>
+ <source>TOP_IMPORTSTL</source>
+ <translation>STLインポート</translation>
</message>
<message>
- <source>STB_IMPORTSTL</source>
- <translation type="unfinished">Import STL</translation>
+ <source>STB_IMPORTSTL</source>
+ <translation>STLインポート</translation>
</message>
-</context>
-<context>
+ </context>
+ <context>
<name>STLPlugin_GUI</name>
<message>
- <source>STL_FILES</source>
- <translation type="unfinished">STL files( *.stl )</translation>
+ <source>STL_FILES</source>
+ <translation>STL ファイル( *.stl )</translation>
</message>
<message>
- <source>EXPORT_TITLE</source>
- <translation type="unfinished">Export STL</translation>
+ <source>EXPORT_TITLE</source>
+ <translation>STLエクスポート</translation>
</message>
<message>
- <source>IMPORT_TITLE</source>
- <translation type="unfinished">Import STL</translation>
+ <source>IMPORT_TITLE</source>
+ <translation>STLインポート</translation>
</message>
-</context>
-<context>
+ </context>
+ <context>
<name>STLPlugin_ExportDlg</name>
<message>
- <source>ASCII</source>
- <translation type="unfinished">Save as ASCII</translation>
+ <source>ASCII</source>
+ <translation>アスキーテキスト</translation>
</message>
<message>
- <source>RELATIVE</source>
- <translation type="unfinished">Relative</translation>
+ <source>RELATIVE</source>
+ <translation>相対</translation>
</message>
<message>
- <source>DEFLECTION</source>
- <translation type="unfinished">Deflection</translation>
+ <source>DEFLECTION</source>
+ <translation>たわみ</translation>
</message>
-</context>
+ </context>
</TS>
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
ShHealOper_SplitCurve3d.hxx
ShHealOper_ChangeOrientation.hxx
ShHealOper_Tool.hxx
+ ShHealOper_ModifStats.hxx
)
# --- sources ---
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
while (itr.More()) {
B.Add(myResultShape,itr.Value().Reversed());
itr.Next();
+ myStatistics.AddModif("Face reversed");
}
}
else if (myInitShape.ShapeType() == TopAbs_FACE)
while (itr.More()) {
B.Add(myResultShape,itr.Value());
itr.Next();
+ myStatistics.AddModif("Wire reversed");
}
myResultShape.Reverse();
}
if ( myInitShape.ShapeType() == TopAbs_EDGE )
{
myResultShape = reversedEdges.First();
+ myStatistics.AddModif("Edge reversed");
}
else
{
BRepBuilderAPI_MakeWire wire;
wire.Add( reversedEdges );
myResultShape = wire;
+ myStatistics.AddModif("Wire reversed");
}
// myResultShape = myInitShape.EmptyCopied();
// TopoDS_Iterator itr (myInitShape);
myResultShape.Orientation(TopAbs_REVERSED);
else
myResultShape.Orientation(TopAbs_FORWARD);
+
+ switch( myResultShape.ShapeType() ) {
+ case TopAbs_SOLID : myStatistics.AddModif("Solid reversed"); break;
+ case TopAbs_COMPSOLID: myStatistics.AddModif("Compsolid reversed"); break;
+ case TopAbs_COMPOUND : myStatistics.AddModif("Compound reversed"); break;
+ default:;
+ }
}
return true;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
Standard_Integer ind1 = (ind2 >1 ? ind2 -1 : theWire->NbEdges());
TopoDS_Edge aE1= theWire->Edge(ind1);
TopoDS_Edge aE2= theWire->Edge(ind2);
- if(!myModeVertex)
+ if(!myModeVertex) {
buildEdge(aE1,aE2,theCommonFaces);
- else
+ myStatistics.AddModif("An edge added to close a wire");
+ }
+ else {
myMaxTolerance = RealLast();
+ myStatistics.AddModif("Tolerance of vertex increased to close a wire");
+ }
if(ind2 == ind1) break;
}
}
//function : checkOneFace
//purpose :
//=======================================================================
-Standard_Boolean ShHealOper_CloseContour::checkOneFace(const Handle(ShapeExtend_WireData)& theSewd,
- TopTools_SequenceOfShape& theCommonFaces) const
+Standard_Boolean
+ShHealOper_CloseContour::checkOneFace(const Handle(ShapeExtend_WireData)& theSewd,
+ TopTools_SequenceOfShape& theCommonFaces) const
{
TopTools_IndexedMapOfShape amapfaces;
TopoDS_Edge aEdge1 = theSewd->Edge(1);
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Created: 30.04.04 16:44:47
// Author: Galina KULIKOVA
//
+#include <BRep_Tool.hxx>
+#include <GCPnts_AbscissaPoint.hxx>
+#include <Geom2dAdaptor_Curve.hxx>
+#include <Geom2d_Curve.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
+#include <GeomAdaptor_Curve.hxx>
+#include <Geom_Curve.hxx>
+#include <Precision.hxx>
#include <ShHealOper_EdgeDivide.hxx>
-#include <ShapeUpgrade_WireDivide.hxx>
-#include <ShHealOper_SplitCurve3d.hxx>
#include <ShHealOper_SplitCurve2d.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <BRep_Tool.hxx>
-#include <ShapeFix_Edge.hxx>
+#include <ShHealOper_SplitCurve3d.hxx>
#include <ShapeAnalysis_Edge.hxx>
-#include <GeomAdaptor_Curve.hxx>
-#include <Geom2dAdaptor_Curve.hxx>
+#include <ShapeFix_Edge.hxx>
+#include <ShapeUpgrade_WireDivide.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
#include <TopoDS.hxx>
-#include <Geom_Curve.hxx>
#include <TopoDS_Face.hxx>
-#include <Geom2d_Curve.hxx>
-#include <GCPnts_AbscissaPoint.hxx>
-#include <TopExp.hxx>
-#include <Precision.hxx>
+
//#include <.hxx>
//#include <.hxx>
//=======================================================================
return myDone;
}
//=======================================================================
-//function : build
+//function : Perform
//purpose :
//=======================================================================
+Standard_Boolean ShHealOper_EdgeDivide::Perform(const TopoDS_Shape& theEdge,
+ const TopoDS_Shape& thePoints)
+{
+ myDone = Standard_False;
+ myErrorStatus = ShHealOper_NotError;
+ if(theEdge.ShapeType() != TopAbs_EDGE) {
+ myErrorStatus = ShHealOper_InvalidParameters;
+ return myDone;
+ }
+ myDivideParamMode = true;
+ myEdge = TopoDS::Edge(theEdge);
+ Handle(TColStd_HSequenceOfReal) aSeqValues = new TColStd_HSequenceOfReal;
+
+ double aFirst,aLast;
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(myEdge,aFirst,aLast);
+ if ( aCurve.IsNull() ) return false;
+ GeomAPI_ProjectPointOnCurve aProjector;
+ aProjector.Init( aCurve, aFirst, aLast );
+
+ TopTools_MapOfShape vMap;
+ TopExp_Explorer vertex( thePoints, TopAbs_VERTEX );
+ std::set< double > params; // to exclude equal params
+ for ( ; vertex.More(); vertex.Next() )
+ {
+ if ( !vMap.Add( vertex.Current() )) continue;
+ gp_Pnt p = BRep_Tool::Pnt( TopoDS::Vertex( vertex.Current() ));
+ aProjector.Perform( p );
+ if ( aProjector.NbPoints() > 0 )
+ {
+ double u = double( aProjector.LowerDistanceParameter() );
+ double param = ( u - aFirst ) / ( aLast - aFirst );
+ params.insert( param );
+ }
+ }
+ // remove too close params
+ params.insert( 0 );
+ params.insert( 1 );
+ std::set< double >::iterator p2 = params.begin(), p1 = p2++;
+ while ( p2 != params.end() )
+ {
+ if ( Abs( *p2 - *p1 ) < 1e-3 ) // compare normalized params
+ params.erase( p1 );
+ p1 = p2++;
+ }
+ p1 = params.begin(); ++p1; // skip aFirst
+ p2 = params.end(); --p2; // skip aLast
+ for ( ; p1 != p2; ++p1 )
+ aSeqValues->Append( *p1 );
+
+ myDone = build(aSeqValues);
+ return myDone;
+}
+//=======================================================================
+//function : build
+//purpose :
+//=======================================================================
+
Standard_Boolean ShHealOper_EdgeDivide::build(const Handle(TColStd_HSequenceOfReal)& theValues)
{
if(myEdge.IsNull() || !theValues->Length()) {
return Standard_False;
}
- Standard_Boolean has3d = Standard_False,
- has2d = Standard_False,
- hasPCurves = Standard_False;
-
+ Standard_Boolean has3d = Standard_False,
+ has2d = Standard_False,
+ hasPCurves = Standard_False;
+
//computation of the split values in dependance from specified mode and values.
if(!computeValues(theValues, has3d,has2d,hasPCurves)) {
myErrorStatus = ShHealOper_InvalidParameters;
return Standard_False;
}
-
+
//setting split values in the splitting curve tools.
Handle(ShapeUpgrade_WireDivide) aSplitTool = new ShapeUpgrade_WireDivide;
aSplitTool->Load(myEdge);
myErrorStatus = ShHealOper_InvalidParameters;
return Standard_False;
}
-
+
//split 3d curve and pcurve for each face reffering to edge.
Standard_Boolean isDone = Standard_True;
if(hasPCurves) {
myErrorStatus = ShHealOper_ErrorExecution;
}
if(isDone)
+ {
myResultShape = myContext->Apply(myInitShape);
+ myStatistics.AddModif("Vertex added on edge", theValues->Length() );
+ }
return isDone;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#ifndef ShHealOper_EdgeDivide_HeaderFile
#define ShHealOper_EdgeDivide_HeaderFile
+#include <ShHealOper_Tool.hxx>
#include <TColStd_HSequenceOfReal.hxx>
+#include <TColStd_SequenceOfReal.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopoDS_Edge.hxx>
-#include <TopoDS_Shape.hxx>
-#include <ShHealOper_Tool.hxx>
-#include <TColStd_SequenceOfReal.hxx>
/// Class ShHealOper_EdgeDivide
//Intended for spitting edge in accordance to the specified mode and value.
//specified mode and value.
//If theDivideParamMode is equal to true edge will be splitted by parameter.
//Else edge will be spliited by length (default true).
- //theValue is koefficient for splitting from 0 to 1.
+ //theValue is coefficient for splitting from 0 to 1.
Standard_EXPORT Standard_Boolean Perform(const TopoDS_Shape& theEdge,
const TColStd_SequenceOfReal& theValues,
//Performs spitting of the specified edge in the accoradnce to
//specified mode and sequence of values the same way as previous.
- protected:
+ Standard_EXPORT Standard_Boolean Perform(const TopoDS_Shape& theEdge,
+ const TopoDS_Shape& thePoint);
+ //Performs spitting of the specified edge by projecting a point to it.
+
+protected:
// ---------- PROTECTED METHODS ----------
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
myDone = (addFace(aSurf,aWire,aCurves2d,aOrders,aSenses) || myDone);
}
if(myDone)
+ {
myResultShape = myContext->Apply(myResultShape);
+ myStatistics.AddModif( "Face created to fill hole" , aSeqWires->Length() );
+ }
return myDone;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+// File : ShHealOper_ModifStats.hxx
+// Created : Mon Dec 1 15:29:48 2014
+
+#ifndef __ShHealOper_ModifStats_HXX__
+#define __ShHealOper_ModifStats_HXX__
+
+#include <string>
+#include <set>
+
+/*!
+ * \brief Structure describing modifications done in a shape
+ */
+class Standard_EXPORT ShHealOper_ModifStats
+{
+ public:
+
+ struct Standard_EXPORT Datum
+ {
+ std::string myModif; // what is done
+ mutable int myCount; // how many times (in how many sub-shapes)
+
+ Datum( const std::string& txt, int cnt=0 ): myModif( txt ), myCount(cnt) {}
+ bool operator< ( const Datum& o ) const { return myModif < o.myModif; }
+ };
+
+ // record a modification
+ void AddModif( const std::string& modifText, int nb=1 )
+ {
+ std::set< Datum >::iterator d = myData.insert( Datum( modifText )).first;
+ d->myCount += nb;
+ }
+
+ // add data from another ShHealOper_ModifStats
+ void Add( const ShHealOper_ModifStats& stats )
+ {
+ if ( myData.empty() ) myData = stats.myData;
+ else {
+ std::set< Datum >::const_iterator d = stats.myData.begin();
+ for ( ; d != stats.myData.end(); ++d )
+ AddModif( d->myModif, d->myCount );
+ }
+ }
+
+ // return all recorder modifications
+ const std::set< Datum >& GetData() const { return myData; }
+
+ // clear all statistics
+ void Clear() { myData.clear(); }
+
+ protected:
+
+ std::set< Datum > myData;
+
+};
+
+#endif
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
}
}
}
+ if ( isremove )
+ myStatistics.AddModif( "Wire removed" );
+
return isremove;
}
//=======================================================================
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_MapOfShape.hxx>
+
+namespace
+{
+ bool cmpNbSubShapes( const TopoDS_Shape& s1, const TopoDS_Shape& s2, TopAbs_ShapeEnum t)
+ {
+ int nbNew = 0, nbOld = 0;
+ TopExp_Explorer exp;
+ TopTools_MapOfShape shMap;
+ for ( exp.Init( s1, t ); exp.More(); exp.Next() ) if ( shMap.Add( exp.Current() ) ) ++nbNew;
+ shMap.Clear();
+ for ( exp.Init( s2, t ); exp.More(); exp.Next() ) if ( shMap.Add( exp.Current() ) ) ++nbOld;
+ return nbNew != nbOld;
+ }
+}
+
//=======================================================================
//function : ShHealOper_Sewing()
//purpose : Constructor
//=======================================================================
-
ShHealOper_Sewing::ShHealOper_Sewing (const TopoDS_Shape& theShape,
const Standard_Real theTolerance)
{
Standard_Boolean ShHealOper_Sewing::isSewed(const TopoDS_Shape& theShape) const
{
- Standard_Integer nbNewShells =0;
- Standard_Integer nbOldShells =0;
- TopExp_Explorer aExpShells(theShape,TopAbs_SHELL);
- for( ; aExpShells.More(); aExpShells.Next())
- nbNewShells++;
- for( aExpShells.Init(myInitShape,TopAbs_SHELL); aExpShells.More(); aExpShells.Next())
- nbOldShells++;
- return (nbNewShells != nbOldShells);
+ return cmpNbSubShapes( theShape, myInitShape, TopAbs_SHELL ) ||
+ cmpNbSubShapes( theShape, myInitShape, TopAbs_EDGE ) ||
+ cmpNbSubShapes( theShape, myInitShape, TopAbs_VERTEX );
}
+
//=======================================================================
//function : deleteFreeEdges
//purpose :
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TopoDS_Iterator.hxx>
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
#include <TNaming_CopyShape.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
+#include <ShapeExtend_MsgRegistrator.hxx>
+#include <ShapeExtend_DataMapOfShapeListOfMsg.hxx>
+#include <ShapeExtend_DataMapIteratorOfDataMapOfShapeListOfMsg.hxx>
+#include <Message_ListOfMsg.hxx>
+#include <Message_ListIteratorOfListOfMsg.hxx>
+#include <Message_Msg.hxx>
//=======================================================================
//function : ShHealOper_ShapeProcess()
//myResource = new Resource_Manager("ShHealing");
myPrefix = "ShapeProcess";
mySaveHistoryMode = Standard_False;
- myLevel = TopAbs_FACE;
+ myLevel = TopAbs_EDGE;
myDone = Standard_False;
+ myOperations.Context()->SetDetalisation ( TopAbs_EDGE );
}
//=======================================================================
ShHealOper_ShapeProcess::ShHealOper_ShapeProcess (const TCollection_AsciiString& theNameResource,
const TCollection_AsciiString& thePrefix ) :
- myOperations(theNameResource.ToCString(),thePrefix.ToCString())
+ myOperations(theNameResource.ToCString(),thePrefix.ToCString())
{
//myResource = new Resource_Manager(theNameResource);
myPrefix = thePrefix;
mySaveHistoryMode = Standard_False;
- myLevel = TopAbs_FACE;
+ myLevel = TopAbs_EDGE;
myDone = Standard_False;
}
//=======================================================================
//function : Perform
-//purpose :
+//purpose :
//=======================================================================
-void ShHealOper_ShapeProcess::Perform(const TopoDS_Shape& theOldShape,
- TopoDS_Shape& theNewShape)
+void ShHealOper_ShapeProcess::Perform(const TopoDS_Shape& theOldShape,
+ TopoDS_Shape& theNewShape)
{
-
myMapModifications.Clear();
//ShapeProcessAPI_ApplySequence aOperations(myResource,myPrefix.ToCString());
//myDone = Standard_False;
myDone = !anOldShape.IsSame(theNewShape);
if(!myDone) {
Standard_Real aendTol =aSatol.Tolerance(theNewShape,0);
- myDone = (fabs(ainitTol - aendTol) > Precision::Confusion());
+ myDone = (fabs(ainitTol - aendTol) > Precision::Confusion());
+ if ( myDone ) {
+ if ( ainitTol > aendTol )
+ myStatistics.AddModif( "Tolerance fixed (decreased)" );
+ else
+ myStatistics.AddModif( "Tolerance fixed (increased)" );
+ }
+ }
+
+ // fill myStatistics with messages
+ Handle(ShapeExtend_MsgRegistrator) msg = myOperations.Context()->Messages();
+ const ShapeExtend_DataMapOfShapeListOfMsg& shape2msg = msg->MapShape();
+ ShapeExtend_DataMapIteratorOfDataMapOfShapeListOfMsg s2msg( shape2msg );
+ for ( ; s2msg.More(); s2msg.Next() )
+ {
+ const Message_ListOfMsg & msgList = s2msg.Value();
+ Message_ListIteratorOfListOfMsg mIt( msgList );
+ for ( ; mIt.More(); mIt.Next() )
+ {
+ Message_Msg& m = mIt.Value();
+ TCollection_AsciiString txt = m.Get();
+ myStatistics.AddModif( txt.ToCString() );
+ }
}
}
+
//=======================================================================
//function : SetOperators
-//purpose :
+//purpose :
//=======================================================================
void ShHealOper_ShapeProcess::SetOperators(const TColStd_SequenceOfAsciiString& theSeqOperators)
//purpose :
//=======================================================================
-void ShHealOper_ShapeProcess::SetParameter(const TCollection_AsciiString& theNameParam,
- const TCollection_AsciiString& theVal)
+void ShHealOper_ShapeProcess::SetParameter(const TCollection_AsciiString& theNameParam,
+ const TCollection_AsciiString& theVal)
{
TCollection_AsciiString anameParam(myPrefix);
anameParam += ".";
anameParam+= theNameParam;
- if(theVal.IsIntegerValue())
- myOperations.Context()->ResourceManager()->
- SetResource(anameParam.ToCString(),theVal.IntegerValue());
- else if(theVal.IsRealValue())
+ if(theVal.IsRealValue())
myOperations.Context()->ResourceManager()->
SetResource(anameParam.ToCString(),theVal.RealValue());
+ else if(theVal.IsIntegerValue())
+ myOperations.Context()->ResourceManager()->
+ SetResource(anameParam.ToCString(),theVal.IntegerValue());
else
myOperations.Context()->ResourceManager()->
SetResource(anameParam.ToCString(),theVal.ToCString());
//=======================================================================
Standard_Boolean ShHealOper_ShapeProcess::GetParameter(const TCollection_AsciiString& theNameParam,
- TCollection_AsciiString& theVal)
+ TCollection_AsciiString& theVal)
{
TCollection_AsciiString namePar(myPrefix);
namePar += ".";
namePar += theNameParam;
if(!myOperations.Context()->ResourceManager()->Find(namePar.ToCString()))
return Standard_False;
-
+
theVal = myOperations.Context()->ResourceManager()->Value(namePar.ToCString());
return Standard_True;
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <ShapeProcessAPI_ApplySequence.hxx>
#include <ShapeProcess_ShapeContext.hxx>
+#include "ShHealOper_Tool.hxx"
+
/// Class ShHealOper_ShapeProcess
//Class for performing Shape healing operations on the shape.
-class ShHealOper_ShapeProcess
+class ShHealOper_ShapeProcess : public ShHealOper_Tool
{
public:
// ---------- PUBLIC METHODS ----------
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
myErrorStatus =ShHealOper_NotError;
myInitShape = theShape;
myContext->Apply(myInitShape);
+ myStatistics.Clear();
}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#ifndef ShHealOper_Tool_HeaderFile
#define ShHealOper_Tool_HeaderFile
-#include <MMgt_TShared.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <TopoDS_Shape.hxx>
+#include "ShHealOper_ModifStats.hxx"
+
/// Class ShHealOper_Tool
//
//enumeration for definition of the status of the error if operation failed
}
//Returns modified shape obtained after operation from initial shape.
- inline Standard_Boolean IsDone() const
+ inline Standard_Boolean IsDone() const
{
return myDone;
}
//Returns status of the operation.
-
+
inline void SetContext(Handle(ShapeBuild_ReShape)& theContext)
{
myContext = theContext;
{
return myErrorStatus;
}
- protected:
+
+ ShHealOper_ModifStats& GetStatistics()
+ {
+ return myStatistics;
+ }
+
+ const ShHealOper_ModifStats& GetStatistics() const
+ {
+ return myStatistics;
+ }
+ // Returns statistics of what is done
+
+protected:
// ---------- PROTECTED FIELDS ----------
Handle(ShapeBuild_ReShape) myContext;
- TopoDS_Shape myInitShape;
- TopoDS_Shape myResultShape;
- Standard_Boolean myDone;
- ShHealOper_Error myErrorStatus;
- public:
-// Declaration of CASCADE RTTI
-//DEFINE_STANDARD_RTTI (ShHealOper_Tool)
+ TopoDS_Shape myInitShape;
+ TopoDS_Shape myResultShape;
+ Standard_Boolean myDone;
+ ShHealOper_Error myErrorStatus;
+ ShHealOper_ModifStats myStatistics;
+
+public:
+ // Declaration of CASCADE RTTI
+ //DEFINE_STANDARD_RTTI (ShHealOper_Tool)
};
// Definition of HANDLE object using Standard_DefineHandle.hxx
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
SET(TransformationGUI_HEADERS
TransformationGUI.h
+ TransformationGUI_ExtensionDlg.h
TransformationGUI_MultiTranslationDlg.h
TransformationGUI_MultiRotationDlg.h
TransformationGUI_TranslationDlg.h
TransformationGUI_ScaleDlg.h
TransformationGUI_OffsetDlg.h
TransformationGUI_ProjectionDlg.h
+ TransformationGUI_ProjectionOnCylDlg.h
TransformationGUI_PositionDlg.h
)
# header files / to be processed by moc
SET(_moc_HEADERS
+ TransformationGUI_ExtensionDlg.h
TransformationGUI_MultiTranslationDlg.h
TransformationGUI_MultiRotationDlg.h
TransformationGUI_TranslationDlg.h
TransformationGUI_ScaleDlg.h
TransformationGUI_OffsetDlg.h
TransformationGUI_ProjectionDlg.h
+ TransformationGUI_ProjectionOnCylDlg.h
TransformationGUI_PositionDlg.h
)
SET(TransformationGUI_SOURCES
TransformationGUI.cxx
+ TransformationGUI_ExtensionDlg.cxx
TransformationGUI_MultiTranslationDlg.cxx
TransformationGUI_MultiRotationDlg.cxx
TransformationGUI_TranslationDlg.cxx
TransformationGUI_ScaleDlg.cxx
TransformationGUI_OffsetDlg.cxx
TransformationGUI_ProjectionDlg.cxx
+ TransformationGUI_ProjectionOnCylDlg.cxx
TransformationGUI_PositionDlg.cxx
${_moc_SOURCES}
${_uic_files}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <SalomeApp_Study.h>
#include <SALOME_ListIO.hxx>
+#include "TransformationGUI_ExtensionDlg.h" // Method EXTENSION
#include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION
#include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION
#include "TransformationGUI_TranslationDlg.h" // Method TRANSLATION
#include "TransformationGUI_OffsetDlg.h" // Method OFFSET
#include "TransformationGUI_ProjectionDlg.h" // Method PROJECTION
#include "TransformationGUI_PositionDlg.h" // Method POSITION
+#include "TransformationGUI_ProjectionOnCylDlg.h" // Method PROJECTION ON CYLINDER
//=======================================================================
// function : TransformationGUI()
case GEOMOp::OpProjection: // PROJECTION
aDlg = new TransformationGUI_ProjectionDlg( getGeometryGUI(), parent );
break;
+ case GEOMOp::OpProjOnCyl: // PROJECTION ON CYLINDER
+ aDlg = new TransformationGUI_ProjectionOnCylDlg( getGeometryGUI(), parent );
+ break;
case GEOMOp::OpMultiTranslate: // MULTI TRANSLATION
aDlg = new TransformationGUI_MultiTranslationDlg( getGeometryGUI(), parent );
break;
} // for (; aSelIt.More(); aSelIt.Next())
}
break;
+ case GEOMOp::OpExtension: // EXTENSION
+ aDlg = new TransformationGUI_ExtensionDlg( getGeometryGUI(), parent );
+ break;
default:
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
break;
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : TransformationGUI_ExtensionDlg.cxx
+// Author : Sergey KHROMOV, Open CASCADE S.A.S.
+
+#include "TransformationGUI_ExtensionDlg.h"
+#include <GEOMBase.h>
+#include <GeometryGUI.h>
+#include <GEOMImpl_Types.hxx>
+
+#include <SalomeApp_Application.h>
+#include <SalomeApp_DoubleSpinBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <LightApp_SelectionMgr.h>
+
+#include <TColStd_MapOfInteger.hxx>
+
+#include <QApplication>
+#include <QGridLayout>
+#include <QGroupBox>
+#include <QLabel>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QRadioButton>
+
+
+//=================================================================================
+// class : TransformationGUI_ExtensionDlg
+// purpose :
+//=================================================================================
+TransformationGUI_ExtensionDlg::TransformationGUI_ExtensionDlg
+ (GeometryGUI* theGeometryGUI, QWidget* parent,
+ bool modal, Qt::WindowFlags fl)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
+ myObjLbl (0),
+ myUMinLbl (0),
+ myUMaxLbl (0),
+ myVMinLbl (0),
+ myVMaxLbl (0),
+ mySelButton (0),
+ myEditObjName (0),
+ myUMinSpinBox (0),
+ myUMaxSpinBox (0),
+ myVMinSpinBox (0),
+ myVMaxSpinBox (0)
+{
+ QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
+ QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_EXTEND_EDGE")));
+ QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_EXTEND_FACE")));
+
+ setWindowTitle(tr("GEOM_EXTENSION_TITLE"));
+
+ /***************************************************************/
+ mainFrame()->GroupConstructors->setTitle(tr ("GEOM_EXTENSION"));
+ mainFrame()->RadioButton1->setIcon(image1);
+ mainFrame()->RadioButton2->setIcon(image2);
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton3->close();
+
+ QGroupBox *aGrp = new QGroupBox(tr("GEOM_ARGUMENTS"));
+
+ myObjLbl = new QLabel;
+ myUMinLbl = new QLabel;
+ myUMaxLbl = new QLabel;
+ myVMinLbl = new QLabel;
+ myVMaxLbl = new QLabel;
+ mySelButton = new QPushButton;
+ myEditObjName = new QLineEdit;
+ myUMinSpinBox = new SalomeApp_DoubleSpinBox;
+ myUMaxSpinBox = new SalomeApp_DoubleSpinBox;
+ myVMinSpinBox = new SalomeApp_DoubleSpinBox;
+ myVMaxSpinBox = new SalomeApp_DoubleSpinBox;
+
+ myVMinLbl->setText(tr("GEOM_EXTENSION_MIN_V"));
+ myVMaxLbl->setText(tr("GEOM_EXTENSION_MAX_V"));
+ mySelButton->setIcon(image0);
+
+ QGridLayout *aGrpLayout = new QGridLayout(aGrp);
+
+ aGrpLayout->setMargin(9);
+ aGrpLayout->setSpacing(6);
+ aGrpLayout->addWidget(myObjLbl, 0, 0);
+ aGrpLayout->addWidget(myUMinLbl, 1, 0);
+ aGrpLayout->addWidget(myUMaxLbl, 2, 0);
+ aGrpLayout->addWidget(myVMinLbl, 3, 0);
+ aGrpLayout->addWidget(myVMaxLbl, 4, 0);
+ aGrpLayout->addWidget(mySelButton, 0, 1);
+ aGrpLayout->addWidget(myEditObjName, 0, 2);
+ aGrpLayout->addWidget(myUMinSpinBox, 1, 1, 1, 2);
+ aGrpLayout->addWidget(myUMaxSpinBox, 2, 1, 1, 2);
+ aGrpLayout->addWidget(myVMinSpinBox, 3, 1, 1, 2);
+ aGrpLayout->addWidget(myVMaxSpinBox, 4, 1, 1, 2);
+
+ myVMinLbl->hide();
+ myVMaxLbl->hide();
+ myVMinSpinBox->hide();
+ myVMaxSpinBox->hide();
+
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ layout->setMargin(0); layout->setSpacing(6);
+ layout->addWidget(aGrp);
+ /***************************************************************/
+
+ setHelpFileName("extension_operation_page.html");
+
+ /* Initialisations */
+ Init();
+}
+
+//=================================================================================
+// function : ~GenerationGUI_FillingDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+TransformationGUI_ExtensionDlg::~TransformationGUI_ExtensionDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void TransformationGUI_ExtensionDlg::Init()
+{
+ /* init variables */
+ showOnlyPreviewControl();
+ myEditCurrentArgument = myEditObjName;
+
+ double aStep = 0.1;
+ /* min, max, step and decimals for spin boxes & initial values */
+ initSpinBox(myUMinSpinBox, -MAX_NUMBER, MAX_NUMBER, aStep, "parametric_precision");
+ initSpinBox(myUMaxSpinBox, -MAX_NUMBER, MAX_NUMBER, aStep, "parametric_precision");
+ initSpinBox(myVMinSpinBox, -MAX_NUMBER, MAX_NUMBER, aStep, "parametric_precision");
+ initSpinBox(myVMaxSpinBox, -MAX_NUMBER, MAX_NUMBER, aStep, "parametric_precision");
+
+ myUMinSpinBox->setValue(0.);
+ myUMaxSpinBox->setValue(1.);
+ myVMinSpinBox->setValue(0.);
+ myVMaxSpinBox->setValue(1.);
+
+ /* signals and slots connections */
+ connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+ connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+
+ connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
+
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(mySelButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+ connect(myUMinSpinBox, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(myUMaxSpinBox, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(myVMinSpinBox, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(myVMaxSpinBox, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
+
+ connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+
+ initName(tr("GEOM_EXTENSION_EDGE_NAME"));
+ resize(100,100);
+
+ ConstructorsClicked(0);
+}
+
+//=================================================================================
+// function : SetDoubleSpinBoxStep()
+// purpose : Double spin box management
+//=================================================================================
+void TransformationGUI_ExtensionDlg::SetDoubleSpinBoxStep(double step)
+{
+ myUMinSpinBox->setSingleStep(step);
+ myUMaxSpinBox->setSingleStep(step);
+ myVMinSpinBox->setSingleStep(step);
+ myVMaxSpinBox->setSingleStep(step);
+}
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void TransformationGUI_ExtensionDlg::ConstructorsClicked (int constructorId)
+{
+ switch (constructorId) {
+ case 0: // Extend edge
+ {
+ TColStd_MapOfInteger aMap;
+
+ aMap.Add(GEOM_EDGE);
+ globalSelection(aMap);
+
+ myObjLbl->setText(tr("GEOM_EDGE"));
+ myUMinLbl->setText(tr("GEOM_EXTENSION_MIN"));
+ myUMaxLbl->setText(tr("GEOM_EXTENSION_MAX"));
+ myVMinLbl->hide();
+ myVMaxLbl->hide();
+ myVMinSpinBox->hide();
+ myVMaxSpinBox->hide();
+
+ initName(tr("GEOM_EXTENSION_EDGE_NAME"));
+
+ break;
+ }
+ case 1: // Extend face
+ {
+ TColStd_MapOfInteger aMap;
+
+ aMap.Add(GEOM_FACE);
+ globalSelection(aMap);
+
+ myObjLbl->setText(tr("GEOM_FACE"));
+ myUMinLbl->setText(tr("GEOM_EXTENSION_MIN_U"));
+ myUMaxLbl->setText(tr("GEOM_EXTENSION_MAX_U"));
+ myVMinLbl->show();
+ myVMaxLbl->show();
+ myVMinSpinBox->show();
+ myVMaxSpinBox->show();
+
+ initName(tr("GEOM_EXTENSION_FACE_NAME"));
+
+ break;
+ }
+ default:
+ break;
+ }
+
+ myBase.nullify();
+ qApp->processEvents();
+ updateGeometry();
+ resize(minimumSizeHint());
+
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void TransformationGUI_ExtensionDlg::ClickOnOk()
+{
+ setIsApplyAndClose(true);
+ if (ClickOnApply())
+ ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool TransformationGUI_ExtensionDlg::ClickOnApply()
+{
+ if (!onAccept())
+ return false;
+
+ initName();
+
+ return true;
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection as changed or other case
+//=================================================================================
+void TransformationGUI_ExtensionDlg::SelectionIntoArgument()
+{
+ erasePreview();
+ myEditCurrentArgument->setText("");
+
+ if (myEditCurrentArgument == myEditObjName) {
+ const TopAbs_ShapeEnum aType =
+ getConstructorId() == 0 ? TopAbs_EDGE: TopAbs_FACE;
+ GEOM::GeomObjPtr aSelectedObject = getSelected(aType);
+
+ if (aSelectedObject) {
+ myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject.get()));
+ myBase = aSelectedObject;
+ } else {
+ myBase.nullify();
+ }
+ }
+
+ processPreview();
+}
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void TransformationGUI_ExtensionDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ if (send == mySelButton) {
+ myEditObjName->setFocus();
+ myEditCurrentArgument = myEditObjName;
+ SelectionIntoArgument();
+ }
+}
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void TransformationGUI_ExtensionDlg::ActivateThisDialog()
+{
+ GEOMBase_Skeleton::ActivateThisDialog();
+ connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+
+ ConstructorsClicked(getConstructorId());
+}
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void TransformationGUI_ExtensionDlg::enterEvent(QEvent*)
+{
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
+}
+
+//=================================================================================
+// function : ValueChangedInSpinBox()
+// purpose :
+//=================================================================================
+void TransformationGUI_ExtensionDlg::ValueChangedInSpinBox(double newValue)
+{
+ processPreview();
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr TransformationGUI_ExtensionDlg::createOperation()
+{
+ return getGeomEngine()->GetIShapesOperations(getStudyId());
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool TransformationGUI_ExtensionDlg::isValid(QString& msg)
+{
+ bool ok = (myUMinSpinBox->isValid(msg, !IsPreview()) &&
+ myUMaxSpinBox->isValid(msg, !IsPreview()) &&
+ myVMinSpinBox->isValid(msg, !IsPreview()) &&
+ myVMaxSpinBox->isValid(msg, !IsPreview()) &&
+ myBase);
+ return ok;
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool TransformationGUI_ExtensionDlg::execute(ObjectList& objects)
+{
+ bool res = false;
+ GEOM::GEOM_IShapesOperations_var anOper =
+ GEOM::GEOM_IShapesOperations::_narrow(getOperation());
+ GEOM::GEOM_Object_var anObj;
+
+ switch (getConstructorId()) {
+ case 0:
+ anObj = anOper->ExtendEdge(myBase.get(), myUMinSpinBox->value(),
+ myUMaxSpinBox->value());
+ if (!anObj->_is_nil() && !IsPreview())
+ {
+ QStringList aParameters;
+ aParameters << myUMinSpinBox->text();
+ aParameters << myUMaxSpinBox->text();
+ anObj->SetParameters(aParameters.join(":").toUtf8().constData());
+ }
+ res = true;
+ break;
+ case 1:
+ anObj = anOper->ExtendFace(myBase.get(), myUMinSpinBox->value(),
+ myUMaxSpinBox->value(),
+ myVMinSpinBox->value(),
+ myVMaxSpinBox->value());
+ if (!anObj->_is_nil() && !IsPreview())
+ {
+ QStringList aParameters;
+ aParameters << myUMinSpinBox->text();
+ aParameters << myUMaxSpinBox->text();
+ aParameters << myVMinSpinBox->text();
+ aParameters << myVMaxSpinBox->text();
+ anObj->SetParameters(aParameters.join(":").toUtf8().constData());
+ }
+ res = true;
+ break;
+ default:
+ break;
+ }
+
+ if (!anObj->_is_nil()) {
+ objects.push_back(anObj._retn());
+ }
+
+ return res;
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> TransformationGUI_ExtensionDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myBase;
+ return res;
+}
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : TransformationGUI_ExtensionDlg.h
+// Author : Sergey KHROMOV, Open CASCADE S.A.S.
+//
+#ifndef TRANSFORMATIONGUI_EXTENSIONDLG_H
+#define TRANSFORMATIONGUI_EXTENSIONDLG_H
+
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
+
+class DlgRef_3Sel4Spin2Check;
+
+/**
+ * This is a dialog for ExtendEdge and ExtendFace functionality
+ */
+class TransformationGUI_ExtensionDlg : public GEOMBase_Skeleton
+{
+ Q_OBJECT
+
+public:
+ TransformationGUI_ExtensionDlg(GeometryGUI*, QWidget* = 0,
+ bool = false, Qt::WindowFlags = 0);
+ ~TransformationGUI_ExtensionDlg();
+
+protected:
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid( QString& );
+ virtual bool execute( ObjectList& );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
+
+private:
+ void Init();
+ void enterEvent(QEvent *);
+
+private:
+
+ QLabel *myObjLbl;
+ QLabel *myUMinLbl;
+ QLabel *myUMaxLbl;
+ QLabel *myVMinLbl;
+ QLabel *myVMaxLbl;
+ QPushButton *mySelButton;
+ QLineEdit *myEditObjName;
+ SalomeApp_DoubleSpinBox *myUMinSpinBox;
+ SalomeApp_DoubleSpinBox *myUMaxSpinBox;
+ SalomeApp_DoubleSpinBox *myVMinSpinBox;
+ SalomeApp_DoubleSpinBox *myVMaxSpinBox;
+ GEOM::GeomObjPtr myBase;
+
+private slots:
+ void ClickOnOk();
+ bool ClickOnApply();
+ void ActivateThisDialog();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
+ void ValueChangedInSpinBox( double );
+ void ConstructorsClicked( int );
+ void SetDoubleSpinBoxStep( double );
+};
+
+#endif // TRANSFORMATIONGUI_EXTENSIONDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
switch (getConstructorId()) {
case 0:
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
break;
case 1:
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
break;
case 2:
globalSelection(GEOM_PLANE);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE);
+ localSelection(TopAbs_FACE);
break;
}
}
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> TransformationGUI_MirrorDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ if ( GroupPoints->CheckButton1->isChecked() ) {
+ res.append(myObjects);
+ res << myArgument;
+ }
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
else if (send == GroupArgs->PushButton2) {
myEditCurrentArgument = GroupArgs->LineEdit2;
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
GroupArgs->PushButton1->setDown(false);
GroupArgs->LineEdit1->setEnabled(false);
}
}
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> TransformationGUI_MultiRotationDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myBase << myVector;
+ return res;
+}
+
//=================================================================================
// function : restoreSubShapes
// purpose :
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
GroupPoints->PushButton1->setDown(false);
GroupPoints->LineEdit1->setEnabled(false);
else if (send == GroupDimensions->PushButton2) {
myEditCurrentArgument = GroupDimensions->LineEdit2;
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
GroupDimensions->PushButton1->setDown(false);
GroupDimensions->PushButton3->setDown(false);
else if (send == GroupDimensions->PushButton3) {
myEditCurrentArgument = GroupDimensions->LineEdit3;
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
GroupDimensions->PushButton1->setDown(false);
GroupDimensions->PushButton2->setDown(false);
}
}
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> TransformationGUI_MultiTranslationDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myBase << myVectorU << myVectorV;
+ return res;
+}
+
//=================================================================================
// function : restoreSubShapes
// purpose :
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
{
mainFrame()->GroupBoxName->setEnabled( GroupPoints->CheckButton1->isChecked() );
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> TransformationGUI_OffsetDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ if ( GroupPoints->CheckButton1->isChecked() )
+ res.append( myObjects );
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
void TransformationGUI_PositionDlg::SelectionTypeButtonClicked()
{
if ( Group1->CheckButton2->isChecked() ) {
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
} else {
TColStd_MapOfInteger aMap;
aMap.Add(GEOM_WIRE);
Group1->CheckButton2->setEnabled(true);
if ( Group1->CheckButton2->isChecked() ) {
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
} else {
TColStd_MapOfInteger aMap;
aMap.Add(GEOM_WIRE);
if ( getConstructorId() == 2 )
GEOMBase::PublishSubObject( myPath.get() );
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> TransformationGUI_PositionDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ if ( Group1->CheckButton1->isChecked() ) {
+ res.append(myObjects);
+ res << myStartLCS << myEndLCS << myPath;
+ }
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool execute( ObjectList& );
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TColStd_MapOfInteger.hxx>
+namespace
+{
+ enum EOperationType { PROJ_ON_FACE = 0, PROJ_ON_WIRE, PROJ_ON_EDGE };
+}
+
//=================================================================================
// class : TransformationGUI_ProjectionDlg()
// purpose : Constructs a TransformationGUI_ProjectionDlg which is a child of 'parent', with the
QWidget* parent, bool modal, Qt::WindowFlags fl)
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl)
{
- QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PROJECTION")));
QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
+ QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PROJECTION_ON_FACE")));
+ QPixmap image3 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PROJECTION_ON_WIRE")));
+ QPixmap image4 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PROJECTION_ON_EDGE")));
setWindowTitle(tr("GEOM_PROJECTION_TITLE"));
- mainFrame()->GroupConstructors->setTitle(tr("GEOM_PROJECTION"));
- mainFrame()->RadioButton1->setIcon(image0);
- mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
- mainFrame()->RadioButton2->close();
- mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
- mainFrame()->RadioButton3->close();
+ mainFrame()->RadioButton1->setIcon(image2);
+ mainFrame()->RadioButton2->setIcon(image3);
+ mainFrame()->RadioButton3->setIcon(image4);
myGroup = new DlgRef_2Sel (centralWidget());
myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
- myGroup->TextLabel1->setText(tr("GEOM_SOURCE_OBJECT"));
- myGroup->TextLabel2->setText(tr("GEOM_TARGET_OBJECT"));
myGroup->PushButton1->setIcon(image1);
myGroup->PushButton2->setIcon(image1);
myGroup->LineEdit1->setReadOnly(true);
showOnlyPreviewControl();
// signals and slots connections
+ connect(this, SIGNAL( constructorsClicked( int )),
+ this, SLOT ( ConstructorsClicked( int )));
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
- initName(mainFrame()->GroupConstructors->title());
+ initName( windowTitle() );
setTabOrder(mainFrame()->GroupConstructors, mainFrame()->GroupBoxName);
setTabOrder(mainFrame()->GroupBoxName, mainFrame()->GroupMedium);
setTabOrder(mainFrame()->GroupMedium, mainFrame()->GroupButtons);
- mainFrame()->RadioButton1->setFocus();
+ //mainFrame()->RadioButton1->setFocus();
+ ConstructorsClicked( 0 );
- globalSelection(GEOM_ALLSHAPES);
-
- myGroup->PushButton1->click();
- SelectionIntoArgument();
resize(100,100);
}
return false;
initName();
- // activate selection and connect selection manager
- myGroup->PushButton1->click();
+ ConstructorsClicked( getConstructorId() );
+
return true;
}
{
myEditCurrentArgument->setText("");
- GEOM::GeomObjPtr aSelectedObject = getSelected(TopAbs_SHAPE);
+ GEOM::GeomObjPtr aSelectedObject;
+ if ( myEditCurrentArgument == myGroup->LineEdit1 ) // what to project
+ switch( getConstructorId() ) {
+ case PROJ_ON_FACE: aSelectedObject = getSelected(TopAbs_SHAPE); break;
+ case PROJ_ON_WIRE:
+ case PROJ_ON_EDGE: aSelectedObject = getSelected(TopAbs_VERTEX); break;
+ default:;
+ }
+ else
+ switch( getConstructorId() ) { // where to project
+ case PROJ_ON_FACE: aSelectedObject = getSelected(TopAbs_FACE); break;
+ case PROJ_ON_WIRE: aSelectedObject = getSelected(TopAbs_WIRE); break;
+ case PROJ_ON_EDGE: aSelectedObject = getSelected(TopAbs_EDGE); break;
+ default:;
+ }
+
TopoDS_Shape aShape;
- if (aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) && !aShape.IsNull()) {
+ if (aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) && !aShape.IsNull())
+ {
QString aName = GEOMBase::GetName(aSelectedObject.get());
myEditCurrentArgument->setText(aName);
if (myEditCurrentArgument == myGroup->LineEdit1) myObject1.nullify();
else if (myEditCurrentArgument == myGroup->LineEdit2) myObject2.nullify();
}
+ processPreview();
}
//=================================================================================
{
QPushButton* send = (QPushButton*)sender();
- if (send == myGroup->PushButton1) {
+ globalSelection(); // close local contexts, if any
+
+ if (send == myGroup->PushButton1) // what to project
+ {
myEditCurrentArgument = myGroup->LineEdit1;
myGroup->PushButton2->setDown(false);
myGroup->LineEdit2->setEnabled(false);
- TColStd_MapOfInteger aMap;
- aMap.Add( GEOM_POINT );
- aMap.Add( GEOM_EDGE );
- aMap.Add( GEOM_WIRE );
- globalSelection( aMap );
+ switch ( getConstructorId() ) {
+ case PROJ_ON_FACE: {
+ TColStd_MapOfInteger aMap;
+ aMap.Add( GEOM_POINT );
+ aMap.Add( GEOM_EDGE );
+ aMap.Add( GEOM_WIRE );
+ globalSelection( aMap );
+ std::list<int> needTypes;
+ needTypes.push_back( TopAbs_VERTEX ), needTypes.push_back( TopAbs_EDGE ), needTypes.push_back( TopAbs_WIRE );
+ localSelection(needTypes);
+ break;
+ }
+ case PROJ_ON_WIRE:
+ case PROJ_ON_EDGE: {
+ localSelection(TopAbs_VERTEX);
+ break;
+ }
+ default:;
+ }
}
- else if (send == myGroup->PushButton2) {
+ else if (send == myGroup->PushButton2) // where to project
+ {
myEditCurrentArgument = myGroup->LineEdit2;
myGroup->PushButton1->setDown(false);
myGroup->LineEdit1->setEnabled(false);
- globalSelection( GEOM_FACE );
+ switch ( getConstructorId() ) {
+ case PROJ_ON_FACE: localSelection(TopAbs_FACE); break;
+ case PROJ_ON_WIRE: localSelection(TopAbs_WIRE); break;
+ case PROJ_ON_EDGE: localSelection(TopAbs_EDGE); break;
+ default:;
+ }
}
// enable line edit
myEditCurrentArgument->setFocus();
// after setFocus(), because it will be setDown(false) when loses focus
send->setDown(true);
+
+ SelectionIntoArgument();
}
//=================================================================================
GEOM::GEOM_Object_var anObj;
GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
- anObj = anOper->ProjectShapeCopy(myObject1.get(), myObject2.get());
+ anObj = anOper->ProjectShapeCopy( myObject1.get(), myObject2.get() );
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
return true;
}
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void TransformationGUI_ProjectionDlg::ConstructorsClicked( int constructorId )
+{
+ myObject1.nullify();
+ myObject2.nullify();
+ myGroup->LineEdit1->setText( "" );
+ myGroup->LineEdit2->setText( "" );
+
+ switch ( constructorId ) {
+ case PROJ_ON_FACE:
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_PROJECTION_ON_FACE"));
+ myGroup->TextLabel1->setText(tr("GEOM_PROJ_ON_FACE_SOURCE"));
+ myGroup->TextLabel2->setText(tr("GEOM_PROJ_ON_FACE_TARGET"));
+ break;
+ case PROJ_ON_EDGE:
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_PROJECTION_ON_EDGE"));
+ myGroup->TextLabel1->setText(tr("GEOM_PROJ_ON_EDGE_SOURCE"));
+ myGroup->TextLabel2->setText(tr("GEOM_PROJ_ON_EDGE_TARGET"));
+ break;
+ case PROJ_ON_WIRE:
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_PROJECTION_ON_WIRE"));
+ myGroup->TextLabel1->setText(tr("GEOM_PROJ_ON_WIRE_SOURCE"));
+ myGroup->TextLabel2->setText(tr("GEOM_PROJ_ON_WIRE_TARGET"));
+ break;
+ default:;
+ }
+ myGroup->PushButton1->click();
+}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_ProjectionDlg::addSubshapesToStudy()
+{
+ GEOMBase::PublishSubObject( myObject1.get() );
+ GEOMBase::PublishSubObject( myObject2.get() );
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> TransformationGUI_ProjectionDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ res << myObject1 << myObject2;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
+ virtual void addSubshapesToStudy();
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
void SetEditCurrentArgument();
void SelectionIntoArgument();
void ActivateThisDialog();
+ void ConstructorsClicked( int constructorId );
};
#endif // TRANSFORMATIONGUI_PROJECTIONDLG_H
--- /dev/null
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : TransformationGUI_ProjectionOnCylDlg.cxx
+// Author : Sergey KHROMOV, Open CASCADE S.A.S.
+
+#include "TransformationGUI_ProjectionOnCylDlg.h"
+
+#include <GeometryGUI.h>
+#include <GEOMBase.h>
+#include <GEOMImpl_Types.hxx>
+
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_DoubleSpinBox.h>
+#include <LightApp_SelectionMgr.h>
+
+#include <QCheckBox>
+#include <QGridLayout>
+#include <QGroupBox>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QRadioButton>
+
+#include <TColStd_MapOfInteger.hxx>
+
+//=================================================================================
+// class : TransformationGUI_ProjectionOnCylDlg()
+// purpose : Constructs a TransformationGUI_ProjectionOnCylDlg which is
+// a child of 'parent', with the name 'name' and widget flags set to
+// 'f'. The dialog will by default be modeless, unless you set
+// 'modal' to TRUE to construct a modal dialog.
+//=================================================================================
+TransformationGUI_ProjectionOnCylDlg::TransformationGUI_ProjectionOnCylDlg
+(GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
+ : GEOMBase_Skeleton (theGeometryGUI, parent, modal, fl),
+ myObjectName (0),
+ mySelButton (0),
+ myRadiusSpin (0),
+ myStartAngleSpin (0),
+ myUseAngleLen (0),
+ myAngleLenSpin (0),
+ myAngleRotSpin (0)
+{
+ SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
+ QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICO_DLG_PROJ_ON_CYL")));
+ QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
+
+ setWindowTitle(tr("GEOM_PROJ_ON_CYL_TITLE"));
+
+ /***************************************************************/
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_PROJECTION_TITLE"));
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton3->close();
+
+ QGroupBox *aGrpParams =
+ new QGroupBox(tr("GEOM_ARGUMENTS"), centralWidget());
+ QGridLayout *aParamsLayout = new QGridLayout(aGrpParams);
+ QLabel *anObjLbl = new QLabel(tr("GEOM_OBJECT"), aGrpParams);
+ QLabel *aRadiusLbl = new QLabel(tr("GEOM_RADIUS"), aGrpParams);
+ QLabel *aStartAngleLbl =
+ new QLabel(tr("GEOM_PROJ_ON_CYL_START_ANGLE"), aGrpParams);
+ QLabel *anAngleLenLbl =
+ new QLabel(tr("GEOM_PROJ_ON_CYL_LENGTH_ANGLE"), aGrpParams);
+ QLabel *anAngleRotLbl =
+ new QLabel(tr("GEOM_PROJ_ON_CYL_ROTATION_ANGLE"), aGrpParams);
+
+ myObjectName = new QLineEdit(aGrpParams);
+ mySelButton = new QPushButton(aGrpParams);
+ myRadiusSpin = new SalomeApp_DoubleSpinBox(aGrpParams);
+ myStartAngleSpin = new SalomeApp_DoubleSpinBox(aGrpParams);
+ myUseAngleLen = new QCheckBox(aGrpParams);
+ myAngleLenSpin = new SalomeApp_DoubleSpinBox(aGrpParams);
+ myAngleRotSpin = new SalomeApp_DoubleSpinBox(aGrpParams);
+
+ myObjectName->setReadOnly(true);
+ mySelButton->setIcon(image1);
+ mySelButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ myUseAngleLen->setChecked(false);
+
+ aParamsLayout->setMargin(9);
+ aParamsLayout->setSpacing(6);
+ aParamsLayout->addWidget(anObjLbl, 0, 1);
+ aParamsLayout->addWidget(mySelButton, 0, 2);
+ aParamsLayout->addWidget(myObjectName, 0, 3);
+ aParamsLayout->addWidget(aRadiusLbl, 1, 1);
+ aParamsLayout->addWidget(myRadiusSpin, 1, 2, 1, 2);
+ aParamsLayout->addWidget(aStartAngleLbl, 2, 1);
+ aParamsLayout->addWidget(myStartAngleSpin, 2, 2, 1, 2);
+ aParamsLayout->addWidget(myUseAngleLen, 3, 0);
+ aParamsLayout->addWidget(anAngleLenLbl, 3, 1);
+ aParamsLayout->addWidget(myAngleLenSpin, 3, 2, 1, 2);
+ aParamsLayout->addWidget(anAngleRotLbl, 4, 1);
+ aParamsLayout->addWidget(myAngleRotSpin, 4, 2, 1, 2);
+
+ QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
+ layout->setMargin( 0 ); layout->setSpacing( 6 );
+ layout->addWidget( aGrpParams );
+
+ /***************************************************************/
+
+ setHelpFileName("projection_on_cylinder_operation_page.html");
+
+ Init();
+}
+
+//=================================================================================
+// function : ~TransformationGUI_ProjectionOnCylDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+TransformationGUI_ProjectionOnCylDlg::~TransformationGUI_ProjectionOnCylDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void TransformationGUI_ProjectionOnCylDlg::Init()
+{
+ showOnlyPreviewControl();
+
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ double aStep = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
+ double aSpecificStep = 5;
+ double aRadius = 100.0;
+ double aStartAngle = 0.;
+ double anAngleLen = 360.;
+ double aRotAngle = 0.;
+
+ initSpinBox(myRadiusSpin, 0.00001, COORD_MAX, aStep, "length_precision");
+ initSpinBox(myStartAngleSpin, -180., 180., aSpecificStep, "angle_precision");
+ initSpinBox(myAngleLenSpin, 0.00001, COORD_MAX, aSpecificStep, "angle_precision");
+ initSpinBox(myAngleRotSpin, -180., 180., aSpecificStep, "angle_precision");
+
+ myRadiusSpin->setValue(aRadius);
+ myStartAngleSpin->setValue(aStartAngle);
+ myAngleLenSpin->setValue(anAngleLen);
+ myAngleRotSpin->setValue(aRotAngle);
+
+ myObjectName->setText("");
+ myUseAngleLen->setChecked(true);
+
+ // signals and slots connections
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+
+ connect(mySelButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(myRadiusSpin, SIGNAL(valueChanged(double)), this, SLOT(processPreview()));
+ connect(myStartAngleSpin, SIGNAL(valueChanged(double)), this, SLOT(processPreview()));
+ connect(myAngleLenSpin, SIGNAL(valueChanged(double)), this, SLOT(processPreview()));
+ connect(myAngleRotSpin, SIGNAL(valueChanged(double)), this, SLOT(processPreview()));
+ connect(myUseAngleLen, SIGNAL(clicked()), this, SLOT(SetUseLengthAngle()));
+
+ connect(myGeomGUI->getApp()->selectionMgr(),SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ initName(tr("GEOM_PROJECTION_NAME"));
+
+ buttonOk()->setEnabled(false);
+ buttonApply()->setEnabled(false);
+
+ activateSelection();
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void TransformationGUI_ProjectionOnCylDlg::ClickOnOk()
+{
+ setIsApplyAndClose( true );
+ if (ClickOnApply())
+ ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool TransformationGUI_ProjectionOnCylDlg::ClickOnApply()
+{
+ if ( !onAccept() )
+ return false;
+
+ initName();
+ return true;
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection is changed or on dialog initialization or activation
+//=================================================================================
+void TransformationGUI_ProjectionOnCylDlg::SelectionIntoArgument()
+{
+ erasePreview();
+ myObj = GEOM::GEOM_Object::_nil();
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ SALOME_ListIO aSelList;
+ aSelMgr->selectedObjects(aSelList);
+
+ if (aSelList.Extent() == 1) {
+ // Single object is selected.
+ GEOM::GEOM_Object_var aSelectedObject =
+ GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
+
+ if (aSelectedObject->_is_nil()) {
+ // Null object.
+ myObjectName->setText("");
+ buttonOk()->setEnabled(false);
+ buttonApply()->setEnabled(false);
+ } else {
+ // Not Null object.
+ myObj = aSelectedObject;
+ myObjectName->setText(GEOMBase::GetName(myObj));
+ buttonOk()->setEnabled(true);
+ buttonApply()->setEnabled(true);
+ }
+ } else {
+ // Not a single object is selected.
+ myObjectName->setText("");
+ buttonOk()->setEnabled(false);
+ buttonApply()->setEnabled(false);
+ }
+
+ processPreview();
+}
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void TransformationGUI_ProjectionOnCylDlg::SetEditCurrentArgument()
+{
+ myObjectName->setFocus();
+ myEditCurrentArgument = myObjectName;
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : SetUseLengthAngle()
+// purpose :
+//=================================================================================
+void TransformationGUI_ProjectionOnCylDlg::SetUseLengthAngle()
+{
+ myAngleLenSpin->setEnabled(myUseAngleLen->isChecked());
+ processPreview();
+}
+
+//=================================================================================
+// function : activateSelection
+// purpose : activate selection of wires or faces
+//=================================================================================
+void TransformationGUI_ProjectionOnCylDlg::activateSelection()
+{
+ TColStd_MapOfInteger aMap;
+
+ aMap.Add(GEOM_WIRE);
+ aMap.Add(GEOM_FACE);
+ globalSelection(aMap);
+}
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void TransformationGUI_ProjectionOnCylDlg::ActivateThisDialog()
+{
+ GEOMBase_Skeleton::ActivateThisDialog();
+ connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( SelectionIntoArgument() ) );
+
+ activateSelection();
+}
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void TransformationGUI_ProjectionOnCylDlg::enterEvent (QEvent*)
+{
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr TransformationGUI_ProjectionOnCylDlg::createOperation()
+{
+ return getGeomEngine()->GetITransformOperations(getStudyId());
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool TransformationGUI_ProjectionOnCylDlg::isValid (QString &msg)
+{
+ bool isOk = false;
+
+ if (!myObj->_is_nil() &&
+ myRadiusSpin->isValid(msg, !IsPreview()) &&
+ myStartAngleSpin->isValid(msg, !IsPreview()) &&
+ myAngleRotSpin->isValid(msg, !IsPreview())) {
+ if (myUseAngleLen->isChecked()) {
+ // Check length angle spin.
+ isOk = myAngleLenSpin->isValid(msg, !IsPreview());
+ } else {
+ // Don't check length angle spin.
+ isOk = true;
+ }
+ }
+
+ return isOk;
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool TransformationGUI_ProjectionOnCylDlg::execute (ObjectList& objects)
+{
+ GEOM::GEOM_ITransformOperations_var anOper =
+ GEOM::GEOM_ITransformOperations::_narrow(getOperation());
+
+ double aRadius = myRadiusSpin->value();
+ double aStartAngle = myStartAngleSpin->value()*M_PI/180.;
+ double aRotAngle = myAngleRotSpin->value()*M_PI/180.;
+ double aLengthAngle = -1.;
+
+ if (myUseAngleLen->isChecked()) {
+ aLengthAngle = myAngleLenSpin->value()*M_PI/180.;
+ }
+
+ GEOM::GEOM_Object_var anObj = anOper->MakeProjectionOnCylinder
+ (myObj, aRadius, aStartAngle, aLengthAngle, aRotAngle);
+
+ if (!anObj->_is_nil()) {
+ if (!IsPreview()) {
+ QStringList aParameters;
+ aParameters << myRadiusSpin->text();
+ aParameters << myStartAngleSpin->text();
+ if (myUseAngleLen->isChecked())
+ aParameters << myAngleLenSpin->text();
+ aParameters << myAngleRotSpin->text();
+ anObj->SetParameters(aParameters.join(":").toUtf8().constData());
+ }
+ objects.push_back(anObj._retn());
+ }
+
+ return true;
+}
--- /dev/null
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : TransformationGUI_ProjectionOnCylDlg.h
+// Author : Sergey KHROMOV, Open CASCADE S.A.S.
+//
+#ifndef TRANSFORMATIONGUI_PROJECTIONONCYLDLG_H
+#define TRANSFORMATIONGUI_PROJECTIONONCYLDLG_H
+
+
+#include "GEOMBase_Skeleton.h"
+
+
+//=================================================================================
+// class : TransformationGUI_ProjectionOnCylDlg
+// purpose :
+//=================================================================================
+class TransformationGUI_ProjectionOnCylDlg : public GEOMBase_Skeleton
+{
+ Q_OBJECT
+
+public:
+ TransformationGUI_ProjectionOnCylDlg(GeometryGUI*, QWidget* = 0,
+ bool = false, Qt::WindowFlags = 0);
+ ~TransformationGUI_ProjectionOnCylDlg();
+
+protected:
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid(QString &msg);
+ virtual bool execute(ObjectList &);
+
+private:
+ void Init();
+ void enterEvent( QEvent* );
+ void activateSelection();
+
+private slots:
+ void ClickOnOk();
+ bool ClickOnApply();
+ void ActivateThisDialog();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
+ void SetUseLengthAngle();
+
+private:
+
+ GEOM::GEOM_Object_var myObj;
+ QLineEdit *myObjectName;
+ QPushButton *mySelButton;
+ SalomeApp_DoubleSpinBox *myRadiusSpin;
+ SalomeApp_DoubleSpinBox *myStartAngleSpin;
+ QCheckBox *myUseAngleLen;
+ SalomeApp_DoubleSpinBox *myAngleLenSpin;
+ SalomeApp_DoubleSpinBox *myAngleRotSpin;
+
+};
+
+#endif // TRANSFORMATIONGUI_PROJECTIONONCYLDLG_H
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
GroupPoints->LineEdit5->setEnabled(false);
if (getConstructorId() == 0)
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
else
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
else if (send == GroupPoints->PushButton4) {
myEditCurrentArgument = GroupPoints->LineEdit4;
GroupPoints->LineEdit2->setEnabled(false);
GroupPoints->LineEdit5->setEnabled(false);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
else if (send == GroupPoints->PushButton5) {
myEditCurrentArgument = GroupPoints->LineEdit5;
GroupPoints->LineEdit2->setEnabled(false);
GroupPoints->LineEdit4->setEnabled(false);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
}
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> TransformationGUI_RotationDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ if ( GroupPoints->CheckButton1->isChecked() ) {
+ res.append(myObjects);
+ res << myAxis << myCentPoint << myPoint1 << myPoint2;
+ }
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
else if (send == PushButton2) {
myEditCurrentArgument = LineEdit2;
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
PushButton1->setDown(false);
LineEdit1->setEnabled(false);
GEOMBase::PublishSubObject( myPoint.get() );
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> TransformationGUI_ScaleDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myObjects);
+ if ( CheckBoxCopy->isChecked() )
+ res << myPoint;
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
GroupPoints->LineEdit3->setEnabled(false);
if (getConstructorId() == 1)
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
else
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
else if (send == GroupPoints->PushButton3) {
myEditCurrentArgument = GroupPoints->LineEdit3;
GroupPoints->LineEdit1->setEnabled(false);
GroupPoints->LineEdit2->setEnabled(false);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
GEOMBase_Helper::displayPreview( aPrs, false, true );
}
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> TransformationGUI_TranslationDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ if ( GroupPoints->CheckBox2->isChecked() ) {
+ res.append(myObjects);
+ res << myVector << myPoint1 << myPoint2;
+ }
+ return res;
+}
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
virtual bool execute( ObjectList& );
virtual void addSubshapesToStudy();
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private:
void Init();
-# Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
MESSAGE( "Export VTK into file " << aFileName );
try
{
- GEOM_VertexSource* myVertexSource = GEOM_VertexSource::New();
- GEOM_EdgeSource* myIsolatedEdgeSource = GEOM_EdgeSource::New();
- GEOM_EdgeSource* myOneFaceEdgeSource = GEOM_EdgeSource::New();
- GEOM_EdgeSource* mySharedEdgeSource = GEOM_EdgeSource::New();
- GEOM_WireframeFace* myWireframeFaceSource = GEOM_WireframeFace::New();
- GEOM_ShadingFace* myShadingFaceSource = GEOM_ShadingFace::New();
-
- vtkAppendPolyData* myAppendFilter = vtkAppendPolyData::New();
- myAppendFilter->AddInputConnection( myVertexSource->GetOutputPort() );
- myAppendFilter->AddInputConnection( myIsolatedEdgeSource->GetOutputPort() );
- myAppendFilter->AddInputConnection( myOneFaceEdgeSource->GetOutputPort() );
- myAppendFilter->AddInputConnection( mySharedEdgeSource->GetOutputPort() );
- //myAppendFilter->AddInputConnection( myWireframeFaceSource->GetOutputPort() ); // iso-lines are unnecessary
- myAppendFilter->AddInputConnection( myShadingFaceSource->GetOutputPort() );
-
- bool anIsVector = false;
-
- // Is shape triangulated?
- bool wasMeshed = true;
- TopExp_Explorer ex;
- TopLoc_Location aLoc;
- for (ex.Init(aShape, TopAbs_FACE); ex.More(); ex.Next()) {
- const TopoDS_Face& aFace = TopoDS::Face(ex.Current());
- Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(aFace,aLoc);
- if(aPoly.IsNull()) {
- wasMeshed = false;
- break;
- }
- }
-
- GEOM::MeshShape( aShape, aDeflection );
-
- TopExp_Explorer aVertexExp( aShape, TopAbs_VERTEX );
- for( ; aVertexExp.More(); aVertexExp.Next() )
- {
- const TopoDS_Vertex& aVertex = TopoDS::Vertex( aVertexExp.Current() );
- myVertexSource->AddVertex( aVertex );
- }
-
- TopTools_IndexedDataMapOfShapeListOfShape anEdgeMap;
- TopExp::MapShapesAndAncestors( aShape, TopAbs_EDGE, TopAbs_FACE, anEdgeMap );
-
- GEOM::SetShape( aShape,
- anEdgeMap,
- anIsVector,
- 0,
- myIsolatedEdgeSource,
- myOneFaceEdgeSource,
- mySharedEdgeSource,
- myWireframeFaceSource,
- myShadingFaceSource );
-
- myAppendFilter->Update();
-
// Set "C" numeric locale to save numbers correctly
Kernel_Utils::Localizer loc;
- vtkPolyDataWriter* aWriter = vtkPolyDataWriter::New();
- aWriter->SetInputConnection( myAppendFilter->GetOutputPort() );
+ vtkPolyData* pd = GEOM::GetVTKData( aShape, aDeflection );
+ vtkPolyDataWriter* aWriter = vtkPolyDataWriter::New();
+ aWriter->SetInputData( pd );
aWriter->SetFileName( aFileName.ToCString() );
aWriter->Write();
aWriter->Delete();
-
- myVertexSource->Delete();
- myIsolatedEdgeSource->Delete();
- myOneFaceEdgeSource->Delete();
- mySharedEdgeSource->Delete();
- myWireframeFaceSource->Delete();
- myShadingFaceSource->Delete();
-
- myAppendFilter->Delete();
-
- if(!wasMeshed)
- BRepTools::Clean(aShape);
+ pd->Delete(); //instanciated by the GEOM::GetData(...) method
return 1;
}
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "GEOM_Operation.h"
#include "GEOMBase.h"
#include "GEOM_Displayer.h"
+#include "GEOM_GenericObjPtr.h"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(VTKPlugin)
+typedef GEOM::GenericObjPtr<GEOM::IVTKOperations> VTKOpPtr;
+
//=======================================================================
// function : VTKPlugin_GUI()
// purpose : Constructor
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "VTKPluginEngine" );
- GEOM::IVTKOperations_var stlOp = GEOM::IVTKOperations::_narrow( op );
- if ( CORBA::is_nil( stlOp ) ) return false;
+ VTKOpPtr vtkOp = GEOM::IVTKOperations::_narrow( op );
+ if ( vtkOp.isNull() ) return false;
LightApp_SelectionMgr* sm = app->selectionMgr();
if ( !sm ) return false;
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, stlOp.in() );
+ GEOM_Operation transaction( app, vtkOp.get() );
try
{
app->putInfo( tr( "GEOM_PRP_EXPORT" ).arg( fileName ) );
transaction.start();
- stlOp->ExportVTK( obj, fileName.toUtf8().constData(), deflection );
+ vtkOp->ExportVTK( obj, fileName.toUtf8().constData(), deflection );
- if ( stlOp->IsDone() )
+ if ( vtkOp->IsDone() )
{
transaction.commit();
}
transaction.abort();
SUIT_MessageBox::critical( parent,
tr( "GEOM_ERROR" ),
- tr( "GEOM_PRP_ABORT" ) + "\n" + tr( stlOp->GetErrorCode() ) );
+ tr( "GEOM_PRP_ABORT" ) + "\n" + tr( vtkOp->GetErrorCode() ) );
return false;
}
}
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="ja" sourcelanguage="en">
-<context>
+ <context>
<name>@default</name>
<message>
- <source>MEN_EXPORTVTK</source>
- <translation type="unfinished">VTK</translation>
+ <source>MEN_EXPORTVTK</source>
+ <translation>VTKエクスポート</translation>
</message>
<message>
- <source>TOP_EXPORTVTK</source>
- <translation type="unfinished">Export VTK</translation>
+ <source>TOP_EXPORTVTK</source>
+ <translation>VTKエクスポート</translation>
</message>
<message>
- <source>STB_EXPORTVTK</source>
- <translation type="unfinished">Export VTK</translation>
+ <source>STB_EXPORTVTK</source>
+ <translation>VTKエクスポート</translation>
</message>
<message>
- <source>MEN_IMPORTVTK</source>
- <translation type="unfinished">VTK</translation>
+ <source>MEN_IMPORTVTK</source>
+ <translation>VTKインポート</translation>
</message>
<message>
- <source>TOP_IMPORTVTK</source>
- <translation type="unfinished">Import VTK</translation>
+ <source>TOP_IMPORTVTK</source>
+ <translation>VTKインポート</translation>
</message>
<message>
- <source>STB_IMPORTVTK</source>
- <translation type="unfinished">Import VTK</translation>
+ <source>STB_IMPORTVTK</source>
+ <translation>VTKインポート</translation>
</message>
-</context>
-<context>
+ </context>
+ <context>
<name>VTKPlugin_GUI</name>
<message>
- <source>VTK_FILES</source>
- <translation type="unfinished">VTK files( *.vtk )</translation>
+ <source>VTK_FILES</source>
+ <translation>VTKファイル( *.vtk )</translation>
</message>
<message>
- <source>EXPORT_TITLE</source>
- <translation type="unfinished">Export VTK</translation>
+ <source>EXPORT_TITLE</source>
+ <translation>VTKエクスポート</translation>
</message>
-</context>
-<context>
+ </context>
+ <context>
<name>VTKPlugin_ExportDlg</name>
<message>
- <source>DEFLECTION</source>
- <translation type="unfinished">Deflection</translation>
+ <source>DEFLECTION</source>
+ <translation>たわみ</translation>
</message>
-</context>
+ </context>
</TS>
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
{
std::ifstream rstr;
int length;
- rstr.open(filePath.c_str());
+ rstr.open(filePath.c_str(), std::ios_base::binary);
rstr.seekg(0, rstr.end); // go to the end
length = rstr.tellg(); // report location (this is the length)
rstr.seekg(0, rstr.beg); // go back to the beginning
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#!/bin/bash
-# Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
return 1;
}
-IMPLEMENT_STANDARD_HANDLE (XAOPlugin_Driver, TFunction_Driver);
-IMPLEMENT_STANDARD_RTTIEXT(XAOPlugin_Driver, TFunction_Driver);
+//=======================================================================
+//function : GetCreationInformation
+//purpose : Returns a name of creation operation and names and values of
+// creation parameters
+//=======================================================================
+
+bool XAOPlugin_Driver::GetCreationInformation(std::string& theOperationName,
+ std::vector<GEOM_Param>& theParams)
+{
+ if (Label().IsNull()) return false;
+ Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
+
+ theOperationName = "ImportXAO";
+ AddParam( theParams, "File name", function->GetString( GetFileNameTag() ));
+ return true;
+}
+
+IMPLEMENT_STANDARD_HANDLE (XAOPlugin_Driver, GEOM_BaseDriver);
+IMPLEMENT_STANDARD_RTTIEXT(XAOPlugin_Driver, GEOM_BaseDriver);
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#ifndef _XAOPlugin_Driver_HXX
#define _XAOPlugin_Driver_HXX
-// OCCT includes
-#include <TFunction_Driver.hxx>
+#include "GEOM_BaseDriver.hxx"
-DEFINE_STANDARD_HANDLE(XAOPlugin_Driver, TFunction_Driver);
+DEFINE_STANDARD_HANDLE(XAOPlugin_Driver, GEOM_BaseDriver);
-class XAOPlugin_Driver: public TFunction_Driver
+class XAOPlugin_Driver: public GEOM_BaseDriver
{
public:
XAOPlugin_Driver();
Standard_Boolean MustExecute(const TFunction_Logbook&) const;
virtual void Validate(TFunction_Logbook&) const {}
-DEFINE_STANDARD_RTTI(XAOPlugin_Driver)
+ virtual bool GetCreationInformation(std::string& theOperationName,
+ std::vector<GEOM_Param>& theParams);
+
+ static int GetFileNameTag() { return 1; } // where to store file name in GEOM_Function
+
+ DEFINE_STANDARD_RTTI(XAOPlugin_Driver)
};
#endif // _XAOPlugin_Driver_HXX
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
layout->addWidget(gbxFilter);
// set help
- setHelpFileName("xao_format_page.html");
+ setHelpFileName("import_export_geom_obj_page.html#io_xao");
Init();
}
// call engine function
GEOM::IXAOOperations_var aXAOOp = GEOM::IXAOOperations::_narrow( getOperation() );
res = aXAOOp->ExportXAO(m_mainObj, groups, fields,
- author.toStdString().c_str(),
- fileName.toStdString().c_str());
+ author.toUtf8().constData(),
+ fileName.toUtf8().constData());
return res;
}
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
void XAOPlugin_IOperations::exportSubshapes( const Handle(GEOM_Object)& shape, XAO::BrepGeometry* geometry )
{
- Handle(TColStd_HSequenceOfTransient) subObjects = myShapesOperations->GetExistingSubObjects( shape, false );
+ Handle(TColStd_HSequenceOfTransient) subObjects = myShapesOperations->GetExistingSubObjects( shape, GEOMImpl_IShapesOperations::SubShapes );
int nbSubObjects = subObjects->Length();
// set the names of the sub shapes
for (int i = 1; i <= nbSubObjects; i++)
if (function.IsNull()) return false;
if (function->GetDriverGUID() != XAOPlugin_Driver::GetID()) return false;
+ function->SetString( XAOPlugin_Driver::GetFileNameTag(), fileName );
+
// set the geometry
if (xaoGeometry->getFormat() == XAO::BREP)
{
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
layout->addWidget(gbxExport);
// set help
- setHelpFileName("xao_format_page.html");
+ setHelpFileName("import_export_geom_obj_page.html#io_xao");
Init();
}
{
QStringList anEntryList;
anEntryList << addInStudy(m_mainShape, m_mainShape->GetName());
+ m_mainShape->UnRegister();
for (int i = 0; i < subShapes->length(); i++)
{
addInStudy(subShapes[i].in(), subShapes[i]->GetName());
+ subShapes[i]->UnRegister();
}
for (int i = 0; i < groups->length(); i++)
{
addInStudy(groups[i].in(), groups[i]->GetName());
+ groups[i]->UnRegister();
}
for (int i = 0; i < fields->length(); i++)
{
SALOMEDS::SObject_var aSO =
getGeomEngine()->AddInStudy(aStudyDS, theField, theField->GetName(), theFather);
+ theField->UnRegister();
QString anEntry;
if ( !aSO->_is_nil() ) {
QString stepName = (tr("XAOPLUGIN_STEP") + " %1 %2").arg( step->GetID() ).arg( step->GetStamp() );
SALOMEDS::SObject_wrap aSOField =
getGeomEngine()->AddInStudy( aStudyDS, step, stepName.toLatin1().constData(), theField );
+ step->UnRegister();
}
aSO->UnRegister();
-// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="ja" sourcelanguage="en">
-<context>
+ <context>
<name>@default</name>
<message>
<source>MEN_EXPORTXAO</source>
- <translation>エクスポートしました。</translation>
+ <translation>XAOエクスポート</translation>
</message>
<message>
- <source>TOP_EXPORTXAO</source>
- <translation>エクスポートしました。</translation>
+ <source>TOP_EXPORTXAO</source>
+ <translation>XAOのエクスポート</translation>
</message>
<message>
<source>STB_EXPORTXAO</source>
- <translation>ソテーした形式でフォームをエクスポートします。</translation>
+ <translation>XAOのエクスポート</translation>
</message>
<message>
<source>MEN_IMPORTXAO</source>
- <translation>インポートしました。</translation>
+ <translation>XAOインポート</translation>
</message>
<message>
<source>TOP_IMPORTXAO</source>
- <translation>インポートしました。</translation>
+ <translation>XAOのインポート</translation>
</message>
<message>
<source>STB_IMPORTXAO</source>
- <translation>ソテーしたフォームをインポートします。</translation>
+ <translation>XAOのインポート</translation>
</message>
<message>
<source>XAOPLUGIN_IMPORT_SELECT</source>
</message>
<message>
<source>XAOPLUGIN_EXPORT_SELECT</source>
- <translation>エクスポートしました。</translation>
+ <translation>XAOへのエクスポート</translation>
</message>
<message>
<source>XAOPLUGIN_FILES</source>
- <translation>ファイルした (*.xao)</translation>
+ <translation>XAO ファイル (*.xao)</translation>
</message>
-</context>
-<context>
+ </context>
+ <context>
<name>XAOPlugin_ExportDlg</name>
<message>
<source>XAOPLUGIN_EXPORT_TITLE</source>
- <translation>エクスポートしました。</translation>
+ <translation>XAOエクスポート</translation>
</message>
<message>
<source>XAOPLUGIN_EXPORTXAO</source>
- <translation>エクスポートしました。</translation>
+ <translation>XAOエクスポート</translation>
</message>
<message>
<source>XAOPLUGIN_EXPORT_INGSHAPE</source>
<source>XAOPLUGIN_EXPORT_LFIELDS</source>
<translation>フィールド</translation>
</message>
-</context>
-<context>
+ </context>
+ <context>
<name>XAOPlugin_ImportDlg</name>
<message>
<source>XAOPLUGIN_IMPORT_TITLE</source>
- <translation>インポートしました。</translation>
+ <translation>XAOインポート</translation>
</message>
<message>
<source>XAOPLUGIN_IMPORTXAO</source>
- <translation>インポートしました。</translation>
+ <translation>XAOインポート</translation>
</message>
<message>
<source>XAOPLUGIN_IMPORT_INGSHAPE</source>
<source>XAOPLUGIN_STEP</source>
<translation>Step</translation>
</message>
-</context>
-</TS>
\ No newline at end of file
+ </context>
+</TS>
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public