1 // SMESH SMDS : implementaion of Salome mesh data structure
3 // Copyright (C) 2003 OPEN CASCADE
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // See http://www.opencascade.org or email : webmaster@opencascade.org
23 // File : SMDSEdit_Transform.cxx
24 // Author : Jean-Michel BOULCOURT
28 #include "SMDSEdit_Transform.ixx"
29 #include "SMDS_MeshNode.hxx"
30 #include "SMDS_MeshElement.hxx"
31 #include "SMDS_MeshNodesIterator.hxx"
32 #include "SMDS_ListIteratorOfListOfMeshElement.hxx"
33 #include "TColStd_MapOfInteger.hxx"
36 //=======================================================================
37 //function : SMDSEdit_Transform
39 //=======================================================================
41 SMDSEdit_Transform::SMDSEdit_Transform(const Handle(SMDS_Mesh)& aMesh,const gp_Trsf& aTrsf)
42 :myMesh(aMesh),myTrsf(aTrsf)
46 //=======================================================================
47 //function : SMDSEdit_Transform
49 //=======================================================================
51 SMDSEdit_Transform::SMDSEdit_Transform(const Handle(SMDS_Mesh)& aMesh,
52 const SMDS_ListOfMeshElement& aListOfME,
54 :myMesh(aMesh),myTrsf(aTrsf)
56 myListOfME = aListOfME;
59 //=======================================================================
62 //=======================================================================
64 void SMDSEdit_Transform::SetTrsf(const gp_Trsf& aTrsf)
69 //=======================================================================
72 //=======================================================================
74 gp_Trsf SMDSEdit_Transform::GetTrsf() const
79 //=======================================================================
82 //=======================================================================
84 void SMDSEdit_Transform::Perform()
86 if (myListOfME.IsEmpty()) {
87 // transform the whole mesh
88 SMDS_MeshNodesIterator itNodes(myMesh);
90 for (;itNodes.More();itNodes.Next()) {
91 const Handle(SMDS_MeshElement)& elem = itNodes.Value();
92 Handle(SMDS_MeshNode) node = *((Handle(SMDS_MeshNode)*)&elem);
94 gp_Pnt P = node->Pnt();
100 TColStd_MapOfInteger mapnode;
101 Standard_Integer nbnodes,inode;
103 SMDS_ListIteratorOfListOfMeshElement itME(myListOfME);
104 for (;itME.More();itME.Next()) {
105 const Handle(SMDS_MeshElement)& elem = itME.Value();
106 nbnodes = elem->NbNodes();
108 for (inode = 1; inode <= nbnodes; ++inode) {
109 const Handle(SMDS_MeshNode)& node = myMesh->GetNode(inode,elem);
110 if (mapnode.Add(node->GetID())) {
111 gp_Pnt P = node->Pnt();