Salome HOME
Updated copyright comment
[modules/hexablock.git] / src / HEXABLOCK / HexVertex.hxx
1
2 // Class : Gestion des sommets
3
4 // Copyright (C) 2009-2024  CEA, EDF
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef __VERTEX_H_
24 #define __VERTEX_H_
25
26 #include "HexEltBase.hxx"
27
28 BEGIN_NAMESPACE_HEXA
29
30 class HexaExport Vertex : public EltBase
31 {
32 public :
33    double getX()   { return v_x; }
34    double getY()   { return v_y; }
35    double getZ()   { return v_z; }
36
37    void setX (double v)   { v_x = v ; }
38    void setY (double v)   { v_y = v ; }
39    void setZ (double v)   { v_z = v ; }
40
41    double getAssoX ()   { return is_associated ? gc_x : v_x ; }
42    double getAssoY ()   { return is_associated ? gc_y : v_y ; }
43    double getAssoZ ()   { return is_associated ? gc_z : v_z ; }
44
45    int  setAssociation   (NewShape* geom, int subid);
46    void clearAssociation ();
47
48    void setColor (double valeur)       { v_scalar = valeur ; }
49
50    Vertex (Document* prev, double x, double y, double z);
51
52 #ifndef SWIG
53 public : 
54    double getCoord (int dir);
55    virtual int     countVertex ()       { return 1; }
56    virtual Vertex* getVertex (int nro)  { return this; }
57
58                                                    // Hexa5
59    int  setAssociation (VertexShape* forme);
60    int  setAssociation (double* point);
61    int  setAssociation (double px, double py, double pz);
62
63    VertexShape* getAssoVertex ()              { return v_shape ;}
64    VertexShape* getAssociation ()             { return v_shape ;}
65
66    void   getAssoCoord (double &x, double &y, double &z);
67    void   getAssoCoord (double* point);
68
69    static void anaVertices (Vertices& cont, double tmin[], double tmax[], double center[]);
70
71 public :
72    Vertex (Vertex* other);
73    virtual ~Vertex () {}
74    virtual void dump () ;
75    virtual void saveXml (XmlWriter* xml);
76
77    void    setScalar (double val)             { setColor (val) ; }
78    double  getScalar ()                       { return v_scalar ; }
79    double* getPoint (double point[]);
80
81    void setCoord  (double x, double y, double z);
82    void setCoord  (double point[]) { setCoord (point[0], point[1], point[2]); }
83
84    bool isin      (double xmin, double xmax, double ymin, double ymax,
85                                             double zmin, double zmax);
86    Edge* getParent (int nro);
87    void  translate (Vector* vecteur, double fact=1.0);
88    void  replace   (Vertex* old);
89
90    Vertex* getClone ()              {  return v_clone ; }
91    void    duplicate (Document* doc);
92
93    static Vertex* createMiddle (Vertex* left, Vertex* right);
94    bool   definedBy (double px, double py, double pz, double eps2=1e-4);
95    double dist2 (Vertex* other);
96
97 private :
98     double v_x;
99     double v_y;
100     double v_z;
101
102     double  v_scalar;
103     Vertex* v_clone;
104     double  gc_x, gc_y, gc_z;
105     VertexShape*  v_shape;
106 #endif
107 };
108 END_NAMESPACE_HEXA
109 #endif