2 // CC++ : Ancienne interface Cascade de la classe Elements ** A SUPPRIMER **
4 // Copyright (C) 2009-2019 CEA/DEN, EDF R&D
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "HexElements.hxx"
24 #include "HexEdge.hxx"
25 #include "HexDocument.hxx"
26 #include "HexEdgeShape.hxx"
27 #include "HexAssoEdge.hxx"
28 #include "HexVertex.hxx"
30 /*****************************************
31 #include <BRepTools.hxx>
32 #include <BRep_Builder.hxx>
33 #include <BRepAdaptor_Curve.hxx>
34 #include <BRepBuilderAPI_Transform.hxx>
35 #include <BRepBuilderAPI_MakeVertex.hxx>
37 #include <GCPnts_AbscissaPoint.hxx>
40 #include <TopoDS_Shape.hxx>
41 #include <TopoDS_Edge.hxx>
42 #include <TopoDS_Compound.hxx>
43 #include <TopoDS_Vertex.hxx>
50 #include <GC_MakeCircle.hxx>
51 #include <Geom_Circle.hxx>
52 #include <gp_Circ.hxx>
54 #include <BRepBuilderAPI_MakeEdge.hxx>
55 #include <BRep_Tool.hxx>
56 ***************************************************/
60 // ---------------------------------------------------------------------
61 bool requals (const double pnt1[], const double pnt2[]);
62 // ========================================================= cutAssociation
63 void Elements::cutAssociation (Edge* orig, Edges& tedges)
65 int nbedges = tedges.size();
66 int nbassos = orig->countAssociation();
68 // ----------- Ordonnancement des shapes
71 for (int ns = 0 ; ns<nbassos ; ns++)
73 AssoEdge* asso = orig->getAssociation (ns);
74 lgpara += fabs (asso->getEnd () - asso->getStart ());
77 double delta = lgpara / nbedges;
79 AssoEdge* asso = orig->getAssociation (nasso);
80 EdgeShape* shape = asso->getEdgeShape ();
81 double param1 = asso->getStart ();
82 double parmax = asso->getEnd ();
84 for (int ned = 0 ; ned<nbedges ; ned++)
86 Edge* edge = tedges [ned];
87 double param2 = param1 + delta;
91 Vertex* node = edge->getVertex (V_AMONT);
92 shape->getPoint (param1, point);
93 node->setAssociation (point);
96 edge->addAssociation (shape, param1, param2);
99 edge->addAssociation (shape, param1, parmax);
101 if (nasso >= nbassos)
103 asso = orig->getAssociation (nasso);
104 shape = asso->getEdgeShape ();
106 parmax = asso->getEnd ();
107 edge->addAssociation (shape, 0, param2);
112 // ====================================================== geom_dump_asso
113 void geom_dump_asso (Edge* edge)
115 std::cout << std::endl;
116 std::cout << " _______________________________________________________ "
117 << " dump_edge :" << std::endl;
119 if (edge==NULL || NOT edge->isHere ())
121 std::cout << "*** deleted ***" << std::endl;
125 std::cout << std::endl;
126 std::cout << " ... Edge = " << edge->getName ()
127 << " = (" << edge->getVertex(V_AMONT)->getName()
128 << ", " << edge->getVertex(V_AVAL )->getName() << ")" << std::endl;
130 for (int nro=0 ; nro<V_TWO ; nro++)
132 Vertex* node = edge->getVertex (nro);
133 std::cout << " ... " << node->getName()
134 << " = (" << node->getX()
135 << ", " << node->getY()
136 << ", " << node->getZ() << ")";
138 if (node->isAssociated())
139 std::cout << " --> (" << node->getAssoX()
140 << ", " << node->getAssoY()
141 << ", " << node->getAssoZ() << ")";
143 std::cout << " (not associated)";
144 std::cout << std::endl;
147 int nbr_associations = edge->countAssociation ();
148 PutData (nbr_associations);
150 for (int nro=0 ; nro<nbr_associations ; nro++)
152 AssoEdge* asso = edge->getAssociation (nro);
153 std::cout << " *** Association nro " << nro+1 << std::endl;
154 const double* shape_origin = asso->getOrigin();
155 const double* shape_extrem = asso->getExtrem();
156 PutData (asso->getStart());
157 PutData (asso->getEnd());
158 PutCoord (shape_origin);
159 PutCoord (shape_extrem);
161 std::cout << std::endl << std::endl;