Salome HOME
Another compilation error on Mageia 5
[modules/smesh.git] / src / OBJECT / SMESH_DeviceActor.cxx
index c24f10bfc8918f2849ed71400387b7c42a8d435c..6f9e3e44cab8a2a4e818e4c6da0fb3bebddd397b 100644 (file)
@@ -1,36 +1,38 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  SMESH OBJECT : interactive object for SMESH visualization
 //  File   : SMESH_DeviceActor.cxx
 //  Author : 
 //  Module : SMESH
 //
-
 #include "SMESH_DeviceActor.h"
+#include "SMESH_ScalarBarActor.h"
 #include "SMESH_ExtractGeometry.h"
 #include "SMESH_ControlsDef.hxx"
 #include "SMESH_ActorUtils.h"
 #include "SMESH_FaceOrientationFilter.h"
 #include "VTKViewer_CellLocationsArray.h"
+#include "VTKViewer_PolyDataMapper.h"
 
 #include <VTKViewer_Transform.h>
 #include <VTKViewer_TransformFilter.h>
@@ -47,7 +49,6 @@
 #include <vtkPolyDataMapper.h>
 #include <vtkUnstructuredGrid.h>
 
-#include <vtkScalarBarActor.h>
 #include <vtkLookupTable.h>
 #include <vtkDoubleArray.h>
 #include <vtkCellData.h>
@@ -62,6 +63,8 @@
 
 #include <vtkRenderer.h>
 
+#include <vtkPlaneCollection.h>
+
 #include "utilities.h"
 
 #ifdef _DEBUG_
@@ -88,10 +91,11 @@ SMESH_DeviceActor
   myRepresentation = eSurface;
 
   myProperty = vtkProperty::New();
-  myMapper = vtkPolyDataMapper::New();
+  myMapper = VTKViewer_PolyDataMapper::New();
+  myPlaneCollection = vtkPlaneCollection::New();
 
   vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
-                                                                myPolygonOffsetUnits);
+                                                                 myPolygonOffsetUnits);
 
   myMapper->UseLookupTableScalarRangeOn();
   myMapper->SetColorModeToMapScalars();
@@ -118,13 +122,13 @@ SMESH_DeviceActor
   // Orientation of faces
   myIsFacesOriented = false;
 
-  vtkFloatingPointType anRGB[3] = { 1, 1, 1 };
+  double anRGB[3] = { 1, 1, 1 };
   SMESH::GetColor( "SMESH", "orientation_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
 
   myFaceOrientationFilter = SMESH_FaceOrientationFilter::New();
 
   myFaceOrientationDataMapper = vtkPolyDataMapper::New();
-  myFaceOrientationDataMapper->SetInput(myFaceOrientationFilter->GetOutput());
+  myFaceOrientationDataMapper->SetInputConnection(myFaceOrientationFilter->GetOutputPort());
 
   myFaceOrientation = vtkActor::New();
   myFaceOrientation->SetMapper(myFaceOrientationDataMapper);
@@ -137,33 +141,29 @@ SMESH_DeviceActor
 {
   if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<<this);
 
-  myProperty->Delete();
-
   myMapper->Delete();
 
-  myShrinkFilter->Delete();
+  myProperty->Delete();
 
-  myExtractUnstructuredGrid->Delete();
+  myExtractGeometry->Delete();
 
   myMergeFilter->Delete();
+  myExtractUnstructuredGrid->Delete();
 
-  myGeomFilter->Delete();
+  // Orientation of faces
+  myFaceOrientationFilter->Delete();
+  myFaceOrientationDataMapper->RemoveAllInputs();
+  myFaceOrientationDataMapper->Delete();
+  myFaceOrientation->Delete();
 
-  myExtractGeometry->Delete();
+  myGeomFilter->Delete();
 
   myTransformFilter->Delete();
 
-  for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++){
+  for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++)
     myPassFilter[i]->Delete();
-  }
 
-  // Orientation of faces
-  myFaceOrientationFilter->Delete();
-
-  myFaceOrientationDataMapper->RemoveAllInputs();
-  myFaceOrientationDataMapper->Delete();
-
-  myFaceOrientation->Delete();
+  myShrinkFilter->Delete();
 }
 
 
@@ -211,9 +211,9 @@ SMESH_DeviceActor
 {
   int anId = 0;
   if(theIsImplicitFunctionUsed)
-    myPassFilter[ anId ]->SetInput( myExtractGeometry->GetOutput() );
+    myPassFilter[ anId ]->SetInputConnection( myExtractGeometry->GetOutputPort() );
   else
-    myPassFilter[ anId ]->SetInput( myMergeFilter->GetOutput() );
+    myPassFilter[ anId ]->SetInputConnection( myMergeFilter->GetOutputPort() );
     
   myIsImplicitFunctionUsed = theIsImplicitFunctionUsed;
   SetStoreClippingMapping(myStoreClippingMapping);
@@ -228,38 +228,51 @@ SMESH_DeviceActor
     //myIsShrinkable = theGrid->GetNumberOfCells() > 10;
     myIsShrinkable = true;
 
-    myExtractUnstructuredGrid->SetInput(theGrid);
+    myExtractUnstructuredGrid->SetInputData(theGrid);
 
-    myMergeFilter->SetGeometry(myExtractUnstructuredGrid->GetOutput());
+    myMergeFilter->SetGeometryConnection(myExtractUnstructuredGrid->GetOutputPort());
+    
+    //Pass diameters of the balls
+    if(myMapper->GetBallEnabled()) {
+      myMergeFilter->SetScalarsConnection(myExtractUnstructuredGrid->GetOutputPort());
+    }
 
-    myExtractGeometry->SetInput(myMergeFilter->GetOutput());
+    myExtractGeometry->SetInputConnection(myMergeFilter->GetOutputPort());
 
     int anId = 0;
     SetImplicitFunctionUsed(myIsImplicitFunctionUsed);
-    myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
+    myPassFilter[ anId + 1]->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
     
     anId++; // 1
-    myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
+    myTransformFilter->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
 
     anId++; // 2
-    myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() ); 
-    myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
+    myPassFilter[ anId ]->SetInputConnection( myTransformFilter->GetOutputPort() );
+    myPassFilter[ anId + 1 ]->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
 
     anId++; // 3
-    myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
+    myGeomFilter->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
 
     anId++; // 4
-    myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
-    myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
+    myPassFilter[ anId ]->SetInputConnection( myGeomFilter->GetOutputPort() ); 
+    myPassFilter[ anId + 1 ]->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
 
     anId++; // 5
-    myMapper->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
+    myMapper->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
+    if( myPlaneCollection->GetNumberOfItems() )
+      myMapper->SetClippingPlanes( myPlaneCollection );
 
     vtkLODActor::SetMapper( myMapper );
     Modified();
   }
 }
 
+void
+SMESH_DeviceActor
+::SetPlaneCollection( vtkPlaneCollection* theCollection )
+{
+  myPlaneCollection = theCollection;
+}
 
 VTKViewer_ExtractUnstructuredGrid* 
 SMESH_DeviceActor
@@ -281,10 +294,10 @@ SMESH_DeviceActor
 void
 SMESH_DeviceActor
 ::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
-                vtkScalarBarActor* theScalarBarActor,
-                vtkLookupTable* theLookupTable)
+                 SMESH_ScalarBarActor* theScalarBarActor,
+                 vtkLookupTable* theLookupTable)
 {
-  bool anIsInitialized = theFunctor;
+  bool anIsInitialized = theFunctor != NULL;
   if(anIsInitialized){
     vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
 
@@ -298,34 +311,46 @@ SMESH_DeviceActor
     vtkIdType aNbCells = aGrid->GetNumberOfCells();
     aScalars->SetNumberOfComponents(1);
     aScalars->SetNumberOfTuples(aNbCells);
+    double* range;// = aScalars->GetRange();
     
     myVisualObj->UpdateFunctor(theFunctor);
 
     using namespace SMESH::Controls;
-    if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get())){
+    if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get()))
+    {
       for(vtkIdType i = 0; i < aNbCells; i++){
-       vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
-       vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
-       double aValue = aNumericalFunctor->GetValue(anObjId);
-       aScalars->SetValue(i,aValue);
+        vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
+        vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
+        double aValue = aNumericalFunctor->GetValue(anObjId);
+        aScalars->SetValue(i,aValue);
       }
-    }else if(Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get())){
+      range = aScalars->GetRange();
+      if ( range[1] - range[0] < ( qMax(qAbs(range[0]),qAbs(range[1])) + 1e-100 ) * 1e-6 )
+      {
+        range[1] = range[0];
+        for(vtkIdType i = 0; i < aNbCells; i++)
+          aScalars->SetValue(i,range[0]);
+      }
+    }
+    else if(Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get()))
+    {
       for(vtkIdType i = 0; i < aNbCells; i++){
-       vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
-       vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
-       bool aValue = aPredicate->IsSatisfy(anObjId);
-       aScalars->SetValue(i,aValue);
+        vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
+        vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
+        bool aValue = aPredicate->IsSatisfy(anObjId);
+        aScalars->SetValue(i,aValue);
       }
+      range = aScalars->GetRange();
     }
 
     aDataSet->GetCellData()->SetScalars(aScalars);
     aScalars->Delete();
-       
-    theLookupTable->SetRange(aScalars->GetRange());
+
+    theLookupTable->SetRange( range );
     theLookupTable->SetNumberOfTableValues(theScalarBarActor->GetMaximumNumberOfColors());
     theLookupTable->Build();
     
-    myMergeFilter->SetScalars(aDataSet);
+    myMergeFilter->SetScalarsData(aDataSet);
     aDataSet->Delete();
   }
   GetMapper()->SetScalarVisibility(anIsInitialized);
@@ -335,8 +360,8 @@ SMESH_DeviceActor
 void
 SMESH_DeviceActor
 ::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
-                   vtkScalarBarActor* theScalarBarActor,
-                   vtkLookupTable* theLookupTable)
+                    SMESH_ScalarBarActor* theScalarBarActor,
+                    vtkLookupTable* theLookupTable)
 {
   bool anIsInitialized = theFunctor;
   myExtractUnstructuredGrid->ClearRegisteredCells();
@@ -368,44 +393,48 @@ SMESH_DeviceActor
       vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
       aCellTypesArray->SetNumberOfComponents( 1 );
       aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
-      
+
       vtkIdList *anIdList = vtkIdList::New();
       anIdList->SetNumberOfIds(2);
-      
+
       Length2D::TValues::const_iterator anIter = aValues.begin();
-      for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
-       const Length2D::Value& aValue = *anIter;
-       int aNode[2] = {
-         myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
-         myVisualObj->GetNodeVTKId(aValue.myPntId[1])
-       };
-       if(aNode[0] >= 0 && aNode[1] >= 0){
-         anIdList->SetId( 0, aNode[0] );
-         anIdList->SetId( 1, aNode[1] );
-         aConnectivity->InsertNextCell( anIdList );
-         aCellTypesArray->InsertNextValue( VTK_LINE );
-         aScalars->SetValue(aVtkId,aValue.myLength);
-       }
+      aNbCells = 0;
+      for(; anIter != aValues.end(); anIter++){
+        const Length2D::Value& aValue = *anIter;
+        int aNode[2] = {
+          myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
+          myVisualObj->GetNodeVTKId(aValue.myPntId[1])
+        };
+        if(aNode[0] >= 0 && aNode[1] >= 0){
+          anIdList->SetId( 0, aNode[0] );
+          anIdList->SetId( 1, aNode[1] );
+          aConnectivity->InsertNextCell( anIdList );
+          aCellTypesArray->InsertNextValue( VTK_LINE );
+          aScalars->SetValue(aNbCells,aValue.myLength);
+          aNbCells++;
+        }
       }
-      
+      aCellTypesArray->SetNumberOfTuples( aNbCells );
+      aScalars->SetNumberOfTuples( aNbCells );
+
       VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
       aCellLocationsArray->SetNumberOfComponents( 1 );
       aCellLocationsArray->SetNumberOfTuples( aNbCells );
-      
+
       aConnectivity->InitTraversal();
       for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
-       aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
-      
-      aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
+        aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+
+      aDataSet->SetCells( aCellTypesArray, aCellLocationsArray, aConnectivity );
       SetUnstructuredGrid(aDataSet);
 
       aDataSet->GetCellData()->SetScalars(aScalars);
       aScalars->Delete();
-      
+
       theLookupTable->SetRange(aScalars->GetRange());
       theLookupTable->Build();
-      
-      myMergeFilter->SetScalars(aDataSet);
+
+      myMergeFilter->SetScalarsData(aDataSet);
       aDataSet->Delete();
     }
     else if (MultiConnection2D* aMultiConnection2D = dynamic_cast<MultiConnection2D*>(theFunctor.get())){
@@ -424,48 +453,52 @@ SMESH_DeviceActor
       vtkIdType aCellsSize = 3*aNbCells;
       vtkCellArray* aConnectivity = vtkCellArray::New();
       aConnectivity->Allocate( aCellsSize, 0 );
-      
+
       vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
       aCellTypesArray->SetNumberOfComponents( 1 );
       aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
-      
+
       vtkIdList *anIdList = vtkIdList::New();
       anIdList->SetNumberOfIds(2);
-      
+
       MultiConnection2D::MValues::const_iterator anIter = aValues.begin();
-      for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
-       const MultiConnection2D::Value& aValue = (*anIter).first;
-       int aNode[2] = {
-         myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
-         myVisualObj->GetNodeVTKId(aValue.myPntId[1])
-       };
-       if(aNode[0] >= 0 && aNode[1] >= 0){
-         anIdList->SetId( 0, aNode[0] );
-         anIdList->SetId( 1, aNode[1] );
-         aConnectivity->InsertNextCell( anIdList );
-         aCellTypesArray->InsertNextValue( VTK_LINE );
-         aScalars->SetValue(aVtkId,(*anIter).second);
-       }
+      aNbCells = 0;
+      for(; anIter != aValues.end(); anIter++){
+        const MultiConnection2D::Value& aValue = (*anIter).first;
+        int aNode[2] = {
+          myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
+          myVisualObj->GetNodeVTKId(aValue.myPntId[1])
+        };
+        if(aNode[0] >= 0 && aNode[1] >= 0){
+          anIdList->SetId( 0, aNode[0] );
+          anIdList->SetId( 1, aNode[1] );
+          aConnectivity->InsertNextCell( anIdList );
+          aCellTypesArray->InsertNextValue( VTK_LINE );
+          aScalars->SetValue( aNbCells,(*anIter).second);
+          aNbCells++;
+        }
       }
-      
+      aCellTypesArray->SetNumberOfTuples( aNbCells );
+      aScalars->SetNumberOfTuples( aNbCells );
+
       VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
       aCellLocationsArray->SetNumberOfComponents( 1 );
       aCellLocationsArray->SetNumberOfTuples( aNbCells );
-      
+
       aConnectivity->InitTraversal();
       for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
-       aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
-      
+        aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+
       aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
       SetUnstructuredGrid(aDataSet);
 
       aDataSet->GetCellData()->SetScalars(aScalars);
       aScalars->Delete();
-      
+
       theLookupTable->SetRange(aScalars->GetRange());
       theLookupTable->Build();
-      
-      myMergeFilter->SetScalars(aDataSet);
+
+      myMergeFilter->SetScalarsData(aDataSet);
       aDataSet->Delete();
     }
   }
@@ -483,21 +516,31 @@ SMESH_DeviceActor
   myVisualObj->UpdateFunctor(theFunctor);
 
   using namespace SMESH::Controls;
-  if ( dynamic_cast<FreeBorders*>(theFunctor.get()) ||
-       dynamic_cast<FreeFaces*>(theFunctor.get()) ) {
-    Predicate* aFreePredicate = dynamic_cast<Predicate*>(theFunctor.get());
+  Predicate* aPredicate = 0;
+  if (( aPredicate =  dynamic_cast<FreeBorders          *>(theFunctor.get())) ||
+      ( aPredicate =  dynamic_cast<FreeFaces            *>(theFunctor.get())) ||
+      ( aPredicate =  dynamic_cast<BareBorderVolume     *>(theFunctor.get())) ||
+      ( aPredicate =  dynamic_cast<BareBorderFace       *>(theFunctor.get())) ||
+      ( aPredicate =  dynamic_cast<OverConstrainedVolume*>(theFunctor.get())) ||
+      ( aPredicate =  dynamic_cast<CoincidentElements1D *>(theFunctor.get())) ||
+      ( aPredicate =  dynamic_cast<CoincidentElements2D *>(theFunctor.get())) ||
+      ( aPredicate =  dynamic_cast<CoincidentElements3D *>(theFunctor.get())) ||
+      ( aPredicate =  dynamic_cast<OverConstrainedFace  *>(theFunctor.get())))
+  {
     myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
     vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
     vtkIdType aNbCells = aGrid->GetNumberOfCells();
     for( vtkIdType i = 0; i < aNbCells; i++ ){
       vtkIdType anObjId = myVisualObj->GetElemObjId(i);
-      if(aFreePredicate->IsSatisfy(anObjId))
-       myExtractUnstructuredGrid->RegisterCell(i);
+      if(aPredicate->IsSatisfy(anObjId))
+        myExtractUnstructuredGrid->RegisterCell(i);
     }
     if(!myExtractUnstructuredGrid->IsCellsRegistered())
       myExtractUnstructuredGrid->RegisterCell(-1);
     SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
-  }else if(FreeEdges* aFreeEdges = dynamic_cast<FreeEdges*>(theFunctor.get())){
+  }
+  else if(FreeEdges* aFreeEdges = dynamic_cast<FreeEdges*>(theFunctor.get()))
+  {
     SMESH::Controls::FreeEdges::TBorders aBorders;
     aFreeEdges->GetBoreders(aBorders);
     vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
@@ -520,15 +563,15 @@ SMESH_DeviceActor
     for(; anIter != aBorders.end(); anIter++){
       const FreeEdges::Border& aBorder = *anIter;
       int aNode[2] = {
-       myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
-       myVisualObj->GetNodeVTKId(aBorder.myPntId[1])
+        myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
+        myVisualObj->GetNodeVTKId(aBorder.myPntId[1])
       };
       //cout<<"aNode = "<<aBorder.myPntId[0]<<"; "<<aBorder.myPntId[1]<<endl;
       if(aNode[0] >= 0 && aNode[1] >= 0){
-       anIdList->SetId( 0, aNode[0] );
-       anIdList->SetId( 1, aNode[1] );
-       aConnectivity->InsertNextCell( anIdList );
-       aCellTypesArray->InsertNextValue( VTK_LINE );
+        anIdList->SetId( 0, aNode[0] );
+        anIdList->SetId( 1, aNode[1] );
+        aConnectivity->InsertNextCell( anIdList );
+        aCellTypesArray->InsertNextValue( VTK_LINE );
       }
     }
     
@@ -544,14 +587,16 @@ SMESH_DeviceActor
 
     SetUnstructuredGrid(aDataSet);
     aDataSet->Delete();
-  }else if(FreeNodes* aFreeNodes = dynamic_cast<FreeNodes*>(theFunctor.get())){
+  }
+  else if (( aPredicate = dynamic_cast<FreeNodes      *>(theFunctor.get())) ||
+           ( aPredicate = dynamic_cast<CoincidentNodes*>(theFunctor.get())))
+  {
     myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
-    vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
-    vtkIdType aNbCells = aGrid->GetNumberOfCells();
-    for( vtkIdType i = 0; i < aNbCells; i++ ){
+    vtkIdType aNbNodes = myVisualObj->GetNbEntities(SMDSAbs_Node);
+    for( vtkIdType i = 0; i < aNbNodes; i++ ){
       vtkIdType anObjId = myVisualObj->GetNodeObjId(i);
-      if(aFreeNodes->IsSatisfy(anObjId))
-       myExtractUnstructuredGrid->RegisterCell(i);
+      if(aPredicate->IsSatisfy(anObjId))
+        myExtractUnstructuredGrid->RegisterCell(i);
     }
     if(!myExtractUnstructuredGrid->IsCellsRegistered())
       myExtractUnstructuredGrid->RegisterCell(-1);
@@ -590,10 +635,10 @@ SMESH_DeviceActor
 ::SetShrink() 
 {
   if ( !myIsShrinkable ) return;
-  if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() )
+  if ( vtkAlgorithmOutput* aDataSet = myPassFilter[ 0 ]->GetOutputPort() )
   {
-    myShrinkFilter->SetInput( aDataSet );
-    myPassFilter[ 1 ]->SetInput( myShrinkFilter->GetOutput() );
+    myShrinkFilter->SetInputConnection( aDataSet );
+    myPassFilter[ 1 ]->SetInputConnection( myShrinkFilter->GetOutputPort() );
     myIsShrunk = true;
   }
 }
@@ -603,9 +648,9 @@ SMESH_DeviceActor
 ::UnShrink() 
 {
   if ( !myIsShrunk ) return;
-  if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() )
+  if ( vtkAlgorithmOutput* aDataSet = myPassFilter[ 0 ]->GetOutputPort() )
   {    
-    myPassFilter[ 1 ]->SetInput( aDataSet );
+    myPassFilter[ 1 ]->SetInputConnection( aDataSet );
     myPassFilter[ 1 ]->Modified();
     myIsShrunk = false;
     Modified();
@@ -617,15 +662,57 @@ void
 SMESH_DeviceActor
 ::SetFacesOriented(bool theIsFacesOriented) 
 {
-  if ( vtkDataSet* aDataSet = myPassFilter[ 1 ]->GetOutput() )
+  if ( vtkAlgorithmOutput* aDataSet = myTransformFilter->GetOutputPort() )
   {
     myIsFacesOriented = theIsFacesOriented;
     if( theIsFacesOriented )
-      myFaceOrientationFilter->SetInput( aDataSet );
+      myFaceOrientationFilter->SetInputConnection( aDataSet );
     UpdateFaceOrientation();
   }
 }
 
+void
+SMESH_DeviceActor
+::SetFacesOrientationColor(double r,double g,double b)
+{
+  myFaceOrientation->GetProperty()->SetColor( r, g, b );
+}
+
+void
+SMESH_DeviceActor
+::GetFacesOrientationColor(double& r,double& g,double& b)
+{
+  myFaceOrientation->GetProperty()->GetColor( r, g, b );
+}
+
+void
+SMESH_DeviceActor
+::SetFacesOrientationScale(double theScale)
+{
+  myFaceOrientationFilter->SetOrientationScale( theScale );
+}
+
+double
+SMESH_DeviceActor
+::GetFacesOrientationScale()
+{
+  return myFaceOrientationFilter->GetOrientationScale();
+}
+
+void
+SMESH_DeviceActor
+::SetFacesOrientation3DVectors(bool theState)
+{
+  myFaceOrientationFilter->Set3dVectors( theState );
+}
+
+bool
+SMESH_DeviceActor
+::GetFacesOrientation3DVectors()
+{
+  return myFaceOrientationFilter->Get3dVectors();
+}
+
 void
 SMESH_DeviceActor
 ::UpdateFaceOrientation()
@@ -662,6 +749,7 @@ SMESH_DeviceActor
     myGeomFilter->SetWireframeMode(false);
     GetProperty()->SetRepresentation(theMode);
   }
+  SetMarkerEnabled(theMode == ePoint);
   myRepresentation = theMode;
   UpdateFaceOrientation();
   GetProperty()->Modified();
@@ -727,13 +815,13 @@ SMESH_DeviceActor
   return aRetID;
 }
 
-vtkFloatingPointType* 
+double* 
 SMESH_DeviceActor
 ::GetNodeCoord(int theObjID)
 {
   vtkDataSet* aDataSet = myMergeFilter->GetOutput();
   vtkIdType anID = myVisualObj->GetNodeVTKId(theObjID);
-  vtkFloatingPointType* aCoord = (anID >=0) ? aDataSet->GetPoint(anID) : NULL;
+  double* aCoord = (anID >=0) ? aDataSet->GetPoint(anID) : NULL;
   if(MYDEBUG) MESSAGE("GetNodeCoord - theObjID = "<<theObjID<<"; anID = "<<anID);
   return aCoord;
 }
@@ -776,7 +864,7 @@ SMESH_DeviceActor
 }
 
 
-vtkFloatingPointTyp
+doubl
 SMESH_DeviceActor
 ::GetShrinkFactor()
 {
@@ -785,7 +873,7 @@ SMESH_DeviceActor
 
 void
 SMESH_DeviceActor
-::SetShrinkFactor(vtkFloatingPointType theValue)
+::SetShrinkFactor(double theValue)
 {
   theValue = theValue > 0.1? theValue: 0.8;
   myShrinkFilter->SetShrinkFactor(theValue);
@@ -808,13 +896,13 @@ SMESH_DeviceActor
 ::Render(vtkRenderer *ren, vtkMapper* m)
 {
   int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
-  vtkFloatingPointType aStoredFactor, aStoredUnit; 
+  double aStoredFactor, aStoredUnit; 
   vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aStoredFactor,aStoredUnit);
 
   vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
-  vtkFloatingPointType aFactor = myPolygonOffsetFactor, aUnits = myPolygonOffsetUnits;
+  double aFactor = myPolygonOffsetFactor, aUnits = myPolygonOffsetUnits;
   if(myIsHighlited){
-    static vtkFloatingPointType EPS = .01;
+    static double EPS = .01;
     aUnits *= (1.0-EPS);
   }
   vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnits);
@@ -827,10 +915,126 @@ SMESH_DeviceActor
 
 void
 SMESH_DeviceActor
-::SetPolygonOffsetParameters(vtkFloatingPointType factor, 
-                            vtkFloatingPointType units)
+::SetPolygonOffsetParameters(double factor, 
+                             double units)
 {
   myPolygonOffsetFactor = factor;
   myPolygonOffsetUnits = units;
 }
 
+/*!
+ * On/Off representation 2D quadratic element as arked polygon
+ */
+void SMESH_DeviceActor::SetQuadraticArcMode(bool theFlag){
+  myGeomFilter->SetQuadraticArcMode(theFlag);
+}
+
+/*!
+ * Return true if 2D quadratic element displayed as arked polygon
+ */
+bool SMESH_DeviceActor::GetQuadraticArcMode(){
+  return myGeomFilter->GetQuadraticArcMode();
+}
+/*!
+ * Set Max angle for representation 2D quadratic element as arked polygon
+ */
+void SMESH_DeviceActor::SetQuadraticArcAngle(double theMaxAngle){
+  myGeomFilter->SetQuadraticArcAngle(theMaxAngle);
+}
+
+/*!
+ * Return Max angle of the representation 2D quadratic element as arked polygon
+ */
+double SMESH_DeviceActor::GetQuadraticArcAngle(){
+  return myGeomFilter->GetQuadraticArcAngle();
+}
+
+/*!
+ * Set point marker enabled
+ * \param theMarkerEnabled flag to enable/disable point marker
+ */
+void SMESH_DeviceActor::SetMarkerEnabled( bool theMarkerEnabled )
+{
+  myMapper->SetMarkerEnabled( theMarkerEnabled );
+}
+
+/*!
+ * Set point marker enabled
+ * \param theBallEnabled flag to enable/disable ball drawing
+ */
+void SMESH_DeviceActor::SetBallEnabled( bool theBallEnabled ) {
+  myMapper->SetBallEnabled( theBallEnabled );
+}
+
+/*!
+ * Set point marker scale factor
+ * \param theBallScale double value which specifies a scale factor of ball element
+ */
+void SMESH_DeviceActor::SetBallScale( double theBallScale )
+{
+  myMapper->SetBallScale( theBallScale );
+  myMapper->Modified();
+}
+
+/*!
+ * Set standard point marker
+ * \param theMarkerType type of the marker
+ */
+void SMESH_DeviceActor::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
+{
+  myMapper->SetMarkerStd( theMarkerType, theMarkerScale );
+}
+
+/*!
+ * Set custom point marker
+ * \param theMarkerId id of the marker texture
+ * \param theMarkerTexture marker texture
+ */
+void SMESH_DeviceActor::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
+{
+  myMapper->SetMarkerTexture( theMarkerId, theMarkerTexture );
+}
+
+/*!
+ * Get type of the point marker
+ * \return type of the point marker
+ */
+VTK::MarkerType SMESH_DeviceActor::GetMarkerType()
+{
+  return myMapper->GetMarkerType();
+}
+
+/*!
+  Get scale of the point marker
+  \return scale of the point marker
+*/
+VTK::MarkerScale SMESH_DeviceActor::GetMarkerScale()
+{
+  return myMapper->GetMarkerScale();
+}
+
+/*!
+ * Get texture identifier of the point marker
+ * \return texture identifier of the point marker
+ */
+int SMESH_DeviceActor::GetMarkerTexture()
+{
+  return myMapper->GetMarkerTexture();
+}
+
+/*!
+ * Get scale factor of ball element
+ * \return scale factor of ball element
+ */
+double SMESH_DeviceActor::GetBallScale()
+{
+  return myMapper->GetBallScale();
+}
+
+void SMESH_DeviceActor::SetCoincident3DAllowed(bool theFlag) {
+  myGeomFilter->SetAppendCoincident3D(theFlag);
+}
+
+bool SMESH_DeviceActor::IsCoincident3DAllowed() const {
+  return myGeomFilter->GetAppendCoincident3D();
+}