1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
23 // File: VISU_Convertor.cxx
24 // Author: Alexey PETROV
27 #include "VISU_Convertor.hxx"
28 #include "VISU_ConvertorUtils.hxx"
38 GetNbOfPoints(int theVTKCellType)
40 switch(theVTKCellType){
41 case VTK_VERTEX : return 1;
42 case VTK_LINE : return 2;
43 case VTK_TRIANGLE : return 3;
44 case VTK_QUAD : return 4;
45 case VTK_TETRA : return 4;
46 case VTK_HEXAHEDRON : return 8;
47 case VTK_WEDGE : return 6;
48 case VTK_PYRAMID : return 5;
65 ::GenerateName(const VISU::TTime& aTime)
68 const string aUnits = aTime.second, tmp(aUnits.size(),' ');
69 if(aUnits == "" || aUnits == tmp)
70 aName.sprintf("%g, -",aTime.first);
72 aName.sprintf("%g, %s",aTime.first,aTime.second.c_str());
73 aName = aName.simplifyWhiteSpace();
74 return aName.latin1();
79 ::GenerateName(const string& theName,
80 unsigned int theTimeId)
83 aName = QString(theName.c_str()).simplifyWhiteSpace();
84 int iEnd = strlen(aName);
85 static int VtkHighLevelLength = 12; //25
86 if(iEnd > VtkHighLevelLength) iEnd = VtkHighLevelLength;
87 char aNewName[iEnd+1];
88 aNewName[iEnd] = '\0';
89 strncpy(aNewName,aName,iEnd);
90 replace(aNewName,aNewName+iEnd,' ','_');
91 if(true || theTimeId == 0)
94 aName.sprintf("%s_%d",aNewName,theTimeId);
95 return aName.latin1();