1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef VTKVIEWER_ARCBUILDER_H
21 #define VTKVIEWER_ARCBUILDER_H
23 #include "VTKViewer.h"
34 class vtkUnstructuredGrid;
38 typedef std::list<Pnt> PntList;
40 vtkIdType MergevtkPoints(const std::vector<vtkPoints*>& theCollection,
41 const std::vector< std::vector<double> >& theScalarCollection,
43 std::map<int, double>& thePntId2ScalarValue,
46 vtkIdType Build1DArc(vtkIdType cellId,
47 vtkUnstructuredGrid* input,
50 double myMaxArcAngle);
52 Pnt CreatePnt(vtkCell* cell,
53 vtkDataArray* scalars,
57 * Class for represenation coordinates X,Y,Z
63 XYZ(double , double , double);
66 double X()const {return x;}
67 double Y()const {return y;}
68 double Z()const {return z;}
70 void SetX(const double X) { x=X; }
71 void SetY(const double Y) { y=Y; }
72 void SetZ(const double Z) { z=Z; }
74 void Coord (double& X, double& Y, double& Z) const { X = x; Y = y; Z = z; }
76 double Modulus () const;
85 Class for the representation point in the 3D space.
90 Pnt(double, double, double, double);
93 void Coord (double& X, double& Y, double& Z) const {coord.Coord(X,Y,Z);}
94 XYZ GetXYZ() const {return coord;}
95 double GetScalarValue() const { return scalarValue; }
103 Class for the representation Vector in the 3D space.
108 Vec(const double Xv, const double Yv, const double Zv);
111 XYZ GetXYZ() const {return coord;}
113 double AngleBetween(const Vec & Other);
114 double AngleBetweenInGrad(const Vec & Other);
116 Vec VectMultiplication(const Vec & Other) const;
123 Class for the representation plane in the 3D.
128 Plane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3);
131 double A() const {return myA;}
132 double B() const {return myB;}
133 double C() const {return myC;}
135 Vec GetNormale() const;
138 void CalculatePlane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3);
147 class VTKViewer_ArcBuilder{
149 enum ArcStatus {Arc_Done=0, Arc_Error};
150 VTKViewer_ArcBuilder(const Pnt& thePnt1,
155 ~VTKViewer_ArcBuilder();
159 ArcStatus GetStatus(){return myStatus;}
161 void GetAngle(const double theAngle);
163 static double GetPointAngleOnCircle(const double theXCenter, const double theYCenter,
164 const double theXPoint, const double theYPoint);
166 vtkPoints* GetPoints();
167 const std::vector<double>& GetScalarValues();
171 enum IncOrder{MINUS=0,PLUS};
173 vtkUnstructuredGrid* BuildGrid(const PntList& theList) const;
174 vtkUnstructuredGrid* TransformGrid(vtkUnstructuredGrid* theGrid, const Vec& theAxis, const double angle) const;
175 vtkUnstructuredGrid* BuildArc(std::vector<double>& theScalarValues);
176 IncOrder GetArcAngle( const double& P1, const double& P2, const double& P3, double* Ang);
188 std::vector<double> myScalarValues;
191 #endif //VTKVIEWER_ARCBUILDER_H