Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/visu.git] / src / VISU_I / VISU_CutLines_i.cc
index 879b0531b617b305203ecde56bf9350340b47257..9b181be3bdf2dd9673dc026701f54f434156a846 100644 (file)
 #include "VISU_Convertor.hxx"
 #include "VISU_PipeLineUtils.hxx"
 
+#include "SUIT_ResourceMgr.h"
+
 #include <vtkAppendPolyData.h>
 
 using namespace VISU;
 using namespace std;
 
-static float EPS_machine = 1.0E-7;
+static vtkFloatingPointType EPS_machine = 1.0E-7;
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
@@ -311,6 +313,9 @@ VISU::CutLines_i
 {
   if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){
     anActor->SetVTKMapping(true);
+    SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+    int aDispMode = aResourceMgr->integerValue("VISU" , "cut_lines_represent", 2);
+    anActor->SetRepresentation(aDispMode);
     return anActor;
   }
   return NULL;
@@ -325,8 +330,8 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
     anAttr = aStudyBuilder->FindOrCreateAttribute(theSObject, "AttributeTableOfReal");
     SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
     
-    typedef set<float> TXCont;
-    typedef map<float,float> TXYMap;
+    typedef set<vtkFloatingPointType> TXCont;
+    typedef map<vtkFloatingPointType,vtkFloatingPointType> TXYMap;
     typedef map<int,TXYMap> TXYMapCont;
     typedef map<long,long> TLineIdCont;
     
@@ -340,9 +345,9 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
     TXCont aXCont;
     TXYMapCont aXYMapCont; 
     TLineIdCont aLineIdCont;  // Define internal numeration of lines
-    const float *aDirLn = myCutLinesPL->GetDirLn();
-    const float *aBasePnt = myCutLinesPL->GetBasePnt();
-    const float *aBoundPrjLn = myCutLinesPL->GetBoundPrjLn();
+    const vtkFloatingPointType *aDirLn = myCutLinesPL->GetDirLn();
+    const vtkFloatingPointType *aBasePnt = myCutLinesPL->GetBasePnt();
+    const vtkFloatingPointType *aBoundPrjLn = myCutLinesPL->GetBoundPrjLn();
     for(int iLine = 0, jLine = 0; iLine < iLineEnd; iLine++){
       vtkDataSet *aDataSet = myCutLinesPL->GetAppendPolyData()->GetInput(iLine);
       aDataSet->Update();
@@ -364,7 +369,7 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
       if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLine = "<<iLine<<"; aNbPoints = "<<aNbPoints);
       aLineIdCont[iLine] = jLine++;
       TXYMap& aXYMap = aXYMapCont[iLine];
-      float aPnt[3], aVect[3], aDist;
+      vtkFloatingPointType aPnt[3], aVect[3], aDist;
       for(int i = 0; i < aNbPoints; i++){
        aDataSet->GetPoint(i,aPnt);
        Sub(aPnt,aBasePnt,aVect);
@@ -394,19 +399,19 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
        TXYMap aNewXYMap;
        TXYMap& aXYMap = aXYMapCont[iLine];
        TXYMap::const_iterator aXYMapIter = aXYMap.begin();
-       std::list<float> XKeys;
+       std::list<vtkFloatingPointType> XKeys;
        for (;aXYMapIter != aXYMap.end() ; aXYMapIter++) XKeys.push_back(aXYMapIter->first);
        XKeys.sort();
        if (XKeys.size() > 1) {
-         float a_first_indx = XKeys.front();
-         float a_last_indx = XKeys.back();
+         vtkFloatingPointType a_first_indx = XKeys.front();
+         vtkFloatingPointType a_last_indx = XKeys.back();
          if (a_first_indx > a_last_indx){
            XKeys.reverse();
-           float tmp = a_first_indx;
+           vtkFloatingPointType tmp = a_first_indx;
            a_first_indx = a_last_indx;
            a_last_indx = tmp;
          }
-         std::list<float>::const_iterator aIter = XKeys.begin();
+         std::list<vtkFloatingPointType>::const_iterator aIter = XKeys.begin();
          for (int k=0;k<XKeys.size() and aIter != XKeys.end();k++,aIter++){
            // Warning: value '1.0' come from workaround:
            // see also aDist = vtkMath::Dot(aVect,aDirLn) / aBoundPrjLn[2];
@@ -431,9 +436,9 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
        aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
        aXCont.insert(aXYMapIter[0]->first);
        for(; aXYMapIter[1] != aXYMap.end(); aXYMapIter[0]++, aXYMapIter[1]++){
-         float aY[3] = {aXYMapIter[0]->second, aXYMapIter[1]->second, 0.0};
+         vtkFloatingPointType aY[3] = {aXYMapIter[0]->second, aXYMapIter[1]->second, 0.0};
          aY[2] = (aY[0] + aY[1])/2.0;
-         float aX[3] = {aXYMapIter[0]->first, aXYMapIter[1]->first, 0.0};
+         vtkFloatingPointType aX[3] = {aXYMapIter[0]->first, aXYMapIter[1]->first, 0.0};
          aX[2] = (aX[0] + aX[1])/2.0;
          aNewXYMap[aX[2]] = aY[2];
          aXCont.insert(aX[2]);
@@ -454,7 +459,7 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
     aTableOfReal->SetNbColumns(iEnd);
     TXCont::const_iterator aXContIter = aXCont.begin();
     for(long i = 0; aXContIter != aXCont.end(); aXContIter++, i++){
-      float aDist = *aXContIter; 
+      vtkFloatingPointType aDist = *aXContIter; 
       aTableOfReal->PutValue(aDist,1,i+1);
       aString.sprintf("%d",i);
       aTableOfReal->SetColumnTitle(i+1,aString.latin1());
@@ -467,7 +472,7 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
        TXYMap::const_iterator aXYMapIter = aXYMap.find(aDist);
        // Can we find some value that belong to the line and have the same X coordinate?
        if(aXYMapIter == aXYMap.end()) continue;
-       float aVal = aXYMapIter->second;
+       vtkFloatingPointType aVal = aXYMapIter->second;
        aTableOfReal->PutValue(aVal,iLineId+2,i+1);
       }
     }