]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Improvement 15484
authorvsv <vsv@opencascade.com>
Tue, 15 Apr 2008 11:26:36 +0000 (11:26 +0000)
committervsv <vsv@opencascade.com>
Tue, 15 Apr 2008 11:26:36 +0000 (11:26 +0000)
23 files changed:
src/OBJECT/Makefile.am
src/OBJECT/VISU_IsoSurfActor.cxx [new file with mode: 0644]
src/OBJECT/VISU_IsoSurfActor.h [new file with mode: 0644]
src/PIPELINE/Makefile.am
src/PIPELINE/VISU_IsoSurfacesPL.cxx
src/PIPELINE/VISU_IsoSurfacesPL.hxx
src/PIPELINE/VISU_LabelPointsFilter.cxx [new file with mode: 0644]
src/PIPELINE/VISU_LabelPointsFilter.hxx [new file with mode: 0644]
src/VISUGUI/VISU_msg_en.po
src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx
src/VISUGUI/VisuGUI_IsoSurfacesDlg.h
src/VISU_I/Makefile.am
src/VISU_I/VISU_DeformedShape_i.cc
src/VISU_I/VISU_DeformedShape_i.hh
src/VISU_I/VISU_DumpPython.cc
src/VISU_I/VISU_IsoSurfaces_i.cc
src/VISU_I/VISU_IsoSurfaces_i.hh
src/VISU_I/VISU_MonoColorPrs_i.cc [new file with mode: 0644]
src/VISU_I/VISU_MonoColorPrs_i.hh [new file with mode: 0644]
src/VISU_I/VISU_Prs3d_i.cc
src/VISU_I/VISU_StreamLines_i.cc
src/VISU_I/VISU_StreamLines_i.hh
src/VISU_I/VISU_Vectors_i.cc

index 11b9d5422651874cc090ffaddfddbd40903ecebf..7f4241daa8913797c1a66f060224586c4cf7bfb3 100644 (file)
@@ -41,7 +41,8 @@ salomeinclude_HEADERS = \
        VISU_GaussPtsAct.h \
        VISU_VectorsAct.h \
        VISU_PointMap3dActor.h \
-       VISU_ActorBase.h
+       VISU_ActorBase.h \
+       VISU_IsoSurfActor.h
 
 dist_libVisuObject_la_SOURCES = \
        VISU_Actor.cxx \
@@ -53,7 +54,8 @@ dist_libVisuObject_la_SOURCES = \
        VISU_GaussPtsAct.cxx \
        VISU_VectorsAct.cxx \
        VISU_PointMap3dActor.cxx \
-       VISU_ActorBase.cxx
+       VISU_ActorBase.cxx \
+       VISU_IsoSurfActor.cxx
 
 libVisuObject_la_CPPFLAGS= \
        $(QT_INCLUDES) \
diff --git a/src/OBJECT/VISU_IsoSurfActor.cxx b/src/OBJECT/VISU_IsoSurfActor.cxx
new file mode 100644 (file)
index 0000000..3c58fc4
--- /dev/null
@@ -0,0 +1,165 @@
+//  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_IsoSurfActor.cxx
+//  Author : Vitaly Smetannikov
+//  Module : VISU
+
+
+#include "VISU_IsoSurfActor.h"
+#include "VISU_PipeLine.hxx"
+#include "VISU_LabelPointsFilter.hxx"
+
+
+#include <vtkObjectFactory.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkPolyData.h>
+#include <vtkActor2D.h>
+//#include <vtkMaskPoints.h>
+#include <vtkLabeledDataMapper.h>
+#include <vtkProperty2D.h>
+#include <vtkRenderer.h>
+#include <vtkCellArray.h>
+#include <vtkPointData.h>
+
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_IsoSurfActor);
+
+
+//----------------------------------------------------------------------------
+VISU_IsoSurfActor::VISU_IsoSurfActor():
+  VISU_ScalarMapAct(),
+  myIsLinesLabeled(true)
+{
+  myLabelsDataSet = vtkPolyData::New();
+
+//   myMaskPoints = vtkMaskPoints::New();
+//   myMaskPoints->SetInput(myLabelsDataSet);
+//   myMaskPoints->SetOnRatio(100);
+
+  myMaskPoints = VISU_LabelPointsFilter::New();
+  myMaskPoints->SetInput(myLabelsDataSet);
+
+  myLabeledDataMapper = vtkLabeledDataMapper::New();
+  myLabeledDataMapper->SetInput(myMaskPoints->GetOutput());
+  //myLabeledDataMapper->SetLabelFormat("%e");
+  myLabeledDataMapper->SetLabelModeToLabelScalars();
+    
+  myLabels = vtkActor2D::New();
+  myLabels->SetMapper(myLabeledDataMapper);
+  myLabels->GetProperty()->SetColor(1,1,1);
+  myLabels->SetVisibility(myIsLinesLabeled);
+}
+
+
+//----------------------------------------------------------------------------
+VISU_IsoSurfActor::~VISU_IsoSurfActor()
+{
+  myLabelsDataSet->Delete();
+  myMaskPoints->Delete();
+  myLabeledDataMapper->Delete();
+  myLabels->Delete();
+}
+
+//----------------------------------------------------------------------------
+void VISU_IsoSurfActor::SetLinesLabeled(bool theIsLinesLabeled, int theNbLbl)
+{
+  myIsLinesLabeled = theIsLinesLabeled;
+  myMaskPoints->SetPointsNb(theNbLbl);
+  Modified();
+}
+//----------------------------------------------------------------------------
+int VISU_IsoSurfActor::GetNbLabels() const 
+{ 
+  return myMaskPoints->GetPointsNb(); 
+}
+
+
+//----------------------------------------------------------------------------
+void VISU_IsoSurfActor::UpdateLabels()
+{
+  if (myIsLinesLabeled) {
+    vtkDataSet* aDataSet = GetPipeLine()->GetOutput();
+    if (aDataSet != NULL) {
+      unsigned long aTime = myLabelsDataSet->GetMTime();
+      unsigned long anObjTime = GetMTime();
+      if (aTime < anObjTime) {
+       myLabelsDataSet->ShallowCopy(aDataSet);
+       myLabelsDataSet->Modified();
+      }
+    }
+  }
+  myLabels->SetVisibility(myIsLinesLabeled);
+}
+
+
+//----------------------------------------------------------------------------
+void VISU_IsoSurfActor::AddToRender(vtkRenderer* theRenderer)
+{
+  VISU_ScalarMapAct::AddToRender(theRenderer);
+  theRenderer->AddActor2D(myLabels);
+}
+
+//----------------------------------------------------------------------------
+void VISU_IsoSurfActor::RemoveFromRender(vtkRenderer* theRenderer)
+{
+  VISU_ScalarMapAct::RemoveFromRender(theRenderer);
+  theRenderer->RemoveActor(myLabels);
+}
+
+//From vtkFollower
+int VISU_IsoSurfActor::RenderOpaqueGeometry(vtkViewport *vp)
+{
+  UpdateLabels();
+  return VISU_ScalarMapAct::RenderOpaqueGeometry(vp);
+}
+
+
+int VISU_IsoSurfActor::RenderTranslucentGeometry(vtkViewport *vp)
+{
+  UpdateLabels();
+  return VISU_ScalarMapAct::RenderTranslucentGeometry(vp);
+}
+
+void VISU_IsoSurfActor::SetVisibility(int theMode){
+  VISU_ScalarMapAct::SetVisibility(theMode);
+  if(GetVisibility())
+    myLabels->VisibilityOn();
+  else
+    myLabels->VisibilityOff();
+  Modified();
+}
+
+
+///!!!! For test purposes only
+// void VISU_IsoSurfActor::SetMapperInput(vtkDataSet* theDataSet)
+// {
+//   VISU_ScalarMapAct::SetMapperInput(theDataSet);
+
+//   vtkFeatureEdges* aFilter = vtkFeatureEdges::New();
+//   aFilter->SetInput(VISU_ScalarMapAct::GetInput());
+//   SetInput(aFilter->GetOutput());
+// }
diff --git a/src/OBJECT/VISU_IsoSurfActor.h b/src/OBJECT/VISU_IsoSurfActor.h
new file mode 100644 (file)
index 0000000..0377ae6
--- /dev/null
@@ -0,0 +1,88 @@
+//  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_IsoSurfActor.h
+//  Author : Vitaly Smetannikov
+//  Module : VISU
+
+
+#ifndef VISU_VectorsAct_HeaderFile
+#define VISU_VectorsAct_HeaderFile
+
+#include "VISU_ScalarMapAct.h"
+
+class vtkActor2D;
+//class vtkMaskPoints;
+class vtkLabeledDataMapper;
+class vtkPolyData;
+class VISU_LabelPointsFilter;
+
+
+class VTKOCC_EXPORT VISU_IsoSurfActor : public VISU_ScalarMapAct 
+{
+ public:
+  vtkTypeMacro(VISU_IsoSurfActor, VISU_ScalarMapAct);
+  
+  static VISU_IsoSurfActor* New();
+  
+  
+  //----------------------------------------------------------------------------
+  virtual void AddToRender( vtkRenderer* ); 
+  
+  virtual void RemoveFromRender( vtkRenderer* );
+
+  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
+  virtual int RenderTranslucentGeometry(vtkViewport *viewport);
+  
+  //virtual void SetPipeLine(VISU_PipeLine* thePipeLine);
+
+  void SetLinesLabeled(bool theIsLinesLabeled, int theNbLbl);
+  bool GetLinesLabeled() const { return myIsLinesLabeled;}
+   
+  int GetNbLabels() const;
+
+
+  //----------------------------------------------------------------------------
+  //! Visibility management
+  virtual void SetVisibility( int );
+
+
+ protected:
+
+  VISU_IsoSurfActor();
+  ~VISU_IsoSurfActor();
+
+  void UpdateLabels();
+
+  vtkActor2D *myLabels;
+  vtkLabeledDataMapper* myLabeledDataMapper;
+  //vtkMaskPoints* myMaskPoints;
+  VISU_LabelPointsFilter* myMaskPoints;
+  vtkPolyData* myLabelsDataSet;
+
+  bool myIsLinesLabeled;
+  //int myNbLabels;
+};
+
+
+#endif
index 34ae81b0d31ccc662f8e0d2843525ecb1fe70288..1a93742e7f89f882cc924f1a871df808b13fb182 100644 (file)
@@ -64,7 +64,8 @@ salomeinclude_HEADERS= \
        VISU_SphereWidget.hxx \
        VISU_WidgetCtrl.hxx \
        VISU_ScalarMapOnDeformedShapePL.hxx \
-       VISUPipeline.hxx
+       VISUPipeline.hxx \
+       VISU_LabelPointsFilter.hxx
 
 dist_libVisuPipeLine_la_SOURCES= \
        VISU_MapperHolder.cxx \
@@ -101,7 +102,8 @@ dist_libVisuPipeLine_la_SOURCES= \
        VISU_SphereWidget.cxx \
        VISU_WidgetCtrl.cxx \
        VISU_ScalarBarCtrl.cxx \
-       VISU_ScalarMapOnDeformedShapePL.cxx
+       VISU_ScalarMapOnDeformedShapePL.cxx \
+       VISU_LabelPointsFilter.cxx
 
 libVisuPipeLine_la_CPPFLAGS= \
        $(VTK_INCLUDES) \
index bea9854f35cfe9ffd5ba52774d85447d5dcf67e6..78ae91af88827ba2d25191642f8072641e2dd918 100644 (file)
 #include "VISU_LookupTable.hxx"
 
 #include "VISU_PipeLineUtils.hxx"
+#include "VISU_LabelPointsFilter.hxx"
 
 #include <vtkContourFilter.h>
 
 
+
 //----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_IsoSurfacesPL);
 
@@ -100,6 +102,14 @@ VISU_IsoSurfacesPL
   return myContourFilter->GetNumberOfContours();
 }
 
+//----------------------------------------------------------------------------
+vtkFloatingPointType
+VISU_IsoSurfacesPL
+::GetValue(int i) 
+{
+  return myContourFilter->GetValue(i);
+}
+
 
 //----------------------------------------------------------------------------
 void
@@ -181,6 +191,7 @@ VISU_IsoSurfacesPL
   VISU::CellDataToPoint(myContourFilter,
                        myCellDataToPointData,
                        GetMergedInput());
+
 }
 
 
index 83a646dd8d3623b6574854fe2696f8d4ffb4bf81..73aec61ed465368085d9d0c93e00ba64aeffe771 100644 (file)
@@ -53,6 +53,8 @@ public:
   int
   GetNbParts();
 
+  virtual vtkFloatingPointType GetValue(int i);
+
   virtual
   void
   SetNbParts(int theNb = 10);
diff --git a/src/PIPELINE/VISU_LabelPointsFilter.cxx b/src/PIPELINE/VISU_LabelPointsFilter.cxx
new file mode 100644 (file)
index 0000000..040d6a2
--- /dev/null
@@ -0,0 +1,296 @@
+//  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_LabelPointsFilter.cxx
+// Author:  Vitaly Smetannikov
+// Module : VISU
+
+
+
+#include "VISU_LabelPointsFilter.hxx"
+
+#include <vtkPolyData.h>
+#include <vtkObjectFactory.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+#include <vtkFeatureEdges.h>
+#include <vtkCellArray.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+#include <vtkDataArray.h>
+#include <vtkDoubleArray.h>
+#include <vtkGeometryFilter.h>
+#include <vtkPolyDataConnectivityFilter.h>
+#include <vtkMath.h>
+
+#include <set>
+#include <vector>
+
+
+#define CONTAINS(SET, PT) (SET.find(PT) != SET.end())
+
+struct ltIdType 
+{
+  bool operator()(const vtkIdType a1, const vtkIdType a2) const
+  {
+    return a1 < a2;
+  }
+};
+
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_LabelPointsFilter);
+
+
+//----------------------------------------------------------------------------
+void VISU_LabelPointsFilter::SetPointsNb(int theNb)
+{
+  if (myPointsNb == theNb) return;
+  myPointsNb = (theNb < 1)? 1:theNb;
+  Modified();
+}
+
+//----------------------------------------------------------------------------
+VISU_LabelPointsFilter::VISU_LabelPointsFilter():
+  vtkPolyDataAlgorithm(),
+  myPointsNb(3)
+{
+}
+
+//----------------------------------------------------------------------------
+VISU_LabelPointsFilter::~VISU_LabelPointsFilter()
+{}
+
+
+
+//----------------------------------------------------------------------------
+int VISU_LabelPointsFilter::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
+  vtkPolyData* input = vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
+  vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
+
+  GetRegions(input, output);
+
+  return 1;
+}
+
+int VISU_LabelPointsFilter::RequestUpdateExtent(vtkInformation* vtkNotUsed(request),
+                                               vtkInformationVector** inputVector,
+                                               vtkInformationVector* outputVector)
+{
+  // get the info objects
+  vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
+  vtkInformation *outInfo = outputVector->GetInformationObject(0);
+
+  vtkPolyData* input = vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
+  vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
+
+  GetRegions(input, output);
+  return 1;
+}
+
+
+
+int VISU_LabelPointsFilter::GetRegions(vtkPolyData* theInput, 
+                                      vtkPolyData* theOutput)
+{
+  vtkIdType cellId, i;
+  vtkIdType numPts, numCells;
+  vtkPoints *inPts;
+
+  vtkPointData *aInpPD=theInput->GetPointData(), *aOutPD=theOutput->GetPointData();
+  vtkCellData *aInpCD=theInput->GetCellData(), *aOutCD=theOutput->GetCellData();
+  
+  //  Check input/allocate storage
+  //
+  inPts = theInput->GetPoints();
+
+  if (inPts == NULL)
+    return 1;
+
+  numPts = inPts->GetNumberOfPoints();
+  numCells = theInput->GetNumberOfCells();
+
+  if ( numPts < 1 || numCells < 1 )
+    return 1;
+
+  // Build cell structure
+  //
+  vtkPolyData* aMesh = vtkPolyData::New();
+  aMesh->CopyStructure(theInput);
+  aMesh->BuildLinks();
+
+  // Initialize.  Keep track of points and cells visited.
+  //
+  vtkIdTypeArray* aRegionSizes = vtkIdTypeArray::New();
+  int* aVisited = new int[numCells];
+  for ( i=0; i < numCells; i++ )
+     aVisited[i] = -1;
+
+  vtkIdType* aPointMap = new vtkIdType[numPts];  
+  for ( i=0; i < numPts; i++ )
+    aPointMap[i] = -1;
+
+  vtkPoints* newPts = vtkPoints::New();
+  newPts->Allocate(numPts);
+
+  // Traverse all cells marking those visited.  Each new search
+  // starts a new connected region. Connected region grows 
+  // using a connected wave propagation.
+  //
+  vtkIdList* aWave = vtkIdList::New();
+  aWave->Allocate(numPts/4+1,numPts);
+  vtkIdList* aWave2 = vtkIdList::New();
+  aWave2->Allocate(numPts/4+1,numPts);
+
+  vtkIdType aPointNumber = 0;
+  int aRegionNumber = 0;
+
+  vtkIdList* aCellIds = vtkIdList::New(); 
+  aCellIds->Allocate(8, VTK_CELL_SIZE);
+  vtkIdList* aPointIds = vtkIdList::New(); 
+  aPointIds->Allocate(8, VTK_CELL_SIZE);
+
+  //  vtkIdType aNumCellsInRegion;
+
+  aOutPD->CopyAllocate(aInpPD);
+  aOutCD->CopyAllocate(aInpCD);
+
+  //visit all cells marking with region number
+  for (cellId=0; cellId < numCells; cellId++) {
+    if ( aVisited[cellId] < 0 ) {
+      aWave->InsertNextId(cellId);
+      aPointNumber = 0;
+      TraverseAndMark(aWave, aWave2, aVisited, aPointMap, 
+                     aRegionNumber, aPointNumber, aMesh);
+      
+      if (aPointNumber >= myPointsNb) {
+       std::set<vtkIdType, ltIdType> aIdxSet;
+       for (i=0; i < numPts; i++) {
+         if ( aPointMap[i] > -1 ) {
+           aIdxSet.insert(i);
+           aPointMap[i] = -1;
+         }
+       }
+       std::vector<vtkIdType> aIdx(aIdxSet.begin(), aIdxSet.end());
+       int aActualPts = aIdx.size();
+       int aNewId;
+       if (myPointsNb > 2) {
+         int k = aActualPts/(myPointsNb - 1);
+         int count;
+         for (i=0, count = 0; i < aActualPts; i+=k, count++) {
+           aNewId = newPts->InsertNextPoint(inPts->GetPoint(aIdx[i]));
+           aOutPD->CopyData(aInpPD, aIdx[i], aNewId);
+         }
+         if (count < myPointsNb) {
+           aNewId = newPts->InsertNextPoint(inPts->GetPoint(aIdx[aActualPts - 1]));
+           aOutPD->CopyData(aInpPD, aIdx[aActualPts - 1], aNewId);
+         }
+       } else {          
+         aNewId = newPts->InsertNextPoint(inPts->GetPoint(aIdx[0]));
+         aOutPD->CopyData(aInpPD, aIdx[0], aNewId);
+         if (myPointsNb == 2) {
+           aNewId = newPts->InsertNextPoint(inPts->GetPoint(aIdx[aActualPts - 1]));
+           aOutPD->CopyData(aInpPD, aIdx[aActualPts - 1], aNewId);
+         }
+       }
+      }
+      aWave->Reset();
+      aWave2->Reset(); 
+    }
+  }
+
+  aWave->Delete();
+  aWave2->Delete();
+
+  theOutput->SetPoints(newPts);
+  newPts->Delete();
+
+
+  delete [] aVisited;
+  delete [] aPointMap;
+  aMesh->Delete();
+  theOutput->Squeeze();
+  aCellIds->Delete();
+  aPointIds->Delete();
+
+  return aRegionSizes->GetMaxId() + 1;
+}
+
+
+// Mark current cell as visited and assign region number.  Note:
+// traversal occurs across shared vertices.
+//
+void VISU_LabelPointsFilter::TraverseAndMark (vtkIdList* theWave, 
+                                             vtkIdList* theWave2, 
+                                             int* theVisited,
+                                             vtkIdType* thePointMap,
+                                             int& theRegionNumber,
+                                             vtkIdType& thePointNumber,
+                                             vtkPolyData* theMesh)
+{
+  vtkIdType cellId, ptId, numIds, i;
+  int j, k;
+  vtkIdType *pts, *cells, npts;
+  vtkIdList *tmpWave;
+  unsigned short ncells;
+  vtkIdList* aNeighborCellPointIds = vtkIdList::New();
+
+
+  while ( (numIds=theWave->GetNumberOfIds()) > 0 ) {
+    for ( i=0; i < numIds; i++ ) {
+      cellId = theWave->GetId(i);
+      if ( theVisited[cellId] < 0 ) {
+        theVisited[cellId] = theRegionNumber;
+        theMesh->GetCellPoints(cellId, npts, pts);
+       
+        for (j=0; j < npts; j++) {
+          if ( thePointMap[ptId=pts[j]] < 0 ) {
+            thePointMap[ptId] = thePointNumber++;
+         }       
+          theMesh->GetPointCells(ptId,ncells,cells);
+         
+          // check connectivity criterion (geometric + scalar)
+          for (k=0; k < ncells; k++) {
+            cellId = cells[k];
+           theWave2->InsertNextId(cellId);
+           //              }
+         }//for all cells using this point
+       }//for all points of this cell
+      }//if cell not yet visited
+    }//for all cells in this wave
+    
+    tmpWave = theWave;
+    theWave = theWave2;
+    theWave2 = tmpWave;
+    tmpWave->Reset();
+  } //while wave is not empty
+}
diff --git a/src/PIPELINE/VISU_LabelPointsFilter.hxx b/src/PIPELINE/VISU_LabelPointsFilter.hxx
new file mode 100644 (file)
index 0000000..46fa1c4
--- /dev/null
@@ -0,0 +1,76 @@
+//  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_LabelPointsFilter.hxx
+// Author:  Vitaly Smetannikov
+// Module : VISU
+
+#ifndef VISU_LabelPointsFilter_HeaderFile
+#define VISU_LabelPointsFilter_HeaderFile
+
+#include "VISUPipeline.hxx"
+#include <vtkPolyDataAlgorithm.h>
+
+class vtkPolyData;
+
+class VISU_PIPELINE_EXPORT VISU_LabelPointsFilter : public vtkPolyDataAlgorithm
+{
+public:
+  vtkTypeMacro(VISU_LabelPointsFilter, vtkPolyDataAlgorithm);
+
+  static VISU_LabelPointsFilter* New();
+
+  void SetPointsNb(int theNb);
+
+  int GetPointsNb() const { return myPointsNb; }
+
+protected:
+  VISU_LabelPointsFilter();
+
+  virtual ~VISU_LabelPointsFilter();
+
+  virtual int RequestData(vtkInformation* request,
+                          vtkInformationVector** inputVector,
+                          vtkInformationVector* outputVector);
+
+  virtual int RequestUpdateExtent(vtkInformation*,
+                                  vtkInformationVector**,
+                                  vtkInformationVector*);
+
+
+  void TraverseAndMark (vtkIdList* theWave, 
+                       vtkIdList* theWave2, 
+                       int* theVisited,
+                       vtkIdType* thePointMap,
+                       int& theRegionNumber,
+                       vtkIdType& thePointNumber,
+                       vtkPolyData* theMesh);
+  
+  int GetRegions(vtkPolyData* theInput, 
+                vtkPolyData* theOutput);
+
+  int myPointsNb;
+
+};
+
+
+#endif
index 58d6ee9bc2a08d02cb0644ada4b58b24d2ed3c80..32a8e7cab1444615f54d3a16ab26d8a165f21b80 100644 (file)
@@ -766,6 +766,15 @@ msgstr "Iso Surfaces Definition"
 msgid "VisuGUI_IsoSurfPane::SHOW_LEVEL_LABELS"
 msgstr "Show level labels"
 
+msgid "VisuGUI_IsoSurfPane::MAGNITUDE_COLORING_CHK"
+msgstr "Magnitude coloring"
+
+msgid "VisuGUI_IsoSurfPane::SEL_COLOR_BTN"
+msgstr "Select Color"
+
+msgid "VisuGUI_IsoSurfPane::SHOW_VALUES_CHK"
+msgstr "Show values (nb per surface)"
+
 
 #: VisuGUI_NonIsometricDlg.cxx
 
index 17a5e38387404527ce4792109eaa618d03f41a79..16aeef9f4936b0861c2b4ba04436fd76971d8045 100644 (file)
@@ -46,6 +46,7 @@
 #include <qlayout.h>
 #include <qvalidator.h>
 #include <qtabwidget.h>
+#include <qcolordialog.h>
 
 using namespace std;
 
@@ -90,8 +91,28 @@ VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane (QWidget* parent,
   LabelMax->setBuddy(MaxIso);
   TopGroupLayout->addWidget( MaxIso, 2, 1 );
 
+  myUseMagnitude = new QCheckBox(tr("MAGNITUDE_COLORING_CHK"), TopGroup, "myUseMagnitude");
+  myUseMagnitude->setChecked(true);
+  TopGroupLayout->addWidget( myUseMagnitude, 3, 0 );
+  mySelColor = new QPushButton(tr("SEL_COLOR_BTN"), TopGroup, "mySelColor");
+  mySelColor->setPaletteBackgroundColor(Qt::black);
+  mySelColor->setPaletteForegroundColor(Qt::gray);
+  mySelColor->setDisabled(true);
+  TopGroupLayout->addWidget( mySelColor, 3, 1 );
+  connect( mySelColor, SIGNAL( clicked() ), this, SLOT( setColor() ) );
+  connect( myUseMagnitude, SIGNAL( toggled(bool) ), mySelColor, SLOT( setDisabled(bool) ) );
+
+  myUseLabels = new QCheckBox(tr("SHOW_VALUES_CHK"), TopGroup, "myUseLabels");
+  myUseLabels->setChecked(false);
+  TopGroupLayout->addWidget( myUseLabels, 4, 0 );
+  myNbLabels = new QSpinBox( 1, 100, 1, TopGroup, "myNbLabels" );
+  myNbLabels->setEnabled(false);
+  TopGroupLayout->addWidget( myNbLabels, 4, 1 );
+  connect( myUseLabels, SIGNAL( toggled(bool) ), myNbLabels, SLOT( setEnabled(bool) ) );
+
+
   QPushButton* aUpdateBtn = new QPushButton( "Update scalar bar range with these values", TopGroup);
-  TopGroupLayout->addMultiCellWidget( aUpdateBtn, 3, 3, 0, 1);
+  TopGroupLayout->addMultiCellWidget( aUpdateBtn, 5, 5, 0, 1);
   connect( aUpdateBtn, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) );
 }
 
@@ -100,12 +121,29 @@ void VisuGUI_IsoSurfPane::initFromPrsObject (VISU::IsoSurfaces_i* thePrs)
   NbrIso->setValue(thePrs->GetNbSurfaces());
   MinIso->setText(QString::number(thePrs->GetSubMin()));
   MaxIso->setText(QString::number(thePrs->GetSubMax()));
+  myUseMagnitude->setChecked(thePrs->IsColored());
+  SALOMEDS::Color anOldColor = thePrs->GetColor();
+  QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
+  setColor(aColor);
+
+  myUseLabels->setChecked(thePrs->IsLabeled());
+  myNbLabels->setValue(thePrs->GetNbLabels());
 }
 
 int VisuGUI_IsoSurfPane::storeToPrsObject (VISU::IsoSurfaces_i* thePrs)
 {
   thePrs->SetNbSurfaces(NbrIso->value());
   thePrs->SetSubRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
+  thePrs->ShowLabels(myUseLabels->isOn(), myNbLabels->value());
+  thePrs->ShowColored(myUseMagnitude->isOn());
+  if(!thePrs->IsColored()){
+    QColor aQColor = color();
+    SALOMEDS::Color aColor;
+    aColor.R = aQColor.red()/255.;
+    aColor.G = aQColor.green()/255.;
+    aColor.B = aQColor.blue()/255.;
+    thePrs->SetColor(aColor);
+  }
   return 1;
 }
 
@@ -126,8 +164,22 @@ bool VisuGUI_IsoSurfPane::check()
   return true;
 }
 
+void VisuGUI_IsoSurfPane::setColor()
+{
+  QColor cnew = QColorDialog::getColor( mySelColor->paletteBackgroundColor(), this );
+  if ( cnew.isValid() )
+    setColor(cnew);
+}
 
+void VisuGUI_IsoSurfPane::setColor(const QColor& theColor)
+{
+  mySelColor->setPaletteBackgroundColor(theColor);
+}
 
+QColor VisuGUI_IsoSurfPane::color() const
+{
+  return mySelColor->paletteBackgroundColor();
+}
 
 
 /*!
index 70ced751572c4894759eda643fb4cc6c37585036..13b4c2ab1c150423ba4cb7758ffb5af81d338ecc 100644 (file)
@@ -62,14 +62,22 @@ class VisuGUI_IsoSurfPane : public QVBox
 
   bool check();
 
+  void setColor(const QColor& theColor);
+  QColor color() const;
+
  protected slots:
   void onCBUpdate();
+ void setColor();
 
  private:
   QLineEdit* MinIso;
   QLineEdit* MaxIso;
   QSpinBox*  NbrIso;
   VisuGUI_ScalarBarPane* myScalarPane;
+  QCheckBox*      myUseMagnitude;
+  QPushButton*    mySelColor;
+  QCheckBox*      myUseLabels;
+  QSpinBox*       myNbLabels;
 };
 
 
index 9b17d5346b51fe4287d26d20edebb114dd462b16..542eab8c407107a7fd4d1a9123388e864d374a99 100644 (file)
@@ -52,6 +52,7 @@ salomeinclude_HEADERS = \
        VISU_TimeAnimation.h \
        VISU_ScalarMapOnDeformedShape_i.hh \
        VISU_ColoredPrs3dFactory.hh \
+       VISU_MonoColorPrs_i.hh \
        SALOME_GenericObjPointer.hh
 
 libVISUEngineImpl_la_SOURCES = \
@@ -85,6 +86,7 @@ libVISUEngineImpl_la_SOURCES = \
        VISU_Table_i.cc \
        VISU_PointMap3d_i.cc \
        VISU_DumpPython.cc \
+       VISU_MonoColorPrs_i.cc \
        SALOME_GenericObjPointer.cc
 
 MOC_FILES = VISU_TimeAnimation_moc.cxx
index 5e8ae25df85037ccdb09dd3661c2870ab03b4893..8c458200da80a20ee0914342a27e379ae39d0965 100644 (file)
@@ -123,6 +123,7 @@ VISU::DeformedShape_i
 ::DeformedShape_i(EPublishInStudyMode thePublishInStudyMode):
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
+  MonoColorPrs_i(thePublishInStudyMode),
   myDeformedShapePL(NULL)
 {
   if(MYDEBUG) MESSAGE("DeformedShape_i::DeformedShape_i");
@@ -151,8 +152,6 @@ VISU::DeformedShape_i
         const std::string& theFieldName, 
         CORBA::Long theTimeStampNumber)
 {
-  myIsColored = false;
-  myColor.R = myColor.G = myColor.B = 0.5;
   return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
 }
 
@@ -167,10 +166,6 @@ VISU::DeformedShape_i
     return NULL;
 
   SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble());
-  myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt();
-  myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
-  myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
-  myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
 
   return this;
 }
@@ -184,11 +179,6 @@ VISU::DeformedShape_i
   TSuperClass::ToStream(theStr);
 
   Storable::DataToStream( theStr, "myFactor", GetScale() );
-
-  Storable::DataToStream( theStr, "myIsColored", myIsColored );
-  Storable::DataToStream( theStr, "myColor.R", myColor.R );
-  Storable::DataToStream( theStr, "myColor.G", myColor.G );
-  Storable::DataToStream( theStr, "myColor.B", myColor.B );
 }
 
 
@@ -220,54 +210,6 @@ VISU::DeformedShape_i
 }
 
 
-//---------------------------------------------------------------
-CORBA::Boolean 
-VISU::DeformedShape_i
-::IsColored()
-{
-  return myIsColored;
-}
-
-
-//---------------------------------------------------------------
-void
-VISU::DeformedShape_i
-::ShowColored(CORBA::Boolean theColored)
-{
-  if(myIsColored == theColored)
-    return;
-
-  myIsColored = theColored; 
-  myParamsTime.Modified();
-}
-
-//---------------------------------------------------------------
-SALOMEDS::Color 
-VISU::DeformedShape_i
-::GetColor()
-{
-  return myColor;
-}
-
-
-//---------------------------------------------------------------
-void
-VISU::DeformedShape_i
-::SetColor(const SALOMEDS::Color& theColor)
-{
-  bool anIsSameValue = VISU::CheckIsSameValue(myColor.R, theColor.R);
-  anIsSameValue &= VISU::CheckIsSameValue(myColor.G, theColor.G);
-  anIsSameValue &= VISU::CheckIsSameValue(myColor.B, theColor.B);
-  if(anIsSameValue)
-    return;
-
-  VISU::TSetModified aModified(this);
-  
-  myColor = theColor;
-  myParamsTime.Modified();
-}
-
-
 //---------------------------------------------------------------
 void
 VISU::DeformedShape_i
@@ -321,34 +263,7 @@ VISU::DeformedShape_i
   bool toShrink  = aResourceMgr->booleanValue("VISU", "deformed_shape_shrink", false);
   anActor->SetRepresentation(aDispMode);
   if (toShrink && !toSupressShrinking) anActor->SetShrink();
-  anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
   return anActor;
 }
 
 
-//---------------------------------------------------------------
-VISU_Actor* 
-VISU::DeformedShape_i
-::CreateActor() 
-{
-  return CreateActor(false);
-}
-
-
-//---------------------------------------------------------------
-void
-VISU::DeformedShape_i
-::UpdateActor(VISU_Actor* theActor) 
-{
-  if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
-    if(IsColored()){
-      anActor->SetBarVisibility(true);
-      GetPipeLine()->GetMapper()->SetScalarVisibility(1);
-    }else{
-      anActor->SetBarVisibility(false);
-      GetPipeLine()->GetMapper()->SetScalarVisibility(0);
-      anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
-    }
-    TSuperClass::UpdateActor(theActor);
-  }
-}
index 1f5d90c78c5cd6513dd043d5fa90739bb6b4cbe0..96487209ea5f68f2246555daa8590f1f2640fa68 100644 (file)
@@ -28,7 +28,7 @@
 #define VISU_DeformedShape_i_HeaderFile
 
 #include <VISU_I.hxx>
-#include "VISU_ScalarMap_i.hh"
+#include "VISU_MonoColorPrs_i.hh"
 
 class VISU_DeformedShapePL;
 
@@ -36,14 +36,14 @@ namespace VISU
 {
   //----------------------------------------------------------------------------
   class VISU_I_EXPORT DeformedShape_i : public virtual POA_VISU::DeformedShape,
-                         public virtual ScalarMap_i
+                                       public virtual MonoColorPrs_i
   {
     static int myNbPresent;
     DeformedShape_i(const DeformedShape_i&);
 
   public:
     //----------------------------------------------------------------------------
-    typedef ScalarMap_i TSuperClass;
+    typedef MonoColorPrs_i TSuperClass;
     typedef VISU::DeformedShape TInterface;
 
     explicit
@@ -71,22 +71,6 @@ namespace VISU
     CORBA::Double 
     GetScale();
 
-    virtual 
-    CORBA::Boolean 
-    IsColored();
-
-    virtual 
-    void
-    ShowColored(CORBA::Boolean theColored);
-
-    virtual 
-    SALOMEDS::Color 
-    GetColor();
-
-    virtual
-    void
-    SetColor(const SALOMEDS::Color& theColor);
-
     VISU_DeformedShapePL* 
     GetSpecificPL() const
     { 
@@ -105,8 +89,6 @@ namespace VISU
     CheckIsPossible();
 
     VISU_DeformedShapePL *myDeformedShapePL;
-    SALOMEDS::Color myColor;
-    bool myIsColored;
 
   public:
     static
@@ -152,17 +134,10 @@ namespace VISU
     void
     SetMapScale(double theMapScale = 1.0);
 
-    virtual 
-    VISU_Actor* 
-    CreateActor();
-
     virtual 
     VISU_Actor* 
     CreateActor(bool toSupressShrinking);
 
-    virtual 
-    void
-    UpdateActor(VISU_Actor* theActor) ;
   };
 }
 
index 7b1fd68eac900d3e8e1133566bc53047b445e415..ce767a35b49cb8e8200d7d8716a5323091d2d812 100644 (file)
@@ -416,6 +416,21 @@ namespace VISU
     return thePrefix;
   }
 
+  //---------------------------------------------------------------------------
+  std::string
+  MonoColorPrsToPython(SALOMEDS::SObject_ptr theSObject,
+                      VISU::MonoColorPrs_i* theServant,
+                      std::ostream& theStr,
+                      const std::string& theName,
+                      TColoredPrs3dFactory& thePrsFactory,
+                      std::string thePrefix)
+  {
+    thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+    theStr<<thePrefix<<endl;
+    theStr<<thePrefix<<theName<<".ShowColored("<<GetBoolean(theServant->IsColored())<<")"<<endl;
+    theStr<<thePrefix<<theName<<".SetColor("<<GetColor(theServant->GetColor())<<")"<<endl;
+    return thePrefix;
+  }
 
   //---------------------------------------------------------------------------
   std::string
@@ -426,12 +441,12 @@ namespace VISU
                        TColoredPrs3dFactory& thePrsFactory,
                        std::string thePrefix)
   {
-    thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+    thePrefix = MonoColorPrsToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
     theStr<<thePrefix<<endl;
 
     theStr<<thePrefix<<theName<<".SetScale("<<theServant->GetScale()<<")"<<endl;
-    theStr<<thePrefix<<theName<<".ShowColored("<<GetBoolean(theServant->IsColored())<<")"<<endl;
-    theStr<<thePrefix<<theName<<".SetColor("<<GetColor(theServant->GetColor())<<")"<<endl;
+//     theStr<<thePrefix<<theName<<".ShowColored("<<GetBoolean(theServant->IsColored())<<")"<<endl;
+//     theStr<<thePrefix<<theName<<".SetColor("<<GetColor(theServant->GetColor())<<")"<<endl;
 
     return thePrefix;
   }
@@ -447,7 +462,8 @@ namespace VISU
                      TColoredPrs3dFactory& thePrsFactory,
                      std::string thePrefix)
   {
-    thePrefix = DeformedShapeToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+    thePrefix = MonoColorPrsToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+    //    thePrefix = DeformedShapeToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
     theStr<<thePrefix<<endl;
     
     std::string aParam;
@@ -595,6 +611,7 @@ namespace VISU
     theStr<<thePrefix<<endl;
 
     theStr<<thePrefix<<theName<<".SetNbSurfaces("<<theServant->GetNbSurfaces()<<")"<<endl;
+    theStr<<thePrefix<<theName<<".ShowLabels("<<theServant->IsLabeled()<<","<<theServant->GetNbLabels()<<")"<<endl;
 
     return thePrefix;
   }
index 96377ac7c03c0616209ea2d07fc5d4a99cf37815..524d6f0b69dfe9cd41b978f55ce126ec07c1b328 100644 (file)
 #include "VISU_IsoSurfacesPL.hxx"
 #include "VISU_Result_i.hh"
 #include "VISU_Actor.h"
+#include "VISU_ScalarMapAct.h"
+#include "VISU_IsoSurfActor.h"
 
 #include "SUIT_ResourceMgr.h"
 #include "SALOME_Event.hxx"
+#include <vtkMapper.h>
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
@@ -94,7 +97,10 @@ VISU::IsoSurfaces_i
 ::IsoSurfaces_i(EPublishInStudyMode thePublishInStudyMode) :
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
-  myIsoSurfacesPL(NULL)
+  MonoColorPrs_i(thePublishInStudyMode),
+  myIsoSurfacesPL(NULL),
+  myIsLabeled(false),
+  myNbLabels(3)
 {}
 
 
@@ -106,7 +112,12 @@ VISU::IsoSurfaces_i
         const std::string& theFieldName, 
         CORBA::Long theTimeStampNumber)
 {
-  return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
+  VISU::Storable* aRes = TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
+  myIsColored = true;
+  myColor.R = myColor.G = myColor.B = 0.;
+  //myIsLabeled = false;
+  //myNbLabels = 3;
+  return aRes;
 }
 
 
@@ -122,6 +133,8 @@ VISU::IsoSurfaces_i
   SetNbSurfaces(VISU::Storable::FindValue(theMap,"myNbSurface").toInt());
   float aMin = VISU::Storable::FindValue(theMap,"myRange[0]").toDouble();
   float aMax = VISU::Storable::FindValue(theMap,"myRange[1]").toDouble();
+  myNbLabels = VISU::Storable::FindValue(theMap,"myNbLabels").toInt();
+  myIsLabeled = VISU::Storable::FindValue(theMap,"myIsLabeled").toInt();
   SetSubRange(aMin,aMax);
     
   return this;
@@ -138,8 +151,22 @@ VISU::IsoSurfaces_i
   Storable::DataToStream( theStr, "myNbSurface", int(GetNbSurfaces()) );
   Storable::DataToStream( theStr, "myRange[0]", GetSubMin() );
   Storable::DataToStream( theStr, "myRange[1]", GetSubMax() );
+  Storable::DataToStream( theStr, "myNbLabels", myNbLabels );
+  Storable::DataToStream( theStr, "myIsLabeled", myIsLabeled );
 }
 
+//---------------------------------------------------------------
+void VISU::IsoSurfaces_i::SameAs(const Prs3d_i* theOrigin)
+{
+  TSuperClass::SameAs(theOrigin);
+
+  if(const IsoSurfaces_i* aPrs3d = dynamic_cast<const IsoSurfaces_i*>(theOrigin)){
+    IsoSurfaces_i* anOrigin = const_cast<IsoSurfaces_i*>(aPrs3d);
+    ShowLabels(anOrigin->IsLabeled(), anOrigin->GetNbLabels());
+  }
+}
+
+
 
 //---------------------------------------------------------------
 VISU::IsoSurfaces_i
@@ -231,20 +258,33 @@ VISU::IsoSurfaces_i
 }
 
 //---------------------------------------------------------------
-VISU_Actor* 
-VISU::IsoSurfaces_i
-::CreateActor()
+VISU_Actor* VISU::IsoSurfaces_i::CreateActor()
 {
-  if(VISU_Actor* anActor = TSuperClass::CreateActor()){
+  VISU_IsoSurfActor* anActor = VISU_IsoSurfActor::New();
+  try{
+    VISU::Prs3d_i::CreateActor(anActor);
+    anActor->SetBarVisibility(true);
     anActor->SetVTKMapping(true);
     SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
     int  aDispMode = aResourceMgr->integerValue("VISU" , "iso_surfaces_represent", 2);
     anActor->SetRepresentation(aDispMode);
-    return anActor;
+    UpdateActor(anActor);
+  }catch(...){
+    anActor->Delete();
+    throw ;
   }
-  return NULL;
+
+ return anActor;
 }
 
+//---------------------------------------------------------------
+void VISU::IsoSurfaces_i::UpdateActor(VISU_ActorBase* theActor) 
+{
+  if(VISU_IsoSurfActor* anActor = dynamic_cast<VISU_IsoSurfActor*>(theActor)){
+    anActor->SetLinesLabeled(myIsLabeled, myNbLabels);
+  }
+  TSuperClass::UpdateActor(theActor);
+}
 
 //---------------------------------------------------------------
 void
@@ -253,3 +293,26 @@ VISU::IsoSurfaces_i
 {
   myIsoSurfacesPL->SetMapScale(theMapScale);
 }
+
+//---------------------------------------------------------------
+CORBA::Boolean VISU::IsoSurfaces_i::IsLabeled()
+{
+  return myIsLabeled;
+}
+
+//---------------------------------------------------------------
+void VISU::IsoSurfaces_i::ShowLabels(CORBA::Boolean theShow, CORBA::Long theNb)
+{
+  if ((myIsLabeled == theShow) && (myNbLabels == theNb)) return;
+  VISU::TSetModified aModified(this);
+  myIsLabeled = theShow;
+  myNbLabels = theNb;
+  myParamsTime.Modified();
+}
+
+//---------------------------------------------------------------
+CORBA::Long VISU::IsoSurfaces_i::GetNbLabels()
+{
+  return myNbLabels;
+}
+
index 74cc1c3d3fd77e7c42104312f3fbd8359bf51863..1e5b6dd459ddfe2bb4496bde3b0e94d3c468af49 100644 (file)
@@ -28,7 +28,8 @@
 #define VISU_IsoSurfaces_i_HeaderFile
 
 #include "VISU_I.hxx"
-#include "VISU_ScalarMap_i.hh"
+//#include "VISU_ScalarMap_i.hh"
+#include "VISU_MonoColorPrs_i.hh"
 
 class VISU_IsoSurfacesPL;
 
@@ -36,19 +37,21 @@ namespace VISU
 {
   //----------------------------------------------------------------------------
   class VISU_I_EXPORT IsoSurfaces_i : public virtual POA_VISU::IsoSurfaces,
-                       public virtual ScalarMap_i
+                                     public virtual MonoColorPrs_i
   {
     static int myNbPresent;
     IsoSurfaces_i(const IsoSurfaces_i&);
 
   public:
     //----------------------------------------------------------------------------
-    typedef ScalarMap_i TSuperClass;
+    typedef MonoColorPrs_i TSuperClass;
     typedef VISU::IsoSurfaces TInterface;
 
     explicit
     IsoSurfaces_i(EPublishInStudyMode thePublishInStudyModep);
 
+    virtual void SameAs(const Prs3d_i* theOrigin);
+
     virtual 
     ~IsoSurfaces_i();
 
@@ -84,7 +87,14 @@ namespace VISU
     { 
       return myIsoSurfacesPL; 
     }
+
+
+    virtual CORBA::Boolean IsLabeled();
+    virtual void ShowLabels(CORBA::Boolean theShow, CORBA::Long theNb);
+
+    virtual CORBA::Long GetNbLabels();
     
+
   protected:
     //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
     virtual 
@@ -103,6 +113,9 @@ namespace VISU
 
     VISU_IsoSurfacesPL* myIsoSurfacesPL;
 
+    bool myIsLabeled;
+    CORBA::Long myNbLabels;
+
   public:
     static
     size_t
@@ -150,6 +163,9 @@ namespace VISU
     virtual 
     void 
     SetMapScale(double theMapScale = 1.0);
+
+    virtual void UpdateActor(VISU_ActorBase* theActor);
+    
   };
 }
 
diff --git a/src/VISU_I/VISU_MonoColorPrs_i.cc b/src/VISU_I/VISU_MonoColorPrs_i.cc
new file mode 100644 (file)
index 0000000..28afbc8
--- /dev/null
@@ -0,0 +1,186 @@
+//  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_MonoColorPrs_i.cxx
+//  Author : Vitaly Smetannikov
+//  Module : VISU
+
+
+#include "VISU_MonoColorPrs_i.hh"
+#include "VISU_Prs3dUtils.hh"
+#include "VISU_PipeLineUtils.hxx"
+#include "VISU_ScalarMapAct.h"
+
+#include "VISU_PipeLine.hxx"
+
+#include <vtkDataSetMapper.h>
+#include <vtkProperty.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//---------------------------------------------------------------
+VISU::MonoColorPrs_i
+::MonoColorPrs_i(EPublishInStudyMode thePublishInStudyMode):
+  ColoredPrs3d_i(thePublishInStudyMode),
+  ScalarMap_i(thePublishInStudyMode)
+{
+  if(MYDEBUG) MESSAGE("MonoColorPrs_i::MonoColorPrs_i");
+}
+
+//---------------------------------------------------------------
+void 
+VISU::MonoColorPrs_i
+::SameAs(const Prs3d_i* theOrigin)
+{
+  TSuperClass::SameAs(theOrigin);
+
+  if(const MonoColorPrs_i* aPrs3d = dynamic_cast<const MonoColorPrs_i*>(theOrigin)){
+    MonoColorPrs_i* anOrigin = const_cast<MonoColorPrs_i*>(aPrs3d);
+    SetColor(anOrigin->GetColor());
+    ShowColored(anOrigin->IsColored());
+  }
+}
+
+
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::MonoColorPrs_i
+::Create(const std::string& theMeshName, 
+        VISU::Entity theEntity,
+        const std::string& theFieldName, 
+        CORBA::Long theTimeStampNumber)
+{
+  myIsColored = false;
+  myColor.R = myColor.G = myColor.B = 0.5;
+  return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
+}
+
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::MonoColorPrs_i
+::Restore(SALOMEDS::SObject_ptr theSObject,
+         const Storable::TRestoringMap& theMap)
+{
+  if(!TSuperClass::Restore(theSObject, theMap))
+    return NULL;
+
+  myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt();
+  myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
+  myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
+  myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
+
+  return this;
+}
+
+//---------------------------------------------------------------
+void
+VISU::MonoColorPrs_i
+::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
+
+  Storable::DataToStream( theStr, "myIsColored", myIsColored );
+  Storable::DataToStream( theStr, "myColor.R", myColor.R );
+  Storable::DataToStream( theStr, "myColor.G", myColor.G );
+  Storable::DataToStream( theStr, "myColor.B", myColor.B );
+}
+
+
+//---------------------------------------------------------------
+VISU::MonoColorPrs_i::~MonoColorPrs_i()
+{
+  if(MYDEBUG) MESSAGE("MonoColorPrs_i::~MonoColorPrs_i()");
+}
+
+//---------------------------------------------------------------
+CORBA::Boolean VISU::MonoColorPrs_i::IsColored()
+{
+  return myIsColored;
+}
+
+
+
+//---------------------------------------------------------------
+void
+VISU::MonoColorPrs_i::ShowColored(CORBA::Boolean theColored)
+{
+  if(myIsColored == theColored)
+    return;
+  myIsColored = theColored; 
+  myParamsTime.Modified();
+}
+
+//---------------------------------------------------------------
+SALOMEDS::Color VISU::MonoColorPrs_i::GetColor()
+{
+  return myColor;
+}
+
+//---------------------------------------------------------------
+void VISU::MonoColorPrs_i::SetColor(const SALOMEDS::Color& theColor)
+{
+  bool anIsSameValue = VISU::CheckIsSameValue(myColor.R, theColor.R);
+  anIsSameValue &= VISU::CheckIsSameValue(myColor.G, theColor.G);
+  anIsSameValue &= VISU::CheckIsSameValue(myColor.B, theColor.B);
+  if(anIsSameValue)
+    return;
+
+  VISU::TSetModified aModified(this);
+  
+  myColor = theColor;
+  myParamsTime.Modified();
+}
+
+//---------------------------------------------------------------
+VISU_Actor* VISU::MonoColorPrs_i::CreateActor(bool toSupressShrinking) 
+{
+  VISU_Actor* anActor = TSuperClass::CreateActor(toSupressShrinking);
+  anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
+  return anActor;
+}
+
+//---------------------------------------------------------------
+VISU_Actor* VISU::MonoColorPrs_i::CreateActor()
+{
+  return CreateActor(false);
+}
+
+//---------------------------------------------------------------
+void VISU::MonoColorPrs_i::UpdateActor(VISU_ActorBase* theActor) 
+{
+  if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
+    if(IsColored()){
+      anActor->SetBarVisibility(true);
+      GetPipeLine()->GetMapper()->SetScalarVisibility(1);
+    }else{
+      anActor->SetBarVisibility(false);
+      GetPipeLine()->GetMapper()->SetScalarVisibility(0);
+      anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
+    }
+    TSuperClass::UpdateActor(theActor);
+  }
+}
+
diff --git a/src/VISU_I/VISU_MonoColorPrs_i.hh b/src/VISU_I/VISU_MonoColorPrs_i.hh
new file mode 100644 (file)
index 0000000..50fff30
--- /dev/null
@@ -0,0 +1,83 @@
+//  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_MonoColorPrs_i.hxx
+//  Author : Vitaly Smetannikov
+//  Module : VISU
+
+
+#ifndef VISU_MonoColorPrs_i_HeaderFile
+#define VISU_MonoColorPrs_i_HeaderFile
+
+#include <VISU_I.hxx>
+#include "VISU_ScalarMap_i.hh"
+
+namespace VISU
+{
+  //----------------------------------------------------------------------------
+  class VISU_I_EXPORT MonoColorPrs_i : public virtual POA_VISU::MonoColorPrs,
+                                      public virtual ScalarMap_i
+  {
+    MonoColorPrs_i(const MonoColorPrs_i&);
+
+  public:
+    //----------------------------------------------------------------------------
+    typedef ScalarMap_i TSuperClass;
+    typedef VISU::MonoColorPrs TInterface;
+
+    explicit MonoColorPrs_i(EPublishInStudyMode thePublishInStudyModep);
+
+    virtual void SameAs(const Prs3d_i* theOrigin);
+
+    virtual ~MonoColorPrs_i();
+
+    virtual CORBA::Boolean IsColored();
+
+    virtual void ShowColored(CORBA::Boolean theColored);
+
+    virtual SALOMEDS::Color GetColor();
+
+    virtual void SetColor(const SALOMEDS::Color& theColor);
+
+  protected:
+    SALOMEDS::Color myColor;
+    bool myIsColored;
+
+  public:
+    virtual Storable* Create(const std::string& theMeshName, 
+                            VISU::Entity theEntity,
+                            const std::string& theFieldName, 
+                            CORBA::Long theTimeStampNumber);
+
+    virtual void ToStream(std::ostringstream& theStr);
+
+    virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject,
+                             const Storable::TRestoringMap& theMap);
+
+    virtual VISU_Actor* CreateActor();
+
+    virtual VISU_Actor* CreateActor(bool toSupressShrinking);
+
+    virtual void UpdateActor(VISU_ActorBase* theActor);
+  };
+};
+#endif
index 521cd57adaf5a124701b88b2fc0a26a8c23a9959..aa3c93bc50aaa6ef8fe423fb8e653519216e140a 100644 (file)
@@ -41,7 +41,7 @@
 #include <boost/bind.hpp>
 
 #ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
 #else
 static int MYDEBUG = 0;
 #endif
index f62b758f61c1ffc0268c4b154ded71247ab5a47c..7b2a45e921bb97275255f4e87705d617441fa69f 100644 (file)
@@ -120,7 +120,7 @@ VISU::StreamLines_i
 ::StreamLines_i(EPublishInStudyMode thePublishInStudyMode) :
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
-  DeformedShape_i(thePublishInStudyMode),
+  MonoColorPrs_i(thePublishInStudyMode),
   myStreamLinesPL(NULL),
   myAppendFilter(vtkAppendFilter::New())
 {}
index f0cee7572d828fe0108b5d10afdf90aa9acbe51f..a1ccf3b98aadcfee8ec0b63900a88bdd2415bcff 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef VISU_StreamLines_i_HeaderFile
 #define VISU_StreamLines_i_HeaderFile
 
-#include "VISU_DeformedShape_i.hh"
+//#include "VISU_DeformedShape_i.hh"
+#include "VISU_MonoColorPrs_i.hh"
 
 class VISU_StreamLinesPL;
 class vtkAppendFilter;
@@ -36,14 +37,15 @@ namespace VISU
 {
   //----------------------------------------------------------------------------
   class VISU_I_EXPORT StreamLines_i : public virtual POA_VISU::StreamLines,
-                                     public virtual DeformedShape_i
+                                     public virtual MonoColorPrs_i
+    //public virtual DeformedShape_i
   {
     static int myNbPresent;
     StreamLines_i(const StreamLines_i&);
 
   public:
     //----------------------------------------------------------------------------
-    typedef DeformedShape_i TSuperClass;
+    typedef MonoColorPrs_i TSuperClass;
     typedef VISU::StreamLines TInterface;
 
     explicit
index 9aca708427cec6a28306828f37fe428cd31f20fc..63936340dd135e65d2a865a6ef6eb1cbf386a709 100644 (file)
@@ -129,6 +129,7 @@ VISU::Vectors_i
 ::Vectors_i(EPublishInStudyMode thePublishInStudyMode) :
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
+  MonoColorPrs_i(thePublishInStudyMode),
   DeformedShape_i(thePublishInStudyMode),
   myLineWidth(1.0),
   myVectorsPL(NULL)