1 // Copyright (C) 2007-2013 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"
29 #include <vtkSmartPointer.h>
35 class vtkUnstructuredGrid;
39 typedef std::list<Pnt> PntList;
41 vtkIdType MergevtkPoints(const std::vector< vtkSmartPointer< vtkPoints > >& theCollection,
42 const std::vector< std::vector<double> >& theScalarCollection,
44 std::map<int, double>& thePntId2ScalarValue,
47 vtkIdType Build1DArc(vtkIdType cellId,
48 vtkUnstructuredGrid* input,
51 double myMaxArcAngle);
53 Pnt CreatePnt(vtkCell* cell,
54 vtkDataArray* scalars,
58 * Class for represenation coordinates X,Y,Z
64 XYZ(double , double , double);
67 double X()const {return x;}
68 double Y()const {return y;}
69 double Z()const {return z;}
71 void SetX(const double X) { x=X; }
72 void SetY(const double Y) { y=Y; }
73 void SetZ(const double Z) { z=Z; }
75 void Coord (double& X, double& Y, double& Z) const { X = x; Y = y; Z = z; }
77 double Modulus () const;
86 Class for the representation point in the 3D space.
91 Pnt(double, double, double, double);
94 void Coord (double& X, double& Y, double& Z) const {coord.Coord(X,Y,Z);}
95 XYZ GetXYZ() const {return coord;}
96 double GetScalarValue() const { return scalarValue; }
104 Class for the representation Vector in the 3D space.
109 Vec(const double Xv, const double Yv, const double Zv);
112 XYZ GetXYZ() const {return coord;}
114 double AngleBetween(const Vec & Other);
115 double AngleBetweenInGrad(const Vec & Other);
117 Vec VectMultiplication(const Vec & Other) const;
124 Class for the representation plane in the 3D.
129 Plane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3);
132 double A() const {return myA;}
133 double B() const {return myB;}
134 double C() const {return myC;}
136 Vec GetNormale() const;
139 void CalculatePlane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3);
148 class VTKViewer_ArcBuilder{
150 enum ArcStatus {Arc_Done=0, Arc_Error};
151 VTKViewer_ArcBuilder(const Pnt& thePnt1,
156 ~VTKViewer_ArcBuilder();
160 ArcStatus GetStatus(){return myStatus;}
162 void GetAngle(const double theAngle);
164 static double GetPointAngleOnCircle(const double theXCenter, const double theYCenter,
165 const double theXPoint, const double theYPoint);
167 vtkPoints* GetPoints();
168 const std::vector<double>& GetScalarValues();
172 enum IncOrder{MINUS=0,PLUS};
174 vtkUnstructuredGrid* BuildGrid(const PntList& theList) const;
175 vtkUnstructuredGrid* TransformGrid(vtkUnstructuredGrid* theGrid, const Vec& theAxis, const double angle) const;
176 vtkUnstructuredGrid* BuildArc(std::vector<double>& theScalarValues);
177 IncOrder GetArcAngle( const double& P1, const double& P2, const double& P3, double* Ang);
188 vtkSmartPointer<vtkPoints> myPoints;
189 std::vector<double> myScalarValues;
192 #endif //VTKVIEWER_ARCBUILDER_H