From: jfa Date: Wed, 22 Aug 2007 06:10:04 +0000 (+0000) Subject: Join modifications from V3_2_0_maintainance (V3_2_6pre4 - T32x_16Aug2007_16h00m) X-Git-Tag: V4_1_0a1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=156546ac91ccd5b385072686cd28e766067e5af1;p=modules%2Fgeom.git Join modifications from V3_2_0_maintainance (V3_2_6pre4 - T32x_16Aug2007_16h00m) --- diff --git a/build_configure b/build_configure index cce3dce8f..27672f14d 100755 --- a/build_configure +++ b/build_configure @@ -14,6 +14,7 @@ ORIG_DIR=`pwd` CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` +GEOM_WITH_GUI="yes" ######################################################################## # Test if the KERNEL_ROOT_DIR is set correctly @@ -28,16 +29,36 @@ fi # echo "failed : KERNEL_SRC variable is not correct !" # exit #fi + +for option +do + case $option in + -with-ihm | --with-ihm) + GEOM_WITH_GUI="yes" + break;; + -without-ihm | --without-ihm | -with-ihm=no | --with-ihm=no) + GEOM_WITH_GUI="no" + break;; + esac +done + ######################################################################## # Test if the GUI_ROOT_DIR is set correctly -if test ! -d "${GUI_ROOT_DIR}"; then - echo "failed : GUI_ROOT_DIR variable is not correct !" - exit +if test ${GEOM_WITH_GUI} = yes; then + if test ! -d "${GUI_ROOT_DIR}"; then + echo "failed : GUI_ROOT_DIR variable is not correct !" + exit + fi fi cd ${CONF_DIR} ABS_CONF_DIR=`pwd` +####################################################################### +# Update configure.ac script: to set NETGENPLUGIN_WITH_GUI variable +sed -e s/GEOM_WITH_GUI=[a-z]*/GEOM_WITH_GUI=${GEOM_WITH_GUI}/g configure.ac > configure.tmp +mv -f configure.tmp configure.ac + mkdir -p salome_adm/unix/config_files #cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/* salome_adm/unix/config_files #cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/pythonbe.py salome_adm/unix @@ -64,9 +85,14 @@ cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/SALOMEconfig.h.in salome_adm/unix # autom4te.cache (directory) echo "====================================================== aclocal" -aclocal -I adm_local/unix/config_files \ - -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ - -I ${GUI_ROOT_DIR}/adm_local/unix/config_files || exit 1 +if test ${GEOM_WITH_GUI} = yes; then + aclocal -I adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${GUI_ROOT_DIR}/adm_local/unix/config_files || exit 1 +else + aclocal -I adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files || exit 1 +fi # ____________________________________________________________________ # libtoolize creates some configuration files (ltmain.sh, diff --git a/configure.ac b/configure.ac index 032af63cc..d8ef0003b 100644 --- a/configure.ac +++ b/configure.ac @@ -213,37 +213,65 @@ corba=make_$ORB CORBA=adm_local/unix/$corba fi + echo echo --------------------------------------------- -echo testing openGL +echo testing msg2qm echo --------------------------------------------- echo -CHECK_OPENGL +CHECK_MSG2QM -echo -echo --------------------------------------------- -echo testing QT -echo --------------------------------------------- -echo -CHECK_QT +GEOM_WITH_GUI=yes -echo -echo --------------------------------------------- -echo testing msg2qm -echo --------------------------------------------- -echo +AM_CONDITIONAL(GEOM_ENABLE_GUI, [test "${GEOM_WITH_GUI}" = "yes"]) -CHECK_MSG2QM +if test "${GEOM_WITH_GUI}" = "yes"; then + echo + echo --------------------------------------------- + echo testing openGL + echo --------------------------------------------- + echo -echo -echo --------------------------------------------- -echo testing VTK -echo --------------------------------------------- -echo + CHECK_OPENGL + + echo + echo --------------------------------------------- + echo testing QT + echo --------------------------------------------- + echo + + CHECK_QT -CHECK_VTK + echo + echo --------------------------------------------- + echo testing VTK + echo --------------------------------------------- + echo + + CHECK_VTK + + echo + echo --------------------------------------------- + echo Testing GUI + echo --------------------------------------------- + echo + + CHECK_SALOME_GUI + + echo + echo --------------------------------------------- + echo Testing full GUI + echo --------------------------------------------- + echo + + CHECK_CORBA_IN_GUI + if test "x${CORBA_IN_GUI}" != "xyes"; then + echo "failed : For configure GEOM module necessary full GUI !" + exit + fi +fi echo echo --------------------------------------------- @@ -277,26 +305,6 @@ echo CHECK_HTML_GENERATORS -echo -echo --------------------------------------------- -echo Testing GUI -echo --------------------------------------------- -echo - -CHECK_SALOME_GUI - -echo -echo --------------------------------------------- -echo Testing full GUI -echo --------------------------------------------- -echo - -CHECK_CORBA_IN_GUI -if test "x${CORBA_IN_GUI}" != "xyes"; then - echo "failed : For configure GEOM module necessary full GUI !" - exit -fi - echo echo --------------------------------------------- echo Testing Kernel @@ -387,6 +395,7 @@ AC_OUTPUT([ \ ./src/GEOM_I/Makefile \ ./src/GEOM_I_Superv/Makefile \ ./src/GEOM_SWIG/Makefile \ + ./src/GEOM_SWIG_WITHIHM/Makefile \ ./src/GenerationGUI/Makefile \ ./src/GroupGUI/Makefile \ ./src/IGESExport/Makefile \ diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 05c9fe46f..118971724 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -896,7 +896,7 @@ module GEOM * \param theSeqSubBases - list of corresponding subshapes of section shapes. * \param theLocations - list of locations on the path corresponding * specified list of the Bases shapes. Number of locations - * should be equal to number of bases or list of locations can be empty. + * should be equal to number of bases. * \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. @@ -985,9 +985,10 @@ module GEOM * Replace coincident faces in theShape by one face. * \param theShape Initial shape. * \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. */ - GEOM_Object MakeGlueFaces (in GEOM_Object theShape, in double theTolerance); + GEOM_Object MakeGlueFaces (in GEOM_Object theShape, in double theTolerance, in boolean doKeepNonSolids); /*! * Find coincident faces in theShape for possible gluing. @@ -1003,10 +1004,11 @@ module GEOM * \param theShape Initial shape. * \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. * \return New GEOM_Object, containing a copy of theShape without some faces. */ GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance, - in ListOfGO theFaces); + in ListOfGO theFaces, in boolean doKeepNonSolids); /*! * Explode a shape on subshapes of a given type. @@ -1309,7 +1311,7 @@ module GEOM in shape_state theState); /*! - * Get sub-shape(s) of theShapeWhere, which are + * Get sub-shape(s) of \a theShapeWhere, which are * coincident with \a theShapeWhat or could be a part of it. * \param theShapeWhere Shape to find sub-shapes of. * \param theShapeWhat Shape, specifying what to find. @@ -1318,6 +1320,23 @@ module GEOM GEOM_Object GetInPlace (in GEOM_Object theShapeWhere, in GEOM_Object theShapeWhat); + /*! + * Get sub-shape(s) of \a theShapeWhere, which are + * coincident with \a theShapeWhat or could be a part of it. + * + * Implementation of this method is based on a saved history of an operation, + * produced \a theShapeWhere. The \a theShapeWhat must be among this operation's + * arguments (an argument shape or a sub-shape of an argument shape). + * The operation could be the Partition or one of boolean operations, + * performed on simple shapes (not on compounds). + * + * \param theShapeWhere Shape to find sub-shapes of. + * \param theShapeWhat Shape, specifying what to find. + * \return Group of all found sub-shapes or a single found sub-shape. + */ + GEOM_Object GetInPlaceByHistory (in GEOM_Object theShapeWhere, + in GEOM_Object theShapeWhat); + /*! * Get sub-shape of theShapeWhere, which are * coincident with \a theShapeWhat that can either SOLID, FACE, EDGE or VERTEX. @@ -1690,6 +1709,10 @@ module GEOM * \note Each compound from ListShapes and ListTools will be exploded in order * to avoid possible intersection between shapes from this compound. * \param theLimit Type of resulting shapes (corresponding to TopAbs_ShapeEnum). + # \param KeepNonlimitShapes: if this parameter == 0 - only shapes with + # type <= Limit are kept in the result, + # else - shapes with type > Limit are kept + # also (if they exist) * * After implementation new version of PartitionAlgo (October 2006) * other parameters are ignored by current functionality. They are kept @@ -1710,7 +1733,8 @@ module GEOM in ListOfGO theRemoveInside, in short theLimit, in boolean theRemoveWebs, - in ListOfLong theMaterials); + in ListOfLong theMaterials, + in short theKeepNonlimitShapes); /*! * Perform partition operation. @@ -1731,7 +1755,8 @@ module GEOM in ListOfGO theRemoveInside, in short theLimit, in boolean theRemoveWebs, - in ListOfLong theMaterials); + in ListOfLong theMaterials, + in short theKeepNonlimitShapes); /*! * Perform partition of the Shape with the Plane diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index 92e6fc36d..4ad14db98 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -198,7 +198,8 @@ module GEOM in GEOM_List theRemoveInside, in short theLimit, in boolean theRemoveWebs, - in GEOM_List theMaterials) ; + in GEOM_List theMaterials, + in short theKeepNonlimitShapes); GEOM_Object MakeHalfPartition (in GEOM_Object theShape, in GEOM_Object thePlane) ; @@ -312,12 +313,14 @@ module GEOM GEOM_Object MakeSolidShells (in GEOM_List theShells) ; GEOM_Object MakeCompound (in GEOM_List theShapes) ; GEOM_Object MakeGlueFaces (in GEOM_Object theShape, - in double theTolerance); + in double theTolerance, + in boolean doKeepNonSolids); GEOM_List GetGlueFaces (in GEOM_Object theShape, in double theTolerance); GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance, - in ListOfGO theFaces); + in ListOfGO theFaces, + in boolean doKeepNonSolids); GEOM_List MakeExplode (in GEOM_Object theShape, in long theShapeType, in boolean isSorted) ; diff --git a/resources/GEOMCatalog.xml.in b/resources/GEOMCatalog.xml.in index 4b05e9c22..2a3f4aa09 100644 --- a/resources/GEOMCatalog.xml.in +++ b/resources/GEOMCatalog.xml.in @@ -517,6 +517,44 @@ + + GetDumpName + + + unknown + 0 + + + theStudyEntry + string + unknown + + + + + return + string + unknown + + + + + + GetAllDumpNames + + + unknown + 0 + + + + return + string_array + unknown + + + + hostname = localhost @@ -526,11 +564,11 @@ GEOM_Superv GEOM_Superv OTHER - mkr + @VERSION@ Supervision wrapper for Geometry component 1 - 1 + 1 @@ -539,8 +577,8 @@ SetStudyID - mkr - 2.1.0 + + unknown 0 @@ -555,8 +593,8 @@ CreateListOfGO - mkr - 2.1.0 + + unknown 0 @@ -571,8 +609,8 @@ AddItemToListOfGO - mkr - 2.1.0 + + unknown 0 @@ -598,8 +636,8 @@ CreateListOfLong - mkr - 2.1.0 + + unknown 0 @@ -614,8 +652,8 @@ AddItemToListOfLong - mkr - 2.1.0 + + unknown 0 @@ -641,8 +679,8 @@ CreateListOfDouble - mkr - 2.1.0 + + unknown 0 @@ -657,8 +695,8 @@ AddItemToListOfDouble - mkr - 2.1.0 + + unknown 0 @@ -684,8 +722,8 @@ MakePointXYZ - mkr - 2.1.0 + + unknown 0 @@ -716,8 +754,8 @@ MakePointWithReference - mkr - 2.1.0 + + unknown 0 @@ -753,8 +791,35 @@ MakePointOnCurve - mkr - 2.1.0 + + + unknown + 0 + + + theRefCurve + GEOM_Object + unknown + + + theParameter + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeTangentOnCurve + + unknown 0 @@ -780,8 +845,8 @@ MakeVectorDXDYDZ - mkr - 2.1.0 + + unknown 0 @@ -812,8 +877,8 @@ MakeVectorTwoPnt - mkr - 2.1.0 + + unknown 0 @@ -839,8 +904,8 @@ MakeLineTwoPnt - mkr - 2.1.0 + + unknown 0 @@ -866,8 +931,8 @@ MakePlaneThreePnt - mkr - 2.1.0 + + unknown 0 @@ -903,8 +968,8 @@ MakePlanePntVec - mkr - 2.1.0 + + unknown 0 @@ -935,8 +1000,8 @@ MakePlaneFace - mkr - 2.1.0 + + unknown 0 @@ -962,8 +1027,8 @@ MakeMarker - mkr - 2.1.0 + + unknown 0 @@ -1022,10 +1087,47 @@ + + MakeTangentPlaneOnFace + + + unknown + 0 + + + theFace + GEOM_Object + unknown + + + theParameterU + double + unknown + + + theParameterV + double + unknown + + + theTrimSize + double + unknown + + + + + return + GEOM_Object + unknown + + + + MakeBox - mkr - 2.1.0 + + unknown 0 @@ -1071,8 +1173,8 @@ MakeBoxDXDYDZ - mkr - 2.1.0 + + unknown 0 @@ -1103,8 +1205,8 @@ MakeBoxTwoPnt - mkr - 2.1.0 + + unknown 0 @@ -1130,8 +1232,8 @@ MakeCylinderPntVecRH - mkr - 2.1.0 + + unknown 0 @@ -1167,8 +1269,8 @@ MakeCylinderRH - mkr - 2.1.0 + + unknown 0 @@ -1194,8 +1296,8 @@ MakeSphere - mkr - 2.1.0 + + unknown 0 @@ -1231,8 +1333,8 @@ MakeSphereR - mkr - 2.1.0 + + unknown 0 @@ -1253,8 +1355,8 @@ MakeSpherePntR - mkr - 2.1.0 + + unknown 0 @@ -1280,8 +1382,8 @@ MakeTorusPntVecRR - mkr - 2.1.0 + + unknown 0 @@ -1317,8 +1419,8 @@ MakeTorusRR - mkr - 2.1.0 + + unknown 0 @@ -1344,8 +1446,8 @@ MakeConePntVecR1R2H - mkr - 2.1.0 + + unknown 0 @@ -1386,8 +1488,8 @@ MakeConeR1R2H - mkr - 2.1.0 + + unknown 0 @@ -1418,8 +1520,8 @@ MakePrismVecH - mkr - 2.1.0 + + unknown 0 @@ -1450,8 +1552,8 @@ MakePrismTwoPnt - mkr - 2.1.0 + + unknown 0 @@ -1482,8 +1584,8 @@ MakePipe - mkr - 2.1.0 + + unknown 0 @@ -1509,8 +1611,8 @@ MakeRevolutionAxisAngle - mkr - 2.1.0 + + unknown 0 @@ -1541,8 +1643,8 @@ MakeFilling - mkr - 2.1.0 + + unknown 0 @@ -1586,10 +1688,136 @@ + + MakeThruSections + + + unknown + 0 + + + theSeqSections + ListOfGO + unknown + + + theModeSolid + boolean + unknown + + + thePreci + double + unknown + + + theRuled + boolean + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakePipeWithDifferentSections + + + unknown + 0 + + + theSeqBases + ListOfGO + unknown + + + theLocations + ListOfGO + unknown + + + thePath + GEOM_Object + unknown + + + theWithContact + boolean + unknown + + + theWithCorrection + boolean + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakePipeWithShellSections + + + unknown + 0 + + + theSeqBases + ListOfGO + unknown + + + theSeqSubBases + ListOfGO + unknown + + + theLocations + ListOfGO + unknown + + + thePath + GEOM_Object + unknown + + + theWithContact + boolean + unknown + + + theWithCorrection + boolean + unknown + + + + + return + GEOM_Object + unknown + + + + MakeBoolean - mkr - 2.1.0 + + unknown 0 @@ -1620,8 +1848,8 @@ MakeFuse - mkr - 2.1.0 + + unknown 0 @@ -1647,8 +1875,8 @@ MakePartition - mkr - 2.1.0 + + unknown 0 @@ -1687,6 +1915,11 @@ GEOM_List unknown + + theKeepNonlimitShapes + short + unknown + @@ -1699,8 +1932,8 @@ MakeHalfPartition - mkr - 2.1.0 + + unknown 0 @@ -1726,8 +1959,8 @@ MakeCopy - mkr - 2.1.0 + + unknown 0 @@ -1748,8 +1981,8 @@ Export - mkr - 2.1.0 + + unknown 0 @@ -1774,8 +2007,8 @@ Import - mkr - 2.1.0 + + unknown 0 @@ -1801,8 +2034,8 @@ ImportTranslators - mkr - 2.1.0 + + unknown 0 @@ -1822,8 +2055,8 @@ ExportTranslators - mkr - 2.1.0 + + unknown 0 @@ -1843,8 +2076,8 @@ TranslateTwoPoints - mkr - 2.1.0 + + unknown 0 @@ -1875,8 +2108,8 @@ TranslateTwoPointsCopy - mkr - 2.1.0 + + unknown 0 @@ -1907,8 +2140,8 @@ TranslateDXDYDZ - mkr - 2.1.0 + + unknown 0 @@ -1944,8 +2177,8 @@ TranslateDXDYDZCopy - mkr - 2.1.0 + + unknown 0 @@ -1981,8 +2214,8 @@ TranslateVector - mkr - 2.1.0 + + unknown 0 @@ -2008,8 +2241,8 @@ TranslateVectorCopy - mkr - 2.1.0 + + unknown 0 @@ -2035,8 +2268,8 @@ MultiTranslate1D - mkr - 2.1.0 + + unknown 0 @@ -2072,8 +2305,8 @@ MultiTranslate2D - mkr - 2.1.0 + + unknown 0 @@ -2124,8 +2357,8 @@ Rotate - mkr - 2.1.0 + + unknown 0 @@ -2156,8 +2389,8 @@ RotateCopy - mkr - 2.1.0 + + unknown 0 @@ -2188,8 +2421,8 @@ RotateThreePoints - mkr - 2.1.0 + + unknown 0 @@ -2225,8 +2458,8 @@ RotateThreePointsCopy - mkr - 2.1.0 + + unknown 0 @@ -2262,8 +2495,8 @@ MultiRotate1D - mkr - 2.1.0 + + unknown 0 @@ -2294,8 +2527,8 @@ MultiRotate2D - mkr - 2.1.0 + + unknown 0 @@ -2341,8 +2574,8 @@ MirrorPlane - mkr - 2.1.0 + + unknown 0 @@ -2368,8 +2601,8 @@ MirrorPlaneCopy - mkr - 2.1.0 + + unknown 0 @@ -2395,8 +2628,8 @@ MirrorAxis - mkr - 2.1.0 + + unknown 0 @@ -2422,8 +2655,8 @@ MirrorAxisCopy - mkr - 2.1.0 + + unknown 0 @@ -2449,8 +2682,8 @@ MirrorPoint - mkr - 2.1.0 + + unknown 0 @@ -2476,8 +2709,8 @@ MirrorPointCopy - mkr - 2.1.0 + + unknown 0 @@ -2503,8 +2736,8 @@ OffsetShape - mkr - 2.1.0 + + unknown 0 @@ -2530,8 +2763,8 @@ OffsetShapeCopy - mkr - 2.1.0 + + unknown 0 @@ -2557,8 +2790,8 @@ ScaleShape - mkr - 2.1.0 + + unknown 0 @@ -2589,8 +2822,8 @@ ScaleShapeCopy - mkr - 2.1.0 + + unknown 0 @@ -2621,8 +2854,8 @@ PositionShape - mkr - 2.1.0 + + unknown 0 @@ -2653,8 +2886,8 @@ PositionShapeCopy - mkr - 2.1.0 + + unknown 0 @@ -2685,8 +2918,8 @@ MakeEdge - mkr - 2.1.0 + + unknown 0 @@ -2712,8 +2945,8 @@ MakeWire - mkr - 2.1.0 + + unknown 0 @@ -2734,8 +2967,8 @@ MakeFace - mkr - 2.1.0 + + unknown 0 @@ -2761,8 +2994,8 @@ MakeFaceWires - mkr - 2.1.0 + + unknown 0 @@ -2788,8 +3021,8 @@ MakeShell - mkr - 2.1.0 + + unknown 0 @@ -2810,8 +3043,8 @@ MakeSolidShell - mkr - 2.1.0 + + unknown 0 @@ -2832,8 +3065,8 @@ MakeSolidShells - mkr - 2.1.0 + + unknown 0 @@ -2854,8 +3087,8 @@ MakeCompound - mkr - 2.1.0 + + unknown 0 @@ -2876,8 +3109,40 @@ MakeGlueFaces - mkr - 2.1.0 + + + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theTolerance + double + unknown + + + doKeepNonSolids + boolean + unknown + + + + + return + GEOM_Object + unknown + + + + + + GetGlueFaces + + unknown 0 @@ -2892,6 +3157,43 @@ unknown + + + return + GEOM_List + unknown + + + + + + MakeGlueFacesByList + + + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theTolerance + double + unknown + + + theFaces + ListOfGO + unknown + + + doKeepNonSolids + boolean + unknown + + return @@ -2903,8 +3205,8 @@ MakeExplode - mkr - 2.1.0 + + unknown 0 @@ -2935,8 +3237,8 @@ NumberOfFaces - mkr - 2.1.0 + + unknown 0 @@ -2957,8 +3259,8 @@ NumberOfEdges - mkr - 2.1.0 + + unknown 0 @@ -2979,8 +3281,8 @@ ChangeOrientation - mkr - 2.1.0 + + unknown 0 @@ -3001,8 +3303,8 @@ MakeQuad4Vertices - mkr - 2.1.0 + + unknown 0 @@ -3038,8 +3340,8 @@ MakeQuad - mkr - 2.1.0 + + unknown 0 @@ -3075,8 +3377,8 @@ MakeQuad2Edges - mkr - 2.1.0 + + unknown 0 @@ -3102,8 +3404,8 @@ MakeHexa - mkr - 2.1.0 + + unknown 0 @@ -3149,8 +3451,8 @@ MakeHexa2Faces - mkr - 2.1.0 + + unknown 0 @@ -3176,8 +3478,8 @@ GetPoint - mkr - 2.1.0 + + unknown 0 @@ -3218,8 +3520,8 @@ GetEdge - mkr - 2.1.0 + + unknown 0 @@ -3250,8 +3552,8 @@ GetEdgeNearPoint - mkr - 2.1.0 + + unknown 0 @@ -3277,8 +3579,8 @@ GetFaceByPoints - mkr - 2.1.0 + + unknown 0 @@ -3319,8 +3621,8 @@ GetFaceByEdges - mkr - 2.1.0 + + unknown 0 @@ -3351,8 +3653,8 @@ GetOppositeFace - mkr - 2.1.0 + + unknown 0 @@ -3378,8 +3680,8 @@ GetFaceNearPoint - mkr - 2.1.0 + + unknown 0 @@ -3405,8 +3707,8 @@ GetFaceByNormale - mkr - 2.1.0 + + unknown 0 @@ -3432,8 +3734,8 @@ IsCompoundOfBlocks - mkr - 2.1.0 + + unknown 0 @@ -3456,7 +3758,7 @@ return - long + boolean unknown @@ -3469,8 +3771,8 @@ CheckCompoundOfBlocks - mkr - 2.1.0 + + unknown 0 @@ -3483,7 +3785,7 @@ return - long + boolean unknown @@ -3496,8 +3798,8 @@ PrintBCErrors - mkr - 2.1.0 + + unknown 0 @@ -3523,8 +3825,8 @@ ExplodeCompoundOfBlocks - mkr - 2.1.0 + + unknown 0 @@ -3555,8 +3857,8 @@ GetBlockNearPoint - mkr - 2.1.0 + + unknown 0 @@ -3582,8 +3884,8 @@ GetBlockByParts - mkr - 2.1.0 + + unknown 0 @@ -3609,8 +3911,8 @@ GetBlocksByParts - mkr - 2.1.0 + + unknown 0 @@ -3636,8 +3938,8 @@ MakeMultiTransformation1D - mkr - 2.1.0 + + unknown 0 @@ -3673,8 +3975,8 @@ MakeMultiTransformation2D - mkr - 2.1.0 + + unknown 0 @@ -3725,8 +4027,8 @@ MakeCirclePntVecR - mkr - 2.1.0 + + unknown 0 @@ -3757,8 +4059,8 @@ MakeCircleThreePnt - mkr - 2.1.0 + + unknown 0 @@ -3789,8 +4091,8 @@ MakeEllipse - mkr - 2.1.0 + + unknown 0 @@ -3826,8 +4128,8 @@ MakeArc - mkr - 2.1.0 + + unknown 0 @@ -3858,8 +4160,8 @@ MakeArcCenter - ngr - 3.2.6 + + unknown 0 @@ -3892,10 +4194,11 @@ - + + MakePolyline - mkr - 2.1.0 + + unknown 0 @@ -3916,8 +4219,8 @@ MakeSplineBezier - mkr - 2.1.0 + + unknown 0 @@ -3938,8 +4241,8 @@ MakeSplineInterpolation - mkr - 2.1.0 + + unknown 0 @@ -3960,8 +4263,8 @@ MakeSketcher - mkr - 2.1.0 + + unknown 0 @@ -3987,8 +4290,8 @@ MakeFilletAll - mkr - 2.1.0 + + unknown 0 @@ -4014,8 +4317,8 @@ MakeFilletEdges - mkr - 2.1.0 + + unknown 0 @@ -4046,8 +4349,8 @@ MakeFilletFaces - mkr - 2.1.0 + + unknown 0 @@ -4078,8 +4381,8 @@ MakeChamferAll - mkr - 2.1.0 + + unknown 0 @@ -4105,8 +4408,8 @@ MakeChamferEdge - mkr - 2.1.0 + + unknown 0 @@ -4147,8 +4450,8 @@ MakeChamferFaces - mkr - 2.1.0 + + unknown 0 @@ -4184,8 +4487,8 @@ MakeArchimede - mkr - 2.1.0 + + unknown 0 @@ -4221,8 +4524,8 @@ GetSubShapeIndex - mkr - 2.1.0 + + unknown 0 @@ -4248,8 +4551,8 @@ CreateGroup - mkr - 2.1.0 + + unknown 0 @@ -4275,8 +4578,8 @@ AddObject - mkr - 2.1.0 + + unknown 0 @@ -4296,8 +4599,8 @@ RemoveObject - mkr - 2.1.0 + + unknown 0 @@ -4317,8 +4620,8 @@ GetType - mkr - 2.1.0 + + unknown 0 @@ -4339,8 +4642,8 @@ GetMainShape - mkr - 2.1.0 + + unknown 0 @@ -4361,8 +4664,8 @@ GetObjects - mkr - 2.1.0 + + unknown 0 diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index fec43e01e..86ea68832 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -17,7 +17,7 @@ // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -35,17 +35,10 @@ #include -#include -#include -#include -#include - #include "GEOMImpl_Types.hxx" #include "utilities.h" -using namespace std; - //================================================================================= // class : BasicGUI_ArcDlg() // purpose : Constructs a BasicGUI_ArcDlg which is a child of 'parent', with the @@ -58,9 +51,10 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg(GeometryGUI* theGeometryGUI, QWidget* parent, : GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ARC"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ARC_CENTER"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + QPixmap image0(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_ARC"))); + QPixmap image1(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_ARC_CENTER"))); + QPixmap image2(aResMgr->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_ARC_TITLE")); @@ -98,11 +92,12 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg(GeometryGUI* theGeometryGUI, QWidget* parent, Group3Pnts2->PushButton1->setPixmap(image2); Group3Pnts2->PushButton2->setPixmap(image2); Group3Pnts2->PushButton3->setPixmap(image2); - + Group3Pnts2->radioButton4->setText(tr("GEOM_REVERSE")); Layout1->addWidget( Group3Pnts, 2, 0 ); Layout1->addWidget( Group3Pnts2, 2, 0 ); + /***************************************************************/ setHelpFileName("arc.htm"); @@ -126,13 +121,7 @@ BasicGUI_ArcDlg::~BasicGUI_ArcDlg() void BasicGUI_ArcDlg::Init() { /* init variables */ - // myGeomGUI->SetState( 0 ); - globalSelection( GEOM_POINT ); - - myConstructorId = -1; myEditCurrentArgument = Group3Pnts->LineEdit1; - myEditCurrentArgument->setFocus(); - myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); Group3Pnts2->radioButton4->setChecked(FALSE); @@ -140,9 +129,9 @@ void BasicGUI_ArcDlg::Init() connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); - + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); - + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -153,7 +142,7 @@ void BasicGUI_ArcDlg::Init() connect(Group3Pnts->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group3Pnts->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group3Pnts->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - + connect(Group3Pnts2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group3Pnts2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group3Pnts2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); @@ -161,36 +150,80 @@ void BasicGUI_ArcDlg::Init() connect(Group3Pnts2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group3Pnts2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group3Pnts2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - + connect(Group3Pnts2->radioButton4, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int))); connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - initName( tr( "GEOM_ARC" )); - - + initName( tr( "GEOM_ARC" )); ConstructorsClicked( 0 ); } //================================================================================= -// function : ClickOnOk() -// purpose : +// function : ConstructorsClicked() +// purpose : Radio button management //================================================================================= -void BasicGUI_ArcDlg::ClickOnOk() +void BasicGUI_ArcDlg::ConstructorsClicked (int constructorId) { - if ( ClickOnApply() ) - ClickOnCancel(); + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + + switch (constructorId) + { + case 0: + { + globalSelection( GEOM_POINT ); + + Group3Pnts->show(); + resize(0, 0); + Group3Pnts2->hide(); + + Group3Pnts->LineEdit1->setText(Group3Pnts2->LineEdit1->text()); + Group3Pnts->LineEdit2->setText(Group3Pnts2->LineEdit2->text()); + Group3Pnts->LineEdit3->setText(Group3Pnts2->LineEdit3->text()); + + myEditCurrentArgument = Group3Pnts->LineEdit1; + + break; + } + case 1: + { + globalSelection( GEOM_POINT ); + + Group3Pnts->hide(); + resize(0, 0); + Group3Pnts2->show(); + + Group3Pnts2->LineEdit1->setText(Group3Pnts->LineEdit1->text()); + Group3Pnts2->LineEdit2->setText(Group3Pnts->LineEdit2->text()); + Group3Pnts2->LineEdit3->setText(Group3Pnts->LineEdit3->text()); + + myEditCurrentArgument = Group3Pnts2->LineEdit1; + + break; + } + } + + myEditCurrentArgument->setFocus(); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + if (CORBA::is_nil(myPoint1)) + SelectionIntoArgument(); + + displayPreview(); } + //================================================================================= -// function : ClickOnCancel() +// function : ClickOnOk() // purpose : //================================================================================= -void BasicGUI_ArcDlg::ClickOnCancel() +void BasicGUI_ArcDlg::ClickOnOk() { - GEOMBase_Skeleton::ClickOnCancel(); + if ( ClickOnApply() ) + ClickOnCancel(); } //================================================================================= @@ -203,19 +236,6 @@ bool BasicGUI_ArcDlg::ClickOnApply() return false; initName(); - - // reset - myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); - Group3Pnts->LineEdit1->setText( "" ); - Group3Pnts->LineEdit2->setText( "" ); - Group3Pnts->LineEdit3->setText( "" ); - Group3Pnts2->LineEdit1->setText( "" ); - Group3Pnts2->LineEdit2->setText( "" ); - Group3Pnts2->LineEdit3->setText( "" ); - if (getConstructorId() == 0) myEditCurrentArgument = Group3Pnts->LineEdit1; - if (getConstructorId() == 1) myEditCurrentArgument = Group3Pnts2->LineEdit1; - - ConstructorsClicked( getConstructorId() ); return true; } @@ -228,21 +248,23 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() { if ((getConstructorId() != 0) && (getConstructorId() != 1)) return; - + myEditCurrentArgument->setText(""); - if ( IObjectCount() != 1 ){ + + if ( IObjectCount() != 1 ) + { switch (getConstructorId()) { - case 0: - { - if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); - return; - break; + case 0: + { + if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); + return; + break; } - case 1: - { + case 1: + { if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); @@ -250,7 +272,8 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() break; } } - } + } + // nbSel == 1 Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); @@ -281,6 +304,22 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() } +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if (send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || send == Group3Pnts->LineEdit3 || + send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + //================================================================================= // function : SetEditCurrentArgument() // purpose : @@ -310,22 +349,6 @@ void BasicGUI_ArcDlg::SetEditCurrentArgument() } -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void BasicGUI_ArcDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if ( send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || send == Group3Pnts->LineEdit3 || - send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3 ) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } -} - - //================================================================================= // function : ActivateThisDialog() // purpose : @@ -333,33 +356,13 @@ void BasicGUI_ArcDlg::LineEditReturnPressed() void BasicGUI_ArcDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - - // myGeomGUI->SetState( 0 ); - globalSelection( GEOM_POINT ); - - myEditCurrentArgument = Group3Pnts->LineEdit1; - myEditCurrentArgument->setFocus(); - Group3Pnts->LineEdit1->setText( "" ); - Group3Pnts->LineEdit2->setText( "" ); - Group3Pnts->LineEdit3->setText( "" ); - myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); + connect(myGeomGUI->getApp()->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); - } -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : public slot to deactivate if active -//================================================================================= -void BasicGUI_ArcDlg::DeactivateActiveDialog() -{ - // myGeomGUI->SetState( -1 ); - GEOMBase_Skeleton::DeactivateActiveDialog(); -} //================================================================================= // function : enterEvent() @@ -367,10 +370,11 @@ void BasicGUI_ArcDlg::DeactivateActiveDialog() //================================================================================= void BasicGUI_ArcDlg::enterEvent(QEvent* e) { - if ( !GroupConstructors->isEnabled() ) + if (!GroupConstructors->isEnabled()) ActivateThisDialog(); } + //================================================================================= // function : createOperation // purpose : @@ -410,71 +414,33 @@ bool BasicGUI_ArcDlg::execute( ObjectList& objects ) switch (getConstructorId()) { - case 0: + case 0: + { + if ( !CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2) &&!CORBA::is_nil(myPoint3) ) { - if ( !CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2) &&!CORBA::is_nil(myPoint3) ){ - anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->MakeArc(myPoint1, myPoint2, myPoint3); - res = true; - } - break; + anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())-> + MakeArc(myPoint1, myPoint2, myPoint3); + res = true; } - case 1: - { - bool Sense; - (Group3Pnts2->radioButton4->isChecked()) ? Sense=true : Sense = false; - if ( !CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2) &&!CORBA::is_nil(myPoint3) ){ - anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->MakeArcCenter(myPoint1, myPoint2, myPoint3,Sense); - res = true; - } - break; - } - } - if ( !anObj->_is_nil() ){ - objects.push_back( anObj._retn() ); - } - return res; -} - -//================================================================================= -// function : closeEvent -// purpose : -//================================================================================= -void BasicGUI_ArcDlg::closeEvent( QCloseEvent* e ) -{ - GEOMBase_Skeleton::closeEvent( e ); -} - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId ) -{ - - disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); - - switch (constructorId) - { - case 0: - { - Group3Pnts->show(); - resize(0, 0); - Group3Pnts2->hide(); - - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } - case 1: + case 1: { - Group3Pnts->hide(); - resize(0, 0); - Group3Pnts2->show(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - + bool Sense; + (Group3Pnts2->radioButton4->isChecked()) ? Sense = true : Sense = false; + if ( !CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2) &&!CORBA::is_nil(myPoint3) ) + { + anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())-> + MakeArcCenter(myPoint1, myPoint2, myPoint3, Sense); + res = true; + } break; } } - displayPreview(); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return res; } //================================================================================= diff --git a/src/BasicGUI/BasicGUI_ArcDlg.h b/src/BasicGUI/BasicGUI_ArcDlg.h index 6a5e73217..9fdcc6ba6 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.h +++ b/src/BasicGUI/BasicGUI_ArcDlg.h @@ -17,7 +17,7 @@ // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -28,7 +28,7 @@ #ifndef DIALOGBOX_ARC_H #define DIALOGBOX_ARC_H -#include "GEOM_BasicGUI.hxx" +#include "GEOM_BasicGUI.hxx" #include "GEOMBase_Skeleton.h" #include "DlgRef_3Sel_QTD.h" @@ -53,12 +53,10 @@ protected: virtual bool isValid( QString& ); virtual bool execute( ObjectList& objects ); - virtual void closeEvent( QCloseEvent* e ); - -private : +private: void Init(); void enterEvent(QEvent* e); - int myConstructorId; + GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3; DlgRef_3Sel_QTD* Group3Pnts; @@ -66,12 +64,10 @@ private : private slots: void ClickOnOk(); - void ClickOnCancel(); bool ClickOnApply(); - + void ActivateThisDialog(); - void DeactivateActiveDialog(); - void ConstructorsClicked( int ); + void ConstructorsClicked(int); void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index ce76529d0..42c3e5aa5 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -125,7 +125,7 @@ void BasicGUI_CircleDlg::Init() double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); /* min, max, step and decimals for spin boxes & initial values */ - GroupPntVecR->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, 3); + GroupPntVecR->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, DBL_DIGITS_DISPLAY); GroupPntVecR->SpinBox_DX->SetValue( 100 ); /* signals and slots connections */ diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index ba6db7d30..7103838b5 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -114,8 +114,8 @@ void BasicGUI_EllipseDlg::Init() double aMajorR( 200. ), aMinorR( 100. ); /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator( 0.001, COORD_MAX, step, 3 ); - GroupPoints->SpinBox_DY->RangeStepAndValidator( 0.001, COORD_MAX, step, 3 ); + GroupPoints->SpinBox_DX->RangeStepAndValidator( 0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY ); + GroupPoints->SpinBox_DY->RangeStepAndValidator( 0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY ); GroupPoints->SpinBox_DX->SetValue( aMajorR ); GroupPoints->SpinBox_DY->SetValue( aMinorR ); diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.cxx b/src/BasicGUI/BasicGUI_MarkerDlg.cxx index 99e7ff9a5..17f6d25b4 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.cxx +++ b/src/BasicGUI/BasicGUI_MarkerDlg.cxx @@ -176,7 +176,7 @@ void BasicGUI_MarkerDlg::Init() for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter ) { - anIter.data()->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, 3 ); + anIter.data()->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY ); connect( anIter.data(), SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged( double ) ) ); } diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index a48162902..62711faa6 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -138,11 +138,11 @@ void BasicGUI_PlaneDlg::Init() double aTrimSize = 2000.0; /* min, max, step and decimals for spin boxes */ - GroupPntDir->SpinBox_DX->RangeStepAndValidator( 0.001, COORD_MAX, aStep, 3 ); + GroupPntDir->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, DBL_DIGITS_DISPLAY); GroupPntDir->SpinBox_DX->SetValue( aTrimSize ); - Group3Pnts->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, 3); + Group3Pnts->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, DBL_DIGITS_DISPLAY); Group3Pnts->SpinBox_DX->SetValue( aTrimSize ); - GroupFace->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, 3); + GroupFace->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, DBL_DIGITS_DISPLAY); GroupFace->SpinBox_DX->SetValue( aTrimSize ); /* signals and slots connections */ diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index 16b642130..755a04b9b 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -157,22 +157,22 @@ void BasicGUI_PointDlg::Init() double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); /* min, max, step and decimals for spin boxes */ - GroupXYZ->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupXYZ->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupXYZ->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + GroupXYZ->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupXYZ->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupXYZ->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); GroupXYZ->SpinBox_DX->SetValue(0.0); GroupXYZ->SpinBox_DY->SetValue(0.0); GroupXYZ->SpinBox_DZ->SetValue(0.0); - GroupRefPoint->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupRefPoint->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupRefPoint->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + GroupRefPoint->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupRefPoint->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupRefPoint->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); GroupRefPoint->SpinBox_DX->SetValue(0.0); GroupRefPoint->SpinBox_DY->SetValue(0.0); GroupRefPoint->SpinBox_DZ->SetValue(0.0); step = 0.1; - GroupOnCurve->SpinBox_DX->RangeStepAndValidator(0., 1., step, 3); + GroupOnCurve->SpinBox_DX->RangeStepAndValidator(0., 1., step, DBL_DIGITS_DISPLAY); GroupOnCurve->SpinBox_DX->SetValue( 0.5 ); /* signals and slots connections */ diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index 48fb526cd..79a4f90c2 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -118,9 +118,9 @@ void BasicGUI_VectorDlg::Init() double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); /* min, max, step and decimals for spin boxes */ - GroupDimensions->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + GroupDimensions->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); double dx( 0. ), dy( 0. ), dz( 200. ); GroupDimensions->SpinBox_DX->SetValue( dx ); diff --git a/src/DlgRef/DlgRef_2Sel1List1Check_QTD.cxx b/src/DlgRef/DlgRef_2Sel1List1Check_QTD.cxx new file mode 100644 index 000000000..b469af6b6 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1List1Check_QTD.cxx @@ -0,0 +1,130 @@ +// Copyright (C) 2005 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. +// +// 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 +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_4Sel1List_QTD.ui' +** +** Created: lun oct 31 17:21:04 2006 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel1List1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel1List_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel1List1Check_QTD::DlgRef_2Sel1List1Check_QTD( QWidget* parent, + const char* name, + WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel1List1Check_QTD" ); + resize( 129, 175 ); + setCaption( trUtf8( "DlgRef_2Sel1List1Check_QTD" ) ); + DlgRef_2Sel1List1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel1List1Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); + + ComboBox1 = new QComboBox( FALSE, GroupBox1, "ComboBox1" ); + ComboBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( ComboBox1, 2, 2 ); + + radioButton4 = new QRadioButton( GroupBox1, "radioButton4" ); + GroupBox1Layout->addMultiCellWidget( radioButton4, 3, 3, 0, 1 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel1List1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); + + QSpacerItem* spacer = new QSpacerItem( 0, 80, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 5, 2 ); + +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel1List1Check_QTD::~DlgRef_2Sel1List1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel1List1Check_QTD.h b/src/DlgRef/DlgRef_2Sel1List1Check_QTD.h new file mode 100644 index 000000000..14e7875f8 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1List1Check_QTD.h @@ -0,0 +1,69 @@ +// Copyright (C) 2005 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. +// +// 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 +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel1List_QTD.ui' +** +** Created: lun oct 31 17:21:03 2006 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL1LIST_QTD_H +#define DLGREF_2SEL1LIST_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QComboBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; + +class DlgRef_2Sel1List1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel1List1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel1List1Check_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit2; + QPushButton* PushButton1; + QPushButton* PushButton2; + QLabel* TextLabel1; + QLineEdit* LineEdit1; + QLabel* TextLabel2; + QComboBox* ComboBox1; + QLabel* TextLabel3; + QRadioButton* radioButton4; + + +protected: + QGridLayout* DlgRef_2Sel1List1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_2SEL1LIST1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_Skeleton_QTD.cxx b/src/DlgRef/DlgRef_Skeleton_QTD.cxx index dddb3e087..0e2b081bc 100644 --- a/src/DlgRef/DlgRef_Skeleton_QTD.cxx +++ b/src/DlgRef/DlgRef_Skeleton_QTD.cxx @@ -20,7 +20,7 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'DlgRef_Skeleton_QTD.ui' ** -** Created: Fri Mar 17 11:18:06 2006 +** Created: Tue Mar 13 14:40:34 2007 ** by: The User Interface Compiler ($Id$) ** ** WARNING! All changes made in this file will be lost! @@ -57,11 +57,6 @@ DlgRef_Skeleton_QTD::DlgRef_Skeleton_QTD( QWidget* parent, const char* name, boo Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); - GroupMedium = new QGroupBox( this, "GroupMedium" ); - GroupMedium->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupMedium->sizePolicy().hasHeightForWidth() ) ); - - Layout1->addWidget( GroupMedium, 2, 0 ); - GroupButtons = new QGroupBox( this, "GroupButtons" ); GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) ); GroupButtons->setColumnLayout(0, Qt::Vertical ); @@ -155,19 +150,5 @@ DlgRef_Skeleton_QTD::~DlgRef_Skeleton_QTD() */ void DlgRef_Skeleton_QTD::languageChange() { - setCaption( tr( "DlgRef_Skeleton_QTD" ) ); - GroupMedium->setTitle( QString::null ); - GroupButtons->setTitle( QString::null ); - buttonOk->setText( tr( "&Ok" ) ); - buttonApply->setText( tr( "&Apply" ) ); - buttonCancel->setText( tr( "&Cancel" ) ); - buttonHelp->setText( tr( "&Help" ) ); - GroupConstructors->setTitle( QString::null ); - RadioButton1->setText( QString::null ); - RadioButton2->setText( QString::null ); - RadioButton3->setText( QString::null ); - RadioButton4->setText( QString::null ); - GroupBoxName->setTitle( tr( "Result name" ) ); - NameLabel->setText( tr( "Name" ) ); } diff --git a/src/DlgRef/DlgRef_Skeleton_QTD.h b/src/DlgRef/DlgRef_Skeleton_QTD.h index 511d48993..0ecfdfcaa 100644 --- a/src/DlgRef/DlgRef_Skeleton_QTD.h +++ b/src/DlgRef/DlgRef_Skeleton_QTD.h @@ -20,7 +20,7 @@ /**************************************************************************** ** Form interface generated from reading ui file 'DlgRef_Skeleton_QTD.ui' ** -** Created: Fri Mar 17 11:18:06 2006 +** Created: Tue Mar 13 14:40:29 2007 ** by: The User Interface Compiler ($Id$) ** ** WARNING! All changes made in this file will be lost! @@ -53,7 +53,6 @@ public: DlgRef_Skeleton_QTD( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~DlgRef_Skeleton_QTD(); - QGroupBox* GroupMedium; QGroupBox* GroupButtons; QPushButton* buttonOk; QPushButton* buttonApply; diff --git a/src/DlgRef/DlgRef_SpinBox.cxx b/src/DlgRef/DlgRef_SpinBox.cxx index 8a7ad7931..35bec55ba 100644 --- a/src/DlgRef/DlgRef_SpinBox.cxx +++ b/src/DlgRef/DlgRef_SpinBox.cxx @@ -102,3 +102,28 @@ void DlgRef_SpinBox::RangeStepAndValidator(double min, double max,double step, setLineStep(step); ((QDoubleValidator*)validator())->setRange(min, max, decimals); } + +QString DlgRef_SpinBox::PrintDoubleValue (double theValue, int thePrecision) +{ + QString aRes; + aRes.setNum(theValue, 'g', thePrecision); + + // remove trailing zeroes + QString delim( "." ); + + int idx = aRes.findRev( delim ); + if ( idx == -1 ) + return aRes; + + QString iPart = aRes.left( idx ); + QString fPart = aRes.mid( idx + 1 ); + + while ( !fPart.isEmpty() && fPart.at( fPart.length() - 1 ) == '0' ) + fPart.remove( fPart.length() - 1, 1 ); + + aRes = iPart; + if ( !fPart.isEmpty() ) + aRes += delim + fPart; + + return aRes; +} diff --git a/src/DlgRef/DlgRef_SpinBox.h b/src/DlgRef/DlgRef_SpinBox.h index d9675462b..e576781d0 100644 --- a/src/DlgRef/DlgRef_SpinBox.h +++ b/src/DlgRef/DlgRef_SpinBox.h @@ -36,6 +36,7 @@ #define COORD_MIN -1e+15 #define COORD_MAX +1e+15 #define MAX_NUMBER 100000 +#define DBL_DIGITS_DISPLAY 16 //================================================================================= // class : DlgRef_SpinBox @@ -54,10 +55,11 @@ public : void SetValue(double v); double GetValue(); QString GetString(); + + static QString PrintDoubleValue (double theValue, int Precision = DBL_DIGITS_DISPLAY); public slots: void SetStep(double newStep); - }; #endif // GEOMSPINBOX_H diff --git a/src/DlgRef/Makefile.am b/src/DlgRef/Makefile.am index efc180f90..27a7a9d8b 100644 --- a/src/DlgRef/Makefile.am +++ b/src/DlgRef/Makefile.am @@ -56,6 +56,7 @@ dist_libDlgRef_la_SOURCES = \ DlgRef_3Sel4Spin2Check_QTD.cxx \ DlgRef_4Sel1List_QTD.cxx \ DlgRef_2Sel1List_QTD.cxx \ + DlgRef_2Sel1List1Check_QTD.cxx \ DlgRef_1List1Spin1Btn_QTD.cxx \ DlgRef_4Sel1List1Check_QTD.cxx \ DlgRef_1Spin_QTD.cxx \ @@ -112,6 +113,7 @@ MOC_FILES = \ DlgRef_3Sel4Spin2Check_QTD_moc.cxx \ DlgRef_4Sel1List_QTD_moc.cxx \ DlgRef_2Sel1List_QTD_moc.cxx \ + DlgRef_2Sel1List1Check_QTD_moc.cxx \ DlgRef_1List1Spin1Btn_QTD_moc.cxx \ DlgRef_4Sel1List1Check_QTD_moc.cxx \ DlgRef_1Spin_QTD_moc.cxx \ @@ -170,6 +172,7 @@ salomeinclude_HEADERS = \ DlgRef_3Sel4Spin2Check_QTD.h \ DlgRef_4Sel1List_QTD.h \ DlgRef_2Sel1List_QTD.h \ + DlgRef_2Sel1List1Check_QTD.h \ DlgRef_1List1Spin1Btn_QTD.h \ DlgRef_4Sel1List1Check_QTD.h \ DlgRef_1Spin_QTD.h \ diff --git a/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui b/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui index b675f277c..8979116e8 100644 --- a/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui +++ b/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui @@ -20,9 +20,6 @@ 0 - - DlgRef_Skeleton_QTD - true @@ -50,22 +47,6 @@ 6 - - - GroupMedium - - - - 7 - 7 - 0 - 0 - - - - - - GroupButtons @@ -78,9 +59,6 @@ 0 - - - unnamed @@ -109,17 +87,11 @@ buttonOk - - &Ok - buttonApply - - &Apply - @@ -142,17 +114,11 @@ buttonCancel - - &Cancel - buttonHelp - - &Help - @@ -170,9 +136,6 @@ 0 - - - unnamed @@ -201,33 +164,21 @@ RadioButton1 - - - RadioButton2 - - - RadioButton3 - - - RadioButton4 - - - @@ -237,9 +188,6 @@ GroupBoxName - - Result name - unnamed @@ -273,9 +221,6 @@ NameLabel - - Name - diff --git a/src/EntityGUI/EntityGUI_Skeleton_QTD.cxx b/src/EntityGUI/EntityGUI_Skeleton_QTD.cxx index 863f45fe9..302635f39 100644 --- a/src/EntityGUI/EntityGUI_Skeleton_QTD.cxx +++ b/src/EntityGUI/EntityGUI_Skeleton_QTD.cxx @@ -20,7 +20,7 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'EntityGUI_Skeleton_QTD.ui' ** -** Created: Fri Mar 17 15:47:14 2006 +** Created: Tue Mar 13 14:04:48 2007 ** by: The User Interface Compiler ($Id$) ** ** WARNING! All changes made in this file will be lost! @@ -30,9 +30,9 @@ #include #include -#include #include #include +#include #include #include #include @@ -54,11 +54,6 @@ EntityGUI_Skeleton_QTD::EntityGUI_Skeleton_QTD( QWidget* parent, const char* nam Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); - GroupVal = new QGroupBox( this, "GroupVal" ); - GroupVal->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupVal->sizePolicy().hasHeightForWidth() ) ); - - Layout1->addWidget( GroupVal, 2, 0 ); - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) ); GroupConstructors->setColumnLayout(0, Qt::Vertical ); @@ -111,26 +106,6 @@ EntityGUI_Skeleton_QTD::EntityGUI_Skeleton_QTD( QWidget* parent, const char* nam Layout5->addMultiCellWidget( GroupDest1, 0, 0, 0, 1 ); - GroupDest2 = new QButtonGroup( GroupDest, "GroupDest2" ); - GroupDest2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupDest2->sizePolicy().hasHeightForWidth() ) ); - GroupDest2->setColumnLayout(0, Qt::Vertical ); - GroupDest2->layout()->setSpacing( 6 ); - GroupDest2->layout()->setMargin( 11 ); - GroupDest2Layout = new QGridLayout( GroupDest2->layout() ); - GroupDest2Layout->setAlignment( Qt::AlignTop ); - - Layout5->addWidget( GroupDest2, 1, 0 ); - - GroupDest3 = new QButtonGroup( GroupDest, "GroupDest3" ); - GroupDest3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupDest3->sizePolicy().hasHeightForWidth() ) ); - GroupDest3->setColumnLayout(0, Qt::Vertical ); - GroupDest3->layout()->setSpacing( 6 ); - GroupDest3->layout()->setMargin( 11 ); - GroupDest3Layout = new QGridLayout( GroupDest3->layout() ); - GroupDest3Layout->setAlignment( Qt::AlignTop ); - - Layout5->addWidget( GroupDest3, 1, 1 ); - GroupDestLayout->addLayout( Layout5, 0, 0 ); Layout1->addWidget( GroupDest, 1, 0 ); @@ -190,21 +165,5 @@ EntityGUI_Skeleton_QTD::~EntityGUI_Skeleton_QTD() */ void EntityGUI_Skeleton_QTD::languageChange() { - setCaption( tr( "EntityGUI_Skeleton_QTD" ) ); - GroupVal->setTitle( QString::null ); - GroupConstructors->setTitle( tr( "Element Type" ) ); - RadioButton1->setText( tr( "Segment" ) ); - RadioButton2->setText( tr( "Arc" ) ); - GroupDest->setTitle( tr( "Destination" ) ); - GroupDest1->setTitle( tr( "Type" ) ); - RB_Dest2->setText( tr( "Direction" ) ); - RB_Dest1->setText( tr( "Point" ) ); - GroupDest2->setTitle( QString::null ); - GroupDest3->setTitle( QString::null ); - GroupButtons->setTitle( QString::null ); - buttonEnd->setText( tr( "End Sketch" ) ); - buttonClose->setText( tr( "Close Sketch" ) ); - buttonCancel->setText( tr( "&Cancel" ) ); - buttonHelp->setText( tr( "&Help" ) ); } diff --git a/src/EntityGUI/EntityGUI_Skeleton_QTD.h b/src/EntityGUI/EntityGUI_Skeleton_QTD.h index 70468d719..11b95f502 100644 --- a/src/EntityGUI/EntityGUI_Skeleton_QTD.h +++ b/src/EntityGUI/EntityGUI_Skeleton_QTD.h @@ -20,7 +20,7 @@ /**************************************************************************** ** Form interface generated from reading ui file 'EntityGUI_Skeleton_QTD.ui' ** -** Created: Fri Mar 17 15:47:13 2006 +** Created: Tue Mar 13 14:04:42 2007 ** by: The User Interface Compiler ($Id$) ** ** WARNING! All changes made in this file will be lost! @@ -38,9 +38,9 @@ class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QSpacerItem; -class QGroupBox; class QButtonGroup; class QRadioButton; +class QGroupBox; class QPushButton; class GEOM_ENTITYGUI_EXPORT EntityGUI_Skeleton_QTD : public QDialog @@ -51,7 +51,6 @@ public: EntityGUI_Skeleton_QTD( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~EntityGUI_Skeleton_QTD(); - QGroupBox* GroupVal; QButtonGroup* GroupConstructors; QRadioButton* RadioButton1; QRadioButton* RadioButton2; @@ -59,8 +58,6 @@ public: QButtonGroup* GroupDest1; QRadioButton* RB_Dest2; QRadioButton* RB_Dest1; - QButtonGroup* GroupDest2; - QButtonGroup* GroupDest3; QGroupBox* GroupButtons; QPushButton* buttonEnd; QPushButton* buttonClose; @@ -76,8 +73,6 @@ protected: QGridLayout* Layout5; QGridLayout* GroupDest1Layout; QGridLayout* Layout4; - QGridLayout* GroupDest2Layout; - QGridLayout* GroupDest3Layout; QHBoxLayout* GroupButtonsLayout; QHBoxLayout* Layout3; QSpacerItem* Spacer1; diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index 5a3baf23f..9fbd604b0 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -82,10 +82,6 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg(GeometryGUI* GUI, QWidget* parent, buttonClose->setText(tr("GEOM_BUT_CLOSE_SKETCH")); buttonHelp->setText(tr("GEOM_BUT_HELP")); - GroupVal->close(TRUE); - GroupDest2->close(TRUE); - GroupDest3->close(TRUE); - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_UNDO"))); QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_REDO"))); @@ -253,7 +249,6 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg(GeometryGUI* GUI, QWidget* parent, Init(); } - //================================================================================= // function : ~EntityGUI_SketcherDlg() // purpose : Destroys the object and frees any allocated resources @@ -263,7 +258,6 @@ EntityGUI_SketcherDlg::~EntityGUI_SketcherDlg() myGeometryGUI->SetActiveDialogBox( 0 ); } - //================================================================================= // function : eventFilter() // purpose : event filter for spin-boxes to provide Apply action on Return pressed @@ -295,6 +289,16 @@ bool EntityGUI_SketcherDlg::eventFilter (QObject* object, QEvent* event) } } + if (event->type() == QEvent::KeyRelease) { + // NPAL16010 (Sketcher Apply non available if only one line is modified) + // To have Apply active as soon as value text changed + QString s = ((QtxDblSpinBox*) object)->text(); + bool ok; + double newVal = s.toDouble( &ok ); + if ( ok ) + ValueChangedInSpinBox( newVal ); + } + return EntityGUI_Skeleton_QTD::eventFilter(object, event); } @@ -324,16 +328,16 @@ void EntityGUI_SketcherDlg::Init() double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 ); /* min, max, step and decimals for spin boxes */ - Group1Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group4Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, 3); - Group4Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, 3); - Group4Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group4Spin->SpinBox_DS->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); + Group1Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group4Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, DBL_DIGITS_DISPLAY); + Group4Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, DBL_DIGITS_DISPLAY); + Group4Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group4Spin->SpinBox_DS->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY); /* displays Dialog */ GroupConstructors->setEnabled(false); @@ -434,8 +438,8 @@ void EntityGUI_SketcherDlg::PointClicked(int constructorId) if ( constructorId == 1 ) { // XY mySketchType = PT_ABS; - Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X2")); Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_Y2")); myX = 0.0; @@ -450,8 +454,8 @@ void EntityGUI_SketcherDlg::PointClicked(int constructorId) else if ( constructorId == 0 ) { // DXDY mySketchType = PT_RELATIVE; - Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_DX2")); Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_DY2")); myDX = 0.0; @@ -508,8 +512,8 @@ void EntityGUI_SketcherDlg::Dir2Clicked(int constructorId) myLength = 100.0; if ( myConstructorDirId == 2 ) { // Angle - Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY); + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2")); Group2Spin->SpinBox_DX->SetValue(myAngle); Group2Spin->buttonApply->setFocus(); @@ -584,9 +588,9 @@ void EntityGUI_SketcherDlg::Dir2Clicked(int constructorId) } else if ( myConstructorDirId == 3 ) { // DXDY - Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, 3); - Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, 3); - Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, DBL_DIGITS_DISPLAY); + Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, DBL_DIGITS_DISPLAY); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_VX2")); Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_VY2")); myDX = 0.0; @@ -622,54 +626,54 @@ void EntityGUI_SketcherDlg::Dir2Clicked(int constructorId) { // Angle if ( constructorId == 2 ) { // Length - mySketchType = DIR_ANGLE_LENGTH; - Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); - Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); - Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2")); - Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_RADIUS2")); - Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_ANGLE2")); - Group3Spin->SpinBox_DX->SetValue(myAngle); - myRadius = 100.0; - Group3Spin->SpinBox_DY->SetValue(myRadius); - myLength = 30.0; - Group3Spin->SpinBox_DZ->SetValue(myLength); - Group3Spin->show(); - Group3Spin->buttonApply->setFocus(); + mySketchType = DIR_ANGLE_LENGTH; + Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY); + Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY); + Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2")); + Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_ANGLE2")); + Group3Spin->SpinBox_DX->SetValue(myAngle); + myRadius = 100.0; + Group3Spin->SpinBox_DY->SetValue(myRadius); + myLength = 30.0; + Group3Spin->SpinBox_DZ->SetValue(myLength); + Group3Spin->show(); + Group3Spin->buttonApply->setFocus(); } } else if ( myConstructorDirId == 0 ) { // Perpendicular if ( constructorId == 2 ) { // Length - mySketchType = DIR_PER_LENGTH; - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); - Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); - Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); - myRadius = 100.0; - Group2Spin->SpinBox_DX->SetValue(myRadius); - myLength = 30.0; - Group2Spin->SpinBox_DY->SetValue(myLength); - Group2Spin->show(); - Group2Spin->buttonApply->setFocus(); + mySketchType = DIR_PER_LENGTH; + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); + myRadius = 100.0; + Group2Spin->SpinBox_DX->SetValue(myRadius); + myLength = 30.0; + Group2Spin->SpinBox_DY->SetValue(myLength); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); } } else if ( myConstructorDirId == 1 ) { // Tangent if ( constructorId == 2 ) { // Length - mySketchType = DIR_TAN_LENGTH; - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); - Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); - Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); - myRadius = 100.0; - Group2Spin->SpinBox_DX->SetValue(myRadius); - myLength = 30.0; - Group2Spin->SpinBox_DY->SetValue(myLength); - Group2Spin->show(); - Group2Spin->buttonApply->setFocus(); + mySketchType = DIR_TAN_LENGTH; + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); + myRadius = 100.0; + Group2Spin->SpinBox_DX->SetValue(myRadius); + myLength = 30.0; + Group2Spin->SpinBox_DY->SetValue(myLength); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); } } else if ( myConstructorDirId == 3 ) @@ -738,7 +742,18 @@ void EntityGUI_SketcherDlg::ClickOnEnd() myCommand.append( ":WW" ); } else + { + // PAL16008 (Sketcher Validation should be equal to Apply&Close) + if (Group1Spin->buttonApply->isEnabled() && Group1Spin->isVisible() || + Group2Spin->buttonApply->isEnabled() && Group2Spin->isVisible() || + Group3Spin->buttonApply->isEnabled() && Group3Spin->isVisible() || + Group4Spin->buttonApply->isEnabled() && Group4Spin->isVisible() || + Group1Sel ->buttonApply->isEnabled() && Group1Sel->isVisible() ) + { + ClickOnApply(); + } myIsAllAdded = true; + } if( myCommand.size() > 2 ) if( !onAccept() ) @@ -753,7 +768,8 @@ void EntityGUI_SketcherDlg::ClickOnEnd() //================================================================================= bool EntityGUI_SketcherDlg::ClickOnApply() { - ((QPushButton*)sender())->setFocus(); // to update value of currently edited spin-box (PAL11948) + if (sender() && sender()->inherits("QPushButton")) + ((QPushButton*)sender())->setFocus(); // to update value of currently edited spin-box (PAL11948) myCommand.append( GetNewCommand() ); mySketchState = NEXT_POINT; @@ -1091,6 +1107,68 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox(double newValue) vz = Group4Spin->SpinBox_DZ->GetValue(); vs = newValue; } + // NPAL16010 (Sketcher Apply non available if only one line is modified) + // if ValueChangedInSpinBox() called from eventFilter() + else if ( Group1Spin->SpinBox_DX->hasFocus() ) + { + vx = newValue; + } + else if ( Group2Spin->SpinBox_DX ->hasFocus() ) + { + vx = newValue; + vy = Group2Spin->SpinBox_DY->GetValue(); + } + else if ( Group2Spin->SpinBox_DY->hasFocus() ) + { + vx = Group2Spin->SpinBox_DX->GetValue(); + vy = newValue; + } + else if ( Group3Spin->SpinBox_DX->hasFocus() ) + { + vx = newValue; + vy = Group3Spin->SpinBox_DY->GetValue(); + vz = Group3Spin->SpinBox_DZ->GetValue(); + } + else if ( Group3Spin->SpinBox_DY->hasFocus() ) + { + vx = Group3Spin->SpinBox_DX->GetValue(); + vy = newValue; + vz = Group3Spin->SpinBox_DZ->GetValue(); + } + else if ( Group3Spin->SpinBox_DZ->hasFocus() ) + { + vx = Group3Spin->SpinBox_DX->GetValue(); + vy = Group3Spin->SpinBox_DY->GetValue(); + vz = newValue; + } + else if ( Group4Spin->SpinBox_DX->hasFocus() ) + { + vx = newValue; + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = Group4Spin->SpinBox_DS->GetValue(); + } + else if ( Group4Spin->SpinBox_DY->hasFocus() ) + { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = newValue; + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = Group4Spin->SpinBox_DS->GetValue(); + } + else if ( Group4Spin->SpinBox_DZ->hasFocus() ) + { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = newValue; + vs = Group4Spin->SpinBox_DS->GetValue(); + } + else if ( Group4Spin->SpinBox_DS->hasFocus() ) + { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = newValue; + } if ( myConstructorId == 0 ) { // SEGMENT diff --git a/src/EntityGUI/UIFiles/EntityGUI_Skeleton_QTD.ui b/src/EntityGUI/UIFiles/EntityGUI_Skeleton_QTD.ui index c257a8086..cdcd86400 100644 --- a/src/EntityGUI/UIFiles/EntityGUI_Skeleton_QTD.ui +++ b/src/EntityGUI/UIFiles/EntityGUI_Skeleton_QTD.ui @@ -20,9 +20,6 @@ 0 - - EntityGUI_Skeleton_QTD - unnamed @@ -47,22 +44,6 @@ 6 - - - GroupVal - - - - 7 - 7 - 0 - 0 - - - - - - GroupConstructors @@ -75,9 +56,6 @@ 0 - - Element Type - unnamed @@ -106,17 +84,11 @@ RadioButton1 - - Segment - RadioButton2 - - Arc - @@ -134,9 +106,6 @@ 0 - - Destination - unnamed @@ -173,9 +142,6 @@ 0 - - Type - unnamed @@ -204,76 +170,16 @@ RB_Dest2 - - Direction - RB_Dest1 - - Point - - - - GroupDest2 - - - - 7 - 7 - 0 - 0 - - - - - - - - unnamed - - - 11 - - - 6 - - - - - - GroupDest3 - - - - 7 - 7 - 0 - 0 - - - - - - - - unnamed - - - 11 - - - 6 - - - @@ -290,9 +196,6 @@ 0 - - - unnamed @@ -321,17 +224,11 @@ buttonEnd - - End Sketch - buttonClose - - Close Sketch - @@ -354,17 +251,11 @@ buttonCancel - - &Cancel - buttonHelp - - &Help - diff --git a/src/GEOM/GEOM_Object.cxx b/src/GEOM/GEOM_Object.cxx index f04bda383..5c91868fe 100644 --- a/src/GEOM/GEOM_Object.cxx +++ b/src/GEOM/GEOM_Object.cxx @@ -95,19 +95,31 @@ Handle(GEOM_Object) GEOM_Object::GetObject(TDF_Label& theLabel) Handle(GEOM_Object) GEOM_Object::GetReferencedObject(TDF_Label& theLabel) { Handle(TDF_Reference) aRef; - if (!theLabel.FindAttribute(TDF_Reference::GetID(), aRef)) return NULL; + if (!theLabel.FindAttribute(TDF_Reference::GetID(), aRef)) { + return NULL; + } + + if(aRef.IsNull() || aRef->Get().IsNull()) { + return NULL; + } + // Get TreeNode of a referenced function Handle(TDataStd_TreeNode) aT, aFather; - if (!TDataStd_TreeNode::Find(aRef->Get(), aT)) return NULL; + if (!TDataStd_TreeNode::Find(aRef->Get(), aT)) { + return NULL; + } + // Get TreeNode of Object of the referenced function aFather = aT->Father(); - if (aFather.IsNull()) return NULL; + if (aFather.IsNull()) { + return NULL; + } // Get label of the referenced object TDF_Label aLabel = aFather->Label(); - + return GEOM_Object::GetObject(aLabel); } @@ -395,8 +407,10 @@ Handle(TColStd_HSequenceOfTransient) GEOM_Object::GetAllDependency() Standard_Integer aLength = aSeq.Length(); if(aLength > 0) { anArray = new TColStd_HSequenceOfTransient; - for(Standard_Integer j =1; j<=aLength; j++) - anArray->Append(GetReferencedObject(aSeq(j))); + for(Standard_Integer j =1; j<=aLength; j++) { + Handle(GEOM_Object) aRefObj = GetReferencedObject(aSeq(j)); + if(!aRefObj.IsNull()) anArray->Append(aRefObj); + } } return anArray; diff --git a/src/GEOM/GEOM_PythonDump.cxx b/src/GEOM/GEOM_PythonDump.cxx index a3ff987bd..41b9c184f 100644 --- a/src/GEOM/GEOM_PythonDump.cxx +++ b/src/GEOM/GEOM_PythonDump.cxx @@ -43,19 +43,12 @@ namespace GEOM TCollection_AsciiString aDescr; if ( myAppend ) aDescr = myFunction->GetDescription() + "\n\t"; - aDescr += (char *)myStream.str().c_str(); + std::string aString = myStream.str(); + aDescr += (char *)aString.c_str(); myFunction->SetDescription( aDescr ); } } -// TPythonDump::operator TCollection_AsciiString () const -// { -// if (myCounter == 1) { -// return TCollection_AsciiString ((char *)myStream.str().c_str()); -// } -// return TCollection_AsciiString (); -// } - TPythonDump& TPythonDump::operator<< (long int theArg) { myStream< -#include - #include +#include //======================================================================= //function : @@ -51,7 +50,7 @@ GEOMAlgo_BuilderShape() { myNbTypes=9; - myDSFiller=NULL; + myPaveFiller=NULL; myEntryPoint=0; // Entry point through PerformWithFiller () } //======================================================================= @@ -61,9 +60,9 @@ GEOMAlgo_Builder::~GEOMAlgo_Builder() { if (myEntryPoint==1) { - if (myDSFiller) { - delete myDSFiller; - myDSFiller=NULL; + if (myPaveFiller) { + delete myPaveFiller; + myPaveFiller=NULL; } } } @@ -260,23 +259,19 @@ aBB.Add(aCS, aS); } // - if (myDSFiller) { - delete myDSFiller; - myDSFiller=NULL; - } - NMTTools_DSFiller* pDSF=new NMTTools_DSFiller; + NMTTools_PaveFiller* pPF=new NMTTools_PaveFiller; // - pDSF->SetCompositeShape(aCS); - pDSF->Perform(); + pPF->SetCompositeShape(aCS); + pPF->Perform(); // myEntryPoint=1; - PerformInternal(*pDSF); + PerformInternal(*pPF); } //======================================================================= //function : PerformWithFiller //purpose : //======================================================================= - void GEOMAlgo_Builder::PerformWithFiller(const NMTTools_DSFiller& theDSF) + void GEOMAlgo_Builder::PerformWithFiller(const NMTTools_PaveFiller& theDSF) { myEntryPoint=0; // @@ -286,18 +281,18 @@ //function : PerformInternal //purpose : //======================================================================= - void GEOMAlgo_Builder::PerformInternal(const NMTTools_DSFiller& theDSF) + void GEOMAlgo_Builder::PerformInternal(const NMTTools_PaveFiller& pPF) { myErrorStatus=0; // Standard_Boolean bIsDone; // - // 0. myDSFiller - myDSFiller=(NMTTools_DSFiller *)&theDSF; + // 0. myPaveFiller + myPaveFiller=(NMTTools_PaveFiller *)&pPF; // - bIsDone=myDSFiller->IsDone(); + bIsDone=myPaveFiller->IsDone(); if (!bIsDone) { - myErrorStatus=2; // DSFiller is failed + myErrorStatus=2; // PaveFiller is failed return; } // @@ -406,6 +401,6 @@ // // 0 - Ok // 1 - The object is just initialized -// 2 - DSFiller is failed +// 2 - PaveFiller is failed // 10 - No shapes to process // 30 - SolidBuilder failed diff --git a/src/GEOMAlgo/GEOMAlgo_Builder.hxx b/src/GEOMAlgo/GEOMAlgo_Builder.hxx index 2f38d77fb..930b3edf0 100644 --- a/src/GEOMAlgo/GEOMAlgo_Builder.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder.hxx @@ -20,8 +20,8 @@ #ifndef _GEOMAlgo_Builder_HeaderFile #define _GEOMAlgo_Builder_HeaderFile -#ifndef _NMTTools_PDSFiller_HeaderFile -#include +#ifndef _NMTTools_PPaveFiller_HeaderFile +#include #endif #ifndef _TopTools_ListOfShape_HeaderFile #include @@ -50,7 +50,7 @@ #ifndef _TopAbs_ShapeEnum_HeaderFile #include #endif -class NMTTools_DSFiller; +class NMTTools_PaveFiller; class TopoDS_Shape; class TopTools_ListOfShape; class BRepAlgo_Image; @@ -90,9 +90,9 @@ Standard_EXPORT virtual ~GEOMAlgo_Builder(); //! Performs calculations
Standard_EXPORT virtual void Perform() ; -//! Performs calculations using prepared DSFiller
+//! Performs calculations using prepared PaveFiller
//! object theDSF
-Standard_EXPORT virtual void PerformWithFiller(const NMTTools_DSFiller& theDSF) ; +Standard_EXPORT virtual void PerformWithFiller(const NMTTools_PaveFiller& theDSF) ; //! Adds argument theShape of the operation
Standard_EXPORT virtual void AddShape(const TopoDS_Shape& theShape) ; @@ -139,7 +139,7 @@ protected: //! Performs calculations using prepared DSFiller
//! object theDSF
-Standard_EXPORT void PerformInternal(const NMTTools_DSFiller& theDSF) ; +Standard_EXPORT virtual void PerformInternal(const NMTTools_PaveFiller& theDSF) ; //! Prepare information for history support
Standard_EXPORT virtual void PrepareHistory() ; @@ -214,7 +214,7 @@ Standard_EXPORT void BuildDraftSolid(const TopoDS_Shape& theSolid,TopoDS_Shape // Fields PROTECTED // -NMTTools_PDSFiller myDSFiller; +NMTTools_PPaveFiller myPaveFiller; TopTools_ListOfShape myShapes; Standard_Integer myNbTypes; TopTools_MapOfShape myMapFence; diff --git a/src/GEOMAlgo/GEOMAlgo_Builder.jxx b/src/GEOMAlgo/GEOMAlgo_Builder.jxx index 1965f5ec7..4cc8d4a52 100644 --- a/src/GEOMAlgo/GEOMAlgo_Builder.jxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder.jxx @@ -17,8 +17,8 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -#ifndef _NMTTools_DSFiller_HeaderFile -#include +#ifndef _NMTTools_PaveFiller_HeaderFile +#include #endif #ifndef _TopoDS_Shape_HeaderFile #include diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_0.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_0.cxx index 72a8b39dc..728c8404d 100644 --- a/src/GEOMAlgo/GEOMAlgo_Builder_0.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_0.cxx @@ -20,7 +20,7 @@ #include #include -#include +//#include #include #include #include diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx index d42da67e2..b6cdfee66 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx @@ -47,7 +47,6 @@ // #include // -#include #include #include #include @@ -78,8 +77,8 @@ static { myErrorStatus=0; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; // Standard_Integer i, aNb, iV; // @@ -94,7 +93,6 @@ static myImages.Bind(aV, aVSD); // mySameDomainShapes.Add(aV, aVSD); - // } } } @@ -108,8 +106,8 @@ static { myErrorStatus=0; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; const BOPTools_SplitShapesPool& aSSP=pPF->SplitShapesPool(); NMTTools_CommonBlockPool& aCBP=pPF->ChangeCommonBlockPool(); IntTools_Context& aCtx=pPF->ChangeContext(); @@ -218,8 +216,8 @@ static TopTools_MapOfShape aMS; TopTools_MapIteratorOfMapOfShape aItS; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; IntTools_Context& aCtx= pPF->ChangeContext(); // aNbS=aDS.NumberOfShapesOfTheObject(); diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx index 068fbc564..92e9e2cc8 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx @@ -54,7 +54,6 @@ #include #include #include -#include #include #include #include @@ -68,7 +67,6 @@ #include #include -#include #include #include #include @@ -83,6 +81,7 @@ #include #include #include +#include static void UpdateCandidates(const Standard_Integer , @@ -109,9 +108,9 @@ static //======================================================================= void GEOMAlgo_Builder::FillIn2DParts() { - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); - BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; + NMTDS_InterfPool* pIP=pPF->IP(); BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); NMTTools_CommonBlockPool& aCBP=pPF->ChangeCommonBlockPool(); // @@ -193,9 +192,9 @@ static //======================================================================= void GEOMAlgo_Builder::BuildSplitFaces() { - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); - BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; + NMTDS_InterfPool* pIP=pPF->IP(); BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); IntTools_Context& aCtx= pPF->ChangeContext(); // @@ -388,9 +387,9 @@ static //======================================================================= void GEOMAlgo_Builder::FillSameDomainFaces() { - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); - BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; + NMTDS_InterfPool* pIP=pPF->IP(); BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); IntTools_Context& aCtx= pPF->ChangeContext(); // @@ -513,7 +512,7 @@ static TopTools_ListOfShape aLFx; TopTools_ListIteratorOfListOfShape aIt; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); // aNb=aDS.NumberOfShapesOfTheObject(); for (i=1; i<=aNb; ++i) { @@ -557,9 +556,9 @@ static //======================================================================= void GEOMAlgo_Builder::FillInternalVertices() { - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); - BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; + NMTDS_InterfPool* pIP=pPF->IP(); IntTools_Context& aCtx= pPF->ChangeContext(); // BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx index 220cc453f..649c60370 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx @@ -56,7 +56,6 @@ #include #include -#include #include #include @@ -93,8 +92,8 @@ static { myErrorStatus=0; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; IntTools_Context& aCtx= pPF->ChangeContext(); // Standard_Boolean bToReverse; @@ -186,8 +185,8 @@ static { myErrorStatus=0; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; IntTools_Context& aCtx= pPF->ChangeContext(); // Standard_Boolean bIsIN, bHasImage; @@ -416,8 +415,8 @@ static { myErrorStatus=0; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; IntTools_Context& aCtx= pPF->ChangeContext(); // Standard_Integer i, aNbS, iErr; @@ -589,8 +588,8 @@ static { myErrorStatus=0; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; IntTools_Context& aCtx= pPF->ChangeContext(); // //Standard_Boolean bHasImage; diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_4.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_4.cxx index 080093803..8465cebba 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_4.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_4.cxx @@ -35,7 +35,6 @@ #include #include -#include #include @@ -49,8 +48,8 @@ static //======================================================================= const TopTools_ListOfShape& GEOMAlgo_Builder::Generated(const TopoDS_Shape& theS) { - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; IntTools_Context& aCtx=pPF->ChangeContext(); // Standard_Boolean bHasImage, bToReverse; @@ -104,8 +103,8 @@ static //======================================================================= const TopTools_ListOfShape& GEOMAlgo_Builder::Modified(const TopoDS_Shape& theS) { - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; IntTools_Context& aCtx=pPF->ChangeContext(); // Standard_Boolean bHasImage, bToReverse; diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx index 98f4afe30..78c540b08 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -688,19 +689,32 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE, aLP.Clear(); BRep_Tool::PolygonOnTriangulation(aE, aPTE, aTRE, aLoc); if (aTRE.IsNull() || aPTE.IsNull()) { - myErrorStatus=20; // no triangulation found - return; + Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(aE, aLoc); + if (aPE.IsNull()) { + myErrorStatus=20; // no triangulation found + return; + } + const gp_Trsf& aTrsf=aLoc.Transformation(); + const TColgp_Array1OfPnt& aNodes=aPE->Nodes(); + // + aNbNodes=aPE->NbNodes(); + Standard_Integer low = aNodes.Lower(), up = aNodes.Upper(); + for (j=low+1; jNodes(); - // - aNbNodes=aPTE->NbNodes(); - const TColStd_Array1OfInteger& aInds=aPTE->Nodes(); - for (j=2; jNodes(); + // + aNbNodes=aPTE->NbNodes(); + const TColStd_Array1OfInteger& aInds=aPTE->Nodes(); + for (j=2; j #include #include +#include #include #include @@ -748,19 +749,32 @@ aLP.Clear(); BRep_Tool::PolygonOnTriangulation(aE, aPTE, aTRE, aLoc); if (aTRE.IsNull() || aPTE.IsNull()) { - myErrorStatus=20; // no triangulation found - return; + Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(aE, aLoc); + if (aPE.IsNull()) { + myErrorStatus=20; // no triangulation found + return; + } + const gp_Trsf& aTrsf=aLoc.Transformation(); + const TColgp_Array1OfPnt& aNodes=aPE->Nodes(); + // + aNbNodes=aPE->NbNodes(); + Standard_Integer low = aNodes.Lower(), up = aNodes.Upper(); + for (j=low+1; jNodes(); - // - aNbNodes=aPTE->NbNodes(); - const TColStd_Array1OfInteger& aInds=aPTE->Nodes(); - for (j=2; jNodes(); + // + aNbNodes=aPTE->NbNodes(); + const TColStd_Array1OfInteger& aInds=aPTE->Nodes(); + for (j=2; j #endif +#ifndef _TopTools_MapOfShape_HeaderFile +#include +#endif #ifndef _GEOMAlgo_ShapeAlgo_HeaderFile #include #endif #ifndef _TopAbs_ShapeEnum_HeaderFile #include #endif +#ifndef _TopoDS_Compound_HeaderFile +#include +#endif class TopTools_ListOfShape; class TopoDS_Shape; class TopoDS_Edge; @@ -92,6 +98,9 @@ Standard_EXPORT void SetCheckGeometry(const Standard_Boolean aFlag) ; Standard_EXPORT Standard_Boolean CheckGeometry() const; +Standard_EXPORT void SetKeepNonSolids(const Standard_Boolean aFlag) ; + + Standard_EXPORT virtual void Perform() ; @@ -143,6 +152,11 @@ Standard_EXPORT void MakeShapes(const TopAbs_ShapeEnum aType) ; Standard_EXPORT void MakeShells() ; +Standard_EXPORT void MakeSubShapes(const TopoDS_Shape& theShape, + TopTools_MapOfShape& theMS, + TopoDS_Compound& theResult); + + Standard_EXPORT void MakeSolids() ; @@ -173,6 +187,7 @@ Standard_EXPORT Standard_Boolean HasNewSubShape(const TopoDS_Shape& aS) const; // Fields PROTECTED // Standard_Boolean myCheckGeometry; +Standard_Boolean myKeepNonSolids; Standard_Real myTol; TopTools_DataMapOfShapeListOfShape myImages; TopTools_DataMapOfShapeShape myOrigins; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx index 0e53aa6e4..299fb5b1a 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx @@ -317,9 +317,6 @@ static aF=TopoDS::Face(aS); // aNbWires=NbWires(aF); - if (aNbWires>1) { - return; - } // aSurf=BRep_Tool::Surface(aF); GeomAdaptor_Surface aGAS(aSurf); @@ -342,6 +339,8 @@ static 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); @@ -374,6 +373,8 @@ static aInfo.SetPosition(aAx3); aInfo.SetRadius1(aR1); // + if (aNbWires>1) return; + // aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED); // @@ -394,6 +395,8 @@ static 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); @@ -424,6 +427,8 @@ static 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); @@ -456,8 +461,10 @@ static aInfo.SetRadius1(aR1); aInfo.SetRadius2(aR2); // + if (aNbWires>1) return; + // aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); - + // FillDetails(aF, aTorus); } } diff --git a/src/GEOMAlgo/GEOMAlgo_Splitter.cdl b/src/GEOMAlgo/GEOMAlgo_Splitter.cdl index a67c8e222..19991027d 100755 --- a/src/GEOMAlgo/GEOMAlgo_Splitter.cdl +++ b/src/GEOMAlgo/GEOMAlgo_Splitter.cdl @@ -63,6 +63,13 @@ is Limit(me) returns ShapeEnum from TopAbs; + + SetLimitMode(me:out; + aLimitMode:Integer from Standard); + + LimitMode(me) + returns Integer from Standard; + -- -- Protected methods -- @@ -89,5 +96,7 @@ fields myTools : ListOfShape from TopTools is protected; myMapTools : MapOfShape from TopTools is protected; myLimit : ShapeEnum from TopAbs is protected; + myLimitMode : Integer from Standard is protected; + end Splitter; diff --git a/src/GEOMAlgo/GEOMAlgo_Splitter.cxx b/src/GEOMAlgo/GEOMAlgo_Splitter.cxx index 7ea27c32f..431719ab1 100755 --- a/src/GEOMAlgo/GEOMAlgo_Splitter.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Splitter.cxx @@ -42,7 +42,10 @@ #include -#include + +static + void TreatCompound(const TopoDS_Shape& aC, + TopTools_ListOfShape& aLSX); //======================================================================= //function : @@ -53,6 +56,7 @@ GEOMAlgo_Builder() { myLimit=TopAbs_SHAPE; + myLimitMode=0; } //======================================================================= //function : ~ @@ -112,6 +116,22 @@ return myLimit; } //======================================================================= +//function : SetLimitMode +//purpose : +//======================================================================= + void GEOMAlgo_Splitter::SetLimitMode(const Standard_Integer aMode) +{ + myLimitMode=aMode; +} +//======================================================================= +//function : LimitMode +//purpose : +//======================================================================= + Standard_Integer GEOMAlgo_Splitter::LimitMode()const +{ + return myLimitMode; +} +//======================================================================= //function : Clear //purpose : //======================================================================= @@ -168,27 +188,137 @@ Standard_Integer i, aNbS; BRep_Builder aBB; TopoDS_Compound aC; - TopTools_IndexedMapOfShape aM; + TopTools_IndexedMapOfShape aMx; // aBB.MakeCompound(aC); // - TopExp::MapShapes(myShape, myLimit, aM); - aNbS=aM.Extent(); + TopExp::MapShapes(myShape, myLimit, aMx); + aNbS=aMx.Extent(); for (i=1; i<=aNbS; ++i) { - const TopoDS_Shape& aS=aM(i); + const TopoDS_Shape& aS=aMx(i); aBB.Add(aC, aS); } + //modified by NIZNHY-PKV Thu Feb 15 17:09:32 2007f + if (myLimitMode) { + Standard_Integer iType, iLimit, iTypeX; + TopAbs_ShapeEnum aType, aTypeX; + TopTools_ListOfShape aLSP, aLSX; + TopTools_ListIteratorOfListOfShape aIt, aItX, aItIm; + TopTools_MapOfShape aM; + // + iLimit=(Standard_Integer)myLimit; + // + // 1. Collect the shapes to process aLSP + aIt.Initialize(myShapes); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + if (myMapTools.Contains(aS)) { + continue; + } + // + aType=aS.ShapeType(); + iType=(Standard_Integer)aType; + // + if (iType>iLimit) { + aLSP.Append(aS); + } + // + else if (aType==TopAbs_COMPOUND) { + aLSX.Clear(); + // + TreatCompound(aS, aLSX); + // + aItX.Initialize(aLSX); + for (; aItX.More(); aItX.Next()) { + const TopoDS_Shape& aSX=aItX.Value(); + aTypeX=aSX.ShapeType(); + iTypeX=(Standard_Integer)aTypeX; + // + if (iTypeX>iLimit) { + aLSP.Append(aSX); + } + } + } + }// for (; aIt.More(); aIt.Next()) { + // + // 2. Add them to aC + aIt.Initialize(aLSP); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + if (myImages.HasImage(aS)) { + const TopTools_ListOfShape& aLSIm=myImages.Image(aS); + aItIm.Initialize(aLSIm); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aSIm=aItIm.Value(); + if (aM.Add(aSIm)) { + aBB.Add(aC, aSIm); + } + } + } + else { + if (aM.Add(aS)) { + aBB.Add(aC, aS); + } + } + } + }// if (myLimitMode) { + //modified by NIZNHY-PKV Thu Feb 15 17:09:34 2007t myShape=aC; - } + }//if (myLimit!=TopAbs_SHAPE) { // GEOMAlgo_Builder::PostTreat(); +} +//======================================================================= +//function : TreatCompound +//purpose : +//======================================================================= +void TreatCompound(const TopoDS_Shape& aC1, + TopTools_ListOfShape& aLSX) +{ + Standard_Integer aNbC1; + TopAbs_ShapeEnum aType; + TopTools_ListOfShape aLC, aLC1; + TopTools_ListIteratorOfListOfShape aIt, aIt1; + TopoDS_Iterator aItC; // + aLC.Append (aC1); + while(1) { + aLC1.Clear(); + aIt.Initialize(aLC); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aC=aIt.Value(); //C is compound + // + aItC.Initialize(aC); + for (; aItC.More(); aItC.Next()) { + const TopoDS_Shape& aS=aItC.Value(); + aType=aS.ShapeType(); + if (aType==TopAbs_COMPOUND) { + aLC1.Append(aS); + } + else { + aLSX.Append(aS); + } + } + } + // + aNbC1=aLC1.Extent(); + if (!aNbC1) { + break; + } + // + aLC.Clear(); + aIt.Initialize(aLC1); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSC=aIt.Value(); + aLC.Append(aSC); + } + }// while(1) } // // myErrorStatus // // 0 - Ok // 1 - The object is just initialized -// 2 - DSFiller is failed +// 2 - PaveFiller is failed // 10 - No shapes to process // 30 - SolidBuilder failed diff --git a/src/GEOMAlgo/GEOMAlgo_Splitter.hxx b/src/GEOMAlgo/GEOMAlgo_Splitter.hxx index 6ef1e92ac..7f3b69fb7 100644 --- a/src/GEOMAlgo/GEOMAlgo_Splitter.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Splitter.hxx @@ -29,6 +29,9 @@ #ifndef _TopAbs_ShapeEnum_HeaderFile #include #endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif #ifndef _GEOMAlgo_Builder_HeaderFile #include #endif @@ -82,6 +85,12 @@ Standard_EXPORT void SetLimit(const TopAbs_ShapeEnum aLimit) ; Standard_EXPORT TopAbs_ShapeEnum Limit() const; + +Standard_EXPORT void SetLimitMode(const Standard_Integer aLimitMode) ; + + +Standard_EXPORT Standard_Integer LimitMode() const; + //! Adds Tool arguments of the operation as
//! shapes of upper level of container shape theShape
//! =====================================================
@@ -108,6 +117,7 @@ Standard_EXPORT virtual void PostTreat() ; TopTools_ListOfShape myTools; TopTools_MapOfShape myMapTools; TopAbs_ShapeEnum myLimit; +Standard_Integer myLimitMode; private: diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index 33a6fe5ac..c4e65d0bc 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -36,6 +36,7 @@ #include "SUIT_Session.h" #include "SUIT_MessageBox.h" +#include #include using namespace std; @@ -57,12 +58,14 @@ GEOMBase_Skeleton::GEOMBase_Skeleton(GeometryGUI* theGeometryGUI, QWidget* paren if (!name) setName("GEOMBase_Skeleton"); + GroupBoxName->setTitle(tr("GEOM_RESULT_NAME_GRP")); + NameLabel->setText(tr("GEOM_RESULT_NAME_LBL")); + buttonCancel->setText(tr("GEOM_BUT_CLOSE")); buttonOk->setText(tr("GEOM_BUT_OK")); buttonApply->setText(tr("GEOM_BUT_APPLY")); buttonHelp->setText(tr("GEOM_BUT_HELP")); - GroupMedium->close(TRUE); resize(0, 0); Init(); diff --git a/src/GEOMClient/GEOM_Client.cxx b/src/GEOMClient/GEOM_Client.cxx index 2659f6209..3e8eb2058 100644 --- a/src/GEOMClient/GEOM_Client.cxx +++ b/src/GEOMClient/GEOM_Client.cxx @@ -222,7 +222,7 @@ TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_p TopExp::MapShapes(aMainShape, anIndices); /* Case of only one subshape */ - if (list->length() == 1) { + if (list->length() == 1 && list[0] > 0) { S = anIndices.FindKey(list[0]); } else { diff --git a/src/GEOMContext/GEOM_msg_en.po b/src/GEOMContext/GEOM_msg_en.po index ae88996a2..7dc8d22ea 100644 --- a/src/GEOMContext/GEOM_msg_en.po +++ b/src/GEOMContext/GEOM_msg_en.po @@ -1189,6 +1189,9 @@ msgstr "\nShading" msgid "GEOM_RECONSTRUCTION_LIMIT" msgstr "Reconstruction Limit" +msgid "GEOM_KEEP_NONLIMIT_SHAPES" +msgstr "Keep nonlimit shapes" + msgid "GEOM_SUPPRESS_RESULT" msgstr "Suppress Result" diff --git a/src/GEOMContext/GEOM_msg_fr.po b/src/GEOMContext/GEOM_msg_fr.po index 45c9b0ead..d88c44986 100644 --- a/src/GEOMContext/GEOM_msg_fr.po +++ b/src/GEOMContext/GEOM_msg_fr.po @@ -1190,6 +1190,9 @@ msgstr "Ombré" msgid "GEOM_RECONSTRUCTION_LIMIT" msgstr "Limite de Reconstruction" +msgid "GEOM_KEEP_NONLIMIT_SHAPES" +msgstr "Keep nonlimit shapes" + msgid "GEOM_SUPPRESS_RESULT" msgstr "Supprimer le Resultat" diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx index 7af013b20..029e8922a 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.cxx +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -205,14 +205,14 @@ GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const return GEOM::GEOM_Object::_nil(); } -QString GEOMGUI_Selection:: selectionMode() const -{ +QString GEOMGUI_Selection::selectionMode() const +{ SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication()); if (app) { GeometryGUI* aGeomGUI = dynamic_cast( app->module( "Geometry" ) ); - if(aGeomGUI) - switch(aGeomGUI->getLocalSelectionMode()) - { + if (aGeomGUI) { + switch (aGeomGUI->getLocalSelectionMode()) + { case GEOM_POINT : return "VERTEX"; case GEOM_EDGE : return "EDGE"; case GEOM_WIRE : return "WIRE"; @@ -222,6 +222,8 @@ QString GEOMGUI_Selection:: selectionMode() const case GEOM_COMPOUND : return "COMPOUND"; case GEOM_ALLOBJECTS : return "ALL"; default: return ""; - } + } + } } + return ""; } diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index b0fd38adc..5b1c41de5 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -82,6 +82,7 @@ #include #include #include +#include // VTK Includes #include @@ -525,8 +526,12 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) Handle(GEOM_AISShape) AISShape; if (myType == GEOM_VECTOR) AISShape = new GEOM_AISVector (myShape, ""); - else + else { + if (myShape.ShapeType() != TopAbs_VERTEX && // fix pb with not displayed points + !TopoDS_Iterator(myShape).More()) + return;// NPAL15983 (Bug when displaying empty groups) AISShape = new GEOM_AISShape (myShape, ""); + } // Temporary staff: vertex must be infinite for correct visualization AISShape->SetInfiniteState( myShape.Infinite() || myShape.ShapeType() == TopAbs_VERTEX ); diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 01825cc9d..3a2e2c94d 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -1312,6 +1312,9 @@ msgstr "\nShading" msgid "GEOM_RECONSTRUCTION_LIMIT" msgstr "Reconstruction Limit" +msgid "GEOM_KEEP_NONLIMIT_SHAPES" +msgstr "Keep nonlimit shapes" + msgid "GEOM_SUPPRESS_RESULT" msgstr "Suppress Result" @@ -2939,6 +2942,12 @@ msgstr "Rename" msgid "NAME_LBL" msgstr "Name: " +msgid "GEOM_RESULT_NAME_GRP" +msgstr "Result name" + +msgid "GEOM_RESULT_NAME_LBL" +msgstr "Name" + msgid "GEOM_ERR_GET_ENGINE" msgstr "Failed to obtain GEOM Engine component. Reload Geometry module and try again." diff --git a/src/GEOMGUI/GEOM_msg_fr.po b/src/GEOMGUI/GEOM_msg_fr.po index 8d5b1b24d..d4efd381d 100644 --- a/src/GEOMGUI/GEOM_msg_fr.po +++ b/src/GEOMGUI/GEOM_msg_fr.po @@ -1238,6 +1238,9 @@ msgstr "Ombré" msgid "GEOM_RECONSTRUCTION_LIMIT" msgstr "Limite de Reconstruction" +msgid "GEOM_KEEP_NONLIMIT_SHAPES" +msgstr "Keep nonlimit shapes" + msgid "GEOM_SUPPRESS_RESULT" msgstr "Supprimer le Resultat" diff --git a/src/GEOMImpl/GEOMImpl_ArcDriver.cxx b/src/GEOMImpl/GEOMImpl_ArcDriver.cxx index d25eb2199..d08ae24cc 100644 --- a/src/GEOMImpl/GEOMImpl_ArcDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ArcDriver.cxx @@ -35,18 +35,16 @@ #include #include +#include #include #include #include #include -#include -#include -#include +#include #include -#include - #include "utilities.h" + //======================================================================= //function : GetID //purpose : @@ -79,46 +77,54 @@ Standard_Integer GEOMImpl_ArcDriver::Execute(TFunction_Logbook& log) const Standard_Integer aType = aFunction->GetType(); TopoDS_Shape aShape; - if ((aType == CIRC_ARC_THREE_PNT)||(aType == CIRC_ARC_CENTER)) { + if ((aType == CIRC_ARC_THREE_PNT) || (aType == CIRC_ARC_CENTER)) + { Handle(GEOM_Function) aRefPoint1 = aCI.GetPoint1(); Handle(GEOM_Function) aRefPoint2 = aCI.GetPoint2(); Handle(GEOM_Function) aRefPoint3 = aCI.GetPoint3(); + TopoDS_Shape aShapePnt1 = aRefPoint1->GetValue(); TopoDS_Shape aShapePnt2 = aRefPoint2->GetValue(); TopoDS_Shape aShapePnt3 = aRefPoint3->GetValue(); + if (aShapePnt1.ShapeType() == TopAbs_VERTEX && aShapePnt2.ShapeType() == TopAbs_VERTEX && - aShapePnt3.ShapeType() == TopAbs_VERTEX) { + aShapePnt3.ShapeType() == TopAbs_VERTEX) + { gp_Pnt aP1 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt1)); gp_Pnt aP2 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt2)); gp_Pnt aP3 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt3)); + if (aP1.Distance(aP2) < gp::Resolution() || aP1.Distance(aP3) < gp::Resolution() || aP2.Distance(aP3) < gp::Resolution()) Standard_ConstructionError::Raise("Arc creation aborted: coincident points given"); + if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular())) Standard_ConstructionError::Raise("Arc creation aborted: points lay on one line"); - if (aType == CIRC_ARC_THREE_PNT){ - GC_MakeArcOfCircle arc(aP1, aP2, aP3); - aShape = BRepBuilderAPI_MakeEdge(arc).Edge(); + if (aType == CIRC_ARC_THREE_PNT) + { + GC_MakeArcOfCircle arc (aP1, aP2, aP3); + aShape = BRepBuilderAPI_MakeEdge(arc).Edge(); } - if (aType == CIRC_ARC_CENTER){ - Standard_Real Rad = aP1.Distance(aP2); - gce_MakeCirc MC(aP1,gce_MakePln(aP1, aP2, aP3).Value(),Rad); + else // CIRC_ARC_CENTER + { Standard_Boolean sense = aCI.GetSense(); - if (MC.IsDone()) { - const gp_Circ& Circ = MC.Value(); - Standard_Real Alpha1 = ElCLib::Parameter(Circ,aP2); - Standard_Real Alpha2 = ElCLib::Parameter(Circ,aP3); - Handle(Geom_Circle) C = new Geom_Circle(Circ); - Handle(Geom_TrimmedCurve) TheArc; - if (!sense) - TheArc= new Geom_TrimmedCurve(C,Alpha1,Alpha2,false); - if (sense) - TheArc= new Geom_TrimmedCurve(C,Alpha2,Alpha1,false); - aShape = BRepBuilderAPI_MakeEdge(TheArc).Edge(); - } + + Standard_Real aRad = aP1.Distance(aP2); + gp_Vec aV1 (aP1, aP2); + gp_Vec aV2 (aP1, aP3); + gp_Vec aN = aV1 ^ aV2; + + if (sense) + aN = -aN; + + GC_MakeCircle circ (aP1, aN, aRad); + Handle(Geom_Circle) aGeomCirc = circ.Value(); + + GC_MakeArcOfCircle arc (aGeomCirc->Circ(), aP2, aP3, Standard_True); + aShape = BRepBuilderAPI_MakeEdge(arc).Edge(); } } } else { @@ -129,8 +135,7 @@ Standard_Integer GEOMImpl_ArcDriver::Execute(TFunction_Logbook& log) const aFunction->SetValue(aShape); log.SetTouched(Label()); - MESSAGE("Out of building step ..."); - return 1; + return 1; } diff --git a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx index 9e2d85745..2efdd7ca2 100644 --- a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx @@ -34,7 +34,8 @@ #include #include -#include +//#include +#include #include #include "utilities.h" @@ -470,14 +471,21 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aCompound = anArgs(1); // Glue coincident faces and edges (with Partition algorithm). - NMTAlgo_Splitter1 PS; - PS.AddShape(aCompound); - PS.Compute(); - PS.SetRemoveWebs(Standard_False); -// PS.Build(aCompound.ShapeType()); - PS.Build(TopAbs_SOLID); - - aShape = PS.Shape(); + //NMTAlgo_Splitter1 PS; + //PS.AddShape(aCompound); + //PS.Compute(); + //PS.SetRemoveWebs(Standard_False); + // PS.Build(aCompound.ShapeType()); + //PS.Build(TopAbs_SOLID); + //aShape = PS.Shape(); + + GEOMAlgo_Gluer aGluer; + aGluer.SetShape(aCompound); + aGluer.SetCheckGeometry(Standard_True); + aGluer.Perform(); + aShape = aGluer.Result(); + + } else { } @@ -537,7 +545,7 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const } // 5. Glue Faces - aShape = GEOMImpl_GlueDriver::GlueFaces(aComp, Precision::Confusion()); + aShape = GEOMImpl_GlueDriver::GlueFaces(aComp, Precision::Confusion(), Standard_False); } } else if (aType == BLOCK_MULTI_TRANSFORM_1D || @@ -643,7 +651,7 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const } // Glue faces of the multi-block - aShape = GEOMImpl_GlueDriver::GlueFaces(aMulti, aTol); + aShape = GEOMImpl_GlueDriver::GlueFaces(aMulti, aTol, Standard_False); } else { // unknown function type return 0; diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx index 4bf020b61..c419cd6d5 100644 --- a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx @@ -153,6 +153,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const } if (isCompound) { + /* TopTools_ListOfShape listShapeC; AddSimpleShapes(C, listShapeC); TopTools_ListIteratorOfListOfShape itSubC (listShapeC); @@ -165,6 +166,14 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion()); else aShape = C; + */ + + // As GlueFaces has been improved to keep all kind of shapes + TopExp_Explorer anExp (C, TopAbs_VERTEX); + if (anExp.More()) + aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion(), Standard_True); + else + aShape = C; } } @@ -215,6 +224,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const } if (isCompound) { + /* TopTools_ListOfShape listShapeC; AddSimpleShapes(C, listShapeC); TopTools_ListIteratorOfListOfShape itSubC (listShapeC); @@ -227,11 +237,20 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion()); else aShape = C; + */ + + // As GlueFaces has been improved to keep all kind of shapes + TopExp_Explorer anExp (C, TopAbs_VERTEX); + if (anExp.More()) + aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion(), Standard_True); + else + aShape = C; } } // perform FUSE operation else if (aType == BOOLEAN_FUSE) { + /* Fix for NPAL15379: refused // Check arguments TopTools_ListOfShape listShape1, listShape2; AddSimpleShapes(aShape1, listShape1); @@ -305,6 +324,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const } } } + */ // Perform BRepAlgoAPI_Fuse BO (aShape1, aShape2); @@ -367,8 +387,16 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const } } - if (isCompound) - aShape = C; + if (isCompound) { + //aShape = C; + + // As GlueFaces has been improved to keep all kind of shapes + TopExp_Explorer anExp (C, TopAbs_VERTEX); + if (anExp.More()) + aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion(), Standard_True); + else + aShape = C; + } } // UNKNOWN operation diff --git a/src/GEOMImpl/GEOMImpl_ExportDriver.cxx b/src/GEOMImpl/GEOMImpl_ExportDriver.cxx index e2d0629e4..559908207 100644 --- a/src/GEOMImpl/GEOMImpl_ExportDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ExportDriver.cxx @@ -113,7 +113,10 @@ Standard_Integer GEOMImpl_ExportDriver::Execute(TFunction_Logbook& log) const int res = fp( aShape, aFileName, aFormatName ); // unload plugin library - //UnLoadLib( anExportLib ); + // commented by enk: + // the bug was occured: using ACIS Import/Export plugin + // UnLoadLib( anExportLib ); + if ( res ) log.SetTouched(Label()); diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx index e056bf7d8..ec18620ff 100644 --- a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx @@ -73,6 +73,7 @@ const Standard_GUID& GEOMImpl_GlueDriver::GetID() //======================================================================= TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& theShape, const Standard_Real theTolerance, + const Standard_Boolean doKeepNonSolids, TCollection_AsciiString& theWarning) const { Standard_Integer iErr, iWrn; @@ -82,6 +83,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the aGluer.SetShape(theShape); aGluer.SetTolerance(theTolerance); aGluer.SetCheckGeometry(Standard_True); + aGluer.SetKeepNonSolids(doKeepNonSolids); aGluer.Perform(); @@ -197,7 +199,8 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the //purpose : //======================================================================= TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape, - const Standard_Real theTolerance) + const Standard_Real theTolerance, + const Standard_Boolean doKeepNonSolids) { Standard_Integer iErr, iWrn; TopoDS_Shape aRes; @@ -206,6 +209,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape, aGluer.SetShape(theShape); aGluer.SetTolerance(theTolerance); aGluer.SetCheckGeometry(Standard_True); + aGluer.SetKeepNonSolids(doKeepNonSolids); aGluer.Perform(); @@ -261,6 +265,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape, //======================================================================= TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape, const Standard_Real theTolerance, + const Standard_Boolean doKeepNonSolids, const TopTools_MapOfShape& aFaces) { TopoDS_Shape aRes; @@ -272,6 +277,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape, aGluer.SetShape(theShape); aGluer.SetTolerance(theTolerance); + aGluer.SetKeepNonSolids(doKeepNonSolids); aGluer.Perform(); Standard_Integer iErr = aGluer.ErrorStatus(); if (iErr) return aRes; @@ -327,8 +333,10 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const Standard_Real tol3d = aCI.GetTolerance(); + Standard_Boolean aKeepNonSolids = aCI.GetKeepNonSolids(); + if (aType == GLUE_FACES) { - aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aWrn); + aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aKeepNonSolids, aWrn); } else { // aType == GLUE_FACES_BY_LIST Handle(TColStd_HSequenceOfTransient) SF = aCI.GetFaces(); @@ -347,7 +355,7 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const if(!aFaces.Contains(aFace)) aFaces.Add(aFace); } - aShape = GlueFacesByList(aShapeBase, tol3d, aFaces); + aShape = GlueFacesByList(aShapeBase, tol3d, aKeepNonSolids, aFaces); } if (aShape.IsNull()) return 0; diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx index eee00b868..e7c3befa8 100644 --- a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx @@ -150,14 +150,17 @@ Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_GlueDriver() {}; Standard_EXPORT static TopoDS_Shape GlueFaces (const TopoDS_Shape& theShape, - const Standard_Real theTolerance); + const Standard_Real theTolerance, + const Standard_Boolean doKeepNonSolids = Standard_True); Standard_EXPORT TopoDS_Shape GlueFacesWithWarnings (const TopoDS_Shape& theShape, const Standard_Real theTolerance, + const Standard_Boolean doKeepNonSolids, TCollection_AsciiString& theWarning) const; Standard_EXPORT static TopoDS_Shape GlueFacesByList (const TopoDS_Shape& theShape, const Standard_Real theTolerance, + const Standard_Boolean doKeepNonSolids, const TopTools_MapOfShape& aFaces); diff --git a/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx b/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx index d2753622d..f5c4040a1 100644 --- a/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx @@ -148,7 +148,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition const Standard_Integer theLimit, const Standard_Boolean theRemoveWebs, const Handle(TColStd_HArray1OfInteger)& theMaterials, - const Standard_Boolean thePerformSelfIntersections) + const Standard_Integer theKeepNonlimitShapes, + const Standard_Boolean thePerformSelfIntersections) { SetErrorCode(KO); @@ -251,6 +252,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition // Limit aCI.SetLimit(theLimit); + aCI.SetKeepNonlimitShapes(theKeepNonlimitShapes); // Materials if (theRemoveWebs) { @@ -302,7 +304,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition pd << ", " << theMaterials->Value(i); } } - pd << "])"; + pd << "], " << theKeepNonlimitShapes <<")"; SetErrorCode(OK); return aPartition; diff --git a/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx b/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx index fd82587b2..6dc82d7be 100644 --- a/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx @@ -46,7 +46,8 @@ class GEOMImpl_IBooleanOperations : public GEOM_IOperations { const Standard_Integer theLimit, const Standard_Boolean theRemoveWebs, const Handle(TColStd_HArray1OfInteger)& theMaterials, - const Standard_Boolean thePerformSelfIntersections); + const Standard_Integer theKeepNonlimitShapes, + const Standard_Boolean thePerformSelfIntersections); Standard_EXPORT Handle(GEOM_Object) MakeHalfPartition (Handle(GEOM_Object) theShape, Handle(GEOM_Object) thePlane); diff --git a/src/GEOMImpl/GEOMImpl_IGlue.hxx b/src/GEOMImpl/GEOMImpl_IGlue.hxx index 7670ed70a..e6e269221 100644 --- a/src/GEOMImpl/GEOMImpl_IGlue.hxx +++ b/src/GEOMImpl/GEOMImpl_IGlue.hxx @@ -27,6 +27,7 @@ #define GLUE_ARG_BASE 1 #define GLUE_ARG_TOLER 2 #define GLUE_ARG_FACES 3 +#define GLUE_ARG_KEEPALL 4 class GEOMImpl_IGlue { @@ -50,6 +51,9 @@ class GEOMImpl_IGlue Handle(TColStd_HSequenceOfTransient) GetFaces() { return _func->GetReferenceList(GLUE_ARG_FACES); } + void SetKeepNonSolids (Standard_Boolean theFlag) { _func->SetInteger(GLUE_ARG_KEEPALL, theFlag ? 1 : 0); } + Standard_Boolean GetKeepNonSolids() { return (_func->GetInteger(GLUE_ARG_KEEPALL) != 0); } + private: Handle(GEOM_Function) _func; diff --git a/src/GEOMImpl/GEOMImpl_IPartition.hxx b/src/GEOMImpl/GEOMImpl_IPartition.hxx index 1141f0f0c..bf1ff4d7c 100644 --- a/src/GEOMImpl/GEOMImpl_IPartition.hxx +++ b/src/GEOMImpl/GEOMImpl_IPartition.hxx @@ -36,6 +36,8 @@ #define PART_ARG_SHAPE 7 #define PART_ARG_PLANE 8 +#define PART_ARG_KEEP_NONLIMIT_SHAPES 9 + class GEOMImpl_IPartition { public: @@ -44,6 +46,9 @@ class GEOMImpl_IPartition void SetLimit(int theLimit) { _func->SetInteger(PART_ARG_LIMIT, theLimit); } + void SetKeepNonlimitShapes(int theKeepNonlimitShapes) + { _func->SetInteger(PART_ARG_KEEP_NONLIMIT_SHAPES,theKeepNonlimitShapes ); } + void SetShapes(const Handle(TColStd_HSequenceOfTransient)& theShapes) { _func->SetReferenceList(PART_ARG_SHAPES, theShapes); } @@ -62,6 +67,8 @@ class GEOMImpl_IPartition int GetLimit() { return _func->GetInteger(PART_ARG_LIMIT); } + int GetKeepNonlimitShapes() { return _func->GetInteger(PART_ARG_KEEP_NONLIMIT_SHAPES); } + Handle(TColStd_HSequenceOfTransient) GetShapes() { return _func->GetReferenceList(PART_ARG_SHAPES); } Handle(TColStd_HSequenceOfTransient) GetTools() { return _func->GetReferenceList(PART_ARG_TOOLS); } Handle(TColStd_HSequenceOfTransient) GetKeepIns() { return _func->GetReferenceList(PART_ARG_KEEP_IN); } diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index 28cae6290..8f698def7 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -17,6 +17,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : GEOMImpl_IShapesOperations.cxx +// Created : +// Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007 +// Project : SALOME +// $Header$ #include @@ -42,7 +47,6 @@ #include "GEOMAlgo_FinderShapeOnQuad.hxx" #include "GEOMAlgo_FinderShapeOn2.hxx" #include "GEOMAlgo_ClsfBox.hxx" -//#include "GEOMAlgo_ClsfSurf.hxx" #include "GEOMAlgo_Gluer1.hxx" #include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx" #include "GEOMAlgo_CoupleOfShapes.hxx" @@ -62,6 +66,7 @@ #include #include +#include #include #include #include @@ -78,6 +83,7 @@ #include #include #include +#include #include #include #include @@ -110,6 +116,16 @@ #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC +// Includes added for GetInPlace algorithm improvement + +#include +#include +#include + +#include +#include +#include + //============================================================================= /*! * constructor: @@ -496,7 +512,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShape //============================================================================= Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces (Handle(GEOM_Object) theShape, - const Standard_Real theTolerance) + const Standard_Real theTolerance, + const Standard_Boolean doKeepNonSolids) { SetErrorCode(KO); @@ -520,6 +537,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces aCI.SetBase(aRefShape); aCI.SetTolerance(theTolerance); + aCI.SetKeepNonSolids(doKeepNonSolids); //Compute the sub-shape value Standard_Boolean isWarning = Standard_False; @@ -635,7 +653,8 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList (Handle(GEOM_Object) theShape, const Standard_Real theTolerance, - list theFaces) + list theFaces, + const Standard_Boolean doKeepNonSolids) { SetErrorCode(KO); @@ -659,6 +678,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList aCI.SetBase(aRefShape); aCI.SetTolerance(theTolerance); + aCI.SetKeepNonSolids(doKeepNonSolids); + Handle(TColStd_HSequenceOfTransient) aFaces = new TColStd_HSequenceOfTransient; list::iterator it = theFaces.begin(); for (; it != theFaces.end(); it++) { @@ -1420,6 +1441,12 @@ Handle(TColStd_HSequenceOfInteger) TopoDS_Shape aBox = theBox->GetValue(); TopoDS_Shape aShape = theShape->GetValue(); + // Check presence of triangulation, build if need + if (!CheckTriangulation(aShape)) { + SetErrorCode("Cannot build triangulation on the shape"); + return aSeqOfIDs; + } + // Call algo GEOMAlgo_FinderShapeOn2 aFinder; Standard_Real aTol = 0.0001; // default value @@ -1581,8 +1608,10 @@ Handle(TColStd_HSequenceOfInteger) Handle(TColStd_HSequenceOfInteger) aSeqOfIDs; // Check presence of triangulation, build if need - if (!CheckTriangulation(theShape)) + if (!CheckTriangulation(theShape)) { + SetErrorCode("Cannot build triangulation on the shape"); return aSeqOfIDs; + } // Call algo GEOMAlgo_FinderShapeOn1 aFinder; @@ -2201,8 +2230,10 @@ Handle(TColStd_HSequenceOfInteger) Handle(TColStd_HSequenceOfInteger) aSeqOfIDs; // Check presence of triangulation, build if need - if (!CheckTriangulation(aShape)) + if (!CheckTriangulation(aShape)) { + SetErrorCode("Cannot build triangulation on the shape"); return aSeqOfIDs; + } // Call algo gp_Pnt aPntTL = BRep_Tool::Pnt(TopoDS::Vertex(aTL)); @@ -2392,7 +2423,7 @@ Handle(TColStd_HSequenceOfInteger) //============================================================================= /*! - * GetInPlace + * GetInPlaceOfShape */ //============================================================================= static bool GetInPlaceOfShape (const Handle(GEOM_Function)& theWhereFunction, @@ -2514,7 +2545,182 @@ static bool GetInPlaceOfShape (const Handle(GEOM_Function)& theWhereFunction, return isFound; } -Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace +//============================================================================= +/*! + * GetShapeProperties + */ +//============================================================================= + +void GEOMImpl_IShapesOperations::GetShapeProperties( const TopoDS_Shape aShape, Standard_Real tab[], + gp_Pnt & aVertex ) +{ + GProp_GProps SProps, VProps; + gp_Pnt aCenterMass; + TopoDS_Shape aPntShape; + Standard_Real aShapeSize; + + BRepGProp::VolumeProperties(aShape, VProps); + aCenterMass = VProps.CentreOfMass(); + aShapeSize = VProps.Mass(); + if (aShape.ShapeType() == TopAbs_FACE) { + BRepGProp::SurfaceProperties(aShape, SProps); + aCenterMass = SProps.CentreOfMass(); + aShapeSize = SProps.Mass(); + } + + aPntShape = BRepBuilderAPI_MakeVertex(aCenterMass).Shape(); + aVertex = BRep_Tool::Pnt( TopoDS::Vertex( aPntShape ) ); + tab[0] = aVertex.X(); + tab[1] = aVertex.Y(); + tab[2] = aVertex.Z(); + tab[3] = aShapeSize; + return; +} + +//============================================================================= +/*! + * GetInPlace + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (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(); + + 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); + + TColStd_ListOfInteger aModifiedList; + Standard_Integer aWhereIndex; + Handle(TColStd_HArray1OfInteger) aModifiedArray; + Handle(GEOM_Object) aResult; + + bool isFound = false; + Standard_Integer 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_1D, Tol_2D, Tol_3D, Tol_Mass; + gp_Pnt aPnt, aPnt_aWhat; + GProp_GProps aProps; + + // 2D or 3D shapes + if ( aWhat.ShapeType() == TopAbs_COMPOUND || + aWhat.ShapeType() == TopAbs_SHELL || + aWhat.ShapeType() == TopAbs_COMPSOLID ) { + TopExp_Explorer Exp( aWhat, TopAbs_ShapeEnum( iType ) ); + if ( ! Exp.More() ) iType = TopAbs_FACE; + } + else if ( aWhat.ShapeType() == TopAbs_FACE ) + iType = TopAbs_FACE; + + TopExp_Explorer Exp_aWhat( aWhat, TopAbs_ShapeEnum( iType ) ); + TopExp_Explorer Exp_aWhere( aWhere, TopAbs_ShapeEnum( iType ) ); + TopExp_Explorer Exp_Edge( aWhere, TopAbs_EDGE ); + + // Find the shortest edge in theShapeWhere shape + for ( Standard_Integer nbEdge = 0; Exp_Edge.More(); Exp_Edge.Next(), nbEdge++ ) { + BRepGProp::LinearProperties(Exp_Edge.Current(), aProps); + if ( ! nbEdge ) min_l = aProps.Mass(); + if ( aProps.Mass() < min_l ) min_l = aProps.Mass(); + } + + // Compute tolerances + 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) ); + + Tol_Mass = Tol_3D; + if ( iType == TopAbs_FACE ) Tol_Mass = Tol_2D; + + // Compute the ShapeWhat Mass + for ( ; Exp_aWhat.More(); Exp_aWhat.Next() ) { + if ( iType == TopAbs_SOLID ) BRepGProp::VolumeProperties(Exp_aWhat.Current(), aProps); + else if ( iType == TopAbs_FACE ) BRepGProp::SurfaceProperties(Exp_aWhat.Current(), aProps); + aWhat_Mass += aProps.Mass(); + } + + // Finding the Sub-ShapeWhere + for ( Exp_aWhere.ReInit(); Exp_aWhere.More(); Exp_aWhere.Next() ) { + 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) ) { + BRepClass3d_SolidClassifier SC_aWhere (Exp_aWhere.Current(), aPnt, Precision::Confusion()); + BRepClass3d_SolidClassifier SC_aWhat (Exp_aWhat.Current(), aPnt, Precision::Confusion()); + // Block construction 3D + if ( SC_aWhere.State() == TopAbs_IN && SC_aWhat.State() == TopAbs_IN ) isFound = true; + // Block construction 2D + else if ( SC_aWhere.State() == TopAbs_ON && SC_aWhat.State() == TopAbs_ON ) isFound = true; + } + if ( isFound ) { + aWhereIndex = aWhereIndices.FindIndex(Exp_aWhere.Current()); + aModifiedList.Append(aWhereIndex); + aWhere_Mass += tab_aWhere[3]; + isFound = false; + break; + } + } + if ( fabs( aWhat_Mass - aWhere_Mass ) <= Tol_Mass ) break; + } + + 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); + if (aResult.IsNull()) { + SetErrorCode("Error in algorithm: result found, but cannot be returned."); + return NULL; + } + + if (aModifiedArray->Length() > 1) { + //Set a GROUP type + aResult->SetType(GEOM_GROUP); + + //Set a sub shape type + TopoDS_Shape aFirstFound = aWhereIndices.FindKey(aModifiedArray->Value(1)); + TopAbs_ShapeEnum aShapeType = aFirstFound.ShapeType(); + + TDF_Label aFreeLabel = aResult->GetFreeLabel(); + TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)aShapeType); + } + + //Make a Python command + Handle(GEOM_Function) aFunction = aResult->GetFunction(1); + + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetInPlace(" + << theShapeWhere << ", " << theShapeWhat << ")"; + + SetErrorCode(OK); + return aResult; +} + +//======================================================================= +//function : GetInPlaceByHistory +//purpose : +//======================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceByHistory (Handle(GEOM_Object) theShapeWhere, Handle(GEOM_Object) theShapeWhat) { @@ -2645,22 +2851,65 @@ void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL) SL.Append( aShapes( OrderInd(Index) )); } +//======================================================================= +//function : CompsolidToCompound +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_IShapesOperations::CompsolidToCompound (const TopoDS_Shape& theCompsolid) +{ + if (theCompsolid.ShapeType() != TopAbs_COMPSOLID) { + return theCompsolid; + } + + TopoDS_Compound aCompound; + BRep_Builder B; + B.MakeCompound(aCompound); + + TopTools_MapOfShape mapShape; + TopoDS_Iterator It (theCompsolid, Standard_True, Standard_True); + + for (; It.More(); It.Next()) { + TopoDS_Shape aShape_i = It.Value(); + if (mapShape.Add(aShape_i)) { + B.Add(aCompound, aShape_i); + } + } + + return aCompound; +} + //======================================================================= //function : CheckTriangulation //purpose : //======================================================================= bool GEOMImpl_IShapesOperations::CheckTriangulation (const TopoDS_Shape& aShape) { + bool isTriangulation = true; + TopExp_Explorer exp (aShape, TopAbs_FACE); - if (!exp.More()) { - SetErrorCode("Shape without faces given"); - return false; + 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 (aShape, TopAbs_EDGE); + if (!expe.More()) { + return false; + } + TopLoc_Location aLoc; + Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(TopoDS::Edge(expe.Current()), aLoc); + if (aPE.IsNull()) { + isTriangulation = false; + } } - TopLoc_Location aTopLoc; - Handle(Poly_Triangulation) aTRF; - aTRF = BRep_Tool::Triangulation(TopoDS::Face(exp.Current()), aTopLoc); - if (aTRF.IsNull()) { + if (!isTriangulation) { // calculate deflection Standard_Real aDeviationCoefficient = 0.001; @@ -2773,6 +3022,7 @@ static bool isSameFace(const TopoDS_Face& theFace1, const TopoDS_Face& theFace2) if(P.Z() > zmaxB2) zmaxB2 = P.Z(); } + //Compare the bounding boxes of both faces if(gp_Pnt(xminB1, yminB1, zminB1).Distance(gp_Pnt(xminB2, yminB2, zminB2)) > MAX_TOLERANCE) return false; @@ -2780,6 +3030,33 @@ static bool isSameFace(const TopoDS_Face& theFace1, const TopoDS_Face& theFace2) if(gp_Pnt(xmaxB1, ymaxB1, zmaxB1).Distance(gp_Pnt(xmaxB2, ymaxB2, zmaxB2)) > MAX_TOLERANCE) return false; + Handle(Geom_Surface) S1 = BRep_Tool::Surface(theFace1); + Handle(Geom_Surface) S2 = BRep_Tool::Surface(theFace2); + + //Check if there a coincidence of two surfaces at least in two points + double U11, U12, V11, V12, U21, U22, V21, V22; + BRepTools::UVBounds(theFace1, U11, U12, V11, V12); + BRepTools::UVBounds(theFace2, U21, U22, V21, V22); + + double rangeU = U12-U11; + double rangeV = V12-V11; + double U = U11 + rangeU/3.0; + double V = V11 + rangeV/3.0; + gp_Pnt P1 = S1->Value(U, V); + U = U11+rangeU*2.0/3.0; + V = V11+rangeV*2.0/3.0; + gp_Pnt P2 = S1->Value(U, V); + + if(!GeomLib_Tool::Parameters(S2, P1, MAX_TOLERANCE, U, V) || U < U21 || U > U22 || V < V21 || V > V22) + return false; + + if(P1.Distance(S2->Value(U,V)) > MAX_TOLERANCE) return false; + + if(!GeomLib_Tool::Parameters(S2, P2, MAX_TOLERANCE, U, V) || U < U21 || U > U22 || V < V21 || V > V22) + return false; + + if(P2.Distance(S2->Value(U, V)) > MAX_TOLERANCE) return false; + //Check that each edge of the Face1 has a counterpart in the Face2 TopTools_MapOfOrientedShape aMap; TopTools_ListIteratorOfListOfShape LSI1(LS1); @@ -2799,36 +3076,6 @@ static bool isSameFace(const TopoDS_Face& theFace1, const TopoDS_Face& theFace2) if(!isFound) return false; } - Handle(Geom_Surface) S1 = BRep_Tool::Surface(theFace1); - Handle(Geom_Surface) S2 = BRep_Tool::Surface(theFace2); - if(S1->DynamicType() == S2->DynamicType()) { - return true; - } - else { //Check if there a coincidence of two surfaces at least in two points - double U11, U12, V11, V12, U21, U22, V21, V22; - BRepTools::UVBounds(theFace1, U11, U12, V11, V12); - BRepTools::UVBounds(theFace2, U21, U22, V21, V22); - - double rangeU = U12-U11; - double rangeV = V12-V11; - double U = U11 + rangeU/3.0; - double V = V11 + rangeV/3.0; - gp_Pnt P1 = S1->Value(U, V); - U = U11+rangeU*2.0/3.0; - V = V11+rangeV*2.0/3.0; - gp_Pnt P2 = S1->Value(U, V); - - if(!GeomLib_Tool::Parameters(S2, P1, MAX_TOLERANCE, U, V) || U < U21 || U > U22 || V < V21 || V > V22) - return false; - - if(P1.Distance(S2->Value(U,V)) > MAX_TOLERANCE) return false; - - if(!GeomLib_Tool::Parameters(S2, P2, MAX_TOLERANCE, U, V) || U < U21 || U > U22 || V < V21 || V > V22) - return false; - - if(P2.Distance(S2->Value(U, V)) > MAX_TOLERANCE) return false; - } - return true; } diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx index 42d2ed991..1e8cdc2c8 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx @@ -17,7 +17,14 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // - +//============================================================================= +// File : GEOMImpl_IShapesOperations.hxx +// Created : +// Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007 +// Project : SALOME +// Copyright : CEA 2003 +// $Header$ +//============================================================================= #ifndef _GEOMImpl_IShapesOperations_HXX_ #define _GEOMImpl_IShapesOperations_HXX_ @@ -32,11 +39,14 @@ #include #include +#include + class GEOM_Engine; class Handle(GEOM_Object); class Handle(TColStd_HArray1OfInteger); -class GEOMImpl_IShapesOperations : public GEOM_IOperations { +class GEOMImpl_IShapesOperations : public GEOM_IOperations +{ public: Standard_EXPORT GEOMImpl_IShapesOperations(GEOM_Engine* theEngine, int theDocID); Standard_EXPORT ~GEOMImpl_IShapesOperations(); @@ -60,22 +70,24 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakeCompound (list theShapes); Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape, - const Standard_Real theTolerance); + 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, const Standard_Real theTolerance, - list theFaces); + list theFaces, + const Standard_Boolean doKeepNonSolids); Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object) theShape, - const Standard_Integer theShapeType, - const Standard_Boolean isSorted); + const Standard_Integer theShapeType, + const Standard_Boolean isSorted); Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs (Handle(GEOM_Object) theShape, - const Standard_Integer theShapeType, - const Standard_Boolean isSorted); + const Standard_Integer theShapeType, + const Standard_Boolean isSorted); Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object) theMainShape, const Standard_Integer theID); @@ -112,22 +124,25 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { const GEOMAlgo_State theState); - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnCylinder (const Handle(GEOM_Object)& theShape, - const Standard_Integer theShapeType, - const Handle(GEOM_Object)& theAxis, - const Standard_Real theRadius, - const GEOMAlgo_State theState); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) + GetShapesOnCylinder (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAxis, + const Standard_Real theRadius, + const GEOMAlgo_State theState); - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnSphere (const Handle(GEOM_Object)& theShape, - const Standard_Integer theShapeType, - const Handle(GEOM_Object)& theCenter, - const Standard_Real theRadius, - const GEOMAlgo_State theState); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) + GetShapesOnSphere (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theCenter, + const Standard_Real theRadius, + const GEOMAlgo_State theState); - Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnPlaneIDs (const Handle(GEOM_Object)& theShape, - const Standard_Integer theShapeType, - const Handle(GEOM_Object)& theAx1, - const GEOMAlgo_State theState); + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) + GetShapesOnPlaneIDs (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAx1, + const GEOMAlgo_State theState); Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnPlaneWithLocationIDs (const Handle(GEOM_Object)& theShape, @@ -136,17 +151,19 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { const Handle(GEOM_Object)& thePnt, const GEOMAlgo_State theState); - Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape, - const Standard_Integer theShapeType, - const Handle(GEOM_Object)& theAxis, - const Standard_Real theRadius, - const GEOMAlgo_State theState); + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) + GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAxis, + const Standard_Real theRadius, + const GEOMAlgo_State theState); - Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape, - const Standard_Integer theShapeType, - const Handle(GEOM_Object)& theCenter, - const Standard_Real theRadius, - const GEOMAlgo_State theState); + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) + GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theCenter, + const Standard_Real theRadius, + const GEOMAlgo_State theState); /*! * \brief Find subshapes complying with given status about quadrangle @@ -198,10 +215,13 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { 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); - Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL); + Standard_EXPORT Handle(GEOM_Object) GetInPlaceByHistory (Handle(GEOM_Object) theShapeWhere, + Handle(GEOM_Object) theShapeWhat); /*! * \brief Searches a shape equal to theWhat in the context of theWhere @@ -240,6 +260,30 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { const Standard_Integer theShapeType, GEOMAlgo_State theState); + public: + /*! + * \brief Sort shapes in the list by their coordinates. + * \param SL The list of shapes to sort. + */ + Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL); + + /*! + * \brief Convert TopoDS_COMPSOLID to TopoDS_COMPOUND. + * + * If the argument shape is not of type TopoDS_COMPSOLID, this method returns it as is. + * + * \param theCompsolid The compsolid to be converted. + * \retval TopoDS_Shape Returns the resulting compound. + */ + Standard_EXPORT static TopoDS_Shape CompsolidToCompound (const TopoDS_Shape& theCompsolid); + + /*! + * \brief Build a triangulation on \a theShape if it is absent. + * \param theShape The shape to check/build triangulation on. + * \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation. + */ + Standard_EXPORT static bool CheckTriangulation (const TopoDS_Shape& theShape); + private: Handle(GEOM_Object) MakeShape (list theShapes, const Standard_Integer theObjectType, @@ -247,11 +291,9 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { const TCollection_AsciiString& theMethodName); // ---------------------------------------------------- - // methods common for all GetShapesOnXXX() functions +// methods common for all GetShapesOnXXX() functions // ---------------------------------------------------- - bool CheckTriangulation (const TopoDS_Shape& aShape); - /*! * \brief Checks if theShapeType parameter of GetShapesOnXXX() is OK * \param theShapeType - the shape type to check diff --git a/src/GEOMImpl/GEOMImpl_ImportDriver.cxx b/src/GEOMImpl/GEOMImpl_ImportDriver.cxx index 90b01ace0..b2ff8fe6b 100644 --- a/src/GEOMImpl/GEOMImpl_ImportDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ImportDriver.cxx @@ -107,7 +107,9 @@ Standard_Integer GEOMImpl_ImportDriver::Execute(TFunction_Logbook& log) const TCollection_AsciiString anError; TopoDS_Shape aShape = fp( aFileName, aFormatName, anError ); - // unload plugin library + // unload plugin library + // commented by enk: + // the bug was occured: using ACIS Import/Export plugin //UnLoadLib( anImportLib ); //This is workaround of BUG OCC13051 if ( aShape.IsNull() ) { diff --git a/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx b/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx index b079521e8..b68177098 100644 --- a/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx @@ -206,6 +206,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const } } + PS.SetLimitMode(aCI.GetKeepNonlimitShapes()); PS.SetLimit( (TopAbs_ShapeEnum)aCI.GetLimit() ); PS.Perform(); diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index b14de152b..320debb03 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -21,16 +21,30 @@ #include #include + +#include +#include +#include #include #include #include +#include +#include + #include +#include +#include +#include #include #include -#include +#include +#include +#include #include +#include +#include #include #include #include @@ -38,32 +52,26 @@ #include #include #include -#include -#include -#include -#include - -#include -#include -#include -#include "utilities.h" -#include -#include -#include #include -#include -#include -#include +#include #include #include -#include #include + #include -#include #include -#include -//#include +#include +#include + +#include +#include +#include +#include + +#include "utilities.h" + +//#include "BRepTools.hxx" //======================================================================= @@ -345,7 +353,6 @@ static void FindNextPairOfFaces(const TopoDS_Shape& aCurFace, } FindNextPairOfFaces(F1other, aMapEdgeFaces1, aMapEdgeFaces2, FF, aCI); - } } @@ -423,6 +430,7 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, Standard_ConstructionError::Raise ("First location shapes is not coincided with first vertex of aWirePath"); } + VLocs.ChangeValue(1) = VF; edge = TopoDS::Edge(Edges.Last()); tol = BRep_Tool::Tolerance(edge); TopoDS_Vertex VL = sae.LastVertex(edge); @@ -432,11 +440,12 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, Standard_ConstructionError::Raise ("Last location shapes is not coincided with last vertex of aWirePath"); } + VLocs.ChangeValue(nbLocs) = VL; int jcurr = 2; TopTools_SequenceOfShape tmpEdges; for(i=1; i<=Edges.Length() && jcurrD0(fp,Pfp); + if(Pfp.Distance(P1)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("<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; ipD0(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("<PI/2.) + aShBase2.Reverse(); + } + */ + if(!CreateFewSolids) { // we can create only one solid TopoDS_Shape aWire1, aWire2; @@ -661,6 +820,11 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, const TopoDS_Shape aSewShape = aSewing->SewedShape(); if( aSewShape.ShapeType() == TopAbs_SHELL ) { aShell = TopoDS::Shell(aSewShape); + GProp_GProps aSystem; + BRepGProp::VolumeProperties(aShell, aSystem); + if(aSystem.Mass()<0) { + aShell.Reverse(); + } if(BRep_Tool::IsClosed(aShell)) { TopoDS_Solid aSolid; B.MakeSolid(aSolid); @@ -679,10 +843,12 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, else { // main block - creation few solids (for each pair of faces) TopTools_MapOfShape aFaces1,aFaces2; - for ( anExp.Init( aShBase1, TopAbs_FACE ); anExp.More(); anExp.Next() ) + for ( anExp.Init( aShBase1, TopAbs_FACE ); anExp.More(); anExp.Next() ) { aFaces1.Add(anExp.Current()); - for ( anExp.Init( aShBase2, TopAbs_FACE ); anExp.More(); anExp.Next() ) + } + for ( anExp.Init( aShBase2, TopAbs_FACE ); anExp.More(); anExp.Next() ) { aFaces2.Add(anExp.Current()); + } // creating map of edge faces TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces1; TopExp::MapShapesAndAncestors(aShBase1, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces1); @@ -844,7 +1010,6 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, // make pipe for each pair of faces - //BRepTools::Write(WPath,"/dn02/users_Linux/skl/work/Bugs/14857/wpath.brep"); for(j=1; j<=FF.Extent(); j++) { TopoDS_Shape F1 = FF.FindKey(j); if( F1.ShapeType() != TopAbs_FACE ) @@ -869,12 +1034,10 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, TopoDS_Shape aShape = aBuilder.Shape(); TopoDS_Shell aShell; B.MakeShell(aShell); - //int nbf=0; for ( anExp.Init( aShape, TopAbs_FACE ); anExp.More(); anExp.Next() ) { - //nbf++; - //cout<<"nbf="<SewedShape(); if( aSewShape.ShapeType() == TopAbs_SHELL ) { aShell = TopoDS::Shell(aSewShape); + GProp_GProps aSystem; + BRepGProp::VolumeProperties(aShell, aSystem); + if(aSystem.Mass()<0) { + //cout<<"aSewShape is reversed"<(aCI); - BRepOffsetAPI_MakePipeShell aBuilder(aWirePath); + //BRepOffsetAPI_MakePipeShell aBuilder(aWirePath); Handle(TColStd_HSequenceOfTransient) aBasesObjs = aCIDS->GetBases (); Handle(TColStd_HSequenceOfTransient) aLocObjs = aCIDS->GetLocations (); Standard_Boolean aWithContact = (aCIDS->GetWithContactMode()); @@ -1069,6 +1239,116 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const } nbLocs = aSeqLocs.Length(); + + // skl 02.05.2007 + if(nbLocs>0) { + // we have to check that each location shape is a vertex from + // path and update aSeqLocs if it is needed (and possible) + TColgp_SequenceOfPnt PLocs; + for(i=1; i<=nbLocs; i++) { + TopoDS_Vertex V = TopoDS::Vertex(aSeqLocs.Value(i)); + PLocs.Append(BRep_Tool::Pnt(V)); + } + TopTools_SequenceOfShape Edges; + TopExp_Explorer anExp; + for ( anExp.Init( aWirePath, TopAbs_EDGE ); anExp.More(); anExp.Next() ) { + Edges.Append(anExp.Current()); + } + int nbEdges = Edges.Length(); + ShapeAnalysis_Edge sae; + TopoDS_Edge edge = TopoDS::Edge(Edges.First()); + double tol = BRep_Tool::Tolerance(edge); + TopoDS_Vertex VF = sae.FirstVertex(edge); + gp_Pnt PF = BRep_Tool::Pnt(VF); + //cout<<"PF("< tol ) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise + ("First location shapes is not coincided with first vertex of aWirePath"); + } + aSeqLocs.ChangeValue(1) = VF; + edge = TopoDS::Edge(Edges.Last()); + tol = BRep_Tool::Tolerance(edge); + TopoDS_Vertex VL = sae.LastVertex(edge); + gp_Pnt PL = BRep_Tool::Pnt(VL); + if( PL.Distance(PLocs.Last()) > tol ) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise + ("Last location shapes is not coincided with last vertex of aWirePath"); + } + aSeqLocs.ChangeValue(nbLocs) = VL; + int jcurr = 2; + for(i=1; i<=Edges.Length() && jcurr0 && + PLocs.Value(jcurr).Distance(PPC.Point(1)) < tol ) { + double param = PPC.Parameter(1); + gp_Pnt PC1; + C->D0(param,PC1); + // split current edge + Handle(Geom_TrimmedCurve) tc1 = new Geom_TrimmedCurve(C,fp,param); + Handle(Geom_TrimmedCurve) tc2 = new Geom_TrimmedCurve(C,param,lp); + TopoDS_Edge E1,E2; + BRep_Builder B; + gp_Pnt Pfp; + C->D0(fp,Pfp); + if(Pfp.Distance(P1) we have to update WirePath + BRep_Builder B; + TopoDS_Wire W; + B.MakeWire(W); + for(i=1; i<=Edges.Length(); i++) { + B.Add(W,TopoDS::Edge(Edges.Value(i))); + } + aWirePath = W; + } + } + + BRepOffsetAPI_MakePipeShell aBuilder(aWirePath); + Standard_Integer nbShapes = aSeqBases.Length(); Standard_Integer step = nbShapes/nbBases; @@ -1135,7 +1415,8 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result"); } - aFunction->SetValue(aShape); + TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape); + aFunction->SetValue(aRes); log.SetTouched(Label()); if(aCI) delete aCI; diff --git a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx index 87157a5fc..8d049aa56 100644 --- a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx @@ -21,6 +21,8 @@ #include #include + +#include #include #include #include @@ -114,7 +116,8 @@ Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const if (aShape.IsNull()) return 0; - aFunction->SetValue(aShape); + TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape); + aFunction->SetValue(aRes); log.SetTouched(Label()); diff --git a/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx b/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx index beec64f3c..2f790ca3e 100644 --- a/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx @@ -21,6 +21,8 @@ #include #include + +#include #include #include #include @@ -114,11 +116,13 @@ Standard_Integer GEOMImpl_RevolutionDriver::Execute(TFunction_Logbook& log) cons } if (aShape.IsNull()) return 0; - aFunction->SetValue(aShape); - log.SetTouched(Label()); + TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape); + aFunction->SetValue(aRes); + + log.SetTouched(Label()); - return 1; + return 1; } diff --git a/src/GEOMImpl/Makefile.am b/src/GEOMImpl/Makefile.am index 6ffbd0ce8..8697b2e1c 100644 --- a/src/GEOMImpl/Makefile.am +++ b/src/GEOMImpl/Makefile.am @@ -112,7 +112,6 @@ libGEOMimpl_la_CPPFLAGS = \ $(KERNEL_CXXFLAGS) \ $(BOOST_CPPFLAGS) \ -I$(srcdir)/../ShHealOper \ - -I$(srcdir)/../NMTAlgo \ -I$(srcdir)/../NMTTools \ -I$(srcdir)/../GEOM \ -I$(srcdir)/../GEOMAlgo \ @@ -122,7 +121,6 @@ libGEOMimpl_la_CPPFLAGS = \ libGEOMimpl_la_LDFLAGS = \ ../GEOM/libGEOMbasic.la \ - ../NMTAlgo/libNMTAlgo.la \ ../GEOMAlgo/libGEOMAlgo.la \ ../ShHealOper/libShHealOper.la \ ../ARCHIMEDE/libGEOMArchimede.la \ diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index 4a3e34a71..2527b21cd 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -78,9 +78,15 @@ static QString getFileName( QWidget* parent, { static QString lastUsedFilter; QStringList filters; - for ( FilterMap::const_iterator it = filterMap.begin(); it != filterMap.end(); ++it ) + QString aBrepFilter; + for ( FilterMap::const_iterator it = filterMap.begin(); it != filterMap.end(); ++it ) { filters.push_back( it.key() ); + if (it.key().contains("BREP", false)) { + aBrepFilter = it.key(); + } + } + SUIT_FileDlg* fd = new SUIT_FileDlg( parent, open, true, true ); if ( !caption.isEmpty() ) fd->setCaption( caption ); @@ -88,10 +94,15 @@ static QString getFileName( QWidget* parent, if ( !initial.isEmpty() ) fd->setSelection( initial ); + fd->setFilters( filters ); + if ( !lastUsedFilter.isEmpty() && filterMap.contains( lastUsedFilter ) ) fd->setSelectedFilter( lastUsedFilter ); - - fd->setFilters( filters ); + else { + if (!aBrepFilter.isEmpty()) { + fd->setSelectedFilter(aBrepFilter); + } + } fd->exec(); QString filename = fd->selectedFile(); diff --git a/src/GEOM_I/GEOM_IBooleanOperations_i.cc b/src/GEOM_I/GEOM_IBooleanOperations_i.cc index c7a594259..836451282 100644 --- a/src/GEOM_I/GEOM_IBooleanOperations_i.cc +++ b/src/GEOM_I/GEOM_IBooleanOperations_i.cc @@ -99,7 +99,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition const GEOM::ListOfGO& theRemoveIns, CORBA::Short theLimit, CORBA::Boolean theRemoveWebs, - const GEOM::ListOfLong& theMaterials) + const GEOM::ListOfLong& theMaterials, + CORBA::Short theKeepNonlimitShapes) { GEOM::GEOM_Object_var aGEOMObject; @@ -166,6 +167,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition Handle(GEOM_Object) anObject = GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns, theLimit, theRemoveWebs, aMaterials, + theKeepNonlimitShapes, /*PerformSelfIntersections*/Standard_True); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -185,7 +187,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected const GEOM::ListOfGO& theRemoveIns, CORBA::Short theLimit, CORBA::Boolean theRemoveWebs, - const GEOM::ListOfLong& theMaterials) + const GEOM::ListOfLong& theMaterials, + CORBA::Short theKeepNonlimitShapes) { GEOM::GEOM_Object_var aGEOMObject; @@ -252,6 +255,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected Handle(GEOM_Object) anObject = GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns, theLimit, theRemoveWebs, aMaterials, + theKeepNonlimitShapes, /*PerformSelfIntersections*/Standard_False); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); diff --git a/src/GEOM_I/GEOM_IBooleanOperations_i.hh b/src/GEOM_I/GEOM_IBooleanOperations_i.hh index 52e597ed4..7379d00b8 100644 --- a/src/GEOM_I/GEOM_IBooleanOperations_i.hh +++ b/src/GEOM_I/GEOM_IBooleanOperations_i.hh @@ -50,7 +50,8 @@ class GEOM_I_EXPORT GEOM_IBooleanOperations_i : const GEOM::ListOfGO& theRemoveInside, CORBA::Short theLimit, CORBA::Boolean theRemoveWebs, - const GEOM::ListOfLong& theMaterials); + const GEOM::ListOfLong& theMaterials, + CORBA::Short theKeepNonlimitShapes); GEOM::GEOM_Object_ptr MakePartitionNonSelfIntersectedShape (const GEOM::ListOfGO& theShapes, const GEOM::ListOfGO& theTools, @@ -58,7 +59,8 @@ class GEOM_I_EXPORT GEOM_IBooleanOperations_i : const GEOM::ListOfGO& theRemoveInside, CORBA::Short theLimit, CORBA::Boolean theRemoveWebs, - const GEOM::ListOfLong& theMaterials); + const GEOM::ListOfLong& theMaterials, + CORBA::Short theKeepNonlimitShapes); GEOM::GEOM_Object_ptr MakeHalfPartition (GEOM::GEOM_Object_ptr theShape, diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.cc b/src/GEOM_I/GEOM_IShapesOperations_i.cc index b3edf98db..32dd0f023 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.cc +++ b/src/GEOM_I/GEOM_IShapesOperations_i.cc @@ -328,7 +328,8 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound //============================================================================= GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, - const CORBA::Double theTolerance) + const CORBA::Double theTolerance, + const CORBA::Boolean doKeepNonSolids) { GEOM::GEOM_Object_var aGEOMObject; @@ -345,7 +346,7 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces //Perform the gluing Handle(GEOM_Object) anObject = - GetOperations()->MakeGlueFaces(aShape, theTolerance); + GetOperations()->MakeGlueFaces(aShape, theTolerance, doKeepNonSolids); //if (!GetOperations()->IsDone() || anObject.IsNull()) // to allow warning if (anObject.IsNull()) @@ -401,7 +402,8 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, const CORBA::Double theTolerance, - const GEOM::ListOfGO& theFaces) + const GEOM::ListOfGO& theFaces, + const CORBA::Boolean doKeepNonSolids) { GEOM::GEOM_Object_var aGEOMObject; @@ -430,7 +432,7 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList //Perform the gluing Handle(GEOM_Object) anObject = - GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces); + GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids); //if (!GetOperations()->IsDone() || anObject.IsNull()) // to allow warning if (anObject.IsNull()) @@ -1323,6 +1325,41 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace return GetObject(anObject); } +//============================================================================= +/*! + * GetInPlaceByHistory + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory + (GEOM::GEOM_Object_ptr theShapeWhere, + GEOM::GEOM_Object_ptr theShapeWhat) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShapeWhere == NULL || + theShapeWhat == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShapeWhere = GetOperations()->GetEngine()->GetObject + (theShapeWhere->GetStudyID(), theShapeWhere->GetEntry()); + Handle(GEOM_Object) aShapeWhat = GetOperations()->GetEngine()->GetObject + (theShapeWhat->GetStudyID(), theShapeWhat->GetEntry()); + + if (aShapeWhere.IsNull() || + aShapeWhat.IsNull()) return aGEOMObject._retn(); + + //Get Shapes in place of aShapeWhat + Handle(GEOM_Object) anObject = + GetOperations()->GetInPlaceByHistory(aShapeWhere, aShapeWhat); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * GetSame diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.hh b/src/GEOM_I/GEOM_IShapesOperations_i.hh index 84575a15d..dc507db1c 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.hh +++ b/src/GEOM_I/GEOM_IShapesOperations_i.hh @@ -61,14 +61,16 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i : GEOM::GEOM_Object_ptr MakeCompound (const GEOM::ListOfGO& theShapes); GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance); + CORBA::Double theTolerance, + const CORBA::Boolean doKeepNonSolids); GEOM::ListOfGO* GetGlueFaces (GEOM::GEOM_Object_ptr theShape, CORBA::Double theTolerance); GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, CORBA::Double theTolerance, - const GEOM::ListOfGO& theFaces); + const GEOM::ListOfGO& theFaces, + const CORBA::Boolean doKeepNonSolids); GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape, CORBA::Long theShapeType, @@ -175,6 +177,9 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i : GEOM::GEOM_Object_ptr GetInPlace (GEOM::GEOM_Object_ptr theShapeWhere, GEOM::GEOM_Object_ptr theShapeWhat); + GEOM::GEOM_Object_ptr GetInPlaceByHistory (GEOM::GEOM_Object_ptr theShapeWhere, + GEOM::GEOM_Object_ptr theShapeWhat); + GEOM::GEOM_Object_ptr GetSame (GEOM::GEOM_Object_ptr theShapeWhere, GEOM::GEOM_Object_ptr theShapeWhat); diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 299d9f550..fa0a64a0e 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -1040,7 +1040,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePartition (GEOM::GEOM_List_ptr theSha GEOM::GEOM_List_ptr theRemoveInside, CORBA::Short theLimit, CORBA::Boolean theRemoveWebs, - GEOM::GEOM_List_ptr theMaterials) + GEOM::GEOM_List_ptr theMaterials, + CORBA::Short theKeepNonlimitShapes) { beginService( " GEOM_Superv_i::MakePartition" ); MESSAGE("GEOM_Superv_i::MakePartition"); @@ -1056,9 +1057,11 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePartition (GEOM::GEOM_List_ptr theSha dynamic_cast*>(GetServant(theMaterials, myPOA).in()); if (aListImplS && aListImplT && aListImplKI && aListImplRI && aListImplM) { getBoolOp(); - GEOM::GEOM_Object_ptr anObj = myBoolOp->MakePartition(aListImplS->GetList(), aListImplT->GetList(), - aListImplKI->GetList(), aListImplRI->GetList(), - theLimit, theRemoveWebs, aListImplM->GetList()); + GEOM::GEOM_Object_ptr anObj = + myBoolOp->MakePartition(aListImplS->GetList(), aListImplT->GetList(), + aListImplKI->GetList(), aListImplRI->GetList(), + theLimit, theRemoveWebs, aListImplM->GetList(), + theKeepNonlimitShapes); endService( " GEOM_Superv_i::MakePartition" ); return anObj; } @@ -1678,12 +1681,14 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCompound (GEOM::GEOM_List_ptr theShapes // MakeGlueFaces: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance) + CORBA::Double theTolerance, + CORBA::Boolean doKeepNonSolids) { beginService( " GEOM_Superv_i::MakeGlueFaces" ); MESSAGE("GEOM_Superv_i::MakeGlueFaces"); getShapesOp(); - GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeGlueFaces(theShape, theTolerance); + GEOM::GEOM_Object_ptr anObj = + myShapesOp->MakeGlueFaces(theShape, theTolerance, doKeepNonSolids); endService( " GEOM_Superv_i::MakeGlueFaces" ); return anObj; } @@ -1709,12 +1714,14 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::GetGlueFaces (GEOM::GEOM_Object_ptr theShape, //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, CORBA::Double theTolerance, - const GEOM::ListOfGO& theFaces) + const GEOM::ListOfGO& theFaces, + CORBA::Boolean doKeepNonSolids) { beginService( " GEOM_Superv_i::MakeGlueFacesByList" ); MESSAGE("GEOM_Superv_i::MakeGlueFacesByList"); getShapesOp(); - GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces); + GEOM::GEOM_Object_ptr anObj = + myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids); endService( " GEOM_Superv_i::MakeGlueFacesByList" ); return anObj; } diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index 298a01ede..84773c8c4 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -258,7 +258,8 @@ public: GEOM::GEOM_List_ptr theRemoveInside, CORBA::Short theLimit, CORBA::Boolean theRemoveWebs, - GEOM::GEOM_List_ptr theMaterials); + GEOM::GEOM_List_ptr theMaterials, + CORBA::Short theKeepNonlimitShapes); GEOM::GEOM_Object_ptr MakeHalfPartition (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr thePlane); @@ -378,12 +379,14 @@ public: GEOM::GEOM_Object_ptr MakeSolidShells (GEOM::GEOM_List_ptr theShells); GEOM::GEOM_Object_ptr MakeCompound (GEOM::GEOM_List_ptr theShapes); GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance); + CORBA::Double theTolerance, + CORBA::Boolean doKeepNonSolids); GEOM::GEOM_List_ptr GetGlueFaces (GEOM::GEOM_Object_ptr theShape, CORBA::Double theTolerance); GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, CORBA::Double theTolerance, - const GEOM::ListOfGO& theFaces); + const GEOM::ListOfGO& theFaces, + CORBA::Boolean doKeepNonSolids); GEOM::GEOM_List_ptr MakeExplode (GEOM::GEOM_Object_ptr theShape, CORBA::Long theShapeType, CORBA::Boolean isSorted); diff --git a/src/GEOM_SWIG/GEOM_TestOthers.py b/src/GEOM_SWIG/GEOM_TestOthers.py index 81b0aa1e0..3bf25cf75 100644 --- a/src/GEOM_SWIG/GEOM_TestOthers.py +++ b/src/GEOM_SWIG/GEOM_TestOthers.py @@ -528,24 +528,72 @@ def TestOtherOperations (geompy, math): geompy.UnionIDs(vertices_on_quad, vertices_on_quad_ids) geompy.addToStudy(vertices_on_quad, "Group of vertices on Quadrangle F12") - # GetInPlace(theShapeWhere, theShapeWhat) + # Prepare arguments for GetInPlace and GetInPlaceByHistory box5 = geompy.MakeBoxDXDYDZ(100, 100, 100) box6 = geompy.MakeTranslation(box5, 50, 50, 0) + geompy.addToStudy(box5, "Box 5") + geompy.addToStudy(box6, "Box 6") + + part = geompy.MakePartition([box5], [box6]) + geompy.addToStudy(part, "Partitioned") + + box5_faces = geompy.SubShapeAll(box5, geompy.ShapeType["FACE"]) + box6_faces = geompy.SubShapeAll(box6, geompy.ShapeType["FACE"]) + + ifa = 1 + for aface in box5_faces: + geompy.addToStudyInFather(box5, aface, "Face" + `ifa`) + ifa = ifa + 1 + + ifa = 1 + for aface in box6_faces: + geompy.addToStudyInFather(box6, aface, "Face" + `ifa`) + ifa = ifa + 1 + + # GetInPlace(theShapeWhere, theShapeWhat) + ibb = 5 + faces_list = [box5_faces, box6_faces] + for afaces in faces_list: + ifa = 1 + for aface in afaces: + if ibb == 6 and (ifa == 2 or ifa == 4): + # use IDL interface directly to avoid error message appearence in Python console + refl_box_face = geompy.ShapesOp.GetInPlace(part, aface) + if refl_box_face is not None: + geompy.addToStudyInFather(part, refl_box_face, + "Reflection of face " + `ifa` + " of box " + `ibb`) + error = "Result of GetInPlace must be NULL for face " + `ifa` + " of box " + `ibb` + raise RuntimeError, error + else: + # use geompy interface + refl_box_face = geompy.GetInPlace(part, aface) + geompy.addToStudyInFather(part, refl_box_face, + "Reflection of face " + `ifa` + " of box " + `ibb`) + ifa = ifa + 1 + ibb = ibb + 1 + + # GetInPlaceByHistory(theShapeWhere, theShapeWhat) part = geompy.MakePartition([box5], [box6]) geompy.addToStudy(part, "Partitioned") ibb = 5 - box_list = [box5, box6] - for abox in box_list: - geompy.addToStudy(abox, "Box " + `ibb`) - box_faces = geompy.SubShapeAll(abox, geompy.ShapeType["FACE"]) + faces_list = [box5_faces, box6_faces] + for afaces in faces_list: ifa = 1 - for aface in box_faces: - geompy.addToStudyInFather(abox, aface, "Face" + `ifa`) - refl_box_face = geompy.GetInPlace(part, aface) - if refl_box_face is not None: + for aface in afaces: + if ibb == 6 and (ifa == 2 or ifa == 4): + # use IDL interface directly to avoid error message appearence in Python console + refl_box_face = geompy.ShapesOp.GetInPlaceByHistory(part, aface) + if refl_box_face is not None: + geompy.addToStudyInFather(part, refl_box_face, + "Reflection of face " + `ifa` + " of box " + `ibb` + " (by history)") + error = "Result of GetInPlaceByHistory must be NULL for face " + `ifa` + " of box " + `ibb` + raise RuntimeError, error + else: + # use geompy interface + refl_box_face = geompy.GetInPlaceByHistory(part, aface) geompy.addToStudyInFather(part, refl_box_face, - "Reflection of Face " + `ifa` + " of box " + `ibb`) + "Reflection of face " + `ifa` + " of box " + `ibb` + " (by history)") ifa = ifa + 1 ibb = ibb + 1 diff --git a/src/GEOM_SWIG/GEOM_cyl2complementary.py b/src/GEOM_SWIG/GEOM_cyl2complementary.py index 1190037ab..fd979913d 100755 --- a/src/GEOM_SWIG/GEOM_cyl2complementary.py +++ b/src/GEOM_SWIG/GEOM_cyl2complementary.py @@ -97,7 +97,7 @@ p_tools.append(geompy.MakePlane(geompy.MakeVertex(gx+g_rayonPetit, 0, 0), geompy addToStudy(t_boite, "t_boite") -p_element = geompy.MakePartition([t_boite], p_tools, [], [], 4, 0, []) +p_element = geompy.MakePartition([t_boite], p_tools, [], [], 4, 0, [], 0) # Compound # -------- diff --git a/src/GEOM_SWIG/Makefile.am b/src/GEOM_SWIG/Makefile.am index a4f68108d..ca9cc2ea7 100644 --- a/src/GEOM_SWIG/Makefile.am +++ b/src/GEOM_SWIG/Makefile.am @@ -17,7 +17,7 @@ # 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # # @@ -32,87 +32,10 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am -# =============================================================== -# Swig targets -# =============================================================== -# (cf. http://www.geocities.com/foetsch/python/swig_linux.htm) -# -# Step 1: build the wrapping source files with swig -# -# libSALOME_LifeCycleCORBA.i -- swig --> swig_wrap.cpp -# libSALOME_Swig.py -# -# Step 2: build the dynamic library from cpp built source files and -# dependant libraries. -# -# swig_wrap.cpp -- gcc --> swig_wrap.o |-- link --> _libSALOME_Swig.la -# + | -# dependant libs | -# -# The file libSALOME_Swigcmodule.py will be installed in -# /lib/python/site-package/salome. -# The library will be installed in the same place. -# - -# this option puts it to dist -#BUILT_SOURCES = swig_wrap.cpp - -SWIG_FLAGS = \ - @SWIG_FLAGS@ \ - -I$(srcdir) \ - -I$(srcdir)/../GEOMGUI - -SWIG_SOURCES = libGEOM_Swig.i - -# Libraries targets -lib_LTLIBRARIES = libGEOM_Swigcmodule.la - -nodist_pkgpython_DATA = libGEOM_Swig.py -libGEOM_Swig.py: swig_wrap.cpp - -libGEOM_Swigcmodule_la_SOURCES = \ - $(BUILT_SOURCES) \ - $(SWIG_SOURCES) - -nodist_libGEOM_Swigcmodule_la_SOURCES = swig_wrap.cpp - -#LIB_CLIENT_IDL = SALOMEDS.idl \ -# SALOMEDS_Attributes.idl \ -# SALOME_Exception.idl \ -# GEOM_Gen.idl \ -# SALOME_Component.idl \ -# SALOME_GenericObj.idl EXPORT_SHAREDPYSCRIPTS=\ GEOM_shared_modules.py -libGEOM_Swigcmodule_la_CPPFLAGS = \ - $(QT_INCLUDES) \ - $(PYTHON_INCLUDES) \ - $(CAS_CPPFLAGS) \ - $(VTK_INCLUDES) \ - $(OGL_INCLUDES) \ - $(KERNEL_CXXFLAGS) \ - $(GUI_CXXFLAGS) \ - $(CORBA_CXXFLAGS) \ - $(CORBA_INCLUDES) \ - -I$(srcdir)/../GEOMGUI \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix - -libGEOM_Swigcmodule_la_LDFLAGS = \ - ../GEOMGUI/libGEOM.la - - -libGEOM_Swigcmodule_la_LIBADD = \ - $(PYTHON_LIBS) - -swig_wrap.cpp : $(SWIG_SOURCES) - $(SWIG) $(SWIG_FLAGS) -o $@ $< - -CLEANFILES = \ - swig_wrap.cpp - # # =============================================================== # Files to be installed @@ -121,7 +44,6 @@ CLEANFILES = \ # Scripts to be installed. dist_salomescript_DATA= \ - libGEOM_Swig.py \ geompy.py \ geompyDC.py \ batchmode_geompy.py \ @@ -157,9 +79,3 @@ dist_salomescript_DATA= \ sharedpkgpython_PYTHON = \ GEOM_shared_modules.py - -install-exec-hook:\ - $(libdir)/_libGEOM_Swig.so - -$(libdir)/_libGEOM_Swig.so: - ( cd $(libdir); ln -sf libGEOM_Swigcmodule.so _libGEOM_Swig.so; ) diff --git a/src/GEOM_SWIG/batchmode_geompy.py b/src/GEOM_SWIG/batchmode_geompy.py index 0f91c8c9d..42e9ec5c2 100644 --- a/src/GEOM_SWIG/batchmode_geompy.py +++ b/src/GEOM_SWIG/batchmode_geompy.py @@ -699,19 +699,23 @@ def MakeSection(s1, s2): return MakeBoolean(s1, s2, 4) def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], - Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]): + Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[], + KeepNonlimitShapes=0): anObj = BoolOp.MakePartition(ListShapes, ListTools, ListKeepInside, ListRemoveInside, - Limit, RemoveWebs, ListMaterials); + Limit, RemoveWebs, ListMaterials, + KeepNonlimitShapes); if BoolOp.IsDone() == 0: print "MakePartition : ", BoolOp.GetErrorCode() return anObj def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], - Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]): + Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[], + KeepNonlimitShapes=0): anObj = MakePartition(ListShapes, ListTools, ListKeepInside, ListRemoveInside, - Limit, RemoveWebs, ListMaterials); + Limit, RemoveWebs, ListMaterials, + KeepNonlimitShapes); return anObj def MakeHalfPartition(theShape, thePlane): diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index afff1b417..78bbae079 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -732,7 +732,9 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theSeqSubBases - list of corresponding subshapes of section shapes. # @param theLocations - list of locations on the path corresponding # specified list of the Bases shapes. Number of locations - # should be equal to number of bases or list of locations can be empty. + # should be equal to number of bases. First and last + # locations must be coincided with first and last vertexes + # of path correspondingly. # @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. @@ -1079,6 +1081,27 @@ class geompyDC(GEOM._objref_GEOM_Gen): print "GetInPlace : ", self.ShapesOp.GetErrorCode() return anObj + ## Get sub-shape(s) of \a theShapeWhere, which are + # coincident with \a theShapeWhat or could be a part of it. + # + # Implementation of this method is based on a saved history of an operation, + # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's + # arguments (an argument shape or a sub-shape of an argument shape). + # The operation could be the Partition or one of boolean operations, + # performed on simple shapes (not on compounds). + # + # @param theShapeWhere Shape to find sub-shapes of. + # @param theShapeWhat Shape, specifying what to find (must be in the + # building history of the ShapeWhere). + # @return Group of all found sub-shapes or a single found sub-shape. + # + # Example: see GEOM_TestOthers.py + def GetInPlaceByHistory(theShapeWhere, theShapeWhat): + anObj = ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat) + if ShapesOp.IsDone() == 0: + print "GetInPlace : ", ShapesOp.GetErrorCode() + return anObj + ## Get sub-shape of theShapeWhere, which is # equal to \a theShapeWhat. # @param theShapeWhere Shape to find sub-shape of. @@ -1365,11 +1388,13 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Replace coincident faces in theShape by one face. # @param theShape Initial shape. # @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. # # Example: see GEOM_Spanner.py - def MakeGlueFaces(self,theShape, theTolerance): - anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance) + def MakeGlueFaces(theShape, theTolerance, doKeepNonSolids=True): + anObj = ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids) if self.ShapesOp.IsDone() == 0: print "MakeGlueFaces : ", self.ShapesOp.GetErrorCode() return anObj @@ -1382,7 +1407,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @return ListOfGO. # # Example: see GEOM_Spanner.py - def GetGlueFaces(self,theShape, theTolerance): + def GetGlueFaces(self, theShape, theTolerance): anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance) if self.ShapesOp.IsDone() == 0: print "GetGlueFaces : ", self.ShapesOp.GetErrorCode() @@ -1395,12 +1420,14 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @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. # @return New GEOM_Object, containing a copy of theShape # without some faces. # # Example: see GEOM_Spanner.py - def MakeGlueFacesByList(self,theShape, theTolerance, theFaces): - anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces) + def MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids=True): + anObj = ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids) if self.ShapesOp.IsDone() == 0: print "MakeGlueFacesByList : ", self.ShapesOp.GetErrorCode() return anObj @@ -1455,6 +1482,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # in order to avoid possible intersection between shapes from # this compound. # @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum). + # @param KeepNonlimitShapes: if this parameter == 0 - only shapes with + # type <= Limit are kept in the result, + # else - shapes with type > Limit are kept + # also (if they exist) # # After implementation new version of PartitionAlgo (October 2006) # other parameters are ignored by current functionality. They are kept @@ -1472,10 +1503,12 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # Example: see GEOM_TestAll.py def MakePartition(self,ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], - Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]): + Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[], + KeepNonlimitShapes=0): anObj = self.BoolOp.MakePartition(ListShapes, ListTools, ListKeepInside, ListRemoveInside, - Limit, RemoveWebs, ListMaterials); + Limit, RemoveWebs, ListMaterials, + KeepNonlimitShapes); if self.BoolOp.IsDone() == 0: print "MakePartition : ", self.BoolOp.GetErrorCode() return anObj @@ -1492,11 +1525,14 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @return New GEOM_Object, containing the result shapes. # - def MakePartitionNonSelfIntersectedShape(self,ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], - Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]): + def MakePartitionNonSelfIntersectedShape(ListShapes, ListTools=[], + ListKeepInside=[], ListRemoveInside=[], + Limit=ShapeType["SHAPE"], RemoveWebs=0, + ListMaterials=[], KeepNonlimitShapes=0): anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools, ListKeepInside, ListRemoveInside, - Limit, RemoveWebs, ListMaterials); + Limit, RemoveWebs, ListMaterials, + KeepNonlimitShapes); if self.BoolOp.IsDone() == 0: print "MakePartitionNonSelfIntersectedShape : ", self.BoolOp.GetErrorCode() return anObj @@ -1505,10 +1541,12 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # Example: see GEOM_TestOthers.py def Partition(self,ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], - Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]): + Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[], + KeepNonlimitShapes=0): anObj = self.MakePartition(ListShapes, ListTools, ListKeepInside, ListRemoveInside, - Limit, RemoveWebs, ListMaterials); + Limit, RemoveWebs, ListMaterials, + KeepNonlimitShapes); return anObj ## Perform partition of the Shape with the Plane diff --git a/src/GEOM_SWIG/libGEOM_Swig.i b/src/GEOM_SWIG/libGEOM_Swig.i deleted file mode 100644 index b1c76a904..000000000 --- a/src/GEOM_SWIG/libGEOM_Swig.i +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2005 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. -// -// 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 : libGeometry_Swig.i -// Created : Tue Mar 26 15:04:48 2002 -// Author : Nicolas REJNERI, Paul RASCLE -// Project : SALOME -// Module : GEOM -// Copyright : Open CASCADE, EDF 2002 -// $Header$ - -%module libGEOM_Swig - -%include "GeometryGUI_Swig.i" - diff --git a/src/GEOM_SWIG_WITHIHM/Makefile.am b/src/GEOM_SWIG_WITHIHM/Makefile.am new file mode 100644 index 000000000..e71593115 --- /dev/null +++ b/src/GEOM_SWIG_WITHIHM/Makefile.am @@ -0,0 +1,127 @@ +# GEOM GEOM_SWIG : binding of C++ omplementaion with Python +# +# Copyright (C) 2003 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. +# +# 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 : Makefile.in +# Author : Nicolas REJNERI, Paul RASCLE +# Modified by : Alexander BORODIN (OCN) - autotools usage +# Module : GEOM +# $Header$ + + +# Libraries targets + +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +# =============================================================== +# Swig targets +# =============================================================== +# (cf. http://www.geocities.com/foetsch/python/swig_linux.htm) +# +# Step 1: build the wrapping source files with swig +# +# libSALOME_LifeCycleCORBA.i -- swig --> swig_wrap.cpp +# libSALOME_Swig.py +# +# Step 2: build the dynamic library from cpp built source files and +# dependant libraries. +# +# swig_wrap.cpp -- gcc --> swig_wrap.o |-- link --> _libSALOME_Swig.la +# + | +# dependant libs | +# +# The file libSALOME_Swigcmodule.py will be installed in +# /lib/python/site-package/salome. +# The library will be installed in the same place. +# + +# this option puts it to dist +#BUILT_SOURCES = swig_wrap.cpp + +SWIG_FLAGS = \ + @SWIG_FLAGS@ \ + -I$(srcdir) \ + -I$(srcdir)/../GEOMGUI + +SWIG_SOURCES = libGEOM_Swig.i + +# Libraries targets +lib_LTLIBRARIES = libGEOM_Swigcmodule.la + +nodist_pkgpython_DATA = libGEOM_Swig.py +libGEOM_Swig.py: swig_wrap.cpp + +libGEOM_Swigcmodule_la_SOURCES = \ + $(BUILT_SOURCES) \ + $(SWIG_SOURCES) + +nodist_libGEOM_Swigcmodule_la_SOURCES = swig_wrap.cpp + +#LIB_CLIENT_IDL = SALOMEDS.idl \ +# SALOMEDS_Attributes.idl \ +# SALOME_Exception.idl \ +# GEOM_Gen.idl \ +# SALOME_Component.idl \ +# SALOME_GenericObj.idl + +libGEOM_Swigcmodule_la_CPPFLAGS = \ + $(QT_INCLUDES) \ + $(PYTHON_INCLUDES) \ + $(CAS_CPPFLAGS) \ + $(VTK_INCLUDES) \ + $(OGL_INCLUDES) \ + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ + $(CORBA_CXXFLAGS) \ + $(CORBA_INCLUDES) \ + -I$(srcdir)/../GEOMGUI \ + -I$(top_builddir)/idl \ + -I$(top_builddir)/salome_adm/unix + +libGEOM_Swigcmodule_la_LDFLAGS = \ + ../GEOMGUI/libGEOM.la + + +libGEOM_Swigcmodule_la_LIBADD = \ + $(PYTHON_LIBS) + +swig_wrap.cpp : $(SWIG_SOURCES) + $(SWIG) $(SWIG_FLAGS) -o $@ $< + +CLEANFILES = \ + swig_wrap.cpp + +# +# =============================================================== +# Files to be installed +# =============================================================== +# + +# Scripts to be installed. +dist_salomescript_DATA= \ + libGEOM_Swig.py + +install-exec-hook:\ + $(libdir)/_libGEOM_Swig.so + +$(libdir)/_libGEOM_Swig.so: + ( cd $(libdir); ln -sf libGEOM_Swigcmodule.so _libGEOM_Swig.so; ) diff --git a/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.i b/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.i new file mode 100644 index 000000000..b1c76a904 --- /dev/null +++ b/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.i @@ -0,0 +1,31 @@ +// Copyright (C) 2005 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. +// +// 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 : libGeometry_Swig.i +// Created : Tue Mar 26 15:04:48 2002 +// Author : Nicolas REJNERI, Paul RASCLE +// Project : SALOME +// Module : GEOM +// Copyright : Open CASCADE, EDF 2002 +// $Header$ + +%module libGEOM_Swig + +%include "GeometryGUI_Swig.i" + diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index 54e4ad76b..c1b1ffe5a 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -17,7 +17,7 @@ // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -33,31 +33,29 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" -#include -#include -#include -#include "GEOMImpl_Types.hxx" - #include #include +#include "GEOMImpl_Types.hxx" + #include "utilities.h" //================================================================================= // class : GenerationGUI_PrismDlg() -// purpose : Constructs a GenerationGUI_PrismDlg which is a child of 'parent', with the +// purpose : Constructs a GenerationGUI_PrismDlg 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. //================================================================================= GenerationGUI_PrismDlg::GenerationGUI_PrismDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) + : GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | + WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PRISM"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PRISM_2P"))); + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + QPixmap image0(aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM"))); + QPixmap image1(aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image2(aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM_2P"))); setCaption(tr("GEOM_EXTRUSION_TITLE")); @@ -65,9 +63,10 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg(GeometryGUI* theGeometryGUI, QWid GroupConstructors->setTitle(tr("GEOM_EXTRUSION")); RadioButton1->setPixmap(image0); RadioButton2->setPixmap(image2); - //RadioButton2->close(TRUE); RadioButton3->close(TRUE); + RadioButton1->setChecked(true); + GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); GroupPoints->CheckButton1->hide(); GroupPoints->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV")); @@ -95,7 +94,6 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg(GeometryGUI* theGeometryGUI, QWid setHelpFileName("extrusion.htm"); - /* Initialisations */ Init(); } @@ -105,8 +103,8 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg(GeometryGUI* theGeometryGUI, QWid // purpose : Destroys the object and frees any allocated resources //================================================================================= GenerationGUI_PrismDlg::~GenerationGUI_PrismDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ +{ + // no need to delete child widgets, Qt does it all for us } @@ -125,15 +123,15 @@ void GenerationGUI_PrismDlg::Init() GroupPoints2->LineEdit2->setReadOnly( true ); GroupPoints2->LineEdit3->setReadOnly( true ); - //myOkBase = myOkVec = false; + myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil(); myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false; - + /* 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 & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); GroupPoints->SpinBox_DX->SetValue(100.0); /* signals and slots connections */ @@ -149,9 +147,10 @@ void GenerationGUI_PrismDlg::Init() connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), + GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); + connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); @@ -163,12 +162,10 @@ void GenerationGUI_PrismDlg::Init() connect(GroupPoints2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(myGeomGUI->getApp()->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName(tr("GEOM_EXTRUSION")); - - globalSelection( GEOM_ALLSHAPES ); ConstructorsClicked(0); } @@ -179,52 +176,52 @@ void GenerationGUI_PrismDlg::Init() //================================================================================= void GenerationGUI_PrismDlg::ConstructorsClicked(int constructorId) { - disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); - + erasePreview(); + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + switch (constructorId) + { + case 0: { - case 0: - { - globalSelection( GEOM_POINT ); - - GroupPoints2->hide(); - resize(0, 0); - GroupPoints->show(); - - //GroupPoints->LineEdit1->setFocus(); - //myEditCurrentArgument = GroupPoints->LineEdit1; - //displayPreview(); - - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setText(""); - GroupPoints->LineEdit2->setText(""); - GroupPoints2->LineEdit1->setText(""); - GroupPoints2->LineEdit2->setText(""); - GroupPoints2->LineEdit3->setText(""); - myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil(); - myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false; - - break; - } - case 1: - { - GroupPoints->hide(); - resize(0, 0); - GroupPoints2->show(); - - myEditCurrentArgument = GroupPoints2->LineEdit1; - GroupPoints2->LineEdit1->setText(""); - GroupPoints2->LineEdit2->setText(""); - GroupPoints2->LineEdit3->setText(""); - myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil(); - myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false; - GroupPoints->LineEdit1->setText(""); - GroupPoints->LineEdit2->setText(""); - - break; - } + globalSelection( GEOM_ALLSHAPES ); + + GroupPoints2->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(GroupPoints2->LineEdit1->text()); // keep base + GroupPoints->LineEdit2->setText(""); + myVec = GEOM::GEOM_Object::_nil(); + myOkVec = false; + + break; } - displayPreview(); + case 1: + { + globalSelection( GEOM_ALLSHAPES ); + + GroupPoints->hide(); + resize(0, 0); + GroupPoints2->show(); + + myEditCurrentArgument = GroupPoints2->LineEdit1; + GroupPoints2->LineEdit1->setText(GroupPoints->LineEdit1->text()); // keep base + GroupPoints2->LineEdit2->setText(""); + GroupPoints2->LineEdit3->setText(""); + myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + myOkPnt1 = myOkPnt2 = false; + + break; + } + } + + myEditCurrentArgument->setFocus(); + connect(myGeomGUI->getApp()->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + if (!myOkBase) + SelectionIntoArgument(); } @@ -262,8 +259,8 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() erasePreview(); myEditCurrentArgument->setText(""); - if ( getConstructorId()==0 ) { - + if (getConstructorId() == 0) + { if (IObjectCount() != 1) { if (myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false; @@ -288,13 +285,11 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() myVec = aSelectedObject; myOkVec = true; } - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); - displayPreview(); + myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); } - - else { // getConstructorId()==1 - extrusion using 2 points - + else // getConstructorId()==1 - extrusion using 2 points + { if (IObjectCount() != 1) { if (myEditCurrentArgument == GroupPoints2->LineEdit1) myOkBase = false; @@ -330,9 +325,28 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() myOkPnt2 = true; } - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); + } + + displayPreview(); +} - displayPreview(); + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if (send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2 || + send == GroupPoints2->LineEdit1 || + send == GroupPoints2->LineEdit2 || + send == GroupPoints2->LineEdit3 ) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); } } @@ -344,81 +358,64 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() void GenerationGUI_PrismDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - globalSelection( GEOM_ALLSHAPES ); - if(send == GroupPoints->PushButton1) { + if (send == GroupPoints->PushButton1) { GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection( GEOM_ALLSHAPES ); } - else if(send == GroupPoints->PushButton2) { + else if (send == GroupPoints->PushButton2) { GroupPoints->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit2; globalSelection( GEOM_LINE ); } - else if(send == GroupPoints2->PushButton1) { + else if (send == GroupPoints2->PushButton1) { GroupPoints2->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints2->LineEdit1; + globalSelection( GEOM_ALLSHAPES ); } - else if(send == GroupPoints2->PushButton2) { + else if (send == GroupPoints2->PushButton2) { GroupPoints2->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints2->LineEdit2; globalSelection( GEOM_POINT ); } - else if(send == GroupPoints2->PushButton3) { + else if (send == GroupPoints2->PushButton3) { GroupPoints2->LineEdit3->setFocus(); myEditCurrentArgument = GroupPoints2->LineEdit3; globalSelection( GEOM_POINT ); } + + myEditCurrentArgument->setFocus(); SelectionIntoArgument(); } //================================================================================= -// function : LineEditReturnPressed() +// function : ActivateThisDialog() // purpose : //================================================================================= -void GenerationGUI_PrismDlg::LineEditReturnPressed() +void GenerationGUI_PrismDlg::ActivateThisDialog() { - QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2 || - send == GroupPoints2->LineEdit1 || - send == GroupPoints2->LineEdit2 || - send == GroupPoints2->LineEdit3 ) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + 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_PrismDlg::enterEvent(QEvent * e) { - if ( !GroupConstructors->isEnabled() ) + if (!GroupConstructors->isEnabled()) ActivateThisDialog(); } -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GenerationGUI_PrismDlg::ActivateThisDialog() -{ - GEOMBase_Skeleton::ActivateThisDialog(); - globalSelection( GEOM_ALLSHAPES ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - //GroupPoints->LineEdit1->setFocus(); - //myEditCurrentArgument = GroupPoints->LineEdit1; - //displayPreview(); - ConstructorsClicked( getConstructorId() ); -} - - //================================================================================= // function : ValueChangedInSpinBox() // purpose : @@ -453,7 +450,12 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation() //================================================================================= bool GenerationGUI_PrismDlg::isValid( QString& ) { - return myOkBase && ( myOkVec || (myOkPnt1 && myOkPnt2) ); + if (getConstructorId() == 0) + // by vector and height + return (myOkBase && myOkVec); + + // by two points + return (myOkBase && myOkPnt1 && myOkPnt2); } //================================================================================= @@ -464,15 +466,15 @@ bool GenerationGUI_PrismDlg::execute( ObjectList& objects ) { GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) + switch ( getConstructorId() ) { - case 0 : - { + case 0: + { anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> MakePrismVecH(myBase, myVec, getHeight()); break; } - case 1 : + case 1: { anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> MakePrismTwoPnt(myBase, myPoint1, myPoint2); diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.h b/src/GenerationGUI/GenerationGUI_PrismDlg.h index 2c106080c..e9b265634 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.h +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.h @@ -17,7 +17,7 @@ // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -53,15 +53,15 @@ protected: virtual bool isValid( QString& msg ); virtual bool execute( ObjectList& objects ); -private : +private: void Init(); void enterEvent(QEvent* e); double getHeight() const; - + GEOM::GEOM_Object_var myBase; /* Base shape */ GEOM::GEOM_Object_var myVec; /* Vector, defining the direction */ - GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points for extrusion */ - + GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points for extrusion */ + bool myOkBase; bool myOkVec; bool myOkPnt1; @@ -73,11 +73,12 @@ private : private slots: void ClickOnOk(); bool ClickOnApply(); + void ActivateThisDialog(); + void ConstructorsClicked(int); void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); - void ConstructorsClicked(int); void ValueChangedInSpinBox(); void onReverse(); }; diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index e8a6608ad..1956395ac 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -114,7 +114,7 @@ void GenerationGUI_RevolDlg::Init() double SpecificStep = 5; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); GroupPoints->SpinBox_DX->SetValue(45.0); /* signals and slots connections */ diff --git a/src/GroupGUI/GroupGUI_GroupDlg.h b/src/GroupGUI/GroupGUI_GroupDlg.h index a42fad91e..3e9f34618 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.h +++ b/src/GroupGUI/GroupGUI_GroupDlg.h @@ -32,6 +32,7 @@ #include +class QGroupBox; class QLineEdit; class QListBox; @@ -89,6 +90,7 @@ private: GEOM::GEOM_Object_var myMainObj; GEOM::GEOM_Object_var myGroup; + QGroupBox* GroupMedium; QPushButton* mySelBtn; QLineEdit* myMainName; QPushButton* mySelSubBtn; diff --git a/src/Makefile.am b/src/Makefile.am index 3a05c863f..5a9503b94 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -25,4 +25,8 @@ # Module : GEOM # $Header$ -SUBDIRS = OBJECT ARCHIMEDE NMTDS NMTTools NMTAlgo GEOMAlgo SKETCHER GEOM BREPExport BREPImport IGESExport IGESImport STEPExport STEPImport STLExport ShHealOper GEOMImpl GEOM_I GEOMClient DlgRef GEOMFiltersSelection GEOMGUI GEOMBase GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI GroupGUI BlocksGUI GEOM_I_Superv GEOM_SWIG +SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo SKETCHER GEOM BREPExport BREPImport IGESExport IGESImport STEPExport STEPImport STLExport ShHealOper GEOMImpl GEOM_I GEOMClient GEOM_I_Superv GEOM_SWIG + +if GEOM_ENABLE_GUI + SUBDIRS+= OBJECT DlgRef GEOMFiltersSelection GEOMGUI GEOMBase GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI GroupGUI BlocksGUI GEOM_SWIG_WITHIHM +endif diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx index ec3acf783..0105cf53a 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx @@ -17,7 +17,7 @@ // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -29,6 +29,8 @@ #include "MeasureGUI_CenterMassDlg.h" #include "MeasureGUI_1Sel3LineEdit_QTD.h" +#include "DlgRef_SpinBox.h" + #include "utilities.h" #include "SUIT_Session.h" #include "SalomeApp_Application.h" @@ -245,9 +247,9 @@ void MeasureGUI_CenterMassDlg::processObject() getParameters( x, y, z ); myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) ); - myGrp->LineEdit2->setText( QString( "%1" ).arg( x ) ); - myGrp->LineEdit3->setText( QString( "%1" ).arg( y ) ); - myGrp->LineEdit4->setText( QString( "%1" ).arg( z ) ); + myGrp->LineEdit2->setText( DlgRef_SpinBox::PrintDoubleValue( x ) ); + myGrp->LineEdit3->setText( DlgRef_SpinBox::PrintDoubleValue( y ) ); + myGrp->LineEdit4->setText( DlgRef_SpinBox::PrintDoubleValue( z ) ); displayPreview(); } diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index d7ac8ed90..163b19653 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -17,7 +17,7 @@ // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -30,6 +30,7 @@ #include "MeasureGUI_2Sel1LineEdit_QTD.h" #include "GEOMBase.h" #include "GEOM_Displayer.h" +#include "DlgRef_SpinBox.h" #include "SUIT_Session.h" #include "SUIT_ViewWindow.h" @@ -118,14 +119,13 @@ void MeasureGUI_DistanceDlg::Init() mySelEdit = myGrp->LineEdit1; mySelBtn2 = myGrp->PushButton2; mySelEdit2 = myGrp->LineEdit2; - + myEditCurrentArgument = mySelEdit; connect( mySelEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( mySelBtn2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); MeasureGUI_Skeleton::Init(); - } @@ -163,7 +163,7 @@ void MeasureGUI_DistanceDlg::processObject() double aDist = 0.; if ( getParameters( aDist, aPnt1, aPnt2 ) ) { - myGrp->LineEdit3->setText( QString( "%1" ).arg( aDist ) ); + myGrp->LineEdit3->setText( DlgRef_SpinBox::PrintDoubleValue( aDist ) ); redisplayPreview(); } else @@ -171,7 +171,6 @@ void MeasureGUI_DistanceDlg::processObject() myGrp->LineEdit3->setText( "" ); erasePreview(); } - } //================================================================================= @@ -256,12 +255,14 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs() { double aDist = 0.; gp_Pnt aPnt1( 0, 0, 0 ), aPnt2( 0, 0, 0 ); - - if ( myObj->_is_nil() || myObj2->_is_nil() || !getParameters( aDist, aPnt1, aPnt2 ) || - SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() - != OCCViewer_Viewer::Type() ) + + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + + if ( myObj->_is_nil() || myObj2->_is_nil() || + !getParameters( aDist, aPnt1, aPnt2 ) || + vw->getViewManager()->getType() != OCCViewer_Viewer::Type() ) return 0; - + try { if( aDist <= 1.e-9 ) @@ -282,7 +283,6 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs() ( aPnt1.Y() + aPnt2.Y() ) / 2, ( aPnt1.Z() + aPnt2.Z() ) / 2 + 100 ); - gp_Vec va( aPnt3, aPnt1 ); gp_Vec vb( aPnt3, aPnt2 ); @@ -291,18 +291,15 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs() aPnt3.SetY( ( aPnt1.Y() + aPnt2.Y() ) / 2 + 100 ); aPnt3.SetZ( ( aPnt1.Z() + aPnt2.Z() ) / 2 ); } - + gce_MakePln gce_MP( aPnt1, aPnt2, aPnt3 ); Handle( Geom_Plane ) P = new Geom_Plane( gce_MP.Value() ); - Handle( AIS_LengthDimension ) anIO = new AIS_LengthDimension( - aVert1, aVert2, P, aDist, TCollection_ExtendedString( (Standard_CString)aLabel.latin1() ) ); + Handle( AIS_LengthDimension ) anIO = new AIS_LengthDimension + (aVert1, aVert2, P, aDist, TCollection_ExtendedString((Standard_CString)aLabel.latin1())); - SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); - SOCC_Prs* aPrs = dynamic_cast( ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs( 0 ) ); - - //QAD_ViewFrame* vf = GEOM_Displayer::GetActiveView(); - //OCCViewer_Prs* aPrs = dynamic_cast( vf->CreatePrs( 0 ) ); + SOCC_Prs* aPrs = + dynamic_cast( ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs( 0 ) ); if ( aPrs ) aPrs->AddObject( anIO ); @@ -324,17 +321,3 @@ bool MeasureGUI_DistanceDlg::isValid( QString& msg ) { return MeasureGUI_Skeleton::isValid( msg ) && !myObj2->_is_nil(); } - - - - - - - - - - - - - - diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx index cd2a6743e..516f9cd6c 100644 --- a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx @@ -17,7 +17,7 @@ // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -203,4 +203,3 @@ bool MeasureGUI_InertiaDlg::getParameters( gp_Mat& I, return getOperation()->IsDone(); } } - diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx index ed42f2126..a5b1bb77a 100644 --- a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx @@ -17,7 +17,7 @@ // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -181,24 +181,3 @@ bool MeasureGUI_MaxToleranceDlg::getParameters( double& theMinFaceToler, return getOperation()->IsDone(); } } - - - - - - - - - - - - - - - - - - - - - diff --git a/src/MeasureGUI/MeasureGUI_PointDlg.cxx b/src/MeasureGUI/MeasureGUI_PointDlg.cxx index 1a14cc347..ccd2a8f07 100644 --- a/src/MeasureGUI/MeasureGUI_PointDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PointDlg.cxx @@ -29,7 +29,10 @@ #include "MeasureGUI_PointDlg.h" #include "GEOMBase.h" +#include "DlgRef_SpinBox.h" + #include "utilities.h" + #include "SUIT_Session.h" #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" @@ -58,14 +61,13 @@ //================================================================================= // class : MeasureGUI_PointDlg() // purpose : Constructs a MeasureGUI_PointDlg which is a child of 'parent' -// //================================================================================= MeasureGUI_PointDlg::MeasureGUI_PointDlg( GeometryGUI* GUI, QWidget* parent ) : MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_PointDlg" ) { QPixmap iconPnt( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_DLG_POINT" ) ) ); - + QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); @@ -75,7 +77,7 @@ MeasureGUI_PointDlg::MeasureGUI_PointDlg( GeometryGUI* GUI, QWidget* parent ) RadioButton1->setPixmap( iconPnt ); QGroupBox* aGrp = new QGroupBox( 2, Qt::Horizontal, tr( "COORDINATES" ), this ); - + new QLabel( tr( "POINT" ), aGrp ); QFrame* aFrame = new QFrame( aGrp ); mySelBtn = new QPushButton( aFrame ); @@ -108,7 +110,7 @@ MeasureGUI_PointDlg::MeasureGUI_PointDlg( GeometryGUI* GUI, QWidget* parent ) //================================================================================= // function : ~MeasureGUI_PointDlg() // purpose : Destroys the object and frees any allocated resources -//======================myX->setReadOnly( true );=========================================================== +//================================================================================= MeasureGUI_PointDlg::~MeasureGUI_PointDlg() { } @@ -178,7 +180,7 @@ void MeasureGUI_PointDlg::SelectionIntoArgument() TopTools_IndexedMapOfShape aShapes; TopExp::MapShapes( aShape, aShapes ); - + if ( aShape != aShapes( i ) ) aName += QString( ":%1" ).arg( i ); @@ -189,9 +191,9 @@ void MeasureGUI_PointDlg::SelectionIntoArgument() { gp_Pnt aPnt = BRep_Tool::Pnt( aPoint ); mySelEdit->setText( aName ); - myX->setText( QString( "%1" ).arg( aPnt.X() ) ); - myY->setText( QString( "%1" ).arg( aPnt.Y() ) ); - myZ->setText( QString( "%1" ).arg( aPnt.Z() ) ); + myX->setText(DlgRef_SpinBox::PrintDoubleValue(aPnt.X())); + myY->setText(DlgRef_SpinBox::PrintDoubleValue(aPnt.Y())); + myZ->setText(DlgRef_SpinBox::PrintDoubleValue(aPnt.Z())); } } catch( ... ) @@ -203,23 +205,3 @@ void MeasureGUI_PointDlg::SelectionIntoArgument() myZ->setText( "" ); } } - - - - - - - - - - - - - - - - - - - - diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx index ea3bb594c..71d3d6980 100644 --- a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx @@ -31,6 +31,7 @@ #include "GEOM_Displayer.h" #include "GEOMImpl_Types.hxx" #include "GEOMBase.h" +#include "DlgRef_SpinBox.h" #include "SalomeApp_Tools.h" #include "utilities.h" @@ -148,9 +149,9 @@ void MeasureGUI_PropertiesDlg::processObject() } else { - myGrp->LineEdit2->setText( QString( "%1" ).arg( aLength ) ); - myGrp->LineEdit3->setText( QString( "%1" ).arg( anArea ) ); - myGrp->LineEdit4->setText( QString( "%1" ).arg( aVolume ) ); + myGrp->LineEdit2->setText( DlgRef_SpinBox::PrintDoubleValue( aLength ) ); + myGrp->LineEdit3->setText( DlgRef_SpinBox::PrintDoubleValue( anArea ) ); + myGrp->LineEdit4->setText( DlgRef_SpinBox::PrintDoubleValue( aVolume ) ); } } @@ -200,24 +201,3 @@ SALOME_Prs* MeasureGUI_PropertiesDlg::buildPrs() return getDisplayer()->BuildPrs( aResult ); } - - - - - - - - - - - - - - - - - - - - - diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.cxx b/src/MeasureGUI/MeasureGUI_Skeleton.cxx index ef4d92e8b..def236c38 100644 --- a/src/MeasureGUI/MeasureGUI_Skeleton.cxx +++ b/src/MeasureGUI/MeasureGUI_Skeleton.cxx @@ -61,12 +61,11 @@ MeasureGUI_Skeleton::MeasureGUI_Skeleton( GeometryGUI* GUI, GEOMBase_Helper( dynamic_cast( parent ) ), myGeomGUI( GUI ) { - mySelBtn = 0; mySelEdit = 0; myDisplayer = 0; myHelpFileName = ""; - + if ( !name ) setName( "MeasureGUI_Skeleton" ); @@ -75,7 +74,6 @@ MeasureGUI_Skeleton::MeasureGUI_Skeleton( GeometryGUI* GUI, buttonClose->setAutoDefault( false ); - GroupMedium->close( TRUE ); resize( 350, 0 ); } diff --git a/src/MeasureGUI/MeasureGUI_Skeleton_QTD.cxx b/src/MeasureGUI/MeasureGUI_Skeleton_QTD.cxx index cc518f461..5a01f5818 100644 --- a/src/MeasureGUI/MeasureGUI_Skeleton_QTD.cxx +++ b/src/MeasureGUI/MeasureGUI_Skeleton_QTD.cxx @@ -20,7 +20,7 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'MeasureGUI_Skeleton_QTD.ui' ** -** Created: Tue Mar 21 10:10:08 2006 +** Created: Tue Mar 13 14:20:24 2007 ** by: The User Interface Compiler ($Id$) ** ** WARNING! All changes made in this file will be lost! @@ -96,11 +96,6 @@ MeasureGUI_Skeleton_QTD::MeasureGUI_Skeleton_QTD( QWidget* parent, const char* n Layout1->addWidget( GroupConstructors, 0, 0 ); - GroupMedium = new QGroupBox( this, "GroupMedium" ); - GroupMedium->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupMedium->sizePolicy().hasHeightForWidth() ) ); - - Layout1->addWidget( GroupMedium, 1, 0 ); - MeasureGUI_Skeleton_QTDLayout->addLayout( Layout1, 0, 0 ); languageChange(); resize( QSize(228, 266).expandedTo(minimumSizeHint()) ); @@ -121,12 +116,5 @@ MeasureGUI_Skeleton_QTD::~MeasureGUI_Skeleton_QTD() */ void MeasureGUI_Skeleton_QTD::languageChange() { - setCaption( tr( "MeasureGUI_Skeleton_QTD" ) ); - GroupButtons->setTitle( QString::null ); - buttonClose->setText( tr( "&Close" ) ); - buttonHelp->setText( tr( "&Help" ) ); - GroupConstructors->setTitle( QString::null ); - RadioButton1->setText( QString::null ); - GroupMedium->setTitle( QString::null ); } diff --git a/src/MeasureGUI/MeasureGUI_Skeleton_QTD.h b/src/MeasureGUI/MeasureGUI_Skeleton_QTD.h index cdc2f7de4..990f0a63e 100644 --- a/src/MeasureGUI/MeasureGUI_Skeleton_QTD.h +++ b/src/MeasureGUI/MeasureGUI_Skeleton_QTD.h @@ -20,7 +20,7 @@ /**************************************************************************** ** Form interface generated from reading ui file 'MeasureGUI_Skeleton_QTD.ui' ** -** Created: Tue Mar 21 10:10:08 2006 +** Created: Tue Mar 13 14:20:20 2007 ** by: The User Interface Compiler ($Id$) ** ** WARNING! All changes made in this file will be lost! @@ -56,7 +56,6 @@ public: QPushButton* buttonHelp; QButtonGroup* GroupConstructors; QRadioButton* RadioButton1; - QGroupBox* GroupMedium; protected: QGridLayout* MeasureGUI_Skeleton_QTDLayout; diff --git a/src/MeasureGUI/UIFiles/MeasureGUI_Skeleton_QTD.ui b/src/MeasureGUI/UIFiles/MeasureGUI_Skeleton_QTD.ui index 07f94c80d..fa012c203 100644 --- a/src/MeasureGUI/UIFiles/MeasureGUI_Skeleton_QTD.ui +++ b/src/MeasureGUI/UIFiles/MeasureGUI_Skeleton_QTD.ui @@ -20,9 +20,6 @@ 0 - - MeasureGUI_Skeleton_QTD - true @@ -62,9 +59,6 @@ 0 - - - unnamed @@ -110,17 +104,11 @@ buttonClose - - &Close - buttonHelp - - &Help - @@ -138,9 +126,6 @@ 0 - - - unnamed @@ -169,30 +154,11 @@ RadioButton1 - - - - - - GroupMedium - - - - 7 - 7 - 0 - 0 - - - - - - diff --git a/src/NMTDS/Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx b/src/NMTDS/Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx new file mode 100644 index 000000000..a48a632d0 --- /dev/null +++ b/src/NMTDS/Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx @@ -0,0 +1,72 @@ +// Copyright (C) 2005 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. +// +// 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 _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile +#define _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger); + +class Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) : public Handle(TCollection_MapNode) { + public: + Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)():Handle(TCollection_MapNode)() {} + Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)(const Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)(const NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)& operator=(const Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)& operator=(const NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger* operator->() const + { + return (NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger *)ControlAccess(); + } + +// Standard_EXPORT ~Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)(); + + Standard_EXPORT static const Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/NMTDS/Makefile.am b/src/NMTDS/Makefile.am index 7f5d642a9..edc19fc65 100644 --- a/src/NMTDS/Makefile.am +++ b/src/NMTDS/Makefile.am @@ -31,6 +31,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files salomeinclude_HEADERS = \ + Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx \ Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx \ Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx \ Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx \ @@ -40,6 +41,9 @@ salomeinclude_HEADERS = \ Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean.hxx \ Handle_NMTDS_StdMapNodeOfMapOfPassKey.hxx \ NMTDS_CArray1OfIndexRange.hxx \ + NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx \ + NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx \ + NMTDS_DataMapOfIntegerMapOfInteger.hxx \ NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx \ NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx \ NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx \ @@ -47,7 +51,10 @@ salomeinclude_HEADERS = \ NMTDS_IndexedDataMapOfIntegerShape.hxx \ NMTDS_IndexedDataMapOfShapeBox.hxx \ NMTDS_IndexRange.hxx \ + NMTDS_InterfPool.hxx \ + NMTDS_InterfType.hxx \ NMTDS_Iterator.hxx \ + NMTDS_IteratorCheckerSI.hxx \ NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx \ NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx \ NMTDS_ListIteratorOfListOfPassKey.hxx \ @@ -62,12 +69,17 @@ salomeinclude_HEADERS = \ NMTDS_MapOfPassKeyBoolean.hxx \ NMTDS_MapOfPassKey.hxx \ NMTDS_PassKeyBoolean.hxx \ + NMTDS_PInterfPool.hxx \ + NMTDS_PIterator.hxx \ NMTDS_PassKey.hxx \ NMTDS_PassKeyMapHasher.hxx \ + NMTDS_PassKeyShape.hxx \ + NMTDS_PassKeyShapeMapHasher.hxx \ NMTDS_PShapesDataStructure.hxx \ NMTDS_ShapesDataStructure.hxx \ NMTDS_StdMapNodeOfMapOfPassKeyBoolean.hxx \ NMTDS_StdMapNodeOfMapOfPassKey.hxx \ + NMTDS_Tools.hxx \ NMTDS_BoxBndTree.hxx # Libraries targets @@ -75,6 +87,9 @@ lib_LTLIBRARIES = libNMTDS.la dist_libNMTDS_la_SOURCES = \ NMTDS_CArray1OfIndexRange_0.cxx \ + NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_0.cxx \ + NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_0.cxx \ + NMTDS_DataMapOfIntegerMapOfInteger_0.cxx \ NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_0.cxx \ NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx \ NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_0.cxx \ @@ -82,7 +97,9 @@ dist_libNMTDS_la_SOURCES = \ NMTDS_IndexedDataMapOfIntegerShape_0.cxx \ NMTDS_IndexedDataMapOfShapeBox_0.cxx \ NMTDS_IndexRange.cxx \ + NMTDS_InterfPool.cxx \ NMTDS_Iterator.cxx \ + NMTDS_IteratorCheckerSI.cxx \ NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx \ NMTDS_ListIteratorOfListOfPassKey_0.cxx \ NMTDS_ListIteratorOfListOfPassKeyBoolean_0.cxx \ @@ -99,9 +116,12 @@ dist_libNMTDS_la_SOURCES = \ NMTDS_PassKeyBoolean.cxx \ NMTDS_PassKey.cxx \ NMTDS_PassKeyMapHasher.cxx \ + NMTDS_PassKeyShape.cxx \ + NMTDS_PassKeyShapeMapHasher.cxx \ NMTDS_ShapesDataStructure.cxx \ NMTDS_StdMapNodeOfMapOfPassKey_0.cxx \ NMTDS_StdMapNodeOfMapOfPassKeyBoolean_0.cxx \ + NMTDS_Tools.cxx \ NMTDS_BoxBndTree.cxx # additionnal information to compil and link file diff --git a/src/NMTDS/NMTDS.cdl b/src/NMTDS/NMTDS.cdl index c023fff9e..cabb10f4b 100644 --- a/src/NMTDS/NMTDS.cdl +++ b/src/NMTDS/NMTDS.cdl @@ -28,29 +28,49 @@ package NMTDS ---Purpose: uses - TCollection, TColStd, Bnd, TopoDS, TopAbs, TopTools, - BooleanOperations, - BOPTColStd + BooleanOperations, + BOPTools, + BOPTColStd + is + enumeration InterfType is + TI_VV, + TI_VE, + TI_VF, + TI_EE, + TI_EF, + TI_FF, + TI_UNKNOWN + end InterfType; + -- class ShapesDataStructure; class IndexRange; -- Modified to Add new classes Thu Sep 14 14:35:18 2006 -- Contribution of Samtech www.samcef.com BEGIN class Iterator; + class PassKey; class PassKeyBoolean; class PassKeyMapHasher; -- Contribution of Samtech www.samcef.com END - + class PassKeyShape; + class PassKeyShapeMapHasher; + --modified by NIZNHY-PKV Tue Feb 6 10:40:02 2007f + class IteratorCheckerSI; + class Tools; + class InterfPool; + --modified by NIZNHY-PKV Tue Feb 6 10:40:04 2007t pointer PShapesDataStructure to ShapesDataStructure from NMTDS; - + pointer PIterator to Iterator from NMTDS; + pointer PInterfPool to InterfPool from NMTDS; + class CArray1OfIndexRange instantiates CArray1 from BOPTColStd(IndexRange from NMTDS); @@ -79,7 +99,7 @@ is PassKeyMapHasher from NMTDS); -- Contribution of Samtech www.samcef.com END - +--modified by NIZNHY-PKV Tue Oct 10 11:19:06 2006f class IndexedDataMapOfShapeBox instantiates IndexedDataMap from TCollection (Shape from TopoDS, Box from Bnd, @@ -88,6 +108,12 @@ is instantiates IndexedDataMap from TCollection (Integer from Standard, Shape from TopoDS, MapIntegerHasher from TColStd); + + class DataMapOfIntegerMapOfInteger + instantiates DataMap from TCollection (Integer from Standard, + MapOfInteger from TColStd, + MapIntegerHasher from TColStd); +--modified by NIZNHY-PKV Tue Oct 10 11:19:08 2006t end NMTDS; diff --git a/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx b/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx new file mode 100644 index 000000000..5c782f2d4 --- /dev/null +++ b/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx @@ -0,0 +1,115 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile +#define _NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile + +#ifndef _TCollection_BasicMapIterator_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class TColStd_MapOfInteger; +class TColStd_MapIntegerHasher; +class NMTDS_DataMapOfIntegerMapOfInteger; +class NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger : public TCollection_BasicMapIterator { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger(); + + +Standard_EXPORT NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger(const NMTDS_DataMapOfIntegerMapOfInteger& aMap); + + +Standard_EXPORT void Initialize(const NMTDS_DataMapOfIntegerMapOfInteger& aMap) ; + + +Standard_EXPORT const Standard_Integer& Key() const; + + +Standard_EXPORT const TColStd_MapOfInteger& Value() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_0.cxx b/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_0.cxx new file mode 100644 index 000000000..52c8d5334 --- /dev/null +++ b/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_0.cxx @@ -0,0 +1,54 @@ +// Copyright (C) 2005 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. +// +// 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 + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _TColStd_MapOfInteger_HeaderFile +#include +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif +#ifndef _NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif + + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem TColStd_MapOfInteger +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_Type_() NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() +#define TCollection_DataMap NMTDS_DataMapOfIntegerMapOfInteger +#define TCollection_DataMap_hxx +#include + diff --git a/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx b/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx new file mode 100644 index 000000000..89989c7a3 --- /dev/null +++ b/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx @@ -0,0 +1,131 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile +#define _NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _TColStd_MapOfInteger_HeaderFile +#include +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class TColStd_MapOfInteger; +class TColStd_MapIntegerHasher; +class NMTDS_DataMapOfIntegerMapOfInteger; +class NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger; + + + +class NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger : public TCollection_MapNode { + +public: + // Methods PUBLIC + // + +NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger(const Standard_Integer& K,const TColStd_MapOfInteger& I,const TCollection_MapNodePtr& n); + + Standard_Integer& Key() const; + + TColStd_MapOfInteger& Value() const; +//Standard_EXPORT ~NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger(); + + + + + // Type management + // + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Integer myKey; +TColStd_MapOfInteger myValue; + + +}; + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem TColStd_MapOfInteger +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_Type_() NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() +#define TCollection_DataMap NMTDS_DataMapOfIntegerMapOfInteger +#define TCollection_DataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_DataMapNode +#undef TCollection_DataMapNode_hxx +#undef TCollection_DataMapIterator +#undef TCollection_DataMapIterator_hxx +#undef Handle_TCollection_DataMapNode +#undef TCollection_DataMapNode_Type_ +#undef TCollection_DataMap +#undef TCollection_DataMap_hxx + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_0.cxx b/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_0.cxx new file mode 100644 index 000000000..81d4ca5ad --- /dev/null +++ b/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_0.cxx @@ -0,0 +1,100 @@ +// Copyright (C) 2005 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. +// +// 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 + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _TColStd_MapOfInteger_HeaderFile +#include +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif +#ifndef _NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif +//NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger::~NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger() {} + + + +Standard_EXPORT Handle_Standard_Type& NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger", + sizeof(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger))) { + _anOtherObject = Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)((Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger::DynamicType() const +{ + return STANDARD_TYPE(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) ; +} +//Standard_Boolean NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger::IsKind(const Handle(Standard_Type)& AType) const +//{ +// return (STANDARD_TYPE(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) == AType || TCollection_MapNode::IsKind(AType)); +//} +//Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger::~Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger() {} +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem TColStd_MapOfInteger +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_Type_() NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() +#define TCollection_DataMap NMTDS_DataMapOfIntegerMapOfInteger +#define TCollection_DataMap_hxx +#include + diff --git a/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger.hxx b/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger.hxx new file mode 100644 index 000000000..2e7c5b402 --- /dev/null +++ b/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger.hxx @@ -0,0 +1,154 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile +#define _NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_NoSuchObject; +class TColStd_MapOfInteger; +class TColStd_MapIntegerHasher; +class NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger; +class NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTDS_DataMapOfIntegerMapOfInteger : public TCollection_BasicMap { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT NMTDS_DataMapOfIntegerMapOfInteger(const Standard_Integer NbBuckets = 1); + + +Standard_EXPORT NMTDS_DataMapOfIntegerMapOfInteger& Assign(const NMTDS_DataMapOfIntegerMapOfInteger& Other) ; + NMTDS_DataMapOfIntegerMapOfInteger& operator =(const NMTDS_DataMapOfIntegerMapOfInteger& Other) +{ + return Assign(Other); +} + + + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; + + +Standard_EXPORT void Clear() ; +~NMTDS_DataMapOfIntegerMapOfInteger() +{ + Clear(); +} + + + +Standard_EXPORT Standard_Boolean Bind(const Standard_Integer& K,const TColStd_MapOfInteger& I) ; + + +Standard_EXPORT Standard_Boolean IsBound(const Standard_Integer& K) const; + + +Standard_EXPORT Standard_Boolean UnBind(const Standard_Integer& K) ; + + +Standard_EXPORT const TColStd_MapOfInteger& Find(const Standard_Integer& K) const; + const TColStd_MapOfInteger& operator()(const Standard_Integer& K) const +{ + return Find(K); +} + + + +Standard_EXPORT TColStd_MapOfInteger& ChangeFind(const Standard_Integer& K) ; + TColStd_MapOfInteger& operator()(const Standard_Integer& K) +{ + return ChangeFind(K); +} + + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + +Standard_EXPORT NMTDS_DataMapOfIntegerMapOfInteger(const NMTDS_DataMapOfIntegerMapOfInteger& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger_0.cxx b/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger_0.cxx new file mode 100644 index 000000000..ca6e0ffea --- /dev/null +++ b/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger_0.cxx @@ -0,0 +1,57 @@ +// Copyright (C) 2005 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. +// +// 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 + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _TColStd_MapOfInteger_HeaderFile +#include +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif +#ifndef _NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif + + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem TColStd_MapOfInteger +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_Type_() NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() +#define TCollection_DataMap NMTDS_DataMapOfIntegerMapOfInteger +#define TCollection_DataMap_hxx +#include + diff --git a/src/NMTDS/NMTDS_InterfPool.cdl b/src/NMTDS/NMTDS_InterfPool.cdl new file mode 100644 index 000000000..8b74d08c4 --- /dev/null +++ b/src/NMTDS/NMTDS_InterfPool.cdl @@ -0,0 +1,151 @@ +-- Copyright (C) 2005 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. +-- +-- 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: NMTDS_InterfPool.cdl +-- Created: Wed Feb 21 10:10:58 2007 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2007 + + +class InterfPool from NMTDS + + ---Purpose: + +uses + MapOfPassKeyBoolean from NMTDS, + ListOfPassKeyBoolean from NMTDS, + PassKeyBoolean from NMTDS, + InterfType from NMTDS, + -- + CArray1OfSSInterference from BOPTools, + CArray1OfESInterference from BOPTools, + CArray1OfVSInterference from BOPTools, + CArray1OfEEInterference from BOPTools, + CArray1OfVEInterference from BOPTools, + CArray1OfVVInterference from BOPTools + +--raises + +is + Create + returns InterfPool from NMTDS; + ---C++: alias "Standard_EXPORT virtual ~NMTDS_InterfPool();" + + + Add (me:out; + aPKB : PassKeyBoolean from NMTDS; + aType: InterfType from NMTDS) + returns Boolean from Standard; + + Add (me:out; + aInd1 : Integer from Standard; + aInd2 : Integer from Standard; + aType : InterfType from NMTDS) + returns Boolean from Standard; + + Add (me:out; + aInd1 : Integer from Standard; + aInd2 : Integer from Standard; + bFlag : Boolean from Standard; + aType : InterfType from NMTDS) + returns Boolean from Standard; + + Contains(me; + aPKB : PassKeyBoolean from NMTDS) + returns Boolean from Standard; + + Contains(me; + aInd1 : Integer from Standard; + aInd2 : Integer from Standard) + returns Boolean from Standard; + + Get(me) + returns ListOfPassKeyBoolean from NMTDS; + ---C++: return const & + + Get(me; + aType : InterfType from NMTDS) + returns ListOfPassKeyBoolean from NMTDS; + ---C++: return const & + + Get(me; + aInd : Integer from Standard) + returns ListOfPassKeyBoolean from NMTDS; + ---C++: return const & + + Get(me; + aInd : Integer from Standard; + aType: InterfType from NMTDS) + returns ListOfPassKeyBoolean from NMTDS; + ---C++: return const & + + -- + -- Interferences + -- + SSInterferences (me:out) + returns CArray1OfSSInterference from BOPTools; + ---C++: return & + ---Purpose: + --- Returns the reference to array Of F/F interferences + --- + ESInterferences (me:out) + returns CArray1OfESInterference from BOPTools; + ---C++: return & + ---Purpose: + --- Returns the reference to array Of E/F interferences + --- + VSInterferences (me:out) + returns CArray1OfVSInterference from BOPTools; + ---C++: return & + ---Purpose: + --- Returns the reference to array Of V/F interferences + --- + EEInterferences (me:out) + returns CArray1OfEEInterference from BOPTools; + ---C++: return & + ---Purpose: + --- Returns the reference to arrray Of E/E interferences + --- + VEInterferences (me:out) + returns CArray1OfVEInterference from BOPTools; + ---C++: return & + ---Purpose: + --- Returns the reference to arrray Of V/E interferences + --- + VVInterferences (me:out) + returns CArray1OfVVInterference from BOPTools; + ---C++: return & + ---Purpose: + --- Returns the reference to arrray Of V/V interferences + --- + +fields + myTable : MapOfPassKeyBoolean from NMTDS [6] is protected; + myList : ListOfPassKeyBoolean from NMTDS is protected; + myMaxInd: Integer from Standard is protected; + -- + mySSInterferences : CArray1OfSSInterference from BOPTools is protected; + myESInterferences : CArray1OfESInterference from BOPTools is protected; + myVSInterferences : CArray1OfVSInterference from BOPTools is protected; + myEEInterferences : CArray1OfEEInterference from BOPTools is protected; + myVEInterferences : CArray1OfVEInterference from BOPTools is protected; + myVVInterferences : CArray1OfVVInterference from BOPTools is protected; + +end InterfPool; diff --git a/src/NMTDS/NMTDS_InterfPool.cxx b/src/NMTDS/NMTDS_InterfPool.cxx new file mode 100644 index 000000000..95774e9f7 --- /dev/null +++ b/src/NMTDS/NMTDS_InterfPool.cxx @@ -0,0 +1,281 @@ +// Copyright (C) 2005 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. +// +// 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: NMTDS_.InterfPoolcxx +// Created: Wed Feb 21 10:35:35 2007 +// Author: Peter KURNEV +// + + +#include +#include +#include +#include +#include + +static + Standard_Integer TypeToInteger(const NMTDS_InterfType aType); + +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTDS_InterfPool::NMTDS_InterfPool() +{ + myMaxInd=6; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + NMTDS_InterfPool::~NMTDS_InterfPool() +{ +} +//======================================================================= +//function : Add +//purpose : +//======================================================================= + Standard_Boolean NMTDS_InterfPool::Add (const NMTDS_PassKeyBoolean& aPKB, + const NMTDS_InterfType aType) +{ + Standard_Boolean bRet; + Standard_Integer iType; + // + bRet=Standard_False; + // + iType=TypeToInteger(aType); + if (iType>-1 && iTypeClear(); + // + for (i=0; iAppend(aPKB); + } + } + return myList; +} +//======================================================================= +//function : Get +//purpose : +//======================================================================= + const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const Standard_Integer aInd)const +{ + Standard_Integer i, n1, n2; + NMTDS_ListOfPassKeyBoolean* pL; + // + pL=(NMTDS_ListOfPassKeyBoolean*)&myList; + pL->Clear(); + // + for (i=0; iAppend(aPKB); + } + } + } + return myList; +} +//======================================================================= +//function : Get +//purpose : +//======================================================================= + const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const NMTDS_InterfType aType)const +{ + Standard_Integer iType; + NMTDS_ListOfPassKeyBoolean* pL; + // + pL=(NMTDS_ListOfPassKeyBoolean*)&myList; + pL->Clear(); + // + iType=TypeToInteger(aType); + if (iType>-1 && iTypeAppend(aPKB); + } + } + return myList; +} +//======================================================================= +//function : Get +//purpose : +//======================================================================= + const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const Standard_Integer aInd, + const NMTDS_InterfType aType)const +{ + Standard_Integer n1, n2; + NMTDS_ListOfPassKeyBoolean *pL, aLPKB; + NMTDS_ListIteratorOfListOfPassKeyBoolean aIt; + // + aLPKB=Get(aType); + // + pL=(NMTDS_ListOfPassKeyBoolean*)&myList; + pL->Clear(); + // + aIt.Initialize (aLPKB); + for (; aIt.More(); aIt.Next()) { + const NMTDS_PassKeyBoolean& aPKB=aIt.Value(); + aPKB.Ids(n1, n2); + if(n1==aInd || n2==aInd) { + pL->Append(aPKB); + } + } + return myList; +} +//////////////////// +//=========================================================================== +//function : SSInterferences +//purpose : +//=========================================================================== + BOPTools_CArray1OfSSInterference& NMTDS_InterfPool::SSInterferences() +{ + return mySSInterferences; +} +//=========================================================================== +//function : ESInterferences +//purpose : +//=========================================================================== + BOPTools_CArray1OfESInterference& NMTDS_InterfPool::ESInterferences() +{ + return myESInterferences; +} +//=========================================================================== +//function : VSInterferences +//purpose : +//=========================================================================== + BOPTools_CArray1OfVSInterference& NMTDS_InterfPool::VSInterferences() +{ + return myVSInterferences; +} +//=========================================================================== +//function : EEInterferences +//purpose : +//=========================================================================== + BOPTools_CArray1OfEEInterference& NMTDS_InterfPool::EEInterferences() +{ + return myEEInterferences; +} +//=========================================================================== +//function : VEInterferences +//purpose : +//=========================================================================== + BOPTools_CArray1OfVEInterference& NMTDS_InterfPool::VEInterferences() +{ + return myVEInterferences; +} +//=========================================================================== +//function : VVInterferences +//purpose : +//=========================================================================== + BOPTools_CArray1OfVVInterference& NMTDS_InterfPool::VVInterferences() +{ + return myVVInterferences; +} +//////////////////// +//======================================================================= +//function : TypeToInteger +//purpose : +//======================================================================= +Standard_Integer TypeToInteger(const NMTDS_InterfType aType) +{ + return (Standard_Integer)aType; +} diff --git a/src/NMTDS/NMTDS_InterfPool.hxx b/src/NMTDS/NMTDS_InterfPool.hxx new file mode 100644 index 000000000..f0bfd2111 --- /dev/null +++ b/src/NMTDS/NMTDS_InterfPool.hxx @@ -0,0 +1,191 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTDS_InterfPool_HeaderFile +#define _NMTDS_InterfPool_HeaderFile + +#ifndef _NMTDS_MapOfPassKeyBoolean_HeaderFile +#include +#endif +#ifndef _NMTDS_ListOfPassKeyBoolean_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfSSInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfESInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfVSInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfEEInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfVEInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfVVInterference_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +#ifndef _NMTDS_InterfType_HeaderFile +#include +#endif +class NMTDS_PassKeyBoolean; +class NMTDS_ListOfPassKeyBoolean; +class BOPTools_CArray1OfSSInterference; +class BOPTools_CArray1OfESInterference; +class BOPTools_CArray1OfVSInterference; +class BOPTools_CArray1OfEEInterference; +class BOPTools_CArray1OfVEInterference; +class BOPTools_CArray1OfVVInterference; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTDS_InterfPool { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT NMTDS_InterfPool(); +Standard_EXPORT virtual ~NMTDS_InterfPool(); + + +Standard_EXPORT Standard_Boolean Add(const NMTDS_PassKeyBoolean& aPKB,const NMTDS_InterfType aType) ; + + +Standard_EXPORT Standard_Boolean Add(const Standard_Integer aInd1,const Standard_Integer aInd2,const NMTDS_InterfType aType) ; + + +Standard_EXPORT Standard_Boolean Add(const Standard_Integer aInd1,const Standard_Integer aInd2,const Standard_Boolean bFlag,const NMTDS_InterfType aType) ; + + +Standard_EXPORT Standard_Boolean Contains(const NMTDS_PassKeyBoolean& aPKB) const; + + +Standard_EXPORT Standard_Boolean Contains(const Standard_Integer aInd1,const Standard_Integer aInd2) const; + + +Standard_EXPORT const NMTDS_ListOfPassKeyBoolean& Get() const; + + +Standard_EXPORT const NMTDS_ListOfPassKeyBoolean& Get(const NMTDS_InterfType aType) const; + + +Standard_EXPORT const NMTDS_ListOfPassKeyBoolean& Get(const Standard_Integer aInd) const; + + +Standard_EXPORT const NMTDS_ListOfPassKeyBoolean& Get(const Standard_Integer aInd,const NMTDS_InterfType aType) const; + + +//! Returns the reference to array Of F/F interferences
+Standard_EXPORT BOPTools_CArray1OfSSInterference& SSInterferences() ; + + +//! Returns the reference to array Of E/F interferences
+Standard_EXPORT BOPTools_CArray1OfESInterference& ESInterferences() ; + + +//! Returns the reference to array Of V/F interferences
+Standard_EXPORT BOPTools_CArray1OfVSInterference& VSInterferences() ; + + +//! Returns the reference to arrray Of E/E interferences
+Standard_EXPORT BOPTools_CArray1OfEEInterference& EEInterferences() ; + + +//! Returns the reference to arrray Of V/E interferences
+Standard_EXPORT BOPTools_CArray1OfVEInterference& VEInterferences() ; + + +//! Returns the reference to arrray Of V/V interferences
+Standard_EXPORT BOPTools_CArray1OfVVInterference& VVInterferences() ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // +NMTDS_MapOfPassKeyBoolean myTable[6]; +NMTDS_ListOfPassKeyBoolean myList; +Standard_Integer myMaxInd; +BOPTools_CArray1OfSSInterference mySSInterferences; +BOPTools_CArray1OfESInterference myESInterferences; +BOPTools_CArray1OfVSInterference myVSInterferences; +BOPTools_CArray1OfEEInterference myEEInterferences; +BOPTools_CArray1OfVEInterference myVEInterferences; +BOPTools_CArray1OfVVInterference myVVInterferences; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_InterfPool.ixx b/src/NMTDS/NMTDS_InterfPool.ixx new file mode 100644 index 000000000..c608b6885 --- /dev/null +++ b/src/NMTDS/NMTDS_InterfPool.ixx @@ -0,0 +1,24 @@ +// Copyright (C) 2005 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. +// +// 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 + + + + diff --git a/src/NMTDS/NMTDS_InterfPool.jxx b/src/NMTDS/NMTDS_InterfPool.jxx new file mode 100644 index 000000000..f12d52951 --- /dev/null +++ b/src/NMTDS/NMTDS_InterfPool.jxx @@ -0,0 +1,46 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTDS_PassKeyBoolean_HeaderFile +#include +#endif +#ifndef _NMTDS_ListOfPassKeyBoolean_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfSSInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfESInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfVSInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfEEInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfVEInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfVVInterference_HeaderFile +#include +#endif +#ifndef _NMTDS_InterfPool_HeaderFile +#include +#endif diff --git a/src/NMTDS/NMTDS_InterfType.hxx b/src/NMTDS/NMTDS_InterfType.hxx new file mode 100644 index 000000000..d32f9835b --- /dev/null +++ b/src/NMTDS/NMTDS_InterfType.hxx @@ -0,0 +1,39 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTDS_InterfType_HeaderFile +#define _NMTDS_InterfType_HeaderFile + + +enum NMTDS_InterfType { + NMTDS_TI_VV, +NMTDS_TI_VE, +NMTDS_TI_VF, +NMTDS_TI_EE, +NMTDS_TI_EF, +NMTDS_TI_FF, +NMTDS_TI_UNKNOWN +}; + + +#ifndef _Standard_PrimitiveTypes_HeaderFile +#include +#endif + +#endif diff --git a/src/NMTDS/NMTDS_Iterator.cdl b/src/NMTDS/NMTDS_Iterator.cdl index 05a026a73..d73a1d5d3 100755 --- a/src/NMTDS/NMTDS_Iterator.cdl +++ b/src/NMTDS/NMTDS_Iterator.cdl @@ -24,7 +24,7 @@ class Iterator from NMTDS - + ---Purpose: uses @@ -33,7 +33,9 @@ uses ShapesDataStructure from NMTDS, PShapesDataStructure from NMTDS, ListOfPassKeyBoolean from NMTDS, - ListIteratorOfListOfPassKeyBoolean from NMTDS + ListIteratorOfListOfPassKeyBoolean from NMTDS, + PassKeyBoolean from NMTDS + --raises is @@ -61,18 +63,28 @@ is aIndex2:out Integer from Standard; aWithSubShape: out Boolean from Standard); - Prepare(me:out); - + Prepare(me:out) + is virtual; + + Intersect(me:out) + is virtual protected; + ExpectedLength(me) returns Integer from Standard; + BlockLength(me) + returns Integer from Standard; + SDVertices(me) returns DataMapOfIntegerListOfInteger from TColStd; - ---C++:return const & - + ---C++:return const & + + FillMVSD(myclass; + aMVSD1:DataMapOfIntegerListOfInteger from TColStd; + aMVSD2:out DataMapOfIntegerListOfInteger from TColStd); fields - myPDS :PShapesDataStructure from NMTDS is protected; + myDS :PShapesDataStructure from NMTDS is protected; myLists :ListOfPassKeyBoolean from NMTDS [6] is protected; myIterator :ListIteratorOfListOfPassKeyBoolean from NMTDS is protected; myEmptyList:ListOfPassKeyBoolean from NMTDS is protected; diff --git a/src/NMTDS/NMTDS_Iterator.cxx b/src/NMTDS/NMTDS_Iterator.cxx index d186736c0..8e894d6d4 100755 --- a/src/NMTDS/NMTDS_Iterator.cxx +++ b/src/NMTDS/NMTDS_Iterator.cxx @@ -1,18 +1,17 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// Copyright (C) 2006 SAMTECH +// // 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 +// License as published by the Free Software Foundation; either // version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// +// 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 +// 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 @@ -24,44 +23,35 @@ #include -#include -#include +// #include -#include +// #include -#include #include #include #include -#include -#include -#include -#include -#include -#include -#include #include -#include #include -#include #include #include - +// +#include +#include +#include +// +#include +// #include #include - -static - void ComputeBoxEx(const Standard_Integer aIx, - NMTDS_ShapesDataStructure* pDS, - Bnd_Box& aBoxEx); - -static inline - Standard_Boolean IsValidType(const TopAbs_ShapeEnum aT); - -static - Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType1, - const TopAbs_ShapeEnum aType2); - +#include +#include +#include +#include +#include +#include +#include +#include +#include //======================================================================= //function : NMTDS_Iterator @@ -69,7 +59,7 @@ static //======================================================================= NMTDS_Iterator::NMTDS_Iterator() { - myPDS=NULL; + myDS=NULL; myLength=0; } //======================================================================= @@ -85,7 +75,7 @@ static //======================================================================= void NMTDS_Iterator::SetDS(const NMTDS_PShapesDataStructure& aDS) { - myPDS=aDS; + myDS=aDS; } //======================================================================= // function: DS @@ -93,7 +83,7 @@ static //======================================================================= const NMTDS_ShapesDataStructure& NMTDS_Iterator::DS()const { - return *myPDS; + return *myDS; } //======================================================================= // function: ExpectedLength @@ -104,6 +94,24 @@ static return myLength; } //======================================================================= +// function: BlockLength +// purpose: +//======================================================================= + Standard_Integer NMTDS_Iterator::BlockLength() const +{ + Standard_Integer aNbIIs; + Standard_Real aCfPredict=.5; + + aNbIIs=ExpectedLength(); + + if (aNbIIs<=1) { + return 1; + } + // + aNbIIs=(Standard_Integer) (aCfPredict*(Standard_Real)aNbIIs); + return aNbIIs; +} +//======================================================================= // function: Initialize // purpose: //======================================================================= @@ -112,7 +120,7 @@ static { Standard_Integer iX; // - iX=TypeToInteger(aType1, aType2); + iX=NMTDS_Tools::TypeToInteger(aType1, aType2); if (iX>=0) { myIterator.Initialize(myLists[iX]); myLength=myLists[iX].Extent(); @@ -158,52 +166,62 @@ static { return myMVSD; } - //======================================================================= // function: Prepare // purpose: //======================================================================= void NMTDS_Iterator::Prepare() +{ + Standard_Integer i; + // + myLength=0; + for (i=0; i<6; ++i) { + myLists[i].Clear(); + } + myMVSD.Clear(); + // + if (myDS==NULL){ + return; + } + Intersect(); +} +//======================================================================= +// function: Intersect +// purpose: +//======================================================================= + void NMTDS_Iterator::Intersect() { Standard_Boolean bFlag; - Standard_Integer aNb, i, aNbB, aNbR; + Standard_Integer aNb, i, aNbB, aNbR, iFlag; Standard_Integer i1, i2, aNbSD, iX, j, iDS, jB, iR, k, aNbLV; TColStd_ListIteratorOfListOfInteger aIt; TColStd_DataMapOfIntegerInteger aMII; - TColStd_MapOfInteger aMFence; + //modified by NIZNHY-PKV Mon Jan 22 15:08:00 2007f + //TColStd_MapOfInteger aMFence; + TColStd_DataMapOfIntegerListOfInteger aMVSD; + TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD; + //modified by NIZNHY-PKV Mon Jan 22 10:21:50 2007t TopTools_DataMapOfShapeInteger aMSI; TopAbs_ShapeEnum aTi, aTj; NMTDS_PassKeyBoolean aPKXB; NMTDS_MapOfPassKeyBoolean aMPKXB; NMTDS_IndexedDataMapOfShapeBox aMSB; - Handle(Bnd_HArray1OfBox) aHAB; - Bnd_BoundSortBox aBSB; // NMTDS_BoxBndTreeSelector aSelector; NMTDS_BoxBndTree aBBTree; NCollection_UBTreeFiller aTreeFiller(aBBTree); // - if (myPDS==NULL){ - return; - } - // - myLength=0; - for (i=0; i<6; ++i) { - myLists[i].Clear(); - } - myMVSD.Clear(); - // - const NMTDS_CArray1OfIndexRange& aRanges=myPDS->Ranges(); + const NMTDS_CArray1OfIndexRange& aRanges=myDS->Ranges(); aNbR=aRanges.Extent(); // - aNb=myPDS->NumberOfShapesOfTheObject(); + aNb=myDS->NumberOfShapesOfTheObject(); for (i=1; i<=aNb; ++i) { - const TopoDS_Shape& aS=myPDS->Shape(i); + const TopoDS_Shape& aS=myDS->Shape(i); aTi=aS.ShapeType(); - if (IsValidType(aTi)) { + if (NMTDS_Tools::HasBRep(aTi)) { Bnd_Box aBoxEx; // - ComputeBoxEx(i, myPDS, aBoxEx); + myDS->ComputeBoxEx(i, aBoxEx); aMSI.Bind(aS, i); aMSB.Add(aS, aBoxEx); } @@ -228,9 +246,9 @@ static i1=aR.First(); i2=aR.Last(); for (i=i1; i<=i2; ++i) { - const TopoDS_Shape& aSi=myPDS->Shape(i); + const TopoDS_Shape& aSi=myDS->Shape(i); aTi=aSi.ShapeType(); - if (!IsValidType(aTi)){ + if (!NMTDS_Tools::HasBRep(aTi)){ continue; } const Bnd_Box& aBoxEx=aMSB.FindFromKey(aSi); @@ -257,25 +275,24 @@ static } // aPKXB.SetIds(i, j); + // if (aMPKXB.Add(aPKXB)) { bFlag=Standard_False;// Bounding boxes are intersected - const Bnd_Box& aBoxi=myPDS->GetBoundingBox(i); - const Bnd_Box& aBoxj=myPDS->GetBoundingBox(j); + const Bnd_Box& aBoxi=myDS->GetBoundingBox(i); + const Bnd_Box& aBoxj=myDS->GetBoundingBox(j); if (aBoxi.IsOut(aBoxj)) { bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected } - const TopoDS_Shape& aSj=myPDS->Shape(j); + const TopoDS_Shape& aSj=myDS->Shape(j); aTj=aSj.ShapeType(); - iX=TypeToInteger(aTi, aTj); - + iX=NMTDS_Tools::TypeToInteger(aTi, aTj); + //bFlag=(iStatus==2); aPKXB.SetFlag(bFlag); myLists[iX].Append(aPKXB); // // VSD prepare if (iX==5) { //VV - if (aMFence.Add(j)) { - aLV.Append(j); - } + aLV.Append(j); } }// if (aMPKXB.Add(aPKXB)) { }// for (; aIt.More(); aIt.Next()) { @@ -283,112 +300,154 @@ static // VSD treatment aNbLV=aLV.Extent(); if (aNbLV) { - myMVSD.Bind(i, aLV); + TColStd_ListOfInteger aLV1; + // + const TopoDS_Vertex& aVi=TopoDS::Vertex(aSi); + aIt.Initialize(aLV); + for (; aIt.More(); aIt.Next()) { + j=aIt.Value(); + const TopoDS_Shape& aSj=myDS->Shape(j); + const TopoDS_Vertex& aVj=TopoDS::Vertex(aSj); + iFlag=NMTDS_Tools::ComputeVV(aVi, aVj); + if (!iFlag) { + aLV1.Append(j); + } + else { + aPKXB.SetIds(i, j); + aMPKXB.Remove(aPKXB); + } + } + aMVSD.Bind(i, aLV1); } }//for (i=i1; i<=i2; ++i) { }//for (iR=1; iRGetBoundingBox(aIx); - aBoxEx.Add(aBox); // - aNbS=pDS->NumberOfSuccessors(aIx); - for (i=1; i<=aNbS; ++i) { - Bnd_Box aBoxS; - iS=pDS->GetSuccessor(aIx, i); - ComputeBoxEx(iS, pDS, aBoxS); - aBoxEx.Add(aBoxS); - } + // Chains + //================= + myMVSD.Clear(); + NMTDS_Iterator::FillMVSD(aMVSD, myMVSD); } - //======================================================================= -// function: TypeToInteger -// purpose: +//function : FillMVSD +//purpose : //======================================================================= -Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType1, - const TopAbs_ShapeEnum aType2) + void NMTDS_Iterator::FillMVSD(const TColStd_DataMapOfIntegerListOfInteger& aMVSD, + TColStd_DataMapOfIntegerListOfInteger& bMVSD) { - Standard_Integer iRet, iT1, iT2, iX; - // - iRet=-1; - iT1=(Standard_Integer)aType1; - iT2=(Standard_Integer)aType2; + Standard_Boolean bFound; + Standard_Integer aNbVSD, iCnt, i, j, k; + TColStd_ListOfInteger aLV; + TColStd_ListIteratorOfListOfInteger aIt; + TColStd_MapOfInteger aMF; + TColStd_MapIteratorOfMapOfInteger aItMI; + TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD; + NMTDS_DataMapOfIntegerMapOfInteger aDMIMI; + NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger aIti, aItj; // - iX=iT2*10+iT1; - switch (iX) { - case 77: - iRet=5; // VV - break; - case 76: - case 67: - iRet=4; // VE - break; - case 74: - case 47: - iRet=2; // VF - break; - case 66: - iRet=3; // EE - break; - case 64: - case 46: - iRet=1; // EF - break; - case 44: - iRet=0; // FF - break; - default: - break; + aNbVSD=aMVSD.Extent(); + if (!aNbVSD) { + return; } - return iRet; -} - -/* -// - // check - TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aIt1; - TColStd_DataMapIteratorOfDataMapOfIntegerInteger aIt2; // - printf(" \n"); - printf(" aMVLV.Extent()=%d\n", aMVLV.Extent()); - aIt1.Initialize(aMVLV); - for (; aIt1.More(); aIt1.Next()) { - i=aIt1.Key(); - printf(" i=%d (", i); - const TColStd_ListOfInteger& aLV=aIt1.Value(); - aIt.Initialize(aLV); + aItVSD.Initialize(aMVSD); + for (; aItVSD.More(); aItVSD.Next()) { + TColStd_MapOfInteger aMI; + // + i=aItVSD.Key(); + aMI.Add(i); + const TColStd_ListOfInteger& aLVSD=aItVSD.Value(); + aIt.Initialize(aLVSD); for (; aIt.More(); aIt.Next()) { j=aIt.Value(); - printf(" %d", j); + aMI.Add(j); } - printf(")\n"); + aDMIMI.Bind(i, aMI); } - // - printf(" \n"); - printf(" aMVV.Extent()=%d\n", aMVV.Extent()); - aIt2.Initialize(aMVV); - for (; aIt2.More(); aIt2.Next()) { - i=aIt2.Key(); - j=aIt2.Value(); - printf(" (%d, %d)\n", i, j); + // i + aIti.Initialize(aDMIMI); + for (; aIti.More(); aIti.Next()) { + i=aIti.Key(); + if (aMF.Contains(i)) { + continue; + } + aMF.Add(i); + // + //TColStd_MapOfInteger& aMIi=aDMIMI.ChangeFind(i); + TColStd_MapOfInteger *pMIi=(TColStd_MapOfInteger *)&aIti.Value(); + TColStd_MapOfInteger& aMIi=*pMIi; + // j + while (1) { + iCnt=0; + aItj.Initialize(aDMIMI); + for (; aItj.More(); aItj.Next()) { + j=aItj.Key(); + if (aMF.Contains(j)) { + continue; + } + // + //TColStd_MapOfInteger& aMIj=aDMIMI.ChangeFind(j); + TColStd_MapOfInteger *pMj=(TColStd_MapOfInteger *)&aItj.Value(); + TColStd_MapOfInteger& aMIj=*pMj; + // + aItMI.Initialize(aMIj); + for (; aItMI.More(); aItMI.Next()) { + k=aItMI.Key(); + bFound=aMIi.Contains(k); + if (bFound) { + break; + } + } + if (!bFound) { + continue; + } + // + aItMI.Initialize(aMIj); + for (; aItMI.More(); aItMI.Next()) { + k=aItMI.Key(); + aMIi.Add(k); + } + // + if (aMF.Add(j)) { + ++iCnt; + } + } //for (; aItj.More(); aItj.Next()) { + if (!iCnt) { + break; + } + } // while (1) { + // + aLV.Clear(); + aItMI.Initialize(aMIi); + for (; aItMI.More(); aItMI.Next()) { + k=aItMI.Key(); + if (k!=i) { + aLV.Append(k); + } + } + bMVSD.Bind(i, aLV); + }// for (; aIti.More(); aIti.Next()) { +} + + /* + { + // check + TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItX; + // + printf(" \n"); + printf(" myMVSD.Extent()=%d\n", myMVSD.Extent()); + aItX.Initialize(myMVSD); + for (; aItX.More(); aItX.Next()) { + i=aItX.Key(); + printf(" i=%d (", i); + const TColStd_ListOfInteger& aLV=aItX.Value(); + aIt.Initialize(aLV); + for (; aIt.More(); aIt.Next()) { + j=aIt.Value(); + printf(" %d", j); + } + printf(")\n"); + } } - printf("\n"); */ + diff --git a/src/NMTDS/NMTDS_Iterator.hxx b/src/NMTDS/NMTDS_Iterator.hxx index d2d260ccd..25ae15ec0 100644 --- a/src/NMTDS/NMTDS_Iterator.hxx +++ b/src/NMTDS/NMTDS_Iterator.hxx @@ -95,15 +95,21 @@ Standard_EXPORT void Next() ; Standard_EXPORT void Current(Standard_Integer& aIndex1,Standard_Integer& aIndex2,Standard_Boolean& aWithSubShape) const; -Standard_EXPORT void Prepare() ; +Standard_EXPORT virtual void Prepare() ; Standard_EXPORT Standard_Integer ExpectedLength() const; +Standard_EXPORT Standard_Integer BlockLength() const; + + Standard_EXPORT const TColStd_DataMapOfIntegerListOfInteger& SDVertices() const; +Standard_EXPORT static void FillMVSD(const TColStd_DataMapOfIntegerListOfInteger& aMVSD1,TColStd_DataMapOfIntegerListOfInteger& aMVSD2) ; + + @@ -113,9 +119,12 @@ protected: // +Standard_EXPORT virtual void Intersect() ; + + // Fields PROTECTED // -NMTDS_PShapesDataStructure myPDS; +NMTDS_PShapesDataStructure myDS; NMTDS_ListOfPassKeyBoolean myLists[6]; NMTDS_ListIteratorOfListOfPassKeyBoolean myIterator; NMTDS_ListOfPassKeyBoolean myEmptyList; diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.cdl b/src/NMTDS/NMTDS_IteratorCheckerSI.cdl new file mode 100644 index 000000000..c7f765003 --- /dev/null +++ b/src/NMTDS/NMTDS_IteratorCheckerSI.cdl @@ -0,0 +1,41 @@ +-- Copyright (C) 2007 SAMTECH +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- +-- File: NMTDS_IteratorCheckerSI.cdl +-- Created: Tue Feb 6 10:18:27 2007 +-- Author: Peter KURNEV + + +class IteratorCheckerSI from NMTDS + inherits Iterator from NMTDS + + ---Purpose: + +--uses +--raises + +is + Create + returns IteratorCheckerSI from NMTDS; + ---C++: alias "Standard_EXPORT virtual ~NMTDS_IteratorCheckerSI();" + + Intersect(me:out) + is redefined protected; + +--fields +end IteratorCheckerSI; diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.cxx b/src/NMTDS/NMTDS_IteratorCheckerSI.cxx new file mode 100644 index 000000000..da2290b93 --- /dev/null +++ b/src/NMTDS/NMTDS_IteratorCheckerSI.cxx @@ -0,0 +1,225 @@ +// Copyright (C) 2007 SAMTECH +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: NMTDS_IteratorChecker.cxx +// Created: Tue Feb 6 10:37:59 2007 +// Author: Peter KURNEV + + +#include + +#include +#include +#include +// +#include +#include +#include +#include +// +#include +#include +#include +#include +#include +#include +#include +#include +// +#include +// +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTDS_IteratorCheckerSI::NMTDS_IteratorCheckerSI() +: + NMTDS_Iterator() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + NMTDS_IteratorCheckerSI::~NMTDS_IteratorCheckerSI() +{ +} +//======================================================================= +// function: Intersect +// purpose: +//======================================================================= + void NMTDS_IteratorCheckerSI::Intersect() +{ + Standard_Boolean bFlag; + Standard_Integer aNbS, i, aNbA, aNbB, iFlag; + Standard_Integer aNbSD, iX, j, iDS, jB, k, aNbLV; + TColStd_ListIteratorOfListOfInteger aIt; + TColStd_DataMapOfIntegerInteger aMII; + TColStd_DataMapOfIntegerListOfInteger aMVSD; + TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD; + TopTools_DataMapOfShapeInteger aMSI; + TopAbs_ShapeEnum aTi, aTj; + NMTDS_PassKeyBoolean aPKXB; + NMTDS_MapOfPassKeyBoolean aMPKXB; + NMTDS_IndexedDataMapOfShapeBox aMSB; + NMTDS_MapOfPassKeyBoolean aMPA;//myPairsAvoid + // + NMTDS_BoxBndTreeSelector aSelector; + NMTDS_BoxBndTree aBBTree; + NCollection_UBTreeFiller aTreeFiller(aBBTree); + // + aNbS=myDS->NumberOfShapesOfTheObject(); + // + // myPairsAvoid, aMSI, aMSB + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aSi=myDS->Shape(i); + aTi=aSi.ShapeType(); + if (NMTDS_Tools::HasBRep(aTi)) { + if (aTi!=TopAbs_VERTEX) { + TColStd_IndexedMapOfInteger aMA; + // + myDS->GetAllSuccessors(i, aMA); + // + aNbA=aMA.Extent(); + for (j=1; j<=aNbA; ++j) { + iX=aMA(j); + aPKXB.Clear(); + aPKXB.SetIds(i, iX); + aMPA.Add(aPKXB); + } + } + else { + aPKXB.Clear(); + aPKXB.SetIds(i, i); + aMPA.Add(aPKXB); + } + // + Bnd_Box aBoxEx; + // + myDS->ComputeBoxEx(i, aBoxEx); + aMSI.Bind(aSi, i); + aMSB.Add(aSi, aBoxEx); + } + } + // + // aMII + aNbB=aMSB.Extent(); + for (i=1; i<=aNbB; ++i) { + const TopoDS_Shape& aS=aMSB.FindKey(i); + const Bnd_Box& aBoxEx=aMSB(i); + // + aTreeFiller.Add(i, aBoxEx); + // + iDS=aMSI.Find(aS); + aMII.Bind(i, iDS); + } + // + aTreeFiller.Fill(); + // + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aSi=myDS->Shape(i); + aTi=aSi.ShapeType(); + if (!NMTDS_Tools::HasBRep(aTi)){ + continue; + } + const Bnd_Box& aBoxEx=aMSB.FindFromKey(aSi); + aSelector.Clear(); + aSelector.SetBox(aBoxEx); + // + aNbSD=aBBTree.Select(aSelector); + if (!aNbSD){ + continue; + } + // + const TColStd_ListOfInteger& aLI=aSelector.Indices(); + // + k=0; + TColStd_ListOfInteger aLV; + // + aIt.Initialize(aLI); + for (; aIt.More(); aIt.Next()) { + jB=aIt.Value(); // box index in MII + j=aMII.Find(jB); // DS index + // + aPKXB.SetIds(i, j); + if (aMPA.Contains(aPKXB)) { + continue; + } + // + if (aMPKXB.Add(aPKXB)) { + bFlag=Standard_False;// Bounding boxes are intersected + const Bnd_Box& aBoxi=myDS->GetBoundingBox(i); + const Bnd_Box& aBoxj=myDS->GetBoundingBox(j); + if (aBoxi.IsOut(aBoxj)) { + bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected + } + const TopoDS_Shape& aSj=myDS->Shape(j); + aTj=aSj.ShapeType(); + iX=NMTDS_Tools::TypeToInteger(aTi, aTj); + //bFlag=(iStatus==2); + aPKXB.SetFlag(bFlag); + myLists[iX].Append(aPKXB); + // + // VSD prepare + if (iX==5) { //VV + aLV.Append(j); + } + }// if (aMPKXB.Add(aPKXB)) { + }// for (; aIt.More(); aIt.Next()) { + // + // VSD treatment + aNbLV=aLV.Extent(); + if (aNbLV) { + TColStd_ListOfInteger aLV1; + // + const TopoDS_Vertex& aVi=TopoDS::Vertex(aSi); + aIt.Initialize(aLV); + for (; aIt.More(); aIt.Next()) { + j=aIt.Value(); + const TopoDS_Shape& aSj=myDS->Shape(j); + const TopoDS_Vertex& aVj=TopoDS::Vertex(aSj); + iFlag=NMTDS_Tools::ComputeVV(aVi, aVj); + if (!iFlag) { + aLV1.Append(j); + } + else { + aPKXB.SetIds(i, j); + aMPKXB.Remove(aPKXB); + } + } + aMVSD.Bind(i, aLV1); + } + }//for (i=1; i<=aNbS; ++i) { + // + // + // 2. Chains + //================= + myMVSD.Clear(); + NMTDS_Iterator::FillMVSD(aMVSD, myMVSD); +} + diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.hxx b/src/NMTDS/NMTDS_IteratorCheckerSI.hxx new file mode 100644 index 000000000..f11a9c1c2 --- /dev/null +++ b/src/NMTDS/NMTDS_IteratorCheckerSI.hxx @@ -0,0 +1,96 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTDS_IteratorCheckerSI_HeaderFile +#define _NMTDS_IteratorCheckerSI_HeaderFile + +#ifndef _NMTDS_Iterator_HeaderFile +#include +#endif + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTDS_IteratorCheckerSI : public NMTDS_Iterator { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT NMTDS_IteratorCheckerSI(); +Standard_EXPORT virtual ~NMTDS_IteratorCheckerSI(); + + + + + +protected: + + // Methods PROTECTED + // + + +Standard_EXPORT virtual void Intersect() ; + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.ixx b/src/NMTDS/NMTDS_IteratorCheckerSI.ixx new file mode 100644 index 000000000..6346ab519 --- /dev/null +++ b/src/NMTDS/NMTDS_IteratorCheckerSI.ixx @@ -0,0 +1,24 @@ +// Copyright (C) 2005 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. +// +// 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 + + + + diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.jxx b/src/NMTDS/NMTDS_IteratorCheckerSI.jxx new file mode 100644 index 000000000..dc6afc1b7 --- /dev/null +++ b/src/NMTDS/NMTDS_IteratorCheckerSI.jxx @@ -0,0 +1,22 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTDS_IteratorCheckerSI_HeaderFile +#include +#endif diff --git a/src/NMTDS/NMTDS_PInterfPool.hxx b/src/NMTDS/NMTDS_PInterfPool.hxx new file mode 100644 index 000000000..7084ba333 --- /dev/null +++ b/src/NMTDS/NMTDS_PInterfPool.hxx @@ -0,0 +1,27 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTDS_PInterfPool_HeaderFile +#define _NMTDS_PInterfPool_HeaderFile + +class NMTDS_InterfPool; + +typedef NMTDS_InterfPool* NMTDS_PInterfPool; + +#endif diff --git a/src/NMTDS/NMTDS_PIterator.hxx b/src/NMTDS/NMTDS_PIterator.hxx new file mode 100644 index 000000000..8cefa5bb5 --- /dev/null +++ b/src/NMTDS/NMTDS_PIterator.hxx @@ -0,0 +1,27 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTDS_PIterator_HeaderFile +#define _NMTDS_PIterator_HeaderFile + +class NMTDS_Iterator; + +typedef NMTDS_Iterator* NMTDS_PIterator; + +#endif diff --git a/src/NMTDS/NMTDS_PassKey.cdl b/src/NMTDS/NMTDS_PassKey.cdl index e9a637a46..905a8d62a 100755 --- a/src/NMTDS/NMTDS_PassKey.cdl +++ b/src/NMTDS/NMTDS_PassKey.cdl @@ -1,4 +1,5 @@ --- Copyright (C) 2006 SAMTECH +-- Copyright (C) 2005 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 @@ -14,67 +15,83 @@ -- 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 +-- See http:--www.salome-platform.org/ or email : webmaster.salome@opencascade.com -- -- File: NMTDS_PassKey.cdl --- Created: +-- Created: Mon Nov 20 12:16:13 2006 -- Author: Peter KURNEV -- + class PassKey from NMTDS ---Purpose: uses Shape from TopoDS, - ListOfInteger from TColStd - + IndexedMapOfInteger from TColStd, + ListOfInteger from TColStd + --raises is Create returns PassKey from NMTDS; - - Assign(me:out; - Other : PassKey from NMTDS) - returns PassKey from NMTDS; - ---C++: alias operator = - ---C++: return & --- + ---C++: alias "Standard_EXPORT virtual ~NMTDS_PassKey();" + + Create(Other:PassKey from NMTDS) + returns PassKey from NMTDS; + ---C++: alias "Standard_EXPORT NMTDS_PassKey& operator =(const NMTDS_PassKey& Other);" + + Clear(me:out); + SetIds(me:out; - aI1 :Integer from Standard; + aI1 :Integer from Standard); + + SetIds(me:out; + aI1 :Integer from Standard; aI2 :Integer from Standard); - NbMax(me) - returns Integer from Standard; - - Clear(me:out); + SetIds(me:out; + aI1 :Integer from Standard; + aI2 :Integer from Standard; + aI3 :Integer from Standard); + + SetIds(me:out; + aI1 :Integer from Standard; + aI2 :Integer from Standard; + aI3 :Integer from Standard; + aI4 :Integer from Standard); - Compute(me:out); + SetIds(me:out; + aLS :ListOfInteger from TColStd); + + NbIds(me) + returns Integer from Standard; IsEqual(me; aOther:PassKey from NMTDS) returns Boolean from Standard; - - Key(me) - returns Address from Standard; HashCode(me; Upper : Integer from Standard) returns Integer from Standard; - + Id(me; + aIndex: Integer from Standard) + returns Integer from Standard; + Ids(me; aI1 :out Integer from Standard; aI2 :out Integer from Standard); - - Dump(me); + Dump(me; + aHex:Integer from Standard=0); + + fields - myNbIds: Integer from Standard is protected; - myNbMax: Integer from Standard is protected; - mySum : Integer from Standard is protected; - myIds : Integer from Standard [2] is protected; + mySum : Integer from Standard is protected; + myMap : IndexedMapOfInteger from TColStd is protected; end PassKey; diff --git a/src/NMTDS/NMTDS_PassKey.cxx b/src/NMTDS/NMTDS_PassKey.cxx index 910400cd6..2d2d52ea0 100755 --- a/src/NMTDS/NMTDS_PassKey.cxx +++ b/src/NMTDS/NMTDS_PassKey.cxx @@ -1,4 +1,5 @@ -// Copyright (C) 2006 SAMTECH +// Copyright (C) 2005 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 @@ -16,10 +17,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTDS_PassKey.cxx -// Created: +// +// File: NMTDS_Algo.cxx +// Created: Sat Dec 04 12:39:47 2004 // Author: Peter KURNEV -// +// #include @@ -27,13 +29,12 @@ #include #include #include +#include #ifdef WNT #pragma warning( disable : 4101) #endif -static - void SortShell(const int n, int* a); static Standard_Integer NormalizedId(const Standard_Integer aId, const Standard_Integer aDiv); @@ -44,129 +45,197 @@ static //======================================================================= NMTDS_PassKey::NMTDS_PassKey() { - Clear(); + Clear(); +} +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTDS_PassKey::NMTDS_PassKey(const NMTDS_PassKey& aOther) +{ + myNbIds=aOther.myNbIds; + mySum=aOther.mySum; + myMap=aOther.myMap; } //======================================================================= -//function :Assign +//function :operator = //purpose : //======================================================================= - NMTDS_PassKey& NMTDS_PassKey::Assign(const NMTDS_PassKey& anOther) + NMTDS_PassKey& NMTDS_PassKey::operator =(const NMTDS_PassKey& aOther) { - myNbIds=anOther.myNbIds; - myNbMax=anOther.myNbMax; - mySum=anOther.mySum; - memcpy(myIds, anOther.myIds, sizeof(myIds)); + myNbIds=aOther.myNbIds; + mySum=aOther.mySum; + myMap=aOther.myMap; return *this; } //======================================================================= +//function :~ +//purpose : +//======================================================================= + NMTDS_PassKey::~NMTDS_PassKey() +{ +} +//======================================================================= //function :Clear //purpose : //======================================================================= void NMTDS_PassKey::Clear() { - Standard_Integer i; - // myNbIds=0; - myNbMax=2; mySum=0; - for (i=0; imyNbIds) { + return -1; + } + return myMap(aIndex); } //======================================================================= -//function :IsEqual +//function :Ids //purpose : //======================================================================= - Standard_Boolean NMTDS_PassKey::IsEqual(const NMTDS_PassKey& anOther) const + void NMTDS_PassKey::Ids(Standard_Integer& aId1, + Standard_Integer& aId2) const { - Standard_Integer iIsEqual; - Standard_Boolean bIsEqual; - // - iIsEqual=memcmp(myIds, anOther.myIds, sizeof(myIds)); - bIsEqual=Standard_False; - if (!iIsEqual) { - bIsEqual=!bIsEqual; + aId1=0; + aId2=0; + if (myNbIds>1) { + aId1=myMap(1); + aId2=myMap(2); } - return bIsEqual; } //======================================================================= -//function :Key +//function :IsEqual //purpose : //======================================================================= - Standard_Address NMTDS_PassKey::Key()const + Standard_Boolean NMTDS_PassKey::IsEqual(const NMTDS_PassKey& aOther) const { - return (Standard_Address)myIds; + Standard_Boolean bRet; + Standard_Integer i, aId; + // + bRet=Standard_False; + // + if (myNbIds!=aOther.myNbIds) { + return bRet; + } + for (i=1; i<=myNbIds; ++i) { + aId=myMap(i); + if (!aOther.myMap.Contains(aId)) { + return bRet; + } + } + return !bRet; } //======================================================================= //function : HashCode //purpose : //======================================================================= - Standard_Integer NMTDS_PassKey::HashCode(const Standard_Integer Upper) const + Standard_Integer NMTDS_PassKey::HashCode(const Standard_Integer aUpper) const { - return ::HashCode(mySum, Upper); + return ::HashCode(mySum, aUpper); } //======================================================================= //function : Dump //purpose : //======================================================================= - void NMTDS_PassKey::Dump()const + void NMTDS_PassKey::Dump(const Standard_Integer )const { - Standard_Integer i; - // - printf(" PassKey: {"); - for (i=0; i -1) goto m30; - }//if (a[l] < a[j]){ - }//for (i=0; i #endif +#ifndef _TColStd_IndexedMapOfInteger_HeaderFile +#include +#endif #ifndef _Standard_Boolean_HeaderFile #include #endif -#ifndef _Standard_Address_HeaderFile -#include -#endif +class TColStd_ListOfInteger; #ifndef _Standard_HeaderFile @@ -60,41 +61,47 @@ public: Standard_EXPORT NMTDS_PassKey(); +Standard_EXPORT virtual ~NMTDS_PassKey(); + +Standard_EXPORT NMTDS_PassKey(const NMTDS_PassKey& Other); +Standard_EXPORT NMTDS_PassKey& operator =(const NMTDS_PassKey& Other); + + +Standard_EXPORT void Clear() ; -Standard_EXPORT NMTDS_PassKey& Assign(const NMTDS_PassKey& Other) ; - NMTDS_PassKey& operator =(const NMTDS_PassKey& Other) -{ - return Assign(Other); -} +Standard_EXPORT void SetIds(const Standard_Integer aI1) ; Standard_EXPORT void SetIds(const Standard_Integer aI1,const Standard_Integer aI2) ; -Standard_EXPORT Standard_Integer NbMax() const; +Standard_EXPORT void SetIds(const Standard_Integer aI1,const Standard_Integer aI2,const Standard_Integer aI3) ; -Standard_EXPORT void Clear() ; +Standard_EXPORT void SetIds(const Standard_Integer aI1,const Standard_Integer aI2,const Standard_Integer aI3,const Standard_Integer aI4) ; -Standard_EXPORT void Compute() ; +Standard_EXPORT void SetIds(const TColStd_ListOfInteger& aLS) ; -Standard_EXPORT Standard_Boolean IsEqual(const NMTDS_PassKey& aOther) const; +Standard_EXPORT Standard_Integer NbIds() const; -Standard_EXPORT Standard_Address Key() const; +Standard_EXPORT Standard_Boolean IsEqual(const NMTDS_PassKey& aOther) const; Standard_EXPORT Standard_Integer HashCode(const Standard_Integer Upper) const; +Standard_EXPORT Standard_Integer Id(const Standard_Integer aIndex) const; + + Standard_EXPORT void Ids(Standard_Integer& aI1,Standard_Integer& aI2) const; -Standard_EXPORT void Dump() const; +Standard_EXPORT void Dump(const Standard_Integer aHex = 0) const; @@ -109,9 +116,8 @@ protected: // Fields PROTECTED // Standard_Integer myNbIds; -Standard_Integer myNbMax; Standard_Integer mySum; -Standard_Integer myIds[2]; +TColStd_IndexedMapOfInteger myMap; private: diff --git a/src/NMTDS/NMTDS_PassKey.jxx b/src/NMTDS/NMTDS_PassKey.jxx index 02ef906d3..ba0d04dd1 100644 --- a/src/NMTDS/NMTDS_PassKey.jxx +++ b/src/NMTDS/NMTDS_PassKey.jxx @@ -17,6 +17,9 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +#ifndef _TColStd_ListOfInteger_HeaderFile +#include +#endif #ifndef _NMTDS_PassKey_HeaderFile #include #endif diff --git a/src/NMTDS/NMTDS_PassKeyBoolean.cdl b/src/NMTDS/NMTDS_PassKeyBoolean.cdl index 2ad7871a0..c34a3244a 100755 --- a/src/NMTDS/NMTDS_PassKeyBoolean.cdl +++ b/src/NMTDS/NMTDS_PassKeyBoolean.cdl @@ -36,21 +36,16 @@ uses is Create returns PassKeyBoolean from NMTDS; - - Assign(me:out; - Other : PassKeyBoolean from NMTDS) - returns PassKeyBoolean from NMTDS; - ---C++: alias operator = - ---C++: return & --- + ---C++: alias "Standard_EXPORT virtual ~NMTDS_PassKeyBoolean();" + SetFlag(me:out; aFlag: Boolean from Standard); - + ---C++: alias " Standard_EXPORT NMTDS_PassKeyBoolean& operator =(const NMTDS_PassKeyBoolean& Other);" + Flag(me) returns Boolean from Standard; fields - myFlag: Boolean from Standard is protected; end PassKeyBoolean; diff --git a/src/NMTDS/NMTDS_PassKeyBoolean.cxx b/src/NMTDS/NMTDS_PassKeyBoolean.cxx index 11f90ee79..059751fe2 100755 --- a/src/NMTDS/NMTDS_PassKeyBoolean.cxx +++ b/src/NMTDS/NMTDS_PassKeyBoolean.cxx @@ -25,7 +25,7 @@ #include //======================================================================= -//function : NMTDS_PassKeyBoolean +//function : //purpose : //======================================================================= NMTDS_PassKeyBoolean::NMTDS_PassKeyBoolean() @@ -35,13 +35,20 @@ { } //======================================================================= -//function :Assign +//function : ~ //purpose : //======================================================================= - NMTDS_PassKeyBoolean& NMTDS_PassKeyBoolean::Assign(const NMTDS_PassKeyBoolean& anOther) + NMTDS_PassKeyBoolean::~NMTDS_PassKeyBoolean() +{ +} +//======================================================================= +//function :operator = +//purpose : +//======================================================================= + NMTDS_PassKeyBoolean& NMTDS_PassKeyBoolean::operator =(const NMTDS_PassKeyBoolean& anOther) { myFlag=anOther.myFlag; - NMTDS_PassKey::Assign(anOther); + NMTDS_PassKey::operator =(anOther); return *this; } //======================================================================= diff --git a/src/NMTDS/NMTDS_PassKeyBoolean.hxx b/src/NMTDS/NMTDS_PassKeyBoolean.hxx index 0ac2e06b6..604cfa30b 100644 --- a/src/NMTDS/NMTDS_PassKeyBoolean.hxx +++ b/src/NMTDS/NMTDS_PassKeyBoolean.hxx @@ -57,17 +57,11 @@ public: Standard_EXPORT NMTDS_PassKeyBoolean(); - - -Standard_EXPORT NMTDS_PassKeyBoolean& Assign(const NMTDS_PassKeyBoolean& Other) ; - NMTDS_PassKeyBoolean& operator =(const NMTDS_PassKeyBoolean& Other) -{ - return Assign(Other); -} - +Standard_EXPORT virtual ~NMTDS_PassKeyBoolean(); Standard_EXPORT void SetFlag(const Standard_Boolean aFlag) ; + Standard_EXPORT NMTDS_PassKeyBoolean& operator =(const NMTDS_PassKeyBoolean& Other); Standard_EXPORT Standard_Boolean Flag() const; diff --git a/src/NMTDS/NMTDS_PassKeyMapHasher.cdl b/src/NMTDS/NMTDS_PassKeyMapHasher.cdl index ae537d787..de75ce8f9 100755 --- a/src/NMTDS/NMTDS_PassKeyMapHasher.cdl +++ b/src/NMTDS/NMTDS_PassKeyMapHasher.cdl @@ -1,4 +1,5 @@ --- Copyright (C) 2006 SAMTECH +-- Copyright (C) 2005 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 @@ -14,8 +15,8 @@ -- 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 --- +-- See http:--www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- -- File: NMTDS_PassKeyMapHasher.cdl -- Created: -- Author: Peter KURNEV diff --git a/src/NMTDS/NMTDS_PassKeyMapHasher.cxx b/src/NMTDS/NMTDS_PassKeyMapHasher.cxx index 09e4ad047..ac7910947 100755 --- a/src/NMTDS/NMTDS_PassKeyMapHasher.cxx +++ b/src/NMTDS/NMTDS_PassKeyMapHasher.cxx @@ -1,4 +1,5 @@ -// Copyright (C) 2006 SAMTECH +// Copyright (C) 2005 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 @@ -28,17 +29,17 @@ //function : HashCode //purpose : //======================================================================= - Standard_Integer NMTDS_PassKeyMapHasher::HashCode(const NMTDS_PassKey& aPKey, + Standard_Integer NMTDS_PassKeyMapHasher::HashCode(const NMTDS_PassKey& aPK, const Standard_Integer Upper) { - return aPKey.HashCode(Upper); + return aPK.HashCode(Upper); } //======================================================================= //function :IsEqual //purpose : //======================================================================= - Standard_Boolean NMTDS_PassKeyMapHasher::IsEqual(const NMTDS_PassKey& aPKey1, - const NMTDS_PassKey& aPKey2) + Standard_Boolean NMTDS_PassKeyMapHasher::IsEqual(const NMTDS_PassKey& aPK1, + const NMTDS_PassKey& aPK2) { - return aPKey1.IsEqual(aPKey2); + return aPK1.IsEqual(aPK2); } diff --git a/src/NMTDS/NMTDS_PassKeyShape.cdl b/src/NMTDS/NMTDS_PassKeyShape.cdl new file mode 100644 index 000000000..081226594 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShape.cdl @@ -0,0 +1,95 @@ +-- Copyright (C) 2005 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. +-- +-- 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: NMTDS_PassKeyShape.cdl +-- Created: +-- Author: Peter KURNEV +-- + + +class PassKeyShape from NMTDS + + ---Purpose: + +uses + Shape from TopoDS, + ListOfShape from TopTools, + IndexedMapOfShape from TopTools + +--raises + +is + Create + returns PassKeyShape from NMTDS; + ---C++: alias "Standard_EXPORT virtual ~NMTDS_PassKeyShape();" + + Create(Other:PassKeyShape from NMTDS) + returns PassKeyShape from NMTDS; + + Assign(me:out; + Other : PassKeyShape from NMTDS) + returns PassKeyShape from NMTDS; + ---C++: alias operator = + ---C++: return & + + SetShapes(me:out; + aS :Shape from TopoDS); + + SetShapes(me:out; + aS1 :Shape from TopoDS; + aS2 :Shape from TopoDS); + + SetShapes(me:out; + aS1 :Shape from TopoDS; + aS2 :Shape from TopoDS; + aS3 :Shape from TopoDS); + + SetShapes(me:out; + aS1 :Shape from TopoDS; + aS2 :Shape from TopoDS; + aS3 :Shape from TopoDS; + aS4 :Shape from TopoDS); + + SetShapes(me:out; + aLS :ListOfShape from TopTools); + + Clear(me:out); + + + NbIds(me) + returns Integer from Standard; + + IsEqual(me; + aOther:PassKeyShape from NMTDS) + returns Boolean from Standard; + + HashCode(me; + Upper : Integer from Standard) + returns Integer from Standard; + + Dump(me; + aHex:Integer from Standard=0); + +fields + myNbIds:Integer from Standard is protected; + mySum :Integer from Standard is protected; + myUpper:Integer from Standard is protected; + myMap :IndexedMapOfShape from TopTools is protected; + +end PassKeyShape; diff --git a/src/NMTDS/NMTDS_PassKeyShape.cxx b/src/NMTDS/NMTDS_PassKeyShape.cxx new file mode 100644 index 000000000..c4af3a480 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShape.cxx @@ -0,0 +1,227 @@ +// Copyright (C) 2005 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. +// +// 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: NMTDS_PassKeyShape.cxx +// Created: +// Author: Peter KURNEV +// + + +#include + +#include +#include + + +static + Standard_Integer NormalizedId(const Standard_Integer aId, + const Standard_Integer aDiv); +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTDS_PassKeyShape::NMTDS_PassKeyShape() +{ + myUpper=432123; +} +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTDS_PassKeyShape::NMTDS_PassKeyShape(const NMTDS_PassKeyShape& aOther) +{ + myUpper=432123; + myNbIds=aOther.myNbIds; + mySum=aOther.mySum; + myMap=aOther.myMap; +} +//======================================================================= +//function :~ +//purpose : +//======================================================================= + NMTDS_PassKeyShape::~NMTDS_PassKeyShape() +{ +} +//======================================================================= +//function :Assign +//purpose : +//======================================================================= + NMTDS_PassKeyShape& NMTDS_PassKeyShape::Assign(const NMTDS_PassKeyShape& aOther) +{ + myUpper=432123; + myNbIds=aOther.myNbIds; + mySum=aOther.mySum; + myMap=aOther.myMap; + return *this; +} +//======================================================================= +//function :Clear +//purpose : +//======================================================================= + void NMTDS_PassKeyShape::Clear() +{ + myNbIds=0; + mySum=0; + myMap.Clear(); +} +//======================================================================= +//function :SetShapes +//purpose : +//======================================================================= + void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1) + +{ + Standard_Integer aHC; + // + Clear(); + myNbIds=1; + myMap.Add(aS1); + aHC=aS1.HashCode(myUpper); + mySum=NormalizedId(aHC, myNbIds); +} +//======================================================================= +//function :SetShapes +//purpose : +//======================================================================= + void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2) +{ + TopTools_ListOfShape aLS; + // + aLS.Append(aS1); + aLS.Append(aS2); + SetShapes(aLS); +} +//======================================================================= +//function :SetShapes +//purpose : +//======================================================================= + void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3) +{ + TopTools_ListOfShape aLS; + // + aLS.Append(aS1); + aLS.Append(aS2); + aLS.Append(aS3); + SetShapes(aLS); +} +//======================================================================= +//function :SetShapes +//purpose : +//======================================================================= + void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3, + const TopoDS_Shape& aS4) +{ + TopTools_ListOfShape aLS; + // + aLS.Append(aS1); + aLS.Append(aS2); + aLS.Append(aS3); + aLS.Append(aS4); + SetShapes(aLS); +} +//======================================================================= +//function :SetShapes +//purpose : +//======================================================================= + void NMTDS_PassKeyShape::SetShapes(const TopTools_ListOfShape& aLS) +{ + Standard_Integer i, aId, aIdN; + TopTools_ListIteratorOfListOfShape aIt; + // + Clear(); + aIt.Initialize(aLS); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + myMap.Add(aS); + } + myNbIds=myMap.Extent(); + for(i=1; i<=myNbIds; ++i) { + const TopoDS_Shape& aS=myMap(i); + aId=aS.HashCode(myUpper); + aIdN=NormalizedId(aId, myNbIds); + mySum+=aIdN; + } +} +//======================================================================= +//function :NbIds +//purpose : +//======================================================================= + Standard_Integer NMTDS_PassKeyShape::NbIds()const +{ + return myNbIds; +} +//======================================================================= +//function :IsEqual +//purpose : +//======================================================================= + Standard_Boolean NMTDS_PassKeyShape::IsEqual(const NMTDS_PassKeyShape& aOther) const +{ + Standard_Boolean bRet; + Standard_Integer i; + // + bRet=Standard_False; + // + if (myNbIds!=aOther.myNbIds) { + return bRet; + } + for (i=1; i<=myNbIds; ++i) { + const TopoDS_Shape& aS=myMap(i); + if (!aOther.myMap.Contains(aS)) { + return bRet; + } + } + return !bRet; +} +//======================================================================= +//function : HashCode +//purpose : +//======================================================================= + Standard_Integer NMTDS_PassKeyShape::HashCode(const Standard_Integer aUpper) const +{ + return ::HashCode(mySum, aUpper); +} +//======================================================================= +//function : Dump +//purpose : +//======================================================================= + void NMTDS_PassKeyShape::Dump(const Standard_Integer)const +{ +} +//======================================================================= +// function: NormalizedId +// purpose : +//======================================================================= +Standard_Integer NormalizedId(const Standard_Integer aId, + const Standard_Integer aDiv) +{ + Standard_Integer aMax, aTresh, aIdRet; + // + aIdRet=aId; + aMax=::IntegerLast(); + aTresh=aMax/aDiv; + if (aId>aTresh) { + aIdRet=aId%aTresh; + } + return aIdRet; +} diff --git a/src/NMTDS/NMTDS_PassKeyShape.hxx b/src/NMTDS/NMTDS_PassKeyShape.hxx new file mode 100644 index 000000000..81eaa8096 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShape.hxx @@ -0,0 +1,146 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTDS_PassKeyShape_HeaderFile +#define _NMTDS_PassKeyShape_HeaderFile + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _TopTools_IndexedMapOfShape_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class TopoDS_Shape; +class TopTools_ListOfShape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTDS_PassKeyShape { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT NMTDS_PassKeyShape(); +Standard_EXPORT virtual ~NMTDS_PassKeyShape(); + + +Standard_EXPORT NMTDS_PassKeyShape(const NMTDS_PassKeyShape& Other); + + +Standard_EXPORT NMTDS_PassKeyShape& Assign(const NMTDS_PassKeyShape& Other) ; + NMTDS_PassKeyShape& operator =(const NMTDS_PassKeyShape& Other) +{ + return Assign(Other); +} + + + +Standard_EXPORT void SetShapes(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2) ; + + +Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2,const TopoDS_Shape& aS3) ; + + +Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2,const TopoDS_Shape& aS3,const TopoDS_Shape& aS4) ; + + +Standard_EXPORT void SetShapes(const TopTools_ListOfShape& aLS) ; + + +Standard_EXPORT void Clear() ; + + +Standard_EXPORT Standard_Integer NbIds() const; + + +Standard_EXPORT Standard_Boolean IsEqual(const NMTDS_PassKeyShape& aOther) const; + + +Standard_EXPORT Standard_Integer HashCode(const Standard_Integer Upper) const; + + +Standard_EXPORT void Dump(const Standard_Integer aHex = 0) const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // +Standard_Integer myNbIds; +Standard_Integer mySum; +Standard_Integer myUpper; +TopTools_IndexedMapOfShape myMap; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_PassKeyShape.ixx b/src/NMTDS/NMTDS_PassKeyShape.ixx new file mode 100644 index 000000000..90c37bd34 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShape.ixx @@ -0,0 +1,24 @@ +// Copyright (C) 2005 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. +// +// 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 + + + + diff --git a/src/NMTDS/NMTDS_PassKeyShape.jxx b/src/NMTDS/NMTDS_PassKeyShape.jxx new file mode 100644 index 000000000..9d79955e4 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShape.jxx @@ -0,0 +1,28 @@ +// Copyright (C) 2005 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. +// +// 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 _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _NMTDS_PassKeyShape_HeaderFile +#include +#endif diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cdl b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cdl new file mode 100644 index 000000000..77c066755 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cdl @@ -0,0 +1,47 @@ +-- Copyright (C) 2005 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. +-- +-- 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: NMTDS_PassKeyMapHasher.cdl +-- Created: +-- Author: Peter KURNEV +-- + + +class PassKeyShapeMapHasher from NMTDS + + ---Purpose: + +uses + PassKeyShape from NMTDS + +--raises + +is + HashCode(myclass; + aPKey : PassKeyShape from NMTDS; + Upper : Integer from Standard) + returns Integer from Standard; + + + IsEqual(myclass; + aPKey1 : PassKeyShape from NMTDS; + aPKey2 : PassKeyShape from NMTDS) + returns Boolean from Standard; + +end PassKeyShapeMapHasher; diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cxx b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cxx new file mode 100644 index 000000000..e637e3380 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cxx @@ -0,0 +1,45 @@ +// Copyright (C) 2005 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. +// +// 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: NMTDS_PassKeyMapHasher.cxx +// Created: +// Author: Peter KURNEV +// + + +#include + +//======================================================================= +//function : HashCode +//purpose : +//======================================================================= + Standard_Integer NMTDS_PassKeyShapeMapHasher::HashCode(const NMTDS_PassKeyShape& aPK, + const Standard_Integer Upper) +{ + return aPK.HashCode(Upper); +} +//======================================================================= +//function :IsEqual +//purpose : +//======================================================================= + Standard_Boolean NMTDS_PassKeyShapeMapHasher::IsEqual(const NMTDS_PassKeyShape& aPK1, + const NMTDS_PassKeyShape& aPK2) +{ + return aPK1.IsEqual(aPK2); +} diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.hxx b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.hxx new file mode 100644 index 000000000..e48436737 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.hxx @@ -0,0 +1,99 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTDS_PassKeyShapeMapHasher_HeaderFile +#define _NMTDS_PassKeyShapeMapHasher_HeaderFile + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class NMTDS_PassKeyShape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTDS_PassKeyShapeMapHasher { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT static Standard_Integer HashCode(const NMTDS_PassKeyShape& aPKey,const Standard_Integer Upper) ; + + +Standard_EXPORT static Standard_Boolean IsEqual(const NMTDS_PassKeyShape& aPKey1,const NMTDS_PassKeyShape& aPKey2) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.ixx b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.ixx new file mode 100644 index 000000000..c7148fd5d --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.ixx @@ -0,0 +1,24 @@ +// Copyright (C) 2005 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. +// +// 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 + + + + diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.jxx b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.jxx new file mode 100644 index 000000000..f0e81fc33 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.jxx @@ -0,0 +1,25 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTDS_PassKeyShape_HeaderFile +#include +#endif +#ifndef _NMTDS_PassKeyShapeMapHasher_HeaderFile +#include +#endif diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.cdl b/src/NMTDS/NMTDS_ShapesDataStructure.cdl index 1922b4861..5a2f93f72 100644 --- a/src/NMTDS/NMTDS_ShapesDataStructure.cdl +++ b/src/NMTDS/NMTDS_ShapesDataStructure.cdl @@ -27,8 +27,10 @@ class ShapesDataStructure from NMTDS ---Purpose: -uses - Shape from TopoDS, +uses + Box from Bnd, + IndexedMapOfInteger from TColStd, + Shape from TopoDS, IndexedDataMapOfShapeAncestorsSuccessors from BooleanOperations, CArray1OfIndexRange from NMTDS, IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger from NMTDS @@ -79,6 +81,14 @@ is aMS :out IndexedDataMapOfShapeAncestorsSuccessors from BooleanOperations); -- Contribution of Samtech www.samcef.com END + GetAllSuccessors(me; + anIndex:Integer from Standard; + aScrs :out IndexedMapOfInteger from TColStd); + + ComputeBoxEx(me; + anIndex:Integer from Standard; + aBox:out Box from Bnd); + fields myCompositeShape: Shape from TopoDS is protected; myRanges : CArray1OfIndexRange from NMTDS is protected; diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.cxx b/src/NMTDS/NMTDS_ShapesDataStructure.cxx index c7355995b..a9a0e7370 100644 --- a/src/NMTDS/NMTDS_ShapesDataStructure.cxx +++ b/src/NMTDS/NMTDS_ShapesDataStructure.cxx @@ -24,19 +24,28 @@ #include - -#include - #include #include - -#include #include -#include - #include #include +#include #include +// +#include +#include +#include +#include + + +static + void ComputeBoxExS(const Standard_Integer aIx, + const NMTDS_ShapesDataStructure* pDS, + Bnd_Box& aBoxEx); +static + void GetAllSuccessorsS(const Standard_Integer nS, + const NMTDS_ShapesDataStructure* myDS, + TColStd_IndexedMapOfInteger& aMA); //=========================================================================== //function : NMTDS_ShapesDataStructure::NMTDS_ShapesDataStructure @@ -170,7 +179,6 @@ } //modified by NIZNHY-PKV Tue Feb 27 17:06:03 2007t } - // aNbS=aMSA.Extent(); // // Fill myRanges @@ -214,6 +222,7 @@ // Contribution of Samtech www.samcef.com BEGIN // // Fill the table + //aShift=0; //for (i=0; i<2; ++i) { // if (i) { @@ -226,7 +235,7 @@ // InsertShapeAndAncestorsSuccessors(aSx, aASx, aShift); // } //} - + aShift=0; for (j=1; j<=aNbS; ++j) { const TopoDS_Shape& aSx=aMSA.FindKey(j); @@ -361,3 +370,72 @@ // Contribution of Samtech www.samcef.com END return aIndex; } + +//======================================================================= +//function : ComputeBoxEx +//purpose : +//======================================================================= + void NMTDS_ShapesDataStructure::ComputeBoxEx (const Standard_Integer aIx, + Bnd_Box& aBoxEx)const +{ + ComputeBoxExS(aIx, this, aBoxEx); +} +//======================================================================= +//function : GetAllSuccessors +//purpose : +//======================================================================= + void NMTDS_ShapesDataStructure::GetAllSuccessors(const Standard_Integer nS, + TColStd_IndexedMapOfInteger& aMA)const +{ + GetAllSuccessorsS(nS, this, aMA); +} +//======================================================================= +//function : GetAllSuccessorsS +//purpose : +//======================================================================= +void GetAllSuccessorsS(const Standard_Integer nS, + const NMTDS_ShapesDataStructure* myDS, + TColStd_IndexedMapOfInteger& aMA) +{ + TopAbs_ShapeEnum aT; + Standard_Integer i, nSx, aNbSuccessors, *pSuccessors; + Standard_Address xSuccessors; + // + const TopoDS_Shape& aS=myDS->Shape(nS); + aT=aS.ShapeType(); + if(NMTDS_Tools::HasBRep(aT)) { + aMA.Add(nS); + // + if (aT==TopAbs_VERTEX) { + return; + } + } + // + myDS->GetSuccessors(nS, xSuccessors, aNbSuccessors); + pSuccessors=(Standard_Integer*)xSuccessors; + for (i=0; iGetBoundingBox(aIx); + aBoxEx.Add(aBox); + // + aNbS=pDS->NumberOfSuccessors(aIx); + for (i=1; i<=aNbS; ++i) { + Bnd_Box aBoxS; + iS=pDS->GetSuccessor(aIx, i); + ComputeBoxExS(iS, pDS, aBoxS); + aBoxEx.Add(aBoxS); + } +} diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.hxx b/src/NMTDS/NMTDS_ShapesDataStructure.hxx index b3e8065f8..9d149f5a7 100644 --- a/src/NMTDS/NMTDS_ShapesDataStructure.hxx +++ b/src/NMTDS/NMTDS_ShapesDataStructure.hxx @@ -38,6 +38,8 @@ class TopoDS_Shape; class NMTDS_CArray1OfIndexRange; class BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors; +class TColStd_IndexedMapOfInteger; +class Bnd_Box; #ifndef _Standard_HeaderFile @@ -98,6 +100,12 @@ Standard_EXPORT void FillMap(const TopoDS_Shape& aS,BooleanOperations_IndexedD Standard_EXPORT void FillSubshapes(const TopoDS_Shape& aS,BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSA,BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMS) const; +Standard_EXPORT void GetAllSuccessors(const Standard_Integer anIndex,TColStd_IndexedMapOfInteger& aScrs) const; + + +Standard_EXPORT void ComputeBoxEx(const Standard_Integer anIndex,Bnd_Box& aBox) const; + + diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.jxx b/src/NMTDS/NMTDS_ShapesDataStructure.jxx index 5ae9a8554..41897c615 100644 --- a/src/NMTDS/NMTDS_ShapesDataStructure.jxx +++ b/src/NMTDS/NMTDS_ShapesDataStructure.jxx @@ -26,6 +26,12 @@ #ifndef _BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors_HeaderFile #include #endif +#ifndef _TColStd_IndexedMapOfInteger_HeaderFile +#include +#endif +#ifndef _Bnd_Box_HeaderFile +#include +#endif #ifndef _NMTDS_ShapesDataStructure_HeaderFile #include #endif diff --git a/src/NMTDS/NMTDS_Tools.cdl b/src/NMTDS/NMTDS_Tools.cdl new file mode 100644 index 000000000..1465d4d16 --- /dev/null +++ b/src/NMTDS/NMTDS_Tools.cdl @@ -0,0 +1,64 @@ +-- Copyright (C) 2005 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. +-- +-- 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: NMTDS_Tools.cdl +-- Created: Tue Feb 20 14:56:14 2007 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2007 + + +class Tools from NMTDS + + ---Purpose: + +uses + ShapeEnum from TopAbs, + Vertex from TopoDS, + Shape from TopoDS, + IndexedDataMapOfShapeShape from TopTools + +--raises + +is + TypeToInteger(myclass; + aT1: ShapeEnum from TopAbs; + aT2: ShapeEnum from TopAbs) + returns Integer from Standard; + + HasBRep(myclass; + aT: ShapeEnum from TopAbs) + returns Boolean from Standard; + + ComputeVV(myclass; + aV1:Vertex from TopoDS; + aV2:Vertex from TopoDS) + returns Integer from Standard; + + CopyShape(myclass; + aS:Shape from TopoDS; + aSC:out Shape from TopoDS); + + CopyShape(myclass; + aS:Shape from TopoDS; + aSC :out Shape from TopoDS; + aMSS :out IndexedDataMapOfShapeShape from TopTools); +--fields + +end Tools; diff --git a/src/NMTDS/NMTDS_Tools.cxx b/src/NMTDS/NMTDS_Tools.cxx new file mode 100644 index 000000000..8944fe501 --- /dev/null +++ b/src/NMTDS/NMTDS_Tools.cxx @@ -0,0 +1,173 @@ +// Copyright (C) 2005 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. +// +// 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: NMTDS_Tools.cxx +// Created: Tue Feb 20 14:57:28 2007 +// Author: Peter KURNEV +// + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void CopySource(const TopoDS_Shape& aS, + TopTools_IndexedDataMapOfShapeShape& aMapSS, + TopoDS_Shape& aSC); + +//======================================================================= +//function : CopyShape +//purpose : +//======================================================================= + void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS, + TopoDS_Shape& aSC) +{ + TopTools_IndexedDataMapOfShapeShape aMapSS; + // + CopySource(aS, aMapSS, aSC); +} +//======================================================================= +//function : CopyShape +//purpose : +//======================================================================= + void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS, + TopoDS_Shape& aSC, + TopTools_IndexedDataMapOfShapeShape& aMapSS) +{ + CopySource(aS, aMapSS, aSC); +} +//======================================================================= +//function : CopySource +//purpose : +//======================================================================= +void CopySource(const TopoDS_Shape& aS, + TopTools_IndexedDataMapOfShapeShape& aMapSS, + TopoDS_Shape& aSC) +{ + Standard_Boolean bFree; + TopAbs_ShapeEnum aT; + TopoDS_Iterator aIt; + BRep_Builder BB; + // + aT=aS.ShapeType(); + // + if (aMapSS.Contains(aS)) { + aSC=aMapSS.ChangeFromKey(aS); + aSC.Orientation(aS.Orientation()); + return; + } + else { + aSC=aS.EmptyCopied(); + aMapSS.Add(aS, aSC); + } + // + bFree=aSC.Free(); + aSC.Free(Standard_True); + aIt.Initialize(aS); + for (; aIt.More(); aIt.Next()) { + TopoDS_Shape aSCx; + // + const TopoDS_Shape& aSx=aIt.Value(); + // + CopySource (aSx, aMapSS, aSCx); + // + aSCx.Orientation(aSx.Orientation()); + BB.Add(aSC, aSCx); + } + aSC.Free(bFree); +} +//======================================================================= +// function: ComputeVV +// purpose: +//======================================================================= + Standard_Integer NMTDS_Tools::ComputeVV(const TopoDS_Vertex& aV1, + const TopoDS_Vertex& aV2) +{ + Standard_Real aTolV1, aTolV2, aTolSum, aTolSum2, aD2; + gp_Pnt aP1, aP2; + // + aTolV1=BRep_Tool::Tolerance(aV1); + aTolV2=BRep_Tool::Tolerance(aV2); + aTolSum=aTolV1+aTolV2; + aTolSum2=aTolSum*aTolSum; + // + aP1=BRep_Tool::Pnt(aV1); + aP2=BRep_Tool::Pnt(aV2); + // + aD2=aP1.SquareDistance(aP2); + if (aD2>aTolSum2) { + return -1; + } + return 0; +} +//======================================================================= +// function: HasBRep +// purpose: +//======================================================================= + Standard_Boolean NMTDS_Tools::HasBRep(const TopAbs_ShapeEnum aTi) +{ + return (aTi==TopAbs_VERTEX || aTi==TopAbs_EDGE || aTi==TopAbs_FACE); +} +//======================================================================= +//function : TypeToInteger +//purpose : +//======================================================================= + Standard_Integer NMTDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2) +{ + Standard_Integer iRet, iT1, iT2, iX; + // + iRet=-1; + iT1=(Standard_Integer)aType1; + iT2=(Standard_Integer)aType2; + // + iX=iT2*10+iT1; + switch (iX) { + case 77: + iRet=5; // VV + break; + case 76: + case 67: + iRet=4; // VE + break; + case 74: + case 47: + iRet=2; // VF + break; + case 66: + iRet=3; // EE + break; + case 64: + case 46: + iRet=1; // EF + break; + case 44: + iRet=0; // FF + break; + default: + break; + } + return iRet; +} diff --git a/src/NMTDS/NMTDS_Tools.hxx b/src/NMTDS/NMTDS_Tools.hxx new file mode 100644 index 000000000..c7eb8fdc9 --- /dev/null +++ b/src/NMTDS/NMTDS_Tools.hxx @@ -0,0 +1,113 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTDS_Tools_HeaderFile +#define _NMTDS_Tools_HeaderFile + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _TopAbs_ShapeEnum_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class TopoDS_Vertex; +class TopoDS_Shape; +class TopTools_IndexedDataMapOfShapeShape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTDS_Tools { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT static Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aT1,const TopAbs_ShapeEnum aT2) ; + + +Standard_EXPORT static Standard_Boolean HasBRep(const TopAbs_ShapeEnum aT) ; + + +Standard_EXPORT static Standard_Integer ComputeVV(const TopoDS_Vertex& aV1,const TopoDS_Vertex& aV2) ; + + +Standard_EXPORT static void CopyShape(const TopoDS_Shape& aS,TopoDS_Shape& aSC) ; + + +Standard_EXPORT static void CopyShape(const TopoDS_Shape& aS,TopoDS_Shape& aSC,TopTools_IndexedDataMapOfShapeShape& aMSS) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_Tools.ixx b/src/NMTDS/NMTDS_Tools.ixx new file mode 100644 index 000000000..8e5877b34 --- /dev/null +++ b/src/NMTDS/NMTDS_Tools.ixx @@ -0,0 +1,24 @@ +// Copyright (C) 2005 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. +// +// 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 + + + + diff --git a/src/NMTDS/NMTDS_Tools.jxx b/src/NMTDS/NMTDS_Tools.jxx new file mode 100644 index 000000000..4359a18a7 --- /dev/null +++ b/src/NMTDS/NMTDS_Tools.jxx @@ -0,0 +1,31 @@ +// Copyright (C) 2005 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. +// +// 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 _TopoDS_Vertex_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopTools_IndexedDataMapOfShapeShape_HeaderFile +#include +#endif +#ifndef _NMTDS_Tools_HeaderFile +#include +#endif diff --git a/src/NMTTools/Makefile.am b/src/NMTTools/Makefile.am index 67fa6c114..ecd125530 100644 --- a/src/NMTTools/Makefile.am +++ b/src/NMTTools/Makefile.am @@ -38,12 +38,12 @@ salomeinclude_HEADERS = \ Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock.hxx \ Handle_NMTTools_ListNodeOfListOfCommonBlock.hxx \ Handle_NMTTools_ListNodeOfListOfCoupleOfShape.hxx \ + NMTTools_CheckerSI.hxx \ NMTTools_CommonBlockAPI.hxx \ NMTTools_CommonBlock.hxx \ NMTTools_CommonBlockPool.hxx \ NMTTools_CoupleOfShape.hxx \ NMTTools_DEProcessor.hxx \ - NMTTools_DSFiller.hxx \ NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger.hxx \ NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape.hxx \ NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock.hxx \ @@ -58,8 +58,6 @@ salomeinclude_HEADERS = \ NMTTools_ListOfCommonBlock.hxx \ NMTTools_ListOfCoupleOfShape.hxx \ NMTTools_PaveFiller.hxx \ - NMTTools_PCurveMaker.hxx \ - NMTTools_PDSFiller.hxx \ NMTTools_PPaveFiller.hxx \ NMTTools_Tools.hxx \ Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock.hxx \ @@ -75,12 +73,13 @@ salomeinclude_HEADERS = \ lib_LTLIBRARIES = libNMTTools.la dist_libNMTTools_la_SOURCES = \ + NMTTools_CheckerSI.cxx \ + NMTTools_CheckerSI_1.cxx \ NMTTools_CommonBlockAPI.cxx \ NMTTools_CommonBlock.cxx \ NMTTools_CommonBlockPool_0.cxx \ NMTTools_CoupleOfShape.cxx \ NMTTools_DEProcessor.cxx \ - NMTTools_DSFiller.cxx \ NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_0.cxx \ NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_0.cxx \ NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_0.cxx \ @@ -105,7 +104,6 @@ dist_libNMTTools_la_SOURCES = \ NMTTools_PaveFiller_8.cxx \ NMTTools_PaveFiller_9.cxx \ NMTTools_PaveFiller.cxx \ - NMTTools_PCurveMaker.cxx \ NMTTools_Tools.cxx \ NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_0.cxx \ NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_0.cxx \ diff --git a/src/NMTTools/NMTTools.cdl b/src/NMTTools/NMTTools.cdl index 6342a3082..14ce83e18 100644 --- a/src/NMTTools/NMTTools.cdl +++ b/src/NMTTools/NMTTools.cdl @@ -44,18 +44,21 @@ uses NMTDS is - class IteratorOfCoupleOfShape; - class DSFiller; + --class IteratorOfCoupleOfShape; + --class DSFiller; class PaveFiller; class Tools; class CommonBlock; class CommonBlockAPI; - class PCurveMaker; + --class PCurveMaker; class DEProcessor; - class CoupleOfShape; - + class CoupleOfShape; + --modified by NIZNHY-PKV Mon Feb 19 11:39:24 2007f + class CheckerSI; + --modified by NIZNHY-PKV Mon Feb 19 11:39:27 2007t + pointer PPaveFiller to PaveFiller from NMTTools; - pointer PDSFiller to DSFiller from NMTTools; + --pointer PDSFiller to DSFiller from NMTTools; class ListOfCommonBlock instantiates List from TCollection(CommonBlock from NMTTools); diff --git a/src/NMTTools/NMTTools_CheckerSI.cdl b/src/NMTTools/NMTTools_CheckerSI.cdl new file mode 100644 index 000000000..50518ecd0 --- /dev/null +++ b/src/NMTTools/NMTTools_CheckerSI.cdl @@ -0,0 +1,64 @@ +-- Copyright (C) 2006 SAMTECH +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- +-- File: NMTTools_CheckerSI.cdl +-- Created: Mon Feb 19 11:23:55 2007 +-- Author: Peter KURNEV + + +class CheckerSI from NMTTools + inherits PaveFiller from NMTTools + ---Purpose: + +uses + ShapeEnum from TopAbs + +--raises + +is + + Create + returns CheckerSI from NMTTools; + ---C++: alias "Standard_EXPORT virtual ~NMTTools_CheckerSI();" + + Perform (me:out) + is redefined; + + Init (me:out) + is redefined protected; + + Clear (me:out) + is redefined protected; + + PreparePaveBlocks (me:out; + nE:Integer from Standard) + is redefined protected; + + PreparePaveBlocks (me:out; + aType1: ShapeEnum from TopAbs; + aType2: ShapeEnum from TopAbs) + is redefined protected; + + StopStatus(me) + returns Integer from Standard; + + +fields + myStopStatus: Integer from Standard is protected; + +end CheckerSI; diff --git a/src/NMTTools/NMTTools_CheckerSI.cxx b/src/NMTTools/NMTTools_CheckerSI.cxx new file mode 100644 index 000000000..f3158795f --- /dev/null +++ b/src/NMTTools/NMTTools_CheckerSI.cxx @@ -0,0 +1,177 @@ +// Copyright (C) 2006 SAMTECH +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: NMTTools_CheckerSI.cxx +// Created: Mon Feb 19 11:32:08 2007 +// Author: Peter KURNEV +// + + +#include + +#include +#include +#include +#include + +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTTools_CheckerSI::NMTTools_CheckerSI() +: + NMTTools_PaveFiller() +{ + myStopStatus=0; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + NMTTools_CheckerSI::~NMTTools_CheckerSI() +{ +} +//======================================================================= +//function : Clear +//purpose : +//======================================================================= + void NMTTools_CheckerSI::Clear() +{ + NMTTools_PaveFiller::Clear(); +} +//======================================================================= +//function : StopStatus +//purpose : +//======================================================================= + Standard_Integer NMTTools_CheckerSI::StopStatus()const +{ + return myStopStatus; +} +//======================================================================= +//function : Init +//purpose : +//======================================================================= + void NMTTools_CheckerSI::Init() +{ + myIsDone=Standard_False; + if (myCompositeShape.IsNull()) { + return; + } + // + Clear(); + // 1. + myDS=new NMTDS_ShapesDataStructure; + myDS->SetCompositeShape(myCompositeShape); + myDS->Init(); + // + // 2. + myDSIt=new NMTDS_IteratorCheckerSI; + myDSIt->SetDS(myDS); + myDSIt->Prepare(); + // + // 4. + myNbSources=myDS->NumberOfShapesOfTheObject()+ + myDS->NumberOfShapesOfTheTool(); + myNbEdges=myDS->NbEdges(); + // 5 + myIP=new NMTDS_InterfPool; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + void NMTTools_CheckerSI::Perform() +{ + myIsDone=Standard_False; + myStopStatus=0; + // + Init(); + //1.VV + // + PerformVV(); + // + // 2.VE + myPavePool.Resize (myNbEdges); + + PrepareEdges(); + // + PerformVE(); + // + // 3.VF + PerformVF(); + // + // 4.EE + myCommonBlockPool.Resize (myNbEdges); + mySplitShapesPool.Resize (myNbEdges); + myPavePoolNew .Resize (myNbEdges); + // + PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE); + if (myStopStatus) { + return; + } + PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE); + if (myStopStatus) { + return; + } + // + PerformEE(); + // + RefinePavePool (); + if (myStopStatus) { + return; + } + // + myPavePoolNew.Destroy(); + myPavePoolNew.Resize (myNbEdges); + // + // 5.EF + PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE); + if (myStopStatus) { + return; + } + // + PerformEF(); + // + RefinePavePool(); + if (myStopStatus) { + return; + } + // + myPavePoolNew.Destroy(); + // + MakeSplitEdges(); + // + UpdateCommonBlocks(); + // + // 6. FF + PerformFF (); + // + MakeBlocks(); + // + MakePCurves(); + // + // 7. Postprocessing + UpdatePaveBlocks(); + // + NMTTools_DEProcessor aDEP(*this); + aDEP.Do(); + // + MakeAloneVertices(); + // + myIsDone=Standard_True; +} diff --git a/src/NMTTools/NMTTools_CheckerSI.hxx b/src/NMTTools/NMTTools_CheckerSI.hxx new file mode 100644 index 000000000..4aacb49d2 --- /dev/null +++ b/src/NMTTools/NMTTools_CheckerSI.hxx @@ -0,0 +1,118 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTTools_CheckerSI_HeaderFile +#define _NMTTools_CheckerSI_HeaderFile + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _NMTTools_PaveFiller_HeaderFile +#include +#endif +#ifndef _TopAbs_ShapeEnum_HeaderFile +#include +#endif + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTTools_CheckerSI : public NMTTools_PaveFiller { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT NMTTools_CheckerSI(); +Standard_EXPORT virtual ~NMTTools_CheckerSI(); + + +Standard_EXPORT virtual void Perform() ; + + +Standard_EXPORT Standard_Integer StopStatus() const; + + + + + +protected: + + // Methods PROTECTED + // + + +Standard_EXPORT virtual void Init() ; + + +Standard_EXPORT virtual void Clear() ; + + +Standard_EXPORT virtual void PreparePaveBlocks(const Standard_Integer nE) ; + + +Standard_EXPORT virtual void PreparePaveBlocks(const TopAbs_ShapeEnum aType1,const TopAbs_ShapeEnum aType2) ; + + + // Fields PROTECTED + // +Standard_Integer myStopStatus; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTTools/NMTTools_CheckerSI.ixx b/src/NMTTools/NMTTools_CheckerSI.ixx new file mode 100644 index 000000000..5d3e0201d --- /dev/null +++ b/src/NMTTools/NMTTools_CheckerSI.ixx @@ -0,0 +1,24 @@ +// Copyright (C) 2005 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. +// +// 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 + + + + diff --git a/src/NMTTools/NMTTools_CheckerSI.jxx b/src/NMTTools/NMTTools_CheckerSI.jxx new file mode 100644 index 000000000..68bdc3096 --- /dev/null +++ b/src/NMTTools/NMTTools_CheckerSI.jxx @@ -0,0 +1,22 @@ +// Copyright (C) 2005 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. +// +// 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 _NMTTools_CheckerSI_HeaderFile +#include +#endif diff --git a/src/NMTTools/NMTTools_CheckerSI_1.cxx b/src/NMTTools/NMTTools_CheckerSI_1.cxx new file mode 100755 index 000000000..36ab867df --- /dev/null +++ b/src/NMTTools/NMTTools_CheckerSI_1.cxx @@ -0,0 +1,160 @@ +// Copyright (C) 2006 SAMTECH +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: NMTTools_CheckerSI.cxx +// Created: Mon Feb 19 11:32:08 2007 +// Author: Peter KURNEV +// + + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +static + Standard_Boolean IsValid(const TopoDS_Edge& aE, + const TopoDS_Vertex& aV, + const Standard_Real aTV1, + const Standard_Real aTV2); + +//======================================================================= +// function: PreparePaveBlocks +// purpose: +//======================================================================= + void NMTTools_CheckerSI::PreparePaveBlocks(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2) +{ + NMTTools_PaveFiller::PreparePaveBlocks(aType1, aType2); +} +//======================================================================= +// function: PreparePaveBlocks +// purpose: +//======================================================================= + void NMTTools_CheckerSI::PreparePaveBlocks(const Standard_Integer nE) +{ + myIsDone=Standard_False; + // + char buf[32]={"SR"}; + Standard_Boolean bIsValid; + Standard_Integer nV1, nV2, iErr; + Standard_Real aT1, aT2; + TopoDS_Edge aE; + TopoDS_Vertex aV1, aV2; + // + BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); + // Edge + aE=TopoDS::Edge(myDS->Shape(nE)); + if (BRep_Tool::Degenerated(aE)) { + myIsDone=Standard_True; + return; + } + // + BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE)); + + BOPTools_PaveBlockIterator aPBIt(nE, aPS); + for (; aPBIt.More(); aPBIt.Next()) { + BOPTools_PaveBlock& aPB=aPBIt.Value(); + const IntTools_Range& aRange=aPB.Range(); + // + const BOPTools_Pave& aPave1=aPB.Pave1(); + nV1=aPave1.Index(); + aV1=TopoDS::Vertex(myDS->Shape(nV1)); + aT1=aPave1.Param(); + // + const BOPTools_Pave& aPave2=aPB.Pave2(); + nV2=aPave2.Index(); + aV2=TopoDS::Vertex(myDS->Shape(nV2)); + aT2=aPave2.Param(); + // + bIsValid=Standard_True; + if (nV1==nV2) { + bIsValid=IsValid(aE, aV1, aT1, aT2); + if (!bIsValid) { + //printf(" pb SR: nV nE: %d nV1:( %d %15.10lf ) nV2:( %d %15.10lf )\n", nE, nV1, aT1, nV2, aT2); + myStopStatus=1; + } + } + // + IntTools_ShrunkRange aSR (aE, aV1, aV2, aRange, myContext); + iErr=aSR.ErrorStatus(); + if (!aSR.IsDone()) { + //printf(" pb SR: Done nE: %d nV1:( %d %15.10lf ) nV2:( %d %15.10lf )\n", nE, nV1, aT1, nV2, aT2); + aSR.SetShrunkRange(aRange); + //throw BOPTColStd_Failure(buf) ; + } + else if (iErr!=6) { + CorrectShrunkRanges (0, aPave1, aSR); + CorrectShrunkRanges (1, aPave2, aSR); + } + aPB.SetShrunkRange(aSR); + aLPB.Append(aPB); + } //for (; aPBIt.More(); aPBIt.Next()) + myIsDone=Standard_True; +} + +//======================================================================= +//function : IsValid +//purpose : +//======================================================================= +Standard_Boolean IsValid(const TopoDS_Edge& aE, + const TopoDS_Vertex& aV, + const Standard_Real aTV1, + const Standard_Real aTV2) +{ + Standard_Boolean bRet; + Standard_Integer i, aNbP, aNbP1; + Standard_Real aTolV2, aTC1, aTC2, dT, aTC, aD2; + Handle(Geom_Curve) aC; + gp_Pnt aPV, aPC; + // + bRet=Standard_False; + aTolV2=BRep_Tool::Tolerance(aV); + aTolV2=aTolV2*aTolV2; + aPV=BRep_Tool::Pnt(aV); + aC=BRep_Tool::Curve(aE, aTC1, aTC2); + aNbP=7; + aNbP1=aNbP-1; + dT=(aTV2-aTV1)/aNbP1; + // + for (i=1; iD0(aTC, aPC); + aD2=aPV.SquareDistance(aPC); + bRet=aD2>aTolV2; + } + return bRet; +} diff --git a/src/NMTTools/NMTTools_DEProcessor.cxx b/src/NMTTools/NMTTools_DEProcessor.cxx index 9c5f860f5..0933b0104 100644 --- a/src/NMTTools/NMTTools_DEProcessor.cxx +++ b/src/NMTTools/NMTTools_DEProcessor.cxx @@ -74,7 +74,7 @@ #include #include #include -#include + #include #include @@ -90,7 +90,7 @@ #include #include - +#include //======================================================================= // function: NMTTools_DEProcessor::NMTTools_DEProcessor @@ -189,7 +189,7 @@ void NMTTools_DEProcessor::DoPaves() { - Standard_Integer i, aNbE, nED, nVD, nFD, aNbLPB; + Standard_Integer i, aNbE, nED, nVD, aNbLPB, nFD; // nFD=0; aNbE=myDEMap.Extent(); @@ -203,16 +203,15 @@ TColStd_ListIteratorOfListOfInteger anIt(nLF); for (; anIt.More(); anIt.Next()) { nFD=anIt.Value(); - // + BOPTools_ListOfPaveBlock aLPB; FindPaveBlocks(nED, nVD, nFD, aLPB); - //modified by NIZNHY-PKV Fri Mar 23 10:35:27 2007f - // + // xxf aNbLPB=aLPB.Extent(); if (!aNbLPB) { continue; } - //modified by NIZNHY-PKV Fri Mar 23 10:35:33 2007t + //xxt FillPaveSet (nED, nVD, nFD, aLPB); } // @@ -236,7 +235,8 @@ BOPTools_ListIteratorOfListOfPaveBlock anIt; Standard_Integer i, aNb, nF2, nV; // - BOPTools_CArray1OfSSInterference& aFFs=(myFiller->InterfPool())->SSInterferences(); + //BOPTools_CArray1OfSSInterference& aFFs=(myFiller->InterfPool())->SSInterferences(); + BOPTools_CArray1OfSSInterference& aFFs=(myFiller->IP())->SSInterferences(); // aNb=aFFs.Extent(); for (i=1; i<=aNb; ++i) { diff --git a/src/NMTTools/NMTTools_PaveFiller.cdl b/src/NMTTools/NMTTools_PaveFiller.cdl index 3cee74a1a..19340bc8c 100644 --- a/src/NMTTools/NMTTools_PaveFiller.cdl +++ b/src/NMTTools/NMTTools_PaveFiller.cdl @@ -28,19 +28,18 @@ class PaveFiller from NMTTools ---Purpose: uses - -- Modified to add new definitions Thu Sep 14 14:35:18 2006 - -- Contribution of Samtech www.samcef.com BEGIN - ListOfInteger from TColStd, - -- Contribution of Samtech www.samcef.com END DataMapOfIntegerInteger from TColStd, Pnt from gp, ShapeEnum from TopAbs, Vertex from TopoDS, Face from TopoDS, + Shape from TopoDS, -- Modified to add new definitions Thu Sep 14 14:35:18 2006 -- Contribution of Samtech www.samcef.com BEGIN Edge from TopoDS, - ListOfShape from TopTools, + ListOfShape from TopTools, + DataMapOfShapeShape from TopTools, + ListOfInteger from TColStd, -- Contribution of Samtech www.samcef.com END Context from IntTools, @@ -48,8 +47,8 @@ uses IndexedDataMapOfShapeInteger from BooleanOperations, - InterferencePool from BOPTools, - PInterferencePool from BOPTools, + --InterferencePool from BOPTools, + --PInterferencePool from BOPTools, PavePool from BOPTools, PaveBlock from BOPTools, ListOfPaveBlock from BOPTools, @@ -66,48 +65,77 @@ uses CommonBlockPool from NMTTools, CommonBlock from NMTTools, ListOfCommonBlock from NMTTools, - -- Modified to add new definitions Thu Sep 14 14:35:18 2006 - -- Contribution of Samtech www.samcef.com BEGIN - IndexedDataMapOfIndexedMapOfInteger from NMTTools, - -- Contribution of Samtech www.samcef.com END + ShapesDataStructure from NMTDS, + -- Modified to add new definitions Thu Sep 14 14:35:18 2006 -- Contribution of Samtech www.samcef.com BEGIN PShapesDataStructure from NMTDS, - Iterator from NMTDS + Iterator from NMTDS, + IndexedDataMapOfIndexedMapOfInteger from NMTTools, -- Contribution of Samtech www.samcef.com END + + PIterator from NMTDS, + PInterfPool from NMTDS --raises is Create - returns PaveFiller from NMTTools; + returns PaveFiller from NMTTools; + ---C++: alias "Standard_EXPORT virtual ~NMTTools_PaveFiller();" - Create(aIP:InterferencePool from BOPTools) - returns PaveFiller from NMTTools; + -- Create(aIP:InterferencePool from BOPTools) + -- returns PaveFiller from NMTTools; - Destroy (me: in out) - is virtual; - ---C++: alias "Standard_EXPORT virtual ~NMTTools_PaveFiller(){Destroy();}" + -- Destroy (me: in out) + --is virtual; + -- -C++: alias "Standard_EXPORT virtual ~NMTTools_PaveFiller(){Destroy();}" -- -- Selectors/Modifiers - SetInterferencePool(me:out; - aIP:InterferencePool from BOPTools); - - InterfPool(me:out) - returns PInterferencePool from BOPTools; + --SetInterferencePool(me:out; + -- aIP:PInterferencePool from BOPTools); + + SetCompositeShape (me:out; + aS: Shape from TopoDS); + + CompositeShape(me) + returns Shape from TopoDS; + ---C++: return const& + + --InterfPool(me:out) + --returns PInterferencePool from BOPTools; + + --SetDS(me:out; + -- aDS:PShapesDataStructure from NMTDS); + + DS(me:out) + returns PShapesDataStructure from NMTDS; + + --SetDSIt(me:out; + -- aIt:PIterator from NMTDS); + + DSIt(me:out) + returns PIterator from NMTDS; + + IP(me:out) + returns PInterfPool from NMTDS; -- -- Perform the algo -- Modified to add new method Thu Sep 14 14:35:18 2006 -- Contribution of Samtech www.samcef.com BEGIN - Init (me:out); + Init (me:out) + is virtual protected; -- Contribution of Samtech www.samcef.com END + Clear (me:out) + is virtual protected; + Perform (me:out) is virtual; PerformVV (me:out) - is virtual ; + is virtual protected; PerformVE (me:out) is virtual protected; @@ -142,28 +170,25 @@ is anE:Integer from Standard) is virtual protected; - PerformNewVertices (me:out) - is virtual ; + --PerformNewVertices (me:out) + --is virtual; PrepareEdges (me:out) is virtual protected; - SortTypes (me; - anInd1:in out Integer from Standard; - anInd2:in out Integer from Standard) - is protected; + --SortTypes (me; + -- anInd1:in out Integer from Standard; + -- anInd2:in out Integer from Standard) + -- is protected; - ExpectedPoolLength(me) - returns Integer from Standard - is protected; + --ExpectedPoolLength(me) + -- returns Integer from Standard + --is protected; -- -- Query section IsDone(me) returns Boolean from Standard; - DS(me:out) - returns PShapesDataStructure from NMTDS; - Context(me) returns Context from IntTools; ---C++:return const & @@ -200,7 +225,7 @@ is nV: Integer from Standard) returns Integer from Standard; - IsSuccesstorsComputed (me; + IsSuccessorsComputed (me; iF1:Integer from Standard; iF2:Integer from Standard) returns Boolean from Standard @@ -500,18 +525,17 @@ is aLSE :out ListOfShape from TopTools); -- Contribution of Samtech www.samcef.com END + FuseVertices(me; + aC:Shape from TopoDS; + aDMVV: out DataMapOfShapeShape from TopTools); + fields - myIntrPool : PInterferencePool from BOPTools is protected; + --myIntrPool : PInterferencePool from BOPTools is protected; myDS : PShapesDataStructure from NMTDS is protected; myIsDone : Boolean from Standard is protected; myNbSources : Integer from Standard is protected; myNbEdges : Integer from Standard is protected; - -- Modified to add new field Thu Sep 14 14:35:18 2006 - -- Contribution of Samtech www.samcef.com BEGIN - myDSIt : Iterator from NMTDS is protected; - -- Contribution of Samtech www.samcef.com END - myPavePool : PavePool from BOPTools is protected; myPavePoolNew : PavePool from BOPTools is protected; myCommonBlockPool : CommonBlockPool from NMTTools is protected; @@ -520,7 +544,10 @@ fields myContext : Context from IntTools is protected; mySectionAttribute : SSIntersectionAttribute from BOPTools is protected; myAloneVertices : IndexedDataMapOfIndexedMapOfInteger from NMTTools is protected; - -- - myVSD : DataMapOfIntegerInteger from TColStd is protected; - -- + --modified by NIZNHY-PKV Wed Oct 11 11:06:50 2006f + myVSD : DataMapOfIntegerInteger from TColStd is protected; + myDSIt : PIterator from NMTDS is protected; + myCompositeShape : Shape from TopoDS is protected; + myIP : PInterfPool from NMTDS is protected; + --modified by NIZNHY-PKV Wed Oct 11 11:06:55 2006t end PaveFiller; diff --git a/src/NMTTools/NMTTools_PaveFiller.cxx b/src/NMTTools/NMTTools_PaveFiller.cxx index 9c76d8910..236a077dc 100644 --- a/src/NMTTools/NMTTools_PaveFiller.cxx +++ b/src/NMTTools/NMTTools_PaveFiller.cxx @@ -27,71 +27,97 @@ #include #include #include +#include +#include -// //======================================================================= // function: NMTTools_PaveFiller::NMTTools_PaveFiller // purpose: //======================================================================= NMTTools_PaveFiller::NMTTools_PaveFiller() { - myIntrPool=NULL; myDS=NULL; + myDSIt=NULL; myIsDone=Standard_False; myNbSources=0; myNbEdges=0; + myIP=NULL; } //======================================================================= -// function:NMTTools_PaveFiller::NMTTools_PaveFiller +// function: ~ // purpose: //======================================================================= - NMTTools_PaveFiller::NMTTools_PaveFiller(const BOPTools_InterferencePool& aIP) + NMTTools_PaveFiller::~NMTTools_PaveFiller() { - SetInterferencePool(aIP); + Clear(); } //======================================================================= -// function: Destroy +// function: Clear // purpose: //======================================================================= - void NMTTools_PaveFiller::Destroy() + void NMTTools_PaveFiller::Clear() { + if (myDSIt) { + delete myDSIt; + } + if (myDS) { + delete myDS; + } + myDSIt=NULL; + myDS=NULL; + + if (myIP) { + delete myIP; + } + myIP=NULL; } //======================================================================= -// function: SetInterferencePool +// function: SetCompositeShape // purpose: //======================================================================= - void NMTTools_PaveFiller::SetInterferencePool(const BOPTools_InterferencePool& aIP) + void NMTTools_PaveFiller::SetCompositeShape(const TopoDS_Shape& aS) { - myIsDone=Standard_False; - // - myIntrPool=(BOPTools_InterferencePool*)&aIP; - myDS=(NMTDS_ShapesDataStructure*)myIntrPool->DS(); - myNbSources=myDS->NumberOfShapesOfTheObject()+myDS->NumberOfShapesOfTheTool(); - myNbEdges=myDS->NbEdges(); + myCompositeShape=aS; } //======================================================================= -// function: InterfPool +// function: CompositeShape // purpose: //======================================================================= - BOPTools_PInterferencePool NMTTools_PaveFiller::InterfPool() + const TopoDS_Shape& NMTTools_PaveFiller::CompositeShape()const { - return myIntrPool; + return myCompositeShape; } //======================================================================= -// function:IsDone +// function: DS // purpose: //======================================================================= - Standard_Boolean NMTTools_PaveFiller::IsDone() const + NMTDS_PShapesDataStructure NMTTools_PaveFiller::DS() { - return myIsDone; + return myDS; } //======================================================================= -// function: DS +// function: DSIt // purpose: //======================================================================= - NMTDS_PShapesDataStructure NMTTools_PaveFiller::DS() + NMTDS_PIterator NMTTools_PaveFiller::DSIt() { - return myDS; + return myDSIt; +} +//======================================================================= +// function: IP +// purpose: +//======================================================================= + NMTDS_PInterfPool NMTTools_PaveFiller::IP() +{ + return myIP; +} +//======================================================================= +// function:IsDone +// purpose: +//======================================================================= + Standard_Boolean NMTTools_PaveFiller::IsDone() const +{ + return myIsDone; } //======================================================================= // function: Context @@ -149,7 +175,6 @@ { return mySplitShapesPool; } - //======================================================================= // function: ChangeSplitShapesPool // purpose: @@ -164,11 +189,29 @@ //======================================================================= void NMTTools_PaveFiller::Init() { - myDSIt.SetDS(myDS); - // Modified Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN - myDSIt.Prepare(); - // Contribution of Samtech www.samcef.com END + myIsDone=Standard_False; + if (myCompositeShape.IsNull()) { + return; + } + // + Clear(); + // 1. + myDS=new NMTDS_ShapesDataStructure; + myDS->SetCompositeShape(myCompositeShape); + myDS->Init(); + // + // 2. + myDSIt=new NMTDS_Iterator; + myDSIt->SetDS(myDS); + myDSIt->Prepare(); + // + // 3. + myNbSources=myDS->NumberOfShapesOfTheObject()+ + myDS->NumberOfShapesOfTheTool(); + myNbEdges=myDS->NbEdges(); + // + // 4 + myIP=new NMTDS_InterfPool; } //======================================================================= @@ -179,6 +222,7 @@ { myIsDone=Standard_False; // + //---------------- try { // 0. // Modified Thu Sep 14 14:35:18 2006 @@ -188,7 +232,6 @@ //1.VV // PerformVV(); - PerformNewVertices(); // // 2.VE myPavePool.Resize (myNbEdges); @@ -217,7 +260,6 @@ // // 5.EF PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE); - PerformEF(); // RefinePavePool(); diff --git a/src/NMTTools/NMTTools_PaveFiller.hxx b/src/NMTTools/NMTTools_PaveFiller.hxx index ab479896e..2d6492a3f 100644 --- a/src/NMTTools/NMTTools_PaveFiller.hxx +++ b/src/NMTTools/NMTTools_PaveFiller.hxx @@ -20,9 +20,6 @@ #ifndef _NMTTools_PaveFiller_HeaderFile #define _NMTTools_PaveFiller_HeaderFile -#ifndef _BOPTools_PInterferencePool_HeaderFile -#include -#endif #ifndef _NMTDS_PShapesDataStructure_HeaderFile #include #endif @@ -32,9 +29,6 @@ #ifndef _Standard_Integer_HeaderFile #include #endif -#ifndef _NMTDS_Iterator_HeaderFile -#include -#endif #ifndef _BOPTools_PavePool_HeaderFile #include #endif @@ -56,13 +50,22 @@ #ifndef _TColStd_DataMapOfIntegerInteger_HeaderFile #include #endif +#ifndef _NMTDS_PIterator_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _NMTDS_PInterfPool_HeaderFile +#include +#endif #ifndef _TopAbs_ShapeEnum_HeaderFile #include #endif #ifndef _Standard_Real_HeaderFile #include #endif -class BOPTools_InterferencePool; +class TopoDS_Shape; class BOPTools_Pave; class IntTools_ShrunkRange; class IntTools_Context; @@ -86,6 +89,7 @@ class gp_Pnt; class NMTTools_IndexedDataMapOfIndexedMapOfInteger; class TopTools_ListOfShape; class TopoDS_Edge; +class TopTools_DataMapOfShapeShape; #ifndef _Standard_HeaderFile @@ -117,39 +121,30 @@ public: Standard_EXPORT NMTTools_PaveFiller(); +Standard_EXPORT virtual ~NMTTools_PaveFiller(); -Standard_EXPORT NMTTools_PaveFiller(const BOPTools_InterferencePool& aIP); +Standard_EXPORT void SetCompositeShape(const TopoDS_Shape& aS) ; -Standard_EXPORT virtual void Destroy() ; -Standard_EXPORT virtual ~NMTTools_PaveFiller(){Destroy();} +Standard_EXPORT const TopoDS_Shape& CompositeShape() const; -Standard_EXPORT void SetInterferencePool(const BOPTools_InterferencePool& aIP) ; +Standard_EXPORT NMTDS_PShapesDataStructure DS() ; -Standard_EXPORT BOPTools_PInterferencePool InterfPool() ; +Standard_EXPORT NMTDS_PIterator DSIt() ; -Standard_EXPORT void Init() ; +Standard_EXPORT NMTDS_PInterfPool IP() ; Standard_EXPORT virtual void Perform() ; -Standard_EXPORT virtual void PerformVV() ; - - -Standard_EXPORT virtual void PerformNewVertices() ; - - Standard_EXPORT Standard_Boolean IsDone() const; -Standard_EXPORT NMTDS_PShapesDataStructure DS() ; - - Standard_EXPORT const IntTools_Context& Context() const; @@ -285,6 +280,9 @@ Standard_EXPORT Standard_Integer CheckIntermediatePoint(const BOPTools_PaveBlo Standard_EXPORT void SharedEdges(const Standard_Integer nF1,const Standard_Integer nF2,TColStd_ListOfInteger& aLNE,TopTools_ListOfShape& aLSE) ; +Standard_EXPORT void FuseVertices(const TopoDS_Shape& aC,TopTools_DataMapOfShapeShape& aDMVV) const; + + @@ -294,6 +292,15 @@ protected: // +Standard_EXPORT virtual void Init() ; + + +Standard_EXPORT virtual void Clear() ; + + +Standard_EXPORT virtual void PerformVV() ; + + Standard_EXPORT virtual void PerformVE() ; @@ -324,13 +331,7 @@ Standard_EXPORT virtual void PreparePaveBlocks(const Standard_Integer anE) ; Standard_EXPORT virtual void PrepareEdges() ; -Standard_EXPORT void SortTypes(Standard_Integer& anInd1,Standard_Integer& anInd2) const; - - -Standard_EXPORT Standard_Integer ExpectedPoolLength() const; - - -Standard_EXPORT Standard_Boolean IsSuccesstorsComputed(const Standard_Integer iF1,const Standard_Integer iF2) const; +Standard_EXPORT Standard_Boolean IsSuccessorsComputed(const Standard_Integer iF1,const Standard_Integer iF2) const; Standard_EXPORT Standard_Boolean IsBlocksCoinside(const BOPTools_PaveBlock& aPB1,const BOPTools_PaveBlock& aPB2) const; @@ -392,12 +393,10 @@ Standard_EXPORT void MakeAloneVertices() ; // Fields PROTECTED // -BOPTools_PInterferencePool myIntrPool; NMTDS_PShapesDataStructure myDS; Standard_Boolean myIsDone; Standard_Integer myNbSources; Standard_Integer myNbEdges; -NMTDS_Iterator myDSIt; BOPTools_PavePool myPavePool; BOPTools_PavePool myPavePoolNew; NMTTools_CommonBlockPool myCommonBlockPool; @@ -406,6 +405,9 @@ IntTools_Context myContext; BOPTools_SSIntersectionAttribute mySectionAttribute; NMTTools_IndexedDataMapOfIndexedMapOfInteger myAloneVertices; TColStd_DataMapOfIntegerInteger myVSD; +NMTDS_PIterator myDSIt; +TopoDS_Shape myCompositeShape; +NMTDS_PInterfPool myIP; private: diff --git a/src/NMTTools/NMTTools_PaveFiller.jxx b/src/NMTTools/NMTTools_PaveFiller.jxx index 0e63c963e..1c7e98a59 100644 --- a/src/NMTTools/NMTTools_PaveFiller.jxx +++ b/src/NMTTools/NMTTools_PaveFiller.jxx @@ -17,8 +17,8 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -#ifndef _BOPTools_InterferencePool_HeaderFile -#include +#ifndef _TopoDS_Shape_HeaderFile +#include #endif #ifndef _BOPTools_Pave_HeaderFile #include @@ -89,6 +89,9 @@ #ifndef _TopoDS_Edge_HeaderFile #include #endif +#ifndef _TopTools_DataMapOfShapeShape_HeaderFile +#include +#endif #ifndef _NMTTools_PaveFiller_HeaderFile #include #endif diff --git a/src/NMTTools/NMTTools_PaveFiller_0.cxx b/src/NMTTools/NMTTools_PaveFiller_0.cxx index e64607d3e..6a355d3df 100644 --- a/src/NMTTools/NMTTools_PaveFiller_0.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_0.cxx @@ -1,65 +1,70 @@ // Copyright (C) 2005 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 +// License as published by the Free Software Foundation; either // version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// +// 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 +// 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: NMTTools_PaveFiller_1.cxx -// Created: Mon Dec 8 11:47:55 2003 +// File: NMTTools_PaveFiller_0.cxx +// Created: Mon Dec 8 11:45:51 2003 // Author: Peter KURNEV // + #include +#include #include -#include + +#include #include -#include +#include //======================================================================= -//function : SortTypes -//purpose : +// function:IsSuccesstorsComputed +// purpose: //======================================================================= - void NMTTools_PaveFiller::SortTypes(Standard_Integer& theWhat, - Standard_Integer& theWith)const -{ - Standard_Boolean aReverseFlag=Standard_True; - - TopAbs_ShapeEnum aType1= myDS->GetShapeType(theWhat), - aType2= myDS->GetShapeType(theWith); - - if (aType1==aType2) - return; - - if (aType1==TopAbs_EDGE && aType2==TopAbs_FACE){ - aReverseFlag=Standard_False; + Standard_Boolean NMTTools_PaveFiller::IsSuccessorsComputed(const Standard_Integer aN1, + const Standard_Integer aN2)const +{ + Standard_Boolean bComputed; + Standard_Integer i, nSuc, n1, n2, ntmp, aNbS; + TopAbs_ShapeEnum aType; + TColStd_IndexedMapOfInteger aMSuc; + // + n1=aN1; + n2=aN2; + aType=myDS->GetShapeType(aN1); + if (aType!=TopAbs_VERTEX) { + ntmp=n1; + n1=n2; + n2=ntmp; } - - if (aType1==TopAbs_VERTEX && - (aType2==TopAbs_FACE || aType2==TopAbs_EDGE)) { - aReverseFlag=Standard_False; + // + myDS->GetAllSuccessors(n2, aMSuc); + aNbS=aMSuc.Extent(); + for (i=1; i<=aNbS; ++i) { + nSuc=aMSuc(i); + bComputed=myIP->Contains(n1, nSuc); + if (bComputed) { + break; + } } - - Standard_Integer aWhat, aWith; - aWhat=(aReverseFlag) ? theWith : theWhat; - aWith=(aReverseFlag) ? theWhat : theWith; - - theWhat=aWhat; - theWith=aWith; + return bComputed; } +/* //======================================================================= // function: ExpectedPoolLength // purpose: @@ -72,7 +77,7 @@ // Contribution of Samtech www.samcef.com BEGIN //const BOPTools_ListOfCoupleOfInteger& aLC=myDSIt.ListOfCouple(); //aNbIIs=aLC.Extent(); - aNbIIs=myDSIt.ExpectedLength(); + aNbIIs=myDSIt->ExpectedLength(); // Contribution of Samtech www.samcef.com END // if (aNbIIs==1) { @@ -83,57 +88,39 @@ return aNbIIs; } +*/ +/* //======================================================================= -// function:IsSuccesstorsComputed -// purpose: +//function : SortTypes +//purpose : //======================================================================= - Standard_Boolean NMTTools_PaveFiller::IsSuccesstorsComputed(const Standard_Integer aN1, - const Standard_Integer aN2)const -{ - Standard_Integer nSuc, n1, n2; - - BooleanOperations_OnceExplorer aExp(*myDS); - TopAbs_ShapeEnum aType=myDS->GetShapeType(aN1); - - n1=aN1; - n2=aN2; - - if (aType!=TopAbs_VERTEX) { - Standard_Integer ntmp=n1; - n1=n2; - n2=ntmp; + void NMTTools_PaveFiller::SortTypes(Standard_Integer& theWhat, + Standard_Integer& theWith)const +{ + Standard_Integer aWhat, aWith; + Standard_Boolean aReverseFlag; + TopAbs_ShapeEnum aType1, aType2; + // + aType1= myDS->GetShapeType(theWhat), + aType2= myDS->GetShapeType(theWith); + // + if (aType1==aType2) { + return; } - - aType=myDS->GetShapeType(n2); - if (aType==TopAbs_EDGE) { - aExp.Init(n2, TopAbs_VERTEX); - for (; aExp.More(); aExp.Next()) { - nSuc=aExp.Current(); - if (myIntrPool->IsComputed(n1, nSuc)) { - return Standard_True; - } - } - return Standard_False; + // + aReverseFlag=Standard_True; + if (aType1==TopAbs_EDGE && aType2==TopAbs_FACE) { + aReverseFlag=Standard_False; } - - else if (aType==TopAbs_FACE) { - aExp.Init(n2, TopAbs_VERTEX); - for (; aExp.More(); aExp.Next()) { - nSuc=aExp.Current(); - if (myIntrPool->IsComputed(n1, nSuc)) { - return Standard_True; - } - } - - aExp.Init(n2, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()) { - nSuc=aExp.Current(); - if (myIntrPool->IsComputed(n1, nSuc)) { - return Standard_True; - } - } - return Standard_False; + if (aType1==TopAbs_VERTEX && + (aType2==TopAbs_FACE || aType2==TopAbs_EDGE)) { + aReverseFlag=Standard_False; } - - return Standard_False; + // + aWhat=(aReverseFlag) ? theWith : theWhat; + aWith=(aReverseFlag) ? theWhat : theWith; + // + theWhat=aWhat; + theWith=aWith; } +*/ diff --git a/src/NMTTools/NMTTools_PaveFiller_1.cxx b/src/NMTTools/NMTTools_PaveFiller_1.cxx index 086e395f6..d4cca964a 100644 --- a/src/NMTTools/NMTTools_PaveFiller_1.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_1.cxx @@ -21,13 +21,14 @@ // Created: Mon Dec 8 11:47:55 2003 // Author: Peter KURNEV // + #include #include #include #include #include - + #include #include #include @@ -35,12 +36,14 @@ #include #include +#include #include #include -#include -#include +#include +#include #include + #include //======================================================================= @@ -51,47 +54,47 @@ { myIsDone=Standard_False; // - Standard_Integer anIndexIn, aWhat, aWith, aNbVVs, aBlockLength, aNbVSD; - Standard_Integer nVnew; + Standard_Integer aNbVVs, aBL, aNbVSD, nVnew, i, j, n1, n2; TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aIt1; - TColStd_ListIteratorOfListOfInteger aIt; + TColStd_ListIteratorOfListOfInteger aItX, aItY; + TColStd_ListOfInteger aLIX; TopTools_ListOfShape aLV; TopoDS_Vertex aVnew; - TopoDS_Shape aS; // myVSD.Clear(); // - BOPTools_CArray1OfVVInterference& aVVs=myIntrPool->VVInterferences(); - // - // BlockLength correction - aNbVVs=ExpectedPoolLength(); - aBlockLength=aVVs.BlockLength(); - if (aNbVVs > aBlockLength) { - aVVs.SetBlockLength(aNbVVs); - } - // - const TColStd_DataMapOfIntegerListOfInteger& aMVSD=myDSIt.SDVertices(); + const TColStd_DataMapOfIntegerListOfInteger& aMVSD=myDSIt->SDVertices(); aNbVSD=aMVSD.Extent(); if (!aNbVSD) { return; } // + BOPTools_CArray1OfVVInterference& aVVs=myIP->VVInterferences(); + // + // BlockLength correction + myDSIt->Initialize(TopAbs_VERTEX, TopAbs_VERTEX); + aNbVVs=myDSIt->BlockLength(); + aBL=aVVs.BlockLength(); + if (aNbVVs > aBL) { + aVVs.SetBlockLength(aNbVVs); + } + // aIt1.Initialize(aMVSD); for (; aIt1.More(); aIt1.Next()) { aLV.Clear(); // - aWhat=aIt1.Key(); + n1=aIt1.Key(); const TColStd_ListOfInteger& aLIV=aIt1.Value(); // // new vertex - aIt.Initialize(aLIV); - for (; aIt.More(); aIt.Next()) { - aWith=aIt.Value(); - aS=myDS->Shape(aWith); - aLV.Append(aS); + const TopoDS_Shape& aS1=myDS->Shape(n1); + aLV.Append(aS1); + aItX.Initialize(aLIV); + for (; aItX.More(); aItX.Next()) { + n2=aItX.Value(); + const TopoDS_Shape& aS2=myDS->Shape(n2); + aLV.Append(aS2); } - aS=myDS->Shape(aWhat); - aLV.Append(aS); // NMTTools_Tools::MakeNewVertex(aLV, aVnew); // @@ -101,30 +104,38 @@ nVnew=myDS->NumberOfInsertedShapes(); myDS->SetState (nVnew, BooleanOperations_ON); // + // myVSD, aLIX + aLIX.Clear(); + aLIX.Append(n1); + myVSD.Bind(n1, nVnew); + // + aItX.Initialize(aLIV); + for (; aItX.More(); aItX.Next()) { + n2=aItX.Value(); + aLIX.Append(n2); + myVSD.Bind(n2, nVnew); + } + // // interferences - aIt.Initialize(aLIV); - for (; aIt.More(); aIt.Next()) { - aWith=aIt.Value(); - BOPTools_VVInterference aVV(aWhat, aWith); - aVV.SetNewShape(nVnew); - anIndexIn=aVVs.Append(aVV); - myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexVertex, anIndexIn); - // - // to find SD-Vertices - myVSD.Bind(aWith, nVnew); + aItX.Initialize(aLIX); + for (i=0; aItX.More(); aItX.Next(), ++i) { + aItY.Initialize(aLIX); + for (j=0; aItY.More(); aItY.Next(), ++j) { + if (j>i) { + n1=aItX.Value(); + n2=aItY.Value(); + myIP->Add(n1, n2, Standard_True, NMTDS_TI_VV); + // + BOPTools_VVInterference aVV(n1, n2); + aVV.SetNewShape(nVnew); + aVVs.Append(aVV); + } + } } - myVSD.Bind(aWhat, nVnew); }//for (; aIt1.More(); aIt1.Next()) { myIsDone=Standard_True; } //======================================================================= -// function: PerformNewVertices -// purpose: -//======================================================================= - void NMTTools_PaveFiller::PerformNewVertices() -{ -} -//======================================================================= // function: FindSDVertex // purpose: //======================================================================= @@ -138,3 +149,12 @@ } return nVSD; } +/* +//======================================================================= +// function: PerformNewVertices +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PerformNewVertices() +{ +} +*/ diff --git a/src/NMTTools/NMTTools_PaveFiller_2.cxx b/src/NMTTools/NMTTools_PaveFiller_2.cxx index 8febb88c2..4c3c9ed33 100644 --- a/src/NMTTools/NMTTools_PaveFiller_2.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_2.cxx @@ -1,18 +1,18 @@ // Copyright (C) 2005 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 +// License as published by the Free Software Foundation; either // version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// +// 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 +// 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 @@ -47,20 +47,137 @@ #include #include - +#include #include +#include // // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN #include #include #include -// + static Standard_Boolean Contains(const TopoDS_Edge& aE, const TopoDS_Vertex& aV); // Contribution of Samtech www.samcef.com END + +//======================================================================= +// function: PerformVE +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PerformVE() +{ + myIsDone=Standard_False; + // + Standard_Boolean bJustAdd; + Standard_Integer n1, n2, anIndexIn, aFlag, aWhat, aWith, aNbVEs, aBlockLength, iSDV, nV1; + Standard_Real aT; + TopoDS_Vertex aV1; + TopoDS_Edge aE2; + BOPTools_IndexedMapOfCoupleOfInteger aSnareMap; + BOPTools_CoupleOfInteger aCouple; + // + BOPTools_CArray1OfVEInterference& aVEs=myIP->VEInterferences(); + // + myDSIt->Initialize (TopAbs_VERTEX, TopAbs_EDGE); + // + // BlockLength correction + aNbVEs=myDSIt->BlockLength(); + aBlockLength=aVEs.BlockLength(); + if (aNbVEs > aBlockLength) { + aVEs.SetBlockLength(aNbVEs); + } + // + for (; myDSIt->More(); myDSIt->Next()) { + myDSIt->Current(n1, n2, bJustAdd); + if (!IsSuccessorsComputed(n1, n2)) { + anIndexIn=0; + aWhat=n1; // Vertex + aWith=n2; // Edge + if (myDS->GetShapeType(n1)==TopAbs_EDGE) { + aWhat=n2; + aWith=n1; + } + // + if(bJustAdd) { + //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexEdge, anIndexIn); + continue; + } + // Edge + aE2=TopoDS::Edge(myDS->Shape(aWith)); + if (BRep_Tool::Degenerated(aE2)){ + continue; + } + // Vertex + nV1=aWhat; + aV1=TopoDS::Vertex(myDS->Shape(aWhat)); + // + iSDV=FindSDVertex(aWhat); + if (iSDV) { + nV1=iSDV; + aV1=TopoDS::Vertex(myDS->Shape(nV1)); + // Modified to find same domain vertex Thu Sep 14 14:35:18 2006 + // Contribution of Samtech www.samcef.com BEGIN + Standard_Integer nVE, iSDVE, iRet; + // + BooleanOperations_OnceExplorer aExp(*myDS); + iRet=0; + aExp.Init(aWith, TopAbs_VERTEX); + for (; aExp.More(); aExp.Next()) { + nVE=aExp.Current(); + iSDVE=FindSDVertex(nVE); + if (iSDVE==iSDV) { + iRet=1; + break; + } + } + if (iRet) { + continue; + } + } + else { + if (Contains(aE2, aV1)) { + continue; + } + // Contribution of Samtech www.samcef.com END + } + // + aFlag=myContext.ComputeVE (aV1, aE2, aT); + // + if (!aFlag) { + // Add Interference to the Pool + BOPTools_VEInterference anInterf (aWhat, aWith, aT); + anIndexIn=aVEs.Append(anInterf); + // + // Add Pave to the Edge's myPavePool + aCouple.SetCouple(nV1, aWith); + if (!aSnareMap.Contains(aCouple)){ + aSnareMap.Add(aCouple); + // + BOPTools_Pave aPave(nV1, aT, BooleanOperations_VertexEdge); + aPave.SetInterference(anIndexIn); + BOPTools_PaveSet& aPaveSet= myPavePool(myDS->RefEdge(aWith)); + aPaveSet.Append(aPave); + } + // + // State for the Vertex in DS; + myDS->SetState (aWhat, BooleanOperations_ON); + // Insert Vertex in Interference Object + BOPTools_VEInterference& aVE=aVEs(anIndexIn); + aVE.SetNewShape(aWhat); + // qqf + { + myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_VE); + } + // qqt + } + //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexEdge, anIndexIn); + } + } + myIsDone=Standard_True; +} //======================================================================= // function: PrepareEdges // purpose: @@ -106,116 +223,7 @@ static } } } -//======================================================================= -// function: PerformVE -// purpose: -//======================================================================= - void NMTTools_PaveFiller::PerformVE() -{ - myIsDone=Standard_False; - // - Standard_Boolean bJustAddInterference; - Standard_Integer n1, n2, anIndexIn, aFlag, aWhat, aWith, aNbVEs, aBlockLength, iSDV, nV1; - Standard_Real aT; - TopoDS_Vertex aV1; - TopoDS_Edge aE2; - BOPTools_IndexedMapOfCoupleOfInteger aSnareMap; - BOPTools_CoupleOfInteger aCouple; - // - BOPTools_CArray1OfVEInterference& aVEs=myIntrPool->VEInterferences(); - // - myDSIt.Initialize (TopAbs_VERTEX, TopAbs_EDGE); - // - // BlockLength correction - aNbVEs=ExpectedPoolLength(); - aBlockLength=aVEs.BlockLength(); - if (aNbVEs > aBlockLength) { - aVEs.SetBlockLength(aNbVEs); - } - // - for (; myDSIt.More(); myDSIt.Next()) { - myDSIt.Current(n1, n2, bJustAddInterference); - // - if (! myIntrPool->IsComputed(n1, n2)) { - if (! IsSuccesstorsComputed(n1, n2)) { - anIndexIn=0; - aWhat=n1; // Vertex - aWith=n2; // Edge - SortTypes(aWhat, aWith); - // - if(bJustAddInterference) { - myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexEdge, anIndexIn); - continue; - } - // Edge - aE2=TopoDS::Edge(myDS->Shape(aWith)); - if (BRep_Tool::Degenerated(aE2)){ - continue; - } - // Vertex - nV1=aWhat; - aV1=TopoDS::Vertex(myDS->Shape(aWhat)); - // - iSDV=FindSDVertex(aWhat); - if (iSDV) { - nV1=iSDV; - aV1=TopoDS::Vertex(myDS->Shape(nV1)); - // Modified to find same domain vertex Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN - Standard_Integer nVE, iSDVE, iRet; - // - BooleanOperations_OnceExplorer aExp(*myDS); - iRet=0; - aExp.Init(aWith, TopAbs_VERTEX); - for (; aExp.More(); aExp.Next()) { - nVE=aExp.Current(); - iSDVE=FindSDVertex(nVE); - if (iSDVE==iSDV) { - iRet=1; - break; - } - } - if (iRet) { - continue; - } - } - else { - if (Contains(aE2, aV1)) { - continue; - } - // Contribution of Samtech www.samcef.com END - } - // - aFlag=myContext.ComputeVE (aV1, aE2, aT); - // - if (!aFlag) { - // Add Interference to the Pool - BOPTools_VEInterference anInterf (aWhat, aWith, aT); - anIndexIn=aVEs.Append(anInterf); - // - // Add Pave to the Edge's myPavePool - aCouple.SetCouple(nV1, aWith); - if (!aSnareMap.Contains(aCouple)){ - aSnareMap.Add(aCouple); - // - BOPTools_Pave aPave(nV1, aT, BooleanOperations_VertexEdge); - aPave.SetInterference(anIndexIn); - BOPTools_PaveSet& aPaveSet= myPavePool(myDS->RefEdge(aWith)); - aPaveSet.Append(aPave); - } - // - // State for the Vertex in DS; - myDS->SetState (aWhat, BooleanOperations_ON); - // Insert Vertex in Interference Object - BOPTools_VEInterference& aVE=aVEs(anIndexIn); - aVE.SetNewShape(aWhat); - } - myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexEdge, anIndexIn); - } - } - } - myIsDone=Standard_True; -} + // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN //======================================================================= diff --git a/src/NMTTools/NMTTools_PaveFiller_3.cxx b/src/NMTTools/NMTTools_PaveFiller_3.cxx index 7869f87d0..ca458c329 100644 --- a/src/NMTTools/NMTTools_PaveFiller_3.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_3.cxx @@ -1,18 +1,18 @@ // Copyright (C) 2005 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 +// License as published by the Free Software Foundation; either // version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// +// 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 +// 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 @@ -30,11 +30,15 @@ #include #include +#include + #include #include +#include #include -#include +#include + // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN @@ -50,71 +54,76 @@ static { myIsDone=Standard_False; // - Standard_Boolean aJustAddInterference; + Standard_Boolean aJustAdd; Standard_Integer n1, n2, anIndexIn, aFlag, aWhat, aWith, aNbVSs, aBlockLength, iSDV; Standard_Real aU, aV; TopoDS_Vertex aV1; TopoDS_Face aF2; // - BOPTools_CArray1OfVSInterference& aVSs=myIntrPool->VSInterferences(); + BOPTools_CArray1OfVSInterference& aVSs=myIP->VSInterferences(); // // V/E Interferences - myDSIt.Initialize(TopAbs_VERTEX, TopAbs_FACE); + myDSIt->Initialize(TopAbs_VERTEX, TopAbs_FACE); // // BlockLength correction - aNbVSs=ExpectedPoolLength(); + aNbVSs=myDSIt->BlockLength(); aBlockLength=aVSs.BlockLength(); if (aNbVSs > aBlockLength) { aVSs.SetBlockLength(aNbVSs); } // - for (; myDSIt.More(); myDSIt.Next()) { - myDSIt.Current(n1, n2, aJustAddInterference); - // - if (! myIntrPool->IsComputed(n1, n2)) { - if (! IsSuccesstorsComputed(n1, n2)) { - anIndexIn=0; - aWhat=n1; // Vertex - aWith=n2; // Face - SortTypes(aWhat, aWith); - // - iSDV=FindSDVertex(aWhat); - // - if(aJustAddInterference) { - myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn); - continue; - } - // - aV1=TopoDS::Vertex(myDS->Shape(aWhat)); - if (iSDV) { - aV1=TopoDS::Vertex(myDS->Shape(iSDV)); - } + for (; myDSIt->More(); myDSIt->Next()) { + myDSIt->Current(n1, n2, aJustAdd); + if (! IsSuccessorsComputed(n1, n2)) { + anIndexIn=0; + aWhat=n1; // Vertex + aWith=n2; // Face + if (myDS->GetShapeType(n1)==TopAbs_FACE) { + aWhat=n2; + aWith=n1; + } + // + iSDV=FindSDVertex(aWhat); // - aF2=TopoDS::Face(myDS->Shape(aWith)); + if(aJustAdd) { + //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn); + continue; + } + // + aV1=TopoDS::Vertex(myDS->Shape(aWhat)); + if (iSDV) { + aV1=TopoDS::Vertex(myDS->Shape(iSDV)); + } // - // Modified Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN - if (Contains(aF2, aV1)) { - continue; - } - // Contribution of Samtech www.samcef.com END + aF2=TopoDS::Face(myDS->Shape(aWith)); + // + // Modified Thu Sep 14 14:35:18 2006 + // Contribution of Samtech www.samcef.com BEGIN + if (Contains(aF2, aV1)) { + continue; + } + // Contribution of Samtech www.samcef.com END + // + aFlag=myContext.ComputeVS (aV1, aF2, aU, aV); + // + if (!aFlag) { // - aFlag=myContext.ComputeVS (aV1, aF2, aU, aV); + // Add Interference to the Pool + BOPTools_VSInterference anInterf (aWhat, aWith, aU, aV); + anIndexIn=aVSs.Append(anInterf); // - if (!aFlag) { - // - // Add Interference to the Pool - BOPTools_VSInterference anInterf (aWhat, aWith, aU, aV); - anIndexIn=aVSs.Append(anInterf); - // - // SetState for Vertex in DS; - myDS->SetState (aWhat, BooleanOperations_ON); - // Insert Vertex in Interference Object - BOPTools_VSInterference& aVS=aVSs(anIndexIn); - aVS.SetNewShape(aWhat); + // SetState for Vertex in DS; + myDS->SetState (aWhat, BooleanOperations_ON); + // Insert Vertex in Interference Object + BOPTools_VSInterference& aVS=aVSs(anIndexIn); + aVS.SetNewShape(aWhat); + // qqf + { + myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_VF); } - myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn); + // qqt } + //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn); } } myIsDone=Standard_True; diff --git a/src/NMTTools/NMTTools_PaveFiller_4.cxx b/src/NMTTools/NMTTools_PaveFiller_4.cxx index 3a9a1c5c9..2c1d50e26 100644 --- a/src/NMTTools/NMTTools_PaveFiller_4.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_4.cxx @@ -28,8 +28,14 @@ #include #include +#include +#include +#include + #include #include +#include +#include #include #include @@ -37,11 +43,18 @@ #include #include +#include +#include +#include +#include +#include #include #include +#include -#include +#include +#include #include #include @@ -67,14 +80,17 @@ #include #include -#include -#include - #include #include #include +#include #include +#include +#include +#include +#include +#include #include #include @@ -90,30 +106,7 @@ #include // Contribution of Samtech www.samcef.com END // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // -#include -#include -#include -#include static @@ -165,31 +158,30 @@ static BooleanOperations_IndexedDataMapOfShapeInteger aMapVI; BOPTools_IDMapOfPaveBlockIMapOfPaveBlock aMapCB; // - BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences(); + // + myDSIt->Initialize(TopAbs_EDGE, TopAbs_EDGE); // // BlockLength correction - aNbVEs=ExpectedPoolLength(); + aNbVEs=myDSIt->BlockLength(); aBlockLength=aEEs.BlockLength(); if (aNbVEs > aBlockLength) { aEEs.SetBlockLength(aNbVEs); } // - myDSIt.Initialize(TopAbs_EDGE, TopAbs_EDGE); - // - for (; myDSIt.More(); myDSIt.Next()) { - myDSIt.Current(n1, n2, bJustAdd); + for (; myDSIt->More(); myDSIt->Next()) { + myDSIt->Current(n1, n2, bJustAdd); anIndexIn = 0; // - if (myIntrPool->IsComputed(n1, n2)) { - continue; - } + //if (myIntrPool->IsComputed(n1, n2)) { + // continue; + //} // nE1=n1; nE2=n2; - SortTypes(nE1, nE2); // if(bJustAdd) { - myIntrPool->AddInterference (nE1, nE2, BooleanOperations_EdgeEdge, anIndexIn); + //myIntrPool->AddInterference (nE1, nE2, BooleanOperations_EdgeEdge, anIndexIn); continue; } // @@ -296,17 +288,68 @@ static bIsOnPave2=IsOnPave(aT2, aR2, aTol); // if(bIsOnPave1 || bIsOnPave2) { - myIntrPool->AddInterference (aWhat, aWith, BooleanOperations_EdgeEdge, anIndexIn); - continue; + continue; } // BOPTools_Tools::MakeNewVertex(aEWhat, aT1, aEWith, aT2, aNewVertex); // + //modified by NIZNHY-PKV Mon Jun 19 11:40:09 2007f + { + Standard_Integer nV11, nV12, nV21, nV22, nVS[2], k, j, iFound; + Standard_Real aTolVx, aTolVnew, aD2, aDT2; + TColStd_MapOfInteger aMV; + gp_Pnt aPnew, aPx; + // + iFound=0; + j=-1; + nV11=aPB1.Pave1().Index(); + nV12=aPB1.Pave2().Index(); + nV21=aPB2.Pave1().Index(); + nV22=aPB2.Pave2().Index(); + aMV.Add(nV11); + aMV.Add(nV12); + // + if (aMV.Contains(nV21)) { + ++j; + nVS[j]=nV21; + } + if (aMV.Contains(nV22)) { + ++j; + nVS[j]=nV22; + } + // + aTolVnew=BRep_Tool::Tolerance(aNewVertex); + aPnew=BRep_Tool::Pnt(aNewVertex); + // + for (k=0; k<=j; ++k) { + const TopoDS_Vertex& aVx=TopoDS::Vertex(myDS->Shape(nVS[k])); + aTolVx=BRep_Tool::Tolerance(aVx); + aPx=BRep_Tool::Pnt(aVx); + aD2=aPnew.SquareDistance(aPx); + // + aDT2=100.*(aTolVnew+aTolVx)*(aTolVnew+aTolVx); + // + if (aD2AddInterference (aWhat, aWith, BooleanOperations_EdgeEdge, anIndexIn); + // qqf + { + myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_EE); + } + // qqt // // Collect aMapVI.Add(aNewVertex, anIndexIn); @@ -321,7 +364,7 @@ static aCoinsideFlag=IsBlocksCoinside(aPB1, aPB2); // if (aNbComPrt2>1 || !aCoinsideFlag) { - myIntrPool->AddInterference (aWhat, aWith, BooleanOperations_EdgeEdge, anIndexIn); + //myIntrPool->AddInterference (aWhat, aWith, BooleanOperations_EdgeEdge, anIndexIn); break; } // @@ -349,6 +392,11 @@ static aMapPB.Add(aPB2); aMapCB.Add(aPB2, aMapPB); } + // qqf + { + myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_EE); + } + // qqt } break; default: @@ -396,7 +444,7 @@ static TColStd_MapOfInteger aMFence; BOPTools_Pave aPave; // - BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences(); // aNb=aMapVI.Extent(); if (!aNb) { // no new vertices, no new problems @@ -575,10 +623,7 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap //... aNbIP=aMIPC.Extent(); if (!aNbIP) { - //modified by NIZNHY-PKV Tue Jan 9 14:26:09 2007f aMIPC.Add(i); - //continue; - //modified by NIZNHY-PKV Tue Jan 9 14:26:12 2007t } // aIt1.Initialize(aMIPC); @@ -698,7 +743,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; BOPTools_Pave aPave; // - BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences(); // // one new vertex case is treated in usual way // @@ -770,58 +815,43 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, { myIsDone=Standard_False; // - Standard_Boolean Ok1, Ok2, Ok3; - Ok1= (aType1==TopAbs_VERTEX) && (aType2==TopAbs_EDGE) ; - Ok2= (aType1==TopAbs_EDGE) && (aType2==TopAbs_EDGE) ; - Ok3= (aType1==TopAbs_EDGE) && (aType2==TopAbs_FACE) ; - if (!Ok1 && !Ok2 && !Ok3) { - // error: Type mismatch + Standard_Boolean bOk1, bOk2, bOk3, bFlag; + Standard_Integer i, aNb, nE[2], n1, n2, aNbSplits; + TColStd_MapOfInteger aMap; + + bOk1= (aType1==TopAbs_VERTEX) && (aType2==TopAbs_EDGE) ; + bOk2= (aType1==TopAbs_EDGE) && (aType2==TopAbs_EDGE) ; + bOk3= (aType1==TopAbs_EDGE) && (aType2==TopAbs_FACE) ; + if (!bOk1 && !bOk2 && !bOk3) {// error: Type mismatch return; } // - Standard_Boolean aFlag = Standard_False; - Standard_Integer n1, n2, nE1, nE2, aNbSplits; - TColStd_MapOfInteger aMap; - // - myDSIt.Initialize(aType1, aType2); + aNb=bOk2 ? 2 : 1; // - for (; myDSIt.More(); myDSIt.Next()) { - myDSIt.Current(n1, n2, aFlag); - nE1=n1; - nE2=n2; - SortTypes(nE1, nE2); + myDSIt->Initialize(aType1, aType2); + for (; myDSIt->More(); myDSIt->Next()) { + myDSIt->Current(n1, n2, bFlag); // - if (aType1==TopAbs_EDGE) { - BOPTools_ListOfPaveBlock& aLPB1=mySplitShapesPool(myDS->RefEdge(nE1)); - aNbSplits=aLPB1.Extent(); - if (!aNbSplits) { - if (!aMap.Contains(nE1)) { - aMap.Add(nE1); - PreparePaveBlocks(nE1); - // - if (!myIsDone) { - return; - } - } - } + nE[0]=n1; + nE[1]=n2; + if (myDS->GetShapeType(n1)!=TopAbs_EDGE) { + nE[0]=n2; + nE[1]=n1; } // - if (aType2==TopAbs_EDGE) { - BOPTools_ListOfPaveBlock& aLPB2=mySplitShapesPool(myDS->RefEdge(nE2)); - aNbSplits=aLPB2.Extent(); + for (i=0; iRefEdge(nE[i])); + aNbSplits=aLPB.Extent(); if (!aNbSplits) { - if (!aMap.Contains(nE2)) { - aMap.Add(nE2); - PreparePaveBlocks(nE2); - // + if (aMap.Add(nE[i])) { + PreparePaveBlocks(nE[i]); if (!myIsDone) { return; } } } - }// if (aType2==TopAbs_EDGE) + } }// for (; myDSIt.More(); myDSIt.Next()) - myIsDone=Standard_True; } //======================================================================= @@ -831,65 +861,60 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, void NMTTools_PaveFiller::PreparePaveBlocks(const Standard_Integer nE) { myIsDone=Standard_False; - - Standard_Integer nV1, nV2; - + // + char buf[512]; + Standard_Integer nV1, nV2, iErr; TopoDS_Edge aE; TopoDS_Vertex aV1, aV2; - - // SplitShapesPool + // BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); // Edge aE=TopoDS::Edge(myDS->Shape(nE)); + if (BRep_Tool::Degenerated(aE)) { + myIsDone=Standard_True; + return; + } // - if (!BRep_Tool::Degenerated(aE)){ + BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE)); + + BOPTools_PaveBlockIterator aPBIt(nE, aPS); + for (; aPBIt.More(); aPBIt.Next()) { + BOPTools_PaveBlock& aPB=aPBIt.Value(); + const IntTools_Range& aRange=aPB.Range(); // - BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE)); - - BOPTools_PaveBlockIterator aPBIt(nE, aPS); - for (; aPBIt.More(); aPBIt.Next()) { - BOPTools_PaveBlock& aPB=aPBIt.Value(); - - const IntTools_Range& aRange=aPB.Range(); - - const BOPTools_Pave& aPave1=aPB.Pave1(); - nV1=aPave1.Index(); - aV1=TopoDS::Vertex(myDS->GetShape(nV1)); - - const BOPTools_Pave& aPave2=aPB.Pave2(); - nV2=aPave2.Index(); - aV2=TopoDS::Vertex(myDS->GetShape(nV2)); - // - // ShrunkRange - IntTools_ShrunkRange aSR (aE, aV1, aV2, aRange, myContext); - // - Standard_Integer anErrorStatus; - anErrorStatus=aSR.ErrorStatus(); - - char buf[512]; - if (!aSR.IsDone()) { - sprintf (buf, "Can not obtain ShrunkRange for Edge %d\n", nE); - BOPTColStd_Dump::PrintMessage(buf); - sprintf (buf, "Can not obtain ShrunkRange for Edge %d", nE); - throw - BOPTColStd_Failure(buf) ; - } - // - if (anErrorStatus==6) { - sprintf(buf, - "Warning: [PreparePaveBlocks()] Max.Dummy Shrunk Range for Edge %d\n", nE); - BOPTColStd_Dump::PrintMessage(buf); - } - else { - // Check left paves and correct ShrunkRange if it is necessary - CorrectShrunkRanges (0, aPave1, aSR); - CorrectShrunkRanges (1, aPave2, aSR); - } - // - aPB.SetShrunkRange(aSR); - aLPB.Append(aPB); - } //for (; aPBIt1.More(); aPBIt1.Next()) - } + const BOPTools_Pave& aPave1=aPB.Pave1(); + nV1=aPave1.Index(); + aV1=TopoDS::Vertex(myDS->GetShape(nV1)); + // + const BOPTools_Pave& aPave2=aPB.Pave2(); + nV2=aPave2.Index(); + aV2=TopoDS::Vertex(myDS->GetShape(nV2)); + // + // ShrunkRange + IntTools_ShrunkRange aSR (aE, aV1, aV2, aRange, myContext); + iErr=aSR.ErrorStatus(); + if (!aSR.IsDone()) { + sprintf (buf, "Can not obtain ShrunkRange for Edge %d\n", nE); + BOPTColStd_Dump::PrintMessage(buf); + sprintf (buf, "Can not obtain ShrunkRange for Edge %d", nE); + throw + BOPTColStd_Failure(buf) ; + } + // + if (iErr==6) { + sprintf(buf, + "Warning: [PreparePaveBlocks()] Max.Dummy Shrunk Range for Edge %d\n", nE); + BOPTColStd_Dump::PrintMessage(buf); + } + else { + // Check left paves and correct ShrunkRange if it is necessary + CorrectShrunkRanges (0, aPave1, aSR); + CorrectShrunkRanges (1, aPave2, aSR); + } + // + aPB.SetShrunkRange(aSR); + aLPB.Append(aPB); + } //for (; aPBIt.More(); aPBIt.Next()) myIsDone=Standard_True; } //======================================================================= @@ -915,7 +940,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, return; } - BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences(); const BOPTools_EEInterference& aEE=aEEs(anIndexInterf); const IntTools_CommonPrt& aCP=aEE.CommonPrt(); const TopoDS_Edge& aE1=aCP.Edge1(); @@ -945,8 +970,10 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, tNV=tV+aCoeff*(tNV-tV); aNewRange.SetFirst(tNV); aNewRange.SetLast (aSR.Last()); - - if(aNewRange.First() > aNewRange.Last()) { + //modified by NIZNHY-PKV Tue Jan 23 14:07:55 2007f + //if(aNewRange.First() > aNewRange.Last()) { + if(aNewRange.First() < aNewRange.Last()) { + //modified by NIZNHY-PKV Tue Jan 23 14:08:02 2007t aShrunkRange.SetShrunkRange(aNewRange); } } @@ -1370,8 +1397,8 @@ void ProcessBlock(const BOPTools_PaveBlock& aPB, TColStd_ListOfInteger aLFI; TColStd_ListIteratorOfListOfInteger aItLFI; // - BOPTools_CArray1OfVSInterference& aVSs=myIntrPool->VSInterferences(); - BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + BOPTools_CArray1OfVSInterference& aVSs=myIP->VSInterferences(); + BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences(); // aNbS=myDS->NumberOfShapesOfTheObject(); for (i=1; i<=aNbS; ++i) { @@ -1427,213 +1454,3 @@ void ProcessBlock(const BOPTools_PaveBlock& aPB, } } // Contribution of Samtech www.samcef.com END -/* -//======================================================================= -// function:EENewVertices -// purpose: -//======================================================================= - void NMTTools_PaveFiller::EENewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) -{ - Standard_Integer aNb, i, j, aNewShape, aNbEdges, aNbIEE, aNbVV, aNbSimple; - Standard_Integer aWhat, aWith, i1, i2, nE1, nE2, nE, nV, aFlag; - Standard_Real aT; - TopoDS_Compound aCompound; - BRep_Builder aBB; - NMTTools_IndexedDataMapOfIndexedMapOfInteger aMNVE, aMNVIEE; - BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; - BOPTools_Pave aPave; - TopoDS_Vertex aNewVertex; - TopTools_IndexedMapOfShape aMNVComplex, aMNVSimple; - // - BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); - // - aNb=aMapVI.Extent(); - // - if (!aNb) { // no new vertices, no new problems - return; - } - // - // 0. - if (aNb==1) { - aNewVertex=TopoDS::Vertex(aMapVI.FindKey(1)); - EENewVertices(aNewVertex, aMapVI); - return; - } - // - // 1. Make compound from new vertices - aBB.MakeCompound(aCompound); - for (i=1; i<=aNb; ++i) { - const TopoDS_Shape& aV=aMapVI.FindKey(i); - aBB.Add(aCompound, aV); - } - // - // 2. VV intersection between these vertices - // using the auxiliary Filler - NMTDS_ShapesDataStructure tDS; - // - tDS.SetCompositeShape(aCompound); - tDS.Init(); - // - BOPTools_InterferencePool tInterfPool(tDS); - NMTTools_PaveFiller tPaveFiller(tInterfPool); - // - tPaveFiller.Init(); - // - tPaveFiller.PerformVV(); - tPaveFiller.PerformNewVertices(); - // - const BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterfs(); - // - // 3. Separate Comlex and Simple new vertices - aNbVV=aVVInterfs.Extent(); - for (i=1; i<=aNbVV; ++i) { - const BOPTools_VVInterference& aVV=aVVInterfs(i); - aVV.Indices(aWhat, aWith); - const TopoDS_Shape& aV1=tDS.Shape(aWhat); - const TopoDS_Shape& aV2=tDS.Shape(aWith); - aMNVComplex.Add(aV1); - aMNVComplex.Add(aV2); - } - // - for (i=1; i<=aNb; ++i) { - const TopoDS_Shape& aV=aMapVI.FindKey(i); - if (!aMNVComplex.Contains(aV)) { - aMNVSimple.Add(aV); - } - } - // - // 4. Treat Simple new Vertices - aNbSimple=aMNVSimple.Extent(); - for (i=1; i<=aNbSimple; ++i) { - const TopoDS_Vertex& aV=TopoDS::Vertex(aMNVSimple(i)); - EENewVertices(aV, aMapVI); - } - // - // 3. Fill Maps : NewVertex-edges (aMNVE) - // NewVertex-interferences (aMNVIEE) - for (i=1; i<=aNbVV; ++i) { - const BOPTools_VVInterference& aVV=aVVInterfs(i); - aNewShape=aVV.NewShape(); - if (!aNewShape) { - continue; - } - // - if (!aMNVE.Contains(aNewShape)) { - TColStd_IndexedMapOfInteger aMx; - aMNVE.Add(aNewShape, aMx); - } - if (!aMNVIEE.Contains(aNewShape)) { - TColStd_IndexedMapOfInteger aMx; - aMNVIEE.Add(aNewShape, aMx); - } - // - TColStd_IndexedMapOfInteger& aME=aMNVE.ChangeFromKey(aNewShape); - TColStd_IndexedMapOfInteger& aMIEE=aMNVIEE.ChangeFromKey(aNewShape); - // - aVV.Indices(aWhat, aWith); - //aWhat - const TopoDS_Shape& aV1=tDS.Shape(aWhat); - i1=aMapVI.FindFromKey(aV1); - const BOPTools_EEInterference& aEE1=aEEs(i1); - aEE1.Indices(nE1, nE2); - aME.Add(nE1); - aME.Add(nE2); - aMIEE.Add(i1); - //aWith - const TopoDS_Shape& aV2=tDS.Shape(aWith); - i2=aMapVI.FindFromKey(aV2); - const BOPTools_EEInterference& aEE2=aEEs(i2); - aEE2.Indices(nE1, nE2); - aME.Add(nE1); - aME.Add(nE2); - aMIEE.Add(i2); - // - //printf(" VV: (%d, %d) -> %d\n", aWhat, aWith, aNewShape); - } - // - // 4. Process new vertices - aNb=aMNVE.Extent(); - for (i=1; i<=aNb; ++i) { // xx - // - // new Vertex - nV=aMNVE.FindKey(i); - aNewVertex=TopoDS::Vertex(tDS.Shape(nV)); - // - // Insert New Vertex in DS; - myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); - aNewShape=myDS->NumberOfInsertedShapes(); - myDS->SetState (aNewShape, BooleanOperations_ON); - // - // Update index of NewShape in EE interferences - const TColStd_IndexedMapOfInteger& aMIEE=aMNVIEE.FindFromKey(nV);//(i); - aNbIEE=aMIEE.Extent(); - for (j=1; j<=aNbIEE; ++j) { - i1=aMIEE(j); - BOPTools_EEInterference& aEE1=aEEs(i1); - aEE1.SetNewShape(aNewShape); - } - // - // Update Paves on edges - const TColStd_IndexedMapOfInteger& aME=aMNVE(i); - aNbEdges=aME.Extent(); - for (j=1; j<=aNbEdges; ++j) { - nE=aME(j); - const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));//mpv - // - aFlag=myContext.ComputeVE (aNewVertex, aE, aT); - // - if (!aFlag) { - aPave.SetInterference(-1); - aPave.SetType (BooleanOperations_EdgeEdge); - aPave.SetIndex(aNewShape); - aPave.SetParam(aT); - // - BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE)); - aPaveSet.Append(aPave); - } - } - }// for (i=1; i<=aNb; ++i) {// xx -} -//======================================================================= -// function:EENewVertices -// purpose: -//======================================================================= - void NMTTools_PaveFiller::EENewVertices (const TopoDS_Vertex& aNewVertex, - const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) -{ - Standard_Integer i, aNewShape, nE1, nE2; - Standard_Real aT1, aT2; - BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; - BOPTools_Pave aPave; - // - BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); - // - // one new vertex case is treated in usual way - // - // Insert New Vertex in DS; - myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); - aNewShape=myDS->NumberOfInsertedShapes(); - myDS->SetState (aNewShape, BooleanOperations_ON); - // Insert New Vertex in EE Interference - i=aMapVI.FindFromKey(aNewVertex); - BOPTools_EEInterference& aEEInterf= aEEs(i); - aEEInterf.SetNewShape(aNewShape); - // Extact interference info - aEEInterf.Indices(nE1, nE2); - const IntTools_CommonPrt& aCPart=aEEInterf.CommonPrt(); - VertexParameters(aCPart, aT1, aT2); - // - // Add Paves to the myPavePoolNew - aPave.SetInterference(i); - aPave.SetType (BooleanOperations_EdgeEdge); - aPave.SetIndex(aNewShape); - // Pave for edge nE1 - aPave.SetParam(aT1); - BOPTools_PaveSet& aPaveSet1=myPavePoolNew(myDS->RefEdge(nE1)); - aPaveSet1.Append(aPave); - // Pave for edge nE2 - aPave.SetParam(aT2); - BOPTools_PaveSet& aPaveSet2=myPavePoolNew(myDS->RefEdge(nE2)); - aPaveSet2.Append(aPave); -} -*/ diff --git a/src/NMTTools/NMTTools_PaveFiller_5.cxx b/src/NMTTools/NMTTools_PaveFiller_5.cxx index 0c6dbab26..01ec5e0bb 100644 --- a/src/NMTTools/NMTTools_PaveFiller_5.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_5.cxx @@ -40,6 +40,8 @@ #include #include +#include + #include #include @@ -63,7 +65,7 @@ #include #include #include -#include + #include #include #include @@ -72,14 +74,15 @@ #include #include +#include +#include #include #include #include #include #include -#include -#include + static void VertexParameter(const IntTools_CommonPrt& aCPart, @@ -105,28 +108,32 @@ static BOPTools_IDMapOfPaveBlockIMapOfInteger aMapCB; BOPTools_IMapOfPaveBlock aIMPBx; // - BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences(); + BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences(); // - myDSIt.Initialize(TopAbs_EDGE, TopAbs_FACE); + myDSIt->Initialize(TopAbs_EDGE, TopAbs_FACE); // // BlockLength correction - aNbEFs=ExpectedPoolLength(); + aNbEFs=myDSIt->BlockLength(); aBlockLength=aEFs.BlockLength(); if (aNbEFs > aBlockLength) { aEFs.SetBlockLength(aNbEFs); } // - for (; myDSIt.More(); myDSIt.Next()) { - myDSIt.Current(n1, n2, bJustAdd); + for (; myDSIt->More(); myDSIt->Next()) { + myDSIt->Current(n1, n2, bJustAdd); anIndexIn = 0; // - if (myIntrPool->IsComputed(n1, n2)) { - continue; - } + //if (myIntrPool->IsComputed(n1, n2)) { + // continue; + //} // nE=n1; - nF=n2; - SortTypes(nE, nF); + nF=n2; + if (myDS->GetShapeType(n2)==TopAbs_EDGE) { + nE=n2; + nF=n1; + } + //SortTypes(nE, nF); // // all Common Blocks for face nF //XXX @@ -135,7 +142,7 @@ static NMTTools_CommonBlockAPI aCBAPIF(aLCBF); //XXX if(bJustAdd) { - myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); + //myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); continue; } // Edge @@ -246,10 +253,15 @@ static // aMapVI.Add(aNewVertex, anIndexIn); aIMPBx.Add(aPB); + // qqf + { + myIP->Add(nE, nF, Standard_True, NMTDS_TI_EF); + } + // qqt // }// if (!nVF) }// if (!bIsOnPave1 && !bIsOnPave2) - myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); + //myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); }// case TopAbs_VERTEX: break; // @@ -258,7 +270,7 @@ static // aCoinsideFlag=BOPTools_Tools::IsBlockInOnFace(aPB, aF, myContext); if (!aCoinsideFlag) { - myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); + //myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); break; } // @@ -272,9 +284,12 @@ static aMapF.Add(nF); aMapCB.Add(aPB, aMapF); } - //modified by NIZNHY-PKV Fri Jan 23 14:13:08 2004 f aIMPBx.Add(aPB); - //modified by NIZNHY-PKV Fri Jan 23 14:13:10 2004 t + // qqf + { + myIP->Add(nE, nF, Standard_True, NMTDS_TI_EF); + } + // qqt }// case TopAbs_EDGE: break; @@ -370,7 +385,7 @@ static void NMTTools_PaveFiller::EFNewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) { Standard_Integer i, j, aNb, aNewShape, aFlag, iX, aNbVV, aNbSimple; - Standard_Integer aWhat, aWith, nE, nF, nV, aNbIEF, aNbEdges; + Standard_Integer aWhat, aWith, nE, nF, nV, aNbIEF, aNbEdges, iTmp; Standard_Real aT; TopoDS_Compound aCompound; TopoDS_Vertex aNewVertex; @@ -380,7 +395,7 @@ static BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; TopTools_IndexedMapOfShape aMNVComplex, aMNVSimple; // - BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences(); + BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences(); // aNb=aMapVI.Extent(); // @@ -404,20 +419,19 @@ static // // 2. VV intersection between these vertices // using the auxiliary Filler - NMTDS_ShapesDataStructure tDS; - // - tDS.SetCompositeShape(aCompound); - tDS.Init(); - // - BOPTools_InterferencePool tInterfPool(tDS); - NMTTools_PaveFiller tPaveFiller(tInterfPool); + NMTTools_PaveFiller tPF; // - tPaveFiller.Init(); + tPF.SetCompositeShape(aCompound); // - tPaveFiller.PerformVV(); - tPaveFiller.PerformNewVertices(); + tPF.Init(); + tPF.PerformVV(); + //tPF.PerformNewVertices(); qq // - const BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterfs(); + NMTDS_ShapesDataStructure& tDS=*(tPF.DS()); + //const BOPTools_InterferencePool& tInterfPool=*(tPF.InterfPool()); + NMTDS_InterfPool& tInterfPool=*(tPF.IP()); + //const BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterfs(); + BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterferences(); // // 3. Separate Comlex and Simple new vertices aNbVV=aVVInterfs.Extent(); @@ -472,7 +486,12 @@ static iX=aMapVI.FindFromKey(aV1); const BOPTools_ESInterference& aEF1=aEFs(iX); aEF1.Indices(nE, nF); - SortTypes(nE, nF); + //SortTypes(nE, nF); + if (myDS->GetShapeType(nF)==TopAbs_EDGE) { + iTmp=nE; + nE=nF; + nF=iTmp; + } aME.Add(nE); aMIEF.Add(iX); //aWith @@ -480,7 +499,12 @@ static iX=aMapVI.FindFromKey(aV2); const BOPTools_ESInterference& aEF2=aEFs(iX); aEF2.Indices(nE, nF); - SortTypes(nE, nF); + //SortTypes(nE, nF); + if (myDS->GetShapeType(nF)==TopAbs_EDGE) { + iTmp=nE; + nE=nF; + nF=iTmp; + } aME.Add(nE); aMIEF.Add(iX); } @@ -539,7 +563,7 @@ static BOPTools_Pave aPave; BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; // - BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences(); + BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences(); // // Insert New Vertex in DS; myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); @@ -551,7 +575,10 @@ static aEFInterf.SetNewShape(aNewShape); // Extract interference info aEFInterf.Indices(nE, nF); - SortTypes(nE, nF); + //SortTypes(nE, nF); + if (myDS->GetShapeType(nF)==TopAbs_EDGE) { + nE=nF; + } const IntTools_CommonPrt& aCPart=aEFInterf.CommonPrt(); VertexParameter(aCPart, aT); // diff --git a/src/NMTTools/NMTTools_PaveFiller_6.cxx b/src/NMTTools/NMTTools_PaveFiller_6.cxx index 298162362..90b631205 100644 --- a/src/NMTTools/NMTTools_PaveFiller_6.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_6.cxx @@ -31,24 +31,36 @@ #include #include +#include +#include +#include +#include +#include -#include #include - +#include +#include #include + #include #include #include #include +#include +#include #include +#include #include #include #include #include +#include +#include +#include #include #include @@ -62,14 +74,15 @@ #include #include #include +#include #include -#include -#include -#include -#include -#include -#include +//#include +//#include +//#include +//#include +//#include + #include #include #include @@ -79,55 +92,18 @@ #include #include +#include #include +#include + +#include #include #include -#include -#include -#include -#include -// -#include -#include -#include -#include -#include -#include -#include -//// #include #include -#include + #include -#include -#include -#include -#include -#include -#include -#include #include -// -#include - -static - Standard_Boolean IsPairFound(const Standard_Integer nF1, - const Standard_Integer nF2, - BOPTools_InterferencePool* myIntrPool, - BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWhat, - BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWith); - -static - void FMapWhat(const Standard_Integer nF, - BOPTools_InterferencePool* myIntrPool, - TColStd_IndexedMapOfInteger& aMapWhat); -static - void FMapWith(const Standard_Integer nF, - BOPTools_InterferencePool* myIntrPool, - TColStd_IndexedMapOfInteger& aMapWith); -static - Standard_Boolean IsFound(const TColStd_IndexedMapOfInteger& aMapWhat, - const TColStd_IndexedMapOfInteger& aMapWith); // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN @@ -137,9 +113,11 @@ static TopTools_ListOfShape& aLS); // Contribution of Samtech www.samcef.com END +//modified by NIZNHY-PKV Mon Dec 4 12:56:04 2006f static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, IntTools_Context& aCtx); +//modified by NIZNHY-PKV Mon Dec 4 12:56:08 2006t //======================================================================= // function: PerformFF @@ -149,7 +127,7 @@ static { myIsDone=Standard_False; // - Standard_Boolean bIsFound, bJustAdd, bIsComputed; + Standard_Boolean bJustAdd;//, bIsComputed, bIsFound; Standard_Integer n1, n2, anIndexIn, nF1, nF2, aBlockLength, aNbFFs; Standard_Boolean bToApproxC3d, bToApproxC2dOnS1, bToApproxC2dOnS2, bIsDone; Standard_Integer aNbCurves, aNbPoints; @@ -159,25 +137,25 @@ static IntTools_SequenceOfCurves aCvs; BooleanOperations_KindOfInterference aTypeFF=BooleanOperations_SurfaceSurface; // - BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); + BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences(); // // F/F Interferences [BooleanOperations_SurfaceSurface] - myDSIt.Initialize(TopAbs_FACE, TopAbs_FACE); + myDSIt->Initialize(TopAbs_FACE, TopAbs_FACE); // // BlockLength correction - aNbFFs=ExpectedPoolLength(); + aNbFFs=myDSIt->BlockLength(); aBlockLength=aFFs.BlockLength(); if (aNbFFs > aBlockLength) { aFFs.SetBlockLength(aNbFFs); } // - for (; myDSIt.More(); myDSIt.Next()) { - myDSIt.Current(n1, n2, bJustAdd); + for (; myDSIt->More(); myDSIt->Next()) { + myDSIt->Current(n1, n2, bJustAdd); // - bIsComputed=myIntrPool->IsComputed(n1, n2); - if (bIsComputed) { - continue; - } + //bIsComputed=myIntrPool->IsComputed(n1, n2); + //if (bIsComputed) { + // continue; + //} // nF1 = n2; nF2 = n1; @@ -189,8 +167,8 @@ static aPnts.Clear(); aCvs.Clear(); // + /* bIsFound=IsPairFound(nF1, nF2, myIntrPool, aMapWhat, aMapWith); - // if (bJustAdd) { if (!bIsFound) { myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); @@ -202,6 +180,7 @@ static } continue; } + */ // const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));//mpv const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));//mpv @@ -222,7 +201,9 @@ static // bIsDone=aFF.IsDone(); // + if (!bIsDone) { + /* if (!bIsFound) { myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); } @@ -231,6 +212,7 @@ static anIndexIn=aFFs.Append(anInterf); myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); } + */ continue; } // @@ -251,14 +233,14 @@ static if (!aNbCurves && !aNbPoints) { BOPTools_SSInterference anInterf (nF1, nF2, 1.e-07, 1.e-07, aCvs, aPnts); anIndexIn=aFFs.Append(anInterf); - myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); + //myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); continue; } // { BOPTools_SSInterference anInterf (nF1, nF2, aTolR3D, aTolR2D, aCvsX, aPntsX); anIndexIn=aFFs.Append(anInterf); - myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); + //myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); } // }// for (; myDSIt.More(); myDSIt.Next()) @@ -278,7 +260,7 @@ static Standard_Boolean bIsExistingPaveBlock, bIsValidIn2D, bIsCoincided; // Contribution of Samtech www.samcef.com END // - Standard_Boolean bIsMicroEdge; + Standard_Boolean bIsMicroEdge, bHasES; Standard_Integer i, aNbFFs, nF1, nF2, aBid=0; Standard_Integer nV1, nV2, j, aNbCurves; Standard_Real aTolR3D, aTol2D, aT1, aT2, aTolPPC=Precision::PConfusion(); @@ -286,7 +268,7 @@ static BooleanOperations_IndexedDataMapOfShapeInteger aMapEI; BOPTools_ListIteratorOfListOfPaveBlock anIt; // - BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); + BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences(); // aNbFFs=aFFs.Extent(); // @@ -375,11 +357,9 @@ static // // 1. Produce Section Edges from intersection curves // between each pair of faces - // aNbFFs=aFFs.Extent(); // for (i=1; i<=aNbFFs; ++i) { - BOPTools_SSInterference& aFFi=aFFs(i); // // Faces @@ -456,6 +436,7 @@ static } // // Pave Blocks on Curves + bHasES=Standard_False; for (j=1; j<=aNbCurves; ++j) { BOPTools_Curve& aBC=aSCvs(j); const IntTools_Curve& aIC= aBC.Curve(); @@ -472,13 +453,12 @@ static nV2=aPBNew.Pave2().Index(); aT1=aPBNew.Pave1().Param(); aT2=aPBNew.Pave2().Param(); - // ??? + // if((nV1==nV2) && (Abs(aT2 - aT1) < aTolPPC)) { - continue;// mkk ft + continue;// mkk ft ??? } // // 1 - bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLPB, aTolR3D); if (bIsExistingPaveBlock) { continue; @@ -517,17 +497,13 @@ static // BOPTools_Tools::MakeSectEdge (aIC, aV1, aT1, aV2, aT2, aES); // - // use_01 f - // NMTTools_Tools::UpdateEdge (aES, aTolR3D); bIsMicroEdge=IsMicroEdge(aES, myContext); if (bIsMicroEdge) { continue; } // - //use_01 t - // - // SKL/PartC5 f + { Handle(Geom2d_Curve) aC2D1, aC2D2; // @@ -536,14 +512,19 @@ static // NMTTools_Tools::MakePCurve(aES, aF1, aC2D1); NMTTools_Tools::MakePCurve(aES, aF2, aC2D2); - //SKL/PartC5 t } // aMEPB.Add(aES, aPBNew); aMapEI.Add(aES, i); - } - + // + bHasES=Standard_True; + }// for (; aPBIter.More(); aPBIter.Next()) } // end of for (j=1; j<=aNbCurves; ++j) + // qqf + if (bHasES) { + myIP->Add(nF1, nF2, Standard_True, NMTDS_TI_FF); + } + // qqt }// for (i=1; i<=aNbFFs; ++i) //============================================================= // @@ -572,18 +553,14 @@ static // // // 2. Intersect SE using auxiliary Filler - NMTDS_ShapesDataStructure tDS; - // - tDS.SetCompositeShape(aCompound); - tDS.Init(); + NMTTools_PaveFiller tPF; // - BOPTools_InterferencePool tIP(tDS); - NMTTools_PaveFiller tPF(tIP); + tPF.SetCompositeShape(aCompound); // // 2.1.VV tPF.Init(); tPF.PerformVV(); - tPF.PerformNewVertices(); + //tPF.PerformNewVertices(); qq // // 2.2.VE tPF.myPavePool.Resize (tPF.myNbEdges); @@ -617,6 +594,7 @@ static BOPTools_ListIteratorOfListOfPaveBlock aIt; BOPTColStd_IndexedDataMapOfIntegerInteger aMNewOld; // + const NMTDS_ShapesDataStructure& tDS=*(tPF.DS()); const BOPTools_SplitShapesPool& aSSP=tPF.mySplitShapesPool; const NMTTools_CommonBlockPool& aCBP=tPF.myCommonBlockPool; // @@ -743,11 +721,9 @@ static aF2FWD=aF2; aF2FWD.Orientation(TopAbs_FORWARD); // - // SKL/PartC5 f NMTTools_Tools::MakePCurve(aEx, aF1FWD, aC2D1); NMTTools_Tools::MakePCurve(aEx, aF2FWD, aC2D2); NMTTools_Tools::UpdateEdge (aEx, aTolEx); - //SKL/PartC5 t } //if (aCBAPI.IsCommonBlock(aPB)) // // new SE @@ -816,13 +792,13 @@ static { Standard_Integer i, aNb, nF1, nF2, nE; Standard_Integer aNbCB, aNbF, nSp, nF; + TopAbs_ShapeEnum aType; TopoDS_Face aF1FWD, aF2FWD; TColStd_ListIteratorOfListOfInteger aItF; BOPTools_ListIteratorOfListOfPaveBlock anIt; NMTTools_ListIteratorOfListOfCommonBlock aItCB; - TopAbs_ShapeEnum aType; // - BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); + BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences(); // aNb=aFFs.Extent(); for (i=1; i<=aNb; i++) { @@ -849,7 +825,7 @@ static BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD); BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD); } - } + } // //modified by NIZNHY-PKV Fri Mar 23 10:35:02 2007f // Check common blocks between edges and faces @@ -1211,122 +1187,8 @@ static } } ///////////// -//======================================================================= -// function: IsPairFound -// purpose: -//======================================================================= -Standard_Boolean IsPairFound(const Standard_Integer nF1, - const Standard_Integer nF2, - BOPTools_InterferencePool* myIntrPool, - BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWhat, - BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWith) -{ - Standard_Boolean bIsFound; - // - if (!aMapWhat.Contains(nF1)) { - TColStd_IndexedMapOfInteger aMWhat; - FMapWhat(nF1, myIntrPool, aMWhat); - aMapWhat.Add(nF1, aMWhat); - } - // - if (!aMapWith.Contains(nF2)) { - TColStd_IndexedMapOfInteger aMWith; - FMapWith(nF2, myIntrPool, aMWith); - aMapWith.Add(nF2, aMWith); - } - // - const TColStd_IndexedMapOfInteger& aMWht=aMapWhat.FindFromKey(nF1); - const TColStd_IndexedMapOfInteger& aMWit=aMapWith.FindFromKey(nF2); - // - bIsFound=IsFound(aMWht, aMWit); - // - return bIsFound; -} -//======================================================================= -// function: FMapWhat -// purpose: -//======================================================================= -void FMapWhat(const Standard_Integer nF, - BOPTools_InterferencePool* myIntrPool, - TColStd_IndexedMapOfInteger& aMapWhat) - -{ - Standard_Integer nE, nV; - - - BooleanOperations_ShapesDataStructure* myDS=myIntrPool->DS(); - BooleanOperations_OnceExplorer aExp(*myDS); - // - // What - aMapWhat.Add(nF); - aExp.Init(nF, TopAbs_VERTEX); - for (; aExp.More(); aExp.Next()) { - nV=aExp.Current(); - aMapWhat.Add(nV); - } - // - aExp.Init(nF, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()) { - nE=aExp.Current(); - aMapWhat.Add(nE); - } -} -//======================================================================= -// function: FMapWith -// purpose: -//======================================================================= -void FMapWith(const Standard_Integer nF, - BOPTools_InterferencePool* myIntrPool, - TColStd_IndexedMapOfInteger& aMapWith) -{ - TColStd_IndexedMapOfInteger aMapWhat; - - FMapWhat(nF, myIntrPool, aMapWhat); - // - // With - Standard_Integer i, aNb, anIndex, aWhat, aWith; - BOPTools_ListIteratorOfListOfInterference anIt; - - const BOPTools_CArray1OfInterferenceLine& anArrIL= myIntrPool->InterferenceTable(); - aNb=aMapWhat.Extent(); - for (i=1; i<=aNb; i++) { - aWhat=aMapWhat(i); - - const BOPTools_InterferenceLine& aWithLine=anArrIL(aWhat); - - const BOPTools_ListOfInterference& aLI=aWithLine.List(); - anIt.Initialize(aLI); - for (; anIt.More(); anIt.Next()) { - const BOPTools_Interference& anIntf=anIt.Value(); - anIndex=anIntf.Index(); - if (anIndex) { - aWith=anIntf.With(); - aMapWith.Add(aWith); - } - } - } -} -//======================================================================= -// function: IsFound -// purpose: -//======================================================================= -Standard_Boolean IsFound(const TColStd_IndexedMapOfInteger& aMapWhat, - const TColStd_IndexedMapOfInteger& aMapWith) -{ - Standard_Boolean bFlag=Standard_False; - Standard_Integer i, aNb, aWhat; - - aNb=aMapWhat.Extent(); - for (i=1; i<=aNb; i++) { - aWhat=aMapWhat(i); - if (aMapWith.Contains(aWhat)) { - return !bFlag; - } - } - return bFlag; -} // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN //======================================================================= @@ -1475,7 +1337,7 @@ void SharedEdges1(const TopoDS_Face& aF1, // // Contribution of Samtech www.samcef.com END -// use_01 f +//modified by NIZNHY-PKV Mon Dec 4 12:30:38 2006f use_01 //======================================================================= //function : IsMicroEdge //purpose : @@ -1514,4 +1376,139 @@ Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, // return bRet; } -// use_01 t +//modified by NIZNHY-PKV Mon Dec 4 12:55:50 2006t +/* +static + Standard_Boolean IsPairFound(const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_InterferencePool* myIntrPool, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWhat, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWith); + +static + void FMapWhat(const Standard_Integer nF, + BOPTools_InterferencePool* myIntrPool, + TColStd_IndexedMapOfInteger& aMapWhat); +static + void FMapWith(const Standard_Integer nF, + BOPTools_InterferencePool* myIntrPool, + TColStd_IndexedMapOfInteger& aMapWith); +static + Standard_Boolean IsFound(const TColStd_IndexedMapOfInteger& aMapWhat, + const TColStd_IndexedMapOfInteger& aMapWith); + +//======================================================================= +// function: IsPairFound +// purpose: +//======================================================================= +Standard_Boolean IsPairFound(const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_InterferencePool* myIntrPool, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWhat, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWith) +{ + Standard_Boolean bIsFound; + // + if (!aMapWhat.Contains(nF1)) { + TColStd_IndexedMapOfInteger aMWhat; + FMapWhat(nF1, myIntrPool, aMWhat); + aMapWhat.Add(nF1, aMWhat); + } + // + if (!aMapWith.Contains(nF2)) { + TColStd_IndexedMapOfInteger aMWith; + FMapWith(nF2, myIntrPool, aMWith); + aMapWith.Add(nF2, aMWith); + } + // + const TColStd_IndexedMapOfInteger& aMWht=aMapWhat.FindFromKey(nF1); + const TColStd_IndexedMapOfInteger& aMWit=aMapWith.FindFromKey(nF2); + // + bIsFound=IsFound(aMWht, aMWit); + // + return bIsFound; +} +//======================================================================= +// function: FMapWhat +// purpose: +//======================================================================= +void FMapWhat(const Standard_Integer nF, + BOPTools_InterferencePool* myIntrPool, + TColStd_IndexedMapOfInteger& aMapWhat) + +{ + Standard_Integer nE, nV; + // + BooleanOperations_ShapesDataStructure* myDS=myIntrPool->DS(); + BooleanOperations_OnceExplorer aExp(*myDS); + // + // What + aMapWhat.Add(nF); + aExp.Init(nF, TopAbs_VERTEX); + for (; aExp.More(); aExp.Next()) { + nV=aExp.Current(); + aMapWhat.Add(nV); + } + // + aExp.Init(nF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + nE=aExp.Current(); + aMapWhat.Add(nE); + } +} +//======================================================================= +// function: FMapWith +// purpose: +//======================================================================= +void FMapWith(const Standard_Integer nF, + BOPTools_InterferencePool* myIntrPool, + TColStd_IndexedMapOfInteger& aMapWith) +{ + TColStd_IndexedMapOfInteger aMapWhat; + + FMapWhat(nF, myIntrPool, aMapWhat); + // + // With + Standard_Integer i, aNb, anIndex, aWhat, aWith; + BOPTools_ListIteratorOfListOfInterference anIt; + + const BOPTools_CArray1OfInterferenceLine& anArrIL= myIntrPool->InterferenceTable(); + + aNb=aMapWhat.Extent(); + for (i=1; i<=aNb; i++) { + aWhat=aMapWhat(i); + + const BOPTools_InterferenceLine& aWithLine=anArrIL(aWhat); + + const BOPTools_ListOfInterference& aLI=aWithLine.List(); + anIt.Initialize(aLI); + for (; anIt.More(); anIt.Next()) { + const BOPTools_Interference& anIntf=anIt.Value(); + anIndex=anIntf.Index(); + if (anIndex) { + aWith=anIntf.With(); + aMapWith.Add(aWith); + } + } + } +} +//======================================================================= +// function: IsFound +// purpose: +//======================================================================= +Standard_Boolean IsFound(const TColStd_IndexedMapOfInteger& aMapWhat, + const TColStd_IndexedMapOfInteger& aMapWith) +{ + Standard_Boolean bFlag=Standard_False; + Standard_Integer i, aNb, aWhat; + + aNb=aMapWhat.Extent(); + for (i=1; i<=aNb; i++) { + aWhat=aMapWhat(i); + if (aMapWith.Contains(aWhat)) { + return !bFlag; + } + } + return bFlag; +} +*/ diff --git a/src/NMTTools/NMTTools_PaveFiller_7.cxx b/src/NMTTools/NMTTools_PaveFiller_7.cxx index 30b69f3f0..ef23a7e29 100644 --- a/src/NMTTools/NMTTools_PaveFiller_7.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_7.cxx @@ -25,54 +25,61 @@ #include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + #include #include #include +#include +#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include + +#include #include -#include -#include -#include + #include -#include #include -#include - // #include #include #include -#include -#include -#include -#include -#include + +#include + +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN static @@ -286,7 +293,7 @@ static BOPTools_Pave aPave1, aPave2; BOPTools_PaveBlock aPB; // - BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); + BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences(); // aNbFFs=aFFs.Extent(); for (i=1; i<=aNbFFs; ++i) { @@ -371,7 +378,7 @@ static // myAloneVertices.Clear(); // - BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); + BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences(); // // 1. Collect alone vertices from FFs aNbV=0; @@ -545,6 +552,50 @@ static } } } + // qqf + { + Standard_Integer aNbF, aNbAV, nF, k; + NMTTools_IndexedDataMapOfIndexedMapOfInteger aMAVF; + // + aNbF=myAloneVertices.Extent(); + if (aNbF<2) { + return; + } + // + // 1. fill map Alone Vertex/Face -> aMAVF + for (i=1; i<=aNbF; ++i) { + nF=myAloneVertices.FindKey(i); + const TColStd_IndexedMapOfInteger& aMAV=myAloneVertices(i); + aNbAV=aMAV.Extent(); + for(j=1; j<=aNbAV; ++j) { + nV=aMAV(j); + if (aMAVF.Contains(nV)) { + TColStd_IndexedMapOfInteger& aMF=aMAVF.ChangeFromKey(nV); + aMF.Add(nF); + } + else{ + TColStd_IndexedMapOfInteger aMF; + aMF.Add(nF); + aMAVF.Add(nV, aMF); + } + } + } + // + // 2 Obtain pairs of faces + aNbAV=aMAVF.Extent(); + for (i=1; i<=aNbAV; ++i) { + const TColStd_IndexedMapOfInteger& aMF=aMAVF(i); + aNbF=aMF.Extent(); + for(j=1; jAdd(nF1, nF2, Standard_True, NMTDS_TI_FF); + } + } + } + } + // qqt } //======================================================================= // function: AloneVertices @@ -558,24 +609,22 @@ static // function: FuseVertices // purpose: //======================================================================= -void FuseVertices(const TopoDS_Shape& aCompound, - TopTools_DataMapOfShapeShape& aDMVV) + void NMTTools_PaveFiller::FuseVertices(const TopoDS_Shape& aCompound, + TopTools_DataMapOfShapeShape& aDMVV)const { Standard_Integer i, aNbVV, n1, n2, nX; - NMTDS_ShapesDataStructure tDS; - // - tDS.SetCompositeShape(aCompound); - tDS.Init(); + NMTTools_PaveFiller tPF; // - BOPTools_InterferencePool tInterfPool(tDS); - NMTTools_PaveFiller tPaveFiller(tInterfPool); + tPF.SetCompositeShape(aCompound); // - tPaveFiller.Init(); + tPF.Init(); // - tPaveFiller.PerformVV(); - tPaveFiller.PerformNewVertices(); + tPF.PerformVV(); + //tPF.PerformNewVertices(); //qq // - const BOPTools_CArray1OfVVInterference& aVVt=tInterfPool.VVInterfs(); + NMTDS_ShapesDataStructure& tDS=*(tPF.DS()); + NMTDS_InterfPool& tInterfPool=*(tPF.IP()); + BOPTools_CArray1OfVVInterference& aVVt=tInterfPool.VVInterferences(); // aNbVV=aVVt.Extent(); for (i=1; i<=aNbVV; ++i) { diff --git a/src/OBJECT/GEOM_AssemblyBuilder.cxx b/src/OBJECT/GEOM_AssemblyBuilder.cxx index cb1a8ba03..af6e55537 100644 --- a/src/OBJECT/GEOM_AssemblyBuilder.cxx +++ b/src/OBJECT/GEOM_AssemblyBuilder.cxx @@ -174,6 +174,7 @@ void GEOM_AssemblyBuilder::MeshShape(const TopoDS_Shape myShape, // Compute default deflection Bnd_Box B; BRepBndLib::Add(myShape, 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); deflection = MAX3( aXmax-aXmin , aYmax-aYmin , aZmax-aZmin) * 0.001 *4; diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx index 886adba41..52ddfbce4 100644 --- a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx @@ -103,9 +103,9 @@ void OperationGUI_ArchimedeDlg::Init() double SpecificStep1 = 0.1; double SpecificStep2 = 0.01; /* min, max, myStep and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, myStep, 3); - GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep1, 3); - GroupPoints->SpinBox_DZ->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep2, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, myStep, DBL_DIGITS_DISPLAY); + GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep1, DBL_DIGITS_DISPLAY); + GroupPoints->SpinBox_DZ->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep2, DBL_DIGITS_DISPLAY); GroupPoints->SpinBox_DX->SetValue( 100.0 ); GroupPoints->SpinBox_DY->SetValue( 1.0 ); diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.cxx b/src/OperationGUI/OperationGUI_ChamferDlg.cxx index 1a4f75ecd..29ecc1795 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.cxx +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -146,7 +146,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QW double SpecificStep = 10.0; QMap< int, DlgRef_SpinBox* >::iterator anIter; for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter ) - anIter.data()->RangeStepAndValidator( 0.001, COORD_MAX, SpecificStep, 3 ); + anIter.data()->RangeStepAndValidator( 0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY ); setHelpFileName("chamfer.htm"); diff --git a/src/OperationGUI/OperationGUI_ClippingDlg.cxx b/src/OperationGUI/OperationGUI_ClippingDlg.cxx index 9e451629f..7f4d49762 100644 --- a/src/OperationGUI/OperationGUI_ClippingDlg.cxx +++ b/src/OperationGUI/OperationGUI_ClippingDlg.cxx @@ -24,7 +24,7 @@ // File : OperationGUI_ClippingDlg.cxx // Author : Michael Zorin // Module : GEOM -// $Header: +// $Header$ #include "OperationGUI_ClippingDlg.h" #include "DlgRef_SpinBox.h" @@ -41,8 +41,6 @@ #include #include -//#include - // QT Includes #include #include @@ -109,8 +107,8 @@ OperationGUI_ClippingDlg::OperationGUI_ClippingDlg(GeometryGUI* theGeometryGUI, Layout1->addWidget( GroupArguments, 2, 0 ); /* Initialisations */ - SpinBox_Near->RangeStepAndValidator( COORD_MIN, COORD_MAX, 10.0, 3 ); - SpinBox_Far->RangeStepAndValidator( COORD_MIN, COORD_MAX, 10.0, 3 ); + SpinBox_Near->RangeStepAndValidator( COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY ); + SpinBox_Far->RangeStepAndValidator( COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY ); /* signals and slots connections */ connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); @@ -141,13 +139,13 @@ void OperationGUI_ClippingDlg::Init() SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); if (!anActiveWindow) return; - + if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) { SVTK_ViewWindow* aVTKFrame = dynamic_cast( anActiveWindow ); if( !aVTKFrame ) return; - + TextLabelNear->setText( tr( "Near" ) ); TextLabelFar->setText( tr( "Far" ) ); @@ -155,40 +153,40 @@ void OperationGUI_ClippingDlg::Init() vtkRenderer* aRenderer = aVTKFrame->getRenderer(); if(!aRenderer) return; - + vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); if( anActiveCamera == NULL ){ MESSAGE("Trying to reset clipping range of non-existant camera"); return; } - + // Find the plane equation for the camera view plane double vn[3]; anActiveCamera->GetViewPlaneNormal(vn); double position[3]; anActiveCamera->GetPosition(position); - + vtkFloatingPointType bounds[6]; aRenderer->ComputeVisiblePropBounds(bounds); - + double center[3]; center[0] = (bounds[0] + bounds[1])/2.0; center[1] = (bounds[2] + bounds[3])/2.0; center[2] = (bounds[4] + bounds[5])/2.0; - + double width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) + (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) + (bounds[5]-bounds[4])*(bounds[5]-bounds[4])); - + double distance = sqrt((position[0]-center[0])*(position[0]-center[0]) + (position[1]-center[1])*(position[1]-center[1]) + (position[2]-center[2])*(position[2]-center[2])); - + vtkFloatingPointType range[2] = {distance - width/2.0, distance + width/2.0}; - + SpinBox_Near->SetValue(range[0]); SpinBox_Far->SetValue(range[1]); - + return; } else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) @@ -200,7 +198,7 @@ void OperationGUI_ClippingDlg::Init() Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView(); - double depth, thickness; + double depth, thickness; int ztype= view3d->ZClipping(depth, thickness); SpinBox_Near->SetValue(depth); SpinBox_Far->SetValue(thickness); @@ -221,26 +219,26 @@ bool OperationGUI_ClippingDlg::ClickOnApply() SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); if (!anActiveWindow) return false; - + if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) { SVTK_ViewWindow* aVTKFrame = dynamic_cast( anActiveWindow ); if( !aVTKFrame ) return false; - + vtkRenderer* aRenderer = aVTKFrame->getRenderer(); if(!aRenderer) return false; - + vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); if( anActiveCamera == NULL ){ MESSAGE("Trying to reset clipping range of non-existant camera"); return false; } - + vtkFloatingPointType range[2] = { SpinBox_Near->GetValue(), SpinBox_Far->GetValue() }; if (range[0] < 0.0) range[0] = 0.0; anActiveCamera->SetClippingRange( range ); - + return true; } else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) @@ -248,11 +246,11 @@ bool OperationGUI_ClippingDlg::ClickOnApply() OCCViewer_ViewWindow* aOCCFrame = dynamic_cast( anActiveWindow ); Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView(); - + double depth = SpinBox_Near->GetValue(); double thickness = SpinBox_Far->GetValue(); int aType = TypeCB->currentItem(); - + view3d->SetZClippingType(V3d_TypeOfZclipping(aType)); view3d->SetZClippingDepth(depth); view3d->SetZClippingWidth(thickness); @@ -309,7 +307,7 @@ void OperationGUI_ClippingDlg::onReset() SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); if (!anActiveWindow) return; - + if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) { SVTK_ViewWindow* aVTKFrame = dynamic_cast( anActiveWindow ); @@ -318,40 +316,40 @@ void OperationGUI_ClippingDlg::onReset() vtkRenderer* aRenderer = aVTKFrame->getRenderer(); if(!aRenderer) return; - + vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); if( anActiveCamera == NULL ){ MESSAGE("Trying to reset clipping range of non-existant camera"); return; } - + // Find the plane equation for the camera view plane double vn[3]; anActiveCamera->GetViewPlaneNormal(vn); double position[3]; anActiveCamera->GetPosition(position); - + vtkFloatingPointType bounds[6]; aRenderer->ComputeVisiblePropBounds(bounds); - + double center[3]; center[0] = (bounds[0] + bounds[1])/2.0; center[1] = (bounds[2] + bounds[3])/2.0; center[2] = (bounds[4] + bounds[5])/2.0; - + double width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) + (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) + (bounds[5]-bounds[4])*(bounds[5]-bounds[4])); - + double distance = sqrt((position[0]-center[0])*(position[0]-center[0]) + (position[1]-center[1])*(position[1]-center[1]) + (position[2]-center[2])*(position[2]-center[2])); - + vtkFloatingPointType range[2] = {distance - width/2.0, distance + width/2.0}; - + SpinBox_Near->SetValue(range[0]); SpinBox_Far->SetValue(range[1]); - + return; } else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) @@ -360,12 +358,12 @@ void OperationGUI_ClippingDlg::onReset() TextLabelNear->setText( tr( "Depth" ) ); TextLabelFar->setText( tr( "Thickness" ) ); - + Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView(); - + view3d->SetZClippingType(V3d_TypeOfZclipping(0)); view3d->ZFitAll(); - double depth, thickness; + double depth, thickness; int ztype= view3d->ZClipping(depth, thickness); SpinBox_Near->SetValue(0); SpinBox_Far->SetValue(1000); diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx index 62633cd0a..e4808de4e 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.cxx +++ b/src/OperationGUI/OperationGUI_FilletDlg.cxx @@ -105,9 +105,9 @@ OperationGUI_FilletDlg::OperationGUI_FilletDlg(GeometryGUI* theGeometryGUI, QWid /***************************************************************/ double SpecificStep = 10.0; - Group1->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, 3); - Group2->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, 3); - Group3->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, 3); + Group1->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); + Group2->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); + Group3->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); setHelpFileName("fillet.htm"); diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx index 12ebfba3c..9649e3a91 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.cxx +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -67,7 +67,7 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg(GeometryGUI* theGeometryGUI RadioButton3->close(TRUE); // Full partition (contains half-space partition) - GroupPoints = new DlgRef_2Sel1List_QTD(this, "GroupPoints"); + GroupPoints = new DlgRef_2Sel1List1Check_QTD(this, "GroupPoints"); GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION")); GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); GroupPoints->TextLabel2->setText(tr("GEOM_TOOL_OBJECT")); @@ -76,6 +76,7 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg(GeometryGUI* theGeometryGUI GroupPoints->PushButton2->setPixmap(image2); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->radioButton4->setText(tr("GEOM_KEEP_NONLIMIT_SHAPES")); Layout1->addWidget(GroupPoints, 2, 0); /***************************************************************/ @@ -109,6 +110,7 @@ void OperationGUI_PartitionDlg::Init() GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_WIRE")); GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_EDGE")); GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_VERTEX")); + GroupPoints->radioButton4->setChecked(FALSE); /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); @@ -123,6 +125,8 @@ void OperationGUI_PartitionDlg::Init() connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); + connect(GroupPoints->radioButton4, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int))); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); @@ -145,7 +149,7 @@ void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId) myListKeepInside.length(0); myListRemoveInside.length(0); myListMaterials.length(0); - + switch (constructorId) { case 0: /*Full partition */ @@ -155,8 +159,8 @@ void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId) resize(0, 0); GroupPoints->TextLabel3->show(); GroupPoints->ComboBox1->show(); - GroupPoints->ComboBox1->setCurrentItem(0); + GroupPoints->radioButton4->show(); break; } case 1: /*Half-space partition */ @@ -166,6 +170,7 @@ void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId) GroupPoints->TextLabel3->hide(); GroupPoints->ComboBox1->hide(); GroupPoints->TextLabel2->setText(tr("GEOM_PLANE")); + GroupPoints->radioButton4->hide(); resize(0, 0); break; } @@ -357,15 +362,25 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects ) int aLimit = GetLimit(); int aConstructorId = getConstructorId(); - if (aConstructorId == 1) + int aKeepNonlimitShapes = 0; + if (aConstructorId == 1) { aLimit = GEOM::SHAPE; + } + else { + if(GroupPoints->radioButton4->isChecked()) { + aKeepNonlimitShapes = 1; + } + else { + aKeepNonlimitShapes = 0; + } + } if (isValid( msg )) { anObj = GEOM::GEOM_IBooleanOperations::_narrow(getOperation())-> MakePartition(myListShapes, myListTools, myListKeepInside, myListRemoveInside, - aLimit, false, myListMaterials); + aLimit, false, myListMaterials, aKeepNonlimitShapes); res = true; } diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.h b/src/OperationGUI/OperationGUI_PartitionDlg.h index dbfbd4dcc..ba321be37 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.h +++ b/src/OperationGUI/OperationGUI_PartitionDlg.h @@ -29,7 +29,7 @@ #define DIALOGBOX_PARTITION_H #include "GEOMBase_Skeleton.h" -#include "DlgRef_2Sel1List_QTD.h" +#include "DlgRef_2Sel1List1Check_QTD.h" //================================================================================= // class : OperationGUI_PartitionDlg @@ -68,7 +68,7 @@ private: GEOM::ListOfGO myListRemoveInside; GEOM::ListOfGO myListKeepInside; - DlgRef_2Sel1List_QTD* GroupPoints; + DlgRef_2Sel1List1Check_QTD* GroupPoints; private slots: void ClickOnOk(); diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx index 23e9ce46a..7230ca6a5 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -117,9 +117,9 @@ void PrimitiveGUI_BoxDlg::Init() double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); /* min, max, step and decimals for spin boxes */ - GroupDimensions->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + GroupDimensions->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); double initValue = 200.0; GroupDimensions->SpinBox_DX->SetValue(initValue); diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index 7de92356e..fd7f05cd6 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -119,12 +119,12 @@ void PrimitiveGUI_ConeDlg::Init() double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(0.000, COORD_MAX, step, 3); - GroupPoints->SpinBox_DY->RangeStepAndValidator(0.000, COORD_MAX, step, 3); - GroupPoints->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.000, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.000, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.000, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupPoints->SpinBox_DY->RangeStepAndValidator(0.000, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupPoints->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.000, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.000, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); double aRadius1(100.0), aRadius2(0.0), aHeight(300.0); GroupPoints->SpinBox_DX->SetValue(aRadius1); diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index 503211cf2..6c2b1b726 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -118,13 +118,13 @@ void PrimitiveGUI_CylinderDlg::Init() /* min, max, step and decimals for spin boxes & initial values */ /* First constructor : radius */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY); /* First constructor : algebric height */ - GroupPoints->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + GroupPoints->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); /* Second constructor : radius */ - GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); + GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY); /* Second constructor : algebric height */ - GroupDimensions->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + GroupDimensions->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); GroupPoints->SpinBox_DX->SetValue(100.0); GroupPoints->SpinBox_DY->SetValue(300.0); diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx index f52f0822a..f7a79b152 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -112,8 +112,8 @@ void PrimitiveGUI_SphereDlg::Init() double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); /* min, max, step and decimals for spin boxes */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY); GroupPoints->SpinBox_DX->SetValue(100.0); GroupDimensions->SpinBox_DX->SetValue(100.0); diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index 7ab9ca465..1f4279bca 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -17,7 +17,7 @@ // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -39,23 +39,22 @@ #include "utilities.h" -using namespace std; - //================================================================================= // class : PrimitiveGUI_TorusDlg() -// purpose : Constructs a PrimitiveGUI_TorusDlg which is a child of 'parent', with the +// purpose : Constructs a PrimitiveGUI_TorusDlg 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. //================================================================================= PrimitiveGUI_TorusDlg::PrimitiveGUI_TorusDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) + : GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | + WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_PV"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_DXYZ"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + QPixmap image0(aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TORUS_PV"))); + QPixmap image1(aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TORUS_DXYZ"))); + QPixmap image2(aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); setCaption(tr("GEOM_TORUS_TITLE")); @@ -83,8 +82,8 @@ PrimitiveGUI_TorusDlg::PrimitiveGUI_TorusDlg(GeometryGUI* theGeometryGUI, QWidge Layout1->addWidget(GroupDimensions, 2, 0); /***************************************************************/ - setHelpFileName("turus.htm"); - + setHelpFileName("turus.htm"); + Init(); } @@ -109,7 +108,7 @@ void PrimitiveGUI_TorusDlg::Init() myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); - + myPoint = myDir = GEOM::GEOM_Object::_nil(); /* Get setting of step value from file configuration */ @@ -117,10 +116,10 @@ void PrimitiveGUI_TorusDlg::Init() double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); - GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, step, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY); GroupPoints->SpinBox_DX->SetValue(300.0); GroupPoints->SpinBox_DY->SetValue(100.0); @@ -130,6 +129,7 @@ void PrimitiveGUI_TorusDlg::Init() /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); @@ -143,14 +143,18 @@ void PrimitiveGUI_TorusDlg::Init() connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); - - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; - + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), + GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), + GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), + GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), + GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + + connect(myGeomGUI->getApp()->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + initName( tr( "GEOM_TORUS" ) ); ConstructorsClicked(0); } @@ -162,36 +166,39 @@ void PrimitiveGUI_TorusDlg::Init() //================================================================================= void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId) { - disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); - - switch(constructorId) - { - case 0 : - { - globalSelection( GEOM_LINE ); - - GroupDimensions->hide(); - resize(0, 0); - GroupPoints->show(); - - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setText(tr("")); - GroupPoints->LineEdit2->setText(tr("")); - myPoint = myDir = GEOM::GEOM_Object::_nil(); - - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - break ; - } - case 1 : - { - GroupPoints->hide(); - resize( 0, 0 ); - GroupDimensions->show(); - - break ; - } + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + + switch (constructorId) + { + case 0: + { + globalSelection( GEOM_POINT ); + + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(tr("")); + GroupPoints->LineEdit2->setText(tr("")); + myPoint = myDir = GEOM::GEOM_Object::_nil(); + + connect(myGeomGUI->getApp()->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + SelectionIntoArgument(); + + break; + } + case 1: + { + GroupPoints->hide(); + resize(0, 0); + GroupDimensions->show(); + + break; } + } + displayPreview(); } @@ -217,21 +224,10 @@ bool PrimitiveGUI_TorusDlg::ClickOnApply() return false; initName(); - ConstructorsClicked( getConstructorId() ); return true; } -//======================================================================= -// function : ClickOnCancel() -// purpose : -//======================================================================= -void PrimitiveGUI_TorusDlg::ClickOnCancel() -{ - GEOMBase_Skeleton::ClickOnCancel(); -} - - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection as changed or other case @@ -240,36 +236,51 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument() { if ( getConstructorId() != 0 ) return; - + myEditCurrentArgument->setText(""); - - if(IObjectCount() != 1) - { - if(myEditCurrentArgument == GroupPoints->LineEdit1) - myPoint = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupPoints->LineEdit2) - myDir = GEOM::GEOM_Object::_nil(); - return; - } - - + + if (IObjectCount() != 1) + { + if (myEditCurrentArgument == GroupPoints->LineEdit1) + myPoint = GEOM::GEOM_Object::_nil(); + else if (myEditCurrentArgument == GroupPoints->LineEdit2) + myDir = GEOM::GEOM_Object::_nil(); + return; + } + /* nbSel == 1 */ Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); - - if(!testResult || CORBA::is_nil( aSelectedObject )) + + if (!testResult || CORBA::is_nil( aSelectedObject )) return; - - if(myEditCurrentArgument == GroupPoints->LineEdit1) + + if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = aSelectedObject; - else if(myEditCurrentArgument == GroupPoints->LineEdit2) + else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir = aSelectedObject; - + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); displayPreview(); } +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if (send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + //================================================================================= // function : SetEditCurrentArgument() // purpose : @@ -277,37 +288,21 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument() void PrimitiveGUI_TorusDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - - if(send == GroupPoints->PushButton1) { + + if (send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection( GEOM_POINT ); } - else if(send == GroupPoints->PushButton2) { + else if (send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; globalSelection( GEOM_LINE ); } - + myEditCurrentArgument->setFocus(); SelectionIntoArgument(); } -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void PrimitiveGUI_TorusDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } -} - - //================================================================================= // function : ActivateThisDialog() // purpose : @@ -315,9 +310,10 @@ void PrimitiveGUI_TorusDlg::LineEditReturnPressed() void PrimitiveGUI_TorusDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - + ConstructorsClicked( getConstructorId() ); } @@ -333,16 +329,6 @@ void PrimitiveGUI_TorusDlg::enterEvent(QEvent* e) } -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : public slot to deactivate if active -//================================================================================= -void PrimitiveGUI_TorusDlg::DeactivateActiveDialog() -{ - GEOMBase_Skeleton::DeactivateActiveDialog(); -} - - //================================================================================= // function : ValueChangedInSpinBox // purpose : @@ -380,22 +366,25 @@ bool PrimitiveGUI_TorusDlg::isValid( QString& msg ) bool PrimitiveGUI_TorusDlg::execute( ObjectList& objects ) { bool res = false; - + GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) - { - case 0 : + switch ( getConstructorId() ) { - if (!CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir )){ - anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2()); - res = true; + case 0: + { + if (!CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir )) + { + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )-> + MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2()); + res = true; + } + break; } - break; - } - case 1 : + case 1: { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeTorusRR(getRadius1(), getRadius2()); + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )-> + MakeTorusRR(getRadius1(), getRadius2()); res = true; break; } @@ -408,16 +397,6 @@ bool PrimitiveGUI_TorusDlg::execute( ObjectList& objects ) } -//================================================================================= -// function : closeEvent -// purpose : -//================================================================================= -void PrimitiveGUI_TorusDlg::closeEvent( QCloseEvent* e ) -{ - GEOMBase_Skeleton::closeEvent( e ); -} - - //================================================================================= // function : getRadius1() // purpose : diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h index 00d6a46b6..08e86ced1 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h @@ -17,7 +17,7 @@ // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -52,11 +52,10 @@ protected: virtual bool isValid( QString& ); virtual bool execute( ObjectList& objects ); - virtual void closeEvent( QCloseEvent* e ); - private: void Init(); void enterEvent(QEvent* e); + double getRadius1() const; double getRadius2() const; @@ -65,12 +64,11 @@ private: DlgRef_2Sel2Spin* GroupPoints; DlgRef_2Spin* GroupDimensions; - private slots: +private slots: void ClickOnOk(); bool ClickOnApply(); - void ClickOnCancel(); + void ActivateThisDialog(); - void DeactivateActiveDialog(); void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); diff --git a/src/RepairGUI/RepairGUI_GlueDlg.cxx b/src/RepairGUI/RepairGUI_GlueDlg.cxx index 3c017c410..1f87910ac 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.cxx +++ b/src/RepairGUI/RepairGUI_GlueDlg.cxx @@ -411,67 +411,69 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects ) bool aResult = false; objects.clear(); - switch ( getConstructorId() ) + switch ( getConstructorId() ) + { + case 0: + { + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow + ( getOperation() )->MakeGlueFaces( myObject, myTolEdt2->value(), true ); + aResult = !anObj->_is_nil(); + if ( aResult ) + objects.push_back( anObj._retn() ); + break; + } + case 1: { - case 0 : + if ( IsPreview() ) { - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow - ( getOperation() )->MakeGlueFaces( myObject, myTolEdt2->value() ); - aResult = !anObj->_is_nil(); - if ( aResult ) - objects.push_back( anObj._retn() ); - break; - } - case 1 : - if ( IsPreview() ) - { - // if this method is used for displaying preview then we must detect glue faces only - ObjectList::iterator anIter; - for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) - objects.push_back( GEOM::GEOM_Object::_duplicate( *anIter ) ); - return myTmpObjs.size() ? true : false; - } // IsPreview - - // Make glue face by list. - // Iterate through myTmpObjs and verifies where each object is currently selected or not. - QMap selected; - - // Get names of selected objects - SALOME_ListIteratorOfListIO it ( selectedIO() ); - for (; it.More(); it.Next()) - selected.insert( it.Value()->getName(), 0 ); - - // Iterate through result and select objects with names from selection - // ObjectList toRemoveFromEnggine; - ObjectList toGlue; + // if this method is used for displaying preview then we must detect glue faces only ObjectList::iterator anIter; - for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) - { - if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) ) - toGlue.push_back(*anIter); - } - - // make glue faces - GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO(); - aListForGlue->length( toGlue.size() ); - ObjectList::iterator anIter3 = toGlue.begin(); - for ( int i = 0; anIter3 != toGlue.end(); ++anIter3, ++i ) - aListForGlue[ i ] = *anIter3; - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow - ( getOperation() )->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue ); - - aResult = !anObj->_is_nil(); - - if ( aResult ) - objects.push_back( anObj._retn() ); - - // Remove from engine useless objects - clearTemporary(); - - updateButtonState(); - + for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) + objects.push_back( GEOM::GEOM_Object::_duplicate( *anIter ) ); + return myTmpObjs.size() ? true : false; + } // IsPreview + + // Make glue face by list. + // Iterate through myTmpObjs and verifies where each object is currently selected or not. + QMap selected; + + // Get names of selected objects + SALOME_ListIteratorOfListIO it ( selectedIO() ); + for (; it.More(); it.Next()) + selected.insert( it.Value()->getName(), 0 ); + + // Iterate through result and select objects with names from selection + // ObjectList toRemoveFromEnggine; + ObjectList toGlue; + ObjectList::iterator anIter; + for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) + { + if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) ) + toGlue.push_back(*anIter); + } + + // make glue faces + GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO(); + aListForGlue->length( toGlue.size() ); + ObjectList::iterator anIter3 = toGlue.begin(); + for ( int i = 0; anIter3 != toGlue.end(); ++anIter3, ++i ) + aListForGlue[ i ] = *anIter3; + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow + ( getOperation() )->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue, true ); + + aResult = !anObj->_is_nil(); + + if ( aResult ) + objects.push_back( anObj._retn() ); + + // Remove from engine useless objects + clearTemporary(); + + updateButtonState(); + break; - } // case + } // case 1 + } // switch return aResult; } diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index 88535e435..1311eb899 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -44,7 +44,7 @@ using namespace std; //================================================================================= // class : TransformationGUI_MultiRotationDlg() -// purpose : Constructs a TransformationGUI_MultiRotationDlg which is a child of 'parent', with the +// purpose : Constructs a TransformationGUI_MultiRotationDlg 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. @@ -124,13 +124,13 @@ void TransformationGUI_MultiRotationDlg::Init() double SpecificStep1 = 5; double SpecificStep2 = 1; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 10); GroupPoints->SpinBox_DX->SetValue(myNbTimes1); - GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep1, 3); - GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); - GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); + GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep1, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 10); + GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 10); GroupDimensions->SpinBox_DX1->SetValue(myAng); GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); GroupDimensions->SpinBox_DX2->SetValue(myStep); @@ -164,8 +164,8 @@ void TransformationGUI_MultiRotationDlg::Init() connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double))); connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle())); - - connect(myGeomGUI->getApp()->selectionMgr(), + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_MULTIROTATION" ) ); @@ -219,7 +219,7 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId) GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); break; - } + } } myEditCurrentArgument->setFocus(); @@ -248,7 +248,7 @@ bool TransformationGUI_MultiRotationDlg::ClickOnApply() { if ( !onAccept() ) return false; - + initName(); ConstructorsClicked( getConstructorId() ); return true; @@ -301,7 +301,7 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - + if(send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection( GEOM_ALLSHAPES ); @@ -331,10 +331,10 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || + if(send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2) { - myEditCurrentArgument = send; + myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); } } @@ -347,9 +347,9 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() void TransformationGUI_MultiRotationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - + ConstructorsClicked( getConstructorId() ); } @@ -381,7 +381,7 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox(double newValue) myStep = newValue; else if(send == GroupDimensions->SpinBox_DY2) myNbTimes2 = (int)newValue; - + displayPreview(); } @@ -431,10 +431,10 @@ bool TransformationGUI_MultiRotationDlg::isValid( QString& msg ) bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects ) { bool res = false; - + GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) + switch ( getConstructorId() ) { case 0 : { @@ -456,10 +456,10 @@ bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects ) break; } } - + if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); - + return res; } diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx index 75f3e4d35..7f5e33c15 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -45,7 +45,7 @@ using namespace std; //================================================================================= // class : TransformationGUI_MultiTranslationDlg() -// purpose : Constructs a TransformationGUI_MultiTranslationDlg which is a child of 'parent', with the +// purpose : Constructs a TransformationGUI_MultiTranslationDlg 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. @@ -127,18 +127,18 @@ void TransformationGUI_MultiTranslationDlg::Init() /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); - + double SpecificStep = 1; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 10); GroupPoints->SpinBox_DX->SetValue(myStepU); GroupPoints->SpinBox_DY->SetValue(myNbTimesU); - GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); - GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); + GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 10); + GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 10); GroupDimensions->SpinBox_DX1->SetValue(myStepU); GroupDimensions->SpinBox_DY1->SetValue(myNbTimesU); GroupDimensions->SpinBox_DX2->SetValue(myStepV); @@ -178,11 +178,10 @@ void TransformationGUI_MultiTranslationDlg::Init() connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); connect(GroupDimensions->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(ReverseStepV())); - - connect(myGeomGUI->getApp()->selectionMgr(), + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - initName( tr( "GEOM_MULTITRANSLATION" ) ); ConstructorsClicked( 0 ); } @@ -195,7 +194,7 @@ void TransformationGUI_MultiTranslationDlg::Init() void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId) { disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - + myStepU = myStepV = 50.0; myNbTimesU = myNbTimesV = 2; @@ -238,10 +237,10 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorI break; } } - + myEditCurrentArgument->setFocus(); myBase = myVectorU = GEOM::GEOM_Object::_nil(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -265,7 +264,7 @@ bool TransformationGUI_MultiTranslationDlg::ClickOnApply() { if ( !onAccept() ) return false; - + initName(); ConstructorsClicked( getConstructorId() ); return true; @@ -279,13 +278,15 @@ bool TransformationGUI_MultiTranslationDlg::ClickOnApply() void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); - - if(IObjectCount() != 1) { - if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) + + if (IObjectCount() != 1) { + if (myEditCurrentArgument == GroupPoints->LineEdit1 || + myEditCurrentArgument == GroupDimensions->LineEdit1) myBase = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) + else if (myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupDimensions->LineEdit2) myVectorU = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupDimensions->LineEdit3) + else if (myEditCurrentArgument == GroupDimensions->LineEdit3) myVectorV = GEOM::GEOM_Object::_nil(); return; } @@ -297,15 +298,17 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) ) return; - if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) - myBase = aSelectedObject; - else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) + if (myEditCurrentArgument == GroupPoints->LineEdit1 || + myEditCurrentArgument == GroupDimensions->LineEdit1) + myBase = aSelectedObject; + else if (myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupDimensions->LineEdit2) myVectorU = aSelectedObject; - else if(myEditCurrentArgument == GroupDimensions->LineEdit3) + else if (myEditCurrentArgument == GroupDimensions->LineEdit3) myVectorV = aSelectedObject; myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); - + displayPreview(); } @@ -317,7 +320,6 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; @@ -339,7 +341,7 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() myEditCurrentArgument = GroupDimensions->LineEdit3; globalSelection( GEOM_LINE ); } - + myEditCurrentArgument->setFocus(); SelectionIntoArgument(); } @@ -356,7 +358,7 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed() send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 || send == GroupDimensions->LineEdit3) { - myEditCurrentArgument = send; + myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); } } @@ -369,7 +371,7 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed() void TransformationGUI_MultiTranslationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); @@ -418,7 +420,7 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValu break; } } - + displayPreview(); } @@ -430,14 +432,14 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValu void TransformationGUI_MultiTranslationDlg::ReverseStepU() { myStepU = -myStepU; - + int aConstructorId = getConstructorId(); if(aConstructorId == 0) GroupPoints->SpinBox_DX->SetValue(myStepU); else if(aConstructorId == 1) GroupDimensions->SpinBox_DX1->SetValue(myStepU); - + displayPreview(); } @@ -449,9 +451,9 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepU() void TransformationGUI_MultiTranslationDlg::ReverseStepV() { myStepV = -myStepV; - + GroupDimensions->SpinBox_DX2->SetValue(myStepV); - + displayPreview(); } @@ -473,12 +475,12 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio bool TransformationGUI_MultiTranslationDlg::isValid( QString& msg ) { int aConstructorId = getConstructorId(); - + if(aConstructorId == 0) return !(myBase->_is_nil() || myVectorU->_is_nil()); else if(aConstructorId == 1) return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil()); - return 0; + return 0; } //================================================================================= @@ -488,10 +490,10 @@ bool TransformationGUI_MultiTranslationDlg::isValid( QString& msg ) bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects ) { bool res = false; - + GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) + switch ( getConstructorId() ) { case 0 : { @@ -512,10 +514,10 @@ bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects ) break; } } - + if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); - + return res; } diff --git a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx index 6a33e47e8..42ee42499 100644 --- a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx @@ -42,7 +42,7 @@ using namespace std; //================================================================================= // class : TransformationGUI_OffsetDlg() -// purpose : Constructs a TransformationGUI_OffsetDlg which is a child of 'parent', with the +// purpose : Constructs a TransformationGUI_OffsetDlg 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. @@ -62,7 +62,7 @@ TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(GeometryGUI* theGeometr RadioButton1->setPixmap(image0); RadioButton2->close(TRUE); RadioButton3->close(TRUE); - + GroupPoints = new DlgRef_1Sel1Spin1Check(this, "GroupPoints"); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); @@ -73,13 +73,13 @@ TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(GeometryGUI* theGeometr GroupPoints->CheckButton1->hide(); GroupPoints->PushButton1->setPixmap(image1); - + Layout1->addWidget(GroupPoints, 2, 0); - + /***************************************************************/ - setHelpFileName("offset_surface.htm"); - + setHelpFileName("offset_surface.htm"); + Init(); } @@ -89,7 +89,7 @@ TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(GeometryGUI* theGeometr // purpose : Destroys the object and frees any allocated resources //================================================================================= TransformationGUI_OffsetDlg::~TransformationGUI_OffsetDlg() -{ +{ /* no need to delete child widgets, Qt does it all for us */ } @@ -99,20 +99,18 @@ TransformationGUI_OffsetDlg::~TransformationGUI_OffsetDlg() // purpose : //================================================================================= void TransformationGUI_OffsetDlg::Init() -{ +{ /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit1->setReadOnly( true ); - + /* Get setting of step value from file configuration */ double step = 1; - + /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupPoints->SpinBox_DX->setPrecision(5); - //@ GroupPoints->SpinBox_DX->setDblPrecision(1e-05); + GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); GroupPoints->SpinBox_DX->SetValue(1e-05); - + // Activate Create a Copy mode GroupPoints->CheckButton1->setChecked(true); CreateCopyModeChanged(true); @@ -120,18 +118,17 @@ void TransformationGUI_OffsetDlg::Init() /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); - + initName( tr( "GEOM_OFFSET" ) ); globalSelection( GEOM_ALLSHAPES ); - } @@ -154,7 +151,7 @@ bool TransformationGUI_OffsetDlg::ClickOnApply() { if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) ) return false; - + initName(); return true; } @@ -180,9 +177,9 @@ void TransformationGUI_OffsetDlg::SelectionIntoArgument() GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); if (!myObjects.length()) return; - + myEditCurrentArgument->setText( aName ); - + displayPreview(); } @@ -209,7 +206,7 @@ void TransformationGUI_OffsetDlg::LineEditReturnPressed() void TransformationGUI_OffsetDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - + if(send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; @@ -237,7 +234,7 @@ void TransformationGUI_OffsetDlg::enterEvent(QEvent * e) void TransformationGUI_OffsetDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); globalSelection( GEOM_ALLSHAPES ); myEditCurrentArgument = GroupPoints->LineEdit1; @@ -292,28 +289,28 @@ bool TransformationGUI_OffsetDlg::isValid( QString& msg ) bool TransformationGUI_OffsetDlg::execute( ObjectList& objects ) { bool res = false; - + GEOM::GEOM_Object_var anObj; - - + if (GroupPoints->CheckButton1->isChecked() || IsPreview()) for (int i = 0; i < myObjects.length(); i++) - { - - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + OffsetShapeCopy( myObjects[i], GetOffset() ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } else for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShape( myObjects[i], GetOffset() ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + OffsetShape( myObjects[i], GetOffset() ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + res = true; - + return res; } diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index 39f71533b..51b85c60b 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -44,7 +44,7 @@ using namespace std; //================================================================================= // class : TransformationGUI_RotationDlg() -// purpose : Constructs a TransformationGUI_RotationDlg which is a child of 'parent', with the +// purpose : Constructs a TransformationGUI_RotationDlg 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. @@ -88,16 +88,17 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg Layout1->addWidget(GroupPoints, 2, 0); /***************************************************************/ + double anAngle = 0; double SpecificStep = 5; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); GroupPoints->SpinBox_DX->SetValue(anAngle); // Activate Create a Copy mode GroupPoints->CheckButton1->setChecked(true); CreateCopyModeChanged(true); - + /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -107,14 +108,14 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); - + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; @@ -143,9 +144,9 @@ void TransformationGUI_RotationDlg::Init() /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit2->clear(); - + myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); - + initName( tr( "GEOM_ROTATION" ) ); ConstructorsClicked( 0 ); } @@ -157,14 +158,14 @@ void TransformationGUI_RotationDlg::Init() void TransformationGUI_RotationDlg::ConstructorsClicked(int constructorId) { disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - + myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); switch (constructorId) { case 0: /* rotation an object angle and axis */ - { + { GroupPoints->ShowRows(2,3,false); resize(0,0); GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); @@ -186,11 +187,11 @@ void TransformationGUI_RotationDlg::ConstructorsClicked(int constructorId) GroupPoints->LineEdit5->clear(); myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); break; - } + } } - + myEditCurrentArgument->setFocus(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -213,7 +214,7 @@ bool TransformationGUI_RotationDlg::ClickOnApply() { if ( !onAccept( GroupPoints->CheckButton1->isChecked()) ) return false; - + initName(); ConstructorsClicked( getConstructorId() ); return true; @@ -228,7 +229,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); QString aName; - + if(myEditCurrentArgument == GroupPoints->LineEdit1) { int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); @@ -241,7 +242,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() if (!myObjects.length()) return; } - else + else { if(IObjectCount() != 1) { @@ -273,7 +274,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() aName = GEOMBase::GetName( aSelectedObject ); } myEditCurrentArgument->setText( aName ); - + displayPreview(); } @@ -285,7 +286,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() void TransformationGUI_RotationDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - + if(send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); @@ -316,7 +317,7 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument() // purpose : //================================================================================= void TransformationGUI_RotationDlg::LineEditReturnPressed() -{ +{ QLineEdit* send = (QLineEdit*)sender(); if(send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2) @@ -334,7 +335,7 @@ void TransformationGUI_RotationDlg::LineEditReturnPressed() void TransformationGUI_RotationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); @@ -380,12 +381,12 @@ bool TransformationGUI_RotationDlg::isValid( QString& msg ) { switch (getConstructorId()) { - case 0: + case 0: { return !(myObjects.length() == 0 || myAxis->_is_nil()); break; } - case 1: + case 1: { return !(myObjects.length() == 0 || myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil() ); break; @@ -405,22 +406,24 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects ) bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked(); GEOM::GEOM_Object_var anObj; - - switch ( getConstructorId() ) + + switch ( getConstructorId() ) { case 0 : { if (toCreateCopy) for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateCopy( myObjects[i], myAxis, GetAngle() * PI180 ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + RotateCopy( myObjects[i], myAxis, GetAngle() * PI180 ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } else for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->Rotate( myObjects[i], myAxis, GetAngle() * PI180 ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + Rotate( myObjects[i], myAxis, GetAngle() * PI180 ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } @@ -432,14 +435,16 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects ) if (toCreateCopy) for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePointsCopy( myObjects[i], myCentPoint, myPoint1, myPoint2 ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + RotateThreePointsCopy( myObjects[i], myCentPoint, myPoint1, myPoint2 ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } else for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePoints( myObjects[i], myCentPoint, myPoint1, myPoint2 ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + RotateThreePoints( myObjects[i], myCentPoint, myPoint1, myPoint2 ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } @@ -447,7 +452,7 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects ) break; } } - + return res; } diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx index 40e6cc20a..44ec3615a 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -44,7 +44,7 @@ using namespace std; //================================================================================= // class : TransformationGUI_ScaleDlg() -// purpose : Constructs a TransformationGUI_ScaleDlg which is a child of 'parent', with the +// purpose : Constructs a TransformationGUI_ScaleDlg 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. @@ -85,9 +85,9 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG double aFactor = 2.0; double SpecificStep = 0.5; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); GroupPoints->SpinBox_DX->SetValue(aFactor); - + // Activate Create a Copy mode GroupPoints->CheckButton1->setChecked(true); CreateCopyModeChanged(true); @@ -95,18 +95,18 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); - - connect(myGeomGUI->getApp()->selectionMgr(), + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; setHelpFileName("scale_transform.htm"); @@ -120,7 +120,7 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG // purpose : Destroys the object and frees any allocated resources //================================================================================= TransformationGUI_ScaleDlg::~TransformationGUI_ScaleDlg() -{ +{ /* no need to delete child widgets, Qt does it all for us */ } @@ -133,9 +133,9 @@ void TransformationGUI_ScaleDlg::Init() { myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit2->clear(); - + myPoint = GEOM::GEOM_Object::_nil(); - + initName( tr( "GEOM_SCALE" ) ); } @@ -200,7 +200,7 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument() aName = GEOMBase::GetName( myPoint ); } myEditCurrentArgument->setText( aName ); - + displayPreview(); } @@ -228,7 +228,7 @@ void TransformationGUI_ScaleDlg::LineEditReturnPressed() void TransformationGUI_ScaleDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - + if(send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); @@ -237,7 +237,7 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument() myEditCurrentArgument = GroupPoints->LineEdit2; globalSelection( GEOM_POINT ); } - + myEditCurrentArgument->setFocus(); SelectionIntoArgument(); } @@ -250,7 +250,7 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument() void TransformationGUI_ScaleDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); globalSelection(); GroupPoints->LineEdit1->setFocus(); @@ -305,25 +305,27 @@ bool TransformationGUI_ScaleDlg::isValid( QString& msg ) bool TransformationGUI_ScaleDlg::execute( ObjectList& objects ) { bool res = false; - + GEOM::GEOM_Object_var anObj; if (GroupPoints->CheckButton1->isChecked() || IsPreview()) for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShapeCopy( myObjects[i], myPoint, GetFactor() ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + ScaleShapeCopy( myObjects[i], myPoint, GetFactor() ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } else for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShape( myObjects[i], myPoint, GetFactor() ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + ScaleShape( myObjects[i], myPoint, GetFactor() ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } res = true; - + return res; } diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index 5e022bc88..aa29811d3 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -33,8 +33,8 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" -#include #include +#include #include "GEOMImpl_Types.hxx" @@ -44,15 +44,15 @@ using namespace std; //================================================================================= // class : TransformationGUI_TranslationDlg() -// purpose : Constructs a TransformationGUI_TranslationDlg which is a child of 'parent', with the +// purpose : Constructs a TransformationGUI_TranslationDlg 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_TranslationDlg::TransformationGUI_TranslationDlg (GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) + : GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | + WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_DXYZ"))); @@ -84,9 +84,9 @@ TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg Layout1->addWidget(GroupPoints, 2, 0); /***************************************************************/ - + setHelpFileName("translation.htm"); - + Init(); } @@ -112,26 +112,26 @@ void TransformationGUI_TranslationDlg::Init() GroupPoints->LineEdit1->setReadOnly(true); GroupPoints->LineEdit2->setReadOnly(true); GroupPoints->LineEdit3->setReadOnly(true); - + myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); - + // Activate Create a Copy mode GroupPoints->CheckBox1->setChecked(true); CreateCopyModeChanged(true); - + /* 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 & initial values */ - GroupPoints->SpinBox1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupPoints->SpinBox2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupPoints->SpinBox3->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - + GroupPoints->SpinBox1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupPoints->SpinBox2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupPoints->SpinBox3->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupPoints->SpinBox1->SetValue(0.0); GroupPoints->SpinBox2->SetValue(0.0); GroupPoints->SpinBox3->SetValue(0.0); - + /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -146,15 +146,15 @@ void TransformationGUI_TranslationDlg::Init() connect(GroupPoints->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox1, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox2, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox3, SLOT(SetStep(double))); - + connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); - - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + connect(myGeomGUI->getApp()->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_TRANSLATION" ) ); ConstructorsClicked( 0 ); @@ -167,15 +167,16 @@ void TransformationGUI_TranslationDlg::Init() //================================================================================= void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId) { + erasePreview(); disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - + myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); switch (constructorId) { case 0: /* translation an object by dx, dy, dz */ - { + { GroupPoints->ShowRows(1,2,false); resize(0,0); GroupPoints->ShowRows(3,5,true); @@ -191,7 +192,7 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId) GroupPoints->LineEdit3->clear(); myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); break; - } + } case 2: /* translation an object by vector */ { GroupPoints->ShowRows(2,5,false); @@ -203,9 +204,9 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId) break; } } - + myEditCurrentArgument->setFocus(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -229,9 +230,8 @@ bool TransformationGUI_TranslationDlg::ClickOnApply() { if ( !onAccept(GroupPoints->CheckBox1->isChecked()) ) return false; - + initName(); - ConstructorsClicked( getConstructorId() ); return true; } @@ -244,50 +244,49 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); QString aName; - - if(myEditCurrentArgument == GroupPoints->LineEdit1) + + if (myEditCurrentArgument == GroupPoints->LineEdit1) + { + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); + + if (aNbSel < 1) { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); - - if(aNbSel < 1) - { - myObjects.length(0); - return; - } - GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); - if (!myObjects.length()) - return; + myObjects.length(0); + return; } + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); + if (!myObjects.length()) + return; + } else - { - if (IObjectCount() != 1) { - if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) - myPoint1 = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) - myVector = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupPoints->LineEdit3) - myPoint2 = GEOM::GEOM_Object::_nil(); - return; - } - - Standard_Boolean testResult = Standard_False;; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); - - if (!testResult || CORBA::is_nil( aSelectedObject )) - return; - - if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) - myPoint1 = aSelectedObject; - else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) - myVector = aSelectedObject; - else if(myEditCurrentArgument == GroupPoints->LineEdit3) - myPoint2 = aSelectedObject; - - aName = GEOMBase::GetName( aSelectedObject ); + { + if (IObjectCount() != 1) { + if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) + myPoint1 = GEOM::GEOM_Object::_nil(); + else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) + myVector = GEOM::GEOM_Object::_nil(); + else if (myEditCurrentArgument == GroupPoints->LineEdit3) + myPoint2 = GEOM::GEOM_Object::_nil(); + return; } - + + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult); + + if (!testResult || CORBA::is_nil( aSelectedObject )) + return; + + if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) + myPoint1 = aSelectedObject; + else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) + myVector = aSelectedObject; + else if (myEditCurrentArgument == GroupPoints->LineEdit3) + myPoint2 = aSelectedObject; + + aName = GEOMBase::GetName( aSelectedObject ); + } + myEditCurrentArgument->setText( aName ); - displayPreview(); } @@ -299,11 +298,11 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument() void TransformationGUI_TranslationDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if (send == GroupPoints->LineEdit1) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -312,26 +311,23 @@ void TransformationGUI_TranslationDlg::LineEditReturnPressed() // purpose : //================================================================================= void TransformationGUI_TranslationDlg::SetEditCurrentArgument() -{ +{ QPushButton* send = (QPushButton*)sender(); - - if(send == GroupPoints->PushButton1) - { - myEditCurrentArgument = GroupPoints->LineEdit1; - globalSelection(); - } - else if (send == GroupPoints->PushButton2) - { - myEditCurrentArgument = GroupPoints->LineEdit2; - getConstructorId() == 1 ? globalSelection( GEOM_POINT ) : - globalSelection( GEOM_LINE ); - } - else if (send == GroupPoints->PushButton3) - { - myEditCurrentArgument = GroupPoints->LineEdit3; - globalSelection( GEOM_POINT ); - } - + + if (send == GroupPoints->PushButton1) { + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection(); + } + else if (send == GroupPoints->PushButton2) { + myEditCurrentArgument = GroupPoints->LineEdit2; + getConstructorId() == 1 ? globalSelection( GEOM_POINT ) : + globalSelection( GEOM_LINE ); + } + else if (send == GroupPoints->PushButton3) { + myEditCurrentArgument = GroupPoints->LineEdit3; + globalSelection( GEOM_POINT ); + } + myEditCurrentArgument->setFocus(); SelectionIntoArgument(); } @@ -344,7 +340,8 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument() void TransformationGUI_TranslationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); @@ -357,7 +354,7 @@ void TransformationGUI_TranslationDlg::ActivateThisDialog() //================================================================================= void TransformationGUI_TranslationDlg::enterEvent(QEvent* e) { - if(!GroupConstructors->isEnabled()) + if (!GroupConstructors->isEnabled()) ActivateThisDialog(); } @@ -378,7 +375,7 @@ void TransformationGUI_TranslationDlg::ValueChangedInSpinBox() //================================================================================= GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation() { - return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() ); + return getGeomEngine()->GetITransformOperations( getStudyId() ); } @@ -389,24 +386,24 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation() bool TransformationGUI_TranslationDlg::isValid( QString& msg ) { int aConstructorId = getConstructorId(); - + switch (aConstructorId) { - case 0: + case 0: { return !(myObjects.length() == 0 ); break; } - case 1: + case 1: { return !(myObjects.length() == 0 || myPoint1->_is_nil() || myPoint2->_is_nil() ); break; } - case 2: + case 2: { return !(myObjects.length() == 0 || myVector->_is_nil()); break; - } + } default: return false; } } @@ -419,12 +416,12 @@ bool TransformationGUI_TranslationDlg::execute( ObjectList& objects ) { bool res = false; bool toCreateCopy = IsPreview() || GroupPoints->CheckBox1->isChecked(); - + GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) + switch ( getConstructorId() ) { - case 0 : + case 0: { double dx = GroupPoints->SpinBox1->GetValue(); double dy = GroupPoints->SpinBox2->GetValue(); @@ -433,33 +430,37 @@ bool TransformationGUI_TranslationDlg::execute( ObjectList& objects ) if (toCreateCopy) for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZCopy( myObjects[i], dx, dy, dz ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + TranslateDXDYDZCopy( myObjects[i], dx, dy, dz ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } else for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZ( myObjects[i], dx, dy, dz ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + TranslateDXDYDZ( myObjects[i], dx, dy, dz ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } res = true; break; } - case 1 : + case 1: { if (toCreateCopy) for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateTwoPointsCopy( myObjects[i], myPoint1, myPoint2 ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + TranslateTwoPointsCopy( myObjects[i], myPoint1, myPoint2 ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } else for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateTwoPoints( myObjects[i], myPoint1, myPoint2 ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + TranslateTwoPoints( myObjects[i], myPoint1, myPoint2 ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } @@ -471,14 +472,16 @@ bool TransformationGUI_TranslationDlg::execute( ObjectList& objects ) if (toCreateCopy) for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVectorCopy( myObjects[i], myVector ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + TranslateVectorCopy( myObjects[i], myVector ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } else for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVector( myObjects[i], myVector ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + TranslateVector( myObjects[i], myVector ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } @@ -486,19 +489,8 @@ bool TransformationGUI_TranslationDlg::execute( ObjectList& objects ) break; } } - - return res; -} - -//================================================================================= -// function : closeEvent -// purpose : -//================================================================================= -void TransformationGUI_TranslationDlg::closeEvent( QCloseEvent* e ) -{ - // myGeomGUI->SetState( -1 ); - GEOMBase_Skeleton::closeEvent( e ); + return res; } diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.h b/src/TransformationGUI/TransformationGUI_TranslationDlg.h index 338c3ab15..dac586af0 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.h +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.h @@ -51,9 +51,7 @@ protected: virtual bool isValid( QString& ); virtual bool execute( ObjectList& objects ); - virtual void closeEvent( QCloseEvent* e ); - -private : +private: void Init(); void enterEvent(QEvent* e); @@ -69,8 +67,8 @@ private slots : void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); - void ValueChangedInSpinBox(); void ConstructorsClicked(int constructorId); + void ValueChangedInSpinBox(); void CreateCopyModeChanged(bool isCreateCopy); };