]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Join modifications from V3_2_0_maintainance (mergeto_BR_Dev_For_4_0_22May07 - T32x_16...
authorjfa <jfa@opencascade.com>
Wed, 22 Aug 2007 11:13:36 +0000 (11:13 +0000)
committerjfa <jfa@opencascade.com>
Wed, 22 Aug 2007 11:13:36 +0000 (11:13 +0000)
21 files changed:
src/CONVERTOR/Makefile.am
src/CONVERTOR/VISU_MergeFilter.hxx
src/CONVERTOR/VISU_UsedPointsFilter.cxx [new file with mode: 0644]
src/CONVERTOR/VISU_UsedPointsFilter.hxx [new file with mode: 0644]
src/PIPELINE/Makefile.am
src/PIPELINE/VISU_MaskPointsFilter.cxx [new file with mode: 0644]
src/PIPELINE/VISU_MaskPointsFilter.hxx [new file with mode: 0644]
src/PIPELINE/VISU_PipeLineUtils.hxx
src/PIPELINE/VISU_ScalarMapPL.cxx
src/PIPELINE/VISU_ScalarMapPL.hxx
src/PIPELINE/VISU_StreamLinesPL.cxx
src/PIPELINE/VISU_StreamLinesPL.hxx
src/PIPELINE/VISU_UsedPointsFilter.cxx [deleted file]
src/PIPELINE/VISU_UsedPointsFilter.hxx [deleted file]
src/PIPELINE/VISU_VectorsPL.cxx
src/PIPELINE/VISU_VectorsPL.hxx
src/VISUGUI/VISU_msg_en.po
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_ActionsDef.h
src/VISU_I/VISU_StreamLines_i.cc

index b26b7f127c6ca2dcf6c84e6ae25cb141403c1e38..3176453e4f4c5ed1702528326036910de7984ac0 100644 (file)
@@ -43,6 +43,7 @@ salomeinclude_HEADERS= \
        VISU_AppendPolyData.hxx \
        VISU_AppendFilterUtilities.hxx \
        VISU_ExtractUnstructuredGrid.hxx \
+       VISU_UsedPointsFilter.hxx \
        VISU_CommonCellsFilter.hxx \
        VISUConvertor.hxx
 
@@ -62,6 +63,7 @@ dist_libVisuConvertor_la_SOURCES= \
        VISU_AppendFilterUtilities.cxx \
        VISU_MergeFilter.cxx \
        VISU_MergeFilterUtilities.cxx \
+       VISU_UsedPointsFilter.cxx \
        VISU_CommonCellsFilter.cxx
 
 libVisuConvertor_la_CPPFLAGS= \
index 26a31a5effb87a64bbd3ddaba5cc20cce263d855..09981c9bb033f49c0578301fc4b63656e8b0a916 100644 (file)
@@ -31,7 +31,8 @@
 
 #include "VISU_Convertor.hxx"
 
-#include <vtkDataSetAlgorithm.h>
+//#include <vtkDataSetAlgorithm.h>
+#include <vtkPointSetAlgorithm.h>
 
 namespace VISU
 {
@@ -40,11 +41,11 @@ namespace VISU
 
 
 //------------------------------------------------------------------------------
-class VISU_CONVERTOR_EXPORT VISU_MergeFilter : public vtkDataSetAlgorithm
+class VISU_CONVERTOR_EXPORT VISU_MergeFilter : public vtkPointSetAlgorithm
 {
 public:
   static VISU_MergeFilter *New();
-  vtkTypeMacro(VISU_MergeFilter, vtkDataSetAlgorithm);
+  vtkTypeMacro(VISU_MergeFilter, vtkPointSetAlgorithm);
 
   // Description:
   // Specify object from which to extract geometry information.
diff --git a/src/CONVERTOR/VISU_UsedPointsFilter.cxx b/src/CONVERTOR/VISU_UsedPointsFilter.cxx
new file mode 100644 (file)
index 0000000..8392385
--- /dev/null
@@ -0,0 +1,108 @@
+//  VISU CONVERTOR :
+//
+//  Copyright (C) 2003  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 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 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VISU_UsedPointsFilter.cxx
+//  Author : 
+//  Module : VISU
+
+
+#include "VISU_UsedPointsFilter.hxx"
+
+#include <vtkObjectFactory.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+#include <vtkCell.h>
+#include <vtkIdList.h>
+
+#include <map>
+
+vtkStandardNewMacro(VISU_UsedPointsFilter);
+
+
+VISU_UsedPointsFilter::VISU_UsedPointsFilter()
+{
+}
+
+VISU_UsedPointsFilter::~VISU_UsedPointsFilter()
+{
+}
+
+void VISU_UsedPointsFilter::Execute(){
+  vtkDataSet *anInput = this->GetInput();
+  vtkUnstructuredGrid *anOutput = this->GetOutput();
+
+  typedef std::map<vtkIdType, vtkIdType> TId2IdMap;
+  TId2IdMap aId2IdMap;
+
+  vtkPointData *aPointData = anOutput->GetPointData();
+  aPointData->CopyAllocate(anInput->GetPointData());
+
+  vtkPoints* aUsedPoints = vtkPoints::New();
+  vtkIdList *anIdList = vtkIdList::New();
+  vtkIdType iEnd = anInput->GetNumberOfPoints();
+  for(vtkIdType aPointId = 0; aPointId < iEnd; aPointId++){
+    anInput->GetPointCells(aPointId,anIdList);
+    if(anIdList->GetNumberOfIds() > 0){
+      vtkIdType aNewPointId = aUsedPoints->InsertNextPoint(anInput->GetPoint(aPointId));
+      aPointData->CopyData(anInput->GetPointData(), aPointId, aNewPointId);
+      aId2IdMap[aPointId] = aNewPointId;
+    }
+  }
+  aPointData->Squeeze();
+  anOutput->SetPoints(aUsedPoints);
+  aUsedPoints->Delete();
+  anIdList->Delete();
+
+  vtkCellData *aCellData = anOutput->GetCellData();
+  aCellData->CopyAllocate(anInput->GetCellData());
+
+  anOutput->Allocate(anInput->GetNumberOfCells()); 
+  vtkIdList *anOldPointsIds = vtkIdList::New();
+  vtkIdList *aNewPointsIds = vtkIdList::New();
+  aNewPointsIds->Allocate(VTK_CELL_SIZE);
+  iEnd = anInput->GetNumberOfCells();
+  for(vtkIdType aCellId = 0; aCellId < iEnd; aCellId++){
+    anInput->GetCellPoints(aCellId, anOldPointsIds);
+    vtkIdType aNbPointsInCell = anOldPointsIds->GetNumberOfIds();
+    aNewPointsIds->Reset();
+    for(vtkIdType i = 0; i < aNbPointsInCell; i++){
+      vtkIdType anOldId = anOldPointsIds->GetId(i);
+      TId2IdMap::iterator anIter = aId2IdMap.find(anOldId);
+      if(anIter == aId2IdMap.end())
+       goto NEXT_CELL;
+      vtkIdType aNewId = anIter->second;
+      aNewPointsIds->InsertNextId(aNewId);
+    }
+    {
+      vtkIdType aNewCellId = anOutput->InsertNextCell(anInput->GetCellType(aCellId), aNewPointsIds);
+      aCellData->CopyData(anInput->GetCellData(), aCellId, aNewCellId);
+    }
+  NEXT_CELL:
+    continue;
+  }
+  aCellData->Squeeze();
+  anOldPointsIds->Delete();
+  aNewPointsIds->Delete();
+  anOutput->Squeeze();
+}
+
diff --git a/src/CONVERTOR/VISU_UsedPointsFilter.hxx b/src/CONVERTOR/VISU_UsedPointsFilter.hxx
new file mode 100644 (file)
index 0000000..a6e082f
--- /dev/null
@@ -0,0 +1,46 @@
+//  VISU CONVERTOR :
+//
+//  Copyright (C) 2003  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 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 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VISU_UsedPointsFilter.hxx
+//  Author : 
+//  Module : VISU
+
+#ifndef VISU_UsedPointsFilter_HeaderFile
+#define VISU_UsedPointsFilter_HeaderFile
+
+#include <vtkDataSetToUnstructuredGridFilter.h>
+
+class VISU_UsedPointsFilter : public vtkDataSetToUnstructuredGridFilter
+{
+public:
+  vtkTypeMacro(VISU_UsedPointsFilter,vtkDataSetToUnstructuredGridFilter);
+  static VISU_UsedPointsFilter *New();
+
+protected:
+  VISU_UsedPointsFilter();
+  ~VISU_UsedPointsFilter();
+  
+  virtual void Execute();
+};
+
+#endif
+  
index 9c291cf89316c482fabc0fa0384303ac60d6e346..bb169513ede54750709e593eae0164cd375e37b6 100644 (file)
@@ -49,7 +49,7 @@ salomeinclude_HEADERS= \
        VISU_ScalarBarActor.hxx \
        VISU_Extractor.hxx \
        VISU_FieldTransform.hxx \
-       VISU_UsedPointsFilter.hxx \
+       VISU_MaskPointsFilter.hxx \
        VISU_GaussPointsPL.hxx \
        VISU_Plot3DPL.hxx \
        VISU_OpenGLPointSpriteMapper.hxx \
@@ -84,7 +84,7 @@ dist_libVisuPipeLine_la_SOURCES= \
        VISU_ScalarBarActor.cxx \
        VISU_Extractor.cxx \
        VISU_FieldTransform.cxx \
-       VISU_UsedPointsFilter.cxx \
+       VISU_MaskPointsFilter.cxx \
        VISU_GaussPointsPL.cxx \
        VISU_Plot3DPL.cxx \
        SALOME_ExtractGeometry.cxx \
diff --git a/src/PIPELINE/VISU_MaskPointsFilter.cxx b/src/PIPELINE/VISU_MaskPointsFilter.cxx
new file mode 100644 (file)
index 0000000..c879e29
--- /dev/null
@@ -0,0 +1,70 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  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 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:    VISU_StreamLinesPL.cxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_MaskPointsFilter.hxx"
+
+#include <vtkObjectFactory.h>
+#include <vtkPointSet.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+#include <vtkPoints.h>
+#include <vtkIdList.h>
+
+vtkStandardNewMacro(VISU_MaskPointsFilter);
+
+VISU_MaskPointsFilter::VISU_MaskPointsFilter(){
+  PercentsOfUsedPoints = 1.0;
+}
+
+VISU_MaskPointsFilter::~VISU_MaskPointsFilter(){}
+
+void VISU_MaskPointsFilter::Execute(){
+  vtkPointSet *anInput = this->GetInput(), *anOutput = this->GetOutput();
+  anOutput->GetPointData()->CopyAllOff();
+  anOutput->GetCellData()->CopyAllOff();
+  anOutput->CopyStructure(anInput);
+
+  vtkPoints* aPoints = vtkPoints::New();
+  vtkIdList *anIdList = vtkIdList::New();
+  vtkIdType iEnd = anInput->GetNumberOfPoints();
+  for(vtkIdType i = 0; i < iEnd; i++){
+    anInput->GetPointCells(i,anIdList);
+    if(anIdList->GetNumberOfIds() > 0)
+      aPoints->InsertNextPoint(anInput->GetPoint(i));
+  }
+  vtkPoints* aNewPoints = vtkPoints::New();
+  iEnd = aPoints->GetNumberOfPoints();
+  if (PercentsOfUsedPoints > 0){
+    vtkIdType anOffset = vtkIdType(1.0/PercentsOfUsedPoints);
+    if(anOffset < 1) anOffset = 1;
+    for(vtkIdType i = 0; i < iEnd; i += anOffset)
+      aNewPoints->InsertNextPoint(aPoints->GetPoint(i));
+  }
+  anOutput->SetPoints(aNewPoints);
+  aNewPoints->Delete();
+  aPoints->Delete();
+}
diff --git a/src/PIPELINE/VISU_MaskPointsFilter.hxx b/src/PIPELINE/VISU_MaskPointsFilter.hxx
new file mode 100644 (file)
index 0000000..38d8792
--- /dev/null
@@ -0,0 +1,49 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  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 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 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:    VISU_MaskPointsFilter.hxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_MaskPointsFilter_HeaderFile
+#define VISU_MaskPointsFilter_HeaderFile
+
+#include <vtkPointSetToPointSetFilter.h>
+
+class VISU_MaskPointsFilter : public vtkPointSetToPointSetFilter{
+protected:
+  VISU_MaskPointsFilter();
+  VISU_MaskPointsFilter(const VISU_MaskPointsFilter&);
+
+  virtual void Execute();
+  float PercentsOfUsedPoints;
+
+public:
+  vtkTypeMacro(VISU_MaskPointsFilter,vtkPointSetToPointSetFilter);
+  static VISU_MaskPointsFilter* New();
+  virtual ~VISU_MaskPointsFilter();
+
+  vtkSetMacro(PercentsOfUsedPoints,float);
+  vtkGetMacro(PercentsOfUsedPoints,float);
+};
+
+#endif
index 2fcb4bcadb15aca26c4a424c045cdcf43503d1b6..65909900e69c2d219a4221c578b75ac603e38522 100644 (file)
@@ -88,22 +88,6 @@ namespace VISU
       theOutputFilter->SetInput(theDataSet);
   }
 
-  //----------------------------------------------------------------------------
-  template<class TOutputFilter> 
-  void
-  ToCellCenters(TOutputFilter* theOutputFilter, 
-               vtkCellCenters *theCellCenters,
-               vtkDataSet* theDataSet)
-
-  {
-    if(VISU::IsDataOnCells(theDataSet)){
-      theCellCenters->SetInput(theDataSet);
-      theCellCenters->VertexCellsOn();
-      theOutputFilter->SetInput(theCellCenters->GetOutput());
-    }else
-      theOutputFilter->SetInput(theDataSet);
-  }
-
   //----------------------------------------------------------------------------
   //! Checks whether the float values are the same or not
   bool VISU_PIPELINE_EXPORT
index 2856a2986bf4c3ae94ed2b869d4ddae999eb4c24..a4df7b39dd1fe2366b51688b941a928b447b5783 100644 (file)
@@ -212,7 +212,7 @@ VISU_ScalarMapPL
 
 
 //----------------------------------------------------------------------------
-vtkDataSet* 
+vtkPointSet* 
 VISU_ScalarMapPL
 ::GetMergedInput()
 {
index 130207935d7990878e208c34fb1e289df8c9209c..eda0bea10fcd815983aee825a8ffc3f4a9aeddb2 100644 (file)
@@ -77,7 +77,7 @@ public:
 
   //----------------------------------------------------------------------------
   virtual 
-  vtkDataSet* 
+  vtkPointSet* 
   GetMergedInput();
 
 protected:
index 97d9abfbe13f26d3b1406683f775d559d57b6602..375d99ac5d426c1d3ab6b717229617c518faddbd 100644 (file)
 
 
 #include "VISU_StreamLinesPL.hxx"
-#include "VISU_Extractor.hxx"
-#include "VISU_FieldTransform.hxx"
-#include "VISU_UsedPointsFilter.hxx"
-#include "VTKViewer_GeometryFilter.h"
 
+#include "VISU_Extractor.hxx"
+//#include "VISU_FieldTransform.hxx"
+//#include "VISU_UsedPointsFilter.hxx"
+#include "VISU_MaskPointsFilter.hxx"
 #include "VISU_PipeLineUtils.hxx"
 
+#include "VTKViewer_GeometryFilter.h"
+
 #include <algorithm>
 
 #include <vtkCell.h>
@@ -64,7 +66,7 @@ VISU_StreamLinesPL
   myStream = vtkStreamLine::New();
   myCenters = vtkCellCenters::New();
   myGeomFilter = VTKViewer_GeometryFilter::New();
-  myPointsFilter = VISU_UsedPointsFilter::New();
+  myPointsFilter = VISU_MaskPointsFilter::New();
   myPercents = 0.3;
   mySource = NULL;
 }
@@ -184,11 +186,11 @@ VISU_StreamLinesPL
 ::SetParams(vtkFloatingPointType theIntStep,
            vtkFloatingPointType thePropogationTime,
            vtkFloatingPointType theStepLength,
-           vtkDataSet* theSource,
+           vtkPointSet* theSource,
            vtkFloatingPointType thePercents,
            int theDirection)
 {
-  vtkDataSet* aDataSet = theSource? theSource: GetMergedInput();
+  vtkPointSet* aDataSet = theSource? theSource: GetMergedInput();
   aDataSet->Update();
 
   vtkIdType aNbOfPoints = aDataSet->GetNumberOfPoints();
@@ -236,7 +238,7 @@ VISU_StreamLinesPL
 
 
 //----------------------------------------------------------------------------
-vtkDataSet* 
+vtkPointSet* 
 VISU_StreamLinesPL
 ::GetSource() 
 {
@@ -288,12 +290,12 @@ VISU_StreamLinesPL
 //----------------------------------------------------------------------------
 size_t
 VISU_StreamLinesPL
-::IsPossible(vtkDataSet* theDataSet, 
+::IsPossible(vtkPointSet* theDataSet, 
             vtkFloatingPointType thePercents)
 {
   vtkFloatingPointType aStepLength = GetBaseStepLength(theDataSet);
   vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet);
-  VISU_UsedPointsFilter *aPointsFilter = VISU_UsedPointsFilter::New();
+  VISU_MaskPointsFilter *aPointsFilter = VISU_MaskPointsFilter::New();
   aPointsFilter->SetInput(theDataSet);
   vtkDataSet* aDataSet = aPointsFilter->GetOutput();
   aDataSet->Update();
index ed762a9b5bab26bf376aa209ac913eaacb8760cc..7909b760bfce599b3ec755ded44d1687c12e4a7f 100644 (file)
 #include <vtkStreamLine.h>
 
 class vtkDataSet;
+class vtkPointSet;
 class vtkCellCenters;
 class VTKViewer_GeometryFilter;
-class VISU_UsedPointsFilter;
+class VISU_MaskPointsFilter;
 
 
 //----------------------------------------------------------------------------
@@ -52,12 +53,12 @@ public:
   SetParams(vtkFloatingPointType theIntStep,
            vtkFloatingPointType thePropogationTime,
            vtkFloatingPointType theStepLength,
-           vtkDataSet* theSource = NULL,
+           vtkPointSet* theSource = NULL,
            vtkFloatingPointType thePercents = 0.3,
            int theDirection = VTK_INTEGRATE_BOTH_DIRECTIONS);
 
   virtual
-  vtkDataSet*
+  vtkPointSet*
   GetSource();
 
   virtual
@@ -186,7 +187,7 @@ public:
 
   static
   size_t
-  IsPossible(vtkDataSet* theDataSet, 
+  IsPossible(vtkPointSet* theDataSet, 
             vtkFloatingPointType thePercents = 0.3);
 
 protected:
@@ -232,10 +233,10 @@ protected:
                    vtkDataSet* theDataSet);
 
   vtkStreamLine* myStream;
-  vtkDataSet* mySource;
+  vtkPointSet* mySource;
   vtkCellCenters* myCenters;
   VTKViewer_GeometryFilter *myGeomFilter;
-  VISU_UsedPointsFilter *myPointsFilter;
+  VISU_MaskPointsFilter *myPointsFilter;
   vtkFloatingPointType myPercents;
 };
 
diff --git a/src/PIPELINE/VISU_UsedPointsFilter.cxx b/src/PIPELINE/VISU_UsedPointsFilter.cxx
deleted file mode 100644 (file)
index b88d18e..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-//  VISU OBJECT : interactive object for VISU entities implementation
-//
-//  Copyright (C) 2003  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 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
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-//
-// File:    VISU_StreamLinesPL.cxx
-// Author:  Alexey PETROV
-// Module : VISU
-
-
-#include "VISU_UsedPointsFilter.hxx"
-
-#include "VISU_ConvertorUtils.hxx"
-
-#include <vtkObjectFactory.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkPointData.h>
-#include <vtkCellData.h>
-#include <vtkPoints.h>
-#include <vtkIdList.h>
-
-#include <vtkInformation.h>
-#include <vtkInformationVector.h>
-
-
-//----------------------------------------------------------------------------
-vtkStandardNewMacro(VISU_UsedPointsFilter);
-
-
-//----------------------------------------------------------------------------
-VISU_UsedPointsFilter::VISU_UsedPointsFilter()
-{
-  PercentsOfUsedPoints = 1.0;
-}
-
-//----------------------------------------------------------------------------
-VISU_UsedPointsFilter::~VISU_UsedPointsFilter()
-{}
-
-
-//----------------------------------------------------------------------------
-int VISU_UsedPointsFilter::RequestData (vtkInformation *vtkNotUsed(request),
-                                        vtkInformationVector **inputVector,
-                                        vtkInformationVector *outputVector)
-{
-  // get the info objects
-  vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
-  vtkInformation *outInfo = outputVector->GetInformationObject(0);
-
-  // get the input and ouptut
-  vtkDataSet *input = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
-  vtkPointSet *output = vtkPointSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
-
-  //////////
-  output->GetPointData()->CopyAllOff();
-  output->GetCellData()->CopyAllOff();
-  output->CopyStructure(input);
-
-  vtkPoints* aPoints = vtkPoints::New();
-  vtkIdList *anIdList = vtkIdList::New();
-  vtkIdType iEnd = input->GetNumberOfPoints();
-  for (vtkIdType i = 0; i < iEnd; i++) {
-    input->GetPointCells(i, anIdList);
-    if (anIdList->GetNumberOfIds() > 0)
-      aPoints->InsertNextPoint(input->GetPoint(i));
-  }
-  vtkPoints* aNewPoints = vtkPoints::New();
-  iEnd = aPoints->GetNumberOfPoints();
-  if (PercentsOfUsedPoints > 0) {
-    vtkIdType anOffset = vtkIdType(1.0/PercentsOfUsedPoints);
-    if (anOffset < 1) anOffset = 1;
-    for (vtkIdType i = 0; i < iEnd; i += anOffset)
-      aNewPoints->InsertNextPoint(aPoints->GetPoint(i));
-  }
-  output->SetPoints(aNewPoints);
-  aNewPoints->Delete();
-  aPoints->Delete();
-
-  return 1;
-}
diff --git a/src/PIPELINE/VISU_UsedPointsFilter.hxx b/src/PIPELINE/VISU_UsedPointsFilter.hxx
deleted file mode 100644 (file)
index 380e0fc..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-//  VISU OBJECT : interactive object for VISU entities implementation
-//
-//  Copyright (C) 2003  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 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 
-// 
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-//
-// File:    VISU_UsedPointsFilter.hxx
-// Author:  Alexey PETROV
-// Module : VISU
-
-#ifndef VISU_UsedPointsFilter_HeaderFile
-#define VISU_UsedPointsFilter_HeaderFile
-
-#include <vtkPointSetAlgorithm.h>
-
-
-//----------------------------------------------------------------------------
-class VISU_UsedPointsFilter : public vtkPointSetAlgorithm
-{
-public:
-  vtkTypeMacro(VISU_UsedPointsFilter, vtkPointSetAlgorithm);
-
-  static
-  VISU_UsedPointsFilter*
-  New();
-
-  vtkSetMacro(PercentsOfUsedPoints,float);
-  vtkGetMacro(PercentsOfUsedPoints,float);
-
-protected:
-  VISU_UsedPointsFilter();
-  VISU_UsedPointsFilter(const VISU_UsedPointsFilter&);
-
-  virtual
-  ~VISU_UsedPointsFilter();
-
-  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
-
-  float PercentsOfUsedPoints;
-};
-
-#endif
index 36a3014f2c43cb7924859399177d1a7721b7e464..73153dfc5c3003a3411bcc353f9b9e89881ffe6e 100644 (file)
@@ -28,6 +28,7 @@
 #include "VISU_VectorsPL.hxx"
 #include "VISU_FieldTransform.hxx"
 #include "VISU_PipeLineUtils.hxx"
+#include "VISU_UsedPointsFilter.hxx"
 #include "VTKViewer_TransformFilter.h"
 #include "VTKViewer_Transform.h"
 
 //----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_VectorsPL);
 
-
 //----------------------------------------------------------------------------
+template<class TOutputFilter>
+void ToCellCenters(TOutputFilter *theOutputFilter, 
+                  vtkCellCenters *theCellCenters,
+                  vtkDataSet* theDataSet,
+                  VISU_UsedPointsFilter* theUsedPointsFilter)
+{
+  if(VISU::IsDataOnCells(theDataSet)){
+    theCellCenters->SetInput(theDataSet);
+    theCellCenters->VertexCellsOn();
+    theOutputFilter->SetInput(theCellCenters->GetOutput());
+  }else {
+    theUsedPointsFilter->SetInput(theDataSet);
+    theOutputFilter->SetInput(theUsedPointsFilter->GetOutput());
+  }
+}
+
+
 VISU_VectorsPL
 ::VISU_VectorsPL()
 {
@@ -57,6 +74,8 @@ VISU_VectorsPL
 
   myCenters = vtkCellCenters::New();
   myTransformFilter = VTKViewer_TransformFilter::New();
+
+  myUsedPointsFilter = VISU_UsedPointsFilter::New();
 }
 
 
@@ -76,6 +95,8 @@ VISU_VectorsPL
   myLineSource->Delete();
 
   myTransformFilter->Delete();
+  
+  myUsedPointsFilter->Delete();
 }
 
 
@@ -202,17 +223,19 @@ VISU_VectorsPL
 ::Build()
 {
   Superclass::Build();
-
-  VISU::ToCellCenters(myBaseGlyph,
-                     myCenters,
-                     GetMergedInput());
+  
+  ToCellCenters(myBaseGlyph,
+               myCenters,
+               GetMergedInput(),
+               myUsedPointsFilter);
   myBaseGlyph->SetVectorModeToUseVector();
   myBaseGlyph->SetScaleModeToScaleByVector();
   myBaseGlyph->SetColorModeToColorByScalar();
 
-  VISU::ToCellCenters(myTransformFilter,
-                     myCenters,
-                     GetMergedInput());
+  ToCellCenters(myTransformFilter,
+               myCenters,
+               GetMergedInput(),
+               myUsedPointsFilter);
   myTransformedGlyph->SetInput(myTransformFilter->GetOutput());
   myTransformedGlyph->SetVectorModeToUseVector();
   myTransformedGlyph->SetScaleModeToScaleByVector();
index cbdcd300adee9757dcd67e8a3928b484ab13859d..9bf2a43c042ac43f9b0b7f85981a42d27aeb2803 100644 (file)
@@ -40,6 +40,7 @@ class vtkLineSource;
 
 class vtkGlyph3D;
 
+class VISU_UsedPointsFilter;
 
 //----------------------------------------------------------------------------
 class VISU_PIPELINE_EXPORT VISU_VectorsPL : public VISU_DeformedShapePL
@@ -139,6 +140,8 @@ protected:
 
   vtkCellCenters* myCenters;
   VTKViewer_TransformFilter *myTransformFilter;
+
+  VISU_UsedPointsFilter* myUsedPointsFilter;
 };
 
 
index 6478722c03c2f0065cdc3f4e34d00651ac9c5fe8..19b1cc9ab949b8d0f46045c808da8416e09fa478 100644 (file)
@@ -34,6 +34,9 @@ msgstr "Warning"
 msgid "INF_DONE"
 msgstr " done"
 
+msgid "INF_FAILED"
+msgstr " failed!"
+
 msgid "WRN_STUDY_LOCKED"
 msgstr "Current Study is locked"
 
@@ -440,6 +443,9 @@ msgstr "Import TimeStamp"
 msgid "VisuGUI::MEN_IMPORT_MED_FIELD"
 msgstr "Import Field"
 
+msgid "VisuGUI::MEN_LOAD_COMPONENT_DATA"
+msgstr "Load Component Data"
+
 msgid "VisuGUI::MEN_DELETE_OBJS"
 msgstr "Delete"
 
index 7955acb06392663d38eea6fd83fed45bf7232c3a..9e512fe420368b274765f3edb9bbbd1afdff7040 100644 (file)
@@ -405,11 +405,9 @@ VisuGUI
       // The same in SUPERVISION: NPAL14522
       {
         SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
-        //std::string aCompIOR;
         CORBA::String_var aCompIOR;
         if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
           CORBA::String_var aCompDataType = aSComp->ComponentDataType();
-          //std::string aCompDataType = aSComp->ComponentDataType();
 
           // obtain a driver by a component data type
           // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
@@ -417,10 +415,8 @@ VisuGUI
           SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
           try {
             CORBA::Object_var
-              //anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType.c_str());
               anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
             if (CORBA::is_nil(anEngineObj))
-              //anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType.c_str());
               anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
 
             if (!CORBA::is_nil(anEngineObj))
@@ -429,7 +425,6 @@ VisuGUI
             if (!CORBA::is_nil(anEngine)) {
               // try to load
               SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
-              //aStudyBuilder->LoadWith(aSComp, aDriverIOR.in());
               aStudyBuilder->LoadWith(aSComp, anEngine);
             }
           }
@@ -461,6 +456,67 @@ VisuGUI
   QApplication::restoreOverrideCursor();
 }
 
+void VisuGUI::OnLoadComponentData()
+{
+  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+  if (CheckLock(aCStudy,GetDesktop(this)))
+    return;
+  SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
+
+  LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+  SALOME_ListIO aListIO;
+  aSelectionMgr->selectedObjects(aListIO);
+
+  SALOME_ListIteratorOfListIO It (aListIO);
+  QApplication::setOverrideCursor(Qt::waitCursor);
+  for (; It.More(); It.Next()) {
+    Handle(SALOME_InteractiveObject) anIO = It.Value();
+    SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
+    if (!aSObject->_is_nil()) {
+
+      // try to load a component data from an opened (presumably) study
+      // The same in SUPERVISION: NPAL14522
+      {
+        SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
+        CORBA::String_var aCompIOR;
+        if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
+          CORBA::String_var aCompDataType = aSComp->ComponentDataType();
+
+          QString anInfo ("Loading ");
+          anInfo = anInfo + aCompDataType.in() + " Component Data ..."; 
+          application()->putInfo( anInfo );
+
+          // obtain a driver by a component data type
+          // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
+          SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
+          SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
+          try {
+            CORBA::Object_var
+              anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
+            if (CORBA::is_nil(anEngineObj))
+              anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
+
+            if (!CORBA::is_nil(anEngineObj))
+              anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
+
+            if (!CORBA::is_nil(anEngine)) {
+              // try to load
+              SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
+              aStudyBuilder->LoadWith(aSComp, anEngine);
+            }
+
+            application()->putInfo( anInfo + tr("INF_DONE"));
+          }
+          catch (...) {
+            application()->putInfo( anInfo + tr("INF_FAILED"));
+          }
+        }
+      }
+    }
+  }
+  QApplication::restoreOverrideCursor();
+}
+
 void
 CreateCurves( SalomeApp_Module* theModule,
               VISU::CutLines_i* thePrs,
@@ -2059,6 +2115,10 @@ VisuGUI
                 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
                 this, SLOT(OnImportMedField()));
 
+  createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIconSet(),
+                tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
+                this, SLOT(OnLoadComponentData()));
+
   createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(),
                 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
                 this, SLOT(OnCreateMesh()));
@@ -2782,6 +2842,14 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
   if (aListIO.Extent() != 1) 
     return;
 
+  // Check if the object's data is loaded
+  _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
+  std::string aCompIOR;
+  if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
+    //std::string aCompDataType = aSComp->ComponentDataType();
+    action( VISU_LOAD_COMPONENT_DATA )->addTo(theMenu); // "Load Component Data"
+  }
+
   VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
   if (aType == VISU::TANIMATION) {
     action( VISU_SHOW_ANIMATION )->addTo(theMenu);
@@ -2796,24 +2864,19 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
       if (!CORBA::is_nil(anObject)) {
         SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
         if (!CORBA::is_nil(aMED.in())) {
-          action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu);
+          action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu); // "Import Structure"
         }
 
-        SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure"
+        SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
         if (!CORBA::is_nil(aField)) {
           action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp"
         }
       } else {
-        _PTR(SObject) aSFather = aSObject->GetFather();
-        if (aSFather) {
-          _PTR(GenericAttribute) anAttr;
-          aSFather->FindAttribute(anAttr, "AttributeName");
-          if (anAttr) {
-            _PTR(AttributeName) aName (anAttr);
-            std::string aValue = aName->Value();
-            if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
-              action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
-            }
+        _PTR(SObject) aSFather1 = aSObject->GetFather();
+        if (aSFather1) {
+          std::string aValue = aSFather1->GetName();
+          if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
+            action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
           }
         }
       }
index 50be5f8d351c4ef9ce00637ceb9bcc4b1071b4c7..b5a5bfeb79698268a78e69968a623ac762abf13b 100644 (file)
@@ -91,6 +91,8 @@ protected slots:
   void OnExportTableToFile();
   void OnImportMedField();
 
+  void OnLoadComponentData();
+
   void OnCreateMesh();
   void OnCreateScalarMap();
   void OnCreateDeformedShape();
index 33e2a81192a6ffa6b19277257c683a626e3cc060..40ef7783f5a01bda867e60353c0be85ef7fa5026 100644 (file)
@@ -28,6 +28,7 @@
 #define VISU_IMPORT_MED_STRUCTURE   4004
 #define VISU_IMPORT_MED_TIMESTAMP   4005
 #define VISU_IMPORT_MED_FIELD       4006
+#define VISU_LOAD_COMPONENT_DATA    4007
 
 #define VISU_SCALAR_MAP             4011
 #define VISU_DEFORMED_SHAPE         4012
index 86f4cbe045c3594ae1fd340cbb2e97433a49fda8..62757e1ce9cf2af9499a5e3add66ea1e6986bd4c 100644 (file)
@@ -252,7 +252,7 @@ VISU::StreamLines_i
     Execute()
     {
       myPrs3dServant = NULL;
-      vtkDataSet* aSource = NULL;
+      vtkPointSet* aSource = NULL;
       if (!CORBA::is_nil(myPrs3d)){
        myPrs3dServant = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(myPrs3d).in());
        if(myPrs3dServant){