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"
32 class vtkUnstructuredGrid;
36 typedef std::list<Pnt> PntList;
38 vtkIdType MergevtkPoints(const std::vector<vtkPoints*>& theCollection,
39 const std::vector< std::vector<double> >& theScalarCollection,
41 std::map<int, double>& thePntId2ScalarValue,
44 vtkIdType Build1DArc(vtkIdType cellId,
45 vtkUnstructuredGrid* input,
48 vtkFloatingPointType myMaxArcAngle);
50 Pnt CreatePnt(vtkCell* cell,
51 vtkDataArray* scalars,
55 * Class for represenation coordinates X,Y,Z
61 XYZ(double , double , double);
64 double X()const {return x;}
65 double Y()const {return y;}
66 double Z()const {return z;}
68 void SetX(const double X) { x=X; }
69 void SetY(const double Y) { y=Y; }
70 void SetZ(const double Z) { z=Z; }
72 void Coord (double& X, double& Y, double& Z) const { X = x; Y = y; Z = z; }
74 double Modulus () const;
83 Class for the representation point in the 3D space.
88 Pnt(double, double, double, double);
91 void Coord (double& X, double& Y, double& Z) const {coord.Coord(X,Y,Z);}
92 XYZ GetXYZ() const {return coord;}
93 double GetScalarValue() const { return scalarValue; }
101 Class for the representation Vector in the 3D space.
106 Vec(const double Xv, const double Yv, const double Zv);
109 XYZ GetXYZ() const {return coord;}
111 double AngleBetween(const Vec & Other);
112 double AngleBetweenInGrad(const Vec & Other);
114 Vec VectMultiplication(const Vec & Other) const;
121 Class for the representation plane in the 3D.
126 Plane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3);
129 double A() const {return myA;}
130 double B() const {return myB;}
131 double C() const {return myC;}
133 Vec GetNormale() const;
136 void CalculatePlane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3);
145 class VTKViewer_ArcBuilder{
147 enum ArcStatus {Arc_Done=0, Arc_Error};
148 VTKViewer_ArcBuilder(const Pnt& thePnt1,
153 ~VTKViewer_ArcBuilder();
157 ArcStatus GetStatus(){return myStatus;}
159 void GetAngle(const double theAngle);
161 static double GetPointAngleOnCircle(const double theXCenter, const double theYCenter,
162 const double theXPoint, const double theYPoint);
164 vtkPoints* GetPoints();
165 const std::vector<double>& GetScalarValues();
169 enum IncOrder{MINUS=0,PLUS};
171 vtkUnstructuredGrid* BuildGrid(const PntList& theList) const;
172 vtkUnstructuredGrid* TransformGrid(vtkUnstructuredGrid* theGrid, const Vec& theAxis, const double angle) const;
173 vtkUnstructuredGrid* BuildArc(std::vector<double>& theScalarValues);
174 IncOrder GetArcAngle( const double& P1, const double& P2, const double& P3, double* Ang);
186 std::vector<double> myScalarValues;
189 #endif //VTKVIEWER_ARCBUILDER_H