From cceb7b5b9e6c728367bdc94c596eb2bf496669e0 Mon Sep 17 00:00:00 2001 From: skv Date: Thu, 27 Nov 2014 16:09:06 +0300 Subject: [PATCH] 0022766: [EDF] Transport of names --- doc/salome/gui/GEOM/images/transfer_data1.png | Bin 0 -> 19246 bytes doc/salome/gui/GEOM/images/transfer_data2.png | Bin 0 -> 9587 bytes doc/salome/gui/GEOM/input/transfer_data.doc | 53 ++ .../gui/GEOM/input/transforming_geom_objs.doc | 2 + doc/salome/gui/GEOM/input/tui_test_others.doc | 3 + idl/GEOM_Gen.idl | 44 +- resources/CMakeLists.txt | 1 + resources/transfer_data.png | Bin 0 -> 716 bytes src/GEOMAlgo/CMakeLists.txt | 7 +- src/GEOMAlgo/FILES | 2 + src/GEOMAlgo/GEOMAlgo_GetInPlaceAPI.cxx | 450 ++++++++++++++++ src/GEOMAlgo/GEOMAlgo_GetInPlaceAPI.hxx | 111 ++++ src/GEOMGUI/GEOM_images.ts | 8 + src/GEOMGUI/GEOM_msg_en.ts | 67 +++ src/GEOMGUI/GeometryGUI.cxx | 4 + src/GEOMGUI/GeometryGUI_Operations.h | 1 + src/GEOMImpl/CMakeLists.txt | 2 + src/GEOMImpl/GEOMImpl_CopyDriver.cxx | 295 +++++++++- src/GEOMImpl/GEOMImpl_CopyDriver.hxx | 61 +-- src/GEOMImpl/GEOMImpl_IInsertOperations.cxx | 105 ++++ src/GEOMImpl/GEOMImpl_IInsertOperations.hxx | 14 + src/GEOMImpl/GEOMImpl_IShapesOperations.cxx | 502 ++---------------- src/GEOMImpl/GEOMImpl_IShapesOperations.hxx | 11 +- src/GEOMImpl/GEOMImpl_ITransferData.cxx | 137 +++++ src/GEOMImpl/GEOMImpl_ITransferData.hxx | 114 ++++ src/GEOMImpl/GEOMImpl_Types.hxx | 7 + src/GEOM_I/GEOM_IInsertOperations_i.cc | 80 +++ src/GEOM_I/GEOM_IInsertOperations_i.hh | 8 +- src/GEOM_SWIG/GEOM_TestOthers.py | 12 + src/GEOM_SWIG/geomBuilder.py | 40 ++ src/OperationGUI/CMakeLists.txt | 3 + src/OperationGUI/OperationGUI.cxx | 2 + .../OperationGUI_TransferDataDlg.cxx | 331 ++++++++++++ .../OperationGUI_TransferDataDlg.h | 68 +++ 34 files changed, 2039 insertions(+), 506 deletions(-) create mode 100644 doc/salome/gui/GEOM/images/transfer_data1.png create mode 100644 doc/salome/gui/GEOM/images/transfer_data2.png create mode 100644 doc/salome/gui/GEOM/input/transfer_data.doc create mode 100644 resources/transfer_data.png create mode 100644 src/GEOMAlgo/GEOMAlgo_GetInPlaceAPI.cxx create mode 100644 src/GEOMAlgo/GEOMAlgo_GetInPlaceAPI.hxx mode change 100755 => 100644 src/GEOMImpl/GEOMImpl_IInsertOperations.cxx create mode 100644 src/GEOMImpl/GEOMImpl_ITransferData.cxx create mode 100644 src/GEOMImpl/GEOMImpl_ITransferData.hxx mode change 100644 => 100755 src/GEOM_SWIG/geomBuilder.py create mode 100755 src/OperationGUI/OperationGUI_TransferDataDlg.cxx create mode 100644 src/OperationGUI/OperationGUI_TransferDataDlg.h diff --git a/doc/salome/gui/GEOM/images/transfer_data1.png b/doc/salome/gui/GEOM/images/transfer_data1.png new file mode 100644 index 0000000000000000000000000000000000000000..4cd196163bcf0f565370427af3a99a4b347fec77 GIT binary patch literal 19246 zcmagG1z43|n>PxgqO>$pBGTOrN|$tZNOw1=l(ck%#Fp-Eq#Nn(?(RBk|KE4!o0;#- zIeKv^o2Q?(?)z7ZAUPQ^WQ4Z}FfcI465_%NFfg!j;EV9pOYjLp#HTRu53GZNm>^8? z5Wx=k=B0s@m@v!}^zW~xoM`aLYg=)32N)QX4(JzbEDZ`i_z>Pv;rhjPc27Ndu~j_&S?%qX9H)c4nw@YZ5F+f z^FI7JVy{U2YNdkUW~s*y1=7bjEXS41gd*3BHmi{ZI-v{Mq{6 z4~``RJFVs@S}d^JxPR+= zI&AsX)-+|T;v=3f=Bd4VmA&nDE)J`IGZC8A- zf^OGjn{SXw_$-7)j--ViU!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aF=e^k%%}zmI8>UB5$JyedT!~c60SVz)9$459nW(FbKic3&AQh# z8278OL?&nzMz+xv}1xk$*sz#yn!HQ6JKAcR0)WXf~D8IqYJquiAWy0x(%913-FyiJdRa zft{J`wvBf~4w?;i#9NdRlvEtBnp~QY{*btQKHPw%G0e_`&7hs@ezogWds*xtY3OtN zIRq=vO#aUn`t@c{xYzweFxDLcJhDMg7$#O9@Pq*dg<$(-;OuH)FXJ;BnnIbZ`$RSn z$@)Xf4Ime~dlq^&eE>`%qoB~hfAUzF6A}@ra@dgo_;T=tF2L=GH~@5xuZaODVc?L> zlM`!V;41-^`FoMi<8hrS;14~vb3m_w0l3Ix@>Dt=2js~39PKH#t>(OSKwiE#gtL@r z)<=DSf(9789XJD+*DO?S?5uuPF;yLZ7r`K8VkHvZNgcuSA*yqIm{Y! +
  • Names
  • +
  • Materials
  • + + +To use this operation, select in the Main Menu Operations -> Transfer Data. +The following dialog box will appear. + +\image html transfer_data1.png "Transfer Data Dialog" + +In this dialog: +
      +
    • Source Shape is an object that is a source of non-topological data.
    • +
    • Destination Shape is a data destination object.
    • +
    • Type of detection operation is the method to search sub-shapes of + Source Shape in Destination Shape. Data are transferred + from these corresponding sub-shapes. This is a combo-box with the following + possible values: +
        +
      • Get In Place - current implementation of Get In Place algorithm + (default value).
      • +
      • Get In Place (old) - old implementation of Get In Place + algorithm.
      • +
      • Get In Place By History - Get In Place By History algorithm.
      • +
      +
    • +
    + +To copy data click on \b Apply or Apply and Close button. As the result +it is possible to see how many names and materials are copied as well as +maximum number of names and materials available for copying. This information is +provided on the following message box: + +\image html transfer_data2.png "Transfer Data Information" + +TUI Command: geompy.TransferData(ObjectFrom, ObjectTo, FindMethod), +
    where \em ObjectFrom is a data source object, \em ObjectTo is a +destination object and \em FindMethod is a same shape detection method with +default value \em GEOM.FSM_GetInPlace. + +Our TUI Scripts provide you with useful example of the use of +\ref swig_TransferData "Transfer Data" functionality. + +*/ diff --git a/doc/salome/gui/GEOM/input/transforming_geom_objs.doc b/doc/salome/gui/GEOM/input/transforming_geom_objs.doc index 573182a4d..8ded8676a 100644 --- a/doc/salome/gui/GEOM/input/transforming_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/transforming_geom_objs.doc @@ -25,6 +25,8 @@ into water. special case of \b Explode operation.
  • \subpage shared_shapes_page "Get shared shapes" operation, a special case of \b Explode operation.
  • +
  • \subpage transfer_data_page "Transfer Data" operation, which copies +non-topological data from one shape to another.
  • \subpage restore_presentation_parameters_page "Restore presentation parameters". diff --git a/doc/salome/gui/GEOM/input/tui_test_others.doc b/doc/salome/gui/GEOM/input/tui_test_others.doc index 701a1b52b..86630b77d 100644 --- a/doc/salome/gui/GEOM/input/tui_test_others.doc +++ b/doc/salome/gui/GEOM/input/tui_test_others.doc @@ -96,6 +96,9 @@ \anchor swig_GetSharedShapes \until "sharedEdge_" +\anchor swig_TransferData +\until subBlackWhite[1] + \anchor swig_CheckAndImprove \until "blocksComp" diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index dc9cf2f92..78e9bfca2 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -115,7 +115,8 @@ module GEOM * \brief Kind of method to find inside one main shape some sub-shapes, * corresponding to other given shape (its argument) * - * Is used in functions GEOM_Gen.RestoreSubShapesO(), GEOM_Gen.RestoreSubShapesSO() + * Is used in functions GEOM_Gen.RestoreSubShapesO(), GEOM_Gen.RestoreSubShapesSO(), + * TransferNames() */ enum find_shape_method { @@ -139,7 +140,10 @@ module GEOM /*! To be used only for multi-transformation result. * Only this method can be used after multi-transformation. */ - FSM_MultiTransformed + FSM_MultiTransformed, + + /*! Use old GetInPlace functionality. */ + FSM_GetInPlace_Old }; /*! @@ -3976,7 +3980,41 @@ module GEOM * \return list of all texture IDs avaiable for the current study */ ListOfLong GetAllTextures(); - + + /*! + * \brief Non-topological information transfer datum. + */ + struct TransferDatum + { + string myName; + long myNumber; + long myMaxNumber; + }; + + /*! + * \brief Sequence of non-topological information tranfer data. + */ + typedef sequence ListOfTransferDatum; + + /*! + * \brief Transfer non-topological data from one object to another + * \param theObjectFrom the source object of non-topological data + * \param theObjectTo the destination object of non-topological data + * \param theFindMethod method to search sub-shapes of theObjectFrom + * in shape theObjectTo. Possible values are: GEOM::FSM_GetInPlace, + * GEOM::FSM_GetInPlaceByHistory and GEOM::FSM_GetInPlace_Old. + * Other values of GEOM::find_shape_method are not supported. + * \param theResult statistics of the operation. Output parameter. It + * represents a sequence of Transfer Datum. A datum has the type + * (string code), the total number of items of this type and + * the number of transfered items. + * \return true in case of success; otherwise false. + */ + boolean TransferData(in GEOM_Object theObjectFrom, + in GEOM_Object theObjectTo, + in find_shape_method theFindMethod, + out ListOfTransferDatum theResult); + }; // # GEOM_IKindOfShape: diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index d887216b3..60ea6bd8a 100755 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -184,6 +184,7 @@ SET( _res_files torus.png torusdxyz.png toruspointvector.png + transfer_data.png translationDxyz.png translationPoints.png translationVector.png diff --git a/resources/transfer_data.png b/resources/transfer_data.png new file mode 100644 index 0000000000000000000000000000000000000000..275444be81c5cb2e43f778a08b7fbe1f1a13f331 GIT binary patch literal 716 zcmV;-0yF)IP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FZT01FZU(%pXi00007bV*G`2i^<} z3n~N;m133v00K-&L_t(I%hi;-Zqz^&hCh3~*(Cv#1QIP51v*BHkf7KmY_p;U35f_n zM?+1Qnj#I40SF0+28jX+p1==)O9TX@$hmpr+t}lw$Z_O^Xp@$aMjnm-^Pm4*=D>fm z`n}b#-&=hNxPa5|tpytwCl}g3YG@uU=Ci;ig<@Tp5vkxAM$Ic)KZUAFIHass zq5Ttmd3SC8$s1AM6_P1AcYLM33DKQKN-Dqt)jx!3@q5oy$!E_!_e}ER040zCtw9j< zq*yajgI!U$2}I2bwZz*j5DR!gzU#oYC~-yEybxzVA~w27=njWNlOzdAk`M&J1u=4g z4ImOi2WSt6!@Pm*0tPS#A&*8QbL;UMS#F5)lJM2aW*COoML{Mx0wvDPAm(RI>K!g>H(TU+eLnleu*^O#bnR7F;M z?MREX0p}#_LC89ZD6&0Fo??oO$`m!|(8M_fcE57R?N+O0fv3Pd;Ih1)iP*YrJYW$} yk~43A{21hwR1M>a*yhvIz|Jvat&)3v8th*-j&urha&(aZ0000 +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//======================================================================= +//function : GetInPlace +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_GetInPlaceAPI::GetInPlace + (const TopoDS_Shape &theWhere, + const TopoDS_Shape &theWhat, + GEOMAlgo_GetInPlace &theGIP) +{ + if (theWhere.IsNull() || theWhat.IsNull()) { + return Standard_False; + } + + // Compute confusion tolerance. + Standard_Real aTolConf = Precision::Confusion(); + Standard_Integer i; + + for (i = 0; i < 2; ++i) { + TopExp_Explorer anExp(i == 0 ? theWhere : theWhat, TopAbs_VERTEX); + + for (; anExp.More(); anExp.Next()) { + const TopoDS_Vertex aVtx = TopoDS::Vertex(anExp.Current()); + const Standard_Real aTolVtx = BRep_Tool::Tolerance(aVtx); + + if (aTolVtx > aTolConf) { + aTolConf = aTolVtx; + } + } + } + + // Compute mass tolerance. + Bnd_Box aBoundingBox; + Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; + Standard_Real aMassTol; + + BRepBndLib::Add(theWhere, aBoundingBox); + BRepBndLib::Add(theWhat, aBoundingBox); + aBoundingBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); + aMassTol = Max(aXmax - aXmin, aYmax - aYmin); + aMassTol = Max(aMassTol, aZmax - aZmin); + aMassTol *= aTolConf; + + // Searching for the sub-shapes inside the ShapeWhere shape + theGIP.SetTolerance(aTolConf); + theGIP.SetTolMass(aMassTol); + theGIP.SetTolCG(aTolConf); + + theGIP.SetArgument(theWhat); + theGIP.SetShapeWhere(theWhere); + + theGIP.Perform(); + + int iErr = theGIP.ErrorStatus(); + + if (iErr) { + return Standard_False; + } + + return Standard_True; +} + +//======================================================================= +//function : GetInPlaceOld +//purpose : +//======================================================================= +Standard_Integer GEOMAlgo_GetInPlaceAPI::GetInPlaceOld + (const TopoDS_Shape &theWhere, + const TopoDS_Shape &theWhat, + TopTools_ListOfShape &theShapesInPlace) +{ + theShapesInPlace.Clear(); + + if (theWhere.IsNull() || theWhat.IsNull()) { + // Error: aWhere and aWhat TopoDS_Shape are Null. + return 1; + } + + TopoDS_Shape aPntShape; + TopoDS_Vertex aVertex; + bool isFound = false; + TopAbs_ShapeEnum iType = TopAbs_SOLID; + //Standard_Real aWhat_Mass = 0., aWhere_Mass = 0.; + Standard_Real tab_aWhat[4], tab_aWhere[4]; + Standard_Real dl_l = 1e-3; + Standard_Real min_l, Tol_0D, Tol_1D, Tol_2D, Tol_3D, Tol_Mass; + Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; + Bnd_Box BoundingBox; + gp_Pnt aPnt, aPnt_aWhat, tab_Pnt[2]; + GProp_GProps aProps; + + iType = GEOMUtils::GetTypeOfSimplePart(theWhat); + if (iType == TopAbs_SHAPE) { + // Error: An attempt to extract a shape of not supported type. + return 2; + } + + TopExp_Explorer Exp_aWhat ( theWhat, iType ); + TopExp_Explorer Exp_aWhere ( theWhere, iType ); + TopExp_Explorer Exp_Edge ( theWhere, TopAbs_EDGE ); + + // Find the shortest edge in theShapeWhere shape + BRepBndLib::Add(theWhere, BoundingBox); + BoundingBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); + min_l = fabs(aXmax - aXmin); + if( min_l < fabs(aYmax - aYmin) ) min_l = fabs(aYmax - aYmin); + if( min_l < fabs(aZmax - aZmin) ) min_l = fabs(aZmax - aZmin); + min_l /= dl_l; + // Mantis issue 0020908 BEGIN + if (!Exp_Edge.More()) { + min_l = Precision::Confusion(); + } + // Mantis issue 0020908 END + for ( Standard_Integer nbEdge = 0; Exp_Edge.More(); Exp_Edge.Next(), nbEdge++ ) { + TopExp_Explorer Exp_Vertex( Exp_Edge.Current(), TopAbs_VERTEX); + for ( Standard_Integer nbVertex = 0; Exp_Vertex.More(); Exp_Vertex.Next(), nbVertex++ ) { + aPnt = BRep_Tool::Pnt( TopoDS::Vertex( Exp_Vertex.Current() ) ); + tab_Pnt[nbVertex] = aPnt; + } + if ( ! tab_Pnt[0].IsEqual(tab_Pnt[1], dl_l) ) { + BRepGProp::LinearProperties(Exp_Edge.Current(), aProps); + if ( aProps.Mass() < min_l ) min_l = aProps.Mass(); + } + } + + // Compute tolerances + Tol_0D = dl_l; + Tol_1D = dl_l * min_l; + Tol_2D = dl_l * ( min_l * min_l) * ( 2. + dl_l); + Tol_3D = dl_l * ( min_l * min_l * min_l ) * ( 3. + (3 * dl_l) + (dl_l * dl_l) ); + + if (Tol_0D < Precision::Confusion()) Tol_0D = Precision::Confusion(); + if (Tol_1D < Precision::Confusion()) Tol_1D = Precision::Confusion(); + if (Tol_2D < Precision::Confusion()) Tol_2D = Precision::Confusion(); + if (Tol_3D < Precision::Confusion()) Tol_3D = Precision::Confusion(); + + Tol_Mass = Tol_3D; + if ( iType == TopAbs_VERTEX ) Tol_Mass = Tol_0D; + else if ( iType == TopAbs_EDGE ) Tol_Mass = Tol_1D; + else if ( iType == TopAbs_FACE ) Tol_Mass = Tol_2D; + + // Searching for the sub-shapes inside the ShapeWhere shape + TopTools_MapOfShape map_aWhere; + for ( Exp_aWhere.ReInit(); Exp_aWhere.More(); Exp_aWhere.Next() ) { + if (!map_aWhere.Add(Exp_aWhere.Current())) + continue; // skip repeated shape to avoid mass addition + GetShapeProperties( Exp_aWhere.Current(), tab_aWhere, aPnt ); + for ( Exp_aWhat.ReInit(); Exp_aWhat.More(); Exp_aWhat.Next() ) { + GetShapeProperties( Exp_aWhat.Current(), tab_aWhat, aPnt_aWhat ); + if ( fabs(tab_aWhat[3] - tab_aWhere[3]) <= Tol_Mass && aPnt_aWhat.Distance(aPnt) <= Tol_1D ) + isFound = true; + else { + if ( (tab_aWhat[3] - tab_aWhere[3]) > Tol_Mass ) { + aPntShape = BRepBuilderAPI_MakeVertex( aPnt ).Shape(); + aVertex = TopoDS::Vertex( aPntShape ); + BRepExtrema_DistShapeShape aWhereDistance ( aVertex, Exp_aWhere.Current() ); + BRepExtrema_DistShapeShape aWhatDistance ( aVertex, Exp_aWhat.Current() ); + if ( aWhereDistance.IsDone() && aWhatDistance.IsDone() && + fabs(aWhereDistance.Value() - aWhatDistance.Value()) <= Tol_1D ) + { + // 0020162: "EDF 961 GEOM : Getinplace is getting additionnal orthogonal faces" + // aVertex must be projected to the same point on Where and on What + gp_Pnt pOnWhat = aWhatDistance.PointOnShape2(1); + gp_Pnt pOnWhere = aWhereDistance.PointOnShape2(1); + isFound = ( pOnWhat.Distance(pOnWhere) <= Tol_1D ); + if ( isFound && iType == TopAbs_FACE ) + { + // check normals at pOnWhat and pOnWhere + const double angleTol = M_PI/180.; + gp_Vec normToWhat = GetNormal( TopoDS::Face(Exp_aWhat.Current()), aWhatDistance); + gp_Vec normToWhere = GetNormal( TopoDS::Face(Exp_aWhere.Current()), aWhereDistance); + if ( normToWhat * normToWhere < 0 ) + normToWhat.Reverse(); + isFound = ( normToWhat.Angle( normToWhere ) < angleTol ); + } + } + } + } + if ( isFound ) { + theShapesInPlace.Append(Exp_aWhere.Current()); + //aWhere_Mass += tab_aWhere[3]; + isFound = false; + break; + } + } + } + + if (theShapesInPlace.Extent() == 0) { + // Not found any Results + return 3; + } + + return 0; +} + +//======================================================================= +//function : GetNormal +//purpose : +//======================================================================= +gp_Vec GEOMAlgo_GetInPlaceAPI::GetNormal + (const TopoDS_Face &theFace, + const BRepExtrema_DistShapeShape &theExtrema) +{ + gp_Vec defaultNorm(1,0,0); // to have same normals on different faces + try { + // get UV at extrema point + Standard_Real u,v, f,l; + switch ( theExtrema.SupportTypeShape2(1) ) { + case BRepExtrema_IsInFace: { + theExtrema.ParOnFaceS2(1, u, v ); + break; + } + case BRepExtrema_IsOnEdge: { + TopoDS_Edge edge = TopoDS::Edge( theExtrema.SupportOnShape2(1)); + Handle(Geom2d_Curve) pcurve = + BRep_Tool::CurveOnSurface(edge, theFace, f,l); + + theExtrema.ParOnEdgeS2( 1, u ); + gp_Pnt2d uv = pcurve->Value( u ); + u = uv.Coord(1); + v = uv.Coord(2); + break; + } + case BRepExtrema_IsVertex: return defaultNorm; + } + // get derivatives + BRepAdaptor_Surface surface( theFace, false ); + gp_Vec du, dv; gp_Pnt p; + surface.D1( u, v, p, du, dv ); + + return du ^ dv; + + } catch (Standard_Failure ) { + } + return defaultNorm; +} + +//======================================================================= +//function : GetShapeProperties +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlaceAPI::GetShapeProperties(const TopoDS_Shape &theShape, + Standard_Real theTab[], + gp_Pnt &theVertex) +{ + GProp_GProps aProps; + gp_Pnt aCenterMass; + Standard_Real aShapeSize; + + if (theShape.ShapeType() == TopAbs_VERTEX) { + aCenterMass = BRep_Tool::Pnt(TopoDS::Vertex(theShape)); + } else if (theShape.ShapeType() == TopAbs_EDGE) { + BRepGProp::LinearProperties(theShape, aProps); + } else if (theShape.ShapeType() == TopAbs_FACE) { + BRepGProp::SurfaceProperties(theShape, aProps); + } else { + BRepGProp::VolumeProperties(theShape, aProps); + } + + if (theShape.ShapeType() == TopAbs_VERTEX) { + aShapeSize = 1; + } else { + aCenterMass = aProps.CentreOfMass(); + aShapeSize = aProps.Mass(); + } + + theVertex = aCenterMass; + theTab[0] = theVertex.X(); + theTab[1] = theVertex.Y(); + theTab[2] = theVertex.Z(); + theTab[3] = aShapeSize; +} + +//======================================================================= +//function : GetInPlaceByHistory +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_GetInPlaceAPI::GetInPlaceByHistory + (const Handle(GEOM_Function) &theWhereFunction, + const TopTools_IndexedMapOfShape &theWhereIndices, + const TopoDS_Shape &theWhat, + TopTools_ListOfShape &theShapesInPlace) +{ + if (theWhereFunction.IsNull() || theWhat.IsNull()) + return Standard_False; + + if (theWhereIndices.Contains(theWhat)) { + // entity was not changed by the operation + theShapesInPlace.Append(theWhat); + + return Standard_True; + } + + // try to find in history + TDF_Label aHistoryLabel = theWhereFunction->GetHistoryEntry(Standard_False); + + // search in history for all argument shapes + Standard_Boolean isFound = Standard_False; + Standard_Boolean isGood = Standard_False; + + TDF_LabelSequence aLabelSeq; + theWhereFunction->GetDependency(aLabelSeq); + Standard_Integer nbArg = aLabelSeq.Length(); + + for (Standard_Integer iarg = 1; iarg <= nbArg && !isFound; iarg++) { + + TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg); + + Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel); + TopoDS_Shape anArgumentShape = anArgumentObject->GetValue(); + + TopTools_IndexedMapOfShape anArgumentIndices; + TopExp::MapShapes(anArgumentShape, anArgumentIndices); + + if (anArgumentIndices.Contains(theWhat)) { + isFound = Standard_True; + Standard_Integer aWhatIndex = anArgumentIndices.FindIndex(theWhat); + + // Find corresponding label in history + TDF_Label anArgumentHistoryLabel = + theWhereFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_False); + if (anArgumentHistoryLabel.IsNull()) { + // Lost History of operation argument. Possibly, all its entities was removed. + isGood = Standard_True; + } + else { + TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(aWhatIndex, Standard_False); + + if (aWhatHistoryLabel.IsNull()) { + // Removed entity ? Compound ? Compsolid ? Shell ? Wire + isGood = Standard_False; + } else { + Handle(TDataStd_IntegerArray) anIntegerArray; + if (!aWhatHistoryLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anIntegerArray)) { + //Error: Empty modifications history for the sought shape. + isGood = Standard_False; + } + else { + isGood = Standard_True; + Standard_Integer imod, aModifLen = anIntegerArray->Array()->Length(); + for (imod = 1; imod <= aModifLen; imod++) { + const Standard_Integer anIndex = + anIntegerArray->Array()->Value(imod); + + theShapesInPlace.Append(theWhereIndices.FindKey(anIndex)); + } + } + } + } + } + } + + isFound = isGood; + + if (!isFound) { + // try compound/compsolid/shell/wire element by element + Standard_Boolean isFoundAny = Standard_False; + TopTools_MapOfShape mapShape; + + if (theWhat.ShapeType() == TopAbs_COMPOUND || + theWhat.ShapeType() == TopAbs_COMPSOLID) { + // recursive processing of compound/compsolid + TopoDS_Iterator anIt (theWhat, Standard_True, Standard_True); + for (; anIt.More(); anIt.Next()) { + if (mapShape.Add(anIt.Value())) { + TopoDS_Shape curWhat = anIt.Value(); + isFoundAny = GetInPlaceByHistory(theWhereFunction, theWhereIndices, curWhat, theShapesInPlace); + if (isFoundAny) isFound = Standard_True; + } + } + } + else if (theWhat.ShapeType() == TopAbs_SHELL) { + // try to replace a shell by its faces images + TopExp_Explorer anExp (theWhat, TopAbs_FACE); + for (; anExp.More(); anExp.Next()) { + if (mapShape.Add(anExp.Current())) { + TopoDS_Shape curWhat = anExp.Current(); + isFoundAny = GetInPlaceByHistory(theWhereFunction, theWhereIndices, curWhat, theShapesInPlace); + if (isFoundAny) isFound = Standard_True; + } + } + } + else if (theWhat.ShapeType() == TopAbs_WIRE) { + // try to replace a wire by its edges images + TopExp_Explorer anExp (theWhat, TopAbs_EDGE); + for (; anExp.More(); anExp.Next()) { + if (mapShape.Add(anExp.Current())) { + TopoDS_Shape curWhat = anExp.Current(); + isFoundAny = GetInPlaceByHistory(theWhereFunction, theWhereIndices, curWhat, theShapesInPlace); + if (isFoundAny) isFound = Standard_True; + } + } + } + else { + // Removed entity + } + } + + return isFound; +} diff --git a/src/GEOMAlgo/GEOMAlgo_GetInPlaceAPI.hxx b/src/GEOMAlgo/GEOMAlgo_GetInPlaceAPI.hxx new file mode 100644 index 000000000..36ed52d46 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_GetInPlaceAPI.hxx @@ -0,0 +1,111 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: GEOMAlgo_GetInPlaceAPI.hxx +// Created: +// Author: Sergey KHROMOV + +#ifndef _GEOMAlgo_GetInPlaceAPI_HeaderFile +#define _GEOMAlgo_GetInPlaceAPI_HeaderFile + + +#include + +class GEOMAlgo_GetInPlace; +class Handle_GEOM_Function; +class BRepExtrema_DistShapeShape; +class TopoDS_Face; +class TopoDS_Shape; +class TopTools_IndexedMapOfShape; +class TopTools_ListOfShape; + + +/** + * This is an API class for all GetInPlace algorithm. + * It facilitates using different GetInPlace algorithms: + * a new one(GEOMAlgo_GetInPlace), an old one and + * GetInPlaceByHistory. + */ +class GEOMAlgo_GetInPlaceAPI +{ + +public: + + /** + * \brief New GetInPlace method implementation. + * Initializes the GEOMAlgo_GetInPlace object with correct parameters and + * performs computation (calls theGIP's method Perform. Returns + * Standard_True in face of success; Standard_False otherwise. + */ + Standard_EXPORT static Standard_Boolean GetInPlace + (const TopoDS_Shape &theWhere, + const TopoDS_Shape &theWhat, + GEOMAlgo_GetInPlace &theGIP); + + /*! + * \brief Old implementation of GetInPlace algoritm. + * This method searches among sub shapes of the shape theWhere parts that are + * coincident with the shape theWhat. The result list of shape is returned as + * an output parameter. It returns the error code with the following possible + * values: + * 0 - Success; + * 1 - theWhere and/or theWhat TopoDS_Shape are Null; + * 2 - An attempt to extract a shape of not supported type; + * 3 - Not found any Results. + */ + Standard_EXPORT static Standard_Integer GetInPlaceOld + (const TopoDS_Shape &theWhere, + const TopoDS_Shape &theWhat, + TopTools_ListOfShape &theShapesInPlace); + + + /** + * \brief GetInPlaceByHistory method implementation. + * Returns Standard_True if something is found. Warning: theShapesInPlace + * list is not cleared at first. + */ + Standard_EXPORT static Standard_Boolean GetInPlaceByHistory + (const Handle_GEOM_Function &theWhereFunction, + const TopTools_IndexedMapOfShape &theWhereIndices, + const TopoDS_Shape &theWhat, + TopTools_ListOfShape &theShapesInPlace); + +protected: + + /*! + * \brief Return normal to face at extrema point + */ + static gp_Vec GetNormal(const TopoDS_Face &theFace, + const BRepExtrema_DistShapeShape &theExtrema); + + /*! + * Return the global properties of the shape: center of mass and + * a size (length, area or volume depending on the shape type). + */ + static void GetShapeProperties(const TopoDS_Shape &theShape, + Standard_Real theTab[], + gp_Pnt &theVertex); + +}; + + + +#endif diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts index 8b6d59b49..43fa10a06 100644 --- a/src/GEOMGUI/GEOM_images.ts +++ b/src/GEOMGUI/GEOM_images.ts @@ -1351,6 +1351,10 @@ ICO_GET_SHARED_SHAPES shared_shapes.png + + ICO_TRANSFER_DATA + transfer_data.png + ICON_DLG_POINT_FACE pointonface.png @@ -1363,6 +1367,10 @@ ICON_DLG_SHARED_SHAPES shared_shapes.png + + ICON_DLG_TRANSFER_DATA + transfer_data.png + ICON_DLG_SCALE_ALONG_AXES scale_along_axes.png diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 8f7d8a97a..45b178e5e 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -5052,6 +5052,18 @@ Please, select face, shell or solid and try again STB_GET_SHARED_SHAPES Get shared shapes + + TOP_TRANSFER_DATA + Transfer Data + + + MEN_TRANSFER_DATA + Transfer Data + + + STB_TRANSFER_DATA + Transfer Data + TOP_EXTENSION Extend Edge or Face @@ -7184,4 +7196,59 @@ Do you want to create new material? SurfaceFromFace + + OperationGUI_TransferDataDlg + + GEOM_TRANSFER_DATA_TITLE + Transfer Data + + + GEOM_TRANSFER_DATA + Transfer Data + + + GEOM_TRANSFER_DATA_FROM + Source Shape + + + GEOM_TRANSFER_DATA_TO + Destination Shape + + + GEOM_TRANSFER_DATA_METHOD + Type of Detection Operation + + + GEOM_TD_METHOD_GETINPLACE + Get In Place + + + GEOM_TD_METHOD_GETINPLACE_OLD + Get In Place (old) + + + GEOM_TD_METHOD_GETINPLACE_HISTORY + Get In Place By History + + + GEOM_TRANSFER_DATA_INFO + Transfer Data: Information + + + GEOM_TRANSFER_DATA_NOT_COPIED + There is nothing to be copied. + + + GEOM_TRANSFER_DATA_COPIED + The following data are copied: + + + GEOM_TRANSFER_DATA_NAMES + Names: %1 of %2 + + + GEOM_TRANSFER_DATA_MATERIALS + Materials: %1 of %2 + + diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index be77999a9..a8e6f6bca 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -602,6 +602,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam ) case GEOMOp::OpSharedShapes: // MENU OPERATION - GET SHARED SHAPES case GEOMOp::OpExtrudedBoss: // MENU OPERATION - EXTRUDED BOSS case GEOMOp::OpExtrudedCut: // MENU OPERATION - EXTRUDED CUT + case GEOMOp::OpTransferData: // MENU OPERATION - TRANSFER DATA libName = "OperationGUI"; break; case GEOMOp::OpSewing: // MENU REPAIR - SEWING @@ -971,6 +972,7 @@ void GeometryGUI::initialize( CAM_Application* app ) //createGeomAction( GEOMOp::OpClipping, "CLIPPING" ); createGeomAction( GEOMOp::OpShapesOnShape, "GET_SHAPES_ON_SHAPE" ); createGeomAction( GEOMOp::OpSharedShapes, "GET_SHARED_SHAPES" ); + createGeomAction( GEOMOp::OpTransferData, "TRANSFER_DATA" ); createGeomAction( GEOMOp::OpExtrudedCut, "EXTRUDED_CUT" ); createGeomAction( GEOMOp::OpExtrudedBoss, "EXTRUDED_BOSS" ); createGeomAction( GEOMOp::OpFillet1d, "FILLET_1D" ); @@ -1214,6 +1216,7 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( GEOMOp::OpArchimede, operId, -1 ); createMenu( GEOMOp::OpShapesOnShape, operId, -1 ); createMenu( GEOMOp::OpSharedShapes, operId, -1 ); + createMenu( GEOMOp::OpTransferData, operId, -1 ); createMenu( separator(), operId, -1 ); @@ -1379,6 +1382,7 @@ void GeometryGUI::initialize( CAM_Application* app ) createTool( GEOMOp::OpArchimede, operTbId ); createTool( GEOMOp::OpShapesOnShape, operTbId ); createTool( GEOMOp::OpSharedShapes, operTbId ); + createTool( GEOMOp::OpTransferData, operTbId ); int featTbId = createTool( tr( "TOOL_FEATURES" ), QString( "GEOMModification" ) ); createTool( GEOMOp::OpFillet1d, featTbId ); diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h index 9a1e4fd40..7243340f4 100644 --- a/src/GEOMGUI/GeometryGUI_Operations.h +++ b/src/GEOMGUI/GeometryGUI_Operations.h @@ -157,6 +157,7 @@ namespace GEOMOp { OpSharedShapes = 3708, // MENU OPERATION - GET SHARED SHAPES OpExtrudedBoss = 3709, // MENU OPERATION - ETRUDED BOSS OpExtrudedCut = 3710, // MENU OPERATION - ETRUDED CUT + OpTransferData = 3711, // MENU OPERATION - TRANSFER DATA // RepairGUI -------------------//-------------------------------- OpSewing = 4000, // MENU REPAIR - SEWING OpSuppressFaces = 4001, // MENU REPAIR - SUPPRESS FACES diff --git a/src/GEOMImpl/CMakeLists.txt b/src/GEOMImpl/CMakeLists.txt index 42b467403..29436dabc 100755 --- a/src/GEOMImpl/CMakeLists.txt +++ b/src/GEOMImpl/CMakeLists.txt @@ -111,6 +111,7 @@ SET(GEOMImpl_HEADERS GEOMImpl_ICone.hxx GEOMImpl_ISphere.hxx GEOMImpl_ITorus.hxx + GEOMImpl_ITransferData.hxx GEOMImpl_IPrism.hxx GEOMImpl_IPipe.hxx GEOMImpl_IPipePath.hxx @@ -197,6 +198,7 @@ SET(GEOMImpl_SOURCES GEOMImpl_IFieldOperations.cxx GEOMImpl_IBaseIEOperations.cxx GEOMImpl_IPolyline2D.cxx + GEOMImpl_ITransferData.cxx GEOMImpl_Gen.cxx GEOMImpl_PointDriver.cxx GEOMImpl_VectorDriver.cxx diff --git a/src/GEOMImpl/GEOMImpl_CopyDriver.cxx b/src/GEOMImpl/GEOMImpl_CopyDriver.cxx index 6009804a3..427451f5e 100644 --- a/src/GEOMImpl/GEOMImpl_CopyDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_CopyDriver.cxx @@ -22,18 +22,29 @@ #include "GEOMImpl_CopyDriver.hxx" #include "GEOMImpl_ICopy.hxx" +#include "GEOMImpl_ITransferData.hxx" #include "GEOMImpl_Types.hxx" #include "GEOM_Function.hxx" #include "GEOM_Object.hxx" +#include "GEOMAlgo_GetInPlace.hxx" +#include "GEOMAlgo_GetInPlaceAPI.hxx" -#include -#include -#include #include -#include -#include +#include #include #include +#include +#include +#include +#include +#include +#include + + +#define NB_DATUM 2 +#define DATUM_NAME_INDEX 1 +#define DATUM_MATERIAL_INDEX 2 + //======================================================================= //function : GetID @@ -65,6 +76,10 @@ Standard_Integer GEOMImpl_CopyDriver::Execute(TFunction_Logbook& log) const Standard_Integer aType = aFunction->GetType(); + if (aType == TRANSFER_DATA) { + return transferData(log); + } + GEOMImpl_ICopy aCI (aFunction); TopoDS_Shape aCopy; @@ -129,6 +144,276 @@ GetCreationInformation(std::string& theOperationName, return true; } +//================================================================================ +/*! + * \brief Performs Transfer Data operation. + */ +//================================================================================ + +Standard_Integer GEOMImpl_CopyDriver::transferData(TFunction_Logbook& log) const +{ + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + GEOMImpl_ITransferData aTD (aFunction); + Handle(GEOM_Function) aRef1 = aTD.GetRef1(); + Handle(GEOM_Function) aRef2 = aTD.GetRef2(); + + if (aRef1.IsNull() || aRef2.IsNull()) { + return 0; + } + + TopoDS_Shape aShape1 = aRef1->GetValue(); + TopoDS_Shape aShape2 = aRef2->GetValue(); + const int aFindMethod = aTD.GetFindMethod(); + TopTools_IndexedDataMapOfShapeListOfShape aMapSoDest; + TopTools_IndexedMapOfShape anIndices1; + + TopExp::MapShapes(aShape1, anIndices1); + + switch (aFindMethod) { + case TD_GET_IN_PLACE: + if (!getInPlace(aShape1, anIndices1, aShape2, aMapSoDest)) { + return 0; + } + break; + case TD_GET_IN_PLACE_OLD: + if (!getInPlaceOld(aRef1, anIndices1, aShape2, aMapSoDest)) { + return 0; + } + break; + case TD_GET_IN_PLACE_BY_HISTORY: + if (!getInPlaceByHistory(aRef1, anIndices1, aShape2, aRef2, aMapSoDest)) { + return 0; + } + break; + default: + return 0; + } + + // Perform copying names. + Handle(TColStd_HArray1OfExtendedString) aDatumName = + new TColStd_HArray1OfExtendedString(1, NB_DATUM); + Handle(TColStd_HArray1OfInteger) aDatumMaxVal = + new TColStd_HArray1OfInteger(1, NB_DATUM, 0); + Handle(TColStd_HArray1OfInteger) aDatumVal = + new TColStd_HArray1OfInteger(1, NB_DATUM, 0); + GEOMImpl_ITransferData aTD1(aRef1); + GEOMImpl_ITransferData aTD2(aRef2); + Standard_Integer i; + Standard_Integer aNbShapes = anIndices1.Extent(); + TopTools_MapOfShape aMapFence; + + aDatumName->SetValue(DATUM_NAME_INDEX, "GEOM_TRANSFER_DATA_NAMES"); + aDatumName->SetValue(DATUM_MATERIAL_INDEX, "GEOM_TRANSFER_DATA_MATERIALS"); + + for (i = 1; i <= aNbShapes; ++i) { + const TopoDS_Shape &aSource = anIndices1.FindKey(i); + TCollection_AsciiString aName = aTD1.GetName(aSource); + TCollection_AsciiString aMaterial = aTD1.GetMaterial(aSource); + + // Transfer name + if (!aName.IsEmpty()) { + aDatumMaxVal->ChangeValue(DATUM_NAME_INDEX)++; + + if (aMapSoDest.Contains(aSource)) { + aDatumVal->ChangeValue(DATUM_NAME_INDEX)++; + + // Copy name to the list of subshapes of the second shape. + const TopTools_ListOfShape &aListDest = + aMapSoDest.FindFromKey(aSource); + TopTools_ListIteratorOfListOfShape anIt(aListDest); + + for (; anIt.More(); anIt.Next()) { + const TopoDS_Shape &aShapeDest = anIt.Value(); + + if (aMapFence.Add(aShapeDest)) { + aTD2.SetName(aShapeDest, aName); + } + } + } + } + + // Transfer Material + if (!aMaterial.IsEmpty()) { + aDatumMaxVal->ChangeValue(DATUM_MATERIAL_INDEX)++; + + if (aMapSoDest.Contains(aSource)) { + aDatumVal->ChangeValue(DATUM_MATERIAL_INDEX)++; + + // Copy material to the list of subshapes of the second shape. + const TopTools_ListOfShape &aListDest = + aMapSoDest.FindFromKey(aSource); + TopTools_ListIteratorOfListOfShape anIt(aListDest); + + for (; anIt.More(); anIt.Next()) { + const TopoDS_Shape &aShapeDest = anIt.Value(); + + if (aMapFence.Add(aShapeDest)) { + aTD2.SetMaterial(aShapeDest, aMaterial); + } + } + } + } + } + + // Store results. + aTD.SetDatumName(aDatumName); + aTD.SetDatumMaxVal(aDatumMaxVal); + aTD.SetDatumVal(aDatumVal); + + return 1; +} + +//================================================================================ +/*! + * \brief For each subshape of the source shape compute coinsident sub-shapes + * of the destination shape using GetInPlace method. + */ +//================================================================================ + +Standard_Boolean GEOMImpl_CopyDriver::getInPlace + (const TopoDS_Shape &theSourceShape, + const TopTools_IndexedMapOfShape &theSourceIndices, + const TopoDS_Shape &theDestinationShape, + TopTools_IndexedDataMapOfShapeListOfShape &theMapSourceDest) const +{ + // Searching for the sub-shapes inside theDestinationShape shape + GEOMAlgo_GetInPlace aGIP; + + if (!GEOMAlgo_GetInPlaceAPI::GetInPlace + (theDestinationShape, theSourceShape, aGIP)) { + return Standard_False; + } + + const GEOMAlgo_DataMapOfShapeMapOfShape &aShapesIn = aGIP.ShapesIn(); + const GEOMAlgo_DataMapOfShapeMapOfShape &aShapesOn = aGIP.ShapesOn(); + Standard_Integer i; + Standard_Integer j; + Standard_Integer aNbShapes = theSourceIndices.Extent(); + + for (i = 1; i <= aNbShapes; ++i) { + const TopoDS_Shape &aSource = theSourceIndices.FindKey(i); + TopTools_ListOfShape aListShapes2; + TopTools_MapOfShape aMapShapes2; + + for (j = 0; j < 2; ++j) { + const GEOMAlgo_DataMapOfShapeMapOfShape &aShapes2 = + j == 0 ? aShapesIn : aShapesOn; + + if (aShapes2.IsBound(aSource)) { + const TopTools_MapOfShape &aMapShapesDest = + aShapes2.Find(aSource); + TopTools_MapIteratorOfMapOfShape aMapIter(aMapShapesDest); + + for (; aMapIter.More(); aMapIter.Next()) { + const TopoDS_Shape &aShapeDest = aMapIter.Key(); + + if (aMapShapes2.Add(aShapeDest)) { + aListShapes2.Append(aShapeDest); + } + } + } + } + + if (!aListShapes2.IsEmpty()) { + theMapSourceDest.Add(aSource, aListShapes2); + } + } + + return Standard_True; +} + +//================================================================================ +/*! + * \brief For each subshape of the source shape compute coinsident sub-shapes + * of the destination shape using an old implementation + * of GetInPlace algorithm. + */ +//================================================================================ + +Standard_Boolean GEOMImpl_CopyDriver::getInPlaceOld + (const Handle(GEOM_Function) &theSourceRef, + const TopTools_IndexedMapOfShape &theSourceIndices, + const TopoDS_Shape &theDestinationShape, + TopTools_IndexedDataMapOfShapeListOfShape &theMapSourceDest) const +{ + const Standard_Integer aNbShapes = theSourceIndices.Extent(); + Standard_Integer i; + Standard_Integer iErr; + TopTools_ListOfShape aModifiedList; + GEOMImpl_ITransferData aTDSource(theSourceRef); + + for (i = 1; i <= aNbShapes; ++i) { + const TopoDS_Shape &aSource = theSourceIndices.FindKey(i); + TCollection_AsciiString aName = aTDSource.GetName(aSource); + TCollection_AsciiString aMaterial = aTDSource.GetMaterial(aSource); + + if (aName.IsEmpty() && aMaterial.IsEmpty()) { + continue; + } + + // Call old GetInPlace. + iErr = GEOMAlgo_GetInPlaceAPI::GetInPlaceOld + (theDestinationShape, aSource, aModifiedList); + + if (iErr == 3) { + // Nothing is found. Skip. + continue; + } + + if (iErr) { + // Error. + return Standard_False; + } + + theMapSourceDest.Add(aSource, aModifiedList); + } + + return Standard_True; +} + +//================================================================================ +/*! + * \brief For each subshape of the source shape compute coinsident sub-shapes + * of the destination shape using GetInPlaceByHistory algorithm. + */ +//================================================================================ + +Standard_Boolean GEOMImpl_CopyDriver::getInPlaceByHistory + (const Handle(GEOM_Function) &theSourceRef, + const TopTools_IndexedMapOfShape &theSourceIndices, + const TopoDS_Shape &theDestinationShape, + const Handle(GEOM_Function) &theDestinationRef, + TopTools_IndexedDataMapOfShapeListOfShape &theMapSourceDest) const +{ + const Standard_Integer aNbShapes = theSourceIndices.Extent(); + Standard_Integer i; + GEOMImpl_ITransferData aTDSource(theSourceRef); + TopTools_IndexedMapOfShape aDestIndices; + + TopExp::MapShapes(theDestinationShape, aDestIndices); + + for (i = 1; i <= aNbShapes; ++i) { + const TopoDS_Shape &aSource = theSourceIndices.FindKey(i); + TCollection_AsciiString aName = aTDSource.GetName(aSource); + TCollection_AsciiString aMaterial = aTDSource.GetMaterial(aSource); + + if (aName.IsEmpty() && aMaterial.IsEmpty()) { + continue; + } + + // Call GetInPlaceByHistory. + TopTools_ListOfShape aModifiedList; + const Standard_Boolean isFound = GEOMAlgo_GetInPlaceAPI::GetInPlaceByHistory + (theDestinationRef, aDestIndices, aSource, aModifiedList); + + if (isFound && !aModifiedList.IsEmpty()) { + theMapSourceDest.Add(aSource, aModifiedList); + } + } + + return Standard_True; +} + IMPLEMENT_STANDARD_HANDLE (GEOMImpl_CopyDriver,GEOM_BaseDriver); IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_CopyDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_CopyDriver.hxx b/src/GEOMImpl/GEOMImpl_CopyDriver.hxx index 66380dbb3..602bc2ddc 100644 --- a/src/GEOMImpl/GEOMImpl_CopyDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_CopyDriver.hxx @@ -26,42 +26,15 @@ #ifndef _GEOMImpl_CopyDriver_HeaderFile #define _GEOMImpl_CopyDriver_HeaderFile -#ifndef _TColStd_SequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif - -#ifndef _TFunction_Driver_HeaderFile -#include -#endif -#ifndef _TFunction_Logbook_HeaderFile -#include -#endif -#ifndef _Standard_CString_HeaderFile -#include -#endif - -class TColStd_SequenceOfExtendedString; +class TopoDS_Shape; +class TopTools_IndexedDataMapOfShapeListOfShape; +class TopTools_IndexedMapOfShape; +class Standard_GUID; #include "GEOM_BaseDriver.hxx" + DEFINE_STANDARD_HANDLE( GEOMImpl_CopyDriver, GEOM_BaseDriver ); class GEOMImpl_CopyDriver : public GEOM_BaseDriver { @@ -82,6 +55,30 @@ Standard_EXPORT ~GEOMImpl_CopyDriver() {}; std::vector& params); DEFINE_STANDARD_RTTI( GEOMImpl_CopyDriver ) + +private: + + Standard_Integer transferData(TFunction_Logbook& log) const; + + Standard_Boolean getInPlace + (const TopoDS_Shape &theSourceShape, + const TopTools_IndexedMapOfShape &theSourceIndices, + const TopoDS_Shape &theDestinationShape, + TopTools_IndexedDataMapOfShapeListOfShape &theMapSourceDest) const; + + Standard_Boolean getInPlaceOld + (const Handle(GEOM_Function) &theSourceShapeRef, + const TopTools_IndexedMapOfShape &theSourceIndices, + const TopoDS_Shape &theDestinationShape, + TopTools_IndexedDataMapOfShapeListOfShape &theMapSourceDest) const; + + Standard_Boolean getInPlaceByHistory + (const Handle(GEOM_Function) &theSourceShapeRef, + const TopTools_IndexedMapOfShape &theSourceIndices, + const TopoDS_Shape &theDestinationShape, + const Handle(GEOM_Function) &theDestinationRef, + TopTools_IndexedDataMapOfShapeListOfShape &theMapSourceDest) const; + }; #endif diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx old mode 100755 new mode 100644 index e5f5a1f94..047b17ac1 --- a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "GEOMImpl_IShapesOperations.hxx" #include "GEOMImpl_IGroupOperations.hxx" @@ -340,3 +341,107 @@ std::list GEOMImpl_IInsertOperations::GetAllTextures() SetErrorCode(OK); return id_list; } + +//============================================================================= +/*! + * TransferData + */ +//============================================================================= +bool GEOMImpl_IInsertOperations::TransferData + (const Handle(GEOM_Object) &theObjectFrom, + const Handle(GEOM_Object) &theObjectTo, + const int theFindMethod, + std::list &theResult) +{ + SetErrorCode(KO); + + if (theObjectFrom.IsNull() || theObjectTo.IsNull()) { + return false; + } + + //Add a new Transfer Data object object + Handle(GEOM_Object) aTDObj = + GetEngine()->AddObject(GetDocID(), GEOM_TRANSFER_DATA); + + //Add a Transfer Data function for created object + Handle(GEOM_Function) aFunction = + aTDObj->AddFunction(GEOMImpl_CopyDriver::GetID(), TRANSFER_DATA); + + //Check if the function is set correctly + if(aFunction->GetDriverGUID() != GEOMImpl_CopyDriver::GetID()) { + return false; + } + + Handle(GEOM_Function) aFunctionFrom = theObjectFrom->GetLastFunction(); + Handle(GEOM_Function) aFunctionTo = theObjectTo->GetLastFunction(); + + if (aFunctionFrom.IsNull() || aFunctionTo.IsNull()) { + return false; + } + + GEOMImpl_ITransferData aTD(aFunction); + + aTD.SetRef1(aFunctionFrom); + aTD.SetRef2(aFunctionTo); + aTD.SetFindMethod(theFindMethod); + + // Transfer data + try { + OCC_CATCH_SIGNALS; + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Transfer data failed"); + return false; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return false; + } + + // Fill result list of data. + theResult.clear(); + + Handle(TColStd_HArray1OfExtendedString) aDatumName = aTD.GetDatumName(); + Handle(TColStd_HArray1OfInteger) aDatumMaxVal = aTD.GetDatumMaxVal(); + Handle(TColStd_HArray1OfInteger) aDatumVal = aTD.GetDatumVal(); + + if (!aDatumName.IsNull() && !aDatumMaxVal.IsNull() && !aDatumVal.IsNull()) { + Standard_Integer i; + Standard_Integer aNbDatum = aDatumName->Length(); + + for (i = 1; i <= aNbDatum; ++i) { + if (aDatumMaxVal->Value(i) > 0) { + TransferDatum aDatum; + + aDatum.myName = TCollection_AsciiString(aDatumName->Value(i)); + aDatum.myNumber = aDatumVal->Value(i); + aDatum.myMaxNumber = aDatumMaxVal->Value(i); + theResult.push_back(aDatum); + } + } + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << "geompy.TransferData(" << theObjectFrom << ", " << theObjectTo; + pd << ", GEOM."; + + switch (theFindMethod) { + case TD_GET_IN_PLACE: + pd << "FSM_GetInPlace"; + break; + case TD_GET_IN_PLACE_OLD: + pd << "FSM_GetInPlace_Old"; + break; + case TD_GET_IN_PLACE_BY_HISTORY: + default: + pd << "FSM_GetInPlaceByHistory"; + break; + } + pd << ")"; + + SetErrorCode(OK); + + return true; +} diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx index 9341c2b8d..f9694ea4e 100644 --- a/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx @@ -49,6 +49,14 @@ class Handle_TColStd_HArray1OfByte; class GEOMImpl_IInsertOperations : public GEOM_IOperations { public: + + struct TransferDatum + { + TCollection_AsciiString myName; + long myNumber; + long myMaxNumber; + }; + Standard_EXPORT GEOMImpl_IInsertOperations(GEOM_Engine* theEngine, int theDocID); Standard_EXPORT ~GEOMImpl_IInsertOperations(); @@ -79,6 +87,12 @@ class GEOMImpl_IInsertOperations : public GEOM_IOperations { Standard_EXPORT std::list GetAllTextures(); + Standard_EXPORT bool TransferData + (const Handle(GEOM_Object) &theObjectFrom, + const Handle(GEOM_Object) &theObjectTo, + const int theFindMethod, + std::list &theResult); + private: std::vector myResMgrList; GEOMImpl_IShapesOperations* myShapesOperations; diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index 1a7c43205..fec403a59 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -25,7 +25,7 @@ // Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007 // Project : SALOME -#include +//#include #include "GEOMImpl_IShapesOperations.hxx" @@ -55,62 +55,32 @@ #include "GEOMAlgo_ClsfBox.hxx" #include "GEOMAlgo_ClsfSolid.hxx" -#include "GEOMAlgo_CoupleOfShapes.hxx" #include "GEOMAlgo_FinderShapeOn1.hxx" #include "GEOMAlgo_FinderShapeOnQuad.hxx" #include "GEOMAlgo_FinderShapeOn2.hxx" #include "GEOMAlgo_GetInPlace.hxx" +#include "GEOMAlgo_GetInPlaceAPI.hxx" #include "GEOMAlgo_GlueDetector.hxx" -#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx" -#include "GEOMAlgo_ListOfCoupleOfShapes.hxx" - -#include #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 @@ -126,59 +96,15 @@ #include #include #include -#include #include #include -#include -#include -#include #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC namespace { - //================================================================================ - /*! - * \brief Return normal to face at extrema point - */ - //================================================================================ - - gp_Vec GetNormal (const TopoDS_Face& face, const BRepExtrema_DistShapeShape& extrema) - { - gp_Vec defaultNorm(1,0,0); // to have same normals on different faces - try { - // get UV at extrema point - Standard_Real u,v, f,l; - switch ( extrema.SupportTypeShape2(1) ) { - case BRepExtrema_IsInFace: { - extrema.ParOnFaceS2(1, u, v ); - break; - } - case BRepExtrema_IsOnEdge: { - TopoDS_Edge edge = TopoDS::Edge( extrema.SupportOnShape2(1)); - Handle(Geom2d_Curve) pcurve = BRep_Tool::CurveOnSurface( edge, face, f,l ); - extrema.ParOnEdgeS2( 1, u ); - gp_Pnt2d uv = pcurve->Value( u ); - u = uv.Coord(1); - v = uv.Coord(2); - break; - } - case BRepExtrema_IsVertex: return defaultNorm; - } - // get derivatives - BRepAdaptor_Surface surface( face, false ); - gp_Vec du, dv; gp_Pnt p; - surface.D1( u, v, p, du, dv ); - - return du ^ dv; - - } catch (Standard_Failure ) { - } - return defaultNorm; - } - void AddFlatSubShapes(const TopoDS_Shape& S, TopTools_ListOfShape& L, TopTools_MapOfShape& M) { if (S.ShapeType() != TopAbs_COMPOUND) { @@ -3966,165 +3892,6 @@ Handle(TColStd_HSequenceOfInteger) return aSeqOfIDs; } -//============================================================================= -/*! - * GetInPlaceOfShape - */ -//============================================================================= -static bool GetInPlaceOfShape (const Handle(GEOM_Function)& theWhereFunction, - const TopTools_IndexedMapOfShape& theWhereIndices, - const TopoDS_Shape& theWhat, - TColStd_ListOfInteger& theModifiedList) -{ - if (theWhereFunction.IsNull() || theWhat.IsNull()) return false; - - if (theWhereIndices.Contains(theWhat)) { - // entity was not changed by the operation - Standard_Integer aWhatIndex = theWhereIndices.FindIndex(theWhat); - theModifiedList.Append(aWhatIndex); - return true; - } - - // try to find in history - TDF_Label aHistoryLabel = theWhereFunction->GetHistoryEntry(Standard_False); - - // search in history for all argument shapes - Standard_Boolean isFound = Standard_False; - Standard_Boolean isGood = Standard_False; - - TDF_LabelSequence aLabelSeq; - theWhereFunction->GetDependency(aLabelSeq); - Standard_Integer nbArg = aLabelSeq.Length(); - - for (Standard_Integer iarg = 1; iarg <= nbArg && !isFound; iarg++) { - - TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg); - - Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel); - TopoDS_Shape anArgumentShape = anArgumentObject->GetValue(); - - TopTools_IndexedMapOfShape anArgumentIndices; - TopExp::MapShapes(anArgumentShape, anArgumentIndices); - - if (anArgumentIndices.Contains(theWhat)) { - isFound = Standard_True; - Standard_Integer aWhatIndex = anArgumentIndices.FindIndex(theWhat); - - // Find corresponding label in history - TDF_Label anArgumentHistoryLabel = - theWhereFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_False); - if (anArgumentHistoryLabel.IsNull()) { - // Lost History of operation argument. Possibly, all its entities was removed. - isGood = Standard_True; - } - else { - TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(aWhatIndex, Standard_False); - - if (aWhatHistoryLabel.IsNull()) { - // Removed entity ? Compound ? Compsolid ? Shell ? Wire - isGood = Standard_False; - } else { - Handle(TDataStd_IntegerArray) anIntegerArray; - if (!aWhatHistoryLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anIntegerArray)) { - //Error: Empty modifications history for the sought shape. - isGood = Standard_False; - } - else { - isGood = Standard_True; - Standard_Integer imod, aModifLen = anIntegerArray->Array()->Length(); - for (imod = 1; imod <= aModifLen; imod++) { - theModifiedList.Append(anIntegerArray->Array()->Value(imod)); - } - } - } - } - } - } - - isFound = isGood; - - if (!isFound) { - // try compound/compsolid/shell/wire element by element - bool isFoundAny = false; - TopTools_MapOfShape mapShape; - - if (theWhat.ShapeType() == TopAbs_COMPOUND || - theWhat.ShapeType() == TopAbs_COMPSOLID) { - // recursive processing of compound/compsolid - TopoDS_Iterator anIt (theWhat, Standard_True, Standard_True); - for (; anIt.More(); anIt.Next()) { - if (mapShape.Add(anIt.Value())) { - TopoDS_Shape curWhat = anIt.Value(); - isFoundAny = GetInPlaceOfShape(theWhereFunction, theWhereIndices, curWhat, theModifiedList); - if (isFoundAny) isFound = Standard_True; - } - } - } - else if (theWhat.ShapeType() == TopAbs_SHELL) { - // try to replace a shell by its faces images - TopExp_Explorer anExp (theWhat, TopAbs_FACE); - for (; anExp.More(); anExp.Next()) { - if (mapShape.Add(anExp.Current())) { - TopoDS_Shape curWhat = anExp.Current(); - isFoundAny = GetInPlaceOfShape(theWhereFunction, theWhereIndices, curWhat, theModifiedList); - if (isFoundAny) isFound = Standard_True; - } - } - } - else if (theWhat.ShapeType() == TopAbs_WIRE) { - // try to replace a wire by its edges images - TopExp_Explorer anExp (theWhat, TopAbs_EDGE); - for (; anExp.More(); anExp.Next()) { - if (mapShape.Add(anExp.Current())) { - TopoDS_Shape curWhat = anExp.Current(); - isFoundAny = GetInPlaceOfShape(theWhereFunction, theWhereIndices, curWhat, theModifiedList); - if (isFoundAny) isFound = Standard_True; - } - } - } - else { - // Removed entity - } - } - - return isFound; -} - -//============================================================================= -/*! - * GetShapeProperties - */ -//============================================================================= -void GEOMImpl_IShapesOperations::GetShapeProperties( const TopoDS_Shape aShape, Standard_Real tab[], - gp_Pnt & aVertex ) -{ - GProp_GProps theProps; - gp_Pnt aCenterMass; - //TopoDS_Shape aPntShape; - Standard_Real aShapeSize; - - if (aShape.ShapeType() == TopAbs_VERTEX) aCenterMass = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); - else if (aShape.ShapeType() == TopAbs_EDGE) BRepGProp::LinearProperties(aShape, theProps); - else if (aShape.ShapeType() == TopAbs_FACE) BRepGProp::SurfaceProperties(aShape, theProps); - else BRepGProp::VolumeProperties(aShape, theProps); - - if (aShape.ShapeType() == TopAbs_VERTEX) - aShapeSize = 1; - else { - aCenterMass = theProps.CentreOfMass(); - aShapeSize = theProps.Mass(); - } - -// aPntShape = BRepBuilderAPI_MakeVertex(aCenterMass).Shape(); -// aVertex = BRep_Tool::Pnt( TopoDS::Vertex( aPntShape ) ); - aVertex = aCenterMass; - tab[0] = aVertex.X(); - tab[1] = aVertex.Y(); - tab[2] = aVertex.Z(); - tab[3] = aShapeSize; - return; -} - //============================================================================= /*! * case GetInPlace: @@ -4146,47 +3913,10 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) return NULL; } - // Compute confusion tolerance. - Standard_Real aTolConf = Precision::Confusion(); - Standard_Integer i; - - for (i = 0; i < 2; ++i) { - TopExp_Explorer anExp(i == 0 ? aWhere : aWhat, TopAbs_VERTEX); - - for (; anExp.More(); anExp.Next()) { - const TopoDS_Vertex aVtx = TopoDS::Vertex(anExp.Current()); - const Standard_Real aTolVtx = BRep_Tool::Tolerance(aVtx); - - if (aTolVtx > aTolConf) { - aTolConf = aTolVtx; - } - } - } - - // Compute mass tolerance. - Bnd_Box aBoundingBox; - Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; - Standard_Real aMassTol; - - BRepBndLib::Add(aWhere, aBoundingBox); - BRepBndLib::Add(aWhat, aBoundingBox); - aBoundingBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); - aMassTol = Max(aXmax - aXmin, aYmax - aYmin); - aMassTol = Max(aMassTol, aZmax - aZmin); - aMassTol *= aTolConf; - // Searching for the sub-shapes inside the ShapeWhere shape GEOMAlgo_GetInPlace aGIP; - aGIP.SetTolerance(aTolConf); - aGIP.SetTolMass(aMassTol); - aGIP.SetTolCG(aTolConf); - aGIP.SetArgument(aWhat); - aGIP.SetShapeWhere(aWhere); - - aGIP.Perform(); - int iErr = aGIP.ErrorStatus(); - if (iErr) { + if (!GEOMAlgo_GetInPlaceAPI::GetInPlace(aWhere, aWhat, aGIP)) { SetErrorCode("Error in GEOMAlgo_GetInPlace"); return NULL; } @@ -4263,201 +3993,59 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) * default: */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceOld (Handle(GEOM_Object) theShapeWhere, - Handle(GEOM_Object) theShapeWhat) +Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceOld + (Handle(GEOM_Object) theShapeWhere, + Handle(GEOM_Object) theShapeWhat) { SetErrorCode(KO); if (theShapeWhere.IsNull() || theShapeWhat.IsNull()) return NULL; - TopoDS_Shape aWhere = theShapeWhere->GetValue(); - TopoDS_Shape aWhat = theShapeWhat->GetValue(); - TopoDS_Shape aPntShape; - TopoDS_Vertex aVertex; + TopoDS_Shape aWhere = theShapeWhere->GetValue(); + TopoDS_Shape aWhat = theShapeWhat->GetValue(); + TopTools_ListOfShape aModifiedList; + const Standard_Integer iErr = + GEOMAlgo_GetInPlaceAPI::GetInPlaceOld(aWhere, aWhat, aModifiedList); - if (aWhere.IsNull() || aWhat.IsNull()) { - SetErrorCode("Error: aWhere and aWhat TopoDS_Shape are Null."); - return NULL; - } + if (iErr) { + switch (iErr) { + case 1: + SetErrorCode("Error: aWhere and aWhat TopoDS_Shape are Null."); + break; + case 2: + SetErrorCode + ("Error: An attempt to extract a shape of not supported type."); + break; + case 3: + SetErrorCode(NOT_FOUND_ANY); + break; + default: + SetErrorCode("Shape driver failed"); + break; + } - Handle(GEOM_Function) aWhereFunction = theShapeWhere->GetLastFunction(); - if (aWhereFunction.IsNull()) { - SetErrorCode("Error: aWhereFunction is Null."); return NULL; } TopTools_IndexedMapOfShape aWhereIndices; TopExp::MapShapes(aWhere, aWhereIndices); - TColStd_ListOfInteger aModifiedList; - Standard_Integer aWhereIndex; - Handle(TColStd_HArray1OfInteger) aModifiedArray; - Handle(GEOM_Object) aResult; - - bool isFound = false; - TopAbs_ShapeEnum iType = TopAbs_SOLID; - //Standard_Real aWhat_Mass = 0., aWhere_Mass = 0.; - Standard_Real tab_aWhat[4], tab_aWhere[4]; - Standard_Real dl_l = 1e-3; - Standard_Real min_l, Tol_0D, Tol_1D, Tol_2D, Tol_3D, Tol_Mass; - Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; - Bnd_Box BoundingBox; - gp_Pnt aPnt, aPnt_aWhat, tab_Pnt[2]; - GProp_GProps aProps; - - // Find the iType of the aWhat shape - /* - if ( aWhat.ShapeType() == TopAbs_VERTEX ) iType = TopAbs_VERTEX; - else if ( aWhat.ShapeType() == TopAbs_EDGE || aWhat.ShapeType() == TopAbs_WIRE ) iType = TopAbs_EDGE; - else if ( aWhat.ShapeType() == TopAbs_FACE || aWhat.ShapeType() == TopAbs_SHELL ) iType = TopAbs_FACE; - else if ( aWhat.ShapeType() == TopAbs_SOLID || aWhat.ShapeType() == TopAbs_COMPSOLID ) iType = TopAbs_SOLID; - else if ( aWhat.ShapeType() == TopAbs_COMPOUND ) { - // Only the iType of the first shape in the compound is taken into account - TopoDS_Iterator It (aWhat, Standard_False, Standard_False); - if ( !It.More() ) { - SetErrorCode("Error: theShapeWhat is an empty COMPOUND."); - return NULL; - } - TopAbs_ShapeEnum compType = It.Value().ShapeType(); - if ( compType == TopAbs_VERTEX ) iType = TopAbs_VERTEX; - else if ( compType == TopAbs_EDGE || compType == TopAbs_WIRE ) iType = TopAbs_EDGE; - else if ( compType == TopAbs_FACE || compType == TopAbs_SHELL) iType = TopAbs_FACE; - else if ( compType == TopAbs_SOLID || compType == TopAbs_COMPSOLID) iType = TopAbs_SOLID; - } - else { - SetErrorCode("Error: An attempt to extract a shape of not supported type."); - return NULL; - } - */ - iType = GEOMUtils::GetTypeOfSimplePart(aWhat); - if (iType == TopAbs_SHAPE) { - SetErrorCode("Error: An attempt to extract a shape of not supported type."); - return NULL; - } - - TopExp_Explorer Exp_aWhat ( aWhat, iType ); - TopExp_Explorer Exp_aWhere ( aWhere, iType ); - TopExp_Explorer Exp_Edge ( aWhere, TopAbs_EDGE ); - - // Find the shortest edge in theShapeWhere shape - BRepBndLib::Add(aWhere, BoundingBox); - BoundingBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); - min_l = fabs(aXmax - aXmin); - if( min_l < fabs(aYmax - aYmin) ) min_l = fabs(aYmax - aYmin); - if( min_l < fabs(aZmax - aZmin) ) min_l = fabs(aZmax - aZmin); - min_l /= dl_l; - // Mantis issue 0020908 BEGIN - if (!Exp_Edge.More()) { - min_l = Precision::Confusion(); - } - // Mantis issue 0020908 END - for ( Standard_Integer nbEdge = 0; Exp_Edge.More(); Exp_Edge.Next(), nbEdge++ ) { - TopExp_Explorer Exp_Vertex( Exp_Edge.Current(), TopAbs_VERTEX); - for ( Standard_Integer nbVertex = 0; Exp_Vertex.More(); Exp_Vertex.Next(), nbVertex++ ) { - aPnt = BRep_Tool::Pnt( TopoDS::Vertex( Exp_Vertex.Current() ) ); - tab_Pnt[nbVertex] = aPnt; - } - if ( ! tab_Pnt[0].IsEqual(tab_Pnt[1], dl_l) ) { - BRepGProp::LinearProperties(Exp_Edge.Current(), aProps); - if ( aProps.Mass() < min_l ) min_l = aProps.Mass(); - } - } - - // Compute tolerances - Tol_0D = dl_l; - Tol_1D = dl_l * min_l; - Tol_2D = dl_l * ( min_l * min_l) * ( 2. + dl_l); - Tol_3D = dl_l * ( min_l * min_l * min_l ) * ( 3. + (3 * dl_l) + (dl_l * dl_l) ); - - if (Tol_0D < Precision::Confusion()) Tol_0D = Precision::Confusion(); - if (Tol_1D < Precision::Confusion()) Tol_1D = Precision::Confusion(); - if (Tol_2D < Precision::Confusion()) Tol_2D = Precision::Confusion(); - if (Tol_3D < Precision::Confusion()) Tol_3D = Precision::Confusion(); + Handle(TColStd_HArray1OfInteger) aModifiedArray = + new TColStd_HArray1OfInteger (1, aModifiedList.Extent()); + TopTools_ListIteratorOfListOfShape anIterModif (aModifiedList); + Standard_Integer imod; - //if (Tol_1D > 1.0) Tol_1D = 1.0; - //if (Tol_2D > 1.0) Tol_2D = 1.0; - //if (Tol_3D > 1.0) Tol_3D = 1.0; + for (imod = 1; anIterModif.More(); anIterModif.Next(), imod++) { + const Standard_Integer anIndex = + aWhereIndices.FindIndex(anIterModif.Value()); - Tol_Mass = Tol_3D; - if ( iType == TopAbs_VERTEX ) Tol_Mass = Tol_0D; - else if ( iType == TopAbs_EDGE ) Tol_Mass = Tol_1D; - else if ( iType == TopAbs_FACE ) Tol_Mass = Tol_2D; - - // Compute the ShapeWhat Mass - /* - for ( ; Exp_aWhat.More(); Exp_aWhat.Next() ) { - if ( iType == TopAbs_VERTEX ) { - aWhat_Mass += 1; - continue; - } - else if ( iType == TopAbs_EDGE ) BRepGProp::LinearProperties(Exp_aWhat.Current(), aProps); - else if ( iType == TopAbs_FACE ) BRepGProp::SurfaceProperties(Exp_aWhat.Current(), aProps); - else BRepGProp::VolumeProperties(Exp_aWhat.Current(), aProps); - aWhat_Mass += aProps.Mass(); + aModifiedArray->SetValue(imod, anIndex); } - */ - - // Searching for the sub-shapes inside the ShapeWhere shape - TopTools_MapOfShape map_aWhere; - for ( Exp_aWhere.ReInit(); Exp_aWhere.More(); Exp_aWhere.Next() ) { - if (!map_aWhere.Add(Exp_aWhere.Current())) - continue; // skip repeated shape to avoid mass addition - GetShapeProperties( Exp_aWhere.Current(), tab_aWhere, aPnt ); - for ( Exp_aWhat.ReInit(); Exp_aWhat.More(); Exp_aWhat.Next() ) { - GetShapeProperties( Exp_aWhat.Current(), tab_aWhat, aPnt_aWhat ); - if ( fabs(tab_aWhat[3] - tab_aWhere[3]) <= Tol_Mass && aPnt_aWhat.Distance(aPnt) <= Tol_1D ) - isFound = true; - else { - if ( (tab_aWhat[3] - tab_aWhere[3]) > Tol_Mass ) { - aPntShape = BRepBuilderAPI_MakeVertex( aPnt ).Shape(); - aVertex = TopoDS::Vertex( aPntShape ); - BRepExtrema_DistShapeShape aWhereDistance ( aVertex, Exp_aWhere.Current() ); - BRepExtrema_DistShapeShape aWhatDistance ( aVertex, Exp_aWhat.Current() ); - if ( aWhereDistance.IsDone() && aWhatDistance.IsDone() && - fabs(aWhereDistance.Value() - aWhatDistance.Value()) <= Tol_1D ) - { - // 0020162: "EDF 961 GEOM : Getinplace is getting additionnal orthogonal faces" - // aVertex must be projected to the same point on Where and on What - gp_Pnt pOnWhat = aWhatDistance.PointOnShape2(1); - gp_Pnt pOnWhere = aWhereDistance.PointOnShape2(1); - isFound = ( pOnWhat.Distance(pOnWhere) <= Tol_1D ); - if ( isFound && iType == TopAbs_FACE ) - { - // check normals at pOnWhat and pOnWhere - const double angleTol = M_PI/180.; - gp_Vec normToWhat = GetNormal( TopoDS::Face(Exp_aWhat.Current()), aWhatDistance); - gp_Vec normToWhere = GetNormal( TopoDS::Face(Exp_aWhere.Current()), aWhereDistance); - if ( normToWhat * normToWhere < 0 ) - normToWhat.Reverse(); - isFound = ( normToWhat.Angle( normToWhere ) < angleTol ); - } - } - } - } - if ( isFound ) { - aWhereIndex = aWhereIndices.FindIndex(Exp_aWhere.Current()); - aModifiedList.Append(aWhereIndex); - //aWhere_Mass += tab_aWhere[3]; - isFound = false; - break; - } - } - //if ( fabs( aWhat_Mass - aWhere_Mass ) <= Tol_Mass ) - //break; - } - - if (aModifiedList.Extent() == 0) { // Not found any Results - SetErrorCode(NOT_FOUND_ANY); - return NULL; - } - - aModifiedArray = new TColStd_HArray1OfInteger (1, aModifiedList.Extent()); - TColStd_ListIteratorOfListOfInteger anIterModif (aModifiedList); - for (Standard_Integer imod = 1; anIterModif.More(); anIterModif.Next(), imod++) - aModifiedArray->SetValue(imod, anIterModif.Value()); //Add a new object - aResult = GetEngine()->AddSubShape(theShapeWhere, aModifiedArray); + Handle(GEOM_Object) aResult = + GetEngine()->AddSubShape(theShapeWhere, aModifiedArray); + if (aResult.IsNull()) { SetErrorCode("Error in algorithm: result found, but cannot be returned."); return NULL; @@ -4482,6 +4070,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceOld (Handle(GEOM_Objec << theShapeWhere << ", " << theShapeWhat << ", False)"; SetErrorCode(OK); + return aResult; } @@ -4507,11 +4096,13 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceByHistory //Fill array of indices TopTools_IndexedMapOfShape aWhereIndices; + TopExp::MapShapes(aWhere, aWhereIndices); // process shape - TColStd_ListOfInteger aModifiedList; - bool isFound = GetInPlaceOfShape(aWhereFunction, aWhereIndices, aWhat, aModifiedList); + TopTools_ListOfShape aModifiedList; + bool isFound = GEOMAlgo_GetInPlaceAPI::GetInPlaceByHistory + (aWhereFunction, aWhereIndices, aWhat, aModifiedList); if (!isFound || aModifiedList.Extent() < 1) { SetErrorCode("Error: No history found for the sought shape or its sub-shapes."); @@ -4519,13 +4110,13 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceByHistory } Standard_Integer nbFound = aModifiedList.Extent(); - TColStd_ListIteratorOfListOfInteger anIterModif (aModifiedList); + TopTools_ListIteratorOfListOfShape anIterModif (aModifiedList); if ( nbFound > 1 ) { // remove sub-shapes inappropriate for group creation TopAbs_ShapeEnum subType = TopAbs_SHAPE; while ( anIterModif.More() ) { - TopAbs_ShapeEnum type = aWhereIndices( anIterModif.Value() ).ShapeType(); + TopAbs_ShapeEnum type = anIterModif.Value().ShapeType(); bool okForGroup = ( type == TopAbs_VERTEX || type == TopAbs_EDGE || type == TopAbs_FACE || type == TopAbs_SOLID ); if ( okForGroup ) { @@ -4550,7 +4141,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceByHistory new TColStd_HArray1OfInteger( 1, nbFound ); anIterModif.Initialize(aModifiedList); for (Standard_Integer imod = 1; anIterModif.More(); anIterModif.Next(), imod++) - aModifiedArray->SetValue(imod, anIterModif.Value()); + aModifiedArray->SetValue + (imod, aWhereIndices.FindIndex(anIterModif.Value())); //Add a new object Handle(GEOM_Object) aResult = GetEngine()->AddSubShape(theShapeWhere, aModifiedArray); diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx index 06b35dac4..d1827ee9c 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx @@ -34,22 +34,17 @@ #include "GEOMAlgo_State.hxx" -#include -#include -#include #include #include -#include - -#include +#include #include -#include class GEOM_Engine; class Handle(GEOM_Object); class Handle(TColStd_HArray1OfInteger); +class TopoDS_Shape; class GEOMImpl_IShapesOperations : public GEOM_IOperations { @@ -304,8 +299,6 @@ 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); diff --git a/src/GEOMImpl/GEOMImpl_ITransferData.cxx b/src/GEOMImpl/GEOMImpl_ITransferData.cxx new file mode 100644 index 000000000..d9e8f4d77 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ITransferData.cxx @@ -0,0 +1,137 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +//NOTE: This is an intreface to a function for the Transfer Data functionality. +// + + +#include "GEOMImpl_ITransferData.hxx" + +#include +#include +#include +#include +#include + + +//============================================================================= +/*! + * SetName + */ +//============================================================================= +void GEOMImpl_ITransferData::SetStringData + (const TopoDS_Shape &theSubShape, + const TCollection_AsciiString &theData, + const Standard_Boolean IsName) +{ + TDF_Label aLabel; + TDF_ChildIDIterator anIt + (_func->GetNamingEntry(), TDataStd_Name::GetID(), Standard_True); + + for (; anIt.More(); anIt.Next()) { + Handle(TDataStd_Name) aNameAttr = + Handle(TDataStd_Name)::DownCast(anIt.Value()); + + if (aNameAttr.IsNull()) { + continue; + } + + TDF_Label aLab = aNameAttr->Label(); + Handle(TNaming_NamedShape) aShAttr; + + if (aLab.FindAttribute(TNaming_NamedShape::GetID(), aShAttr) && + aShAttr->Get().IsEqual(theSubShape)) { + aLabel = aLab; + break; + } + } + + if (aLabel.IsNull()) { + TDF_TagSource aTag; + + aLabel = aTag.NewChild(_func->GetNamingEntry()); + + TNaming_Builder aTnBuild (aLabel); + + aTnBuild.Generated(theSubShape); + } + + // set a name or a material + TCollection_ExtendedString aDataExt(theData); + + if (IsName) { + TDataStd_Name::Set(aLabel, aDataExt); + } else { + TDataStd_Comment::Set(aLabel, aDataExt); + } +} + +//============================================================================= +/*! + * GetStringData + */ +//============================================================================= +TCollection_AsciiString GEOMImpl_ITransferData::GetStringData + (const TopoDS_Shape &theSubShape, + const Standard_Boolean IsName) +{ + // check all named shapes using iterator + TCollection_AsciiString aResult; + TDF_ChildIDIterator anIt + (_func->GetNamingEntry(), TNaming_NamedShape::GetID(), Standard_True); + + for (; anIt.More(); anIt.Next()) { + Handle(TNaming_NamedShape) aShAttr = + Handle(TNaming_NamedShape)::DownCast(anIt.Value()); + + if (aShAttr.IsNull()) { + continue; + } + + if (aShAttr->Get().IsEqual(theSubShape)) { + TDF_Label aLabel = aShAttr->Label(); + Standard_Boolean isFound = Standard_False; + + if (IsName) { + Handle(TDataStd_Name) aString; + + if(aLabel.FindAttribute(TDataStd_Name::GetID(), aString)) { + aResult = TCollection_AsciiString(aString->Get()); + isFound = Standard_True; + } + } else { + Handle(TDataStd_Comment) aString; + + if(aLabel.FindAttribute(TDataStd_Comment::GetID(), aString)) { + aResult = TCollection_AsciiString(aString->Get()); + isFound = Standard_True; + } + } + + if (isFound) { + break; + } + } + } + + return aResult; +} diff --git a/src/GEOMImpl/GEOMImpl_ITransferData.hxx b/src/GEOMImpl/GEOMImpl_ITransferData.hxx new file mode 100644 index 000000000..761ed19e2 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ITransferData.hxx @@ -0,0 +1,114 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +//NOTE: This is an intreface to a function for the Transfer Data functionality. +// + + +#ifndef _GEOMImpl_ITransferData_HXX_ +#define _GEOMImpl_ITransferData_HXX_ + + +#include "GEOM_GEOMImpl.hxx" +#include "GEOM_Function.hxx" + +#include + + +#define TD_ARG_REF1 1 +#define TD_ARG_REF2 2 +#define TD_ARG_METHOD 3 +#define TD_ARG_DATUM_NAME 4 +#define TD_ARG_DATUM_MAX_VALUE 5 +#define TD_ARG_DATUM_VALUE 6 + +class GEOMImpl_ITransferData +{ + public: + + GEOMImpl_ITransferData(const Handle(GEOM_Function) &theFunction) + : _func(theFunction) {} + + void SetRef1(const Handle(GEOM_Function) &theRefPoint1) + { _func->SetReference(TD_ARG_REF1, theRefPoint1); } + + Handle(GEOM_Function) GetRef1() { return _func->GetReference(TD_ARG_REF1); } + + void SetRef2(const Handle(GEOM_Function) &theRefPoint2) + { _func->SetReference(TD_ARG_REF2, theRefPoint2); } + + Handle(GEOM_Function) GetRef2() { return _func->GetReference(TD_ARG_REF2); } + + void SetFindMethod(const int theFindMethod) + { _func->SetInteger(TD_ARG_METHOD, theFindMethod); } + + int GetFindMethod() { return _func->GetInteger(TD_ARG_METHOD); } + + void SetDatumName(const Handle(TColStd_HArray1OfExtendedString) &theDatumName) + { _func->SetStringArray(TD_ARG_DATUM_NAME, theDatumName); } + + Handle(TColStd_HArray1OfExtendedString) GetDatumName() + { return _func->GetStringArray(TD_ARG_DATUM_NAME); } + + void SetDatumMaxVal(const Handle(TColStd_HArray1OfInteger) &theDatumMaxVal) + { _func->SetIntegerArray(TD_ARG_DATUM_MAX_VALUE, theDatumMaxVal); } + + Handle(TColStd_HArray1OfInteger) GetDatumMaxVal() + { return _func->GetIntegerArray(TD_ARG_DATUM_MAX_VALUE); } + + void SetDatumVal(const Handle(TColStd_HArray1OfInteger) &theDatumVal) + { _func->SetIntegerArray(TD_ARG_DATUM_VALUE, theDatumVal); } + + Handle(TColStd_HArray1OfInteger) GetDatumVal() + { return _func->GetIntegerArray(TD_ARG_DATUM_VALUE); } + + GEOMIMPL_EXPORT void SetName(const TopoDS_Shape &theSubShape, + const TCollection_AsciiString &theName) + { SetStringData(theSubShape, theName, Standard_True); } + + GEOMIMPL_EXPORT TCollection_AsciiString GetName + (const TopoDS_Shape &theSubShape) + { return GetStringData(theSubShape, Standard_True); } + + GEOMIMPL_EXPORT void SetMaterial(const TopoDS_Shape &theSubShape, + const TCollection_AsciiString &theName) + { SetStringData(theSubShape, theName, Standard_False); } + + GEOMIMPL_EXPORT TCollection_AsciiString GetMaterial + (const TopoDS_Shape &theSubShape) + { return GetStringData(theSubShape, Standard_False); } + + private: + + TCollection_AsciiString GetStringData(const TopoDS_Shape &theSubShape, + const Standard_Boolean IsName); + + void SetStringData(const TopoDS_Shape &theSubShape, + const TCollection_AsciiString &theData, + const Standard_Boolean IsName); + + private: + + Handle(GEOM_Function) _func; +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index 272db63b8..073a6c778 100644 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -117,10 +117,13 @@ #define GEOM_POLYLINE2D 56 +#define GEOM_TRANSFER_DATA 57 + //GEOM_Function types #define COPY_WITH_REF 1 #define COPY_WITHOUT_REF 2 +#define TRANSFER_DATA 3 #define IMPORT_SHAPE 1 #define EXPORT_SHAPE 2 @@ -379,6 +382,10 @@ #define USER_TYPE 200 // Base type for GEOM advanced shapes #define USER_TYPE_EX 1000 // Base type for GEOM plugins +// Transfer data method type +#define TD_GET_IN_PLACE 1 +#define TD_GET_IN_PLACE_OLD 2 +#define TD_GET_IN_PLACE_BY_HISTORY 3 // Plugins specified constants #define PLUGIN_NAME "Plugin Name" diff --git a/src/GEOM_I/GEOM_IInsertOperations_i.cc b/src/GEOM_I/GEOM_IInsertOperations_i.cc index ab79c87b6..334000f23 100644 --- a/src/GEOM_I/GEOM_IInsertOperations_i.cc +++ b/src/GEOM_I/GEOM_IInsertOperations_i.cc @@ -34,6 +34,7 @@ #include "GEOM_Engine.hxx" #include "GEOM_BaseObject.hxx" +#include "GEOMImpl_Types.hxx" #include @@ -259,4 +260,83 @@ GEOM::ListOfLong* GEOM_IInsertOperations_i::GetAllTextures() return anIDs._retn(); } +//============================================================================= +/*! + * TransferData + */ +//============================================================================= +CORBA::Boolean GEOM_IInsertOperations_i::TransferData + (GEOM::GEOM_Object_ptr theObjectFrom, + GEOM::GEOM_Object_ptr theObjectTo, + GEOM::find_shape_method theFindMethod, + GEOM::GEOM_IInsertOperations::ListOfTransferDatum_out theResult) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (CORBA::is_nil(theObjectFrom) || CORBA::is_nil(theObjectTo)) + { + return false; + } + + //Get the reference shape + Handle(GEOM_Object) aShapeFrom = GetObjectImpl(theObjectFrom); + Handle(GEOM_Object) aShapeTo = GetObjectImpl(theObjectTo); + + if (aShapeFrom.IsNull() || aShapeTo.IsNull()) + { + return false; + } + bool isOk = false; + std::list aData; + int aFindMethod = -1; + + switch (theFindMethod) { + case GEOM::FSM_GetInPlace: + aFindMethod = TD_GET_IN_PLACE; + break; + case GEOM::FSM_GetInPlaceByHistory: + aFindMethod = TD_GET_IN_PLACE_BY_HISTORY; + break; + case GEOM::FSM_GetInPlace_Old: + aFindMethod = TD_GET_IN_PLACE_OLD; + break; + default: + break; + } + + // Transfer data. + if (aFindMethod > 0) { + isOk = GetOperations()->TransferData + (aShapeFrom, aShapeTo, aFindMethod, aData); + } + + if (isOk) { + // Copy results. + const int aNbDatum = aData.size(); + GEOM::GEOM_IInsertOperations::ListOfTransferDatum_var aResult = + new GEOM::GEOM_IInsertOperations::ListOfTransferDatum; + + aResult->length(aNbDatum); + + // fill the local CORBA array with values from lists + std::list::const_iterator + anIt = aData.begin(); + int i = 0; + + for (; anIt != aData.end(); i++, anIt++) { + GEOM::GEOM_IInsertOperations::TransferDatum_var aDatum = + new GEOM::GEOM_IInsertOperations::TransferDatum; + + aDatum->myName = CORBA::string_dup(anIt->myName.ToCString()); + aDatum->myNumber = anIt->myNumber; + aDatum->myMaxNumber = anIt->myMaxNumber; + aResult[i] = aDatum; + } + + theResult = aResult._retn(); + } + + return isOk; +} diff --git a/src/GEOM_I/GEOM_IInsertOperations_i.hh b/src/GEOM_I/GEOM_IInsertOperations_i.hh index 4a2b4f2cc..26bfa4d88 100644 --- a/src/GEOM_I/GEOM_IInsertOperations_i.hh +++ b/src/GEOM_I/GEOM_IInsertOperations_i.hh @@ -66,7 +66,13 @@ class GEOM_I_EXPORT GEOM_IInsertOperations_i : CORBA::Long& theHeight); GEOM::ListOfLong* GetAllTextures(); - + + CORBA::Boolean TransferData + (GEOM::GEOM_Object_ptr theObjectFrom, + GEOM::GEOM_Object_ptr theObjectTo, + GEOM::find_shape_method theFindMethod, + GEOM::GEOM_IInsertOperations::ListOfTransferDatum_out theResult); + ::GEOMImpl_IInsertOperations* GetOperations() { return (::GEOMImpl_IInsertOperations*)GetImpl(); } }; diff --git a/src/GEOM_SWIG/GEOM_TestOthers.py b/src/GEOM_SWIG/GEOM_TestOthers.py index 2cb39a2bf..548204a65 100644 --- a/src/GEOM_SWIG/GEOM_TestOthers.py +++ b/src/GEOM_SWIG/GEOM_TestOthers.py @@ -562,6 +562,18 @@ def TestOtherOperations (geompy, math): ind = ind + 1 pass + # TransferData + path = os.getenv("DATA_DIR") + fileName = path + "/Shapes/Step/black_and_white.step" + blackWhite = geompy.ImportSTEP(fileName) + blackWhiteCopy = geompy.MakeCopy(blackWhite[0]) + subBlackWhite = geompy.SubShapeAll(blackWhiteCopy, GEOM.SOLID) + geompy.TransferData(blackWhite[0], blackWhiteCopy) + geompy.addToStudy(blackWhite[0], "blackWhite") + geompy.addToStudy(blackWhiteCopy, "blackWhiteCopy") + geompy.addToStudyInFather( blackWhiteCopy, subBlackWhite[0], "" ) + geompy.addToStudyInFather( blackWhiteCopy, subBlackWhite[1], "" ) + # CheckAndImprove blocksComp = geompy.CheckAndImprove(part) diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py old mode 100644 new mode 100755 index c7aa61896..b5e1ca808 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -12934,6 +12934,46 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): RaiseIfFailed("AddTexture", self.InsertOp) return ID + ## Transfer not topological data from one GEOM object to another. + # + # @param theObjectFrom the source object of non-topological data + # @param theObjectTo the destination object of non-topological data + # @param theFindMethod method to search sub-shapes of theObjectFrom + # in shape theObjectTo. Possible values are: GEOM.FSM_GetInPlace, + # GEOM.FSM_GetInPlaceByHistory and GEOM.FSM_GetInPlace_Old. + # Other values of GEOM.find_shape_method are not supported. + # + # @return True in case of success; False otherwise. + # + # @ingroup l1_geomBuilder_auxiliary + # + # @ref swig_TransferData "Example" + @ManageTransactions("InsertOp") + def TransferData(self, theObjectFrom, theObjectTo, + theFindMethod=GEOM.FSM_GetInPlace): + """ + Transfer not topological data from one GEOM object to another. + + Parameters: + theObjectFrom the source object of non-topological data + theObjectTo the destination object of non-topological data + theFindMethod method to search sub-shapes of theObjectFrom + in shape theObjectTo. Possible values are: + GEOM.FSM_GetInPlace, GEOM.FSM_GetInPlaceByHistory + and GEOM.FSM_GetInPlace_Old. Other values of + GEOM.find_shape_method are not supported. + + Returns: + True in case of success; False otherwise. + + # Example: see GEOM_TestOthers.py + """ + # Example: see GEOM_TestAll.py + isOk = self.InsertOp.TransferData(theObjectFrom, + theObjectTo, theFindMethod) + RaiseIfFailed("TransferData", self.InsertOp) + return isOk + ## Creates a new folder object. It is a container for any GEOM objects. # @param Name name of the container # @param Father parent object. If None, diff --git a/src/OperationGUI/CMakeLists.txt b/src/OperationGUI/CMakeLists.txt index 0f8ae114e..b4c76b04f 100755 --- a/src/OperationGUI/CMakeLists.txt +++ b/src/OperationGUI/CMakeLists.txt @@ -76,6 +76,7 @@ SET(OperationGUI_HEADERS OperationGUI_GetSharedShapesDlg.h OperationGUI_ExtrudedFeatureDlg.h OperationGUI_ClippingDlg.h + OperationGUI_TransferDataDlg.h ) # header files / to be processed by moc @@ -89,6 +90,7 @@ SET(_moc_HEADERS OperationGUI_GetSharedShapesDlg.h OperationGUI_ExtrudedFeatureDlg.h OperationGUI_ClippingDlg.h + OperationGUI_TransferDataDlg.h ) # header files / uic wrappings @@ -110,6 +112,7 @@ SET(OperationGUI_SOURCES OperationGUI_ChamferDlg.cxx OperationGUI_ExtrudedFeatureDlg.cxx OperationGUI_ClippingDlg.cxx + OperationGUI_TransferDataDlg.cxx ${_moc_SOURCES} ${_uic_files} ) diff --git a/src/OperationGUI/OperationGUI.cxx b/src/OperationGUI/OperationGUI.cxx index a705e0ae2..e72c96d4e 100644 --- a/src/OperationGUI/OperationGUI.cxx +++ b/src/OperationGUI/OperationGUI.cxx @@ -39,6 +39,7 @@ #include "OperationGUI_GetShapesOnShapeDlg.h" #include "OperationGUI_GetSharedShapesDlg.h" #include "OperationGUI_ExtrudedFeatureDlg.h" // Methods EXTRUDED BOSS / CUT +#include "OperationGUI_TransferDataDlg.h" //======================================================================= // function : OperationGUI() @@ -81,6 +82,7 @@ bool OperationGUI::OnGUIEvent (int theCommandID, SUIT_Desktop* parent) case GEOMOp::OpExtrudedCut: (new OperationGUI_ExtrudedFeatureDlg (CUT, getGeometryGUI(), parent))->show(); break; case GEOMOp::OpFillet1d: (new OperationGUI_Fillet1d2dDlg (getGeometryGUI(), parent, true))->show(); break; case GEOMOp::OpFillet2d: (new OperationGUI_Fillet1d2dDlg (getGeometryGUI(), parent, false))->show(); break; + case GEOMOp::OpTransferData: (new OperationGUI_TransferDataDlg (getGeometryGUI(), parent))->show(); break; default: app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); } diff --git a/src/OperationGUI/OperationGUI_TransferDataDlg.cxx b/src/OperationGUI/OperationGUI_TransferDataDlg.cxx new file mode 100755 index 000000000..9c5d48f97 --- /dev/null +++ b/src/OperationGUI/OperationGUI_TransferDataDlg.cxx @@ -0,0 +1,331 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "OperationGUI_TransferDataDlg.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +//============================================================================== +// class : OperationGUI_TransferDataDlg() +// purpose : Constructs a OperationGUI_TransferDataDlg which is a child of +// 'parent'. +//================================================================================= +OperationGUI_TransferDataDlg::OperationGUI_TransferDataDlg (GeometryGUI* theGeometryGUI, + QWidget* parent) + : GEOMBase_Skeleton(theGeometryGUI, parent, false), + myGroup(NULL) +{ + SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); + QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSFER_DATA"))); + QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setWindowTitle(tr("GEOM_TRANSFER_DATA_TITLE")); + + /***************************************************************/ + mainFrame()->GroupConstructors->setTitle(tr("GEOM_TRANSFER_DATA")); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton3->close(); + + mainFrame()->GroupBoxName->hide(); + + myGroup = new DlgRef_2Sel1List(centralWidget()); + myGroup->GroupBox1->setTitle(tr("GEOM_PARAMETERS")); + myGroup->TextLabel1->setText(tr("GEOM_TRANSFER_DATA_FROM")); + myGroup->TextLabel2->setText(tr("GEOM_TRANSFER_DATA_TO")); + myGroup->TextLabel3->setText(tr("GEOM_TRANSFER_DATA_METHOD")); + myGroup->PushButton1->setIcon(image1); + myGroup->PushButton2->setIcon(image1); + myGroup->LineEdit1->setReadOnly(true); + myGroup->LineEdit2->setReadOnly(true); + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(myGroup); + /***************************************************************/ + + setHelpFileName("transfer_data_page.html"); + + Init(); +} + +//================================================================================= +// function : ~OperationGUI_TransferDataDlg +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +OperationGUI_TransferDataDlg::~OperationGUI_TransferDataDlg() +{ +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void OperationGUI_TransferDataDlg::Init() +{ + // type for detection + myGroup->ComboBox1->addItem(tr("GEOM_TD_METHOD_GETINPLACE")); + myGroup->ComboBox1->addItem(tr("GEOM_TD_METHOD_GETINPLACE_OLD")); + myGroup->ComboBox1->addItem(tr("GEOM_TD_METHOD_GETINPLACE_HISTORY")); + + myGroup->LineEdit1->clear(); + myGroup->LineEdit2->clear(); + myObject1.nullify(); + myObject2.nullify(); + + // signals and slots connections + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(myGroup->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(myGroup->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(myGroup->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(myGroup->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + myGroup->TextLabel3->show(); + myGroup->ComboBox1->show(); + myGroup->ComboBox1->setCurrentIndex(0); + + globalSelection(GEOM_ALLSHAPES); + + myGroup->PushButton1->click(); + SelectionIntoArgument(); + resize(100,100); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void OperationGUI_TransferDataDlg::ClickOnOk() +{ + setIsApplyAndClose( true ); + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool OperationGUI_TransferDataDlg::ClickOnApply() +{ + if (!onAccept(false)) + return false; + // activate first line edit + myGroup->PushButton1->click(); + return true; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection is changed or on dialog initialization or activation +//================================================================================= +void OperationGUI_TransferDataDlg::SelectionIntoArgument() +{ + GEOM::GeomObjPtr aSelectedObject = getSelected(TopAbs_SHAPE); + + if (aSelectedObject) { + myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject.get())); + + if (myEditCurrentArgument == myGroup->LineEdit1) { + myObject1 = aSelectedObject; + + if (!myObject2) { + myGroup->PushButton2->click(); + } + } else if (myEditCurrentArgument == myGroup->LineEdit2) { + myObject2 = aSelectedObject; + + if (!myObject1) { + myGroup->PushButton1->click(); + } + } + } else { + myEditCurrentArgument->setText(""); + + if (myEditCurrentArgument == myGroup->LineEdit1) { + myObject1.nullify(); + } else if (myEditCurrentArgument == myGroup->LineEdit2) { + myObject2.nullify(); + } + } +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void OperationGUI_TransferDataDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if (send == myGroup->PushButton1) { + myEditCurrentArgument = myGroup->LineEdit1; + + myGroup->PushButton2->setDown(false); + myGroup->LineEdit2->setEnabled(false); + } + else if (send == myGroup->PushButton2) { + myEditCurrentArgument = myGroup->LineEdit2; + + myGroup->PushButton1->setDown(false); + myGroup->LineEdit1->setEnabled(false); + } + + // enable line edit + myEditCurrentArgument->setEnabled(true); + myEditCurrentArgument->setFocus(); + // after setFocus(), because it will be setDown(false) when loses focus + send->setDown(true); +} + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void OperationGUI_TransferDataDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if (send == myGroup->LineEdit1 || send == myGroup->LineEdit2) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void OperationGUI_TransferDataDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + globalSelection(GEOM_ALLSHAPES); + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( SelectionIntoArgument() ) ); +} + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void OperationGUI_TransferDataDlg::enterEvent (QEvent*) +{ + if (!mainFrame()->GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr OperationGUI_TransferDataDlg::createOperation() +{ + return getGeomEngine()->GetIInsertOperations(getStudyId()); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool OperationGUI_TransferDataDlg::isValid(QString&) +{ + return myObject1 && myObject2; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool OperationGUI_TransferDataDlg::execute (ObjectList& objects) +{ + const int aLimit = myGroup->ComboBox1->currentIndex(); + GEOM::find_shape_method aMethod; + + switch (aLimit) + { + case 0: + aMethod = GEOM::FSM_GetInPlace; + break; + case 1: + aMethod = GEOM::FSM_GetInPlace_Old; + break; + case 2: + default: + aMethod = GEOM::FSM_GetInPlaceByHistory; + break; + } + + GEOM::GEOM_IInsertOperations_var anOper = + GEOM::GEOM_IInsertOperations::_narrow(getOperation()); + GEOM::GEOM_IInsertOperations::ListOfTransferDatum_var aResult; + + bool isOK = anOper->TransferData + (myObject1.get(), myObject2.get(), aMethod, aResult); + + if (isOK) { + // Construct info message. + QString aMsg; + int aNbTypes = aResult->length(); + + if (aNbTypes == 0) { + aMsg = tr("GEOM_TRANSFER_DATA_NOT_COPIED"); + } else { + aMsg = tr("GEOM_TRANSFER_DATA_COPIED"); + aMsg += "\n"; + int i; + + for (i = 0; i < aNbTypes; i++ ) { + if (i > 0) { + aMsg += "\n"; + } + + aMsg += tr(aResult[i].myName). + arg(aResult[i].myNumber).arg(aResult[i].myMaxNumber); + } + } + + // Show info message. + SUIT_MessageBox::information + (SUIT_Session::session()->activeApplication()->desktop(), + tr("GEOM_TRANSFER_DATA_INFO"), aMsg, tr("BUT_OK")); + + objects.push_back(myObject2.copy()); + } + + return isOK; +} diff --git a/src/OperationGUI/OperationGUI_TransferDataDlg.h b/src/OperationGUI/OperationGUI_TransferDataDlg.h new file mode 100644 index 000000000..a4b6ef947 --- /dev/null +++ b/src/OperationGUI/OperationGUI_TransferDataDlg.h @@ -0,0 +1,68 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + + +#ifndef OPERATIONGUI_TRANSFERDATADLG_H +#define OPERATIONGUI_TRANSFERDATADLG_H + + +#include + +class DlgRef_2Sel1List; + +//================================================================================= +// class : OperationGUI_TransferDataDlg +// purpose : +//================================================================================= +class OperationGUI_TransferDataDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + OperationGUI_TransferDataDlg + ( GeometryGUI* theGeometryGUI, QWidget* parent = 0 ); + ~OperationGUI_TransferDataDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + +private: + void Init(); + void enterEvent( QEvent* ); + +private: + GEOM::GeomObjPtr myObject1; + GEOM::GeomObjPtr myObject2; + int myShapeType; + + DlgRef_2Sel1List* myGroup; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); +}; + +#endif // OPERATIONGUI_GETSHAPESONSHAPEDLG_H -- 2.39.2