--- /dev/null
+/*!
+
+\page table_3d_page Table 3D presentation
+
+\n <b>Table 3D</b> is a 3D graphic presentation of data contained in the table.
+The relief and coloring of the resulting
+presentation both correspond to the values contained in the table. The values from the first column of the
+table define X-axis. The values from the second to the last columns define Z-axis. Y increases with a fixed step starting from Y=0.
+To successfully produce a Table 3D presentation, the table should not contain empty fields.
+
+<em>To create a Table 3D presentation:</em>
+\par
+– Right-click on an XLS table in the
+Object browser and from the context menu choose <b>Show</b>, or <b>Show only</b>
+
+\image html table.png
+
+The table will be immediately displayed in the Viewer.
+
+Choose <b>Edit</b> in the context menu if you wish to change the layout of the presentation.
+
+\image html table3d.png
+
+\par
+<ul>
+<li><b>Scale Factor</b> - visualization scaling of all values of the table.</li>
+<li><b>Presentation type:</b></li>
+<ul>
+<li>\b Surface - Plot 3D will be represented with a smooth surface.</li>
+
+\image html tablesn2.png
+
+<li>\b Contour - Plot 3D will be represented with a set of contours.</li>
+
+\image html tablesn1.png
+
+</ul>
+<li><b>Number of contours</b> - allows to define the number of
+contours (active when Contour presentation type is selected).</li>
+<li> <b>Scalar Bar</b> tab allows to define the parameters of the scalar
+bar displayed with this presentation (\ref scalar_map_page "see also").</li>
+</ul>
+
+It is also possible to choose \b Wireframe or \b Shading \b Representation type, change
+such properties as \b Opacity and <b> Line Width </b> and <b> Translate </b> presentation from the context menu.
+
+
+
+*/
\ No newline at end of file
--- /dev/null
+// 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_ElnoMeshValue.hxx
+// Author : Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_ElnoMeshValue_HeaderFile
+#define VISU_ElnoMeshValue_HeaderFile
+
+#include "VISU_VTKTypeList.hxx"
+#include <vtkDataSetAttributes.h>
+
+
+/*!
+ \file VISU_ElnoMeshValue.hxx
+ \brief The file contains declarations for the acess to the specific ELNO MED data
+*/
+
+namespace VISU
+{
+ //---------------------------------------------------------------
+ template< int elno_type >
+ struct TGetElnoNodeData
+ {
+ typedef typename TL::TEnum2VTKArrayType< elno_type >::TResult TVTKDataArray;
+ typedef typename TL::TEnum2VTKBasicType< elno_type >::TResult TDataType;
+ TVTKDataArray *myElnoDataArray;
+ vtkIntArray *myElnoDataMapper;
+ int myElemInfo[3];
+
+
+ //----------------------------------------------------------------------------
+ TGetElnoNodeData( vtkDataArray *theElnoDataArray,
+ vtkDataArray *theElnoDataMapper )
+ : myElnoDataArray( TVTKDataArray::SafeDownCast( theElnoDataArray ) )
+ , myElnoDataMapper( vtkIntArray::SafeDownCast( theElnoDataMapper ) )
+ {}
+
+
+ //----------------------------------------------------------------------------
+ TDataType*
+ operator () ( vtkIdType theCellId, vtkIdType theLocalPntId )
+ {
+ myElnoDataMapper->GetTupleValue( theCellId, myElemInfo );
+
+ vtkIdType aPos = myElemInfo[ 0 ] + theLocalPntId * myElemInfo[ 1 ];
+
+ return myElnoDataArray->GetPointer( aPos );
+ }
+
+
+ //----------------------------------------------------------------------------
+ int
+ getNbComp()
+ {
+ myElnoDataMapper->GetTupleValue( 0, myElemInfo );
+
+ return myElemInfo[ 1 ];
+ }
+ };
+
+
+ //----------------------------------------------------------------------------------------------
+ template< int elno_type >
+ struct TSetElnoNodeData
+ {
+ typedef typename TL::TEnum2VTKArrayType< elno_type >::TResult TVTKDataArray;
+ typedef typename TL::TEnum2VTKBasicType< elno_type >::TResult TDataType;
+
+ //----------------------------------------------------------------------------------------------
+ TSetElnoNodeData( vtkIdType theEffectNbComp,
+ vtkIdType theRealNbComp,
+ vtkIdType theNbTuples,
+ const char* theDataArrayName,
+ const char* theMapperArrayName )
+ : myElnoDataArray( TVTKDataArray::New() )
+ , myElnoDataMapper( vtkIntArray::New() )
+ {
+ myElnoDataArray->SetNumberOfComponents( theEffectNbComp );
+ myElnoDataArray->SetNumberOfTuples( theNbTuples );
+ myElnoDataArray->SetName( theDataArrayName );
+
+ myElnoDataMapper->SetNumberOfComponents( 3 );
+ myElnoDataMapper->Allocate( theNbTuples * 3 );
+ myElnoDataMapper->SetName( theMapperArrayName );
+
+ myElemInfo[ 0 ] = 0;
+ myElemInfo[ 1 ] = theRealNbComp;
+ myElemInfo[ 2 ] = 0;
+ }
+
+
+ //----------------------------------------------------------------------------------------------
+ ~TSetElnoNodeData()
+ {
+ myElnoDataArray->Delete();
+ myElnoDataMapper->Delete();
+ }
+
+
+ //----------------------------------------------------------------------------------------------
+ int
+ AddNextPointData( TDataType* theDataPtr )
+ {
+ vtkIdType aPos = myElemInfo[ 0 ] + myElemInfo[ 2 ] * myElemInfo[ 1 ];
+
+ TDataType* aDataPtr = myElnoDataArray->GetPointer( aPos );
+
+ for ( vtkIdType aCompId = 0; aCompId < myElemInfo[ 1 ]; aCompId++ )
+ *aDataPtr++ = *theDataPtr++;
+
+ return myElemInfo[ 2 ]++;
+ }
+
+
+ //----------------------------------------------------------------------------------------------
+ void
+ InsertNextCellData()
+ {
+ myElnoDataMapper->InsertNextTupleValue( myElemInfo );
+ myElemInfo[ 0 ] += myElemInfo[ 2 ] * myElemInfo[ 1 ];
+ myElemInfo[ 2 ] = 0;
+ }
+
+
+ //----------------------------------------------------------------------------------------------
+ void
+ AddData( vtkDataSetAttributes* theDataSetAttributes )
+ {
+ theDataSetAttributes->AddArray( myElnoDataArray );
+ theDataSetAttributes->AddArray( myElnoDataMapper );
+ }
+
+ protected:
+ TVTKDataArray *myElnoDataArray;
+ vtkIntArray *myElnoDataMapper;
+ int myElemInfo[ 3 ];
+ };
+
+
+ //---------------------------------------------------------------
+}
+
+#endif
--- /dev/null
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+// 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 :
+// Author :
+// Module : SALOME
+// $Header$
+
+#include "VISU_GaussMergeFilter.hxx"
+#include "VISU_MergeFilterUtilities.hxx"
+
+#include <vtkObjectFactory.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkPolyData.h>
+#include <vtkCellData.h>
+#include <vtkPointData.h>
+#include <vtkIdList.h>
+#include <vtkCell.h>
+#include <vtkFloatArray.h>
+
+#include <vtkExecutive.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+#include <vtkStreamingDemandDrivenPipeline.h>
+
+
+//------------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_GaussMergeFilter);
+
+//------------------------------------------------------------------------------
+VISU_GaussMergeFilter
+::VISU_GaussMergeFilter():
+ myIsMergingInputs(false)
+{
+ this->FieldList = new VISU::TFieldList;
+ this->SetNumberOfInputPorts(6);
+}
+
+//------------------------------------------------------------------------------
+VISU_GaussMergeFilter::~VISU_GaussMergeFilter()
+{
+ delete this->FieldList;
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::SetGeometry(vtkDataSet *input)
+{
+ this->Superclass::SetInput(input);
+}
+
+//------------------------------------------------------------------------------
+vtkDataSet *VISU_GaussMergeFilter::GetGeometry()
+{
+ if (this->GetNumberOfInputConnections(0) < 1)
+ {
+ return NULL;
+ }
+ return vtkDataSet::SafeDownCast(
+ this->GetExecutive()->GetInputData(0, 0));
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::SetScalars(vtkDataSet *input)
+{
+ this->SetInput(1, input);
+}
+
+//------------------------------------------------------------------------------
+vtkDataSet *VISU_GaussMergeFilter::GetScalars()
+{
+ if (this->GetNumberOfInputConnections(1) < 1)
+ {
+ return NULL;
+ }
+ return vtkDataSet::SafeDownCast(
+ this->GetExecutive()->GetInputData(1, 0));
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::SetVectors(vtkDataSet *input)
+{
+ this->SetInput(2, input);
+}
+
+//------------------------------------------------------------------------------
+vtkDataSet *VISU_GaussMergeFilter::GetVectors()
+{
+ if (this->GetNumberOfInputConnections(2) < 1)
+ {
+ return NULL;
+ }
+ return vtkDataSet::SafeDownCast(
+ this->GetExecutive()->GetInputData(2, 0));
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::SetNormals(vtkDataSet *input)
+{
+ this->SetInput(3, input);
+}
+
+//------------------------------------------------------------------------------
+vtkDataSet *VISU_GaussMergeFilter::GetNormals()
+{
+ if (this->GetNumberOfInputConnections(3) < 1)
+ {
+ return NULL;
+ }
+ return vtkDataSet::SafeDownCast(
+ this->GetExecutive()->GetInputData(3, 0));
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::SetTCoords(vtkDataSet *input)
+{
+ this->SetInput(4, input);
+}
+
+//------------------------------------------------------------------------------
+vtkDataSet *VISU_GaussMergeFilter::GetTCoords()
+{
+ if (this->GetNumberOfInputConnections(4) < 1)
+ {
+ return NULL;
+ }
+ return vtkDataSet::SafeDownCast(
+ this->GetExecutive()->GetInputData(4, 0));
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::SetTensors(vtkDataSet *input)
+{
+ this->SetInput(5, input);
+}
+
+//------------------------------------------------------------------------------
+vtkDataSet *VISU_GaussMergeFilter::GetTensors()
+{
+ if (this->GetNumberOfInputConnections(5) < 1)
+ {
+ return NULL;
+ }
+ return vtkDataSet::SafeDownCast(
+ this->GetExecutive()->GetInputData(5, 0));
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::AddField(const char* name, vtkDataSet* input)
+{
+ this->FieldList->Add(name, input);
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::RemoveFields()
+{
+ delete this->FieldList;
+ this->FieldList = new VISU::TFieldList;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU_GaussMergeFilter
+::SetMergingInputs(bool theIsMergingInputs)
+{
+ if(myIsMergingInputs == theIsMergingInputs)
+ return;
+
+ myIsMergingInputs = theIsMergingInputs;
+ Modified();
+}
+
+
+//---------------------------------------------------------------
+bool
+VISU_GaussMergeFilter
+::IsMergingInputs()
+{
+ return myIsMergingInputs;
+}
+
+
+//---------------------------------------------------------------
+int
+VISU_GaussMergeFilter
+::RequestData(vtkInformation *theRequest,
+ vtkInformationVector **theInputVector,
+ vtkInformationVector *theOutputVector)
+{
+ if(vtkUnstructuredGrid *anInput = dynamic_cast<vtkUnstructuredGrid*>(this->GetInput())){
+ vtkPolyData *anOutput = dynamic_cast<vtkPolyData*>(this->GetOutput());
+ return ExecuteGauss(anInput,
+ anOutput);
+ }
+
+ return Superclass::RequestData(theRequest,
+ theInputVector,
+ theOutputVector);
+}
+
+//----------------------------------------------------------------------------
+// Trick: Abstract data types that may or may not be the same type
+// (structured/unstructured), but the points/cells match up.
+// Output/Geometry may be structured while ScalarInput may be
+// unstructured (but really have same triagulation/topology as geometry).
+// Just request all the input. Always generate all of the output (todo).
+int
+VISU_GaussMergeFilter
+::RequestUpdateExtent(vtkInformation *vtkNotUsed(request),
+ vtkInformationVector **inputVector,
+ vtkInformationVector *vtkNotUsed(outputVector))
+{
+ vtkInformation *inputInfo;
+ int idx;
+
+ for (idx = 0; idx < 6; ++idx)
+ {
+ inputInfo = inputVector[idx]->GetInformationObject(0);
+ if (inputInfo)
+ {
+ inputInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER(),
+ 0);
+ inputInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES(),
+ 1);
+ inputInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS(),
+ 0);
+ inputInfo->Set(vtkStreamingDemandDrivenPipeline::EXACT_EXTENT(), 1);
+ }
+ }
+ return 1;
+}
+
+
+//----------------------------------------------------------------------------
+int
+VISU_GaussMergeFilter
+::FillInputPortInformation(int port, vtkInformation *info)
+{
+ int retval = this->Superclass::FillInputPortInformation(port, info);
+ if (port > 0)
+ {
+ info->Set(vtkAlgorithm::INPUT_IS_OPTIONAL(), 1);
+ }
+ return retval;
+}
+
+//----------------------------------------------------------------------------
+int
+VISU_GaussMergeFilter
+::FillOutputPortInformation(int port, vtkInformation *info)
+{
+ info->Set(vtkDataObject::DATA_TYPE_NAME(),"vtkPolyData");
+ return 1;
+}
+
+void
+VISU_GaussMergeFilter
+::SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theIDMapper)
+{
+ myGaussPtsIDMapper = theIDMapper;
+}
+
+
+const VISU::PGaussPtsIDMapper&
+VISU_GaussMergeFilter
+::GetGaussPtsIDMapper()
+{
+ return myGaussPtsIDMapper;
+}
+
+bool
+VISU_GaussMergeFilter
+::ExecuteGauss(vtkUnstructuredGrid* theInput,
+ vtkPolyData* theOutput)
+{
+ if(IsMergingInputs()){
+ vtkCellData *aCellData = theInput->GetCellData();
+ if(vtkDataArray *aCellMapper = aCellData->GetArray("VISU_CELLS_MAPPER")){
+ vtkIntArray *aGeometryCellMapper = dynamic_cast<vtkIntArray*>(aCellMapper);
+
+ vtkIntArray* aDataPointMapper = GetIDMapper(FieldList,
+ VISU::TGetPointData(),
+ "VISU_POINTS_MAPPER");
+
+ vtkIntArray* aDataCellIds = vtkIntArray::New();
+
+ int nbPoints = aDataPointMapper->GetNumberOfTuples();
+ aDataCellIds->SetNumberOfComponents(2);
+ aDataCellIds->SetNumberOfTuples(nbPoints);
+ int* aDataCellPointer = aDataCellIds->GetPointer(0);
+ {
+ int nbPoints = aDataPointMapper->GetNumberOfTuples();
+ for(int i=0;i<nbPoints;i++,aDataCellPointer++){
+ VISU::TGaussPointID aGPID = myGaussPtsIDMapper->GetObjID(i);
+ vtkIdType aCellId = aGPID.first;
+ *aDataCellPointer = aCellId;
+ aDataCellPointer++;
+ *aDataCellPointer = 3; // it's a entity CELL
+ }
+ }
+ /*
+ vtkIntArray* anCellArr = GetIDMapper(FieldList,
+ VISU::TGetCellData(),
+ "VISU_CELLS_MAPPER");
+ vtkIntArray* anPMArr = GetIDMapper(FieldList,
+ VISU::TGetPointData(),
+ "VISU_POINTS_MAPPER");
+
+ vtkDataArray* anFArr = GetIDMapper(FieldList,
+ VISU::TGetPointData(),
+ "VISU_FIELD");
+ */
+ if(VISU::IsDifferent(aDataCellIds, aGeometryCellMapper)){
+ VISU::TObjectIdArray anIntersection;
+ VISU::GetIntersection(aDataCellIds,
+ aGeometryCellMapper,
+ anIntersection);
+
+ vtkIdType aNbTuples = anIntersection.size();
+
+ VISU::TObjectId2TupleIdMap aDataCellId2TupleIdMap;
+ VISU::GetObjectId2TupleIdMap(aDataCellIds, aDataCellId2TupleIdMap);
+
+ vtkPointSet* aScalarsDataSet = dynamic_cast<vtkPointSet*>(GetScalars());
+ vtkPoints* aDataPoints = aScalarsDataSet->GetPoints();
+ vtkPoints* anOutputPoints = vtkPoints::New(aDataPoints->GetDataType());
+
+ anOutputPoints->SetNumberOfPoints(aNbTuples);
+ theOutput->SetPoints(anOutputPoints);
+ anOutputPoints->Delete();
+
+ vtkCellData* anInputCellData = aScalarsDataSet->GetCellData();
+ vtkPointData* anInputPointData = aScalarsDataSet->GetPointData();
+
+ theOutput->Allocate(aNbTuples);
+ vtkCellData* anOutputCellData = theOutput->GetCellData();
+ vtkPointData* anOutputPointData = theOutput->GetPointData();
+
+ anOutputCellData->CopyAllocate(anInputCellData,aNbTuples);
+ anOutputPointData->CopyAllocate(anInputPointData,aNbTuples);
+
+ vtkIdList *aCellIds = vtkIdList::New();
+ vtkFloatingPointType aCoords[3];
+ for(int aTupleId=0;aTupleId<aNbTuples;aTupleId++){
+ VISU::TObjectId& anObjectId = anIntersection[aTupleId];
+
+ vtkIdType aCellId = aDataCellId2TupleIdMap[anObjectId];
+ vtkCell *aCell = GetScalars()->GetCell(aCellId);
+
+ aCellIds->Reset();
+ aCellIds->InsertNextId(aTupleId);
+
+ vtkIdType aCellType = GetScalars()->GetCellType(aCellId);
+ vtkIdType aNewCellId = theOutput->InsertNextCell(aCellType, aCellIds);
+
+ anOutputCellData->CopyData(anInputCellData, aCellId, aNewCellId);
+ anOutputPointData->CopyData(anInputPointData, aCellId, aNewCellId);
+
+ aDataPoints->GetPoint(aCellId, aCoords);
+ anOutputPoints->SetPoint(aNewCellId, aCoords);
+ }
+ }
+ }
+ }
+ return true;
+}
--- /dev/null
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+// 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 :
+// Author :
+// Module : SALOME
+// $Header$
+
+#ifndef VISU_GaussMergeFilter_H
+#define VISU_GaussMergeFilter_H
+
+#include "VISU_Convertor.hxx"
+
+//#include <vtkDataSetAlgorithm.h>
+#include <vtkPointSetAlgorithm.h>
+
+namespace VISU
+{
+ class TFieldList;
+}
+
+
+//------------------------------------------------------------------------------
+class VISU_CONVERTOR_EXPORT VISU_GaussMergeFilter : public vtkPointSetAlgorithm
+{
+public:
+ static VISU_GaussMergeFilter *New();
+ vtkTypeMacro(VISU_GaussMergeFilter, vtkPointSetAlgorithm);
+
+ // Description:
+ // Specify object from which to extract geometry information.
+ void SetGeometry(vtkDataSet *input);
+ vtkDataSet *GetGeometry();
+
+ // Description:
+ // Specify object from which to extract scalar information.
+ void SetScalars(vtkDataSet *);
+ vtkDataSet *GetScalars();
+
+ // Description:
+ // Set / get the object from which to extract vector information.
+ void SetVectors(vtkDataSet *);
+ vtkDataSet *GetVectors();
+
+ // Description:
+ // Set / get the object from which to extract normal information.
+ void SetNormals(vtkDataSet *);
+ vtkDataSet *GetNormals();
+
+ // Description:
+ // Set / get the object from which to extract texture coordinates
+ // information.
+ void SetTCoords(vtkDataSet *);
+ vtkDataSet *GetTCoords();
+
+ // Description:
+ // Set / get the object from which to extract tensor data.
+ void SetTensors(vtkDataSet *);
+ vtkDataSet *GetTensors();
+
+ // Description:
+ // Set the object from which to extract a field and the name
+ // of the field
+ void AddField(const char* name, vtkDataSet* input);
+
+ // Description:
+ // Removes all previously added fields
+ void RemoveFields();
+
+ // Description:
+ // Defines whether to perform merging of data with the geometry according to
+ // the ids of the cell or not
+ void
+ SetMergingInputs(bool theIsMergingInputs);
+
+ bool
+ IsMergingInputs();
+
+ void
+ SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
+
+ const VISU::PGaussPtsIDMapper&
+ GetGaussPtsIDMapper();
+
+protected:
+ VISU_GaussMergeFilter();
+ ~VISU_GaussMergeFilter();
+
+ virtual
+ int
+ RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+
+ int
+ RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+
+ int
+ FillInputPortInformation(int port, vtkInformation *info);
+
+ int
+ FillOutputPortInformation(int port, vtkInformation *info);
+
+ VISU::TFieldList* FieldList;
+ bool myIsMergingInputs;
+
+ VISU::PGaussPtsIDMapper myGaussPtsIDMapper;
+
+ bool
+ ExecuteGauss(vtkUnstructuredGrid* theInput,
+ vtkPolyData* theOutput);
+
+private:
+ VISU_GaussMergeFilter(const VISU_GaussMergeFilter&); // Not implemented.
+ void operator=(const VISU_GaussMergeFilter&); // Not implemented.
+};
+
+#endif
+
+
--- /dev/null
+// 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:
+// Author:
+// Module : VISU
+
+#include "VISU_TableReader.hxx"
+
+#include <qfileinfo.h>
+#include <qstring.h>
+#include <qregexp.h>
+#include <qfile.h>
+
+#include <fstream>
+#include <iostream>
+#include <strstream>
+
+#include <vtkPoints.h>
+#include <vtkDoubleArray.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+#include <vtkPolyData.h>
+
+#include <vtkStructuredGrid.h>
+#include <vtkStructuredGridGeometryFilter.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+//---------------------------------------------------------------
+int
+VISU::TTable2D
+::Check()
+{
+ if ( myRows.empty() )
+ return 0;
+
+ int iEnd = myRows[0].myValues.size();
+ if ( iEnd == 0 )
+ return 0;
+
+ if ( myColumnTitles.size() != iEnd )
+ myColumnTitles.resize( iEnd );
+
+ if ( myColumnUnits.size() != iEnd )
+ myColumnUnits.resize( iEnd );
+
+ int jEnd = myRows.size();
+ for ( int j = 0; j < jEnd; j++ )
+ if ( myRows[j].myValues.size() != iEnd )
+ return 0;
+
+ return 1;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::TTable2D
+::getColumns(VISU::TTable2D& theTable2D) const
+{
+ TRows& aRows = theTable2D.myRows;
+ aRows.clear();
+ if ( myRows.empty() )
+ return;
+
+ int jEnd = myRows.size();
+
+ //Define Titles & Units
+ theTable2D.myColumnTitles.resize(jEnd);
+ theTable2D.myColumnUnits.resize(jEnd);
+ for ( int j = 0; j < jEnd; j++ ) {
+ theTable2D.myColumnTitles[j] = myRows[j].myTitle;
+ theTable2D.myColumnUnits[j] = myRows[j].myUnit;
+ }
+
+ //Define Rows
+ int iEnd = myRows[0].myValues.size();
+ for ( int i = 0; i < iEnd; i++ ) {
+ TRow aNewRow;
+ aNewRow.myTitle = myColumnTitles[i];
+ aNewRow.myUnit = myColumnUnits[i];
+ aNewRow.myValues.resize(jEnd);
+ for ( int j = 0; j < jEnd; j++ ) {
+ aNewRow.myValues[j] = myRows[j].myValues[i];
+ }
+ aRows.push_back(aNewRow);
+ }
+}
+
+
+//---------------------------------------------------------------
+namespace
+{
+ int getLine( std::ifstream& theStmIn, QString& theString )
+ {
+ char tmp;
+ std::ostrstream aStrOut;
+
+ while ( theStmIn.get( tmp ) ) {
+ aStrOut<<tmp;
+ if ( tmp == '\n' )
+ break;
+ }
+
+ aStrOut<<std::ends;
+ theString = aStrOut.str();
+
+ return !theStmIn.eof();
+ }
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::ImportTables( const char* theFileName, TTableContainer& theContainer )
+{
+ std::ifstream aStmIn;
+ QFileInfo aFileInfo( theFileName );
+ if( !aFileInfo.isFile() || !aFileInfo.isReadable() || !aFileInfo.size() )
+ return;
+
+ aStmIn.open( theFileName );
+ QString aTmp;
+ do {
+ // find beginning of table (tables are separated by empty lines)
+ while( ::getLine( aStmIn, aTmp ) && aTmp.stripWhiteSpace() == "");
+
+ PTableIDMapper aTableIDMapper( new TTableIDMapper() );
+ TTable2D& aTable2D = *aTableIDMapper;
+ if(MYDEBUG) std::cout << "New table is found" << std::endl;
+
+ while( !aStmIn.eof() && aTmp.stripWhiteSpace() != "" ){
+ QString data = aTmp.stripWhiteSpace();
+ QString cmt = "";
+ QString keyword = "";
+ // split string to data and comment (comment starts from '#' symbol)
+ int index = aTmp.find( "#" );
+ if ( index >= 0 ) {
+ data = aTmp.left( index ).stripWhiteSpace();
+ cmt = aTmp.mid( index+1 ).stripWhiteSpace();
+ }
+ // if comment is not empty, try to get keyword from it (separated by ':' symbol)
+ if ( !cmt.isEmpty() ) {
+ int index1 = cmt.find( ":" );
+ if ( index1 >= 0 ) {
+ QString tmpstr = cmt.left( index1 ).stripWhiteSpace();
+ if ( tmpstr == QString( "TITLE" ) ||
+ tmpstr == QString( "COLUMN_TITLES" ) ||
+ tmpstr == QString( "COLUMN_UNITS" ) ||
+ tmpstr == QString( "COMMENT" ) ) {
+ keyword = tmpstr;
+ cmt = cmt.mid( index1+1 ).stripWhiteSpace();
+ }
+ }
+ }
+ // if data is empty, process only comment
+ if ( data.isEmpty() ) {
+ // if keyword is found, try to process it
+ // elsewise it is a simple comment, just ignore it
+ if ( !keyword.isEmpty() ) {
+ if ( keyword == QString( "TITLE" ) ) {
+ QString title = cmt;
+ if ( aTable2D.myTitle != "" )
+ title = QString( aTable2D.myTitle.c_str() ) + QString( " " ) + title;
+ if(MYDEBUG) std::cout << "...Table TITLE is: " << title.latin1() << std::endl;
+ aTable2D.myTitle = title.latin1();
+ }
+ else if ( keyword == QString( "COLUMN_TITLES" ) ) {
+ // comment may contain column headers
+ QStringList aStrList = QStringList::split( "|", cmt );
+ if(MYDEBUG) std::cout << "...Column TITLES are: ";
+ for ( int i = 0; i < aStrList.count(); i++ ) {
+ QString tmpstr = aStrList[ i ].stripWhiteSpace();
+ if(MYDEBUG) std::cout << tmpstr.latin1() << " ";
+ aTable2D.myColumnTitles.push_back( tmpstr.latin1() );
+ }
+ if(MYDEBUG) std::cout << std::endl;
+ }
+ else if ( keyword == QString( "COLUMN_UNITS" ) ) {
+ // comment may contain column units
+ QStringList aStrList = QStringList::split( " ", cmt );
+ if(MYDEBUG) std::cout << "...Column UNITS are: ";
+ for ( int i = 0; i < aStrList.count(); i++ ) {
+ QString tmpstr = aStrList[ i ].stripWhiteSpace();
+ if(MYDEBUG) std::cout << tmpstr.latin1() << " ";
+ aTable2D.myColumnUnits.push_back( tmpstr.latin1() );
+ }
+ if(MYDEBUG) std::cout << std::endl;
+ }
+ else if ( keyword == QString( "COMMENT" ) ) {
+ // keyword 'COMMENT' processing can be here
+ // currently it is ignored
+ if(MYDEBUG) std::cout << "...COMMENT: " << cmt.latin1() << std::endl;
+ }
+ }
+ else {
+ if(MYDEBUG) std::cout << "...comment: " << cmt.latin1() << std::endl;
+ // simple comment processing can be here
+ // currently it is ignored
+ }
+ }
+ // if data is not empty, try to process it
+ else {
+ TTable2D::TRow aRow;
+ if(MYDEBUG) std::cout << "...New row is found: " << std::endl;
+ if ( !cmt.isEmpty() ) {
+ aRow.myTitle = cmt.latin1();
+ if(MYDEBUG) std::cout << "......ROW TITLE is: " << cmt.latin1() << std::endl;
+ }
+ QString datar1 = data.replace(QRegExp("\t"), " ");
+ QStringList aValList = QStringList::split( " ", datar1 );
+ for ( int i = 0; i < aValList.count(); i++ ) {
+ if ( aValList[i].stripWhiteSpace() != "" ) {
+ TTable2D::TValue aVal = aValList[i].stripWhiteSpace().latin1();
+ aRow.myValues.push_back( aVal );
+ }
+ }
+ if( aRow.myValues.size() > 0 )
+ aTable2D.myRows.push_back( aRow );
+ // ************** OLD CODE ******************
+ /*
+ TValue aVal;
+ istrstream aStream( data );
+ aStream.precision( STRPRECISION );
+ while( aStream >> aVal ) {
+ aRow.myValues.push_back( aVal );
+ }
+ if( aRow.myValues.size() > 0 )
+ aTable2D.myRows.push_back( aRow );
+ */
+ // ************** OLD CODE ******************
+ }
+ ::getLine( aStmIn, aTmp );
+ }
+ if( aTable2D.Check() ) {
+ if(MYDEBUG) std::cout << "aTable2D is checked OK " << aTable2D.myTitle << std::endl;
+ theContainer.push_back( aTableIDMapper );
+ }
+ } while ( !aStmIn.eof() );
+ aStmIn.close();
+
+ if(MYDEBUG) std::cout << "After close" << std::endl;
+}
+
+
+//---------------------------------------------------------------
+VISU::TTableIDMapper
+::TTableIDMapper():
+ myOutput( vtkPolyData::New() ),
+ myXAxisPosition( -1 )
+{}
+
+VISU::TTableIDMapper
+::~TTableIDMapper()
+{
+ myOutput->Delete();
+}
+
+vtkPolyData*
+VISU::TTableIDMapper
+::GetPolyDataOutput()
+{
+ if ( myXAxisPosition == -1 )
+ SetXAxisPosition( 0 );
+
+ return myOutput;
+}
+
+long unsigned int
+VISU::TTableIDMapper
+::GetMemorySize()
+{
+ return myOutput->GetActualMemorySize() * 1024;
+}
+
+void
+VISU::TTableIDMapper
+::SetXAxisPosition( vtkIdType theAxisPosition )
+{
+ if ( myXAxisPosition == theAxisPosition || !Check() )
+ return;
+
+ myOutput->Initialize();
+
+ if ( !Check() )
+ return;
+
+ TTable2D aTable2D;
+ getColumns( aTable2D );
+
+ vtkIdType aXSize = aTable2D.myRows[0].myValues.size();
+
+ // It is necessary to decrease the size at 1 take intoa account X axis
+ vtkIdType anYSize = aTable2D.myRows.size() - 1;
+
+ vtkIdType aNbPoints = aXSize * anYSize;
+
+ std::vector<double> anXAxis(aXSize);
+ const TTable2D::TValues& aValues = aTable2D.myRows[theAxisPosition].myValues;
+ for ( vtkIdType aX = 0; aX < aXSize; aX++ )
+ anXAxis[aX] = atof( aValues[aX].c_str() );
+
+ double aXRange = anXAxis[aXSize - 1] - anXAxis[0];
+ double anYDelta = aXRange / anYSize;
+ std::vector<double> anYAxis(anYSize);
+ for ( vtkIdType anY = 0; anY < anYSize; anY++ )
+ anYAxis[anY] = anY * anYDelta;
+
+ vtkPoints* aPoints = vtkPoints::New();
+ aPoints->SetNumberOfPoints( aNbPoints );
+
+ vtkIntArray *aPointsIDMapper = vtkIntArray::New();
+ aPointsIDMapper->SetName("VISU_POINTS_MAPPER");
+ aPointsIDMapper->SetNumberOfComponents(2);
+ aPointsIDMapper->SetNumberOfTuples(aNbPoints);
+ int *aPointsIDMapperPtr = aPointsIDMapper->GetPointer(0);
+
+ //vtkIntArray *aCellIDMapper = vtkIntArray::New();
+ //aCellIDMapper->SetName("VISU_POINTS_MAPPER");
+ //aCellIDMapper->SetNumberOfComponents(2);
+ //aCellIDMapper->SetNumberOfTuples(aNbPoints);
+ //int *aCellIDMapperPtr = aCellIDMapper->GetPointer(0);
+
+ for ( vtkIdType aY = 0, aPntId = 0; aY < anYSize; aY++ ) {
+ for ( vtkIdType aX = 0; aX < aXSize; aX++, aPntId++ ) {
+ aPoints->SetPoint( aPntId, anXAxis[aX], anYAxis[aY], 0.0 );
+
+ *aPointsIDMapperPtr++ = aPntId;
+ *aPointsIDMapperPtr++ = 0;
+
+ //*aCellIDMapperPtr++ = aPntId;
+ //*aCellIDMapperPtr++ = 0;
+ }
+ }
+
+ std::vector<TValues> anYData;
+ for ( vtkIdType anY = 0; anY < anYSize + 1; anY++ ) {
+ if ( anY == theAxisPosition )
+ continue;
+ anYData.push_back( aTable2D.myRows[anY].myValues );
+ }
+
+ vtkDoubleArray* aScalars = vtkDoubleArray::New();
+ aScalars->SetNumberOfComponents( 1 );
+ aScalars->SetNumberOfTuples( aNbPoints );
+ double *aScalarsPtr = aScalars->GetPointer(0);
+ for ( vtkIdType anY = 0; anY < anYSize; anY++ ) {
+ const TTable2D::TValues& aValues = anYData[anY];
+ for ( vtkIdType aX = 0; aX < aXSize; aX++ ) {
+ double aValue = atof( aValues[aX].c_str() );
+ *aScalarsPtr++ = aValue;
+ }
+ }
+
+ vtkStructuredGrid* aStructuredGrid = vtkStructuredGrid::New();
+ aStructuredGrid->SetPoints( aPoints );
+ aPoints->Delete();
+
+ aStructuredGrid->SetDimensions( aXSize, anYSize, 1 );
+
+ aStructuredGrid->GetPointData()->AddArray( aPointsIDMapper );
+ aPointsIDMapper->Delete();
+
+ //aStructuredGrid->GetCellData()->AddArray( aCellIDMapper );
+ //aCellIDMapper->Delete();
+
+ aStructuredGrid->GetPointData()->SetScalars( aScalars );
+ aScalars->Delete();
+
+ vtkStructuredGridGeometryFilter* aFilter = vtkStructuredGridGeometryFilter::New();
+ aFilter->SetInput( aStructuredGrid );
+ aFilter->Update();
+ myOutput->ShallowCopy( aFilter->GetOutput() );
+ aFilter->Delete();
+}
--- /dev/null
+// 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_TableReader.hxx
+// Author : Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_TableReader_HeaderFile
+#define VISU_TableReader_HeaderFile
+
+/*!
+ \file VISU_TableReader.hxx
+ \brief The file contains definition of the Table reading functionlity
+*/
+
+#include "VISUConvertor.hxx"
+
+#include "VISU_IDMapper.hxx"
+
+#include <string>
+#include <vector>
+
+namespace VISU
+{
+ //---------------------------------------------------------------
+ struct VISU_CONVERTOR_EXPORT TTable2D
+ {
+ typedef std::string TValue;
+ typedef std::vector<TValue> TValues;
+
+ struct TRow
+ {
+ std::string myTitle;
+ std::string myUnit;
+ TValues myValues;
+ };
+
+ std::string myTitle;
+ std::vector<std::string> myColumnUnits;
+ std::vector<std::string> myColumnTitles;
+
+ typedef std::vector<TRow> TRows;
+ TRows myRows;
+
+ int
+ Check();
+
+ void
+ getColumns( TTable2D& theTable2D ) const;
+ };
+
+
+ //---------------------------------------------------------------
+ class VISU_CONVERTOR_EXPORT TTableIDMapper:
+ public virtual TPolyDataIDMapper,
+ public virtual TTable2D
+ {
+ public:
+ TTableIDMapper();
+ ~TTableIDMapper();
+
+ virtual
+ vtkPolyData*
+ GetPolyDataOutput();
+
+ virtual
+ long unsigned int
+ GetMemorySize();
+
+ void
+ SetXAxisPosition( vtkIdType theAxisPosition );
+
+ vtkIdType
+ GetXAxisPosition();
+
+ protected:
+ vtkIdType myXAxisPosition;
+ vtkPolyData* myOutput;
+ };
+ typedef MED::SharedPtr<TTableIDMapper> PTableIDMapper;
+
+
+ //---------------------------------------------------------------
+ typedef std::vector<PTableIDMapper> TTableContainer;
+ void ImportTables( const char* theFileName, TTableContainer& theContainer );
+
+
+ //---------------------------------------------------------------
+}
+
+#endif
--- /dev/null
+// 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_VTKTypeList.hxx
+// Author : Oleg UVAROV
+// Module : VISU
+
+#ifndef VISU_VTKTypeList_HeaderFile
+#define VISU_VTKTypeList_HeaderFile
+
+#include "VISU_TypeList.hxx"
+
+#include <vtkCharArray.h>
+#include <vtkUnsignedCharArray.h>
+#include <vtkShortArray.h>
+#include <vtkUnsignedShortArray.h>
+#include <vtkIntArray.h>
+#include <vtkUnsignedIntArray.h>
+#include <vtkLongArray.h>
+#include <vtkUnsignedLongArray.h>
+#include <vtkFloatArray.h>
+#include <vtkDoubleArray.h>
+
+
+//----------------------------------------------------------------------------
+namespace VISU
+{
+ //----------------------------------------------------------------------------
+ namespace TL
+ {
+ //----------------------------------------------------------------------------
+ typedef TSequence< char,
+ unsigned char,
+ short,
+ unsigned short,
+ int,
+ unsigned int,
+ long,
+ unsigned long,
+ float,
+ double >::TResult TVTKBasicTypeList;
+
+
+ //----------------------------------------------------------------------------
+ typedef TSequence< vtkCharArray,
+ vtkUnsignedCharArray,
+ vtkShortArray,
+ vtkUnsignedShortArray,
+ vtkIntArray,
+ vtkUnsignedIntArray,
+ vtkLongArray,
+ vtkUnsignedLongArray,
+ vtkFloatArray,
+ vtkDoubleArray >::TResult TVTKArrayTypeList;
+
+
+ //----------------------------------------------------------------------------
+ typedef TSequence< TInt2Type< VTK_CHAR >,
+ TInt2Type< VTK_UNSIGNED_CHAR >,
+ TInt2Type< VTK_SHORT >,
+ TInt2Type< VTK_UNSIGNED_SHORT >,
+ TInt2Type< VTK_INT >,
+ TInt2Type< VTK_UNSIGNED_INT >,
+ TInt2Type< VTK_LONG >,
+ TInt2Type< VTK_UNSIGNED_LONG >,
+ TInt2Type< VTK_FLOAT >,
+ TInt2Type< VTK_DOUBLE > >::TResult TVTKBasicEnumList;
+
+
+ //----------------------------------------------------------------------------
+ template< unsigned int type_enum >
+ struct TEnum2VTKBasicType
+ {
+ typedef typename TTypeAt< TVTKBasicTypeList, TIndexOf< TVTKBasicEnumList, TInt2Type< type_enum > >::value >::TResult TResult;
+ };
+
+
+ //----------------------------------------------------------------------------
+ template< unsigned int type_enum >
+ struct TEnum2VTKArrayType
+ {
+ typedef typename TTypeAt< TVTKArrayTypeList, TIndexOf< TVTKBasicEnumList, TInt2Type< type_enum > >::value >::TResult TResult;
+ };
+
+
+ //----------------------------------------------------------------------------
+ template< class T >
+ struct TVTKBasicType2Enum
+ {
+ typedef typename TTypeAt< TVTKBasicEnumList, TIndexOf< TVTKBasicTypeList, T >::value >::TResult TResult;
+ };
+
+
+ //----------------------------------------------------------------------------
+ }
+
+
+ //----------------------------------------------------------------------------
+}
+
+#endif
--- /dev/null
+// 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 :
+// Author :
+// Module : VISU
+// $Header$
+
+#include "VISU_ActorBase.h"
+#include "VISU_ActorFactory.h"
+
+#include <vtkObjectFactory.h>
+#include <vtkProperty.h>
+#include <vtkPassThroughFilter.h>
+#include <vtkShrinkFilter.h>
+#include <vtkDataSet.h>
+#include <vtkShrinkPolyData.h>
+#include <vtkUnstructuredGrid.h>
+
+#include "utilities.h"
+
+#include "VTKViewer_ShrinkFilter.h"
+
+
+#include <boost/bind.hpp>
+
+VISU_ActorBase
+::VISU_ActorBase() :
+ myIsShrinkable(true),
+ myIsShrunk(false),
+ myShrinkFilter(VTKViewer_ShrinkFilter::New())
+{
+ myShrinkFilter->Delete();
+
+ myStoreMapping = true;
+
+ myShrinkFilter->SetStoreMapping(true);
+
+}
+
+VISU_ActorBase
+::~VISU_ActorBase()
+{
+
+}
+
+//----------------------------------------------------------------------------
+VISU::TActorFactory*
+VISU_ActorBase
+::GetFactory()
+{
+ return myActorFactory;
+}
+
+void
+VISU_ActorBase
+::SetFactory(VISU::TActorFactory* theActorFactory)
+{
+ using namespace VISU;
+
+ if(myActorFactory == theActorFactory)
+ return;
+
+ if(theActorFactory)
+ myDestroySignal.connect(boost::bind(&TActorFactory::RemoveActor,
+ theActorFactory,
+ _1));
+
+ myActorFactory = theActorFactory;
+}
+
+void
+VISU_ActorBase
+::UpdateFromFactory()
+{
+ if(myUpdateFromFactoryTime.GetMTime() < myActorFactory->GetMTime()){
+ myUpdateFromFactoryTime.Modified();
+ myActorFactory->UpdateActor(this);
+ Update();
+ }
+}
+
+//--------------------------------------------------------------------------
+
+void
+VISU_ActorBase
+::SetLineWidth(vtkFloatingPointType theLineWidth)
+{
+ GetProperty()->SetLineWidth(theLineWidth);
+}
+
+vtkFloatingPointType
+VISU_ActorBase
+::GetLineWidth()
+{
+ return GetProperty()->GetLineWidth();
+}
+
+//--------------------------------------------------------------------------
+void
+VISU_ActorBase
+::SetRepresentation(int theMode)
+{
+ Superclass::SetRepresentation(theMode);
+ if(myRepresentation == VTK_POINTS)
+ UnShrink();
+}
+
+//----------------------------------------------------------------------------
+void VISU_ActorBase::SetShrink()
+{
+ if(!myIsShrinkable)
+ return;
+ if(vtkDataSet* aDataSet = myPassFilter[0]->GetOutput()){
+ myShrinkFilter->SetInput(aDataSet);
+ myPassFilter[1]->SetInput(myShrinkFilter->GetOutput());
+ myIsShrunk = true;
+ }
+}
+
+void VISU_ActorBase::UnShrink()
+{
+ if(!myIsShrunk)
+ return;
+ if(vtkDataSet* aDataSet = myPassFilter[0]->GetOutput()){
+ myPassFilter[1]->SetInput(aDataSet);
+ myPassFilter[1]->Modified();
+ myIsShrunk = false;
+ Modified();
+ }
+}
+
+bool VISU_ActorBase::IsShrunk()
+{
+ return myIsShrunk;
+}
+
+void VISU_ActorBase::SetShrinkable(bool theIsShrinkable)
+{
+ myIsShrinkable = theIsShrinkable;
+}
+
+bool VISU_ActorBase::IsShrunkable()
+{
+ return myIsShrinkable;
+}
--- /dev/null
+// 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 :
+// Author :
+// Module : VISU
+// $Header$
+
+#ifndef VISU_ACTOR_BASE_H
+#define VISU_ACTOR_BASE_H
+
+#include "SALOME_Actor.h"
+#include "VISU_BoostSignals.h"
+
+class VTKViewer_ShrinkFilter;
+
+#ifdef _WIN32
+#define VTKOCC_EXPORT __declspec (dllexport)
+#else
+#define VTKOCC_EXPORT VTK_EXPORT
+#endif
+
+
+//----------------------------------------------------------------------------
+namespace VISU
+{
+ struct TActorFactory;
+}
+
+
+//! This class defines an abstaract interface to manage actors
+class VTKOCC_EXPORT VISU_ActorBase: public SALOME_Actor,
+ public boost::signalslib::trackable
+{
+ public:
+ vtkTypeMacro(VISU_ActorBase, SALOME_Actor);
+
+ //----------------------------------------------------------------------------
+ VISU::TActorFactory* GetFactory();
+ virtual void SetFactory(VISU::TActorFactory* theActorFactory);
+
+ //----------------------------------------------------------------------------
+ virtual void UpdateFromFactory();
+
+ //----------------------------------------------------------------------------
+
+ virtual void SetLineWidth(vtkFloatingPointType theLineWidth);
+ virtual vtkFloatingPointType GetLineWidth();
+
+ virtual void SetShrink();
+ virtual void UnShrink();
+ virtual bool IsShrunkable();
+ virtual bool IsShrunk();
+ virtual void SetShrinkable(bool theIsShrinkable);
+
+
+ virtual void SetRepresentation(int theMode);
+
+ protected:
+ VISU_ActorBase();
+ virtual ~VISU_ActorBase();
+
+ VISU::TActorFactory* myActorFactory;
+ vtkTimeStamp myUpdateFromFactoryTime;
+ boost::signal1<void,VISU_ActorBase*> myDestroySignal;
+
+ vtkSmartPointer<VTKViewer_ShrinkFilter> myShrinkFilter;
+
+ bool myIsShrinkable;
+ bool myIsShrunk;
+};
+
+#endif //VISU_ACTOR_BASE_H
--- /dev/null
+// 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());
+// }
--- /dev/null
+// 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
--- /dev/null
+// 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 :
+// Author :
+// Module : VISU
+// $Header$
+
+#include "VISU_PointMap3dActor.h"
+#include "VISU_PipeLine.hxx"
+#include "VISU_ScalarBarActor.hxx"
+#include "VISU_DeformedGridPL.hxx"
+
+#include "utilities.h"
+#include <vtkRenderer.h>
+#include <vtkObjectFactory.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+vtkStandardNewMacro(VISU_PointMap3dActor);
+
+//==================================================================
+// function: Constructor
+// purpose :
+//==================================================================
+
+VISU_PointMap3dActor
+::VISU_PointMap3dActor()
+{
+ if(MYDEBUG) MESSAGE("VISU_PointMap3dActor::VISU_PointMap3dActor - this = "<<this);
+ myScalarBar = VISU_ScalarBarActor::New();
+}
+
+//==================================================================
+// function: Destructor
+// purpose :
+//==================================================================
+
+VISU_PointMap3dActor
+::~VISU_PointMap3dActor()
+{
+ if(MYDEBUG) MESSAGE("VISU_PointMap3dActor::~VISU_PointMap3dActor - this = "<<this);
+ myScalarBar->Delete();
+}
+
+//==================================================================
+// function: AddToRender
+// purpose :
+//==================================================================
+void
+VISU_PointMap3dActor
+::AddToRender(vtkRenderer* theRenderer)
+{
+ Superclass::AddToRender(theRenderer);
+ theRenderer->AddActor2D(myScalarBar);
+}
+
+void
+VISU_PointMap3dActor
+::RemoveFromRender(vtkRenderer* theRenderer)
+{
+ if(myScalarBar)
+ theRenderer->RemoveActor(myScalarBar);
+
+ Superclass::RemoveFromRender(theRenderer);
+}
+
+//==================================================================
+// function: Set & Get PipeLine
+// purpose :
+//==================================================================
+void
+VISU_PointMap3dActor
+::SetPipeLine(VISU_DeformedGridPL* thePipeLine)
+{
+ myPipeLine = thePipeLine;
+ SetMapper(thePipeLine->GetMapper());
+ myScalarBar->SetLookupTable(thePipeLine->GetBarTable());
+}
+
+VISU_DeformedGridPL*
+VISU_PointMap3dActor
+::GetPipeLine()
+{
+ return myPipeLine.GetPointer();
+}
+
+//==================================================================
+// function: Visibility
+// purpose :
+//==================================================================
+
+void
+VISU_PointMap3dActor
+::SetVisibility(int theMode)
+{
+ Superclass::SetVisibility( theMode );
+
+ // myPointsActor->SetVisibility( theMode );
+
+ if(myScalarBar)
+ myScalarBar->SetVisibility(theMode);
+}
+
+VISU_ScalarBarActor*
+VISU_PointMap3dActor
+::GetScalarBar()
+{
+ return myScalarBar;
+}
+
+//==================================================================
+// function: SetIO
+// purpose :
+//==================================================================
+
+void
+VISU_PointMap3dActor
+::setIO(const Handle(SALOME_InteractiveObject)& theIO)
+{
+ Superclass::setIO(theIO);
+ myName = theIO->getName();
+}
--- /dev/null
+// 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_PointMap3dActor.h
+// Author : Dmitry MATVEICHEV with help of Alexey PETROV
+// Module : VISU
+// $Header$
+
+#ifndef VISU_PointMap3dActor_HeaderFile
+#define VISU_PointMap3dActor_HeaderFile
+
+#include "SALOME_Actor.h"
+#include "VISU_DataSetActor.h"
+#include "VISU_BoostSignals.h"
+
+class VISU_ScalarBarActor;
+
+#ifdef _WIN32
+#define VTKOCC_EXPORT __declspec (dllexport)
+#else
+#define VTKOCC_EXPORT VTK_EXPORT
+#endif
+
+class VISU_DeformedGridPL;
+
+class VTKOCC_EXPORT VISU_PointMap3dActor : public VISU_ActorBase
+{
+ public:
+ vtkTypeMacro(VISU_PointMap3dActor,SALOME_Actor);
+
+ static
+ VISU_PointMap3dActor*
+ New();
+
+ ~VISU_PointMap3dActor();
+
+//----------------------------------------------------------------------------
+ virtual
+ void
+ AddToRender( vtkRenderer* );
+
+ virtual
+ void
+ RemoveFromRender( vtkRenderer* );
+
+ virtual
+ void
+ SetVisibility(int theMode);
+
+ virtual
+ VISU_ScalarBarActor*
+ GetScalarBar();
+
+//----------------------------------------------------------------------------
+ virtual
+ void
+ setIO(const Handle(SALOME_InteractiveObject)& theIO);
+
+//----------------------------------------------------------------------------
+ virtual
+ VISU_DeformedGridPL*
+ GetPipeLine();
+
+ virtual
+ void
+ SetPipeLine(VISU_DeformedGridPL* thePipeLine);
+
+ protected:
+ VISU_PointMap3dActor();
+ vtkSmartPointer<VISU_DeformedGridPL> myPipeLine;
+
+ VISU_ScalarBarActor* myScalarBar;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2008 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_ScalarMapPL.cxx
+// Author: Roman NIKOLAEV
+// Module : VISU
+
+//Salome includes
+#include "VISU_DeformationPL.hxx"
+#include "VISU_MergeFilter.hxx"
+#include "VISU_DeformedShapePL.hxx"
+#include "VISU_PipeLineUtils.hxx"
+
+//VTK includes
+#include <vtkDataSet.h>
+#include <vtkPassThroughFilter.h>
+#include <vtkWarpVector.h>
+#include <vtkCellDataToPointData.h>
+#include <vtkUnstructuredGrid.h>
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+//----------------------------------------------------------------------------
+VISU_DeformationPL::VISU_DeformationPL():
+ myScaleFactor(1.0),
+ myMapScaleFactor(1.0)
+{
+ if(MYDEBUG) MESSAGE("VISU_DeformationPL()::VISU_DeformationPL() - "<<this);
+ myWarpVector = vtkWarpVector::New();
+ myWarpVector->SetScaleFactor(myScaleFactor);
+
+ myVectorMergeFilter = VISU_MergeFilter::New();
+ myVectorMergeFilter->SetMergingInputs(true);
+ myInputPassFilter = vtkPassThroughFilter::New();
+ myOutputPassFiler = vtkPassThroughFilter::New();
+ myCellDataToPointData = vtkCellDataToPointData::New();
+ myCellDataToPointData->PassCellDataOn();
+
+ myInputPassFilter->SetInput(vtkUnstructuredGrid::New());
+
+ myCellDataToPointData->SetInput(myInputPassFilter->GetOutput());
+
+ myWarpVector->SetInput(myCellDataToPointData->GetOutput());
+
+ myOutputPassFiler->SetInput(myWarpVector->GetOutput());
+}
+
+//----------------------------------------------------------------------------
+VISU_DeformationPL::~VISU_DeformationPL()
+{
+ if(MYDEBUG) MESSAGE("VISU_DeformationPL()::~VISU_DeformationPL() - "<<this);
+ myWarpVector->Delete();
+ myVectorMergeFilter->Delete();
+ myInputPassFilter->Delete();
+ myOutputPassFiler->Delete();
+ myCellDataToPointData->Delete();
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_DeformationPL::GetMTime(){
+ unsigned long int aTime = std::max(myWarpVector->GetMTime(),
+ myVectorMergeFilter->GetMTime());
+
+ aTime = std::max(aTime,myInputPassFilter->GetMTime());
+ aTime = std::max(aTime,myOutputPassFiler->GetMTime());
+ aTime = std::max(aTime,myCellDataToPointData->GetMTime());
+}
+
+//----------------------------------------------------------------------------
+void VISU_DeformationPL::SetScale(vtkFloatingPointType theScaleFactor)
+{
+ if(myScaleFactor == theScaleFactor)
+ return;
+ myScaleFactor = theScaleFactor;
+ myWarpVector->SetScaleFactor(myScaleFactor*myMapScaleFactor);
+}
+
+void VISU_DeformationPL::SetMapScale(vtkFloatingPointType theMapScaleFactor)
+{
+ if(myMapScaleFactor == theMapScaleFactor)
+ return;
+ myMapScaleFactor = theMapScaleFactor;
+
+ myWarpVector->SetScaleFactor(myScaleFactor*myMapScaleFactor);
+}
+
+
+vtkFloatingPointType VISU_DeformationPL::GetScale()
+{
+ return myScaleFactor;
+}
+
+//----------------------------------------------------------------------------
+void VISU_DeformationPL::SetWarpVectorInput(vtkDataSet *theInput)
+{
+ myInputPassFilter->SetInput(theInput);
+}
+
+//----------------------------------------------------------------------------
+vtkDataSet* VISU_DeformationPL::GetWarpVectorOutput()
+{
+ return myOutputPassFiler->GetOutput();
+}
+
+//----------------------------------------------------------------------------
+void VISU_DeformationPL::SetMergeFilterInput(vtkDataSet* ScalarInput,
+ vtkDataSet* VectorialInput)
+{
+ myVectorMergeFilter->SetScalars(ScalarInput);
+ myVectorMergeFilter->AddField("VISU_CELLS_MAPPER",ScalarInput);
+ myVectorMergeFilter->AddField("VISU_POINTS_MAPPER",ScalarInput);
+
+ myVectorMergeFilter->SetGeometry(VectorialInput);
+ myVectorMergeFilter->SetVectors(VectorialInput);
+}
+
+//----------------------------------------------------------------------------
+vtkDataSet* VISU_DeformationPL::GetMergeFilterOutput(){
+ return myVectorMergeFilter->GetOutput();
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType VISU_DeformationPL::GetDefaultScaleFactor(VISU_DeformationPL *thePipeLine)
+{
+ if(!thePipeLine || !thePipeLine->GetMergeFilterOutput())
+ return 0.0;
+
+ vtkFloatingPointType aSourceRange[2];
+ thePipeLine->GetMergeFilterOutput()->GetScalarRange(aSourceRange);
+
+ static vtkFloatingPointType EPS = 1.0 / VTK_LARGE_FLOAT;
+ if(fabs(aSourceRange[1]) > EPS){
+ vtkDataSet* aDataSet = thePipeLine->GetMergeFilterOutput();
+ vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor(aDataSet);
+ return aScaleFactor / aSourceRange[1];
+ }
+ return 0.0;
+}
+
--- /dev/null
+// Copyright (C) 2008 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_DeformationPL.hxx
+// Author :
+// Module : SALOME
+
+#ifndef VISU_DeformationPL_HeaderFile
+#define VISU_DeformationPL_HeaderFile
+
+#include "VISUPipeline.hxx"
+#include "VISU_MapperHolder.hxx"
+#include <vtkSmartPointer.h>
+
+class vtkDataSet;
+class VISU_MergeFilter;
+class vtkPassThroughFilter;
+class vtkWarpVector;
+class vtkCellDataToPointData;
+
+class VISU_PIPELINE_EXPORT VISU_DeformationPL {
+
+public:
+ VISU_DeformationPL();
+ virtual ~VISU_DeformationPL();
+
+ //-----------------------------------------------------------
+ virtual void SetScale(vtkFloatingPointType theScaleFactor);
+ virtual void SetMapScale(vtkFloatingPointType theMapScaleFactor);
+ virtual vtkFloatingPointType GetScale();
+
+ //-----------------------------------------------------------
+ virtual void SetVectorialField(VISU::PUnstructuredGridIDMapper theIdMapper) = 0;
+ virtual VISU::PUnstructuredGridIDMapper getVectorialField() = 0;
+
+
+ //-----------------------------------------------------------
+ virtual
+ unsigned
+ long int
+ GetMTime();
+
+ static vtkFloatingPointType GetDefaultScaleFactor(VISU_DeformationPL *thePipeLine);
+
+ void SetWarpVectorInput(vtkDataSet *theInput);
+ vtkDataSet* GetWarpVectorOutput();
+
+ //-----------------------------------------------------------
+ void SetMergeFilterInput(vtkDataSet* ScalarInput,
+ vtkDataSet* VectorialInput);
+
+ vtkDataSet* GetMergeFilterOutput();
+
+protected:
+
+ VISU::PUnstructuredGridIDMapper myVectorialField;
+ vtkWarpVector *myWarpVector;
+ vtkSmartPointer<VISU_MergeFilter> myVectorMergeFilter;
+ vtkPassThroughFilter *myInputPassFilter;
+ vtkPassThroughFilter *myOutputPassFiler;
+ vtkCellDataToPointData *myCellDataToPointData;
+
+private:
+ vtkFloatingPointType myScaleFactor;
+ vtkFloatingPointType myMapScaleFactor;
+
+};
+
+#endif
--- /dev/null
+// 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_DeformedGridPL.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_DeformedGridPL.hxx"
+#include "VISU_FieldTransform.hxx"
+#include "VISU_Plot3DPL.hxx"
+
+#include "VISU_PipeLineUtils.hxx"
+
+#include <vtkPolyDataMapper.h>
+#include <vtkContourFilter.h>
+#include <vtkWarpScalar.h>
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_DeformedGridPL);
+
+
+//----------------------------------------------------------------------------
+VISU_DeformedGridPL
+::VISU_DeformedGridPL():
+ myContourFilter(vtkContourFilter::New()),
+ myWarpScalar(vtkWarpScalar::New()),
+ myIsContour(false),
+ myScaleFactor(1.0),
+ myMapScaleFactor(1.0)
+{
+ SetIsShrinkable(false);
+ SetNumberOfContours(32);
+}
+
+
+//----------------------------------------------------------------------------
+VISU_DeformedGridPL
+::~VISU_DeformedGridPL()
+{}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_DeformedGridPL
+::GetMTime()
+{
+ unsigned long int aTime = Superclass::GetMTime();
+
+ aTime = std::max(aTime, myContourFilter->GetMTime());
+ aTime = std::max(aTime, myWarpScalar->GetMTime());
+
+ return aTime;
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_DeformedGridPL
+::GetMemorySize()
+{
+ unsigned long int aSize = Superclass::GetMemorySize();
+
+ if(vtkDataObject* aDataObject = myContourFilter->GetInput())
+ aSize += aDataObject->GetActualMemorySize() * 1024;
+
+ if(vtkDataObject* aDataObject = myWarpScalar->GetInput())
+ aSize += aDataObject->GetActualMemorySize() * 1024;
+
+ return aSize;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
+{
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+
+ if(VISU_DeformedGridPL *aPipeLine = dynamic_cast<VISU_DeformedGridPL*>(thePipeLine)){
+ SetScaleFactor( aPipeLine->GetScaleFactor() );
+ SetContourPrs( aPipeLine->GetIsContourPrs() );
+ SetNumberOfContours( aPipeLine->GetNumberOfContours() );
+ }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::Init()
+{
+ Superclass::Init();
+
+ vtkPointSet* aPointSet = GetFieldTransformFilter()->GetPolyDataOutput();
+ SetScaleFactor( VISU_Plot3DPL::GetScaleFactor( this, aPointSet ) );
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::Build()
+{
+ Superclass::Build();
+
+ myWarpScalar->SetInput( GetFieldTransformFilter()->GetPolyDataOutput() );
+ GetPolyDataMapper()->SetInput( myWarpScalar->GetPolyDataOutput() );
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::Update()
+{
+ vtkPointSet* aPointSet = GetFieldTransformFilter()->GetPolyDataOutput();
+ if ( !myIsContour ) // surface prs
+ {
+ myWarpScalar->SetInput( aPointSet );
+ }
+ else // contour prs
+ {
+ myContourFilter->SetInput( aPointSet );
+
+ vtkFloatingPointType aScalarRange[2];
+ GetSourceRange( aScalarRange );
+
+ myContourFilter->GenerateValues( GetNumberOfContours(), aScalarRange );
+ myWarpScalar->SetInput( myContourFilter->GetOutput() );
+ }
+
+ Superclass::Update();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::SetNumberOfContours(int theNumber)
+{
+ myContourFilter->SetNumberOfContours(theNumber);
+}
+
+
+//----------------------------------------------------------------------------
+int
+VISU_DeformedGridPL
+::GetNumberOfContours()
+{
+ return myContourFilter->GetNumberOfContours();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::SetScaleFactor(vtkFloatingPointType theScaleFactor)
+{
+ if ( VISU::CheckIsSameValue( myWarpScalar->GetScaleFactor(), theScaleFactor ) )
+ return;
+
+ myScaleFactor = theScaleFactor;
+ myWarpScalar->SetScaleFactor(theScaleFactor*myMapScaleFactor);
+}
+
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType
+VISU_DeformedGridPL
+::GetScaleFactor()
+{
+ return myScaleFactor;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::SetContourPrs(bool theIsContourPrs )
+{
+ if(myIsContour == theIsContourPrs)
+ return;
+
+ myIsContour = theIsContourPrs;
+ Modified();
+}
+
+
+//----------------------------------------------------------------------------
+bool
+VISU_DeformedGridPL
+::GetIsContourPrs()
+{
+ return myIsContour;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::SetMapScale(vtkFloatingPointType theMapScale)
+{
+ Superclass::SetMapScale(theMapScale);
+ myMapScaleFactor = theMapScale;
+
+ if ( myIsContour ) {
+ vtkFloatingPointType aSourceRange[2];
+ GetSourceRange( aSourceRange );
+ vtkFloatingPointType aDeltaRange = aSourceRange[1] - aSourceRange[0];
+ vtkFloatingPointType aNewRange[2] = { aSourceRange[1] - theMapScale*aDeltaRange, aSourceRange[1] };
+ myContourFilter->GenerateValues( GetNumberOfContours(), aNewRange );
+ }
+
+ myWarpScalar->SetScaleFactor( myScaleFactor * theMapScale );
+}
--- /dev/null
+// 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_ScalarMapPL.hxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_DeformedGridPL_HeaderFile
+#define VISU_DeformedGridPL_HeaderFile
+
+#include "VISUPipeline.hxx"
+#include "VISU_PolyDataPL.hxx"
+
+class vtkWarpScalar;
+class vtkContourFilter;
+
+
+//----------------------------------------------------------------------------
+class VISU_PIPELINE_EXPORT VISU_DeformedGridPL : public VISU_PolyDataPL
+{
+public:
+ vtkTypeMacro(VISU_DeformedGridPL, VISU_PolyDataPL);
+
+ static
+ VISU_DeformedGridPL*
+ New();
+
+ //----------------------------------------------------------------------------
+ virtual
+ unsigned long int
+ GetMTime();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ //----------------------------------------------------------------------------
+ void
+ SetScaleFactor( vtkFloatingPointType theScaleFactor );
+
+ vtkFloatingPointType
+ GetScaleFactor();
+
+ void
+ SetContourPrs( bool theIsContourPrs );
+
+ bool
+ GetIsContourPrs();
+
+ void
+ SetNumberOfContours( int theNumber );
+
+ int
+ GetNumberOfContours();
+
+ virtual
+ void
+ SetMapScale(vtkFloatingPointType theMapScale = 1.0);
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ Init();
+
+ virtual
+ void
+ Update();
+
+protected:
+ //----------------------------------------------------------------------------
+ VISU_DeformedGridPL();
+
+ virtual
+ ~VISU_DeformedGridPL();
+
+ virtual
+ void
+ Build();
+
+ virtual
+ void
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
+
+private:
+ VISU_DeformedGridPL(const VISU_DeformedGridPL&); // Not implemented.
+ void operator=(const VISU_DeformedGridPL&); // Not implemented.
+
+ vtkFloatingPointType myScaleFactor;
+ vtkFloatingPointType myMapScaleFactor;
+ vtkContourFilter* myContourFilter;
+ vtkWarpScalar *myWarpScalar;
+ bool myIsContour;
+};
+
+#endif
--- /dev/null
+// VISU DeformedShapeAndScalarMapPL
+//
+// 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_DeformedShapeAndScalarMapPL.cxx
+// Author: Eugeny Nikolaev
+// Module : VISU
+
+#include "VISU_DeformedShapeAndScalarMapPL.hxx"
+#include "VISU_FieldTransform.hxx"
+#include "VISU_Extractor.hxx"
+#include "VISU_LookupTable.hxx"
+#include "VISU_DeformedShapePL.hxx"
+#include "VTKViewer_TransformFilter.h"
+#include "VTKViewer_Transform.h"
+#include "VISU_MergeFilter.hxx"
+#include "VISU_ElnoDisassembleFilter.hxx"
+#include "VISU_PipeLineUtils.hxx"
+
+#include <vtkWarpVector.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkCellDataToPointData.h>
+#include <vtkPointDataToCellData.h>
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_DeformedShapeAndScalarMapPL)
+
+//----------------------------------------------------------------------------
+/*!
+ * Constructor. Creating new instances of vtkWarpVector,vtkMergeFilter,vtkUnstructuredGrid
+ * Where:
+ * \li myDeformVectors is vtkWarpVector - deformation vectors data
+ * \li myScalarsMergeFilter is vtkMergeFilter - merge filter.
+ * Merge filter which unify the deformation and scalars
+ * \li myScalars is vtk shared pointer to vtkUnstructuredGrid - scalars data
+*/
+VISU_DeformedShapeAndScalarMapPL
+::VISU_DeformedShapeAndScalarMapPL():
+ myScaleFactor(1.0),
+ myMapScaleFactor(1.0)
+{
+ myWarpVector = vtkWarpVector::New();
+
+ myScalarsMergeFilter = VISU_MergeFilter::New();
+ myScalarsMergeFilter->SetMergingInputs(true);
+
+ myScalarsExtractor = VISU_Extractor::New();
+
+ myScalarsFieldTransform = VISU_FieldTransform::New();
+
+ myCellDataToPointData = vtkCellDataToPointData::New();
+ myScalarsElnoDisassembleFilter = VISU_ElnoDisassembleFilter::New();
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Destructor.
+ * Delete all fields.
+*/
+VISU_DeformedShapeAndScalarMapPL
+::~VISU_DeformedShapeAndScalarMapPL()
+{
+ myWarpVector->Delete();
+
+ myScalarsMergeFilter->Delete();
+
+ myScalarsExtractor->Delete();
+
+ myScalarsFieldTransform->Delete();
+
+ myCellDataToPointData->Delete();
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Initial method
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::Init()
+{
+ Superclass::Init();
+
+ SetScale(VISU_DeformedShapePL::GetDefaultScale(this));
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Build method
+ * Building of deformation and puts result to merge filter.
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::Build()
+{
+ Superclass::Build();
+}
+
+
+//----------------------------------------------------------------------------
+vtkDataSet*
+VISU_DeformedShapeAndScalarMapPL
+::InsertCustomPL()
+{
+ GetMapper()->SetColorModeToMapScalars();
+ GetMapper()->ScalarVisibilityOn();
+
+ VISU::CellDataToPoint(myWarpVector,
+ myCellDataToPointData,
+ GetMergedInput());
+
+ myScalars = GetMergedInput();
+
+ UpdateScalars();
+
+ myScalarsFieldTransform->SetInput(myScalarsExtractor->GetOutput());
+
+ // Sets geometry for merge filter
+ myScalarsMergeFilter->SetGeometry(myWarpVector->GetUnstructuredGridOutput());
+
+ vtkDataSet* aScalarsDataSet = myScalarsFieldTransform->GetOutput();
+ myScalarsMergeFilter->SetScalars(aScalarsDataSet);
+ myScalarsMergeFilter->AddField("VISU_CELLS_MAPPER", aScalarsDataSet);
+ myScalarsMergeFilter->AddField("VISU_POINTS_MAPPER", aScalarsDataSet);
+
+ return myScalarsMergeFilter->GetOutput();
+}
+
+
+//----------------------------------------------------------------------------
+/*!
+ * Update method
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::Update()
+{
+ Superclass::Update();
+ //{
+ // std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myScalarsExtractor.vtk";
+ // VISU::WriteToFile(myScalarsExtractor->GetUnstructuredGridOutput(), aFileName);
+ //}
+ //{
+ // std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myWarpVector.vtk";
+ // VISU::WriteToFile(myWarpVector->GetUnstructuredGridOutput(), aFileName);
+ //}
+ //{
+ // std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myScalarsMergeFilter.vtk";
+ // VISU::WriteToFile(myScalarsMergeFilter->GetUnstructuredGridOutput(), aFileName);
+ //}
+}
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_DeformedShapeAndScalarMapPL
+::GetMemorySize()
+{
+ unsigned long int aSize = Superclass::GetMemorySize();
+
+ if(vtkDataSet* aDataSet = myWarpVector->GetOutput())
+ aSize += aDataSet->GetActualMemorySize() * 1024;
+
+ if(vtkDataSet* aDataSet = myScalarsExtractor->GetOutput())
+ aSize += aDataSet->GetActualMemorySize() * 1024;
+
+ if(vtkDataSet* aDataSet = myScalarsMergeFilter->GetOutput())
+ aSize += aDataSet->GetActualMemorySize() * 1024;
+
+ if(myCellDataToPointData->GetInput())
+ if(vtkDataSet* aDataSet = myCellDataToPointData->GetOutput())
+ aSize += aDataSet->GetActualMemorySize() * 1024;
+
+ return aSize;
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Update scalars method.
+ * Put scalars to merge filter.
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::UpdateScalars()
+{
+ vtkDataSet* aScalars = GetScalars();
+ myScalarsElnoDisassembleFilter->SetInput(aScalars);
+ myScalarsExtractor->SetInput(myScalarsElnoDisassembleFilter->GetOutput());
+
+ if(VISU::IsDataOnCells(myScalarsElnoDisassembleFilter->GetOutput()))
+ GetMapper()->SetScalarModeToUseCellData();
+ else
+ GetMapper()->SetScalarModeToUsePointData();
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Copy information about pipline.
+ * Copy scale and scalars.
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
+{
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+
+ if(VISU_DeformedShapeAndScalarMapPL *aPipeLine = dynamic_cast<VISU_DeformedShapeAndScalarMapPL*>(thePipeLine)){
+ SetScale(aPipeLine->GetScale());
+ SetScalars(aPipeLine->GetScalars());
+ }
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Set scalars.
+ * Sets vtkDataSet with scalars values to VISU_Extractor filter for scalars extraction.
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::SetScalars(vtkDataSet *theScalars)
+{
+ if(GetScalars() == theScalars)
+ return;
+
+ myScalars = theScalars;
+ UpdateScalars();
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Get pointer to input scalars.
+ */
+vtkDataSet*
+VISU_DeformedShapeAndScalarMapPL
+::GetScalars()
+{
+ return myScalars.GetPointer();
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Sets scale for deformed shape
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::SetScale(vtkFloatingPointType theScale)
+{
+ if(VISU::CheckIsSameValue(myScaleFactor, theScale))
+ return;
+
+ myScaleFactor = theScale;
+ myWarpVector->SetScaleFactor(theScale*myMapScaleFactor);
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Gets scale of deformed shape.
+ */
+vtkFloatingPointType
+VISU_DeformedShapeAndScalarMapPL
+::GetScale()
+{
+ return myScaleFactor;
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Set scale factor of deformation.
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::SetMapScale(vtkFloatingPointType theMapScale)
+{
+ myMapScaleFactor = theMapScale;
+ Superclass::SetMapScale(theMapScale);
+ myWarpVector->SetScaleFactor(myScaleFactor*theMapScale);
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Gets scalar mode.
+ */
+int
+VISU_DeformedShapeAndScalarMapPL
+::GetScalarMode()
+{
+ return myScalarsExtractor->GetScalarMode();
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Sets scalar mode.
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::SetScalarMode(int theScalarMode)
+{
+ VISU_ScalarMapPL::SetScalarMode(theScalarMode, GetScalars(), myScalarsExtractor);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedShapeAndScalarMapPL
+::SetScaling(int theScaling)
+{
+ if(GetScaling() == theScaling)
+ return;
+
+ GetBarTable()->SetScale(theScaling);
+
+ if(theScaling == VTK_SCALE_LOG10)
+ myScalarsFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Log10));
+ else
+ myScalarsFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Ident));
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedShapeAndScalarMapPL
+::SetScalarRange(vtkFloatingPointType theRange[2])
+{
+ if(VISU::CheckIsSameRange(theRange, GetScalarRange()))
+ return;
+
+ myScalarsFieldTransform->SetScalarRange(theRange);
+ GetBarTable()->SetRange(theRange);
+}
+
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType*
+VISU_DeformedShapeAndScalarMapPL
+::GetScalarRange()
+{
+ return myScalarsFieldTransform->GetScalarRange();
+}
+
+
+//----------------------------------------------------------------------------
+/*!
+ * Gets ranges of extracted scalars
+ * \param theRange[2] - output values
+ * \li theRange[0] - minimum value
+ * \li theRange[1] - maximum value
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::GetSourceRange(vtkFloatingPointType theRange[2])
+{
+ myScalarsExtractor->Update();
+ myScalarsExtractor->GetUnstructuredGridOutput()->GetScalarRange(theRange);
+}
--- /dev/null
+// 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_DeformedShapeAndScalarMapPL.hxx
+// Author: Eugeny Nikolaev
+// Module : VISU
+
+#ifndef VISU_DeformedShapeAndScalarMapPL_HeaderFile
+#define VISU_DeformedShapeAndScalarMapPL_HeaderFile
+
+#include "VISUPipeline.hxx"
+#include "VISU_ScalarMapPL.hxx"
+
+class VISU_MergeFilter;
+class vtkWarpVector;
+class vtkUnstructuredGrid;
+class vtkCellDataToPointData;
+class vtkPointDataToCellData;
+class VISU_ElnoDisassembleFilter;
+
+
+//----------------------------------------------------------------------------
+class VISU_PIPELINE_EXPORT VISU_DeformedShapeAndScalarMapPL : public VISU_ScalarMapPL
+{
+public:
+ vtkTypeMacro(VISU_DeformedShapeAndScalarMapPL, VISU_ScalarMapPL);
+
+ static
+ VISU_DeformedShapeAndScalarMapPL*
+ New();
+
+ virtual
+ void
+ SetScale(vtkFloatingPointType theScale);
+
+ virtual
+ vtkFloatingPointType
+ GetScale();
+
+ virtual
+ int
+ GetScalarMode();
+
+ virtual
+ void
+ SetScalarMode(int theScalarMode = 0);
+
+ virtual
+ void
+ SetScaling(int theScaling);
+
+ virtual
+ void
+ SetScalarRange(vtkFloatingPointType theRange[2]);
+
+ virtual
+ vtkFloatingPointType*
+ GetScalarRange();
+
+ virtual
+ void
+ GetSourceRange(vtkFloatingPointType theRange[2]);
+
+ virtual
+ void
+ SetScalars(vtkDataSet *theScalars);
+
+ virtual
+ vtkDataSet*
+ GetScalars();
+
+public:
+ //! Redefined method for initialization of the pipeline.
+ virtual
+ void
+ Init();
+
+ //! Redefined method for building the pipeline.
+ virtual
+ void
+ Build();
+
+ //! Redefined method for updating the pipeline.
+ virtual
+ void
+ Update();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ //! Update scalars.
+ void
+ UpdateScalars();
+
+ virtual
+ void
+ SetMapScale(vtkFloatingPointType theMapScale = 1.0);
+
+protected:
+ VISU_DeformedShapeAndScalarMapPL();
+
+ virtual
+ ~VISU_DeformedShapeAndScalarMapPL();
+
+ virtual
+ vtkDataSet*
+ InsertCustomPL();
+
+ virtual
+ void
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
+
+private:
+ VISU_DeformedShapeAndScalarMapPL(const VISU_DeformedShapeAndScalarMapPL&);
+
+ vtkFloatingPointType myScaleFactor;
+ vtkFloatingPointType myMapScaleFactor;
+ vtkWarpVector *myWarpVector;
+ VISU_MergeFilter *myScalarsMergeFilter;
+ vtkSmartPointer<vtkUnstructuredGrid> myScalars;
+ vtkCellDataToPointData* myCellDataToPointData;
+ VISU_FieldTransform* myScalarsFieldTransform;
+ VISU_Extractor* myScalarsExtractor;
+ VISU_ElnoDisassembleFilter* myScalarsElnoDisassembleFilter;
+};
+
+#endif
--- /dev/null
+// 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
+
+#include "VISU_ElnoAssembleFilter.hxx"
+#include "VISU_PipeLineUtils.hxx"
+#include "VISU_ElnoMeshValue.hxx"
+
+#include <vtkCellData.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkPoints.h>
+#include <vtkCellArray.h>
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro( VISU_ElnoAssembleFilter );
+
+
+//----------------------------------------------------------------------------
+VISU_ElnoAssembleFilter::VISU_ElnoAssembleFilter()
+{
+ this->SetInputArrayToProcess( 0, // idx
+ 0, // port
+ 0, // connection
+ vtkDataObject::FIELD_ASSOCIATION_POINTS, // field association
+ "ELNO_POINT_COORDS" ); // name
+
+ this->myIsRestorePoints = false;
+}
+
+
+//----------------------------------------------------------------------------
+VISU_ElnoAssembleFilter::~VISU_ElnoAssembleFilter()
+{}
+
+
+//----------------------------------------------------------------------------
+void VISU_ElnoAssembleFilter::SetElnoAssembleState( bool theIsRestorePoints )
+{
+ if ( myIsRestorePoints == theIsRestorePoints )
+ return;
+
+ myIsRestorePoints = theIsRestorePoints;
+ this->Modified();
+}
+
+//----------------------------------------------------------------------------
+namespace
+{
+ //----------------------------------------------------------------------------
+ template < int points_type, int elno_type >
+ int Execute2( vtkPointSet *theInput,
+ vtkPointSet *theOutput,
+ vtkDataArray *theElnoPointCoords )
+ {
+ theOutput->CopyStructure( theInput );
+
+ vtkCellData *aCellData = theOutput->GetCellData();
+ aCellData->PassData( theInput->GetCellData() );
+
+ vtkPointData *aPointData = theOutput->GetPointData();
+ aPointData->PassData( theInput->GetPointData() );
+
+ vtkPoints *anInputPoints = theInput->GetPoints();
+ vtkPoints *aPoints = anInputPoints->New( elno_type );
+ vtkIdType aNbPoints = theInput->GetNumberOfPoints();
+ aPoints->SetNumberOfPoints( aNbPoints );
+
+ typedef typename VISU::TL::TEnum2VTKArrayType< elno_type >::TResult TPointsDataArray;
+ typedef typename VISU::TL::TEnum2VTKBasicType< elno_type >::TResult TPointsDataType;
+ TPointsDataArray* anOutputPointsArray = TPointsDataArray::SafeDownCast( aPoints->GetData() );
+
+ TPointsDataArray* anElnoPointCoords = TPointsDataArray::SafeDownCast( theElnoPointCoords );
+
+ for ( vtkIdType aPointId = 0; aPointId < aNbPoints; aPointId++ ) {
+ TPointsDataType aCoords[ 3 ];
+ anElnoPointCoords->GetTupleValue( aPointId, aCoords );
+ anOutputPointsArray->SetTupleValue( aPointId, aCoords );
+ }
+
+ theOutput->SetPoints( aPoints );
+
+ return 1;
+ }
+
+
+ //----------------------------------------------------------------------------
+ template < int points_type >
+ int Execute( vtkPointSet *theInput,
+ vtkPointSet *theOutput,
+ vtkDataArray *theElnoPointCoords )
+ {
+ switch( theElnoPointCoords->GetDataType() ){
+ case VTK_DOUBLE:
+ return Execute2< points_type, VTK_DOUBLE >( theInput, theOutput, theElnoPointCoords );
+ case VTK_FLOAT:
+ return Execute2< points_type, VTK_FLOAT >( theInput, theOutput, theElnoPointCoords );
+ case VTK_INT:
+ return Execute2< points_type, VTK_INT >( theInput, theOutput, theElnoPointCoords );
+ case VTK_LONG:
+ return Execute2< points_type, VTK_LONG >( theInput, theOutput, theElnoPointCoords );
+ default:
+ break;
+ }
+
+ return 0;
+ }
+
+
+ //----------------------------------------------------------------------------
+}
+
+
+//----------------------------------------------------------------------------
+int VISU_ElnoAssembleFilter::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
+ vtkPointSet *anInput = vtkPointSet::SafeDownCast( inInfo->Get( vtkDataObject::DATA_OBJECT() ) );
+ vtkPointSet *anOutput = vtkPointSet::SafeDownCast( outInfo->Get( vtkDataObject::DATA_OBJECT() ) );
+
+ vtkDataArray *anElnoPointCoords = this->GetInputArrayToProcess( 0, inputVector );
+
+ if ( !myIsRestorePoints || !anElnoPointCoords ) {
+ anOutput->ShallowCopy( anInput );
+ return 1;
+ }
+
+ vtkPoints *aPoints = anInput->GetPoints();
+ switch( aPoints->GetDataType() ){
+ case VTK_DOUBLE:
+ return ::Execute< VTK_DOUBLE >( anInput, anOutput, anElnoPointCoords );
+ case VTK_FLOAT:
+ return ::Execute< VTK_FLOAT >( anInput, anOutput, anElnoPointCoords );
+ case VTK_INT:
+ return ::Execute< VTK_INT >( anInput, anOutput, anElnoPointCoords );
+ case VTK_LONG:
+ return ::Execute< VTK_LONG >( anInput, anOutput, anElnoPointCoords );
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+
+//----------------------------------------------------------------------------
--- /dev/null
+// 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
+
+#ifndef VISU_ElnoAssembleFilter_H
+#define VISU_ElnoAssembleFilter_H
+
+#include <vtkPointSetAlgorithm.h>
+
+class VISU_ElnoAssembleFilter : public vtkPointSetAlgorithm
+{
+public:
+ typedef vtkPointSetAlgorithm Superclass;
+
+ static VISU_ElnoAssembleFilter *New();
+
+ void SetElnoAssembleState( bool theIsRestorePoints );
+
+protected:
+ VISU_ElnoAssembleFilter();
+ ~VISU_ElnoAssembleFilter();
+
+ int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+
+ bool myIsRestorePoints;
+
+private:
+ VISU_ElnoAssembleFilter(const VISU_ElnoAssembleFilter&); // Not implemented.
+ void operator=(const VISU_ElnoAssembleFilter&); // Not implemented.
+};
+
+#endif
--- /dev/null
+// 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
+
+#include "VISU_ElnoDisassembleFilter.hxx"
+#include "VISU_PipeLineUtils.hxx"
+#include "VISU_ElnoMeshValue.hxx"
+
+#include <vtkCellData.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkPoints.h>
+#include <vtkCellArray.h>
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro( VISU_ElnoDisassembleFilter );
+
+
+//----------------------------------------------------------------------------
+VISU_ElnoDisassembleFilter::VISU_ElnoDisassembleFilter()
+{
+ this->SetInputArrayToProcess( 0, // idx
+ 0, // port
+ 0, // connection
+ vtkDataObject::FIELD_ASSOCIATION_CELLS, // field association
+ "ELNO_FIELD" ); // name
+
+ this->SetInputArrayToProcess( 1, // idx
+ 0, // port
+ 0, // connection
+ vtkDataObject::FIELD_ASSOCIATION_CELLS, // field association
+ "ELNO_COMPONENT_MAPPER" ); // name
+
+ this->myShrinkFactor = -0.999;
+}
+
+
+//----------------------------------------------------------------------------
+VISU_ElnoDisassembleFilter::~VISU_ElnoDisassembleFilter()
+{}
+
+
+//----------------------------------------------------------------------------
+void VISU_ElnoDisassembleFilter::SetShrinkFactor( vtkFloatingPointType theValue )
+{
+ if ( VISU::CheckIsSameValue( theValue, myShrinkFactor ) )
+ return;
+
+ myShrinkFactor = theValue;
+ this->Modified();
+}
+
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType VISU_ElnoDisassembleFilter::GetShrinkFactor()
+{
+ return myShrinkFactor;
+}
+
+
+//----------------------------------------------------------------------------
+namespace
+{
+ //----------------------------------------------------------------------------
+ template < int points_type, int elno_type >
+ struct TExecute2
+ {
+ vtkUnstructuredGrid *myInput;
+ vtkUnstructuredGrid *myOutput;
+ vtkDataArray *myElnoDataArray;
+ vtkDataArray *myElnoDataMapper;
+ vtkFloatingPointType myShrinkFactor;
+
+ typedef typename VISU::TL::TEnum2VTKArrayType< points_type >::TResult TPointsDataArray;
+ typedef typename VISU::TL::TEnum2VTKBasicType< points_type >::TResult TPointsDataType;
+
+ typedef typename VISU::TL::TEnum2VTKArrayType< elno_type >::TResult TElnoDataArray;
+ typedef typename VISU::TL::TEnum2VTKBasicType< elno_type >::TResult TElnoDataType;
+
+ VISU::TGetElnoNodeData< elno_type > myGetElnoNodeData;
+ vtkCellArray *myConnectivity;
+ vtkPointData *myInputPointData;
+ vtkPointData *myOutputPointData;
+ TPointsDataArray *myInputPointsArray;
+ TPointsDataArray *myOutputPointsArray;
+ TElnoDataArray* myElnoFullDataArray;
+ TElnoDataArray* myElnoPartialDataArray;
+ TPointsDataArray *myElnoPointCoords;
+ vtkIntArray* myInputPointsMapper;
+ vtkIntArray* myOutputPointsMapper;
+
+ //----------------------------------------------------------------------------
+ TExecute2( vtkUnstructuredGrid *theInput,
+ vtkUnstructuredGrid *theOutput,
+ vtkDataArray *theElnoDataArray,
+ vtkDataArray *theElnoDataMapper,
+ vtkFloatingPointType theShrinkFactor )
+ : myGetElnoNodeData( theElnoDataArray, theElnoDataMapper )
+ , myInput( theInput )
+ , myOutput( theOutput )
+ , myElnoDataArray( theElnoDataArray )
+ , myElnoDataMapper( theElnoDataMapper )
+ , myShrinkFactor( theShrinkFactor )
+ {
+ myConnectivity = vtkCellArray::New();
+ myConnectivity->DeepCopy( theInput->GetCells() );
+
+ vtkPoints *anInputPoints = theInput->GetPoints();
+ vtkPoints *aPoints = anInputPoints->New( anInputPoints->GetDataType() );
+ vtkIdType aNbCells = myConnectivity->GetNumberOfCells();
+ vtkIdType aNbPoints = myConnectivity->GetNumberOfConnectivityEntries() - aNbCells;
+ aPoints->Allocate( aNbPoints );
+
+ myInputPointsArray = TPointsDataArray::SafeDownCast( anInputPoints->GetData() );
+ myOutputPointsArray = TPointsDataArray::SafeDownCast( aPoints->GetData() );
+
+ myInputPointData = theInput->GetPointData();
+ myOutputPointData = theOutput->GetPointData();
+ myOutputPointData->Allocate( aNbPoints );
+
+ vtkCellData *anInputCellData = theInput->GetCellData();
+
+ // To create a new copy of initial data for output
+ myElnoFullDataArray = TElnoDataArray::New();
+ myElnoFullDataArray->SetName( "VISU_FIELD" );
+ myElnoFullDataArray->SetNumberOfComponents( myGetElnoNodeData.getNbComp() );
+ myElnoFullDataArray->SetNumberOfTuples( aNbPoints );
+
+ // To create a new copy of partial initial data for output
+ myElnoPartialDataArray = TElnoDataArray::New();
+ // This partial data can be represented as in terms of vectors as scalars
+ if ( anInputCellData->GetVectors() != NULL )
+ myElnoPartialDataArray->SetNumberOfComponents( 3 );
+ else
+ myElnoPartialDataArray->SetNumberOfComponents( 1 );
+ myElnoPartialDataArray->SetNumberOfTuples( aNbPoints );
+
+ myElnoPointCoords = TPointsDataArray::New();
+ myElnoPointCoords->SetName( "ELNO_POINT_COORDS" );
+ myElnoPointCoords->SetNumberOfComponents( 3 );
+ myElnoPointCoords->SetNumberOfTuples( aNbPoints );
+
+ vtkDataArray* anArray = myInputPointData->GetArray( "VISU_POINTS_MAPPER" );
+ myInputPointsMapper = vtkIntArray::SafeDownCast( anArray );
+
+ myOutputPointsMapper = vtkIntArray::New();
+ myOutputPointsMapper->SetName( myInputPointsMapper->GetName() );
+ myOutputPointsMapper->SetNumberOfComponents( myInputPointsMapper->GetNumberOfComponents() );
+ myOutputPointsMapper->SetNumberOfTuples( aNbPoints );
+
+ if ( theShrinkFactor > 0.0 )
+ this->ShrinkExecute();
+ else
+ this->SimpleExecute();
+
+ theOutput->SetPoints( aPoints );
+
+ theOutput->SetCells( theInput->GetCellTypesArray(),
+ theInput->GetCellLocationsArray(),
+ myConnectivity );
+
+ myConnectivity->Delete();
+
+ vtkCellData *anOutputCellData = theOutput->GetCellData();
+ anOutputCellData->PassData( anInputCellData );
+
+ anOutputCellData->RemoveArray( "ELNO_COMPONENT_MAPPER" );
+ anOutputCellData->RemoveArray( "ELNO_FIELD" );
+ anOutputCellData->RemoveArray( "VISU_FIELD" );
+ anOutputCellData->SetVectors( NULL );
+
+ //anOutputPointData->PassData( anInputPointData );
+
+ myOutputPointData->AddArray( myElnoFullDataArray );
+ myElnoFullDataArray->Delete();
+
+ if ( anInputCellData->GetVectors() != NULL )
+ myOutputPointData->SetVectors( myElnoPartialDataArray );
+ else
+ myOutputPointData->SetScalars( myElnoPartialDataArray );
+ myElnoPartialDataArray->Delete();
+
+ myOutputPointData->AddArray( myElnoPointCoords );
+ myElnoPointCoords->Delete();
+
+ myOutputPointData->AddArray( myOutputPointsMapper );
+ myOutputPointsMapper->Delete();
+ }
+
+ //----------------------------------------------------------------------------
+ void SimpleExecute()
+ {
+ // To reserve a temproary value holder
+ vtkIdType aNbComp = std::max( 3, myGetElnoNodeData.getNbComp() );
+ std::vector< TElnoDataType > anElnoDataValues( aNbComp );
+
+ std::vector< int > anPointsMapperValues( myInputPointsMapper->GetNumberOfComponents() );
+
+ myConnectivity->InitTraversal();
+ vtkIdType aNbPts = 0, *aPts = 0;
+ for ( vtkIdType aCellId = 0; myConnectivity->GetNextCell( aNbPts, aPts ); aCellId++ ) {
+ for ( vtkIdType aPntId = 0; aPntId < aNbPts; aPntId++ ) {
+ TPointsDataType aCoords[ 3 ];
+ vtkIdType aCurrentPntId = aPts[ aPntId ];
+ myInputPointsArray->GetTupleValue( aCurrentPntId, aCoords );
+
+ aPts[ aPntId ] = myOutputPointsArray->InsertNextTupleValue( aCoords );
+ vtkIdType aNewPntId = aPts[ aPntId ];
+
+ myElnoPointCoords->SetTupleValue( aNewPntId, aCoords );
+
+ myOutputPointData->CopyData( myInputPointData, aCurrentPntId, aNewPntId );
+
+ TElnoDataType* anElnoData = myGetElnoNodeData( aCellId, aPntId );
+ myElnoFullDataArray->SetTupleValue( aNewPntId, anElnoData );
+
+ myElnoFullDataArray->GetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] );
+ myElnoPartialDataArray->SetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] );
+
+ myInputPointsMapper->GetTupleValue( aCurrentPntId, &anPointsMapperValues[ 0 ] );
+ myOutputPointsMapper->SetTupleValue( aNewPntId, &anPointsMapperValues[ 0 ] );
+ }
+ }
+ }
+
+ //----------------------------------------------------------------------------
+ void ShrinkExecute()
+ {
+ // To reserve a temproary value holder
+ vtkIdType aNbComp = std::max( 3, myGetElnoNodeData.getNbComp() );
+ std::vector< TElnoDataType > anElnoDataValues( aNbComp );
+
+ std::vector< int > anPointsMapperValues( myInputPointsMapper->GetNumberOfComponents() );
+
+ myConnectivity->InitTraversal();
+ vtkIdType aNbPts = 0, *aPts = 0;
+ for ( vtkIdType aCellId = 0; myConnectivity->GetNextCell( aNbPts, aPts ); aCellId++ ) {
+
+ TPointsDataType aCenter[ 3 ] = { TPointsDataType(), TPointsDataType(), TPointsDataType() };
+
+ for ( vtkIdType aPntId = 0; aPntId < aNbPts; aPntId++ ) {
+ TPointsDataType aCoords[ 3 ];
+ myInputPointsArray->GetTupleValue( aPts[ aPntId ], aCoords );
+
+ aCenter[ 0 ] += aCoords[ 0 ];
+ aCenter[ 1 ] += aCoords[ 1 ];
+ aCenter[ 2 ] += aCoords[ 2 ];
+ }
+
+ aCenter[ 0 ] /= aNbPts;
+ aCenter[ 1 ] /= aNbPts;
+ aCenter[ 2 ] /= aNbPts;
+
+ for ( vtkIdType aPntId = 0; aPntId < aNbPts; aPntId++ ) {
+ TPointsDataType aCoords[ 3 ];
+ vtkIdType aCurrentPntId = aPts[ aPntId ];
+ myInputPointsArray->GetTupleValue( aCurrentPntId, aCoords );
+
+ TPointsDataType aNewCoords[ 3 ];
+
+ aNewCoords[ 0 ] = aCenter[ 0 ] +
+ TPointsDataType( myShrinkFactor * ( aCoords[ 0 ] - aCenter[ 0 ] ) );
+ aNewCoords[ 1 ] = aCenter[ 1 ] +
+ TPointsDataType( myShrinkFactor * ( aCoords[ 1 ] - aCenter[ 1 ] ) );
+ aNewCoords[ 2 ] = aCenter[ 2 ] +
+ TPointsDataType( myShrinkFactor * ( aCoords[ 2 ] - aCenter[ 2 ] ) );
+
+ aPts[ aPntId ] = myOutputPointsArray->InsertNextTupleValue( aNewCoords );
+ vtkIdType aNewPntId = aPts[ aPntId ];
+
+ myElnoPointCoords->SetTupleValue( aNewPntId, aCoords );
+
+ myOutputPointData->CopyData( myInputPointData, aCurrentPntId, aNewPntId );
+
+ TElnoDataType* anElnoData = myGetElnoNodeData( aCellId, aPntId );
+ myElnoFullDataArray->SetTupleValue( aNewPntId, anElnoData );
+
+ myElnoFullDataArray->GetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] );
+ myElnoPartialDataArray->SetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] );
+
+ myInputPointsMapper->GetTupleValue( aCurrentPntId, &anPointsMapperValues[ 0 ] );
+ myOutputPointsMapper->SetTupleValue( aNewPntId, &anPointsMapperValues[ 0 ] );
+ }
+ }
+ }
+ };
+
+
+ //----------------------------------------------------------------------------
+ template < int points_type, int elno_type >
+ int Execute2( vtkUnstructuredGrid *theInput,
+ vtkUnstructuredGrid *theOutput,
+ vtkDataArray *theElnoDataArray,
+ vtkDataArray *theElnoDataMapper,
+ vtkFloatingPointType theShrinkFactor )
+ {
+ TExecute2< points_type, elno_type >( theInput,
+ theOutput,
+ theElnoDataArray,
+ theElnoDataMapper,
+ theShrinkFactor );
+
+ return 1;
+ }
+
+
+ //----------------------------------------------------------------------------
+ template < int points_type >
+ int Execute( vtkUnstructuredGrid *theInput,
+ vtkUnstructuredGrid *theOutput,
+ vtkDataArray *theElnoDataArray,
+ vtkDataArray *theElnoDataMapper,
+ vtkFloatingPointType theShrinkFactor )
+ {
+ switch( theElnoDataArray->GetDataType() ){
+ case VTK_DOUBLE:
+ return Execute2< points_type, VTK_DOUBLE >
+ ( theInput, theOutput, theElnoDataArray, theElnoDataMapper, theShrinkFactor );
+ case VTK_FLOAT:
+ return Execute2< points_type, VTK_FLOAT >
+ ( theInput, theOutput, theElnoDataArray, theElnoDataMapper, theShrinkFactor );
+ case VTK_INT:
+ return Execute2< points_type, VTK_INT >
+ ( theInput, theOutput, theElnoDataArray, theElnoDataMapper, theShrinkFactor );
+ case VTK_LONG:
+ return Execute2< points_type, VTK_LONG >
+ ( theInput, theOutput, theElnoDataArray, theElnoDataMapper, theShrinkFactor );
+ default:
+ break;
+ }
+
+ return 0;
+ }
+
+
+ //----------------------------------------------------------------------------
+}
+
+
+//----------------------------------------------------------------------------
+int VISU_ElnoDisassembleFilter::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
+ vtkUnstructuredGrid *anInput =
+ vtkUnstructuredGrid::SafeDownCast( inInfo->Get( vtkDataObject::DATA_OBJECT() ) );
+ vtkUnstructuredGrid *anOutput =
+ vtkUnstructuredGrid::SafeDownCast( outInfo->Get( vtkDataObject::DATA_OBJECT() ) );
+
+ vtkDataArray *anElnoDataArray = this->GetInputArrayToProcess( 0, inputVector );
+ vtkDataArray *anElnoDataMapper = this->GetInputArrayToProcess( 1, inputVector );
+
+ if ( !anElnoDataArray ) {
+ anOutput->ShallowCopy( anInput );
+ return 1;
+ }
+
+ vtkPoints *aPoints = anInput->GetPoints();
+ switch( aPoints->GetDataType() ){
+ case VTK_DOUBLE:
+ return ::Execute< VTK_DOUBLE >( anInput, anOutput, anElnoDataArray, anElnoDataMapper, myShrinkFactor );
+ case VTK_FLOAT:
+ return ::Execute< VTK_FLOAT >( anInput, anOutput, anElnoDataArray, anElnoDataMapper, myShrinkFactor );
+ case VTK_INT:
+ return ::Execute< VTK_INT >( anInput, anOutput, anElnoDataArray, anElnoDataMapper, myShrinkFactor );
+ case VTK_LONG:
+ return ::Execute< VTK_LONG >( anInput, anOutput, anElnoDataArray, anElnoDataMapper, myShrinkFactor );
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+
+//----------------------------------------------------------------------------
--- /dev/null
+// 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
+
+#ifndef VISU_ElnoDisassembleFilter_H
+#define VISU_ElnoDisassembleFilter_H
+
+#include <vtkUnstructuredGridAlgorithm.h>
+
+class VISU_ElnoDisassembleFilter : public vtkUnstructuredGridAlgorithm
+{
+public:
+ typedef vtkUnstructuredGridAlgorithm Superclass;
+
+ static VISU_ElnoDisassembleFilter *New();
+
+ void SetShrinkFactor( vtkFloatingPointType theValue );
+ vtkFloatingPointType GetShrinkFactor();
+
+protected:
+ VISU_ElnoDisassembleFilter();
+ ~VISU_ElnoDisassembleFilter();
+
+ int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+
+ vtkFloatingPointType myShrinkFactor;
+
+private:
+ VISU_ElnoDisassembleFilter(const VISU_ElnoDisassembleFilter&); // Not implemented.
+ void operator=(const VISU_ElnoDisassembleFilter&); // Not implemented.
+};
+
+#endif
--- /dev/null
+// 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
+}
--- /dev/null
+// 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
--- /dev/null
+// 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_MergedPL.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_MergedPL.hxx"
+#include "VISU_PipeLine.hxx"
+
+
+//----------------------------------------------------------------------------
+void
+VISU_MergedPL
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
+{
+ if(VISU_MergedPL *aPipeLine = dynamic_cast<VISU_MergedPL*>(thePipeLine)){
+ if ( this == aPipeLine )
+ return;
+
+ if ( aPipeLine->IsExternalGeometryUsed() ) {
+ ClearGeometry();
+ int aNbOfGeometry = aPipeLine->GetNumberOfGeometry();
+ for ( int aGeomNumber = 0; aGeomNumber < aNbOfGeometry; aGeomNumber++ )
+ AddGeometry( aPipeLine->GetGeometry( aGeomNumber ) );
+ }else
+ SetSourceGeometry();
+ }
+}
--- /dev/null
+// 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_MergedPL.hxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_MergedPL_HeaderFile
+#define VISU_MergedPL_HeaderFile
+
+#include "VISUPipeline.hxx"
+
+class vtkDataSet;
+class vtkPointSet;
+class VISU_PipeLine;
+
+
+//----------------------------------------------------------------------------
+struct VISU_PIPELINE_EXPORT VISU_MergedPL
+{
+ virtual
+ void
+ SetSourceGeometry() = 0;
+
+ virtual
+ int
+ AddGeometry( vtkDataSet* theGeometry ) = 0;
+
+ virtual
+ vtkDataSet*
+ GetGeometry( int theGeomNumber ) = 0;
+
+ virtual
+ int
+ GetNumberOfGeometry() = 0;
+
+ virtual
+ bool
+ IsExternalGeometryUsed() = 0;
+
+ virtual
+ void
+ ClearGeometry() = 0;
+
+ virtual
+ vtkPointSet*
+ GetMergedInput() = 0;
+
+ virtual
+ void
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2008 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_ScalarMapPL.cxx
+// Author: Roman NIKOLAEV
+// Module : VISU
+
+//Salome includes
+#include "VISU_OptionalDeformationPL.hxx"
+#include "VISU_PipeLineUtils.hxx"
+
+//VTK includes
+#include <vtkDataSet.h>
+#include <vtkPassThroughFilter.h>
+#include <vtkWarpVector.h>
+#include <vtkCellDataToPointData.h>
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//----------------------------------------------------------------------------
+VISU_OptionalDeformationPL::VISU_OptionalDeformationPL():
+ VISU_DeformationPL(),
+ myIsDeformed(true)
+{
+ if(MYDEBUG) MESSAGE("VISU_OptionalDeformationPL()::VISU_OptionalDeformationPL() - "<<this);
+}
+
+//----------------------------------------------------------------------------
+VISU_OptionalDeformationPL::~VISU_OptionalDeformationPL()
+{
+ if(MYDEBUG) MESSAGE("VISU_OptionalDeformationPL()::~VISU_OptionalDeformationPL() - "<<this);
+}
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_OptionalDeformationPL::GetMTime(){
+ return Superclass::GetMTime();
+}
+
+//----------------------------------------------------------------------------
+void VISU_OptionalDeformationPL::UseDeformation(bool flag){
+ if(myIsDeformed == flag)
+ return;
+
+ myIsDeformed = flag;
+ if(myIsDeformed)
+ OnDeformation();
+ else
+ OffDeformation();
+}
+
+//----------------------------------------------------------------------------
+bool VISU_OptionalDeformationPL::IsDeformed(){
+ return myIsDeformed;
+}
+
+//----------------------------------------------------------------------------
+void VISU_OptionalDeformationPL::OnDeformation(){
+
+ myCellDataToPointData->SetInput(myInputPassFilter->GetOutput());
+ myWarpVector->SetInput(myCellDataToPointData->GetOutput());
+ myOutputPassFiler->SetInput(myWarpVector->GetOutput());
+}
+
+//----------------------------------------------------------------------------
+void VISU_OptionalDeformationPL::OffDeformation(){
+ myOutputPassFiler->SetInput(myInputPassFilter->GetOutput());
+}
+
+
+
+bool VISU_OptionalDeformationPL::CheckCanDeformate(vtkDataSet* theInput){
+ if(theInput) {
+ if(VISU::IsDataOnCells(theInput))
+ return theInput->GetCellData()->GetVectors() != NULL;
+ else if(VISU::IsDataOnPoints(theInput))
+ return theInput->GetPointData()->GetVectors() != NULL;
+ }
+ return false;
+}
--- /dev/null
+// Copyright (C) 2008 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_OptionalDeformationPL.hxx
+// Author :
+// Module : SALOME
+
+#ifndef VISU_OptionalDeformationPL_HeaderFile
+#define VISU_OptionalDeformationPL_HeaderFile
+
+#include "VISUPipeline.hxx"
+#include "VISU_DeformationPL.hxx"
+
+class VISU_PIPELINE_EXPORT VISU_OptionalDeformationPL: public VISU_DeformationPL
+{
+public:
+ VISU_OptionalDeformationPL();
+ virtual ~VISU_OptionalDeformationPL();
+
+ typedef VISU_DeformationPL Superclass;
+
+ void UseDeformation(bool flag);
+ bool IsDeformed();
+
+ virtual
+ unsigned
+ long int
+ GetMTime();
+
+protected:
+ bool CheckCanDeformate(vtkDataSet* theInput);
+
+private:
+ void OnDeformation();
+ void OffDeformation();
+
+private:
+ bool myIsDeformed;
+};
+
+#endif
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// 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 : VisuGUI_DeformedShapeAndScalarMapDlg.cxx
+// Author : Eugeny Nikolaev
+// Module : VISU
+
+#include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
+
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_InputPane.h"
+
+#include "VISU_Result_i.hh"
+#include "VISU_DeformedShapeAndScalarMap_i.hh"
+#include "VISU_ColoredPrs3dFactory.hh"
+
+#include "VISU_ScalarMapPL.hxx"
+#include "VISU_DeformedShapeAndScalarMapPL.hxx"
+
+#include "VISU_Convertor.hxx"
+
+#include "SalomeApp_Module.h"
+#include "LightApp_Application.h"
+#include "LightApp_SelectionMgr.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+
+#include "SALOME_ListIO.hxx"
+
+#include "SALOMEDSClient_AttributeString.hxx"
+#include "SALOMEDSClient_AttributeName.hxx"
+
+#include <qlayout.h>
+#include <qtabwidget.h>
+
+using namespace std;
+
+#define MYDEBUG 0
+
+/*!
+ * Constructor
+ */
+VisuGUI_DeformedShapeAndScalarMapDlg::VisuGUI_DeformedShapeAndScalarMapDlg (SalomeApp_Module* theModule)
+ : VisuGUI_ScalarBarBaseDlg(theModule),
+ myIsAnimation(false),
+ myUpdateScalars(true),
+ myVisuGUI(theModule)
+{
+ setCaption(tr("DLG_TITLE"));
+ setSizeGripEnabled(TRUE);
+
+ QVBoxLayout* TopLayout = new QVBoxLayout (this);
+ TopLayout->setSpacing(6);
+ TopLayout->setMargin(11);
+
+ myTabBox = new QTabWidget (this);
+
+ // Scalar Map on Deformed shape pane
+ QVBox* aBox = new QVBox (this);
+ aBox->setMargin(11);
+ QFrame* TopGroup = new QFrame (aBox, "TopGroup");
+ TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
+ TopGroup->setLineWidth(1);
+ QGridLayout* TopGroupLayout = new QGridLayout (TopGroup);
+ TopGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+ TopGroupLayout->setSpacing(6);
+ TopGroupLayout->setMargin(11);
+
+ // Scale factor
+ QLabel* ScaleLabel = new QLabel (tr("SCALE_FACTOR"), TopGroup, "ScaleLabel");
+ TopGroupLayout->addWidget(ScaleLabel, 0, 0);
+
+ ScalFact = new QtxDblSpinBox (0.0, 1.0E+38, 0.1, TopGroup);
+ ScalFact->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 );
+
+ ScalFact->setPrecision( aPrecision*(-1) );
+ ScalFact->setValue(0.1);
+ TopGroupLayout->addWidget(ScalFact, 0, 1);
+
+ // Fields combo box
+ QLabel* FieldLabel = new QLabel (tr("FIELD_ITEM"), TopGroup, "FieldLabel");
+ myFieldsCombo = new QComboBox (TopGroup,"Fields");
+
+ TopGroupLayout->addWidget(FieldLabel, 1, 0);
+ TopGroupLayout->addWidget(myFieldsCombo,1,1);
+
+ // TimeStamps combo box
+ QLabel* TimeStampLabel = new QLabel (tr("TIMESTAMP_ITEM"), TopGroup, "TimeStampLabel");
+ myTimeStampsCombo = new QComboBox (TopGroup,"TimeStamp");
+
+ TopGroupLayout->addWidget(TimeStampLabel, 2, 0);
+ TopGroupLayout->addWidget(myTimeStampsCombo,2,1);
+
+ //
+ myTabBox->addTab(aBox, tr("DEFORMED_SHAPE_AND_SCALAR_MAP_TAB"));
+
+ // Scalar bar pane
+ myInputPane = new VisuGUI_InputPane(VISU::TDEFORMEDSHAPEANDSCALARMAP, theModule, this);
+
+ myTabBox->addTab(GetScalarPane(), tr("SCALAR_BAR_TAB"));
+ myTabBox->addTab(myInputPane, tr("INPUT_TAB"));
+
+ // Buttons
+ QGroupBox* GroupButtons = new QGroupBox (this, "GroupButtons");
+ GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+ GroupButtons->setColumnLayout(0, Qt::Vertical);
+ GroupButtons->layout()->setSpacing(0);
+ GroupButtons->layout()->setMargin(0);
+ QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons->layout());
+ GroupButtonsLayout->setAlignment(Qt::AlignTop);
+ GroupButtonsLayout->setSpacing(6);
+ GroupButtonsLayout->setMargin(11);
+
+ QPushButton* buttonOk = new QPushButton (tr("&OK"), GroupButtons, "buttonOk");
+ buttonOk->setAutoDefault(TRUE);
+ buttonOk->setDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+
+ GroupButtonsLayout->addItem(new QSpacerItem (5, 5, QSizePolicy::Expanding,
+ QSizePolicy::Minimum), 0, 1);
+
+ QPushButton* buttonCancel = new QPushButton (tr("&Cancel") , GroupButtons, "buttonCancel");
+ buttonCancel->setAutoDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonCancel, 0, 2);
+
+ QPushButton* buttonHelp = new QPushButton (tr("&Help") , GroupButtons, "buttonHelp");
+ buttonHelp->setAutoDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonHelp, 0, 3);
+
+ // Add Tab box and Buttons to the top layout
+ TopLayout->addWidget(myTabBox);
+ TopLayout->addWidget(GroupButtons);
+
+ // signals and slots connections
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp()));
+ connect(myFieldsCombo, SIGNAL(activated(int)), this, SLOT(onFieldChanged(int)));
+ connect(myTimeStampsCombo, SIGNAL(activated(int)), this, SLOT(onTimeStampChanged(int)));
+}
+
+VisuGUI_DeformedShapeAndScalarMapDlg::~VisuGUI_DeformedShapeAndScalarMapDlg()
+{}
+
+void VisuGUI_DeformedShapeAndScalarMapDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+ bool theInit )
+{
+ if( theInit )
+ myPrsCopy = VISU::TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+ setFactor(myPrsCopy->GetScale());
+ myTimeStampsCombo->setDisabled(myIsAnimation);
+
+ CORBA::String_var aFieldName(myPrsCopy->GetScalarFieldName());
+ QString aIteration = GetFloatValueOfTimeStamp(myPrsCopy->GetScalarEntity(),
+ aFieldName.in(),
+ myPrsCopy->GetScalarTimeStampNumber());
+ if (myEntity2Fields.size() == 0)
+ {
+ // find all fields and time stamps on it
+ _PTR(Study) aActiveStudy = VISU::GetCStudy(VISU::GetAppStudy(myVisuGUI));
+ LightApp_SelectionMgr* aSel = VISU::GetSelectionMgr(myVisuGUI);
+ SALOME_ListIO selected;
+ aSel->selectedObjects(selected);
+ if (selected.Extent() > 0) {
+ Handle(SALOME_InteractiveObject) aIO = selected.First();
+ if (aIO->hasEntry()) {
+ _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry());
+ VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
+ switch(aType){
+ case VISU::TTIMESTAMP: {
+ aSObject = aSObject->GetFather();
+ aSObject = aSObject->GetFather();
+ break;
+ }
+ case VISU::TFIELD: {
+ _PTR(SObject) newSObject;
+ if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject;
+ aSObject = aSObject->GetFather();
+ break;
+ }
+ case VISU::TANIMATION: {
+ _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject);
+ for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) {
+ _PTR(SObject) aTmpChildSObj = aTmpIter->Value();
+ _PTR(SObject) newSObject;
+ if(aTmpChildSObj->ReferencedObject(newSObject)){
+ aSObject = newSObject;
+ aSObject->GetFather();
+ break;
+ }
+ }
+ break;
+ }}
+
+ aSObject = aSObject->GetFather();
+ aSObject = aSObject->GetFather();
+
+ mySelectionObj = aSObject;
+ CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
+ if (CORBA::is_nil(anObject)) {
+ mySelectionObj = mySelectionObj->GetFather();
+ }
+ }
+ }
+
+ if (mySelectionObj) {
+ _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj);
+
+ for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
+ _PTR(SObject) aChildSObj = aIter->Value();
+ VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aChildSObj);
+ if (!aRestoringMap.empty()) {
+ VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aRestoringMap);
+ if (aType == VISU::TTIMESTAMP) {
+ QString aMeshName = aRestoringMap["myMeshName"];
+ CORBA::String_var aName = myPrsCopy->GetMeshName();
+ if (aMeshName != aName.in())
+ continue;
+ QString aFieldName = aRestoringMap["myFieldName"];
+ QString aTimeIter = aRestoringMap["myTimeStampId"];
+ QString aEntity = aRestoringMap["myEntityId"];
+ VISU::Entity anEntity;
+ switch (aEntity.toInt()) {
+ case 0: anEntity = VISU::NODE; break;
+ case 1: anEntity = VISU::EDGE; break;
+ case 2: anEntity = VISU::FACE; break;
+ case 3: anEntity = VISU::CELL; break;
+ }
+ TFieldName2TimeStamps& aFieldName2TimeStamps = myEntity2Fields[anEntity];
+ TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldName2TimeStamps[aFieldName];
+ aTimeStampNumber2Time[aTimeIter.toInt()] =
+ GetFloatValueOfTimeStamp(anEntity,
+ aFieldName.latin1(),
+ aTimeIter.toInt());
+ }
+ }
+ }
+ }
+ AddAllFieldNames();
+ }
+ myFieldsCombo->setCurrentText(aFieldName.in());
+ AddAllTimes(myFieldsCombo->currentText());
+ myTimeStampsCombo->setCurrentText(aIteration);
+ SetScalarField( false );
+
+ VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
+
+ if( !theInit )
+ return;
+
+ myInputPane->initFromPrsObject( myPrsCopy );
+ myTabBox->setCurrentPage( 0 );
+}
+
+void VisuGUI_DeformedShapeAndScalarMapDlg::setFactor(double theFactor)
+{
+ double i=0.1;
+ while (1) { // Calculate Step & Precission
+ if ( int (theFactor/i) > 0)
+ break;
+ else {
+ i = i*0.1;
+ }
+ }
+
+ ScalFact->setLineStep(i);
+
+ ScalFact->setValue(theFactor);
+}
+
+int
+VisuGUI_DeformedShapeAndScalarMapDlg
+::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
+{
+ if(!myInputPane->check() || !GetScalarPane()->check())
+ return 0;
+
+ int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
+ anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy );
+
+ myPrsCopy->SetScale(getFactor());
+
+ myPrsCopy->SetScalarField(myPrsCopy->GetScalarEntity(),
+ getCurrentScalarFieldName().latin1(),
+ myTimeStampID[ myTimeStampsCombo->currentItem() ]);
+
+ if(myUpdateScalars)
+ SetScalarField( false );
+
+ VISU::TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Copy(myPrsCopy, thePrs);
+
+ return anIsOk;
+}
+
+int VisuGUI_DeformedShapeAndScalarMapDlg::getCurrentScalarFieldNamePos(){
+ return myFieldsCombo->currentItem();
+}
+
+QString VisuGUI_DeformedShapeAndScalarMapDlg::getCurrentScalarFieldName(){
+ return myFieldsCombo->currentText();
+}
+
+int VisuGUI_DeformedShapeAndScalarMapDlg::getCurrentScalarNbIterations(){
+ return myTimeStampsCombo->count();
+}
+
+VISU::Entity
+VisuGUI_DeformedShapeAndScalarMapDlg
+::getCurrentScalarEntity()
+{
+ VISU::Entity anEntity = VISU::Entity(-1);
+ TEntity2Fields::const_iterator anIter = myEntity2Fields.begin();
+ for(; anIter != myEntity2Fields.end(); anIter++){
+ const TFieldName2TimeStamps& aFieldName2TimeStamps = anIter->second;
+ TFieldName2TimeStamps::const_iterator aFieldIter = aFieldName2TimeStamps.begin();
+ for(; aFieldIter != aFieldName2TimeStamps.end(); aFieldIter++){
+ const QString& aFieldName = aFieldIter->first;
+ if (aFieldName == myFieldsCombo->currentText()) {
+ anEntity = anIter->first;
+ break;
+ }
+ }
+ }
+ return anEntity;
+}
+
+void VisuGUI_DeformedShapeAndScalarMapDlg::SetScalarField( const bool save_scalar_pane ){
+ SetScalarField( myTimeStampID[ myTimeStampsCombo->currentItem() ], "", save_scalar_pane );
+}
+
+void
+VisuGUI_DeformedShapeAndScalarMapDlg
+::SetScalarField(int theIter,
+ QString theFieldName,
+ const bool save_scalar_pane )
+{
+ QApplication::setOverrideCursor(Qt::waitCursor);
+
+ if( save_scalar_pane )
+ GetScalarPane()->storeToPrsObject(myPrsCopy);
+
+ QString aFieldName;
+
+ if(theFieldName.isEmpty())
+ aFieldName = myFieldsCombo->currentText();
+ else
+ aFieldName = theFieldName;
+
+ VISU::Entity anEntity = getCurrentScalarEntity();
+
+ myPrsCopy->SetScalarField(anEntity,
+ aFieldName.latin1(),
+ theIter);
+
+ if( save_scalar_pane )
+ UpdateScalarField();
+
+ QApplication::restoreOverrideCursor();
+}
+
+void VisuGUI_DeformedShapeAndScalarMapDlg::accept()
+{
+ VisuGUI_ScalarBarBaseDlg::accept();
+}
+
+void VisuGUI_DeformedShapeAndScalarMapDlg::reject()
+{
+ VisuGUI_ScalarBarBaseDlg::reject();
+}
+
+QString VisuGUI_DeformedShapeAndScalarMapDlg::GetContextHelpFilePath()
+{
+ return "scalar_map_on_deformed_shape_page.html";
+}
+
+void VisuGUI_DeformedShapeAndScalarMapDlg::AddAllFieldNames(){
+ TEntity2Fields::const_iterator anIter = myEntity2Fields.begin();
+ for(; anIter != myEntity2Fields.end(); anIter++){
+ const TFieldName2TimeStamps& aFieldName2TimeStamps = anIter->second;
+ TFieldName2TimeStamps::const_iterator aFieldIter = aFieldName2TimeStamps.begin();
+ for(; aFieldIter != aFieldName2TimeStamps.end(); aFieldIter++){
+ const QString& aFieldName = aFieldIter->first;
+ myFieldsCombo->insertItem(aFieldName);
+ }
+ }
+}
+
+void VisuGUI_DeformedShapeAndScalarMapDlg::AddAllTimes(const QString& theFieldName){
+ TEntity2Fields::const_iterator anIter = myEntity2Fields.begin();
+ for(; anIter != myEntity2Fields.end(); anIter++){
+ const TFieldName2TimeStamps& aFieldName2TimeStamps = anIter->second;
+ TFieldName2TimeStamps::const_iterator aFieldIter = aFieldName2TimeStamps.begin();
+ for(; aFieldIter != aFieldName2TimeStamps.end(); aFieldIter++){
+ const QString& aFieldName = aFieldIter->first;
+ if(theFieldName != aFieldName)
+ continue;
+
+ myTimeStampID.clear();
+ myTimeStampsCombo->clear();
+
+ const TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldIter->second;
+ TTimeStampNumber2Time::const_iterator aTimeStampIter = aTimeStampNumber2Time.begin();
+ for(; aTimeStampIter != aTimeStampNumber2Time.end(); aTimeStampIter++){
+ int aTimeStampNumber = aTimeStampIter->first;
+ myTimeStampID.push_back(aTimeStampNumber);
+
+ QString aTimeStampTime = aTimeStampIter->second;
+ myTimeStampsCombo->insertItem(aTimeStampTime);
+ }
+ return;
+ }
+ }
+}
+
+void VisuGUI_DeformedShapeAndScalarMapDlg::onFieldChanged(int){
+ AddAllTimes(myFieldsCombo->currentText());
+ SetScalarField();
+ UpdateScalarField();
+}
+
+void VisuGUI_DeformedShapeAndScalarMapDlg::onTimeStampChanged(int){
+ SetScalarField();
+ UpdateScalarField();
+}
+
+void VisuGUI_DeformedShapeAndScalarMapDlg::UpdateScalarField(){
+ GetScalarPane()->initFromPrsObject(myPrsCopy);
+}
+
+QString
+VisuGUI_DeformedShapeAndScalarMapDlg
+::GetFloatValueOfTimeStamp(VISU::Entity theEntity,
+ const std::string& theFieldName,
+ int theTimeStampNumber)
+{
+ QString aTime("");
+ VISU::TEntity anEntity = VISU::TEntity(theEntity);
+ VISU::Result_i* theResult = myPrsCopy->GetCResult();
+ VISU::Result_i::PInput anInput = theResult->GetInput();
+ VISU::PField aField = anInput->GetField(myPrsCopy->GetCMeshName(),
+ anEntity,
+ theFieldName);
+ if(!aField)
+ return aTime;
+
+ VISU::TValField& aValField = aField->myValField;
+ VISU::TValField::const_iterator aIter = aValField.find(theTimeStampNumber);
+ if(aIter != aValField.end()){
+ VISU::PValForTime aValForTime = aIter->second;
+ aTime = VISU_Convertor::GenerateName(aValForTime->myTime).c_str();
+ }
+ return aTime;
+}
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// 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 : VisuGUI_DeformedShapeAndScalarMapDlg.h
+// Author : Eugeny Nikolaev
+// Module : VISU
+
+#ifndef VISUGUI_DEFORMEDSHAPEANDSCALARMAPDLS_H
+#define VISUGUI_DEFORMEDSHAPEANDSCALARMAPDLS_H
+
+#include "VisuGUI_Prs3dDlg.h"
+
+#include "VISUConfig.hh"
+
+#include "QtxDblSpinBox.h"
+
+#include <qdialog.h>
+#include <qgroupbox.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qtabwidget.h>
+
+#include <set>
+#include <vector>
+
+class SalomeApp_Module;
+class VisuGUI_InputPane;
+
+namespace VISU
+{
+ class DeformedShapeAndScalarMap_i;
+}
+
+class VisuGUI_DeformedShapeAndScalarMapDlg : public VisuGUI_ScalarBarBaseDlg
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_DeformedShapeAndScalarMapDlg (SalomeApp_Module* theModule);
+ ~VisuGUI_DeformedShapeAndScalarMapDlg();
+
+ double getFactor()
+ { return ScalFact->value(); }
+ void setFactor(double theFactor);
+
+ virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+ bool theInit );
+
+ virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
+
+ int getCurrentScalarFieldNamePos();
+ QString getCurrentScalarFieldName();
+ int getCurrentScalarNbIterations();
+ VISU::Entity getCurrentScalarEntity();
+ void SetScalarField(int theIter,QString theFieldName=QString(""), const bool = true );
+
+protected:
+ virtual QString GetContextHelpFilePath();
+
+protected slots:
+ void accept();
+ void reject();
+
+private slots:
+ void onFieldChanged(int i=0);
+ void onTimeStampChanged(int i=0);
+
+private:
+ QtxDblSpinBox* ScalFact;
+ QTabWidget* myTabBox;
+ VisuGUI_ScalarBarPane* myScalarPane;
+ VisuGUI_InputPane* myInputPane;
+ QComboBox *myFieldsCombo;
+ QComboBox *myTimeStampsCombo;
+
+ typedef std::map<int, QString> TTimeStampNumber2Time; // Times map definition (iteration time, real value of time)
+ typedef std::map<QString, TTimeStampNumber2Time> TFieldName2TimeStamps; // Field name and enity to Times
+ typedef std::map<VISU::Entity, TFieldName2TimeStamps> TEntity2Fields; // Mesh to fields map
+
+ TEntity2Fields myEntity2Fields;
+ int myCurrScalarIter;
+ bool myIsAnimation;
+ bool myUpdateScalars;
+ std::vector<int> myTimeStampID;
+
+ _PTR(SObject) mySelectionObj;
+ SALOME::GenericObjPtr<VISU::DeformedShapeAndScalarMap_i> myPrsCopy;
+ SalomeApp_Module* myVisuGUI;
+
+protected:
+ void UpdateScalarField();
+ void SetScalarField( const bool = true );
+ void AddAllFieldNames();
+ void AddAllTimes(const QString& theFieldName);
+ QString GetFloatValueOfTimeStamp(VISU::Entity theEntity,
+ const std::string& theFieldName,
+ int theTimeStampNumber);
+};
+
+#endif // VISUGUI_DEFORMEDSHAPEDLS_H
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// 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 : VisuGUI_FileInfoDlg.cxx
+// Author : Alexandre SOLOVYOV
+// Module : VISU
+// $Header$
+
+#include <VisuGUI_FileInfoDlg.h>
+
+#include <MED_Common.hxx>
+
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+
+VisuGUI_FileInfoDlg::VisuGUI_FileInfoDlg( QWidget* parent, SALOME_MED::MedFileInfo* inf )
+ : QtxDialog( parent, 0, true, true, QtxDialog::OK )
+{
+ setCaption( tr( "CAPTION" ) );
+ setSizeGripEnabled( true );
+
+ QLineEdit* fname = new QLineEdit( mainFrame() );
+ fname->setReadOnly( true );
+ QLineEdit* fsize = new QLineEdit( mainFrame() );
+ fsize->setReadOnly( true );
+ QLineEdit* medversion = new QLineEdit( mainFrame() );
+ medversion->setReadOnly( true );
+ fname->setMinimumWidth( 300 );
+
+ QGridLayout* lay = new QGridLayout( mainFrame(), 4, 2, 5, 5 );
+ lay->addWidget( new QLabel( tr( "FILE_NAME" ), mainFrame() ), 0, 0 );
+ lay->addWidget( fname, 0, 1 );
+ lay->addWidget( new QLabel( tr( "FILE_SIZE" ), mainFrame() ), 1, 0 );
+ lay->addWidget( fsize, 1, 1 );
+ lay->addWidget( new QLabel( tr( "MED_VERSION" ), mainFrame() ), 2, 0 );
+ lay->addWidget( medversion, 2, 1 );
+
+ fname->setText( (char*)inf->fileName );
+ fname->home( false );
+ fsize->setText( QString::number( inf->fileSize ) );
+
+ QString version;
+ if( inf->major>=0 )
+ {
+ version = QString::number( inf->major );
+ if( inf->minor>=0 )
+ {
+ version += "." + QString::number( inf->minor );
+ if( inf->release>=0 )
+ version += "." + QString::number( inf->release );
+ }
+ }
+ medversion->setText( version );
+}
+
+VisuGUI_FileInfoDlg::~VisuGUI_FileInfoDlg()
+{
+}
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// 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 : VisuGUI_FileInfoDlg.h
+// Author : Alexandre SOLOVYOV
+// Module : VISU
+// $Header$
+
+#ifndef VISUGUI_FILE_INFO_DIALOG
+#define VISUGUI_FILE_INFO_DIALOG
+
+#include <MED.hh>
+#include <QtxDialog.h>
+
+class VisuGUI_FileInfoDlg : public QtxDialog
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_FileInfoDlg( QWidget*, SALOME_MED::MedFileInfo* );
+ virtual ~VisuGUI_FileInfoDlg();
+};
+
+#endif
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// 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 : VisuGUI_Plot3DDlg.cxx
+// Author : Laurent CORNABE & Hubert ROLLAND
+// Module : VISU
+// $Header$
+
+#include "VisuGUI_Table3dDlg.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
+#include "VisuGUI_InputPane.h"
+
+#include "VISU_ColoredPrs3dFactory.hh"
+#include "VISU_ViewManager_i.hh"
+
+#include "SVTK_ViewWindow.h"
+
+#include "SALOME_Actor.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+#include "LightApp_Application.h"
+
+#include "SVTK_FontWidget.h"
+
+#include "QtxDblSpinBox.h"
+
+#include <qlayout.h>
+#include <qvalidator.h>
+#include <qtabwidget.h>
+#include <qradiobutton.h>
+#include <qspinbox.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+
+using namespace std;
+
+#define SURFACE_PRS_ID 0
+#define CONTOUR_PRS_ID 1
+
+//=======================================================================
+//function : VisuGUI_Table3DPane
+//purpose :
+//=======================================================================
+VisuGUI_Table3DPane::VisuGUI_Table3DPane (QWidget* parent)
+ : QVBox(parent), myViewWindow(VISU::GetActiveViewWindow<SVTK_ViewWindow>()), myPrs(NULL),
+ myInitFromPrs(false)
+{
+ layout()->setAlignment(Qt::AlignTop);
+ setSpacing(6);
+
+ // Scale, Presentation type, Nb Contours, Preview
+
+ QFrame* bottomFrame = new QFrame (this);
+ QGridLayout* bottomLayout = new QGridLayout (bottomFrame);
+ bottomLayout->setAlignment(Qt::AlignTop);
+ bottomLayout->setSpacing(6);
+ bottomLayout->setMargin(11);
+ // scale
+ QLabel* scaleLabel = new QLabel (tr("SCALE"), bottomFrame);
+ ScaleSpn = new QtxDblSpinBox (-1.e6, 1.e6, 0.1, bottomFrame);
+ // Presentation type
+ GBPrsType = new QHButtonGroup (tr("PRESENTATION_TYPE"), bottomFrame);
+ new QRadioButton (tr("SURFACE"), GBPrsType);
+ new QRadioButton (tr("CONTOUR"), GBPrsType);
+ // nb Contours
+ QLabel* nbContLabel = new QLabel (tr("NUMBER_CONTOURS"), bottomFrame);
+ NbContoursSpn = new QSpinBox (1, 999, 1, bottomFrame, "NbContoursSpn");
+
+ bottomLayout->addWidget(scaleLabel, 0, 0);
+ bottomLayout->addWidget(ScaleSpn, 0, 1);
+ bottomLayout->addMultiCellWidget(GBPrsType, 1, 1, 0, 1);
+ bottomLayout->addWidget(nbContLabel, 2, 0);
+ bottomLayout->addWidget(NbContoursSpn, 2, 1);
+
+ // signals and slots connections
+
+ connect(GBPrsType, SIGNAL(clicked(int)), this, SLOT(onPrsType(int)));
+}
+
+//=======================================================================
+//function : destructor
+//purpose :
+//=======================================================================
+VisuGUI_Table3DPane::~VisuGUI_Table3DPane()
+{}
+
+//=======================================================================
+//function : onPrsType
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DPane::onPrsType(int id)
+{
+ NbContoursSpn->setEnabled(id == CONTOUR_PRS_ID);
+}
+
+//=======================================================================
+//function : storeToPrsObject
+//purpose :
+//=======================================================================
+int VisuGUI_Table3DPane::storeToPrsObject(VISU::PointMap3d_i* thePrs)
+{
+
+ // scale
+ thePrs->SetScaleFactor(ScaleSpn->value());
+
+ // prs type
+ int id = GBPrsType->id (GBPrsType->selected());
+ thePrs->SetContourPrs(id == CONTOUR_PRS_ID);
+
+ // nb contours
+ thePrs->SetNbOfContours(NbContoursSpn->value());
+
+ return 1;
+}
+
+//=======================================================================
+//function : initFromPrsObject
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DPane::initFromPrsObject(VISU::PointMap3d_i* thePrs)
+{
+ myInitFromPrs = true;
+ myPrs = thePrs;
+
+ // scale
+ double aScale = thePrs->GetScaleFactor();
+ if (aScale<0)
+ aScale = 0;
+ ScaleSpn->setValue( aScale );
+
+ // prs type
+ int id = thePrs->GetIsContourPrs() ? CONTOUR_PRS_ID : SURFACE_PRS_ID;
+ GBPrsType->setButton(id);
+ onPrsType(id);
+
+ // nb contours
+ NbContoursSpn->setValue(thePrs->GetNbOfContours());
+}
+
+//=======================================================================
+//function : Table Scalar Bar
+//purpose :
+//=======================================================================
+
+VisuGUI_TableScalarBarPane::VisuGUI_TableScalarBarPane (QWidget * parent):
+ QVBox(parent), myBarPrs(NULL)
+{
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ QString propertyName;
+ propertyName = QString("scalar_bar_vertical_");
+ myVerX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
+ myVerY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
+ myVerW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
+ myVerH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
+ myVerTW = aResourceMgr->integerValue("VISU", propertyName + "title_width", 0);
+ myVerTH = aResourceMgr->integerValue("VISU", propertyName + "title_height",0);
+ myVerLW = aResourceMgr->integerValue("VISU", propertyName + "label_width", 0);
+ myVerLH = aResourceMgr->integerValue("VISU", propertyName + "label_height",0);
+ myVerBW = aResourceMgr->integerValue("VISU", propertyName + "bar_width", 0);
+ myVerBH = aResourceMgr->integerValue("VISU", propertyName + "bar_height",0);
+
+ propertyName = QString("scalar_bar_horizontal_");
+ myHorX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
+ myHorY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
+ myHorW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
+ myHorH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
+ myHorTW = aResourceMgr->integerValue("VISU", propertyName + "title_width", 0);
+ myHorTH = aResourceMgr->integerValue("VISU", propertyName + "title_height",0);
+ myHorLW = aResourceMgr->integerValue("VISU", propertyName + "label_width", 0);
+ myHorLH = aResourceMgr->integerValue("VISU", propertyName + "label_height",0);
+ myHorBW = aResourceMgr->integerValue("VISU", propertyName + "bar_width", 0);
+ myHorBH = aResourceMgr->integerValue("VISU", propertyName + "bar_height",0);
+
+ setSpacing(6);
+ setMargin(11);
+
+ // Range ============================================================
+ RangeGroup = new QButtonGroup (tr("SCALAR_RANGE_GRP"), this, "RangeGroup");
+ RangeGroup->setColumnLayout(0, Qt::Vertical );
+ RangeGroup->layout()->setSpacing( 0 );
+ RangeGroup->layout()->setMargin( 0 );
+ QGridLayout* RangeGroupLayout = new QGridLayout( RangeGroup->layout() );
+ RangeGroupLayout->setAlignment( Qt::AlignTop );
+ RangeGroupLayout->setSpacing( 6 );
+ RangeGroupLayout->setMargin( 11 );
+
+ CBLog = new QCheckBox (tr("LOGARITHMIC_SCALING"), RangeGroup);
+ CBLog->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ RBFrange = new QRadioButton (tr("FIELD_RANGE_BTN"), RangeGroup, "RBFrange");
+ RBIrange = new QRadioButton (tr("IMPOSED_RANGE_BTN"), RangeGroup, "RBIrange");
+ RBFrange->setChecked( true );
+
+ MinEdit = new QLineEdit( RangeGroup, "MinEdit" );
+ MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ MinEdit->setMinimumWidth( 70 );
+ MinEdit->setValidator( new QDoubleValidator(this) );
+ MinEdit->setText( "0.0" );
+ QLabel* MinLabel = new QLabel (tr("LBL_MIN"), RangeGroup, "MinLabel");
+ MinLabel->setBuddy(MinEdit);
+
+ MaxEdit = new QLineEdit( RangeGroup, "MaxEdit" );
+ MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ MaxEdit->setMinimumWidth( 70 );
+ MaxEdit->setValidator( new QDoubleValidator(this) );
+ MaxEdit->setText( "0.0" );
+ QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), RangeGroup, "MaxLabel");
+ MaxLabel->setBuddy(MaxEdit);
+
+ RangeGroupLayout->addMultiCellWidget( CBLog, 1, 1, 0, 3);
+ RangeGroupLayout->addMultiCellWidget( RBFrange, 2, 2, 0, 1);
+ RangeGroupLayout->addMultiCellWidget( RBIrange, 2, 2, 2, 3);
+ RangeGroupLayout->addWidget( MinLabel, 3, 0 );
+ RangeGroupLayout->addWidget( MinEdit, 3, 1 );
+ RangeGroupLayout->addWidget( MaxLabel, 3, 2 );
+ RangeGroupLayout->addWidget( MaxEdit, 3, 3 );
+
+ //TopLayout->addWidget( RangeGroup );
+
+ // Colors and Labels ========================================================
+ QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this, "ColLabGroup");
+ ColLabGroup->setColumnLayout(0, Qt::Vertical );
+ ColLabGroup->layout()->setSpacing( 0 );
+ ColLabGroup->layout()->setMargin( 0 );
+ QGridLayout* ColLabGroupLayout = new QGridLayout( ColLabGroup->layout() );
+ ColLabGroupLayout->setAlignment( Qt::AlignTop );
+ ColLabGroupLayout->setSpacing( 6 );
+ ColLabGroupLayout->setMargin( 11 );
+
+ QLabel* ColorLabel = new QLabel (tr("LBL_NB_COLORS"), ColLabGroup, "ColorLabel");
+ ColorSpin = new QSpinBox( 2, 256, 1, ColLabGroup );
+ ColorSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ ColorSpin->setMinimumWidth( 70 );
+ ColorSpin->setValue( 64 );
+
+ QLabel* LabelLabel = new QLabel (tr("LBL_NB_LABELS"), ColLabGroup, "LabelLabel");
+ LabelSpin = new QSpinBox( 2, 65, 1, ColLabGroup );
+ LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ LabelSpin->setMinimumWidth( 70 );
+ LabelSpin->setValue( 5 );
+
+ ColLabGroupLayout->addWidget( ColorLabel, 0, 0);
+ ColLabGroupLayout->addWidget( ColorSpin, 0, 1);
+ ColLabGroupLayout->addWidget( LabelLabel, 0, 2);
+ ColLabGroupLayout->addWidget( LabelSpin, 0, 3);
+
+ //TopLayout->addWidget( ColLabGroup );
+
+ // Orientation ==========================================================
+ QButtonGroup* OrientGroup = new QButtonGroup (tr("ORIENTATION_GRP"), this, "OrientGroup");
+ OrientGroup->setColumnLayout(0, Qt::Vertical );
+ OrientGroup->layout()->setSpacing( 0 );
+ OrientGroup->layout()->setMargin( 0 );
+ QGridLayout* OrientGroupLayout = new QGridLayout( OrientGroup->layout() );
+ OrientGroupLayout->setAlignment( Qt::AlignTop );
+ OrientGroupLayout->setSpacing( 6 );
+ OrientGroupLayout->setMargin( 11 );
+
+ RBvert = new QRadioButton (tr("VERTICAL_BTN"), OrientGroup, "RBvert");
+ RBvert->setChecked( true );
+ RBhori = new QRadioButton (tr("HORIZONTAL_BTN"), OrientGroup, "RBhori");
+ OrientGroupLayout->addWidget( RBvert, 0, 0 );
+ OrientGroupLayout->addWidget( RBhori, 0, 1 );
+
+ // TopLayout->addWidget( OrientGroup );
+
+ // Origin ===============================================================
+ QGroupBox* OriginGroup = new QGroupBox (tr("ORIGIN_GRP"), this, "OriginGroup");
+ OriginGroup->setColumnLayout(0, Qt::Vertical );
+ OriginGroup->layout()->setSpacing( 0 );
+ OriginGroup->layout()->setMargin( 0 );
+ QGridLayout* OriginGroupLayout = new QGridLayout( OriginGroup->layout() );
+ OriginGroupLayout->setAlignment( Qt::AlignTop );
+ OriginGroupLayout->setSpacing( 6 );
+ OriginGroupLayout->setMargin( 11 );
+
+ QLabel* XLabel = new QLabel (tr("LBL_X"), OriginGroup, "XLabel");
+ XSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
+ XSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ XSpin->setMinimumWidth( 70 );
+ XSpin->setValue( 0.01 );
+
+ QLabel* YLabel = new QLabel (tr("LBL_Y"), OriginGroup, "YLabel");
+ YSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
+ YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ YSpin->setMinimumWidth( 70 );
+ YSpin->setValue( 0.01 );
+
+ OriginGroupLayout->addWidget( XLabel, 0, 0);
+ OriginGroupLayout->addWidget( XSpin, 0, 1);
+ OriginGroupLayout->addWidget( YLabel, 0, 2);
+ OriginGroupLayout->addWidget( YSpin, 0, 3);
+
+ //TopLayout->addWidget( OriginGroup );
+
+ // Dimensions =========================================================
+ QGroupBox* DimGroup = new QGroupBox (tr("DIMENSIONS_GRP"), this, "DimGroup");
+ DimGroup->setColumnLayout(0, Qt::Vertical );
+ DimGroup->layout()->setSpacing( 0 );
+ DimGroup->layout()->setMargin( 0 );
+ QGridLayout* DimGroupLayout = new QGridLayout( DimGroup->layout() );
+ DimGroupLayout->setAlignment( Qt::AlignTop );
+ DimGroupLayout->setSpacing( 6 );
+ DimGroupLayout->setMargin( 11 );
+
+ QLabel* WidthLabel = new QLabel (tr("LBL_WIDTH"), DimGroup, "WidthLabel");
+ WidthSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
+ WidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ WidthSpin->setMinimumWidth( 70 );
+ WidthSpin->setValue( 0.1 );
+
+ QLabel* HeightLabel = new QLabel (tr("LBL_HEIGHT"), DimGroup, "HeightLabel");
+ HeightSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
+ HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ HeightSpin->setMinimumWidth( 70 );
+ HeightSpin->setValue( 0.8 );
+
+ DimGroupLayout->addWidget( WidthLabel, 0, 0);
+ DimGroupLayout->addWidget( WidthSpin, 0, 1);
+ DimGroupLayout->addWidget( HeightLabel, 0, 2);
+ DimGroupLayout->addWidget( HeightSpin, 0, 3);
+
+ //TopLayout->addWidget( DimGroup );
+
+ QHBox* aSaveBox = new QHBox(this);
+
+ myTextBtn = new QPushButton("Text properties...", aSaveBox);
+ myBarBtn = new QPushButton("Bar properties...", aSaveBox);
+ myTextDlg = new VisuGUI_TextPrefDlg(this);
+ myTextDlg->setTitleVisible(true);
+ myBarDlg = new VisuGUI_BarPrefDlg(this);
+
+
+ if(RBvert->isChecked()) {
+ myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ } else {
+ myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ }
+
+ myBarDlg->setLabelsFormat(aResourceMgr->stringValue("VISU", propertyName + "label_format", "%-#6.3g"));
+ myBarDlg->setUnitsVisible(aResourceMgr->booleanValue("VISU", propertyName + "display_units", true));
+
+ // signals and slots connections ===========================================
+ connect( RangeGroup, SIGNAL( clicked( int ) ), this, SLOT( changeRange( int ) ) );
+ connect( OrientGroup, SIGNAL( clicked( int ) ), this, SLOT( changeDefaults( int ) ) );
+ connect( XSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
+ connect( YSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
+ connect( myTextBtn, SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
+ connect( myBarBtn, SIGNAL( clicked() ), this, SLOT( onBarPref() ) );
+ changeDefaults( 0 );
+ myIsStoreTextProp = true;
+ myBusy = false;
+}
+
+//----------------------------------------------------------------------------
+
+void VisuGUI_TableScalarBarPane::onBarPref()
+{
+ if(RBvert->isChecked())
+ myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ else
+ myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ if(myBarDlg->exec()) {
+ if(RBvert->isChecked())
+ myBarDlg->getRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ else
+ myBarDlg->getRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ }
+}
+
+//----------------------------------------------------------------------------
+/**
+ * Initialise dialog box from presentation object
+ */
+void VisuGUI_TableScalarBarPane::initFromPrsObject(VISU::PointMap3d_i* thePrs)
+{
+ myBarPrs = dynamic_cast<VISU::PointMap3d_i*>(thePrs);
+
+ if( !myBarPrs )
+ return;
+
+ switch(myBarPrs->GetScaling()){
+ case VISU::LOGARITHMIC :
+ CBLog->setChecked( true );
+ break;
+ default:
+ CBLog->setChecked( false );
+ }
+
+ setRange( myBarPrs->GetMin(), myBarPrs->GetMax(), myBarPrs->IsRangeFixed() );
+
+ setScalarBarData( myBarPrs->GetNbColors(), myBarPrs->GetLabels() );
+
+ // "Title"
+ CORBA::String_var aTitle = myBarPrs->GetTitle();
+ myTextDlg->setTitleText(aTitle.in());
+ myTitle = aTitle.in();
+
+ vtkFloatingPointType R, G, B;
+ myBarPrs->GetTitleColor(R, G, B);
+
+ setPosAndSize( myBarPrs->GetPosX(),
+ myBarPrs->GetPosY(),
+ myBarPrs->GetWidth(),
+ myBarPrs->GetHeight(),
+ myBarPrs->GetBarOrientation());
+
+ myVerTW = myBarPrs->GetTitleWidth();
+ myVerTH = myBarPrs->GetTitleHeight();
+ myVerLW = myBarPrs->GetLabelWidth();
+ myVerLH = myBarPrs->GetLabelHeight();
+ myVerBW = myBarPrs->GetBarWidth();
+ myVerBH = myBarPrs->GetBarHeight();
+ myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+
+ myBarDlg->setLabelsFormat(myBarPrs->GetLabelsFormat());
+ myBarDlg->setUnitsVisible(myBarPrs->IsUnitsVisible());
+
+ myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
+ myBarPrs->GetTitFontType(),
+ myBarPrs->IsBoldTitle(),
+ myBarPrs->IsItalicTitle(),
+ myBarPrs->IsShadowTitle());
+
+ // "Labels"
+ myBarPrs->GetLabelColor(R, G, B);
+
+ myTextDlg->myLabelFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
+ myBarPrs->GetLblFontType(),
+ myBarPrs->IsBoldLabel(),
+ myBarPrs->IsItalicLabel(),
+ myBarPrs->IsShadowLabel());
+}
+
+//----------------------------------------------------------------------------
+/**
+ * Store values to presentation object
+ */
+int VisuGUI_TableScalarBarPane::storeToPrsObject(VISU::PointMap3d_i* thePrs) {
+ if( !myBarPrs )
+ return 0;
+
+ myBarPrs->SetPosition(XSpin->value(), YSpin->value());
+ myBarPrs->SetSize(WidthSpin->value(), HeightSpin->value());
+
+ myBarPrs->SetRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+
+ myBarPrs->SetLabelsFormat(myBarDlg->getLabelsFormat());
+ myBarPrs->SetUnitsVisible(myBarDlg->isUnitsVisible());
+
+ myBarPrs->SetBarOrientation((RBvert->isChecked())? VISU::ColoredPrs3dBase::VERTICAL : VISU::ColoredPrs3dBase::HORIZONTAL);
+ if(CBLog->isChecked())
+ myBarPrs->SetScaling(VISU::LOGARITHMIC);
+ else
+ myBarPrs->SetScaling(VISU::LINEAR);
+
+ if (RBFrange->isChecked()) {
+ myBarPrs->SetSourceRange();
+ } else {
+ myBarPrs->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
+ }
+ myBarPrs->SetNbColors(ColorSpin->value());
+ myBarPrs->SetLabels(LabelSpin->value());
+
+ if (myIsStoreTextProp) {
+ // "Title"
+ myBarPrs->SetTitle(myTextDlg->getTitleText().latin1());
+
+ QColor aTitColor (255, 255, 255);
+ int aTitleFontFamily = VTK_ARIAL;
+ bool isTitleBold = false;
+ bool isTitleItalic = false;
+ bool isTitleShadow = false;
+
+ myTextDlg->myTitleFont->GetData(aTitColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow);
+
+ myBarPrs->SetBoldTitle(isTitleBold);
+ myBarPrs->SetItalicTitle(isTitleItalic);
+ myBarPrs->SetShadowTitle(isTitleShadow);
+ myBarPrs->SetTitFontType(aTitleFontFamily);
+ myBarPrs->SetTitleColor(aTitColor.red()/255.,
+ aTitColor.green()/255.,
+ aTitColor.blue()/255.);
+
+ // "Label"
+ QColor aLblColor (255, 255, 255);
+ int aLabelFontFamily = VTK_ARIAL;
+ bool isLabelBold = false;
+ bool isLabelItalic = false;
+ bool isLabelShadow = false;
+
+ myTextDlg->myLabelFont->GetData(aLblColor, aLabelFontFamily, isLabelBold, isLabelItalic, isLabelShadow);
+
+ myBarPrs->SetBoldLabel(isLabelBold);
+ myBarPrs->SetItalicLabel(isLabelItalic);
+ myBarPrs->SetShadowLabel(isLabelShadow);
+ myBarPrs->SetLblFontType(aLabelFontFamily);
+ myBarPrs->SetLabelColor(aLblColor.red()/255.,
+ aLblColor.green()/255.,
+ aLblColor.blue()/255.);
+ // myIsStoreTextProp = false;
+ }
+ return 1;
+}
+
+//----------------------------------------------------------------------------
+/*!
+ Sets default values and range mode
+*/
+void VisuGUI_TableScalarBarPane::setRange( double imin, double imax, bool sbRange )
+{
+ MinEdit->setText( QString::number( imin ) );
+ MaxEdit->setText( QString::number( imax ) );
+
+ if( sbRange )
+ RBIrange->setChecked( true );
+ else
+ RBFrange->setChecked( true );
+
+ changeRange( sbRange );
+}
+
+//----------------------------------------------------------------------------
+/*!
+ Called when Range mode is changed
+*/
+void VisuGUI_TableScalarBarPane::changeRange( int )
+{
+ if ( RBFrange->isChecked() ) {
+ myBarPrs->SetSourceRange();
+ MinEdit->setEnabled( false );
+ MaxEdit->setEnabled( false );
+ } else {
+ myBarPrs->SetRange( myBarPrs->GetMin(), myBarPrs->GetMax() );
+ myBarPrs->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
+ MinEdit->setEnabled( true );
+ MaxEdit->setEnabled( true );
+ }
+
+ MinEdit->setText( QString::number( myBarPrs->GetMin() ) );
+ MaxEdit->setText( QString::number( myBarPrs->GetMax() ) );
+}
+
+//----------------------------------------------------------------------------
+/*!
+ Called when X,Y position is changed
+*/
+void VisuGUI_TableScalarBarPane::XYChanged( double )
+{
+ QtxDblSpinBox* snd = (QtxDblSpinBox*)sender();
+ if ( snd == XSpin ) {
+ WidthSpin->setMaxValue( 1.0 - XSpin->value() );
+ }
+ if ( snd == YSpin ) {
+ HeightSpin->setMaxValue( 1.0 - YSpin->value() );
+ }
+}
+
+//----------------------------------------------------------------------------
+/*!
+ Sets size and position
+*/
+void VisuGUI_TableScalarBarPane::setPosAndSize( double x, double y, double w, double h, bool vert )
+{
+ if ( vert ) {
+ myVerX = x;
+ myVerY = y;
+ myVerW = w;
+ myVerH = h;
+ RBvert->setChecked( true );
+ }
+ else {
+ myHorX = x;
+ myHorY = y;
+ myHorW = w;
+ myHorH = h;
+ RBhori->setChecked( true );
+ }
+ changeDefaults( 0 );
+}
+
+//----------------------------------------------------------------------------
+/*!
+ Sets colors and labels number
+*/
+void VisuGUI_TableScalarBarPane::setScalarBarData( int colors, int labels )
+{
+ ColorSpin->setValue( colors );
+ LabelSpin->setValue( labels );
+}
+
+//----------------------------------------------------------------------------
+void VisuGUI_TableScalarBarPane::onTextPref()
+{
+ myTextDlg->storeBeginValues();
+ myIsStoreTextProp = myTextDlg->exec() || myIsStoreTextProp;
+}
+
+//----------------------------------------------------------------------------
+VisuGUI_TableScalarBarPane::~VisuGUI_TableScalarBarPane()
+{
+}
+
+//----------------------------------------------------------------------------
+/*!
+ Called when orientation is changed
+*/
+void VisuGUI_TableScalarBarPane::changeDefaults( int )
+{
+ if ( RBvert->isChecked() ) {
+ XSpin->setValue( myVerX );
+ YSpin->setValue( myVerY );
+ WidthSpin->setValue( myVerW );
+ HeightSpin->setValue( myVerH );
+ }
+ else {
+ XSpin->setValue( myHorX );
+ YSpin->setValue( myHorY );
+ WidthSpin->setValue( myHorW );
+ HeightSpin->setValue( myHorH );
+ }
+}
+
+
+//=======================================================================
+//function : Constructor
+//purpose :
+//=======================================================================
+VisuGUI_Table3DDlg::VisuGUI_Table3DDlg ( SalomeApp_Module* theModule )
+ : QDialog ( VISU::GetDesktop(theModule), 0, false )
+{
+ setCaption(tr("Point Map 3D Definition"));
+ setSizeGripEnabled(TRUE);
+
+ QVBoxLayout* TopLayout = new QVBoxLayout(this);
+ TopLayout->setSpacing(6);
+ TopLayout->setMargin(11);
+
+ myTabBox = new QTabWidget (this);
+ myIsoPane = new VisuGUI_Table3DPane (this);
+ myScalarBarPane = new VisuGUI_TableScalarBarPane (this);
+
+ myIsoPane->setMargin(11);
+ myScalarBarPane->setMargin(11);
+ myTabBox->addTab(myIsoPane, tr("DLG_PREF_TITLE"));
+ myTabBox->addTab(myScalarBarPane, tr("DLG_PROP_TITLE"));
+
+ TopLayout->addWidget(myTabBox);
+
+ QGroupBox* GroupButtons = new QGroupBox (this, "GroupButtons");
+ GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+ GroupButtons->setColumnLayout(0, Qt::Vertical);
+ GroupButtons->layout()->setSpacing(0);
+ GroupButtons->layout()->setMargin(0);
+ QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons->layout());
+ GroupButtonsLayout->setAlignment(Qt::AlignTop);
+ GroupButtonsLayout->setSpacing(6);
+ GroupButtonsLayout->setMargin(11);
+
+ QPushButton* buttonOk = new QPushButton (tr("&OK"), GroupButtons, "buttonOk");
+ buttonOk->setAutoDefault(TRUE);
+ buttonOk->setDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+
+ QPushButton* buttonApply = new QPushButton (tr("&Apply"), GroupButtons, "buttonApply");
+ buttonApply->setAutoDefault(TRUE);
+ buttonApply->setDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+ GroupButtonsLayout->addItem(new QSpacerItem (5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);
+ QPushButton* buttonCancel = new QPushButton (tr("&Cancel") , GroupButtons, "buttonCancel");
+ buttonCancel->setAutoDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+ QPushButton* buttonHelp = new QPushButton (tr("&Help") , GroupButtons, "buttonHelp");
+ buttonHelp->setAutoDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonHelp, 0, 4);
+
+ TopLayout->addWidget(GroupButtons);
+
+ // signals and slots connections
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp()));
+ connect(buttonApply, SIGNAL(clicked()), this, SLOT(onApply()));
+}
+
+VisuGUI_Table3DDlg::~VisuGUI_Table3DDlg()
+{}
+
+//=======================================================================
+//function : Check
+//purpose : Called when <OK> button is clicked, validates data and closes dialog
+//=======================================================================
+bool VisuGUI_TableScalarBarPane::check()
+{
+ double minVal = MinEdit->text().toDouble();
+ double maxVal = MaxEdit->text().toDouble();
+ if ( RBIrange->isChecked() ) {
+ if (minVal >= maxVal) {
+ SUIT_MessageBox::warn1( this,tr("WRN_VISU"),
+ tr("MSG_MINMAX_VALUES"),
+ tr("BUT_OK"));
+ return false;
+ }
+ }
+
+ // check if logarithmic mode is on and check imposed range to not contain negative values
+ if ( CBLog->isChecked() ) {
+ if ( minVal <= 0.0 ) {
+ if ( RBIrange->isChecked() ) {
+ SUIT_MessageBox::warn1( this,
+ tr("WRN_VISU"),
+ tr("WRN_LOGARITHMIC_RANGE"),
+ tr("BUT_OK"));
+ } else {
+ if ( minVal == 0)
+ SUIT_MessageBox::warn1( this,
+ tr("WRN_VISU"),
+ tr("WRN_LOGARITHMIC_RANGE"),
+ tr("BUT_OK"));
+ else
+ SUIT_MessageBox::warn1( this,
+ tr("WRN_VISU"),
+ tr("WRN_LOGARITHMIC_FIELD_RANGE"),
+ tr("BUT_OK"));
+ RBIrange->setChecked(true);
+ changeRange(1);
+ }
+ return false;
+ }
+ }
+ return true;
+}
+
+//=======================================================================
+//function : accept
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DDlg::accept()
+{
+ if (myScalarBarPane->check())
+ QDialog::accept();
+}
+
+//=======================================================================
+//function : reject
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DDlg::reject()
+{
+ QDialog::reject();
+}
+
+//=======================================================================
+//function : onApply
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DDlg::onApply()
+{
+ if (myScalarBarPane->check()) {
+ storeToPrsObject( myPrsCopy );
+ myPrsCopy->UpdateActors();
+ }
+}
+
+//=======================================================================
+//function : onHelp
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DDlg::onHelp()
+{
+ QString aHelpFileName = "table_3d_page.html";
+ LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+ if (app) {
+ VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
+ app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
+ }
+ else {
+ QString platform;
+#ifdef WIN32
+ platform = "winapplication";
+#else
+ platform = "application";
+#endif
+ SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
+ QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
+ QObject::tr("BUT_OK"));
+ }
+
+}
+
+//=======================================================================
+//function : storeToPrsObject
+//purpose :
+//=======================================================================
+int VisuGUI_Table3DDlg::storeToPrsObject (VISU::PointMap3d_i* thePrs)
+{
+ int anIsOk = myIsoPane->storeToPrsObject( thePrs );
+ anIsOk &= myScalarBarPane->storeToPrsObject( thePrs );
+
+ return anIsOk;
+}
+
+//=======================================================================
+//function : initFromPrsObject
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DDlg::initFromPrsObject (VISU::PointMap3d_i* thePrs)
+{
+ myPrsCopy = thePrs;
+ myIsoPane->initFromPrsObject( thePrs );
+ myScalarBarPane->initFromPrsObject( thePrs );
+}
+
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// 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 : VisuGUI_Plot3DDlg.h
+// Author : Laurent CORNABE & Hubert ROLLAND
+// Module : VISU
+// $Header$
+
+#ifndef VISUGUI_TABLE3D_H
+#define VISUGUI_TABLE3D_H
+
+#include "VisuGUI_Prs3dDlg.h"
+
+#include <qhbuttongroup.h>
+#include <qtabwidget.h>
+#include <qcombobox.h>
+#include <qlineedit.h>
+
+class SalomeApp_Module;
+
+namespace VISU
+{
+ class PointMap3d_i;
+};
+
+class VISU_Plot3DPL;
+class SVTK_ViewWindow;
+class SALOME_Actor;
+class QtxDblSpinBox;
+
+class VisuGUI_Table3DPane : public QVBox
+{
+ Q_OBJECT
+
+ public:
+ VisuGUI_Table3DPane(QWidget* parent);
+ ~VisuGUI_Table3DPane();
+
+ void initFromPrsObject (VISU::PointMap3d_i* thePrs);
+ int storeToPrsObject (VISU::PointMap3d_i* thePrs);
+
+ VISU::PointMap3d_i* GetPrs() { return myPrs; }
+
+ private:
+ bool myInitFromPrs;
+
+ SVTK_ViewWindow* myViewWindow;
+ VISU::PointMap3d_i* myPrs;
+
+ QtxDblSpinBox * ScaleSpn;
+ QHButtonGroup * GBPrsType;
+ QSpinBox * NbContoursSpn;
+
+ private slots:
+
+ void onPrsType( int );
+};
+
+class VisuGUI_TableScalarBarPane : public QVBox
+{
+ Q_OBJECT;
+
+ public:
+ VisuGUI_TableScalarBarPane(QWidget* parent);
+ ~VisuGUI_TableScalarBarPane();
+
+ void setRange( double imin, double imax, bool sbRange );
+ void setDefaultRange(double imin, double imax);
+ int getOrientation();
+ void setPosAndSize( double x, double y, double w, double h, bool vert );
+ void setScalarBarData( int colors, int labels );
+ bool isIRange();
+ double getMin();
+ double getMax();
+ double getX();
+ double getY();
+ double getWidth();
+ double getHeight();
+ int getNbColors();
+ int getNbLabels();
+ bool isLogarithmic();
+ void setLogarithmic( bool on );
+ // bool isToSave() {return CBSave ? CBSave->isChecked() : false;}
+
+ void storeToResources();
+
+ void initFromPrsObject(VISU::PointMap3d_i* thePrs);
+ int storeToPrsObject(VISU::PointMap3d_i* thePrs);
+
+ bool check();
+
+ protected:
+ QButtonGroup* RangeGroup;
+ QRadioButton* RBFrange;
+ QRadioButton* RBIrange;
+ QLineEdit* MinEdit;
+ QLineEdit* MaxEdit;
+
+ QRadioButton* RBhori;
+ QRadioButton* RBvert;
+
+ QtxDblSpinBox* XSpin;
+ QtxDblSpinBox* YSpin;
+
+ QtxDblSpinBox* WidthSpin;
+ QtxDblSpinBox* HeightSpin;
+
+ QSpinBox* ColorSpin;
+ QSpinBox* LabelSpin;
+
+ QCheckBox* CBSave;
+ QCheckBox* CBLog;
+ QComboBox* myModeCombo;
+ QPushButton* myTextBtn;
+ QPushButton* myBarBtn;
+ VisuGUI_TextPrefDlg* myTextDlg;
+ VisuGUI_BarPrefDlg* myBarDlg;
+
+ double myHorX, myHorY, myHorW, myHorH;
+ double myVerX, myVerY, myVerW, myVerH;
+ int myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH;
+ int myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH;
+ bool myIsStoreTextProp;
+
+ private slots:
+ void changeDefaults( int );
+ void changeRange( int );
+ void XYChanged( double );
+ void changeScalarMode( int );
+ void onTextPref();
+ void onBarPref();
+
+ private:
+ std::string myTitle;
+ VISU::PointMap3d_i* myBarPrs;
+
+ bool myBusy;
+};
+
+///////////////////////////////////////////////////////
+
+class VisuGUI_Table3DDlg : public QDialog
+{
+ Q_OBJECT
+
+ public:
+ VisuGUI_Table3DDlg (SalomeApp_Module* theModule);
+ ~VisuGUI_Table3DDlg();
+
+ virtual void initFromPrsObject( VISU::PointMap3d_i* thePrs );
+ virtual int storeToPrsObject(VISU::PointMap3d_i* thePrs);
+
+ protected slots:
+ void accept();
+ void reject();
+ void onHelp();
+ void onApply();
+
+ private:
+ QTabWidget* myTabBox;
+ VisuGUI_Table3DPane* myIsoPane;
+ VisuGUI_TableScalarBarPane* myScalarBarPane;
+
+ SALOME::GenericObjPtr<VISU::PointMap3d_i> myPrsCopy;
+};
+
+#endif // VISUGUI_TABLE3D_H
--- /dev/null
+// Copyright (C) 2008 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_Deformation_i.cc
+// Author :
+// Module : VISU
+
+#include "VISU_Deformation_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_Prs3dUtils.hh"
+
+#include "VISU_DeformationPL.hxx"
+#include "VISU_Convertor.hxx"
+#include "VISU_DeformationPL.hxx"
+#include "VISUConfig.hh"
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//---------------------------------------------------------------
+VISU::Deformation_i::Deformation_i(VISU::ColoredPrs3d_i *thePrs3d):
+ myColoredPrs3d(thePrs3d)
+{
+ if(MYDEBUG) MESSAGE("Deformation_i::Deformation_i()");
+}
+
+//---------------------------------------------------------------
+VISU::Deformation_i::~Deformation_i()
+{
+ if(MYDEBUG) MESSAGE("Deformation_i::~Deformation_i()");
+}
+
+//---------------------------------------------------------------
+void VISU::Deformation_i::SetScale(CORBA::Double theScale)
+{
+ if(MYDEBUG) MESSAGE("Deformation_i::SetScale()");
+
+ VISU::TSetModified aModified(GetColoredPrs3d());
+
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformationPL, vtkFloatingPointType>
+ (GetSpecificDeformedPL(), &VISU_DeformationPL::SetScale, theScale));
+}
+
+//---------------------------------------------------------------
+void VISU::Deformation_i::InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine){
+
+ if(MYDEBUG) MESSAGE("Deformation_i::InitDeformedPipeLine()");
+ myDeformationPL = theDeformedPipeLine;
+}
+
+//---------------------------------------------------------------
+CORBA::Double
+VISU::Deformation_i
+::GetScale()
+{
+ if(MYDEBUG) MESSAGE("Deformation_i::GetScale()");
+ return GetSpecificDeformedPL()->GetScale();
+}
+
+//---------------------------------------------------------------
+VISU::Entity VISU::Deformation_i::GetVectorialFieldEntity(){
+ return myVectorialEntity;
+}
+
+//---------------------------------------------------------------
+char* VISU::Deformation_i::GetVectorialFieldName(){
+ return CORBA::string_dup(myVectorialFieldName.c_str());
+}
+
+//---------------------------------------------------------------
+void VISU::Deformation_i::
+DeformationToStream(std::ostringstream& theStr)
+{
+ Storable::DataToStream(theStr,"myScaleFactor", GetScale());
+ Storable::DataToStream(theStr,"myVectorialField", GetVectorialFieldName());
+ Storable::DataToStream(theStr,"myVectorialEntiry", GetVectorialFieldEntity());
+
+}
+
+//---------------------------------------------------------------
+void
+VISU::Deformation_i::RestoreDeformation(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap)
+{
+ SetScale(VISU::Storable::FindValue(theMap,"myScaleFactor").toDouble());
+ VISU::Entity anEntity = VISU::Entity(VISU::Storable::FindValue(theMap, "myVectorialEntiry").toInt());
+
+ SetVectorialField(anEntity,
+ VISU::Storable::FindValue(theMap, "myVectorialField"));
+}
+
+//---------------------------------------------------------------
+void
+VISU::Deformation_i::SameAsDeformation(const Deformation_i *aDeformedPrs){
+ if(const Deformation_i* aPrs = dynamic_cast<const Deformation_i*>(aDeformedPrs)) {
+ Deformation_i* anOrigin = const_cast<Deformation_i*>(aPrs);
+
+ CORBA::String_var aVectorialFieldName = anOrigin->GetVectorialFieldName();
+ VISU::Entity anEntity = anOrigin->GetVectorialFieldEntity();
+ this->SetVectorialField(anEntity,
+ aVectorialFieldName);
+ this->SetScale(anOrigin->GetScale());
+ }
+}
+
+void VISU::Deformation_i::SetVectorialField(Entity theEntity, const char* theFieldName){
+ if(MYDEBUG) MESSAGE("CutPlanes_i::SetVectorialField()");
+
+ bool anIsModified = false;
+ if(!anIsModified)
+ anIsModified |= GetVectorialFieldEntity() != theEntity;
+
+ if(!anIsModified)
+ anIsModified |= GetVectorialFieldName() != theFieldName;
+
+ if(!anIsModified)
+ return;
+
+ ColoredPrs3d_i *aColoredPrs = GetColoredPrs3d();
+ int aTimeStampNumber = aColoredPrs->GetTimeStampNumber();
+
+ VISU::TEntity aEntity = VISU::TEntity(theEntity);
+
+ VISU::Result_i::PInput anInput = aColoredPrs->GetCResult()->GetInput(aColoredPrs->GetCMeshName(),
+ theEntity,
+ theFieldName,
+ aTimeStampNumber);
+
+ PField aVectorialField = anInput->GetField(aColoredPrs->GetCMeshName(), aEntity, theFieldName);
+
+ VISU::PUnstructuredGridIDMapper anIDMapper =
+ anInput->GetTimeStampOnMesh(aColoredPrs->GetCMeshName(),
+ aEntity,
+ theFieldName,
+ aTimeStampNumber);
+ if(GetSpecificDeformedPL() && anIDMapper) {
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformationPL, VISU::PUnstructuredGridIDMapper>
+ (GetSpecificDeformedPL(), &VISU_DeformationPL::SetVectorialField, anIDMapper));
+
+ VISU::TSetModified aModified(GetColoredPrs3d());
+
+ myVectorialEntity = theEntity;
+ myVectorialFieldName = theFieldName;
+ myVectorialField = anIDMapper;
+ }
+};
--- /dev/null
+// Copyright (C) 2008 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_Deformation_i.hxx
+// Author :
+// Module : VISU
+
+#ifndef VISU_Deformation_i_HeaderFile
+#define VISU_Deformation_i_HeaderFile
+
+#include "VISU_I.hxx"
+#include "VISU_ColoredPrs3d_i.hh"
+#include "VISU_DeformationPL.hxx"
+
+
+
+namespace VISU{
+
+ class VISU_I_EXPORT Deformation_i : public virtual POA_VISU::Deformation
+ {
+ Deformation_i(const Deformation_i&);
+ public:
+ typedef VISU::Deformation TInterface;
+
+ Deformation_i(VISU::ColoredPrs3d_i* theColoredPrs3d);
+ virtual ~Deformation_i();
+
+ virtual
+ void
+ SetScale(CORBA::Double theScale);
+
+ virtual
+ CORBA::Double
+ GetScale();
+
+ virtual
+ void
+ DeformationToStream(std::ostringstream& theStr);
+
+ virtual
+ void
+ RestoreDeformation(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap);
+
+ virtual
+ void
+ SameAsDeformation(const Deformation_i *aDeformedPrs);
+
+ virtual
+ VISU::Entity
+ GetVectorialFieldEntity();
+
+ virtual
+ char*
+ GetVectorialFieldName();
+
+ virtual void SetVectorialField(Entity theEntity, const char* theFieldName);
+
+ protected:
+ virtual
+ void
+ InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine);
+
+ VISU_DeformationPL*
+ GetSpecificDeformedPL() const
+ {
+ return myDeformationPL;
+ }
+
+ ColoredPrs3d_i* GetColoredPrs3d(){
+ return myColoredPrs3d;
+ }
+
+
+ private:
+ VISU_DeformationPL *myDeformationPL;
+
+ PField myVectorialField;
+ VISU::Entity myVectorialEntity;
+ std::string myVectorialFieldName;
+ ColoredPrs3d_i *myColoredPrs3d;
+
+ };
+}
+
+#endif
--- /dev/null
+// 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_DeformedShapeAndScalarMap_i.cc
+// Author : Eugeny Nikolaev
+// Module : VISU
+
+#include "VISU_DeformedShapeAndScalarMap_i.hh"
+#include "VISU_Prs3dUtils.hh"
+#include "VISU_Result_i.hh"
+
+#include "VISU_ScalarMapAct.h"
+#include "VISU_DeformedShapeAndScalarMapPL.hxx"
+#include "VISU_Convertor.hxx"
+
+#include "SUIT_ResourceMgr.h"
+#include "SALOME_Event.hxx"
+
+#include <vtkUnstructuredGrid.h>
+#include <vtkProperty.h>
+#include <vtkMapper.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+static int INCMEMORY = 4+12;
+
+
+//---------------------------------------------------------------
+size_t
+VISU::DeformedShapeAndScalarMap_i
+::IsPossible(Result_i* theResult,
+ const std::string& theMeshName,
+ VISU::Entity theEntity,
+ const std::string& theFieldName,
+ CORBA::Long theTimeStampNumber,
+ bool theIsMemoryCheck)
+{
+ size_t aResult = 0;
+ try{
+ aResult = TSuperClass::IsPossible(theResult,
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theTimeStampNumber,
+ false);
+ if(theIsMemoryCheck && aResult){
+ VISU::Result_i::PInput anInput = theResult->GetInput(theMeshName,
+ theEntity,
+ theFieldName,
+ theTimeStampNumber);
+ VISU::PField aField = anInput->GetField(theMeshName,
+ (VISU::TEntity)theEntity,
+ theFieldName);
+ if(aField->myNbComp <= 1)
+ return 0;
+
+ bool anIsEstimated = true;
+ size_t aSize = anInput->GetTimeStampOnMeshSize(theMeshName,
+ (VISU::TEntity)theEntity,
+ theFieldName,
+ theTimeStampNumber,
+ anIsEstimated);
+ if(anIsEstimated)
+ aSize *= INCMEMORY;
+ aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+ if(MYDEBUG)
+ MESSAGE("DeformedShapeAndScalarMap_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+ }
+ }catch(std::exception& exc){
+ INFOS("Follow exception was occured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was occured!");
+ }
+ return aResult;
+}
+
+//---------------------------------------------------------------
+int VISU::DeformedShapeAndScalarMap_i::myNbPresent = 0;
+
+//---------------------------------------------------------------
+QString
+VISU::DeformedShapeAndScalarMap_i
+::GenerateName()
+{
+ return VISU::GenerateName("ScalarDef.Shape",myNbPresent++);
+}
+
+//---------------------------------------------------------------
+const string VISU::DeformedShapeAndScalarMap_i::myComment = "SCALARMAPONDEFORMEDSHAPE"; // It is obsolete. Use "DEFORMEDSHAPEANDSCALARMAP" instead.
+
+//---------------------------------------------------------------
+const char*
+VISU::DeformedShapeAndScalarMap_i
+::GetComment() const
+{
+ return myComment.c_str();
+}
+
+//----------------------------------------------------------------------------
+const char*
+VISU::DeformedShapeAndScalarMap_i
+::GetIconName()
+{
+ if (!IsGroupsUsed())
+ return "ICON_TREE_SCALAR_MAP_ON_DEFORMED_SHAPE";
+ else
+ return "ICON_TREE_SCALAR_MAP_ON_DEFORMED_SHAPE_GROUPS";
+}
+
+//---------------------------------------------------------------
+VISU::DeformedShapeAndScalarMap_i
+::DeformedShapeAndScalarMap_i(EPublishInStudyMode thePublishInStudyMode) :
+ ColoredPrs3d_i(thePublishInStudyMode),
+ ScalarMap_i(thePublishInStudyMode),
+ myDeformedShapeAndScalarMapPL(NULL),
+ myScalarTimeStampNumber(1)
+{}
+
+
+//---------------------------------------------------------------
+VISU::Storable*
+VISU::DeformedShapeAndScalarMap_i
+::Create(const std::string& theMeshName,
+ VISU::Entity theEntity,
+ const std::string& theFieldName,
+ CORBA::Long theTimeStampNumber)
+{
+ TSuperClass::Create(theMeshName,
+ theEntity,
+ theFieldName,
+ theTimeStampNumber);
+ SetScalarField(theEntity,
+ theFieldName.c_str(),
+ theTimeStampNumber);
+ return this;
+}
+
+
+//---------------------------------------------------------------
+VISU::Storable*
+VISU::DeformedShapeAndScalarMap_i
+::Restore(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap)
+{
+ if(!TSuperClass::Restore(theSObject, theMap))
+ return NULL;
+
+ QString aMeshName = VISU::Storable::FindValue(theMap,"myScalarMeshName");
+ VISU::Entity anEntity = VISU::Entity(VISU::Storable::FindValue(theMap,"myScalarEntity").toInt());
+
+ QString aFieldName = VISU::Storable::FindValue(theMap,"myScalarFieldName");
+ int aTimeStampNumber = VISU::Storable::FindValue(theMap,"myScalarIteration").toInt();
+
+ SetScalarField(anEntity,
+ aFieldName,
+ aTimeStampNumber);
+
+ SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble());
+
+ return this;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::DeformedShapeAndScalarMap_i
+::ToStream(std::ostringstream& theStr)
+{
+ TSuperClass::ToStream(theStr);
+
+ Storable::DataToStream( theStr, "myScalarEntity", int(myScalarEntity));
+ Storable::DataToStream( theStr, "myScalarFieldName", myScalarFieldName.c_str());
+ Storable::DataToStream( theStr, "myScalarIteration", int(myScalarTimeStampNumber));
+
+ Storable::DataToStream( theStr, "myFactor", GetScale() );
+}
+
+
+//---------------------------------------------------------------
+VISU::DeformedShapeAndScalarMap_i
+::~DeformedShapeAndScalarMap_i()
+{
+ if(MYDEBUG) MESSAGE("DeformedShapeAndScalarMap_i::~DeformedShapeAndScalarMap_i()");
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::DeformedShapeAndScalarMap_i
+::SameAs(const Prs3d_i* theOrigin)
+{
+ TSuperClass::SameAs(theOrigin);
+
+ if(const DeformedShapeAndScalarMap_i* aPrs3d = dynamic_cast<const DeformedShapeAndScalarMap_i*>(theOrigin)){
+ DeformedShapeAndScalarMap_i* anOrigin = const_cast<DeformedShapeAndScalarMap_i*>(aPrs3d);
+ CORBA::String_var aFieldName = anOrigin->GetScalarFieldName();
+
+ SetScalarField(anOrigin->GetScalarEntity(),
+ aFieldName,
+ anOrigin->GetScalarTimeStampNumber());
+ Update();
+ }
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::DeformedShapeAndScalarMap_i
+::SetScale(CORBA::Double theScale)
+{
+ VISU::TSetModified aModified(this);
+
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedShapeAndScalarMapPL, vtkFloatingPointType>
+ (GetSpecificPL(), &VISU_DeformedShapeAndScalarMapPL::SetScale, theScale));
+}
+
+
+//---------------------------------------------------------------
+CORBA::Double
+VISU::DeformedShapeAndScalarMap_i
+::GetScale()
+{
+ return myDeformedShapeAndScalarMapPL->GetScale();
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::DeformedShapeAndScalarMap_i
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
+{
+ if(!thePipeLine){
+ myDeformedShapeAndScalarMapPL = VISU_DeformedShapeAndScalarMapPL::New();
+ }else
+ myDeformedShapeAndScalarMapPL = dynamic_cast<VISU_DeformedShapeAndScalarMapPL*>(thePipeLine);
+
+ myDeformedShapeAndScalarMapPL->GetMapper()->SetScalarVisibility(1);
+
+ TSuperClass::CreatePipeLine(myDeformedShapeAndScalarMapPL);
+}
+
+
+//---------------------------------------------------------------
+bool
+VISU::DeformedShapeAndScalarMap_i
+::CheckIsPossible()
+{
+ return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
+}
+
+
+//---------------------------------------------------------------
+VISU_Actor*
+VISU::DeformedShapeAndScalarMap_i
+::CreateActor()
+{
+ VISU_Actor* anActor = TSuperClass::CreateActor(true);
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aDispMode = aResourceMgr->integerValue("VISU", "scalar_def_represent", 2);
+ bool toShrink = aResourceMgr->booleanValue("VISU", "scalar_def_shrink", false);
+ anActor->SetRepresentation(aDispMode);
+ if (toShrink)
+ anActor->SetShrink();
+ anActor->SetVTKMapping(false);
+ return anActor;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::DeformedShapeAndScalarMap_i
+::UpdateActor(VISU_Actor* theActor)
+{
+ if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
+ anActor->SetBarVisibility(true);
+ GetPipeLine()->GetMapper()->SetScalarVisibility(1);
+ }
+ TSuperClass::UpdateActor(theActor);
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::DeformedShapeAndScalarMap_i
+::SetField(VISU::PField theField)
+{
+ TSuperClass::SetField(theField);
+
+ if(!myScalarField)
+ myScalarField = theField;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::DeformedShapeAndScalarMap_i
+::SetScalarField(VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theTimeStampNumber)
+{
+ bool anIsModified = false;
+
+ if(!anIsModified)
+ anIsModified |= myScalarEntity != theEntity;
+
+ if(!anIsModified)
+ anIsModified |= myScalarFieldName != theFieldName;
+
+ if(!anIsModified)
+ anIsModified |= myScalarTimeStampNumber != theTimeStampNumber;
+
+ if(!anIsModified)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ VISU::TEntity aEntity = VISU::TEntity(theEntity);
+ VISU::Result_i::PInput anInput = GetCResult()->GetInput(GetCMeshName(),
+ theEntity,
+ theFieldName,
+ theTimeStampNumber);
+ myScalarField = anInput->GetField(GetCMeshName(), aEntity, theFieldName);
+
+ VISU::PUnstructuredGridIDMapper anIDMapper =
+ anInput->GetTimeStampOnMesh(GetCMeshName(),
+ aEntity,
+ theFieldName,
+ theTimeStampNumber);
+
+ vtkUnstructuredGrid* anOutput = anIDMapper->GetUnstructuredGridOutput();
+ if(myDeformedShapeAndScalarMapPL && anOutput)
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedShapeAndScalarMapPL, vtkDataSet*>
+ (GetSpecificPL(), &VISU_DeformedShapeAndScalarMapPL::SetScalars, anOutput));
+
+ myScalarEntity = theEntity;
+ myScalarFieldName = theFieldName;
+ myScalarTimeStampNumber = theTimeStampNumber;
+
+ SetTitle(theFieldName);
+ SetScalarMode(GetScalarMode());
+ if(!IsRangeFixed() && IsPipeLineExists())
+ SetSourceRange();
+
+ myParamsTime.Modified();
+}
+
+
+//---------------------------------------------------------------
+VISU::Entity
+VISU::DeformedShapeAndScalarMap_i
+::GetScalarEntity()
+{
+ return myScalarEntity;
+}
+
+
+//---------------------------------------------------------------
+char*
+VISU::DeformedShapeAndScalarMap_i
+::GetScalarFieldName()
+{
+ return CORBA::string_dup(myScalarFieldName.c_str());
+}
+
+
+//---------------------------------------------------------------
+CORBA::Long
+VISU::DeformedShapeAndScalarMap_i
+::GetScalarTimeStampNumber()
+{
+ return myScalarTimeStampNumber;
+}
+
+
+//---------------------------------------------------------------
+VISU::PField
+VISU::DeformedShapeAndScalarMap_i
+::GetScalarField()
+{
+ return myScalarField;
+}
--- /dev/null
+// 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_DeformedShapeAndScalarMap_i.hh
+// Author: Eugeny Nikolaev
+// Module : VISU
+
+#ifndef VISU_DeformedShapeAndScalarMap_i_HeaderFile
+#define VISU_DeformedShapeAndScalarMap_i_HeaderFile
+
+#include "VISU_ScalarMap_i.hh"
+
+class VISU_DeformedShapeAndScalarMapPL;
+
+namespace VISU
+{
+ //----------------------------------------------------------------------------
+ //! Class of Scalar Map on Deformed Shape presentation.
+ class VISU_I_EXPORT DeformedShapeAndScalarMap_i : public virtual POA_VISU::DeformedShapeAndScalarMap,
+ public virtual ScalarMap_i
+ {
+ static int myNbPresent;
+ DeformedShapeAndScalarMap_i(const DeformedShapeAndScalarMap_i&);
+
+ public:
+ //----------------------------------------------------------------------------
+ typedef ScalarMap_i TSuperClass;
+ typedef VISU::DeformedShapeAndScalarMap TInterface;
+
+ explicit
+ DeformedShapeAndScalarMap_i(EPublishInStudyMode thePublishInStudyModep);
+
+ virtual
+ ~DeformedShapeAndScalarMap_i();
+
+ virtual
+ VISU::VISUType
+ GetType()
+ {
+ return VISU::TDEFORMEDSHAPEANDSCALARMAP;
+ }
+
+ virtual
+ void
+ SetScale(CORBA::Double theScale);
+
+ virtual
+ CORBA::Double
+ GetScale();
+
+ virtual
+ void
+ SameAs(const Prs3d_i* theOrigin);
+
+ VISU_DeformedShapeAndScalarMapPL*
+ GetSpecificPL()
+ {
+ return myDeformedShapeAndScalarMapPL;
+ }
+
+ protected:
+ //! Redefines VISU_ColoredPrs3d_i::SetField
+ virtual
+ void
+ SetField(VISU::PField theField);
+
+ //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
+ virtual
+ void
+ CreatePipeLine(VISU_PipeLine* thePipeLine);
+
+ //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible
+ virtual
+ bool
+ CheckIsPossible();
+
+ public:
+ //! Redefines VISU_ColoredPrs3d_i::IsPossible
+ static
+ size_t
+ IsPossible(Result_i* theResult,
+ const std::string& theMeshName,
+ VISU::Entity theEntity,
+ const std::string& theFieldName,
+ CORBA::Long theTimeStampNumber,
+ bool theIsMemoryCheck);
+
+ //! Redefines VISU_ColoredPrs3d_i::IsPossible
+ virtual
+ Storable*
+ Create(const std::string& theMeshName,
+ VISU::Entity theEntity,
+ const std::string& theFieldName,
+ CORBA::Long theTimeStampNumber);
+
+ //! Redefines VISU_ColoredPrs3d_i::ToStream
+ virtual
+ void
+ ToStream(std::ostringstream& theStr);
+
+ //! Redefines VISU_ColoredPrs3d_i::Restore
+ virtual
+ Storable*
+ Restore(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap);
+
+ static const std::string myComment;
+
+ virtual
+ const char*
+ GetComment() const;
+
+ virtual
+ QString
+ GenerateName();
+
+ virtual
+ const char*
+ GetIconName();
+
+ virtual
+ VISU_Actor*
+ CreateActor();
+
+ virtual
+ void
+ UpdateActor(VISU_Actor* theActor) ;
+
+ virtual
+ void
+ SetScalarField(VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theTimeStampNumber);
+
+ virtual
+ VISU::Entity
+ GetScalarEntity();
+
+ virtual
+ char*
+ GetScalarFieldName();
+
+ virtual
+ CORBA::Long
+ GetScalarTimeStampNumber();
+
+ virtual
+ VISU::PField
+ GetScalarField();
+
+ private:
+ VISU_DeformedShapeAndScalarMapPL *myDeformedShapeAndScalarMapPL;
+
+ PField myScalarField;
+ VISU::Entity myScalarEntity;
+ std::string myScalarFieldName;
+ CORBA::Long myScalarTimeStampNumber;
+ };
+}
+#endif
--- /dev/null
+// 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);
+ }
+}
+
--- /dev/null
+// 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
--- /dev/null
+// Copyright (C) 2008 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_OptionalDeformation_i.cc
+// Author :
+// Module : VISU
+
+#include "VISU_OptionalDeformation_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_Prs3dUtils.hh"
+#include "VISUConfig.hh"
+
+#include "VISU_OptionalDeformationPL.hxx"
+
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//---------------------------------------------------------------
+VISU::OptionalDeformation_i::OptionalDeformation_i(VISU::ColoredPrs3d_i *theColoredPrs3d):
+ Deformation_i(theColoredPrs3d)
+{
+ if(MYDEBUG) MESSAGE("OptionalDeformation_i::OptionalDeformation_i()");
+}
+
+//---------------------------------------------------------------
+VISU::OptionalDeformation_i::~OptionalDeformation_i()
+{
+ if(MYDEBUG) MESSAGE("OptionalDeformation_i::~OptionalDeformation_i()");
+}
+
+//---------------------------------------------------------------
+void VISU::OptionalDeformation_i::UseDeformation(CORBA::Boolean theFlag){
+ if(MYDEBUG) MESSAGE("OptionalDeformation_i::UseDeformation()");
+
+ VISU::TSetModified aModified(GetColoredPrs3d());
+
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_OptionalDeformationPL, bool>
+ (GetSpecificDeformedPL(), &VISU_OptionalDeformationPL::UseDeformation, theFlag));
+}
+
+//---------------------------------------------------------------
+CORBA::Boolean VISU::OptionalDeformation_i::IsDeformed(){
+
+ if(MYDEBUG) MESSAGE("OptionalDeformation_i::IsDeformed()");
+ return GetSpecificDeformedPL()->IsDeformed();
+}
+
+
+void VISU::OptionalDeformation_i::InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine){
+
+ if(MYDEBUG) MESSAGE("OptionalDeformation_i::InitDeformedPipeLine()");
+ myOptionalDeformationPL = dynamic_cast<VISU_OptionalDeformationPL*>(theDeformedPipeLine);
+
+ TSuperClass::InitDeformedPipeLine(myOptionalDeformationPL);
+}
+
+//---------------------------------------------------------------
+void VISU::OptionalDeformation_i::
+DeformationToStream(std::ostringstream& theStr)
+{
+ Storable::DataToStream(theStr,"IsDeformed", IsDeformed());
+ if(IsDeformed())
+ TSuperClass::DeformationToStream(theStr);
+}
+
+//---------------------------------------------------------------
+void
+VISU::OptionalDeformation_i::RestoreDeformation(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap)
+{
+ UseDeformation(Storable::FindValue(theMap,"IsDeformed").toInt());
+ if(IsDeformed())
+ TSuperClass::RestoreDeformation(theSObject,theMap);
+}
+
+
+
+void
+VISU::OptionalDeformation_i::SameAsDeformation(const Deformation_i *aDeformedPrs){
+
+ if(const OptionalDeformation_i* aPrs3d = dynamic_cast<const OptionalDeformation_i*>(aDeformedPrs)){
+ OptionalDeformation_i* anOrigin = const_cast<OptionalDeformation_i*>(aPrs3d);
+ UseDeformation(anOrigin->IsDeformed());
+
+ if(anOrigin->IsDeformed()){
+ TSuperClass::SameAsDeformation(aDeformedPrs);
+ }
+ }
+}
--- /dev/null
+// Copyright (C) 2008 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_Deformation_i.hxx
+// Author :
+// Module : VISU
+
+#ifndef VISU_OptionalDeformation_i_HeaderFile
+#define VISU_OptionalDeformation_i_HeaderFile
+
+#include "VISU_I.hxx"
+#include "VISU_Deformation_i.hh"
+#include "VISU_OptionalDeformationPL.hxx"
+
+namespace VISU {
+ class VISU_I_EXPORT OptionalDeformation_i : public virtual POA_VISU::OptionalDeformation,
+ public virtual Deformation_i
+ {
+ OptionalDeformation_i(const OptionalDeformation_i&);
+ public:
+ typedef VISU::OptionalDeformation TInterface;
+ typedef Deformation_i TSuperClass;
+
+ OptionalDeformation_i(VISU::ColoredPrs3d_i* theModifiedEngine);
+ virtual ~OptionalDeformation_i();
+
+ virtual void UseDeformation(CORBA::Boolean theFlag);
+ virtual CORBA::Boolean IsDeformed();
+
+
+ virtual
+ void
+ DeformationToStream(std::ostringstream& theStr);
+
+ virtual
+ void
+ RestoreDeformation(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap);
+
+ virtual
+ void
+ SameAsDeformation(const Deformation_i *aDeformedPrs);
+
+ protected:
+ virtual
+ void InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine);
+
+ VISU_OptionalDeformationPL*
+ GetSpecificDeformedPL() const
+ {
+ return myOptionalDeformationPL;
+ }
+
+ private:
+ VISU_OptionalDeformationPL* myOptionalDeformationPL;
+
+ };
+}
+#endif
--- /dev/null
+// 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_PointMap3d_i.cc
+// Author : Dmitry Matveitchev
+// Module : VISU
+
+#include "VISU_PointMap3d_i.hh"
+
+#include "VISU_CutLines_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_ViewManager_i.hh"
+#include "VISU_ScalarBarActor.hxx"
+#include "SUIT_ResourceMgr.h"
+
+#include "SALOME_Event.hxx"
+#include "VISU_Prs3dUtils.hh"
+#include "SPlot2d_Curve.h"
+#include "VISU_PipeLineUtils.hxx"
+
+#include "VISU_TableReader.hxx"
+#include "VISU_ConvertorUtils.hxx"
+#include "VISU_DeformedGridPL.hxx"
+
+#include "SALOME_InteractiveObject.hxx"
+#include "VISU_Gen_i.hh"
+
+#include <vtkTextProperty.h>
+#include <vtkActorCollection.h>
+
+#include <boost/bind.hpp>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//----------------------------------------------------------------
+// PointMap3d Object
+//----------------------------------------------------------------
+int VISU::PointMap3d_i::myNbPresent = 0;
+const string VISU::PointMap3d_i::myComment = "POINTMAP3D";
+/*!
+ Generate unique name
+*/
+QString VISU::PointMap3d_i::GenerateName()
+{
+ return VISU::GenerateName( "Table3D - ", ++myNbPresent );
+}
+/*!
+ Gets comment string
+*/
+const char* VISU::PointMap3d_i::GetComment() const
+{
+ return myComment.c_str();
+}
+/*!
+ Constructor
+*/
+VISU::PointMap3d_i::PointMap3d_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry )
+ : Table_i(theStudy, theObjectEntry),
+ myActorCollection(vtkActorCollection::New()),
+ myIsActiveState(true)
+{
+ if(MYDEBUG) MESSAGE("PointMap3d_i::PointMap3d_i - this = "<<this);
+ SetStudyDocument(theStudy);
+ mySObj = theStudy->FindObjectID(theObjectEntry);
+ myOffset[0] = myOffset[1] = myOffset[2] = 0;
+ myActorCollection->Delete();
+}
+/*!
+ Destructor
+*/
+VISU::PointMap3d_i::~PointMap3d_i()
+{
+ if(MYDEBUG) MESSAGE("PointMap3d_i::~PointMap3d_i - this = "<<this);
+}
+
+//----------------------------------------------------------------------------
+namespace VISU
+{
+ struct TInvokeSignalEvent: public SALOME_Event
+ {
+ typedef boost::signal0<void> TSignal;
+ const TSignal& mySignal;
+
+ TInvokeSignalEvent(const TSignal& theSignal):
+ mySignal(theSignal)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ mySignal();
+ }
+ };
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::PointMap3d_i
+::SetTitle( const char* theTitle )
+{
+ SetName( theTitle, true );
+}
+
+//----------------------------------------------------------------------------
+char*
+VISU::PointMap3d_i
+::GetTitle()
+{
+ return CORBA::string_dup( GetName().c_str() );
+}
+
+//----------------------------------------------------------------------------
+SALOMEDS::SObject_var
+VISU::PointMap3d_i
+::GetSObject() const
+{
+ return mySObj;
+}
+
+//----------------------------------------------------------------------------
+std::string
+VISU::PointMap3d_i
+::GetObjectEntry()
+{
+ CORBA::String_var anEntry = mySObj->GetID();
+ return anEntry.in();
+}
+
+//----------------------------------------------------------------------------
+Handle(SALOME_InteractiveObject)
+VISU::PointMap3d_i
+::GetIO()
+{
+ if( myIO.IsNull() )
+ myIO = new SALOME_InteractiveObject(GetEntry().c_str(), "VISU", GetName().c_str());
+
+ return myIO;
+}
+
+//----------------------------------------------------------------------------
+/*!
+ Creates table3d object
+*/
+VISU::Storable* VISU::PointMap3d_i::Create()
+{
+ // generate name ...
+ SetName(GetTableTitle().latin1(), false);
+
+ if ( GetName() == "" ) {
+ if ( !mySObj->_is_nil() ) {
+ CutLines_i* pCutLines = NULL;
+ CORBA::Object_var anObj = SObjectToObject(mySObj);
+ if(!CORBA::is_nil(anObj)){
+ VISU::CutLines_var aCutLines = VISU::CutLines::_narrow(anObj);
+ if(!aCutLines->_is_nil())
+ pCutLines = dynamic_cast<CutLines_i*>(GetServant(aCutLines).in());
+ }
+ if (!pCutLines)
+ if (mySObj->GetName()) SetName(mySObj->GetName(), false);
+ }
+ }
+
+ if ( GetName() == "" )
+ SetName(GenerateName().latin1(), false);
+
+ // Create Pipeline
+ myTablePL = VISU_DeformedGridPL::New();
+ myTablePL->SetPolyDataIDMapper(GetTableIDMapper());
+ myTablePL->Update();
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ bool isUnits = aResourceMgr->booleanValue( "VISU", "scalar_bar_display_units", true );
+ SetUnitsVisible(isUnits);
+
+ SetSourceRange();
+
+ if( aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false) )
+ SetScaling(VISU::LOGARITHMIC);
+ else
+ SetScaling(VISU::LINEAR);
+
+ int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 );
+ SetNbColors(aNumberOfColors);
+
+ int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
+ UseFixedRange(aRangeType == 1);
+ if(aRangeType == 1){
+ float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0);
+ float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0);
+ SetRange(aMin, aMax);
+ }
+
+ QString aLabelsFormat = aResourceMgr->stringValue( "VISU", "scalar_bar_label_format", "%-#6.3g" );
+ const char *lf=aLabelsFormat.latin1();
+ SetLabelsFormat(lf);
+
+ // Orientation
+ int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0);
+ if(anOrientation == 1)
+ SetBarOrientation(VISU::ColoredPrs3dBase::HORIZONTAL);
+ else
+ SetBarOrientation(VISU::ColoredPrs3dBase::VERTICAL);
+
+ // Scalar Bar origin
+ QString propertyName = QString( "scalar_bar_%1_" ).arg( anOrientation == 0 ? "vertical" : "horizontal" );
+
+ vtkFloatingPointType aXorigin = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.01 : 0.2;
+ aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin);
+ myPosition[0] = aXorigin;
+
+ vtkFloatingPointType aYorigin = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.1 : 0.012;
+ aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin);
+ myPosition[1] = aYorigin;
+
+ // Scalar Bar size
+ myWidth = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.1 : 0.6;
+ myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth);
+
+ myHeight = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.8:0.12;
+ myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight);
+
+ myTitleWidth = aResourceMgr->doubleValue("VISU", propertyName + "title_width", 0);
+ myTitleHeight = aResourceMgr->doubleValue("VISU", propertyName + "title_height", 0);
+ myLabelWidth = aResourceMgr->doubleValue("VISU", propertyName + "label_width", 0);
+ myLabelHeight = aResourceMgr->doubleValue("VISU", propertyName + "label_height", 0);
+ myBarWidth = aResourceMgr->doubleValue("VISU", propertyName + "bar_width", 0);
+ myBarHeight = aResourceMgr->doubleValue("VISU", propertyName + "bar_height", 0);
+
+ // Nb of Labels
+ myNumberOfLabels = aResourceMgr->integerValue( "VISU", "scalar_bar_num_labels", 5 );
+
+ // Fonts properties definition
+ myIsBoldTitle = myIsItalicTitle = myIsShadowTitle = true;
+ myTitFontType = VTK_ARIAL;
+
+ if(aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" )){
+ QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
+ if ( f.family() == "Arial" )
+ myTitFontType = VTK_ARIAL;
+ else if ( f.family() == "Courier" )
+ myTitFontType = VTK_COURIER;
+ else if ( f.family() == "Times" )
+ myTitFontType = VTK_TIMES;
+
+ myIsBoldTitle = f.bold();
+ myIsItalicTitle = f.italic();
+ myIsShadowTitle = f.underline();
+ }
+
+ QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
+
+ myTitleColor[0] = aTextColor.red() / 255;
+ myTitleColor[1] = aTextColor.green() / 255;
+ myTitleColor[2] = aTextColor.blue() / 255;
+
+ myIsBoldLabel = myIsItalicLabel = myIsShadowLabel = true;
+ myLblFontType = VTK_ARIAL;
+
+ if( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" )){
+ QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
+ if ( f.family() == "Arial" )
+ myLblFontType = VTK_ARIAL;
+ else if ( f.family() == "Courier" )
+ myLblFontType = VTK_COURIER;
+ else if ( f.family() == "Times" )
+ myLblFontType = VTK_TIMES;
+
+ myIsBoldLabel = f.bold();
+ myIsItalicLabel = f.italic();
+ myIsShadowLabel = f.underline();
+ }
+
+ QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
+
+ myLabelColor[0] = aLabelColor.red() / 255;
+ myLabelColor[1] = aLabelColor.green() / 255;
+ myLabelColor[2] = aLabelColor.blue() / 255;
+
+ // scalar bar default position
+ bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0);
+ int aPlace = 1;
+ if (anIsArrangeBar){
+ aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0);
+ }
+ if(myBarOrientation == VISU::ColoredPrs3dBase::HORIZONTAL){
+ myPosition[1] += myHeight*(aPlace-1);
+ } else {
+ myPosition[0] += myWidth*(aPlace-1);
+ }
+
+ return Build( false );
+}
+
+/*
+ GetIDMapper
+*/
+
+VISU::PTableIDMapper
+VISU::PointMap3d_i
+::GetTableIDMapper()
+{
+ //Initialisate table mapper
+ SALOMEDS::GenericAttribute_var anAttr;
+ mySObj->FindAttribute(anAttr, "AttributeTableOfReal");
+ SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+
+ PTableIDMapper aTableIDMapper( new TTableIDMapper() );
+ TTable2D& aTable2D = *aTableIDMapper;
+
+ aTable2D.myTitle = aTableOfReal->GetTitle();
+
+ SALOMEDS::StringSeq_var aColStrList = aTableOfReal->GetColumnTitles();
+ SALOMEDS::StringSeq_var aRowStrList = aTableOfReal->GetRowTitles();
+
+ for ( int i = 0; i < aRowStrList->length(); i++ ) {
+ aTable2D.myColumnTitles.push_back( aRowStrList[ i ].in() );
+ }
+
+ int aCols = aTableOfReal->GetNbColumns();
+ int aRows = aTableOfReal->GetNbRows();
+
+ for (int i=1; i<=aCols; i++) {
+ TTable2D::TRow aRow;
+ aRow.myTitle = aColStrList[ i-1 ].in();
+ for (int j=1; j<=aRows; j++) {
+ double aVal = aTableOfReal->GetValue(j, i);
+ QString aValStr = QString::number(aVal);
+ aRow.myValues.push_back( aValStr );
+ }
+ if( aRow.myValues.size() > 0 )
+ aTable2D.myRows.push_back( aRow );
+ }
+
+ return aTableIDMapper;
+}
+
+/*
+ Create Actor
+*/
+VISU_PointMap3dActor* VISU::PointMap3d_i::CreateActor()
+{
+ VISU_PointMap3dActor* anActor = VISU_PointMap3dActor::New();
+ anActor->SetPipeLine(myTablePL);
+ anActor->SetFactory(this);
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aDispMode = aResourceMgr->integerValue("VISU", "point_map_represent", 2);
+ bool toShrink = aResourceMgr->booleanValue("VISU", "scalar_map_shrink", false);
+ anActor->SetRepresentation(aDispMode);
+ if (toShrink) anActor->SetShrink();
+
+ Handle (SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(GetEntry().c_str(), "VISU", GetName().c_str());
+ anActor->setIO(anIO);
+
+ myUpdateActorsSignal.connect(boost::bind(&VISU_Actor::UpdateFromFactory,anActor));
+ // myRemoveActorsFromRendererSignal.connect(boost::bind(&VISU_Actor::RemoveFromRender,anActor));
+
+ myActorCollection->AddItem(anActor);
+
+ UpdateActor( anActor );
+
+ return anActor;
+}
+
+/*
+ Update Actor
+*/
+void VISU::PointMap3d_i::UpdateActor(VISU_ActorBase* theActor)
+{
+ if(VISU_PointMap3dActor* anActor = dynamic_cast<VISU_PointMap3dActor*>(theActor)){
+ Update();
+ VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
+ aScalarBar->SetLookupTable(GetSpecificPL()->GetBarTable());
+ aScalarBar->SetTitle(GetTitle());
+ aScalarBar->SetOrientation(GetBarOrientation());
+ aScalarBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
+ aScalarBar->GetPositionCoordinate()->SetValue(GetPosX(),GetPosY());
+ aScalarBar->SetWidth(GetWidth());
+ aScalarBar->SetHeight(GetHeight());
+ aScalarBar->SetNumberOfLabels(GetLabels());
+ aScalarBar->SetRatios(myTitleWidth, myTitleHeight,
+ myLabelWidth, myLabelHeight,
+ myBarWidth, myBarHeight);
+ aScalarBar->SetNumberOfLabels(GetLabels());
+ aScalarBar->SetLabelFormat(GetLabelsFormat());
+
+ vtkFloatingPointType anRGB[3];
+
+ vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty();
+ aTitleProp->SetFontFamily(GetTitFontType());
+
+ GetTitleColor(anRGB[0],anRGB[1],anRGB[2]);
+ aTitleProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+
+ IsBoldTitle()? aTitleProp->BoldOn() : aTitleProp->BoldOff();
+ IsItalicTitle()? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
+ IsShadowTitle()? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
+
+ vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty();
+ aLabelProp->SetFontFamily(GetLblFontType());
+
+ GetLabelColor(anRGB[0],anRGB[1],anRGB[2]);
+ aLabelProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+
+ IsBoldLabel()? aLabelProp->BoldOn() : aLabelProp->BoldOff();
+ IsItalicLabel()? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
+ IsShadowLabel()? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
+
+ aScalarBar->Modified();
+ }
+ theActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]);
+}
+
+void
+VISU::PointMap3d_i
+::UpdateActors()
+{
+ if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActors - this = "<<this);
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_PipeLine>
+ (GetSpecificPL(), &VISU_PipeLine::Update));
+
+ ProcessVoidEvent(new VISU::TInvokeSignalEvent(myUpdateActorsSignal));
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::PointMap3d_i
+::Update()
+{
+ if(GetMTime() < myUpdateTime.GetMTime())
+ return;
+
+ if(MYDEBUG) MESSAGE("PointMap3d_i::Update - this = "<<this);
+
+ try{
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_PipeLine>
+ (GetSpecificPL(), &VISU_PipeLine::Update));
+ myUpdateTime.Modified();
+ }catch(std::exception&){
+ throw;
+ }catch(...){
+ throw std::runtime_error("PointMap3d_i::Update >> unexpected exception was caught!!!");
+ }
+}
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU::PointMap3d_i
+::GetMTime()
+{
+ unsigned long int aTime = myParamsTime.GetMTime();
+ if( GetSpecificPL() )
+ aTime = std::max(aTime, GetSpecificPL()->GetMTime());
+ return aTime;
+}
+
+/*!
+ Builds presentation of table
+*/
+VISU::Storable* VISU::PointMap3d_i::Build( int theRestoring )
+{
+
+ // look for reference SObject with table attribute
+ SALOMEDS::SObject_var SO = mySObj;
+
+ if ( !SO->_is_nil() ) {
+ CutLines_i* pCutLines = NULL;
+ CORBA::Object_var anObj = SObjectToObject(SO);
+ if(!CORBA::is_nil(anObj)){
+ VISU::CutLines_var aCutLines = VISU::CutLines::_narrow(anObj);
+ if(!aCutLines->_is_nil())
+ pCutLines = dynamic_cast<CutLines_i*>(GetServant(aCutLines).in());
+ }
+ SALOMEDS::Study_var aStudy = GetStudyDocument();
+ SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr;
+ // look for component
+ if ( !theRestoring ) {
+ SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( GetStudyDocument() );
+ // create SObject and set attributes
+ QString aComment;
+ if(pCutLines)
+ aComment.sprintf("myComment=%s;mySourceId=CutLines",GetComment());
+ else{
+ aComment.sprintf("myComment=%s;mySourceId=TableAttr",GetComment());
+ SALOMEDS::SObject_var aFatherSObject = SO->GetFather();
+ if(aFatherSObject->FindAttribute(anAttr,"AttributeString")){
+ SALOMEDS::AttributeString_var aCommentAttr =
+ SALOMEDS::AttributeString::_narrow(anAttr);
+ CORBA::String_var aValue = aCommentAttr->Value();
+ Storable::TRestoringMap aMap;
+ Storable::StringToMap(aValue.in(),aMap);
+ bool anIsExist;
+ QString aMethodName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
+ if(anIsExist){
+ if(strcmp(aMethodName.latin1(),"ImportTables") == 0){
+ aComment.sprintf("myComment=%s;mySourceId=TableFile",GetComment());
+ }
+ }
+ }
+ }
+
+ string anEntry = CreateAttributes( GetStudyDocument(),
+ SO->GetID(),//SComponent->GetID(),
+ "ICON_TREE_TABLE",
+ GetID(),
+ GetName(),
+ "",
+ aComment.latin1(),
+ pCutLines );
+ // create SObject referenced to real table object
+ mySObj = SALOMEDS::SObject::_duplicate(GetStudyDocument()->FindObjectID( anEntry.c_str() ));
+ if(pCutLines) {
+ pCutLines->BuildTableOfReal(mySObj);
+ }
+ // mpv (PAL5357): reference attributes are unnecessary now
+ //SALOMEDS::SObject_var refSO = Builder->NewObject( mySObj );
+ //Builder->Addreference( refSO, SO );
+ }
+
+ return this;
+ }
+ return NULL;
+}
+/*!
+ Restores table object from stream
+*/
+VISU::Storable* VISU::PointMap3d_i::Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO)
+{
+ if(MYDEBUG) MESSAGE(GetComment());
+ SetName(VISU::Storable::FindValue(theMap,"myName").latin1(), false);
+ myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1();
+ myOrientation = ( VISU::Table::Orientation )( VISU::Storable::FindValue(theMap,"myOrientation").toInt() );
+ mySObj = SALOMEDS::SObject::_duplicate(SO);
+
+ //Create PipeLine
+ myTablePL = VISU_DeformedGridPL::New();
+ myTablePL->SetPolyDataIDMapper(GetTableIDMapper());
+ myTablePL->Update();
+
+ //Restore Other Values
+
+ float aMin = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble();
+ float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble();
+ SetRange(aMin, aMax);
+
+ UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange", "0").toInt());
+
+ SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
+ SetUnitsVisible(VISU::Storable::FindValue(theMap,"myUnitsVisible", "1").toInt());
+ SetLabelsFormat(VISU::Storable::FindValue(theMap,"myLabelsFormat", "%-#6.3g"));
+ SetBarOrientation((VISU::ColoredPrs3dBase::Orientation)VISU::Storable::FindValue(theMap,"myBarOrientation").toInt());
+
+ SetTitle(VISU::Storable::FindValue(theMap,"myTitle").latin1());
+ myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt();
+ myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
+ myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
+ myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
+ myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
+ myTitleWidth = VISU::Storable::FindValue(theMap,"myTitleWidth").toInt();
+ myTitleHeight = VISU::Storable::FindValue(theMap,"myTitleHeight").toInt();
+ myLabelWidth = VISU::Storable::FindValue(theMap,"myLabelWidth").toInt();
+ myLabelHeight = VISU::Storable::FindValue(theMap,"myLabelHeight").toInt();
+ myBarWidth = VISU::Storable::FindValue(theMap,"myBarWidth").toInt();
+ myBarHeight = VISU::Storable::FindValue(theMap,"myBarHeight").toInt();
+
+ myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt();
+ myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt();
+ myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt();
+ myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt();
+ myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat();
+ myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat();
+ myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat();
+
+ myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt();
+ myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt();
+ myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt();
+ myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt();
+ myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat();
+ myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat();
+ myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat();
+
+ myParamsTime.Modified();
+ return Build( true );
+}
+/*!
+ Flushes table data into stream
+*/
+void VISU::PointMap3d_i::ToStream( std::ostringstream& theStr )
+{
+ Storable::DataToStream( theStr, "myName", GetName().c_str() );
+ Storable::DataToStream( theStr, "myTitle", myTitle.c_str() );
+ Storable::DataToStream( theStr, "myOrientation", myOrientation );
+
+ Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() );
+ Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
+ Storable::DataToStream( theStr, "myIsFixedRange", IsRangeFixed() );
+
+ Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
+ Storable::DataToStream( theStr, "myBarOrientation", myBarOrientation );
+
+ Storable::DataToStream( theStr, "myTitle", myTitle.c_str() );
+ Storable::DataToStream( theStr, "myUnitsVisible", myIsUnits );
+ Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
+ Storable::DataToStream( theStr, "myLabelsFormat", myLabelsFormat.c_str() );
+ Storable::DataToStream( theStr, "myPosition[0]", myPosition[0] );
+ Storable::DataToStream( theStr, "myPosition[1]", myPosition[1] );
+ Storable::DataToStream( theStr, "myWidth", myWidth );
+ Storable::DataToStream( theStr, "myHeight", myHeight );
+ Storable::DataToStream( theStr, "myTitleWidth", myTitleWidth );
+ Storable::DataToStream( theStr, "myTitleHeight", myTitleHeight );
+ Storable::DataToStream( theStr, "myLabelWidth", myLabelWidth );
+ Storable::DataToStream( theStr, "myLabelHeight", myLabelHeight );
+ Storable::DataToStream( theStr, "myBarWidth", myBarWidth );
+ Storable::DataToStream( theStr, "myBarHeight", myBarHeight );
+
+ Storable::DataToStream( theStr, "myTitFontType", myTitFontType );
+ Storable::DataToStream( theStr, "myIsBoldTitle", myIsBoldTitle );
+ Storable::DataToStream( theStr, "myIsItalicTitle", myIsItalicTitle );
+ Storable::DataToStream( theStr, "myIsShadowTitle", myIsShadowTitle );
+ Storable::DataToStream( theStr, "myTitleColor[0]", myTitleColor[0] );
+ Storable::DataToStream( theStr, "myTitleColor[1]", myTitleColor[1] );
+ Storable::DataToStream( theStr, "myTitleColor[2]", myTitleColor[2] );
+
+ Storable::DataToStream( theStr, "myLblFontType", myLblFontType );
+ Storable::DataToStream( theStr, "myIsBoldLabel", myIsBoldLabel );
+ Storable::DataToStream( theStr, "myIsItalicLabel", myIsItalicLabel );
+ Storable::DataToStream( theStr, "myIsShadowLabel", myIsShadowLabel );
+ Storable::DataToStream( theStr, "myLabelColor[0]", myLabelColor[0] );
+ Storable::DataToStream( theStr, "myLabelColor[1]", myLabelColor[1] );
+ Storable::DataToStream( theStr, "myLabelColor[2]", myLabelColor[2] );
+}
+/*!
+ Called from engine to restore table from the file
+*/
+VISU::Storable* VISU::PointMap3d_i::StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
+{
+ SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+ VISU::PointMap3d_i* pResent = new VISU::PointMap3d_i( aStudy, "" );
+ return pResent->Restore( theMap, theSObject);
+}
+/*!
+ Gets title for the original table object
+*/
+QString VISU::PointMap3d_i::GetTableTitle()
+{
+ SALOMEDS::SObject_var SO = mySObj;
+ SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeTableOfInteger_var anInt;
+ SALOMEDS::AttributeTableOfReal_var aReal;
+ if ( !SO->_is_nil() ) {
+ if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+ anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+ CORBA::String_var aString = anInt->GetTitle();
+ return aString.in();
+ }
+ else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+ aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+ CORBA::String_var aString = aReal->GetTitle();
+ return aString.in();
+ }
+ }
+ return "";
+}
+
+//---------------------------------------------------------------
+void VISU::PointMap3d_i::RemoveFromStudy()
+{
+ struct TRemoveFromStudy: public SALOME_Event
+ {
+ VISU::PointMap3d_i* myRemovable;
+ TRemoveFromStudy(VISU::PointMap3d_i* theRemovable):
+ myRemovable(theRemovable)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ VISU::RemoveFromStudy(myRemovable->GetSObject(),false);
+ }
+ };
+
+ // Remove the table with all curves
+ ProcessVoidEvent(new TRemoveFromStudy(this));
+}
+
+//----------------------------------------------------------------
+void VISU::PointMap3d_i::SetOffset(CORBA::Float theDx, CORBA::Float theDy, CORBA::Float theDz)
+{
+ myOffset[0] = theDx;
+ myOffset[1] = theDy;
+ myOffset[2] = theDz;
+ myParamsTime.Modified();
+}
+
+void VISU::PointMap3d_i::GetOffset(CORBA::Float& theDx, CORBA::Float& theDy, CORBA::Float& theDz)
+{
+ theDx = myOffset[0];
+ theDy = myOffset[1];
+ theDz = myOffset[2];
+}
+
+CORBA::Float VISU::PointMap3d_i::GetMemorySize()
+{
+ CORBA::Float aSize = GetSpecificPL()->GetMemorySize();
+
+ int anEnd = myActorCollection->GetNumberOfItems();
+ for(int anId = 0; anId < anEnd; anId++)
+ if(vtkObject* anObject = myActorCollection->GetItemAsObject(anId))
+ if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anObject)){
+ aSize += anActor->GetMemorySize();
+ //cout<<"Prs3d_i::GetMemorySize - "<<this<<"; anActor = "<<aSize / (1024.0 * 1024.0)<<endl;
+ }
+
+ // Convert to mega bytes
+ return aSize / (1024.0 * 1024.0);
+}
+
+//------------------ ColoredPrs3dBase Methods --------------------
+CORBA::Double VISU::PointMap3d_i::GetMin()
+{
+ return myTablePL->GetScalarRange()[0];
+}
+
+CORBA::Double VISU::PointMap3d_i::GetMinTableValue()
+{
+ SALOMEDS::GenericAttribute_var anAttr;
+ mySObj->FindAttribute(anAttr, "AttributeTableOfReal");
+ SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+ double aMin = aTableOfReal->GetValue(1, 1);
+
+ for (int i=1; i<=aTableOfReal->GetNbColumns(); i++)
+ for (int j=1; j<=aTableOfReal->GetNbRows(); j++) {
+ double aVal = aTableOfReal->GetValue(j, i);
+ if (aVal < aMin)
+ aMin = aVal;
+ }
+
+ return aMin;
+}
+
+CORBA::Double VISU::PointMap3d_i::GetMaxTableValue()
+{
+ SALOMEDS::GenericAttribute_var anAttr;
+ mySObj->FindAttribute(anAttr, "AttributeTableOfReal");
+ SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+ double aMax = aTableOfReal->GetValue(1, 1);
+
+ for (int i=1; i<=aTableOfReal->GetNbColumns(); i++)
+ for (int j=1; j<=aTableOfReal->GetNbRows(); j++) {
+ double aVal = aTableOfReal->GetValue(j, i);
+ if (aVal > aMax)
+ aMax = aVal;
+ }
+
+ return aMax;
+}
+
+CORBA::Double VISU::PointMap3d_i::GetMax()
+{
+ return myTablePL->GetScalarRange()[1];
+}
+
+void VISU::PointMap3d_i::SetRange(CORBA::Double theMin, CORBA::Double theMax)
+{
+ vtkFloatingPointType aScalarRange[2] = {theMin, theMax};
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, vtkFloatingPointType*>
+ (GetSpecificPL(), &VISU_DeformedGridPL::SetScalarRange, aScalarRange));
+
+ UseFixedRange(true);
+}
+
+CORBA::Double VISU::PointMap3d_i::GetSourceMin()
+{
+ vtkFloatingPointType aRange[2];
+ GetSpecificPL()->GetSourceRange(aRange);
+ return aRange[0];
+}
+
+CORBA::Double VISU::PointMap3d_i::GetSourceMax()
+{
+ vtkFloatingPointType aRange[2];
+ GetSpecificPL()->GetSourceRange(aRange);
+ return aRange[1];
+}
+
+void VISU::PointMap3d_i::SetSourceRange()
+{
+ GetSpecificPL()->SetSourceRange();
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_DeformedGridPL>
+ (GetSpecificPL(), &VISU_DeformedGridPL::SetSourceRange));
+
+ UseFixedRange(false);
+}
+
+CORBA::Boolean VISU::PointMap3d_i::IsRangeFixed()
+{
+ return myIsFixedRange;
+}
+
+void VISU::PointMap3d_i::UseFixedRange(bool theRange)
+{
+ if(myIsFixedRange == theRange)
+ return;
+
+ myIsFixedRange = theRange;
+}
+
+void VISU::PointMap3d_i::SetPosition(CORBA::Double theX, CORBA::Double theY)
+{
+ bool anIsSameValue = VISU::CheckIsSameValue(myPosition[0], theX);
+ anIsSameValue &= VISU::CheckIsSameValue(myPosition[1], theY);
+ if(anIsSameValue)
+ return;
+
+ myPosition[0] = theX;
+ myPosition[1] = theY;
+}
+
+CORBA::Double VISU::PointMap3d_i::GetPosX()
+{
+ return myPosition[0];
+}
+
+CORBA::Double VISU::PointMap3d_i::GetPosY()
+{
+ return myPosition[1];
+}
+
+void VISU::PointMap3d_i::SetSize(CORBA::Double theWidth, CORBA::Double theHeight)
+{
+ bool anIsSameValue = VISU::CheckIsSameValue(myWidth, theWidth);
+ anIsSameValue &= VISU::CheckIsSameValue(myHeight, theHeight);
+ if(anIsSameValue)
+ return;
+
+ myWidth = theWidth;
+ myHeight = theHeight;
+}
+
+CORBA::Double VISU::PointMap3d_i::GetHeight()
+{
+ return myHeight;
+}
+
+CORBA::Double VISU::PointMap3d_i::GetWidth()
+{
+ return myWidth;
+}
+
+void VISU::PointMap3d_i::SetNbColors(CORBA::Long theNbColors)
+{
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, int>
+ (GetSpecificPL(), &VISU_DeformedGridPL::SetNbColors, theNbColors));
+}
+
+CORBA::Long VISU::PointMap3d_i::GetNbColors()
+{
+ return GetSpecificPL()->GetNbColors();
+}
+
+void VISU::PointMap3d_i::SetLabels(CORBA::Long theNbLabels)
+{
+ if(myNumberOfLabels == theNbLabels)
+ return;
+
+ myNumberOfLabels = theNbLabels;
+}
+
+CORBA::Long VISU::PointMap3d_i::GetLabels()
+{
+ return myNumberOfLabels;
+}
+
+void VISU::PointMap3d_i::SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theBarOrientation)
+{
+ if(myBarOrientation == theBarOrientation)
+ return;
+
+ myBarOrientation = theBarOrientation;
+}
+
+VISU::ColoredPrs3dBase::Orientation VISU::PointMap3d_i::GetBarOrientation()
+{
+ return myBarOrientation;
+}
+
+//------------------- ScaledPrs3d Methods -----------------------
+
+void VISU::PointMap3d_i::SetScaling(VISU::Scaling theScaling)
+{
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, int>
+ (GetSpecificPL(), &VISU_DeformedGridPL::SetScaling, theScaling));
+}
+
+VISU::Scaling VISU::PointMap3d_i::GetScaling()
+{
+ return VISU::Scaling(GetSpecificPL()->GetScaling());
+}
+
+//------------------- Check Table on Positive Values ------------
+bool VISU::PointMap3d_i::IsPositiveTable()
+{
+ SALOMEDS::GenericAttribute_var anAttr;
+ mySObj->FindAttribute(anAttr, "AttributeTableOfReal");
+ SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+
+ for (int i=1; i<=aTableOfReal->GetNbColumns(); i++)
+ for (int j=1; j<=aTableOfReal->GetNbRows(); j++) {
+ double aVal = aTableOfReal->GetValue(j, i);
+ if (aVal < 0)
+ return false;
+ }
+
+ return true;
+}
+
+//------------------- Plot3dBase Methods ------------------------
+
+void VISU::PointMap3d_i::SetScaleFactor (CORBA::Double theScaleFactor)
+{
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, vtkFloatingPointType>
+ (GetSpecificPL(), &VISU_DeformedGridPL::SetScaleFactor, theScaleFactor));
+}
+
+CORBA::Double VISU::PointMap3d_i::GetScaleFactor ()
+{
+ return myTablePL->GetScaleFactor();
+}
+
+void VISU::PointMap3d_i::SetContourPrs (CORBA::Boolean theIsContourPrs )
+{
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, bool>
+ (GetSpecificPL(), &VISU_DeformedGridPL::SetContourPrs, theIsContourPrs));
+}
+
+CORBA::Boolean VISU::PointMap3d_i::GetIsContourPrs()
+{
+ return myTablePL->GetIsContourPrs();
+}
+
+void VISU::PointMap3d_i::SetNbOfContours (CORBA::Long theNb)
+{
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, int>
+ (GetSpecificPL(), &VISU_DeformedGridPL::SetNumberOfContours, theNb));
+}
+
+CORBA::Long VISU::PointMap3d_i::GetNbOfContours ()
+{
+ return myTablePL->GetNumberOfContours();
+}
+
+//-------------------- Actor Factory Methods --------------------
+
+bool VISU::PointMap3d_i::GetActiveState ()
+{
+ return myIsActiveState;
+}
+
+void VISU::PointMap3d_i::SetActiveState ( bool theState )
+{
+ myIsActiveState = theState;
+}
+
+void VISU::PointMap3d_i::RemoveActor (VISU_ActorBase* theActor)
+{
+ myActorCollection->RemoveItem(theActor);
+}
+
+void VISU::PointMap3d_i::RemoveActors ()
+{
+ ProcessVoidEvent(new TInvokeSignalEvent(myRemoveActorsFromRendererSignal));
+ myActorCollection->RemoveAllItems();
+}
+
+
+//-----------------------Text Properties & Label Properties------------------
+bool VISU::PointMap3d_i::IsBoldTitle()
+{
+ return myIsBoldTitle;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetBoldTitle(bool theIsBoldTitle)
+{
+ if(myIsBoldTitle == theIsBoldTitle)
+ return;
+
+ myIsBoldTitle = theIsBoldTitle;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+bool VISU::PointMap3d_i::IsItalicTitle()
+{
+ return myIsItalicTitle;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetItalicTitle(bool theIsItalicTitle)
+{
+ if(myIsItalicTitle == theIsItalicTitle)
+ return;
+
+ myIsItalicTitle = theIsItalicTitle;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+bool VISU::PointMap3d_i::IsShadowTitle()
+{
+ return myIsShadowTitle;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetShadowTitle(bool theIsShadowTitle)
+{
+ if(myIsShadowTitle == theIsShadowTitle)
+ return;
+
+ myIsShadowTitle = theIsShadowTitle;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+int VISU::PointMap3d_i::GetTitFontType()
+{
+ return myTitFontType;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetTitFontType(int theTitFontType)
+{
+ if(myTitFontType == theTitFontType)
+ return;
+
+ myTitFontType = theTitFontType;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::GetTitleColor(vtkFloatingPointType& theR,
+ vtkFloatingPointType& theG,
+ vtkFloatingPointType& theB)
+{
+ theR = myTitleColor[0];
+ theG = myTitleColor[1];
+ theB = myTitleColor[2];
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetTitleColor(vtkFloatingPointType theR,
+ vtkFloatingPointType theG,
+ vtkFloatingPointType theB)
+{
+ bool anIsSameValue = VISU::CheckIsSameValue(myTitleColor[0], theR);
+ anIsSameValue &= VISU::CheckIsSameValue(myTitleColor[1], theG);
+ anIsSameValue &= VISU::CheckIsSameValue(myTitleColor[2], theB);
+ if(anIsSameValue)
+ return;
+
+ myTitleColor[0] = theR;
+ myTitleColor[1] = theG;
+ myTitleColor[2] = theB;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+bool VISU::PointMap3d_i::IsBoldLabel()
+{
+ return myIsBoldLabel;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetBoldLabel(bool theIsBoldLabel)
+{
+ if(myIsBoldLabel == theIsBoldLabel)
+ return;
+
+ myIsBoldLabel = theIsBoldLabel;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+bool VISU::PointMap3d_i::IsItalicLabel()
+{
+ return myIsItalicLabel;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetItalicLabel(bool theIsItalicLabel)
+{
+ if(myIsItalicLabel == theIsItalicLabel)
+ return;
+
+ myIsItalicLabel = theIsItalicLabel;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+bool VISU::PointMap3d_i::IsShadowLabel()
+{
+ return myIsShadowLabel;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetShadowLabel(bool theIsShadowLabel)
+{
+ if(myIsShadowLabel == theIsShadowLabel)
+ return;
+
+ myIsShadowLabel = theIsShadowLabel;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+int VISU::PointMap3d_i::GetLblFontType()
+{
+ return myLblFontType;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetLblFontType(int theLblFontType)
+{
+ if(myLblFontType == theLblFontType)
+ return;
+
+ myLblFontType = theLblFontType;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::GetLabelColor(vtkFloatingPointType& theR,
+ vtkFloatingPointType& theG,
+ vtkFloatingPointType& theB)
+{
+ theR = myLabelColor[0];
+ theG = myLabelColor[1];
+ theB = myLabelColor[2];
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetLabelColor(vtkFloatingPointType theR,
+ vtkFloatingPointType theG,
+ vtkFloatingPointType theB)
+{
+ bool anIsSameValue = VISU::CheckIsSameValue(myLabelColor[0], theR);
+ anIsSameValue &= VISU::CheckIsSameValue(myLabelColor[1], theG);
+ anIsSameValue &= VISU::CheckIsSameValue(myLabelColor[2], theB);
+ if(anIsSameValue)
+ return;
+
+ myLabelColor[0] = theR;
+ myLabelColor[1] = theG;
+ myLabelColor[2] = theB;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long VISU::PointMap3d_i::GetTitleWidth()
+{
+ return myTitleWidth;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long VISU::PointMap3d_i::GetTitleHeight()
+{
+ return myTitleHeight;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long VISU::PointMap3d_i::GetLabelWidth()
+{
+ return myLabelWidth;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long VISU::PointMap3d_i::GetLabelHeight()
+{
+ return myLabelHeight;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long VISU::PointMap3d_i::GetBarWidth()
+{
+ return myBarWidth;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long VISU::PointMap3d_i::GetBarHeight()
+{
+ return myBarHeight;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::PointMap3d_i::SetLabelsFormat(const char* theFormat)
+{
+ if( myLabelsFormat != theFormat ){
+ myLabelsFormat = theFormat;
+ myParamsTime.Modified();
+ }
+}
+
+//----------------------------------------------------------------------------
+char* VISU::PointMap3d_i::GetLabelsFormat()
+{
+ return CORBA::string_dup(myLabelsFormat.c_str());
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetUnitsVisible(CORBA::Boolean isVisible)
+{
+ if( myIsUnits != isVisible ){
+ myIsUnits = isVisible;
+ myParamsTime.Modified();
+ }
+}
+
+//----------------------------------------------------------------------------
+CORBA::Boolean VISU::PointMap3d_i::IsUnitsVisible()
+{
+ return myIsUnits;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetRatios(CORBA::Long theTitleWidth, CORBA::Long theTitleHeight,
+ CORBA::Long theLabelWidth, CORBA::Long theLabelHeight,
+ CORBA::Long theBarWidth, CORBA::Long theBarHeight)
+{
+ bool anIsSameValue = VISU::CheckIsSameValue(myTitleWidth, theTitleWidth);
+ anIsSameValue &= VISU::CheckIsSameValue(myTitleHeight, theTitleHeight);
+ anIsSameValue &= VISU::CheckIsSameValue(myLabelWidth, theLabelWidth);
+ anIsSameValue &= VISU::CheckIsSameValue(myLabelHeight, theLabelHeight);
+ anIsSameValue &= VISU::CheckIsSameValue(myBarWidth, theBarWidth);
+ anIsSameValue &= VISU::CheckIsSameValue(myBarHeight, theBarHeight);
+ if(anIsSameValue)
+ return;
+
+ myTitleWidth = theTitleWidth;
+ myTitleHeight = theTitleHeight;
+ myLabelWidth = theLabelWidth;
+ myLabelHeight = theLabelHeight;
+ myBarWidth = theBarWidth;
+ myBarHeight = theBarHeight;
+ myParamsTime.Modified();
+}
--- /dev/null
+// 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_PointMap3d_i.hh
+// Author :
+// Module : VISU
+
+#ifndef VISU_PointMap3d_i_HeaderFile
+#define VISU_PointMap3d_i_HeaderFile
+
+#include "VISU_PrsObject_i.hh"
+#include "SALOME_GenericObj_i.hh"
+
+#include "VISU_TableReader.hxx"
+#include "VISU_PointMap3dActor.h"
+#include "VISU_Table_i.hh"
+#include "VISU_ActorFactory.h"
+#include "VISU_DeformedGridPL.hxx"
+
+#include <vtkTimeStamp.h>
+#include <qstringlist.h>
+
+#include <vtkSmartPointer.h>
+
+namespace VISU
+{
+
+ struct TActorFactory;
+
+ //==============================================================================
+ class VISU_I_EXPORT PointMap3d_i : public virtual POA_VISU::PointMap3d,
+ public virtual SALOME::GenericObj_i,
+ public virtual TActorFactory,
+ public virtual Table_i
+ {
+ static int myNbPresent;
+ PointMap3d_i( const PointMap3d_i& );
+ public:
+ PointMap3d_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry);
+
+ virtual ~PointMap3d_i();
+ virtual VISU::VISUType GetType() { return VISU::TPOINTMAP3D;};
+
+ virtual void SetTitle( const char* theTitle );
+ virtual char* GetTitle();
+
+ virtual void RemoveFromStudy();
+ virtual void UpdateActor(VISU_ActorBase* thePointMap3dActor);
+ virtual void UpdateActors();
+
+ virtual void Update();
+
+ virtual Handle(SALOME_InteractiveObject) GetIO();
+
+ //----------- override Prs3d methods -----------------------------
+
+ //! Move the 3D presentation according to the given offset parameters
+ virtual void SetOffset(CORBA::Float theDx, CORBA::Float theDy, CORBA::Float theDz);
+
+ //! Gets offset parameters for the 3D presentation
+ virtual void GetOffset(CORBA::Float& theDx, CORBA::Float& theDy, CORBA::Float& theDz);
+
+ //! Gets memory size actually used by the presentation (Mb).
+ virtual CORBA::Float GetMemorySize();
+
+ //----------- override ColoredPrs3dBase methods ------------------
+
+ virtual CORBA::Double GetMin();
+ virtual CORBA::Double GetMax();
+ virtual CORBA::Double GetMinTableValue();
+ virtual CORBA::Double GetMaxTableValue();
+ virtual void SetRange(CORBA::Double theMin, CORBA::Double theMax);
+
+ virtual CORBA::Double GetSourceMin();
+ virtual CORBA::Double GetSourceMax();
+ virtual void SetSourceRange();
+
+ virtual CORBA::Boolean IsRangeFixed();
+
+ virtual void SetPosition(CORBA::Double X, CORBA::Double Y);
+ virtual CORBA::Double GetPosX();
+ virtual CORBA::Double GetPosY();
+
+ virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight);
+
+ virtual void SetRatios(CORBA::Long theTitleWidth, CORBA::Long theTitleHeight,
+ CORBA::Long theLabelWidth, CORBA::Long theLabelHeight,
+ CORBA::Long theBarWidth, CORBA::Long theBarHeight);
+
+ virtual CORBA::Double GetWidth();
+ virtual CORBA::Double GetHeight();
+
+ virtual void SetNbColors(CORBA::Long theNbColors);
+ virtual CORBA::Long GetNbColors();
+
+ virtual void SetLabels(CORBA::Long theNbLabels);
+ virtual CORBA::Long GetLabels();
+
+ virtual void SetLabelsFormat(const char* theFormat);
+ virtual char* GetLabelsFormat();
+
+ virtual void SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theOrientation);
+ virtual VISU::ColoredPrs3dBase::Orientation GetBarOrientation();
+
+ void UseFixedRange(bool theUseFixedRange);
+
+ // ScaledMap Methods
+
+ virtual VISU::Scaling GetScaling();
+ virtual void SetScaling(VISU::Scaling theScaling);
+
+ bool IsPositiveTable();
+
+ // Plot3dBase methods
+
+ void SetScaleFactor (CORBA::Double theScaleFactor);
+ CORBA::Double GetScaleFactor();
+
+ void SetContourPrs (CORBA::Boolean theIsContourPrs );
+ CORBA::Boolean GetIsContourPrs();
+
+ void SetNbOfContours (CORBA::Long);
+ CORBA::Long GetNbOfContours();
+
+ VISU_DeformedGridPL* GetSpecificPL() const { return myTablePL; }
+
+ // TActorFactory Methods
+
+ //! Gets know whether the factory instance can be used for actor management or not
+ virtual bool GetActiveState();
+
+ virtual void SetActiveState(bool theState);
+
+ //! Return modified time of the factory
+ virtual unsigned long int GetMTime();
+
+ //! To unregister the actor
+ virtual void RemoveActor(VISU_ActorBase* theActor);
+ virtual void RemoveActors();
+
+ //------ Text Properties & Label Properties ------------------------
+
+ virtual bool IsBoldTitle();
+ virtual void SetBoldTitle(bool isBold);
+ virtual bool IsItalicTitle();
+ virtual void SetItalicTitle(bool isItalic);
+ virtual bool IsShadowTitle();
+ virtual void SetShadowTitle(bool isShadow);
+ virtual int GetTitFontType();
+ virtual void SetTitFontType(int theType);
+ virtual void GetTitleColor(vtkFloatingPointType& theR,
+ vtkFloatingPointType& theG,
+ vtkFloatingPointType& theB);
+ virtual void SetTitleColor(vtkFloatingPointType theR,
+ vtkFloatingPointType theG,
+ vtkFloatingPointType theB);
+
+ virtual bool IsBoldLabel();
+ virtual void SetBoldLabel(bool isBold);
+ virtual bool IsItalicLabel();
+ virtual void SetItalicLabel(bool isItalic);
+ virtual bool IsShadowLabel();
+ virtual void SetShadowLabel(bool isShadow);
+ virtual int GetLblFontType();
+ virtual void SetLblFontType(int theType);
+ virtual void GetLabelColor(vtkFloatingPointType& theR,
+ vtkFloatingPointType& theG,
+ vtkFloatingPointType& theB);
+ virtual void SetLabelColor(vtkFloatingPointType theR,
+ vtkFloatingPointType theG,
+ vtkFloatingPointType theB);
+
+ //-------------------------------------------------------------------
+ virtual CORBA::Long GetTitleWidth();
+ virtual CORBA::Long GetTitleHeight();
+ virtual CORBA::Long GetLabelWidth();
+ virtual CORBA::Long GetLabelHeight();
+ virtual CORBA::Long GetBarWidth();
+ virtual CORBA::Long GetBarHeight();
+
+ virtual void SetUnitsVisible(CORBA::Boolean isVisible);
+ virtual CORBA::Boolean IsUnitsVisible();
+
+ //-------------------------------------------------------------------
+
+ protected:
+ Storable* Build(int theRestoring);
+
+ VISU::Table::Orientation myOrientation;
+ VISU::ColoredPrs3dBase::Orientation myBarOrientation;
+ std::string myTitle;
+ std::string myScalarBarTitle;
+ bool myIsUnits;
+ SALOMEDS::SObject_var mySObj;
+ int myNumberOfLabels;
+ std::string myLabelsFormat;
+ vtkFloatingPointType myPosition[2],
+ myWidth, myHeight,
+ myTitleWidth, myTitleHeight,
+ myLabelWidth, myLabelHeight,
+ myBarWidth, myBarHeight;
+ bool myIsFixedRange;
+ CORBA::Float myOffset[3];
+ bool myIsActiveState;
+ vtkTimeStamp myParamsTime;
+ vtkTimeStamp myUpdateTime;
+
+ Handle(SALOME_InteractiveObject) myIO;
+
+
+ //Font management
+ bool myIsBoldTitle;
+ bool myIsItalicTitle;
+ bool myIsShadowTitle;
+ int myTitFontType;
+ vtkFloatingPointType myTitleColor[3];
+
+ bool myIsBoldLabel;
+ bool myIsItalicLabel;
+ bool myIsShadowLabel;
+ int myLblFontType;
+ vtkFloatingPointType myLabelColor[3];
+
+ boost::signal0<void> myUpdateActorsSignal;
+ boost::signal0<void> myRemoveActorsFromRendererSignal;
+ vtkSmartPointer<vtkActorCollection> myActorCollection;
+
+ public:
+ // virtual Storable* Create( const VISU::PTableIDMapper& theTableIDMapper );
+ virtual Storable* Create();
+ VISU_PointMap3dActor* CreateActor();
+ VISU::PTableIDMapper GetTableIDMapper();
+
+ SALOMEDS::SObject_var GetSObject() const;
+ VISU_DeformedGridPL* myTablePL;
+
+ virtual Storable* Restore( const Storable::TRestoringMap& theMap,
+ SALOMEDS::SObject_ptr SO);
+
+ static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile);
+
+ virtual void ToStream( std::ostringstream& theStr );
+ static const std::string myComment;
+ virtual const char* GetComment() const;
+ virtual QString GenerateName();
+ virtual QString GetTableTitle();
+
+ virtual std::string GetObjectEntry();
+ };
+}
+
+#endif
--- /dev/null
+import os
+import VISU
+from visu_gui import *
+
+aTableFile = os.getenv('DATA_DIR') + '/Tables/table_test.xls'
+
+aTableSObject = myVisu.ImportTables(aTableFile)
+
+aTable = None
+if aTableSObject:
+ anIsFound, aSObject = aTableSObject.FindSubObject(1)
+ if anIsFound:
+ aTable = aSObject.GetObject()
+
+aViewManager = myVisu.GetViewManager();
+aView = aViewManager.Create3DView()
+if aView is None : print "Creating View Error"
+print aTable
+
+##########Get Values################
+aScaleFactor = aTable.GetScaleFactor();
+anIsContourPrs = aTable.GetIsContourPrs();
+aNbOfContours = aTable.GetNbOfContours();
+aScaling = aTable.GetScaling();
+aMin = aTable.GetMin();
+aMax = aTable.GetMax();
+aSourceMin = aTable.GetSourceMin();
+aSourceMax = aTable.GetSourceMax();
+aPosX = aTable.GetPosX();
+aPosY = aTable.GetPosY();
+aHeight = aTable.GetHeight();
+aWidth = aTable.GetWidth();
+aNbColors = aTable.GetNbColors();
+aLabels = aTable.GetLabels();
+aBarOrientation = aTable.GetBarOrientation();
+
+
+print "Get Values:"
+print "aScaleFactor = ", aScaleFactor
+print "anIsContourPrs = ", anIsContourPrs
+print "aNbOfContours = ", aNbOfContours
+print "aScaling = ", aScaling
+print "===== SCALAR BAR ======="
+print "aMin = ", aMin
+print "aMax = ", aMax
+print "aSourceMin = ", aSourceMin
+print "aSourceMax = ", aSourceMax
+print "aPosX = ", aPosX
+print "aPosY = ", aPosY
+print "aHeight = ", aHeight
+print "aWidth = ", aWidth
+print "aNbColors = ", aNbColors
+print "aLabels = ", aLabels
+print "aBarOrientation = ", aBarOrientation
+
+aView.DisplayOnly( aTable )
+aView.FitAll()
\ No newline at end of file