]> SALOME platform Git repositories - modules/visu.git/blob - src/CONVERTOR/VISU_TableReader.hxx
Salome HOME
Fix for the "0051899: curves are not shown in opened study" issue.
[modules/visu.git] / src / CONVERTOR / VISU_TableReader.hxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //  VISU CONVERTOR :
21 //  File   : VISU_TableReader.hxx
22 //  Author : Alexey PETROV
23 //  Module : VISU
24 //
25 #ifndef VISU_TableReader_HeaderFile
26 #define VISU_TableReader_HeaderFile
27
28 /*! 
29   \file VISU_TableReader.hxx
30   \brief The file contains definition of the Table reading functionlity
31 */
32
33 #include "VISUConvertor.hxx"
34
35 #include "VISU_IDMapper.hxx"
36
37 #include <string>
38 #include <vector>
39
40 class vtkPassThroughFilter;
41
42 namespace VISU
43 {
44   //---------------------------------------------------------------
45   struct VISU_CONVERTOR_EXPORT TTable2D 
46   {
47     typedef std::string TValue;
48     typedef std::vector<TValue> TValues;
49     
50     struct TRow
51     {
52       std::string myTitle;
53       std::string myUnit;
54       TValues myValues;
55     };
56     
57     std::string myTitle;
58     std::vector<std::string> myColumnUnits;
59     std::vector<std::string> myColumnTitles;
60     
61     typedef std::vector<TRow> TRows;
62     TRows myRows;
63     
64     int 
65     Check();
66
67     void
68     getColumns( TTable2D& theTable2D ) const;
69   };
70
71
72   //---------------------------------------------------------------
73   class VISU_CONVERTOR_EXPORT TTableIDMapper: 
74     public virtual TPolyDataIDMapper,
75     public virtual TTable2D
76   {
77   public:
78     TTableIDMapper();
79     ~TTableIDMapper();
80     
81     virtual
82     vtkPolyData*
83     GetPolyDataOutput();
84
85     virtual
86     vtkAlgorithmOutput*
87     GetOutputPort();
88
89     virtual
90     long unsigned int
91     GetMemorySize();
92
93     void
94     SetXAxisPosition( vtkIdType theAxisPosition );
95
96     vtkIdType
97     GetXAxisPosition();
98
99   protected:
100     vtkIdType myXAxisPosition;
101     vtkPolyData* myOutput;
102     vtkPassThroughFilter* myFilter;
103   };
104   typedef MED::SharedPtr<TTableIDMapper> PTableIDMapper;
105   
106
107   //---------------------------------------------------------------
108   typedef std::vector<PTableIDMapper> TTableContainer;
109   VISU_CONVERTOR_EXPORT 
110     void ImportTables( const char* theFileName, TTableContainer& theContainer,
111                        bool theFirstStrAsTitle = false);
112
113   void ImportCSVTable(const char* theFileName,
114                       TTableContainer& theContainer,
115                       bool theFirstStrAsTitle,
116                       const char theSeparator);
117
118   //---------------------------------------------------------------
119 }
120
121 #endif