/*!
-\page scalar_map_on_deformed_shape_page Scalar Map on Deformed Shape presentation
+\page scalar_map_on_deformed_shape_page Deformed Shape and Scalar Map presentation
-\n <b>Scalar Map on Deformed Shape</b> presentation is a mix of the
+\n <b>Deformed Shape and Scalar Map</b> presentation is a mix of the
two: \ref scalar_map_page "Scalar Map" and \ref deformed_shape_page
"Deformed Shape". In this presentation the Scalar Map is built on a
Deformed Shape.
-<em>To create a Scalar Map on Deformed Shape presentation:</em>
+<em>To create a Deformed Shape and Scalar Map presentation:</em>
\par
– Right-click on one of the time stamps of the field in the
-Object browser and from the pop-up menu choose <b>Scalar Map on
-Deformed Shape</b>, or
+Object browser and from the pop-up menu choose <b>Deformed Shape and
+Scalar Map</b>, or
\n – Click on one of the time stamps of the field in the Object
-browser and select from the main menu <b>Visualization > Scalar Map on
-Deformed Shape</b>, or click <em>"Scalar Map on Deformed Shape"</em>
+browser and select from the main menu <b>Visualization > Deformed Shape and
+Scalar Map</b>, or click <em>"Deformed Shape and Scalar Map"</em>
icon in the <b>Visualization Toolbar</b>.
\image html image40.gif
-<center><em>"Scalar Map on Deformed Shape" icon</em></center>
+<center><em>"Deformed Shape and Scalar Map" icon</em></center>
\image html smds1.png
\par
-<b>Scalar Map on Deformed Shape</b> tab allows you to set additional
-parameters of your Scalar Map on Deformed Shape presentation:
+<b>Deformed Shape and Scalar Map</b> tab allows you to set additional
+parameters of your Deformed Shape and Scalar Map presentation:
<ul>
<li><b>Scale Factor:</b> visualization scaling of all vector values
applied to the cells of the mesh.</li>
\image html smds-example1.png
-with Scalar Map on Deformed Shape presentation:
+with Deformed Shape and Scalar Map presentation:
\image html smds-example.png
<li><b>Show preview</b> check box allows to edit the parameters of the
presentation and simultaneously observe the preview of this
presentation in the viewer.</li>
+<li><b>Deformation</b> allows to switch on/off deformation of the
+planes.</li>
+<li><b>Vectors</b> allows to choose a vectorial field for deformation.</li>
+<li><b>Scale Factor</b> allows to set the scaling ratio for all vector values.</li>
</ul>
</ul>
\image html cutplpresent.png
-*/
\ No newline at end of file
+*/
<li>\ref importing_exporting_tables_page</li>
<li>\ref displaying_tables_page</li>
<li>\ref creating_tables_from_cut_lines_page</li>
+<li>\ref table_3d_page</li>
</ul>
<li>\subpage xy_plots_page</li>
<ul>
--- /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
<li>\subpage importing_exporting_tables_page</li>
<li>\subpage displaying_tables_page</li>
<li>\subpage creating_tables_from_cut_lines_page</li>
+<li>\subpage table_3d_page</li>
</ul>
*/
\ No newline at end of file
<tr><td class="mdescLeft"> </td><td class="mdescRight">Deformed shape presentation interface. <a href="interfaceVISU_1_1DeformedShape.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">interface </td><td class="memItemRight" valign="bottom"><a class="el" href="interfaceVISU_1_1ScalarMapOnDeformedShape.html">VISU.ScalarMapOnDeformedShape</a></td></tr>
-<tr><td class="mdescLeft"> </td><td class="mdescRight">Scalar Map on Deformed shape presentation interface. <a href="interfaceVISU_1_1ScalarMapOnDeformedShape.html#_details">More...</a><br></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Deformed shape and Scalar Map presentation interface. <a href="interfaceVISU_1_1ScalarMapOnDeformedShape.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">interface </td><td class="memItemRight" valign="bottom"><a class="el" href="interfaceVISU_1_1Plot3D.html">VISU.Plot3D</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="interfaceVISU_1_1Plot3D.html">Plot3D</a> interface. <a href="interfaceVISU_1_1Plot3D.html#_details">More...</a><br></td></tr>
<!-- Generated by Doxygen 1.4.7 -->
<div class="nav">
<a class="el" href="namespaceVISU.html">VISU</a>.<a class="el" href="interfaceVISU_1_1ScalarMapOnDeformedShape.html">ScalarMapOnDeformedShape</a></div>
-<h1>VISU.ScalarMapOnDeformedShape Interface Reference</h1><!-- doxytag: class="VISU::ScalarMapOnDeformedShape" --><!-- doxytag: inherits="VISU::ScalarMap" -->Scalar Map on Deformed shape presentation interface.
+<h1>VISU.ScalarMapOnDeformedShape Interface Reference</h1><!-- doxytag: class="VISU::ScalarMapOnDeformedShape" --><!-- doxytag: inherits="VISU::ScalarMap" -->Deformed shape and Scalar Map presentation interface.
<a href="#_details">More...</a>
<p>
<code>import "VISU_Gen.idl";</code>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Deformed shape presentation interface. <a href="interfaceVISU_1_1DeformedShape.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">interface </td><td class="memItemRight" valign="bottom"><a class="el" href="interfaceVISU_1_1ScalarMapOnDeformedShape.html">ScalarMapOnDeformedShape</a></td></tr>
-<tr><td class="mdescLeft"> </td><td class="mdescRight">Scalar Map on Deformed shape presentation interface. <a href="interfaceVISU_1_1ScalarMapOnDeformedShape.html#_details">More...</a><br></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Deformed shape and Scalar Map presentation interface. <a href="interfaceVISU_1_1ScalarMapOnDeformedShape.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">interface </td><td class="memItemRight" valign="bottom"><a class="el" href="interfaceVISU_1_1Plot3D.html">Plot3D</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="interfaceVISU_1_1Plot3D.html">Plot3D</a> interface. <a href="interfaceVISU_1_1Plot3D.html#_details">More...</a><br></td></tr>
aTE("Plot 3D presentation","plot_3d_presentation.htm");
aTE("Primitive Types","primitive_types.htm");
aTE("Scalar Bar","scalar_bar.htm");
-aTE("Scalar Map on Deformed Shape presentation","scalar_map_on_deformed_shape_presentation.htm");
+aTE("Deformed Shape and Scalar Map presentation","scalar_map_on_deformed_shape_presentation.htm");
aTE("Segmentation","segmentation.htm");
aTE("Types of Gauss Points Presentations","types_of_gauss_points_presentations.htm");
aTE("VTK 3D Viewer","vtk_3d_viewer.htm");
aTE(2,0,"Deformed Shape presentation","files/deformed_shape_presentation.htm");
aTE(2,0,"Vectors Presentation","files/vectors_presentation.htm");
aTE(2,0,"Stream Lines presentation","files/stream_lines_presentation.htm");
- aTE(2,0,"Scalar Map on Deformed Shape presentation","scalar_map_on_deformed_shape_presentation.htm");
+ aTE(2,0,"Deformed Shape and Scalar Map presentation","scalar_map_on_deformed_shape_presentation.htm");
aTE(2,0,"Plot 3D presentation","plot_3d_presentation.htm");
aTE(2,0,"Animating presentations","files/animating_presentations.htm");
aTE(1,9,"Gauss Points Presentations");
<nobr><a href="../files/deformed_shape_presentation.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Deformed Shape presentation</a></nobr><br>
<nobr><a href="../files/vectors_presentation.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Vectors Presentation</a></nobr><br>
<nobr><a href="../files/stream_lines_presentation.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Stream Lines presentation</a></nobr><br>
- <nobr><a href="../scalar_map_on_deformed_shape_presentation.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Scalar Map on Deformed Shape presentation</a></nobr><br>
+ <nobr><a href="../scalar_map_on_deformed_shape_presentation.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Deformed Shape and Scalar Map presentation</a></nobr><br>
<nobr><a href="../plot_3d_presentation.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Plot 3D presentation</a></nobr><br>
<nobr><a href="../files/animating_presentations.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Animating presentations</a></nobr><br>
<nobr><a name="4"></a><a href="whlstt4.htm#4" target="_self" title="closed book"><img src="../whd_toc1.gif" border="0" align="absmiddle"> Gauss Points Presentations</a></nobr><br>
<nobr><a href="../files/deformed_shape_presentation.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Deformed Shape presentation</a></nobr><br>
<nobr><a href="../files/vectors_presentation.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Vectors Presentation</a></nobr><br>
<nobr><a href="../files/stream_lines_presentation.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Stream Lines presentation</a></nobr><br>
- <nobr><a href="../scalar_map_on_deformed_shape_presentation.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Scalar Map on Deformed Shape presentation</a></nobr><br>
+ <nobr><a href="../scalar_map_on_deformed_shape_presentation.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Deformed Shape and Scalar Map presentation</a></nobr><br>
<nobr><a href="../plot_3d_presentation.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Plot 3D presentation</a></nobr><br>
<nobr><a href="../files/animating_presentations.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Animating presentations</a></nobr><br>
<nobr><a name="4"></a><a href="whlstt3.htm#4" target="_self"><img src="../whd_toc2.gif" border="0" align="absmiddle"> Gauss Points Presentations</a></nobr><br>
<topic name="Plot 3D presentation" url="plot_3d_presentation.htm" />
<topic name="Primitive Types" url="primitive_types.htm" />
<topic name="Scalar Bar" url="scalar_bar.htm" />
-<topic name="Scalar Map on Deformed Shape presentation" url="scalar_map_on_deformed_shape_presentation.htm" />
+<topic name="Deformed Shape and Scalar Map presentation" url="scalar_map_on_deformed_shape_presentation.htm" />
<topic name="Segmentation" url="segmentation.htm" />
<topic name="Types of Gauss Points Presentations" url="types_of_gauss_points_presentations.htm" />
<topic name="VTK 3D Viewer" url="vtk_3d_viewer.htm" />
<item name="Deformed Shape presentation" url="files/deformed_shape_presentation.htm" />
<item name="Vectors Presentation" url="files/vectors_presentation.htm" />
<item name="Stream Lines presentation" url="files/stream_lines_presentation.htm" />
- <item name="Scalar Map on Deformed Shape presentation" url="scalar_map_on_deformed_shape_presentation.htm" />
+ <item name="Deformed Shape and Scalar Map presentation" url="scalar_map_on_deformed_shape_presentation.htm" />
<item name="Plot 3D presentation" url="plot_3d_presentation.htm" />
<item name="Animating presentations" url="files/animating_presentations.htm" />
<book name="Gauss Points Presentations" >
TSCALARMAP, /*!< Scalarmap 3D presentation object */
TISOSURFACES, /*!< Iso surface 3D presentation object */
TDEFORMEDSHAPE, /*!< Deformed shape 3D presentation object */
- TSCALARMAPONDEFORMEDSHAPE, /*!< Scalar map on deformed shape 3D presentation object */
+ TSCALARMAPONDEFORMEDSHAPE, /*!< Scalar map on deformed shape 3D presentation object. It is obsolete. Use TDEFORMEDSHAPEANDSCALARMAP instead */
+ TDEFORMEDSHAPEANDSCALARMAP, /*!< Deformed shape and scalar map 3D presentation object */
TGAUSSPOINTS, /*!< Gauss Points 3D presentation object */
TPLOT3D, /*!< Plot3D 3D presentation object */
TPOINTMAP3D, /*!< 3D presentation for table object */
long GetFaceLimit();
};
- /*! \brief Deformed shape presentation interface
+
+ /*! \brief MonoColor presentation presentation interface
*
- * Presentation parameters of the deformed shape presentation.
+ * Presentation parameters of the MonoColor presentation.
*/
- interface DeformedShape : ScalarMap
- {
- /*!
- * Sets the scale of the presentatable object.
- * \param theScale Double value defining the scale of this presentable object.
- */
- void SetScale(in double theScale);
-
- /*!
- * Gets the scale of the presentatable object.
- */
- double GetScale();
+ interface MonoColorPrs : ScalarMap {
/*! This boolean method returns True if this deformed shape presentation is colored.
*/
};
+ /*! \brief Deformed shape presentation interface
+ *
+ * Presentation parameters of the deformed shape presentation.
+ */
+ interface DeformedShape : MonoColorPrs
+ {
+ /*!
+ * Sets the scale of the presentatable object.
+ * \param theScale Double value defining the scale of this presentable object.
+ */
+ void SetScale(in double theScale);
+
+ /*!
+ * Gets the scale of the presentatable object.
+ */
+ double GetScale();
+
+ };
+
+ //-------------------------------------------------------
+ /*! \brief Deformation interface
+ *
+ * This is base interface for building of the deformed presentations
+ */
+ interface Deformation{
+ /*!
+ * Sets the scale of the presentatable object.
+ * \param theScale Double value defining the scale of this presentable object.
+ */
+ void SetScale(in double theScale);
+
+ /*!
+ * Gets the scale of the presentatable object.
+ */
+ double GetScale();
+
+ /*!
+ * Sets the vectorial field
+ * \param theEntity - entity of vectorial field
+ * \param theFieldName - the name of vectorial field
+ */
+ void SetVectorialField(in Entity theEntity,
+ in string theFieldName);
+
+ /*!
+ * Get vectorial entity
+ */
+ Entity GetVectorialFieldEntity();
+
+ /*!
+ * Get scalar field name
+ */
+ string GetVectorialFieldName();
+
+ };
+
+ //-------------------------------------------------------
+ /*! \brief OptionalDeformation interface
+ *
+ * This is interface for switch on/off of the deformation of the presentation
+ */
+ interface OptionalDeformation : Deformation{
+
+ /*!
+ * Sets the deformation flag of the presentatable object.
+ * \param theFlag Boolean value defining the deformation flag of this presentable object.
+ */
+ void UseDeformation(in boolean theFlag);
+
+ /*!
+ * Gets the deformation flag of the presentatable object.
+ */
+ boolean IsDeformed();
+ };
+
//-------------------------------------------------------
/*! \brief Scalar Map on Deformed shape presentation interface
*
* Presentation parameters of the scalar map on deformed shape presentation.
*/
- interface ScalarMapOnDeformedShape : ScalarMap {
+ interface DeformedShapeAndScalarMap : ScalarMap {
/*!
* Sets the scale of the presentatable object.
* consists of cutting your initial mesh by a definite number of planes. As the
* result you will see these planes which will be cutted by the borders of the mesh.
*/
- interface CutPlanes : ScalarMap {
+ interface CutPlanes : ScalarMap, OptionalDeformation {
/*!
* This enumeration contains a set of elements defining the type of orientation in 3D space
* of the cut planes.
* Streamlines are used to convey the structure of a vector field.
* Usually streamlines are created to explore the most interesting features in the field.
*/
- interface StreamLines : DeformedShape {
+ interface StreamLines : MonoColorPrs {
/*! This enumerations contains a set of elements necessary
* for definition of direction of the stream lines.
*/
* values on the cells and on the basis of them constructs
* isobaric surfaces, which form this presentation.
*/
- interface IsoSurfaces : ScalarMap {
+ interface IsoSurfaces : MonoColorPrs {
/*!
* Sets the number of isometric surfaces.
* \param theNb A long value defining the number of isometric surfaces
* Gets the number of isometric surfaces
*/
long GetNbSurfaces();
+
+ /*!
+ * Returns TRUE if labels with values are shown
+ */
+ boolean IsLabeled();
+
+ /*!
+ * Set show or not value labels
+ */
+ void ShowLabels(in boolean theShow, in long theNb);
+
+ /*!
+ * Returns Nb of labels per surface
+ */
+ long GetNbLabels();
+
};
//-------------------------------------------------------
in Entity theEntity, in string theFieldName,
in long theTimeStampNumber);
+ /*!
+ * Creates a deformed shape presentation. This function is obsolete. Use DeformedShapeAndScalarMapOnField instead.
+ * \param theResult Data generated in other sources. (MED object or file)
+ * \param theMeshName One of the meshes presented in MED file
+ * \param theEntity Type of entity where the field is defined
+ * \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
+ * \param theTimeStampNumber Number of iteration on the field
+ */
+ DeformedShapeAndScalarMap ScalarMapOnDeformedShapeOnField(in Result theResult, in string theMeshName,
+ in Entity theEntity, in string theFieldName,
+ in long theTimeStampNumber);
+
/*!
* Creates a deformed shape presentation.
* \param theResult Data generated in other sources. (MED object or file)
* \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
* \param theTimeStampNumber Number of iteration on the field
*/
- ScalarMapOnDeformedShape ScalarMapOnDeformedShapeOnField(in Result theResult, in string theMeshName,
- in Entity theEntity, in string theFieldName,
- in long theTimeStampNumber);
+ DeformedShapeAndScalarMap DeformedShapeAndScalarMapOnField(in Result theResult, in string theMeshName,
+ in Entity theEntity, in string theFieldName,
+ in long theTimeStampNumber);
/*!
* Creates a vector presentation.
salomeinclude_HEADERS= \
VISU_TypeList.hxx \
+ VISU_VTKTypeList.hxx \
VISU_IDMapper.hxx \
VISU_ConvertorDef.hxx \
VISU_Structures.hxx \
VISU_ConvertorDef_impl.hxx \
VISU_Structures_impl.hxx \
VISU_MeshValue.hxx \
+ VISU_ElnoMeshValue.hxx \
VISU_PointCoords.hxx \
VISU_Convertor_impl.hxx \
VISU_ConvertorUtils.hxx \
#include <QStringList>
+#include "utilities.h"
+
using namespace std;
#ifdef DEBUG
vtkDataSet* aDataSet = aGaussMesh->GetOutput();
aDataSet->Update();
int aNbCells = aDataSet->GetNumberOfCells();
- cout<<"aNbCells = "<<aNbCells<<endl;
+ MESSAGE("aNbCells = "<<aNbCells);
for(int anCellId = 0; anCellId < aNbCells; anCellId++){
VISU::TGaussPointID anObjID = aGaussMesh->GetObjID(anCellId);
cout<<anObjID.first<<"; "<<anObjID.second<<"; "<<aGaussMesh->GetNodeVTKID(anObjID.first)<<endl;
for(anCellId = 0; anCellId < aNbCells; anCellId++){
anObjID = anIDMapper->GetElemObjID(anCellId);
aVTKID = anIDMapper->GetElemVTKID(anObjID);
- cout<<anObjID<<"; "<<aVTKID<<endl;
+ MESSAGE(anObjID<<"; "<<aVTKID);
}
#endif
}
vtkInformationVector *theOutputVector)
{
bool anIsExecuted = false;
- if(GetNumberOfInputConnections(0) > 1 || IsMergingInputs() || IsMappingInputs())
+ if( IsMergingInputs() || IsMappingInputs() )
anIsExecuted = VISU::UnstructuredGridRequestData(theInputVector,
- this->GetNumberOfInputConnections(0),
+ GetNumberOfInputConnections( 0 ),
theOutputVector,
GetSharedPointSet(),
IsMergingInputs(),
IsMappingInputs());
- if(!anIsExecuted)
+ if( !anIsExecuted )
anIsExecuted = Superclass::RequestData(theRequest,
theInputVector,
theOutputVector);
bool theIsMergingInputs,
bool theIsMappingInputs)
{
- if(theSharedPointSet){
+ if ( theNumberOfInputConnections == 1 ) {
+ // get the input and ouptut
+ vtkDataSet *anInput = VISU::GetInput( theInputVector, 0 );
+ vtkDataSet* anOutput = VISU::GetOutput( theOutputVector );
+
+ if ( anInput->GetDataObjectType() != anOutput->GetDataObjectType() )
+ return false;
+
+ // This has to be here because it initialized all field datas.
+ anOutput->CopyStructure( anInput );
+
+ // Pass all. (data object's field data is passed by the
+ // superclass after this method)
+ anOutput->GetPointData()->PassData( anInput->GetPointData() );
+ anOutput->GetCellData()->PassData( anInput->GetCellData() );
+
+ return true;
+ }
+
+ if ( theSharedPointSet ) {
vtkPoints* aPoints = theSharedPointSet->GetPoints();
if(aPoints->GetNumberOfPoints() < 1)
return true;
TDataSet* anOutput = TDataSet::SafeDownCast(VISU::GetOutput(theOutputVector));
vtkIdType anNbInputs = theNumberOfInputConnections;
- if(theIsMergingInputs){
+ if ( theIsMergingInputs ) {
TCellIdMerger aFunctor(anNbInputs);
ForEachInput<TCellIdMerger>(theInputVector, anNbInputs, aFunctor);
return aDataSetAttributes->GetArray("VISU_FIELD") != NULL;
}
+ //---------------------------------------------------------------
+ bool
+ IsElnoData(vtkDataSet* theDataSet)
+ {
+ theDataSet->Update();
+
+ if ( vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetCellData() )
+ if ( aDataSetAttributes->GetArray( "ELNO_FIELD" ) != NULL )
+ return true;
+
+ if ( vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetPointData() )
+ if ( aDataSetAttributes->GetArray( "ELNO_POINT_COORDS" ) != NULL )
+ return true;
+
+ return false;
+ }
+
//---------------------------------------------------------------
vtkIdType
bool
IsDataOnCells(vtkDataSet* theDataSet);
+ //---------------------------------------------------------------
+ VISU_CONVERTOR_EXPORT
+ bool
+ IsElnoData(vtkDataSet* theDataSet);
+
//---------------------------------------------------------------
VISU_CONVERTOR_EXPORT
//---------------------------------------------------------------
+ inline
void
- PrintCells(int& theStartId,
- vtkCellArray* theConnectivity,
- const VISU::TConnect& theVector)
+ PrintCells( vtkCellArray* theConnectivity,
+ const VISU::TConnect& theVector)
{
- vtkIdList *anIdList = vtkIdList::New();
- int kEnd = theVector.size();
- anIdList->SetNumberOfIds(kEnd);
- for(int k = 0; k < kEnd; k++)
- anIdList->SetId(k,theVector[k]);
- theConnectivity->InsertNextCell(anIdList);
- anIdList->Delete();
+ theConnectivity->InsertNextCell( theVector.size(), &theVector[ 0 ] );
}
aCellTypesArray->SetNumberOfTuples(aNbCells);
for(vtkIdType anID = 0; anID < aNbCells; anID++){
- PrintCells(anID,aConnectivity,anArray[anID]);
+ PrintCells( aConnectivity, anArray[ anID ] );
aCellTypesArray->SetValue(anID,(unsigned char)theGeom);
}
VISU::TSubMeshID::const_iterator aSubMeshIDIter = aSubMeshID.begin();
for(; aSubMeshIDIter != aSubMeshID.end(); aSubMeshIDIter++, aCellId++){
vtkIdType anID = *aSubMeshIDIter;
- PrintCells(aCellId, aConnectivity, anArray[anID]);
+ PrintCells( aConnectivity, anArray[ anID ] );
aCellTypesArray->SetValue(aCellId, (unsigned char)aVGeom);
vtkIdType anObjID = aSubMesh.GetElemObjID(anID);
anElemObj2VTKID[anObjID] = aCellId;
VISU::TCell2Connect::const_iterator anIter = aCell2Connect.begin();
for(vtkIdType anId = 0, aConnId = 0; anIter != aCell2Connect.end(); anIter++){
const VISU::TConnect& anArray = aCell2Connect[anId];
- PrintCells(aConnId,aConnectivity,anArray);
+ PrintCells( aConnectivity, anArray );
aCellTypesArray->SetValue(anId,(unsigned char)aVGeom);
aConnId += aNbNodes;
anId++;
for(vtkIdType anId = 0, aConnId = 0; anIter != aSubMeshID.end(); anIter++){
vtkIdType aSubId = *anIter;
const VISU::TConnect& anArray = aCell2Connect[aSubId];
- PrintCells(aConnId,aConnectivity,anArray);
+ PrintCells( aConnectivity, anArray );
aCellTypesArray->SetValue(anId,(unsigned char)aVGeom);
aConnId += aNbNodes;
anId++;
//---------------------------------------------------------------
vtkUnstructuredGrid*
VISU_Convertor_impl
-::GetTimeStampOnProfile(const VISU::PMeshImpl& theMesh,
- const VISU::PMeshOnEntityImpl& theMeshOnEntity,
- const VISU::PFieldImpl& theField,
- const VISU::PValForTimeImpl& theValForTime,
- const VISU::PUnstructuredGridIDMapperImpl& theUnstructuredGridIDMapper,
- const VISU::PProfileImpl& theProfile,
- const VISU::TEntity& theEntity)
+::GetTimeStampOnProfile( const VISU::PMeshImpl& theMesh,
+ const VISU::PMeshOnEntityImpl& theMeshOnEntity,
+ const VISU::PFieldImpl& theField,
+ const VISU::PValForTimeImpl& theValForTime,
+ const VISU::PUnstructuredGridIDMapperImpl& theUnstructuredGridIDMapper,
+ const VISU::PProfileImpl& theProfile,
+ const VISU::TEntity& theEntity )
{
- vtkUnstructuredGrid* anOutput = NULL;
-
- LoadMeshOnEntity(theMesh, theMeshOnEntity);
- GetMeshOnEntity(theMeshOnEntity->myMeshName, theMeshOnEntity->myEntity);
- GetMeshOnProfile(theMesh, theMeshOnEntity, theProfile);
-
- bool isNeedInCells = false;
+ LoadMeshOnEntity( theMesh, theMeshOnEntity );
+ GetMeshOnEntity( theMeshOnEntity->myMeshName, theMeshOnEntity->myEntity );
+ GetMeshOnProfile( theMesh, theMeshOnEntity, theProfile );
theUnstructuredGridIDMapper->myIDMapper = theProfile;
- if(theMeshOnEntity->myEntity == VISU::NODE_ENTITY){
+
+ if ( theMeshOnEntity->myEntity == VISU::NODE_ENTITY ) {
// add geometry elements to output,
// if timestamp on NODE_ENTITY and
// on profiles with status eAddPart
- VISU::TGeom2SubProfile::const_iterator anIter = theProfile->myGeom2SubProfile.begin();
- for(; anIter != (theProfile->myGeom2SubProfile).end(); anIter++){
- const VISU::EGeometry aGeom = anIter->first;
- const VISU::PSubProfileImpl aSubProfile = anIter->second;
- if(aSubProfile->myStatus == VISU::eAddPart && aGeom == VISU::ePOINT1){
- isNeedInCells = true;
- break;
+ const VISU::TGeom2SubProfile& aGeom2SubProfile = theProfile->myGeom2SubProfile;
+ VISU::TGeom2SubProfile::const_iterator aSubProfileIter = aGeom2SubProfile.begin();
+ for ( ; aSubProfileIter != aGeom2SubProfile.end(); aSubProfileIter++ ) {
+ const VISU::EGeometry& aGeom = aSubProfileIter->first;
+ const VISU::PSubProfileImpl& aSubProfile = aSubProfileIter->second;
+ if ( aSubProfile->myStatus == VISU::eAddPart && aGeom == VISU::ePOINT1 ) {
+ const VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+ VISU::TMeshOnEntityMap::const_reverse_iterator aMeshOnEntityIter = aMeshOnEntityMap.rbegin();
+ for( ; aMeshOnEntityIter != aMeshOnEntityMap.rend(); aMeshOnEntityIter++ ) {
+ VISU::TEntity anEntity = aMeshOnEntityIter->first;
+ if ( anEntity == VISU::NODE_ENTITY )
+ continue;
+ VISU::PNamedIDMapper aNamedIDMapper = GetMeshOnEntity( theMesh->myName, anEntity );
+ if( aNamedIDMapper ) {
+ theUnstructuredGridIDMapper->SetReferencedMesh( aNamedIDMapper );
+ VISU::PUnstructuredGrid aSource = theUnstructuredGridIDMapper->GetSource();
+ VISU::GetTimeStampOnProfile( aSource, theField, theValForTime, theEntity );
+
+ return theUnstructuredGridIDMapper->GetUnstructuredGridOutput();
+ }
+ }
}
}
- if(isNeedInCells){
- theUnstructuredGridIDMapper->myIsSpecialKey = true;
- GetTimeStampOnNodalProfile(theMesh,theUnstructuredGridIDMapper,theField,theValForTime,theEntity);
- anOutput = theUnstructuredGridIDMapper->GetUnstructuredGridOutput();
- }
}
- if(!isNeedInCells){
- vtkUnstructuredGrid* anOutput = theUnstructuredGridIDMapper->GetUnstructuredGridOutput();
- const VISU::PUnstructuredGrid& aSource = theUnstructuredGridIDMapper->mySource.GetSource();
- VISU::GetTimeStampOnProfile(aSource, theField, theValForTime, theEntity);
- }
- return anOutput;
-}
-void
-VISU_Convertor_impl
-::GetTimeStampOnNodalProfile(const VISU::PMeshImpl& theMesh,
- const VISU::PUnstructuredGridIDMapperImpl& theIDMapperFilter,
- const VISU::PFieldImpl& theField,
- const VISU::PValForTimeImpl& theValForTime,
- const VISU::TEntity& theEntity)
-{
- const VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
- VISU::TMeshOnEntityMap::const_iterator aIter = aMeshOnEntityMap.begin();
- for(;aIter!=aMeshOnEntityMap.end();aIter++){
- VISU::TEntity aEntity = aIter->first;
- if(aEntity != VISU::NODE_ENTITY){
- VISU::PNamedIDMapper aMapper = GetMeshOnEntity(theMesh->myName,aEntity);
- if(aMapper)
- theIDMapperFilter->myMappers[aEntity] = aMapper;
- }
- }
+ VISU::PUnstructuredGrid aSource = theUnstructuredGridIDMapper->GetSource();
+ VISU::GetTimeStampOnProfile( aSource, theField, theValForTime, theEntity );
- theIDMapperFilter->GetUnstructuredGridOutput();
- const VISU::PUnstructuredGrid& aSource = theIDMapperFilter->mySource.GetSource();
- VISU::GetTimeStampOnProfile(aSource,theField,theValForTime,theEntity);
+ return theUnstructuredGridIDMapper->GetUnstructuredGridOutput();
}
+
//---------------------------------------------------------------
VISU::PUnstructuredGridIDMapper
VISU_Convertor_impl
-::GetTimeStampOnMesh(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName,
- int theStampsNum)
+::GetTimeStampOnMesh( const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theStampsNum )
{
INITMSG(MYDEBUG,"GetTimeStampOnMesh"<<
"; theMeshName = '"<<theMeshName<<"'"<<
aGaussPtsIDFilter->myIDMapper = aGaussMesh;
aGaussPtsIDFilter->myGaussPtsIDMapper = aGaussMesh;
- vtkPolyData* anOutput = aGaussPtsIDFilter->GetPolyDataOutput();
- const VISU::PPolyData& aSource = aGaussPtsIDFilter->mySource.GetSource();
+ VISU::PPolyData aSource = aGaussPtsIDFilter->GetSource();
VISU::GetTimeStampOnGaussMesh(aSource, aField, aValForTime);
+ vtkPolyData* anOutput = aGaussPtsIDFilter->GetPolyDataOutput();
aGaussPtsIDFilter->myIsVTKDone = true;
VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
VISU::PMeshOnEntityImpl aVTKMeshOnEntity = aMeshOnEntity;
- if(theEntity == VISU::NODE_ENTITY){
- if(aMeshOnEntityMap.find(VISU::CELL_ENTITY) != aMeshOnEntityMap.end())
- aVTKMeshOnEntity = aMeshOnEntityMap[VISU::CELL_ENTITY];
- else if(aMeshOnEntityMap.find(VISU::FACE_ENTITY) != aMeshOnEntityMap.end())
- aVTKMeshOnEntity = aMeshOnEntityMap[VISU::FACE_ENTITY];
- else if(aMeshOnEntityMap.find(VISU::EDGE_ENTITY) != aMeshOnEntityMap.end())
- aVTKMeshOnEntity = aMeshOnEntityMap[VISU::EDGE_ENTITY];
- else if(aMeshOnEntityMap.find(VISU::NODE_ENTITY) != aMeshOnEntityMap.end())
- aVTKMeshOnEntity = aMeshOnEntityMap[VISU::NODE_ENTITY];
+ if ( theEntity == VISU::NODE_ENTITY ) {
+ if(aMeshOnEntityMap.find( VISU::CELL_ENTITY ) != aMeshOnEntityMap.end())
+ aVTKMeshOnEntity = aMeshOnEntityMap[ VISU::CELL_ENTITY ];
+ else if (aMeshOnEntityMap.find( VISU::FACE_ENTITY ) != aMeshOnEntityMap.end() )
+ aVTKMeshOnEntity = aMeshOnEntityMap[ VISU::FACE_ENTITY ];
+ else if (aMeshOnEntityMap.find( VISU::EDGE_ENTITY ) != aMeshOnEntityMap.end() )
+ aVTKMeshOnEntity = aMeshOnEntityMap[ VISU::EDGE_ENTITY ];
+ else if ( aMeshOnEntityMap.find( VISU::NODE_ENTITY ) != aMeshOnEntityMap.end() )
+ aVTKMeshOnEntity = aMeshOnEntityMap[ VISU::NODE_ENTITY ];
}else
aVTKMeshOnEntity = aMeshOnEntity;
VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
- VISU::TFieldMap::const_iterator aFieldIter= aFieldMap.find(theFieldName);
+ VISU::TFieldMap::const_iterator aFieldIter= aFieldMap.find( theFieldName );
if(aFieldIter == aFieldMap.end())
EXCEPTION(std::runtime_error,"FindField >> There is no field on the mesh!!!");
VISU::PFieldImpl aField = aFieldIter->second;
- return TFindField(aMesh,
- aMeshOnEntity,
- aVTKMeshOnEntity,
- aField);
+ return TFindField( aMesh,
+ aMeshOnEntity,
+ aVTKMeshOnEntity,
+ aField );
}
//! Implemention of the VISU_Convertor::GetTimeStampOnMesh
virtual
VISU::PUnstructuredGridIDMapper
- GetTimeStampOnMesh(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName,
- int theTimeStampNumber);
+ GetTimeStampOnMesh( const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theTimeStampNumber );
//! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on mesh
virtual
VISU::PMeshOnEntityImpl,
VISU::PFieldImpl> TFindField;
TFindField
- FindField(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName);
+ FindField( const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName );
//! An utility method to find TTimeStamp by name of its parent mesh, corresponding entity, field name and its number
typedef boost::tuple<VISU::PMeshImpl,
int theStampsNum);
vtkUnstructuredGrid*
- GetTimeStampOnProfile(const VISU::PMeshImpl& theMesh,
- const VISU::PMeshOnEntityImpl& theMeshOnEntity,
- const VISU::PFieldImpl& theField,
- const VISU::PValForTimeImpl& theValForTime,
- const VISU::PUnstructuredGridIDMapperImpl& theIDMapperFilter,
- const VISU::PProfileImpl& theProfile,
- const VISU::TEntity& theEntity);
-
- void
- GetTimeStampOnNodalProfile(const VISU::PMeshImpl& theMesh,
- const VISU::PUnstructuredGridIDMapperImpl& theIDMapperFilter,
- const VISU::PFieldImpl& theField,
- const VISU::PValForTimeImpl& theValForTime,
- const VISU::TEntity& theEntity);
-
+ GetTimeStampOnProfile( const VISU::PMeshImpl& theMesh,
+ const VISU::PMeshOnEntityImpl& theMeshOnEntity,
+ const VISU::PFieldImpl& theField,
+ const VISU::PValForTimeImpl& theValForTime,
+ const VISU::PUnstructuredGridIDMapperImpl& theIDMapperFilter,
+ const VISU::PProfileImpl& theProfile,
+ const VISU::TEntity& theEntity );
+
protected:
//! Implemention of the VISU_Convertor::GetTimeStampSize
virtual
--- /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
::GetIndexesOfNode(vtkIdType theNodeId)
{
if ( IsStructured() ) {
- TObj2StructuredId::const_iterator aIter = myObj2StructuredId->find( theNodeId );
- if ( aIter != myObj2StructuredId->end() )
+ TObj2StructuredId::const_iterator aIter = myObj2StructuredId.find( theNodeId );
+ if ( aIter != myObj2StructuredId.end() )
return aIter->second;
}
TStructured
::GetObjectIDByIndexes(TStructuredId theVec)
{
- TObj2StructuredId::const_iterator aIter = myObj2StructuredId->begin();
- for (; aIter != myObj2StructuredId->end(); aIter++ ) {
+ TObj2StructuredId::const_iterator aIter = myObj2StructuredId.begin();
+ for (; aIter != myObj2StructuredId.end(); aIter++ ) {
if ( theVec == aIter->second )
return aIter->first;
}
*/
TStructuredId myGrilleStructure;
- PObj2StructuredId myObj2StructuredId;//!< map of object id to i,j,k ids of structured grid nodes
+ TObj2StructuredId myObj2StructuredId;//!< map of object id to i,j,k ids of structured grid nodes
};
//---------------------------------------------------------------
//---------------------------------------------------------------
VISU::TEntity
- MEDEntityToVTK(MED::EEntiteMaillage theMEDEntity)
+ MEDEntityToVTK( MED::EEntiteMaillage theMEDEntity )
{
+ VISU::TEntity anEntity = VISU::TEntity( -1 );
+
switch(theMEDEntity){
- case MED::eNOEUD: return VISU::NODE_ENTITY;
- case MED::eARETE: return VISU::EDGE_ENTITY;
- case MED::eFACE: return VISU::FACE_ENTITY;
- case MED::eMAILLE: return VISU::CELL_ENTITY;
+ case MED::eNOEUD :
+ anEntity = VISU::NODE_ENTITY;
+ break;
+ case MED::eARETE :
+ anEntity = VISU::EDGE_ENTITY;
+ break;
+ case MED::eFACE :
+ anEntity = VISU::FACE_ENTITY;
+ break;
+ case MED::eMAILLE :
+ anEntity = VISU::CELL_ENTITY;
+ break;
+ case MED::eNOEUD_ELEMENT :
+ anEntity = VISU::CELL_ENTITY;
+ break;
}
- return VISU::TEntity(-1);
+
+ return anEntity;
}
MED::PPolygoneInfo aPolygoneInfo =
theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom);
for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
- TInt aNbConn = aPolygoneInfo->GetNbConn(anElemNum[anElemId]);
+ TInt aNbConn = aPolygoneInfo->GetNbConn( anElemNum[ anElemId ] - 1 );
aSubProfile->myCellsSize += aNbConn;
}
break;
theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom);
for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
MED::TCConnSliceArr aConnSliceArr =
- aPolyedreInfo->GetConnSliceArr(anElemNum[anElemId]);
+ aPolyedreInfo->GetConnSliceArr( anElemNum[ anElemId ] - 1 );
TInt aNbFaces = aConnSliceArr.size();
TInt aCellSize = 0;
for(TInt iFace = 0; iFace < aNbFaces; iFace++){
if(aNbTimeStamps < 1)
continue;
- VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::TEntity aVEntity = MEDEntityToVTK( aMEntity );
vtkIdType aDataType = VTK_DOUBLE;
- if(aFieldInfo->GetType() != MED::eFLOAT64){
+ if ( aFieldInfo->GetType() != MED::eFLOAT64 ) {
#if defined(HAVE_F77INT64)
aDataType = VTK_LONG;
#else
aField->myName = aFieldName;
aField->myMeshName = aMeshName;
aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
-
+ aField->myIsELNO = ( aMEntity == MED::eNOEUD_ELEMENT );
+
INITMSG(MYDEBUG,"myName = '"<<aField->myName<<"'"<<
"; myId = "<<aField->myId<<
"; myEntity = "<<aField->myEntity<<
MED::TGeom2NbGauss::const_iterator anIter = aMGeom2NbGauss.begin();
for(; anIter != aMGeom2NbGauss.end(); anIter++){
const MED::EGeometrieElement& aMGeom = anIter->first;
- VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+ VISU::EGeometry aEGeom = MEDGeom2VISU( aMGeom );
TInt aNbGauss = anIter->second;
- aVGeom2NbGauss[aEGeom] = aNbGauss;
+ aVGeom2NbGauss[ aEGeom ] = aNbGauss;
+
+ // ELNO data should satisfy the following condition ( implicitly )
+ vtkIdType aNbNodes = MEDGeom2NbNodes( aMGeom );
+ aField->myIsELNO &= ( aNbGauss == aNbNodes );
}
}
}
//---------------------------------------------------------------
vtkIdType
TMEDGaussSubMesh
- ::GetVTKID(const TGaussPointID& theID,
- vtkIdType theStartID) const
+ ::GetVTKID( const TGaussPointID& theID ) const
{
vtkIdType aResult = -1;
if ( myIsElemNum ) {
aCellID = GetElemVTKID( aCellID );
} else
- aCellID -= theStartID;
+ aCellID -= myStartID;
- return aCellID * aNbPoints + aLocalPntID + theStartID;
+ return aCellID * aNbPoints + aLocalPntID + myStartID;
}
::Init(const MED::PElemInfo& theElemInfo,
MED::EVersion theVersion)
{
+ myVersion = theVersion;
myIsElemNum = theElemInfo->IsElemNum();
if(myIsElemNum)
myElemNum = theElemInfo->myElemNum;
virtual
vtkIdType
- GetVTKID(const TGaussPointID& theID,
- vtkIdType theStartID) const;
+ GetVTKID( const TGaussPointID& theID ) const;
//! Gets memory size used by the instance (bytes).
virtual
vtkCellData *anOutputCellData = theOutput->GetCellData();
anOutputCellData->CopyAllocate(aCellData);
+ if(theVectorsDataSet && theVectorsDataSet != theScalarsDataSet)
+ anOutputCellData->CopyVectorsOff();
+
vtkIdType aNbTuples = anIntersection.size();
theOutput->Allocate(aNbTuples);
vtkIdList *aCellIds = vtkIdList::New();
aCellIds->Delete();
theOutput->SetPoints(theInput->GetPoints());
+
}else{
theOutput->CopyStructure(theInput);
theOutput->GetCellData()->ShallowCopy(theScalarsDataSet->GetCellData());
}
theOutput->GetPointData()->ShallowCopy(theInput->GetPointData());
+
+ //If need, copy vectors data.
+ if(theVectorsDataSet && theVectorsDataSet != theScalarsDataSet){
+ bool isVectorsOnCells = theVectorsDataSet->GetCellData()->GetVectors() != NULL;
+ bool isVectorsDataOnPoints = theVectorsDataSet->GetPointData()->GetVectors() != NULL;
+ if(isVectorsOnCells) {
+ CopyVectorsOnCells(theVectorsDataSet,theOutput);
+ }
+ else if(isVectorsDataOnPoints){
+ CopyVectorsOnPoints(theVectorsDataSet,theOutput);
+ }
+ }
}
+ void CopyVectorsOnCells(vtkDataSet *theVectorsDataSet,
+ vtkDataSet *theOutput)
+ {
+ vtkDataArray *anInputVectors = theVectorsDataSet->GetCellData()->GetVectors();
+ vtkDataArray *anOutputVectors = vtkDataArray::CreateDataArray(anInputVectors->GetDataType());
+
+ //Clear output vector data
+ theOutput->GetCellData()->SetVectors(NULL);
+
+ //Copy vectors data
+ vtkIntArray* anOutputIDMapper = GetIDMapper(theOutput,
+ TGetCellData(),
+ "VISU_CELLS_MAPPER");
+
+ vtkIntArray* anInputIDMapper = GetIDMapper(theVectorsDataSet,
+ TGetCellData(),
+ "VISU_CELLS_MAPPER");
+
+ TObjectIdArray anIntersection;
+ GetIntersection(anOutputIDMapper,
+ anInputIDMapper,
+ anIntersection);
+
+ vtkIdType aNbTuples = anIntersection.size();
+ anOutputVectors->SetNumberOfComponents(anInputVectors->GetNumberOfComponents());
+ anOutputVectors->SetNumberOfTuples(aNbTuples);
+ theOutput->GetCellData()->SetVectors(anOutputVectors);
+ anOutputVectors->Delete();
+
+ TObjectId2TupleIdMap anOutputObjectId2TupleIdMap;
+ GetObjectId2TupleIdMap(anOutputIDMapper, anOutputObjectId2TupleIdMap);
+
+ TObjectId2TupleIdMap anInputObjectId2TupleIdMap;
+ GetObjectId2TupleIdMap(anInputIDMapper, anInputObjectId2TupleIdMap);
+
+ for(vtkIdType iTupleId = 0; iTupleId < aNbTuples; iTupleId++ ){
+ TObjectId &anObjectId = anIntersection[iTupleId];
+ vtkIdType anOutputCellId = anOutputObjectId2TupleIdMap[anObjectId];
+ vtkIdType anInputCellId = anInputObjectId2TupleIdMap[anObjectId];
+ anOutputVectors->SetTuple(anOutputCellId,anInputVectors->GetTuple(anInputCellId));
+ }
+ }
//---------------------------------------------------------------
template<class TDataSet>
theOutput->GetCellData()->ShallowCopy(theInput->GetCellData());
}
theOutput->GetPointData()->ShallowCopy(theScalarsDataSet->GetPointData());
+
+ //If need, copy vectors data.
+ if(theVectorsDataSet && theVectorsDataSet != theScalarsDataSet){
+ bool isVectorsOnCells = theVectorsDataSet->GetCellData()->GetVectors() != NULL;
+ bool isVectorsDataOnPoints = theVectorsDataSet->GetPointData()->GetVectors() != NULL;
+
+ //Merge cells if need
+ //rnv
+ if(!IsDifferent(theGeometryPointMapper, theDataPointMapper)){
+ vtkIntArray* theGeometryCellMapper = GetIDMapper(theVectorsDataSet,
+ TGetCellData(),
+ "VISU_CELLS_MAPPER");
+
+ vtkIntArray* theDataCellMapper = GetIDMapper(theScalarsDataSet,
+ TGetCellData(),
+ "VISU_CELLS_MAPPER");
+
+
+ if(IsDifferent(theGeometryCellMapper, theDataCellMapper)){
+ TObjectIdArray anIntersection;
+
+ GetIntersection(theGeometryCellMapper,
+ theDataCellMapper,
+ anIntersection);
+
+ TObjectId2TupleIdMap aGeomObjectId2TupleIdMap;
+ GetObjectId2TupleIdMap(theGeometryCellMapper, aGeomObjectId2TupleIdMap);
+
+ TObjectId2TupleIdMap aDataObjectId2TupleIdMap;
+ GetObjectId2TupleIdMap(theDataCellMapper, aDataObjectId2TupleIdMap);
+
+ vtkCellData *aCellData = theScalarsDataSet->GetCellData();
+ vtkCellData *anOutputCellData = theOutput->GetCellData();
+ anOutputCellData->CopyAllocate(aCellData);
+
+ vtkIdType aNbTuples = anIntersection.size();
+ theOutput->Allocate(aNbTuples);
+ vtkIdList *aCellIds = vtkIdList::New();
+ for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
+ TObjectId& anObjectId = anIntersection[aTupleId];
+ vtkIdType aCellId = aGeomObjectId2TupleIdMap[anObjectId];
+ vtkCell *aCell = theInput->GetCell(aCellId);
+ aCellIds->Reset();
+ vtkIdType aNbPointIds = aCell->PointIds->GetNumberOfIds();
+ for(vtkIdType anId = 0; anId < aNbPointIds; anId++)
+ aCellIds->InsertNextId(aCell->GetPointIds()->GetId(anId));
+ vtkIdType aCellType = theInput->GetCellType(aCellId);
+ vtkIdType aNewCellId = theOutput->InsertNextCell(aCellType, aCellIds);
+ vtkIdType aDataCellId = aDataObjectId2TupleIdMap[anObjectId];
+ anOutputCellData->CopyData(aCellData, aDataCellId, aNewCellId);
+ }
+ aCellIds->Delete();
+
+ }
+ }
+
+ if(isVectorsOnCells) {
+ CopyVectorsOnCells(theVectorsDataSet,theOutput);
+ }
+ else if(isVectorsDataOnPoints){
+ CopyVectorsOnPoints(theVectorsDataSet,theOutput);
+ }
+ }
}
+
+ void CopyVectorsOnPoints(vtkDataSet *theVectorsDataSet,
+ vtkDataSet *theOutput)
+ {
+ vtkDataArray *anInputVectors = theVectorsDataSet->GetPointData()->GetVectors();
+
+ //Clear output vector data
+ theOutput->GetPointData()->SetVectors(NULL);
+
+ vtkDataArray *anOutputVectors = vtkDataArray::CreateDataArray(anInputVectors->GetDataType());
+
+ //Copy vectors data
+ vtkIntArray* anOutputIDMapper = GetIDMapper(theOutput,
+ TGetPointData(),
+ "VISU_POINTS_MAPPER");
+
+ vtkIntArray* anInputIDMapper = GetIDMapper(theVectorsDataSet,
+ TGetPointData(),
+ "VISU_POINTS_MAPPER");
+ TObjectIdArray anIntersection;
+
+ GetIntersection(anOutputIDMapper,
+ anInputIDMapper,
+ anIntersection);
+
+ vtkIdType aNbTuples = anIntersection.size();
+ anOutputVectors->SetNumberOfComponents(anInputVectors->GetNumberOfComponents());
+ anOutputVectors->SetNumberOfTuples(aNbTuples);
+
+
+
+ TObjectId2TupleIdMap anOutputObjectId2TupleIdMap;
+ GetObjectId2TupleIdMap(anOutputIDMapper, anOutputObjectId2TupleIdMap);
+
+ TObjectId2TupleIdMap anInputObjectId2TupleIdMap;
+ GetObjectId2TupleIdMap(anInputIDMapper, anInputObjectId2TupleIdMap);
+
+ for(vtkIdType iTupleId = 0; iTupleId < aNbTuples; iTupleId++ ){
+ TObjectId& anObjectId = anIntersection[iTupleId];
+ vtkIdType anOutputPointId = anOutputObjectId2TupleIdMap[anObjectId];
+ vtkIdType anInputPointId = anInputObjectId2TupleIdMap[anObjectId];
+ anOutputVectors->SetTuple(anOutputPointId,anInputVectors->GetTuple(anInputPointId));
+ }
+
+ theOutput->GetPointData()->SetVectors(anOutputVectors);
+ anOutputVectors->Delete();
+ }
+
//---------------------------------------------------------------
typedef vtkDataArray* (vtkDataSetAttributes::* TGetAttribute)();
// Module : VISU
#include "VISU_MeshValue.hxx"
+#include "VISU_ElnoMeshValue.hxx"
#include "VISU_Structures_impl.hxx"
#include "VISU_ConvertorUtils.hxx"
#include "VISU_PointCoords.hxx"
-#include "VISU_TypeList.hxx"
+#include "VISU_VTKTypeList.hxx"
#include <vtkUnstructuredGrid.h>
#include <vtkPolyData.h>
}
- namespace TL
- {
- //----------------------------------------------------------------------------
- typedef TList<char,
- TList<unsigned char,
- TList<short,
- TList<unsigned short,
- TList<int,
- TList<unsigned int,
- TList<long,
- TList<unsigned long,
- TList<float,
- TList<double,
- TNullType> > > > > > > > > >
- TVTKBasicTypeList;
-
-
- //----------------------------------------------------------------------------
- typedef TList<vtkCharArray,
- TList<vtkUnsignedCharArray,
- TList<vtkShortArray,
- TList<vtkUnsignedShortArray,
- TList<vtkIntArray,
- TList<vtkUnsignedIntArray,
- TList<vtkLongArray,
- TList<vtkUnsignedLongArray,
- TList<vtkFloatArray,
- TList<vtkDoubleArray,
- TNullType> > > > > > > > > >
- TVTKArrayTypeList;
-
-
- typedef TList<TInt2Type<VTK_CHAR>,
- TList<TInt2Type<VTK_UNSIGNED_CHAR>,
- TList<TInt2Type<VTK_SHORT>,
- TList<TInt2Type<VTK_UNSIGNED_SHORT>,
- TList<TInt2Type<VTK_INT>,
- TList<TInt2Type<VTK_UNSIGNED_INT>,
- TList<TInt2Type<VTK_LONG>,
- TList<TInt2Type<VTK_UNSIGNED_LONG>,
- TList<TInt2Type<VTK_FLOAT>,
- TList<TInt2Type<VTK_DOUBLE>,
- TNullType> > > > > > > > > >
- 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;
- };
-
- }
-
-
//----------------------------------------------------------------------------
template<int EDataType>
void
std::string aFieldName = VISU::GenerateFieldName(theField, theValForTime);
vtkDataSetAttributes* aDataSetAttributes;
- switch(theEntity){
+ switch ( theEntity ) {
case VISU::NODE_ENTITY :
aDataSetAttributes = theSource->GetPointData();
break;
typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
TVTKDataArray *aSelectedDataArray = TVTKDataArray::New();
vtkIdType aNbComp = theField->myNbComp;
- switch(aNbComp) {
+
+ switch ( aNbComp ) {
case 1:
- aSelectedDataArray->SetNumberOfComponents(1);
- aDataSetAttributes->SetScalars(aSelectedDataArray);
+ aSelectedDataArray->SetNumberOfComponents( 1 );
+ aDataSetAttributes->SetScalars( aSelectedDataArray );
break;
default:
- aSelectedDataArray->SetNumberOfComponents(3);
- aDataSetAttributes->SetVectors(aSelectedDataArray);
+ aSelectedDataArray->SetNumberOfComponents( 3 );
+ aDataSetAttributes->SetVectors( aSelectedDataArray );
}
- aSelectedDataArray->SetNumberOfTuples(aNbTuples);
- aSelectedDataArray->SetName(aFieldName.c_str());
+ aSelectedDataArray->SetNumberOfTuples( aNbTuples );
+ aSelectedDataArray->SetName( aFieldName.c_str() );
TVTKDataArray *aFullDataArray = TVTKDataArray::New();
- aFullDataArray->SetNumberOfComponents(aNbComp);
- aFullDataArray->SetNumberOfTuples(aNbTuples);
- aFullDataArray->SetName("VISU_FIELD");
- aDataSetAttributes->AddArray(aFullDataArray);
+ aFullDataArray->SetNumberOfComponents( aNbComp );
+ aFullDataArray->SetNumberOfTuples( aNbTuples );
+ aFullDataArray->SetName( "VISU_FIELD" );
+ aDataSetAttributes->AddArray( aFullDataArray );
INITMSG(MYDEBUG,"InitTimeStampOnProfile "<<
"- theEntity = "<<theEntity<<
"; aNbTuples = "<<aNbTuples<<
"; aNbComp = "<<aNbComp<<
std::endl);
+
TTimerLog aTimerLog(MYDEBUG,"InitTimeStampOnProfile");
const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue();
- typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
- typedef TTMeshValue<TVTKBasicType> TMeshValue;
- typedef MED::SharedPtr<TMeshValue> TMeshValuePtr;
+ typedef typename TL::TEnum2VTKBasicType< EDataType >::TResult TVTKBasicType;
+ typedef TTMeshValue< TVTKBasicType > TMeshValue;
+ typedef MED::SharedPtr< TMeshValue > TMeshValuePtr;
- typedef TDataArrayHolder<EDataType> TTDataArrayHolder;
- typedef MED::SharedPtr<TTDataArrayHolder> PDataArrayHolder;
+ typedef TDataArrayHolder< EDataType > TTDataArrayHolder;
+ typedef MED::SharedPtr< TTDataArrayHolder > PDataArrayHolder;
TMeshValuePtr aMeshValue = theValForTime->GetFirstMeshValue();
- if(aGeom2MeshValue.size() == 1 && aMeshValue->GetNbGauss() == 1){
+ if ( aGeom2MeshValue.size() == 1 && aMeshValue->GetNbGauss() == 1 ) {
aFullDataArray->SetVoidArray(aMeshValue->GetPointer(),
aMeshValue->size(),
true);
INITMSG(MYDEBUG,"InitTimeStampOnProfile - aFullDataArray->SetVoidArray()"<<std::endl);
- if(aNbComp == 1){
- aSelectedDataArray->SetVoidArray(aMeshValue->GetPointer(),
- aMeshValue->size(),
- true);
+ if ( aNbComp == 1 ) {
+ aSelectedDataArray->SetVoidArray( aMeshValue->GetPointer(),
+ aMeshValue->size(),
+ true );
INITMSG(MYDEBUG,"InitTimeStampOnProfile - aSelectedDataArray->SetVoidArray()"<<std::endl);
}else{
PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder(aSelectedDataArray));
aSelectedDataArray->Delete();
aFullDataArray->Delete();
+
+ // Process the case for ELNO data
+ //-------------------------------
+ if ( theField->myIsELNO ) {
+ // To calculate effective number of components for the VTK compatibel ELNO data representation
+ vtkIdType aEffectNbTuples = 0;
+ TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin();
+ for ( ; anIter != aGeom2MeshValue.end(); anIter++ ) {
+ const PMeshValue& aMeshValue = anIter->second;
+ aEffectNbTuples += aMeshValue->GetNbElem() * aMeshValue->GetNbGauss();
+ }
+
+ vtkIdType anEffectNbComp = ( aEffectNbTuples * aNbComp ) / aNbTuples + 1;
+
+ // To create corresponding VTK representation for the ELNO data
+ TSetElnoNodeData< EDataType > aSetElnoNodeData( anEffectNbComp,
+ aNbComp,
+ aNbTuples,
+ "ELNO_FIELD",
+ "ELNO_COMPONENT_MAPPER" );
+
+ std::vector< TVTKBasicType > aDataValues( aNbComp ); // To reserve a temproary value holder
+
+ // To initilize these VTK representation for the ELNO data from the MED
+ anIter = aGeom2MeshValue.begin();
+ for ( ; anIter != aGeom2MeshValue.end(); anIter++ ) {
+ EGeometry aEGeom = anIter->first;
+ const TMeshValuePtr aMeshValue = anIter->second;
+
+ vtkIdType aNbElem = aMeshValue->GetNbElem();
+ vtkIdType aNbGauss = aMeshValue->GetNbGauss();
+
+ INITMSG(MYDEBUG,
+ "- aEGeom = "<<aEGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbGauss = "<<aNbGauss<<
+ std::endl);
+ std::vector<int> med2visu(aNbGauss);
+ InitMed2VisuArray(med2visu,aEGeom);
+ for ( vtkIdType iElem = 0; iElem < aNbElem; iElem++ ) {
+ const typename TMeshValue::TValueSliceArr& aValueSliceArr = aMeshValue->GetGaussValueSliceArr( iElem );
+
+ for( vtkIdType iGauss = 0; iGauss < aNbGauss; iGauss++ ) {
+ const typename TMeshValue::TCValueSlice& aValueSlice = aValueSliceArr[ med2visu[iGauss] ];
+
+ for( vtkIdType iComp = 0; iComp < aNbComp; iComp++ ) {
+ aDataValues[ iComp ] = aValueSlice[ iComp ];
+ }
+
+ aSetElnoNodeData.AddNextPointData( &aDataValues[ 0 ] );
+ }
+
+ aSetElnoNodeData.InsertNextCellData();
+ }
+ }
+
+ // Assign the ELNO data on the corresponding VTK data set attribute
+ aSetElnoNodeData.AddData( aDataSetAttributes );
+ }
+ //-------------------------------
}
aFullDataArray->Delete();
}
+
+ //----------------------------------------------------------------------------
- //---------------------------------------------------------------
+ void InitMed2VisuArray(std::vector<int>& anArray, EGeometry aEGeom){
+ switch(aEGeom){
+#if !(defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+ case eSEG3:
+ anArray[0] = 0;
+ anArray[2] = 1;
+ anArray[1] = 2;
+ break;
+#endif
+
+#if !(defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+ case eTRIA6:
+ anArray[0] = 0;
+ anArray[2] = 1;
+ anArray[4] = 2;
+
+ anArray[1] = 3;
+ anArray[3] = 4;
+ anArray[5] = 5;
+ break;
+#endif
+
+#if !(defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+ case eQUAD8:
+ anArray[0] = 0;
+ anArray[2] = 1;
+ anArray[4] = 2;
+ anArray[6] = 3;
+
+ anArray[1] = 4;
+ anArray[3] = 5;
+ anArray[5] = 6;
+ anArray[7] = 7;
+ break;
+#endif
+ case eTETRA4:
+ anArray[0] = 0;
+ anArray[1] = 2;
+ anArray[2] = 1;
+ anArray[3] = 3;
+ break;
+ case ePYRA5:
+ anArray[0] = 0;
+ anArray[1] = 3;
+ anArray[2] = 2;
+ anArray[3] = 1;
+ anArray[4] = 4;
+ break;
+#if (defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+ case eTETRA10:
+ anArray[0] = 0;
+ anArray[1] = 2;
+ anArray[2] = 1;
+ anArray[3] = 3;
+
+ anArray[4] = 6;
+ anArray[5] = 5;
+ anArray[6] = 4;
+
+ anArray[7] = 7;
+ anArray[8] = 9;
+ anArray[9] = 8;
+ break;
+#endif
+
+#if (defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+ case ePYRA13:
+ anArray[0] = 0;
+ anArray[1] = 3;
+ anArray[2] = 2;
+ anArray[3] = 1;
+ anArray[4] = 4;
+
+ anArray[5] = 5;
+ anArray[6] = 8;
+ anArray[7] = 7;
+ anArray[8] = 6;
+
+ anArray[9] = 9;
+ anArray[10] = 12;
+ anArray[11] = 11;
+ anArray[12] = 10;
+ break;
+#endif
+ default:
+ for(int i=0;i<anArray.size();i++){
+ anArray[i] = i;
+ }
+ break;
+ }
+ }
}
const PFieldImpl& theField,
const PValForTimeImpl& theValForTime);
+ void
+ InitMed2VisuArray(std::vector<int>& anArray, EGeometry aEGeom);
+
//---------------------------------------------------------------
}
std::string myGroupsEntry; //!< To simplify publication of the groups in a data tree
std::string myFieldsEntry; //!< To simplify publication of the fiels in a data tree
-
- // MULTIPR
std::string myPartsEntry; //!< To simplify publication of the parts in a data tree
TMesh();
typedef std::map<std::string, PMesh> TMeshMap;
- typedef std::map<VISU::TEntity,VISU::PNamedIDMapper> PNamedIDMapperMap;
-
//---------------------------------------------------------------
//! Define a basic class which corresponds to MED PROFILE entity
struct VISU_CONVERTOR_EXPORT TSubProfile: virtual TBaseStructure
//---------------------------------------------------------------
TUnstructuredGridIDMapperImpl
- ::TUnstructuredGridIDMapperImpl():
- myIsSpecialKey(false)
+ ::TUnstructuredGridIDMapperImpl()
{
- if(!myCommonCellsFilter.GetPointer()){
+ if ( !myCommonCellsFilter.GetPointer() ) {
myCommonCellsFilter = VISU_CommonCellsFilter::New();
myCommonCellsFilter->Delete();
}
return myIDMapper->GetElemCell(theObjID);
}
- vtkUnstructuredGrid*
+ void
TUnstructuredGridIDMapperImpl
- ::GetUnstructuredGridOutput()
+ ::SetReferencedMesh( const PNamedIDMapper& theNamedIDMapper )
{
- if(!myFilter.GetPointer()){
-
+ myCommonCellsFilter->SetCellsUG( theNamedIDMapper->GetUnstructuredGridOutput() );
+ }
+
+ void
+ TUnstructuredGridIDMapperImpl
+ ::Build()
+ {
+ if ( !myFilter.GetPointer() ) {
const PAppendFilter& anAppendFilter = myIDMapper->GetFilter();
- vtkUnstructuredGrid* aGeometry;
+ vtkUnstructuredGrid* aGeometry = anAppendFilter->GetOutput();
const PUnstructuredGrid& aSource = mySource.GetSource();
- vtkUnstructuredGrid* aDataSet;
-
- if(myIsSpecialKey){
- PNamedIDMapperMap::iterator aIter;
- aIter = myMappers.find(VISU::CELL_ENTITY);
- if(aIter!=myMappers.end()) myCommonCellsFilter->SetCellsUG((aIter->second)->GetUnstructuredGridOutput());
- else {
- aIter = myMappers.find(VISU::FACE_ENTITY);
- if(aIter!=myMappers.end()) myCommonCellsFilter->SetCellsUG((aIter->second)->GetUnstructuredGridOutput());
- else {
- aIter = myMappers.find(VISU::EDGE_ENTITY);
- if(aIter!=myMappers.end()) myCommonCellsFilter->SetCellsUG((aIter->second)->GetUnstructuredGridOutput());
- }
- }
- }
-
- aGeometry = anAppendFilter->GetOutput();
- aDataSet = aSource.GetPointer();
- aDataSet->ShallowCopy(aGeometry);
+ vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
+ aDataSet->ShallowCopy( aGeometry );
const PMergeFilter& aFilter = GetFilter();
- aFilter->SetGeometry(aGeometry);
- aFilter->SetScalars(aDataSet);
- aFilter->SetVectors(aDataSet);
- aFilter->AddField("VISU_FIELD",aDataSet);
- aFilter->AddField("VISU_CELLS_MAPPER",aDataSet);
- aFilter->AddField("VISU_POINTS_MAPPER",aDataSet);
-
- myCommonCellsFilter->SetProfileUG(aFilter->GetUnstructuredGridOutput());
+ aFilter->SetGeometry( aGeometry );
+ aFilter->SetScalars( aDataSet );
+ aFilter->SetVectors( aDataSet );
+ aFilter->AddField( "VISU_FIELD", aDataSet );
+ aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
+ aFilter->AddField( "ELNO_FIELD", aDataSet );
+ aFilter->AddField( "ELNO_COMPONENT_MAPPER", aDataSet );
+ aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
+
+ myCommonCellsFilter->SetProfileUG( aFilter->GetUnstructuredGridOutput() );
}
+ }
+
+ vtkUnstructuredGrid*
+ TUnstructuredGridIDMapperImpl
+ ::GetUnstructuredGridOutput()
+ {
+ Build();
return myCommonCellsFilter->GetOutput();
}
return GetUnstructuredGridOutput();
}
+ PUnstructuredGrid
+ TUnstructuredGridIDMapperImpl
+ ::GetSource()
+ {
+ Build();
+ return mySource.GetSource();
+ }
+
unsigned long int
TUnstructuredGridIDMapperImpl
::GetMemorySize()
{
size_t aSize = myIDMapper->GetMemorySize();
+
aSize += mySource.GetMemorySize();
- if(vtkUnstructuredGrid* anOutput = myCommonCellsFilter->GetOutput())
+
+ if ( vtkUnstructuredGrid* anOutput = myCommonCellsFilter->GetOutput() )
aSize += anOutput->GetActualMemorySize() * 1024;
- PNamedIDMapperMap::const_iterator aIter = myMappers.begin();
- for(;aIter!=myMappers.end();aIter++)
- aSize += (aIter->second)->GetMemorySize();
+
return aSize;
}
return myIDMapper->GetElemCell(theObjID);
}
- vtkPolyData*
+ void
TPolyDataIDMapperImpl
- ::GetPolyDataOutput()
+ ::Build()
{
- if(!myFilter.GetPointer()){
+ if ( !myFilter.GetPointer() ) {
const PAppendPolyData& anAppendFilter = myIDMapper->GetFilter();
vtkPolyData* aGeometry = anAppendFilter->GetOutput();
const PPolyData& aSource = mySource.GetSource();
vtkPolyData* aDataSet = aSource.GetPointer();
- aDataSet->ShallowCopy(aGeometry);
+ aDataSet->ShallowCopy( aGeometry );
const PMergeFilter& aFilter = GetFilter();
- aFilter->SetGeometry(aGeometry);
- aFilter->SetScalars(aDataSet);
- aFilter->SetVectors(aDataSet);
- aFilter->AddField("VISU_FIELD",aDataSet);
- aFilter->AddField("VISU_CELLS_MAPPER",aDataSet);
- aFilter->AddField("VISU_POINTS_MAPPER",aDataSet);
+ aFilter->SetGeometry( aGeometry );
+ aFilter->SetScalars( aDataSet );
+ aFilter->SetVectors( aDataSet );
+ aFilter->AddField( "VISU_FIELD", aDataSet );
+ aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
+ aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
}
+ }
+
+ vtkPolyData*
+ TPolyDataIDMapperImpl
+ ::GetPolyDataOutput()
+ {
+ Build();
return myFilter->GetPolyDataOutput();
}
return GetPolyDataOutput();
}
+ PPolyData
+ TPolyDataIDMapperImpl
+ ::GetSource()
+ {
+ Build();
+ return mySource.GetSource();
+ }
+
unsigned long int
TPolyDataIDMapperImpl
::GetMemorySize()
return aResult;
size_t aSubMeshEnd = myGaussSubMeshArr.size();
- const PAppendFilter& anAppendFilter = GetFilter();
const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
for ( size_t aSubMeshId = 0; aSubMeshId < aSubMeshEnd; aSubMeshId++ ) {
const PGaussSubMeshImpl& aSubMesh = myGaussSubMeshArr[aSubMeshId];
//---------------------------------------------------------------
TFieldImpl
- ::TFieldImpl():
- myDataSize(0),
- myDataType(0)
+ ::TFieldImpl()
+ : myDataSize( 0 )
+ , myDataType( 0 )
+ , myIsELNO( false )
{}
void
virtual
unsigned long int
GetMemorySize();
-
- //! if false, TIDCommonCellsFilter - same as TIDMapperFilter
- //! if true, TIDCommonCellsFilter - use VISU_CommonCellsFilter
- bool myIsSpecialKey;
-
- //! Vector of id mappers, which consist of meshonentity in next sequence:
- //! CELL_ENTITY,FACE_ENTITY,EDGE_ENTITY
- PNamedIDMapperMap myMappers;
};
//---------------------------------------------------------------
struct TUnstructuredGridIDMapperImpl: virtual TMergeFilterHolder,
virtual TUnstructuredGridIDMapper
{
- PAppendFilterHolder myIDMapper; //!< Responsible for numbering
- PCommonCellsFilter myCommonCellsFilter;
- TUnstructuredGridHolder mySource; //!< Keeps assigned data
+ PAppendFilterHolder myIDMapper; //!< Responsible for numbering
+ PCommonCellsFilter myCommonCellsFilter;
TUnstructuredGridIDMapperImpl();
unsigned long int
GetMemorySize();
- //! if false, Not using CommonCellsFilter
- //! if true, Using CommonCellsFilter
- bool myIsSpecialKey;
+ void
+ SetReferencedMesh( const PNamedIDMapper& theNamedIDMapper );
+
+ PUnstructuredGrid
+ GetSource();
+
+ protected:
+ void Build();
- //! Vector of id mappers, which consist of meshonentity in next sequence:
- //! CELL_ENTITY,FACE_ENTITY,EDGE_ENTITY
- PNamedIDMapperMap myMappers;
+ TUnstructuredGridHolder mySource; //!< Keeps assigned data
};
//---------------------------------------------------------------
virtual TPolyDataIDMapper
{
PAppendPolyDataHolder myIDMapper; //!< Responsible for numbering
- TPolyDataHolder mySource; //!< Keeps assigned data
//! Reimplement the TIDMapper::GetNodeObjID
virtual
virtual
unsigned long int
GetMemorySize();
+
+ PPolyData
+ GetSource();
+
+ protected:
+ void Build();
+
+ TPolyDataHolder mySource; //!< Keeps assigned data
};
vtkIdType myDataSize; //!< Keeps size of the assigned data
vtkIdType myDataType; //!< Keeps type idetificator of the mesh data
TMinMaxArr myMinMaxArr; //!< Keeps min/max values for each component of the MED FIELD
+ bool myIsELNO; //!< Defines whether this field contains specific "ELNO" data or not
};
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
-// File : VISU_ColoredPrs3dCache_i.hh
+// File : VISU_TypeList.hxx
// Author : Oleg UVAROV
// Module : VISU
#ifndef VISU_TypeList_HeaderFile
#define VISU_TypeList_HeaderFile
+
+//----------------------------------------------------------------------------
namespace VISU
{
+ //----------------------------------------------------------------------------
namespace TL
{
//----------------------------------------------------------------------------
- template <class T, class U>
+ struct TNullType {};
+
+
+ //----------------------------------------------------------------------------
+ template < class T, class U >
struct TList
{
typedef T THead;
typedef U TTail;
};
- template <int v>
+ template < int v >
struct TInt2Type
{
enum { value = v };
};
- struct TNullType {};
-
+
//----------------------------------------------------------------------------
- template <class TypeList, unsigned int index>
+ template < class TypeList, unsigned int index >
struct TTypeAt;
- template <class THead, class TTail>
- struct TTypeAt<TList<THead, TTail>, 0>
+ template < class THead, class TTail >
+ struct TTypeAt< TList< THead, TTail >, 0 >
{
typedef THead TResult;
};
- template <class THead, class TTail, unsigned int index>
- struct TTypeAt<TList<THead, TTail>, index>
+ template < class THead, class TTail, unsigned int index >
+ struct TTypeAt< TList< THead, TTail >, index >
{
- typedef typename TTypeAt<TTail, index - 1>::TResult TResult;
+ typedef typename TTypeAt< TTail, index - 1 >::TResult TResult;
};
+
//----------------------------------------------------------------------------
- template <class TypeList, class T>
+ template < class TypeList, class T >
struct TIndexOf;
- template <class T>
- struct TIndexOf<TNullType, T>
+ template < class T >
+ struct TIndexOf< TNullType, T >
{
enum { value = -1 };
};
- template <class T, class TTail>
- struct TIndexOf<TList<T, TTail>, T>
+ template < class T, class TTail >
+ struct TIndexOf< TList< T, TTail >, T >
{
enum { value = 0 };
};
- template <class THead, class TTail, class T>
- struct TIndexOf<TList<THead, TTail>, T>
+ template < class THead, class TTail, class T >
+ struct TIndexOf< TList< THead, TTail >, T >
{
private:
- enum { temp = TIndexOf<TTail, T>::value };
+ enum { temp = TIndexOf< TTail, T >::value };
public:
enum { value = temp == -1? -1 : 1 + temp };
};
+
+ //----------------------------------------------------------------------------
+ template
+ <
+ class T01 = TNullType, class T02 = TNullType, class T03 = TNullType, class T04 = TNullType, class T05 = TNullType,
+ class T06 = TNullType, class T07 = TNullType, class T08 = TNullType, class T09 = TNullType, class T10 = TNullType,
+ class T11 = TNullType, class T12 = TNullType, class T13 = TNullType, class T14 = TNullType, class T15 = TNullType,
+ class T16 = TNullType, class T17 = TNullType, class T18 = TNullType, class T19 = TNullType, class T20 = TNullType,
+ class T21 = TNullType, class T22 = TNullType, class T23 = TNullType, class T24 = TNullType, class T25 = TNullType,
+ class T26 = TNullType, class T27 = TNullType, class T28 = TNullType, class T29 = TNullType, class T30 = TNullType,
+ class T31 = TNullType, class T32 = TNullType, class T33 = TNullType, class T34 = TNullType, class T35 = TNullType,
+ class T36 = TNullType, class T37 = TNullType, class T38 = TNullType, class T39 = TNullType, class T40 = TNullType
+ >
+ struct TSequence
+ {
+ private:
+ typedef typename TSequence< T02, T03, T04, T05, T06, T07, T08, T09, T10,
+ T11, T12, T13, T14, T15, T16, T17, T18, T19, T20,
+ T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, T37, T38, T39, T40
+ >::TResult
+ TailResult;
+ public:
+ typedef TList< T01, TailResult > TResult;
+ };
+
+
+ //----------------------------------------------------------------------------
+ template<>
+ struct TSequence<>
+ {
+ typedef TNullType 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 : 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
return myVisuGen->DeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
- ScalarMapOnDeformedShape_ptr
+ DeformedShapeAndScalarMap_ptr
VISU_Gen_i
::ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
const char* theMeshName,
const char* theFieldName,
CORBA::Long theIteration)
{
- return myVisuGen->ScalarMapOnDeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
+ return DeformedShapeAndScalarMapOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
+ }
+
+ DeformedShapeAndScalarMap_ptr
+ VISU_Gen_i
+ ::DeformedShapeAndScalarMapOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
+ {
+ return myVisuGen->DeformedShapeAndScalarMapOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
Vectors_ptr
const char* theFieldName,
CORBA::Long theIteration);
+ //This function is obsolete. Use DeformedShapeAndScalarMapOnField instead.
virtual
- ScalarMapOnDeformedShape_ptr
+ DeformedShapeAndScalarMap_ptr
ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
const char* theMeshName,
VISU::Entity theEntity,
const char* theFieldName,
CORBA::Long theIteration);
+ virtual
+ DeformedShapeAndScalarMap_ptr
+ DeformedShapeAndScalarMapOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration);
+
//Create Digital Presentation
virtual Table_ptr CreateTable(const char* theTableEntry);
virtual Curve_ptr CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow);
VISU_GaussPtsAct.h \
VISU_VectorsAct.h \
VISU_PointMap3dActor.h \
- VISU_ActorBase.h
+ VISU_ActorBase.h \
+ VISU_IsoSurfActor.h
dist_libVisuObject_la_SOURCES = \
VISU_Actor.cxx \
VISU_GaussPtsAct.cxx \
VISU_VectorsAct.cxx \
VISU_PointMap3dActor.cxx \
- VISU_ActorBase.cxx
+ VISU_ActorBase.cxx \
+ VISU_IsoSurfActor.cxx
libVisuObject_la_CPPFLAGS= \
$(QT_INCLUDES) \
return myPrs3d;
}
-//----------------------------------------------------------------------------
-/*VISU::TActorFactory*
-VISU_Actor
-::GetFactory()
-{
- return myActorFactory;
-}*/
-
-/*void
-VISU_Actor
-::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_Actor
-::UpdateFromFactory()
-{
- if(myUpdateFromFactoryTime.GetMTime() < myActorFactory->GetMTime()){
- myUpdateFromFactoryTime.Modified();
- myActorFactory->UpdateActor(this);
- Update();
- }
-}*/
-
void
VISU_Actor
::RemoveFromRender()
::SetPipeLine(VISU_PipeLine* thePipeLine)
{
myPipeLine = thePipeLine;
- if(thePipeLine){
- if(vtkMapper *aMapper = myPipeLine->GetMapper()){
- if(vtkDataSet *aDataSet = aMapper->GetInput()){
- SetShrinkable(thePipeLine->IsShrinkable());
- SetMapperInput(aDataSet);
+ if ( thePipeLine ) {
+ if ( vtkMapper *aMapper = myPipeLine->GetMapper() ) {
+ if ( vtkDataSet *aDataSet = aMapper->GetInput() ) {
+ SetShrinkable( thePipeLine->IsShrinkable() );
+ SetMapperInput( aDataSet );
}
}
}
#include "VISU_ActorBase.h"
#include "VISU_ActorFactory.h"
+#include "VTKViewer_ShrinkFilter.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 <boost/bind.hpp>
VISU_ActorBase
-::VISU_ActorBase()
+::VISU_ActorBase() :
+ myIsShrinkable(true),
+ myIsShrunk(false),
+ myShrinkFilter(VTKViewer_ShrinkFilter::New())
{
-
+ myShrinkFilter->Delete();
+
+ myStoreMapping = true;
+
+ myShrinkFilter->SetStoreMapping(true);
}
VISU_ActorBase
}
}
+//--------------------------------------------------------------------------
+
+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;
+}
#include "SALOME_Actor.h"
#include "VISU_BoostSignals.h"
+class VTKViewer_ShrinkFilter;
+
#ifdef _WIN32
#define VTKOCC_EXPORT __declspec (dllexport)
#else
vtkTypeMacro(VISU_ActorBase, SALOME_Actor);
//----------------------------------------------------------------------------
- VISU::TActorFactory*
- GetFactory();
-
- virtual
- void
- SetFactory(VISU::TActorFactory* theActorFactory);
+ VISU::TActorFactory* GetFactory();
+ virtual void SetFactory(VISU::TActorFactory* theActorFactory);
//----------------------------------------------------------------------------
- virtual
- void
- UpdateFromFactory();
+ 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
#include <vtkCamera.h>
#include <vtkRenderer.h>
#include <vtkPointPicker.h>
+#include <vtkMatrix4x4.h>
#include <vtkScalarBarWidget.h>
#include <vtkTextMapper.h>
#include <vtkTextProperty.h>
#include <vtkPolyDataMapper.h>
#include <vtkPolyData.h>
#include <vtkActor.h>
+#include <vtkTransform.h>
#include <vtkObjectFactory.h>
#include <vtkCallbackCommand.h>
myEventCallbackCommand->SetClientData(this);
myEventCallbackCommand->SetCallback(VISU_GaussPtsAct::ProcessEvents);
+ vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
+
myDeviceActor->SetProperty(GetProperty());
+ myDeviceActor->SetUserMatrix(aMatrix);
myDeviceActor->SetVisibility(true);
myDeviceActor->SetPickable(false);
myScalarBarCtrl->Delete();
myMapper->Delete();
+ aMatrix->Delete();
}
VISU_GaussPtsAct
VISU_GaussPtsAct
::RenderOpaqueGeometry(vtkViewport *viewport)
{
+ GetMatrix(myDeviceActor->GetUserMatrix());
return 1;
}
VISU_GaussPtsAct
::RenderTranslucentGeometry(vtkViewport *viewport)
{
+ GetMatrix(myDeviceActor->GetUserMatrix());
return 1;
}
if(myIsPreselected){
anIsChanged = (myLastPreHighlightObjID != anObjId);
if(anIsChanged){
- vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
+ vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
+ //Take into account translation
+ vtkFloatingPointType aLocalNodeCoord[3];
+ this->Transform->Push();
+ this->Transform->PostMultiply();
+ this->Transform->Identity();
+
+ this->Transform->Translate(this->Position[0],
+ this->Position[1],
+ this->Position[2]);
+ double aPosition[3];
+ this->Transform->GetPosition(aPosition);
+
+ aLocalNodeCoord[0] = aNodeCoord[0] + aPosition[0];
+ aLocalNodeCoord[1] = aNodeCoord[1] + aPosition[1];
+ aLocalNodeCoord[2] = aNodeCoord[2] + aPosition[2];
+
vtkDataSet* aDataSet = GetInput();
vtkPointData* aPointData = aDataSet->GetPointData();
if(vtkDataArray *aScalarArray = aPointData->GetScalars()){
- vtkFloatingPointType aPyramidHeight = myPickingSettings->GetPyramidHeight();
- aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
- //vtkFloatingPointType aColor[3] = myPreHighlightActor->GetProperty()->GetColor();
- vtkFloatingPointType aColor[3];
- theInteractorStyle->GetCurrentRenderer()->GetBackground( aColor );
- aColor[0] = 1. - aColor[0];
- aColor[1] = 1. - aColor[1];
- aColor[2] = 1. - aColor[2];
-
- myCursorPyramid->Init(aPyramidHeight,
- myPickingSettings->GetCursorSize(),
- GetRadius(anObjId,aVtkId,aScalarArray),
- GetMagnification(anObjId),
- GetClamp(anObjId),
- aNodeCoord,
- aColor);
+ if ( myPickingSettings ){
+ vtkFloatingPointType aPyramidHeight = myPickingSettings->GetPyramidHeight();
+ aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
+ //vtkFloatingPointType aColor[3] = myPreHighlightActor->GetProperty()->GetColor();
+ vtkFloatingPointType aColor[3];
+ theInteractorStyle->GetCurrentRenderer()->GetBackground( aColor );
+ aColor[0] = 1. - aColor[0];
+ aColor[1] = 1. - aColor[1];
+ aColor[2] = 1. - aColor[2];
+
+ myCursorPyramid->Init(aPyramidHeight,
+ myPickingSettings->GetCursorSize(),
+ GetRadius(anObjId,aVtkId,aScalarArray),
+ GetMagnification(anObjId),
+ GetClamp(anObjId),
+ aLocalNodeCoord,
+ aColor);
+ }
+
}
+ this->Transform->Pop();
myLastPreHighlightObjID = anObjId;
}
myCursorPyramid->SetVisibility(true);
vtkIdType theInitialHasIndex,
vtkIdType theCurrentHasIndex)
{
- if(theInitialHasIndex + theCurrentHasIndex == 1){
+ if( (theInitialHasIndex + theCurrentHasIndex == 1) && thePickingSettings){
vtkCamera *aCamera = theRenderer->GetActiveCamera();
vtkFloatingPointType aZoomFactor = thePickingSettings->GetZoomFactor();
return false;
}
+
+
+void VISU_GaussPtsAct::SetPosition(double _arg[3]){
+ Superclass::SetPosition(_arg);
+ Highlight(isHighlighted());
+}
+
//==================================================================
// function : Highlight
// purpose :
if(!mySelector.GetPointer())
return;
+ if ( !myPickingSettings )
+ {
+ Superclass::Highlight(theIsHighlight);
+ return;
+ }
+
Selection_Mode aSelectionMode = mySelector->SelectionMode();
bool anInitialHasIndex = isHighlighted() && mySelectionMode == GaussPointSelection;
myOutlineActor->SetVisibility(false);
myCursorPyramid->SetVisibility(false);
-
- myTextActor->SetVisibility(anIsVisible);
- myCellActor->SetVisibility(anIsVisible);
- GetScalarBarCtrl()->SetIsMarked(anIsVisible);
- myCursorPyramidSelected->SetVisibility(anIsVisible);
- //GetScalarBarCtrl()->Update();
-
- myIsHighlighted = aCurrentHasIndex;
-
- // Zoom if necessary
- ChangeZoom(myPickingSettings,
- GetRenderer(),
- anInitialHasIndex,
- aCurrentHasIndex);
+ myTextActor->SetVisibility(false);
+ myCellActor->SetVisibility(false);
+ myCursorPyramidSelected->SetVisibility(false);
if(!theIsHighlight)
return;
if ( !aCurrentHasIndex || !myBarVisibility )
return;
+ myTextActor->SetVisibility(anIsVisible);
+ myCellActor->SetVisibility(anIsVisible && myPickingSettings->GetDisplayParentMesh());
+ GetScalarBarCtrl()->SetIsMarked(anIsVisible);
+ myCursorPyramidSelected->SetVisibility(anIsVisible);
+//GetScalarBarCtrl()->Update();
+
+ myIsHighlighted = aCurrentHasIndex;
+
+ // Zoom if necessary
+ ChangeZoom(myPickingSettings,
+ GetRenderer(),
+ anInitialHasIndex,
+ aCurrentHasIndex);
+
// TColStd_IndexedMapOfInteger aMapIndex;
mySelector->GetIndex( getIO(), aMapIndex );
if(aMapIndex.Extent() != 1 || !myBarVisibility) {
int anObjId = aMapIndex(1);
vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
+ if ( !aNodeCoord )
+ return;
+ //Take into account translation
+ vtkFloatingPointType aLocalNodeCoord[3];
+ this->Transform->Push();
+ this->Transform->PostMultiply();
+ this->Transform->Identity();
+ this->Transform->Translate(this->Position[0],
+ this->Position[1],
+ this->Position[2]);
+ double aPosition[3];
+ this->Transform->GetPosition(aPosition);
+ aLocalNodeCoord[0] = aNodeCoord[0] + aPosition[0];
+ aLocalNodeCoord[1] = aNodeCoord[1] + aPosition[1];
+ aLocalNodeCoord[2] = aNodeCoord[2] + aPosition[2];
+ this->Transform->Pop();
vtkFloatingPointType aFocalPnt[3];
aCamera->GetFocalPoint(aFocalPnt);
- if ( !aNodeCoord || CheckIsSameVector( aNodeCoord, aFocalPnt, 3 ) )
+ if ( CheckIsSameVector(aLocalNodeCoord, aFocalPnt, 3 ) )
return;
// FlyTo
anInteractor->SetDolly(0.0);
anInteractor->SetNumberOfFlyFrames(myPickingSettings->GetStepNumber());
- anInteractor->FlyTo(aRenderer, aNodeCoord);
+ anInteractor->FlyTo(aRenderer, aLocalNodeCoord);
aRenderer->ResetCameraClippingRange();
anInteractor->SetDolly(aDollyWas);
anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
- anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aNodeCoord);
+ anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aLocalNodeCoord);
//
std::ostringstream aStr;
// int anObjId = aMapIndex(1);
//
vtkIdType aVtkId = GetNodeVTKID(anObjId);
if(aVtkId >= 0){
- vtkFloatingPointType *aNodeCoord = GetNodeCoord(anObjId);
- vtkFloatingPointType aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.};
+ vtkFloatingPointType aWorldCoord[4] = {aLocalNodeCoord[0], aLocalNodeCoord[1], aLocalNodeCoord[2], 1.};
//
vtkDataSet* aDataSet = GetInput();
vtkPointData* aDataSetAttributes = aDataSet->GetPointData();
GetRadius(anObjId,aVtkId,aScalarArray),
GetMagnification(anObjId),
GetClamp(anObjId),
- aNodeCoord,
+ aLocalNodeCoord,
myHighlightActor->GetProperty()->GetColor());
myCursorPyramidSelected->SetVisibility(anIsVisible && theIsHighlight);
//
myCellActor->SetVisibility(anIsVisible && theIsHighlight);
myCellActor->SetRepresentation(VTK_WIREFRAME);
}
+ else
+ myCellActor->SetVisibility(false);
}
}
VISU_GaussPtsAct
::UpdatePickingSettings()
{
- if(!myPickingSettings || myPickingSettings->GetInitial())
+ if(!myPickingSettings)
return;
myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition());
myEventCallbackCommand->SetCallback(VISU_GaussPtsAct1::ProcessEvents);
+ vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
+
myInsideDeviceActor->SetVisibility(false);
myInsideDeviceActor->SetPickable(false);
+ myInsideDeviceActor->SetUserMatrix(aMatrix);
myInsideDeviceActor->Delete();
myOutsideDeviceActor->SetVisibility(false);
myOutsideDeviceActor->SetPickable(false);
+ myOutsideDeviceActor->SetUserMatrix(aMatrix);
myOutsideDeviceActor->Delete();
+ aMatrix->Delete();
}
VISU_GaussPtsAct1
}
+int
+VISU_GaussPtsAct1
+::RenderOpaqueGeometry(vtkViewport *viewport)
+{
+
+ Superclass::RenderOpaqueGeometry(viewport);
+ GetMatrix(myInsideDeviceActor->GetUserMatrix());
+ GetMatrix(myOutsideDeviceActor->GetUserMatrix());
+ return 1;
+}
+
+int
+VISU_GaussPtsAct1
+::RenderTranslucentGeometry(vtkViewport *viewport)
+{
+ Superclass::RenderTranslucentGeometry(viewport);
+ GetMatrix(myInsideDeviceActor->GetUserMatrix());
+ GetMatrix(myOutsideDeviceActor->GetUserMatrix());
+
+ return 1;
+}
+
//----------------------------------------------------------------------------
void
VISU_GaussPtsAct1
//----------------------------------------------------------------
+
+void
+VISU_GaussPtsAct1::SetPosition(double _arg[3]){
+ if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::SetPosition - this = "<<this);
+ Superclass::SetPosition(_arg);
+ myUpdatePositionSignal(_arg);
+}
+
void
VISU_GaussPtsAct1
::Connect(VISU_GaussPtsAct2* theActor)
{
mySetVisibilitySignal.connect(boost::bind(&VISU_GaussPtsAct2::SetVisibility,theActor,_1));
+ myUpdatePositionSignal.connect(boost::bind(&VISU_GaussPtsAct2::SetPosition, theActor,_1));
}
void
Superclass::ShallowCopyPL(thePipeLine);
}
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct2::SetPosition(double _arg[3]){
+ if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct2::SetPosition - this = "<<this);
+ Superclass::SetPosition(_arg);
+}
//----------------------------------------------------------------------------
void
VISU::TGaussPtsActorFactory*
GetGaussPtsFactory();
+ virtual
+ void
+ SetPosition(double _arg[3]);
+
//----------------------------------------------------------------------------
//! Add actor to the renderer.
virtual
void
SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
+ //! Redefined method of rendering the Opaque Geometry.
+ virtual
+ int
+ RenderOpaqueGeometry(vtkViewport *viewport);
+
+ //! Redefined method of rendering the Translucent Geometry.
+ virtual
+ int
+ RenderTranslucentGeometry(vtkViewport *viewport);
+
+ virtual
+ void
+ SetPosition(double _arg[3]);
+
//! Gets memory size used by the instance (bytes).
virtual
unsigned long int
OnInteractorEvent(unsigned long theEvent);
boost::signal1<void,int> mySetVisibilitySignal;
+ boost::signal1<void,double*> myUpdatePositionSignal;
VISU_OutsideCursorSettings* myOutsideCursorSettings;
//----------------------------------------------------------------------------
virtual
unsigned long int
GetMemorySize();
-
+
+ virtual
+ void
+ SetPosition(double _arg[3]);
+
protected:
//----------------------------------------------------------------------------
VISU_GaussPtsAct2();
// $Header$
#include "VISU_GaussPtsSettings.h"
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
#include <vtkObjectFactory.h>
#include <vtkImageData.h>
+#include <QColor>
+
//----------------------------------------------------------------
vtkStandardNewMacro( VISU_GaussPtsSettings );
vtkStandardNewMacro( VISU_InsideCursorSettings );
//----------------------------------------------------------------
VISU_PickingSettings::VISU_PickingSettings()
{
- this->Initial = true;
+ float aCursorSize = 0.5;
+ float aPyramidHeight = 10.0;
+ float aPointTolerance = 0.1;
+ QColor aColor = Qt::yellow;
+ int anInfoWindowTransparency = 50;
+ int anInfoWindowPosition = VISU_PickingSettings::BelowPoint;
+ float aZoomFactor = 1.5;
+ int aStepNumber = 10;
+ bool aDisplayParentMesh = false;
+
+ SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
- this->PyramidHeight = -1;
- this->CursorSize = -1;
- this->PointTolerance = -1;
- this->Color[0] = -1;
- this->Color[1] = -1;
- this->Color[2] = -1;
- this->InfoWindowTransparency = -1;
- this->InfoWindowPosition = -1;
- this->ZoomFactor = -1;
- this->StepNumber = -1;
- this->DisplayParentMesh = false;
+ this->CursorSize = aResourceMgr->doubleValue( "VISU", "picking_cursor_size", aCursorSize );
+
+ this->PyramidHeight = aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", aPyramidHeight );
+
+ this->PointTolerance = aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", aPointTolerance );
+
+ aColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", aColor );
+ this->Color[0] = aColor.red() / 255.0;
+ this->Color[1] = aColor.green() / 255.0;
+ this->Color[2] = aColor.blue() / 255.0;
+
+ this->InfoWindowTransparency = aResourceMgr->integerValue( "VISU", "picking_transparency", anInfoWindowTransparency ) / 100.0;
+
+ this->InfoWindowPosition = aResourceMgr->integerValue( "VISU", "picking_position", anInfoWindowPosition );
+
+ this->ZoomFactor = aResourceMgr->doubleValue( "VISU", "picking_zoom_factor", aZoomFactor );
+
+ this->StepNumber = aResourceMgr->integerValue( "VISU", "picking_step_number", aStepNumber );
+
+ this->DisplayParentMesh = aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", aDisplayParentMesh );
}
VISU_PickingSettings::~VISU_PickingSettings()
VISU_PickingSettings*
New();
- vtkSetMacro( Initial, bool );
- vtkGetMacro( Initial, bool );
-
vtkSetMacro( PyramidHeight, vtkFloatingPointType );
vtkGetMacro( PyramidHeight, vtkFloatingPointType );
vtkGetMacro( DisplayParentMesh, bool );
private:
- bool Initial;
-
vtkFloatingPointType PyramidHeight;
vtkFloatingPointType CursorSize;
vtkFloatingPointType PointTolerance;
--- /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
#include <SALOME_InteractiveObject.hxx>
+#include "utilities.h"
#include <vtkRenderer.h>
#include <vtkObjectFactory.h>
-//using namespace std;
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
vtkStandardNewMacro(VISU_PointMap3dActor);
//==================================================================
VISU_PointMap3dActor
::VISU_PointMap3dActor()
{
+ if(MYDEBUG) MESSAGE("VISU_PointMap3dActor::VISU_PointMap3dActor - this = "<<this);
myScalarBar = VISU_ScalarBarActor::New();
}
VISU_PointMap3dActor
::~VISU_PointMap3dActor()
{
+ if(MYDEBUG) MESSAGE("VISU_PointMap3dActor::~VISU_PointMap3dActor - this = "<<this);
myScalarBar->Delete();
}
#include "VISU_VectorsAct.h"
#include "VISU_VectorsPL.hxx"
+#include <SVTK_Actor.h>
// VTK Includes
#include <vtkObjectFactory.h>
VISU_VectorsAct
::SetPipeLine(VISU_PipeLine* thePipeLine)
{
- myVectorsPL = dynamic_cast<VISU_VectorsPL*>(thePipeLine);
- VISU_Actor::SetPipeLine(myVectorsPL.GetPointer());
+ myVectorsPL = dynamic_cast<VISU_VectorsPL*>( thePipeLine );
+
+ Superclass::SetPipeLine( myVectorsPL.GetPointer() );
}
VISU_VectorsAct
::SetTransform(VTKViewer_Transform* theTransform)
{
- Superclass::SetTransform(theTransform);
- myVectorsPL->SetTransform(theTransform);
+ // To perform only vector's specific action,
+ // there is nothing to be done for the Superclass
+ myVectorsPL->SetTransform( theTransform );
}
else if(vtkPolyDataMapper* aMapper = dynamic_cast<vtkPolyDataMapper*>(theMapper))
aMapper->SetInput(myPassFilter[3]->GetPolyDataOutput());
}
+
vtkLODActor::SetMapper(theMapper);
}
VISU_PlanesWidget.hxx \
VISU_SphereWidget.hxx \
VISU_WidgetCtrl.hxx \
- VISU_ScalarMapOnDeformedShapePL.hxx \
- VISUPipeline.hxx
+ VISU_DeformedShapeAndScalarMapPL.hxx \
+ VISUPipeline.hxx \
+ VISU_LabelPointsFilter.hxx \
+ VISU_ElnoDisassembleFilter.hxx \
+ VISU_ElnoAssembleFilter.hxx \
+ VISU_DeformationPL.hxx \
+ VISU_OptionalDeformationPL.hxx
dist_libVisuPipeLine_la_SOURCES= \
VISU_MapperHolder.cxx \
VISU_SphereWidget.cxx \
VISU_WidgetCtrl.cxx \
VISU_ScalarBarCtrl.cxx \
- VISU_ScalarMapOnDeformedShapePL.cxx
+ VISU_DeformedShapeAndScalarMapPL.cxx \
+ VISU_LabelPointsFilter.cxx \
+ VISU_ElnoDisassembleFilter.cxx \
+ VISU_ElnoAssembleFilter.cxx \
+ VISU_DeformationPL.cxx \
+ VISU_OptionalDeformationPL.cxx
libVisuPipeLine_la_CPPFLAGS= \
$(VTK_INCLUDES) \
// Author: Alexey PETROV
// Module : VISU
+
+// Salome includes
+#include "VISU_Convertor.hxx"
+#include "VISU_ConvertorUtils.hxx"
+
#include "VISU_MeshPL.hxx"
#include "VISU_ScalarMapPL.hxx"
#include "VISU_IsoSurfacesPL.hxx"
#include "VISU_VectorsPL.hxx"
#include "VISU_StreamLinesPL.hxx"
#include "VISU_GaussPointsPL.hxx"
-#include "VISU_ScalarMapOnDeformedShapePL.hxx"
+#include "VISU_DeformedShapeAndScalarMapPL.hxx"
#include "VISU_Plot3DPL.hxx"
-#include "VISU_ScalarBarActor.hxx"
-
-#include "VISU_DeformedGridPL.hxx"
+#include "VISU_ScalarBarActor.hxx"
#include "VISU_OpenGLPointSpriteMapper.hxx"
#include "VTKViewer_GeometryFilter.h"
-#include <vtkMaskPoints.h>
-#include "VISU_Convertor.hxx"
-#include "VISU_TableReader.hxx"
-#include "VISU_ConvertorUtils.hxx"
+#include "VISU_ElnoDisassembleFilter.hxx"
+#include "VISU_ElnoAssembleFilter.hxx"
-typedef VISU_StreamLinesPL TPresent;
+typedef VISU_ScalarMapPL TPresent;
+// VTK includes
+#include <vtkShrinkFilter.h>
+#include <vtkPointLocator.h>
+#include <vtkCutter.h>
+#include <vtkPlane.h>
+#include <vtkWarpVector.h>
+#include <vtkScalarBarActor.h>
+#include <vtkScalarBarWidget.h>
+#include <vtkMaskPoints.h>
+#include <vtkUnstructuredGridReader.h>
#include <vtkUnstructuredGrid.h>
#include <vtkDataSetMapper.h>
-
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderWindow.h>
#include <vtkImageData.h>
+#include <vtkCellData.h>
#include <vtkRenderer.h>
#include <vtkCamera.h>
#include <vtkActor.h>
#include <vtk3DWidget.h>
-
#include <vtkProperty.h>
-#include <QFileInfo>
-
-#include <memory>
-
-//#define _DEBUG_ID_MAPPING_
-
-//----------------------------------------------------------------------------
-template<class TPipeLine>
-VISU_ColoredPL*
-CreateColoredPL(VISU_Convertor* theConvertor,
- const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName,
- int theTimeStampNumber);
-
+#include "utilities.h"
-//----------------------------------------------------------------------------
-template<>
-VISU_ColoredPL*
-CreateColoredPL<VISU_GaussPointsPL>(VISU_Convertor* theConvertor,
- const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName,
- int theTimeStampNumber)
-{
- VISU_GaussPointsPL* aPresent = VISU_GaussPointsPL::New();
- VISU::PGaussPtsIDMapper aGaussPtsIDMapper =
- theConvertor->GetTimeStampOnGaussPts(theMeshName,
- theEntity,
- theFieldName,
- theTimeStampNumber);
- aPresent->SetGaussPtsIDMapper(aGaussPtsIDMapper);
-
- char aMainTexture[80];
- strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) );
- strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.bmp" );
-
- char anAlphaTexture[80];
- strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) );
- strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.bmp" );
-
- vtkSmartPointer<vtkImageData> aTextureValue =
- VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture );
- aPresent->SetImageData( aTextureValue.GetPointer() );
-
- aPresent->Update();
-
-#ifdef _DEBUG_ID_MAPPING_
- vtkDataSet* aDataSet = aPresent->GetOutput();
- aDataSet->Update();
- int aNbCells = aDataSet->GetNumberOfCells();
- cout<<"aNbCells = "<<aNbCells<<endl;
- for(int anCellId = 0; anCellId < aNbCells; anCellId++){
- vtkIdType anObjID = aPresent->GetNodeObjID(anCellId);
- vtkIdType aVtkID = aPresent->GetNodeVTKID(anObjID);
- cout<<anObjID<<"; "<<aVtkID<<"; - ";
- vtkFloatingPointType* aCoord = aPresent->GetNodeCoord(anObjID);
- cout<<aCoord[0]<<"; "<<aCoord[1]<<"; "<<aCoord[2]<<endl;
- }
-#endif
-
- return aPresent;
+void PrintMissing(){
+ MESSAGE(std::endl << "VISUPipeLine : missing operand after `VISUPipeLine'" <<
+ std::endl << "VISUPipeLine : Try `VISUPipeLine -h' for more information.");
}
-
-//----------------------------------------------------------------------------
-template<class TPipeLine>
-VISU_ColoredPL*
-CreateColoredPL(VISU_Convertor* theConvertor,
- const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName,
- int theTimeStampNumber)
-{
- TPipeLine* aPresent = TPipeLine::New();
- VISU::PUnstructuredGridIDMapper anUnstructuredGridIDMapper =
- theConvertor->GetTimeStampOnMesh(theMeshName,
- theEntity,
- theFieldName,
- theTimeStampNumber);
- aPresent->SetUnstructuredGridIDMapper(anUnstructuredGridIDMapper);
-
- //aPresent->ClearGeometry();
- //{
- // VISU::PUnstructuredGridIDMapper anIDMapper =
- // theConvertor->GetMeshOnGroup(theMeshName,
- // "groupe1");
- // aPresent->AddGeometry(anIDMapper->GetOutput());
- //}
- //{
- // VISU::PUnstructuredGridIDMapper anIDMapper =
- // theConvertor->GetMeshOnGroup(theMeshName,
- // "TUBEH ");
- // aPresent->AddGeometry(anIDMapper->GetOutput());
- //}
- //{
- // VISU::PUnstructuredGridIDMapper anIDMapper =
- // theConvertor->GetMeshOnGroup(theMeshName,
- // "STRI ");
- // aPresent->AddGeometry(anIDMapper->GetOutput());
- //}
- aPresent->Update();
- return aPresent;
+void PrintHelp(){
+ MESSAGE_ADD(std::endl << " Usage: VISUPipeLine filename meshname fieldname [timestamp] [component] " <<
+ std::endl << "filename - Name of the med file. " <<
+ std::endl << "meshname - Name of the mesh in the med file. " <<
+ std::endl << "fieldname - Name of the mesh field. " <<
+ std::endl << "timestamp - Number of the time stamp in the field 1,2,3 ... (optionally)" <<
+ std::endl << " by default used first time stamp. " <<
+ std::endl << "component - Number of the component in the field 0,1,2,3 ...(optionally)" <<
+ std::endl << " 0 - modulus, 1 - first component, 2 - second component, ... " <<
+ std::endl << " by default used modulus. ");
}
-
-//----------------------------------------------------------------------------
-struct TMEDSource
-{
- std::auto_ptr<VISU_Convertor> myConvertor;
-
- TMEDSource(char** argv): myConvertor(CreateConvertor(argv[1]))
- {
- myConvertor->BuildEntities();
- }
-};
-
-
-//----------------------------------------------------------------------------
-struct TMeshBulder: TMEDSource
-{
- TMeshBulder(char** argv): TMEDSource(argv)
- {}
-
- int Publish(vtkRenderer *theRenderer) const
- {
- const VISU::TMeshMap& aMeshMap = myConvertor->GetMeshMap();
- VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
- if(aMeshMapIter == aMeshMap.end())
- return 0;
-
- const std::string& aMeshName = aMeshMapIter->first;
- const VISU::PMesh aMesh = aMeshMapIter->second;
- const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
-
- VISU::TEntity anEntity = VISU::CELL_ENTITY;
- aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity);
-
- VISU::PNamedIDMapper anIDMapper = myConvertor->GetMeshOnEntity(aMeshName, anEntity);
-
- VISU_MeshPL* aPresent = VISU_MeshPL::New();
- aPresent->SetUnstructuredGridIDMapper(anIDMapper);
-
- vtkActor* anActor = vtkActor::New();
- anActor->SetMapper(aPresent->GetMapper());
- anActor->GetProperty()->SetRepresentation(VTK_WIREFRAME);
-
- theRenderer->AddActor(anActor);
- anActor->Delete();
-
- return 0;
- }
-};
+void PrintErr(){
+ MESSAGE("***************************ERROR*****************************************");
+}
//----------------------------------------------------------------------------
-struct TColoredPrsBulder: TMEDSource
+int
+main(int argc, char** argv)
{
- TColoredPrsBulder(char** argv): TMEDSource(argv)
- {}
-
- int Publish(vtkRenderer *theRenderer) const
- {
- myConvertor->BuildGroups();
- myConvertor->BuildFields();
- myConvertor->BuildMinMax();
- const VISU::TMeshMap& aMeshMap = myConvertor->GetMeshMap();
- VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
- if(aMeshMapIter == aMeshMap.end())
- return 0;
-
- const std::string& aMeshName = aMeshMapIter->first;
- const VISU::PMesh aMesh = aMeshMapIter->second;
- const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
-
- //Import fields
- aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
- for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++) {
- const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
- const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
- const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
- VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
- for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
- const VISU::PField aField = aFieldMapIter->second;
- //if(aField->myNbComp == 1)
- // continue;
- const std::string& aFieldName = aFieldMapIter->first;
- const VISU::TValField& aValField = aField->myValField;
- VISU::TValField::const_reverse_iterator aValFieldIter = aValField.rbegin();
- if(aValFieldIter == aValField.rend())
- return 0;
-
- int aTimeStamp = aValFieldIter->first;
-
- VISU_ColoredPL* aPresent = NULL;
- if(anEntity != VISU::NODE_ENTITY){
- aPresent = CreateColoredPL<TPresent>(myConvertor.get(),
- aMeshName,
- anEntity,
- aFieldName,
- aTimeStamp);
-
- }else{
- continue;
- aPresent = CreateColoredPL<TPresent>(myConvertor.get(),
- aMeshName,
- anEntity,
- aFieldName,
- aTimeStamp);
- }
-
- vtkActor* anActor = vtkActor::New();
- anActor->SetMapper(aPresent->GetMapper());
-
- VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New();
- aScalarBar->SetLookupTable(aPresent->GetBarTable());
-
- theRenderer->AddActor(anActor);
- anActor->Delete();
-
- theRenderer->AddActor2D(aScalarBar);
- aScalarBar->Delete();
- }
+ try{
+ if(argc == 1){
+ PrintMissing();
+ return 1;
+ }
+ if(argc == 2 && !strcmp(argv[1],"-h")) {
+ PrintHelp();
+ return 1;
}
- return 0;
- }
-};
-
-
-//----------------------------------------------------------------------------
-struct TXLSSource
-{
- VISU::TTableContainer myContainer;
-
- TXLSSource(char** argv)
- {
- VISU::ImportTables( argv[1], myContainer );
- }
-
- int Publish(vtkRenderer *theRenderer) const
- {
- if ( myContainer.empty() )
- return 0;
-
- VISU::PPolyDataIDMapper anIDMapper = myContainer[0];
-
- VISU_DeformedGridPL* aPresent = VISU_DeformedGridPL::New();
- aPresent->SetPolyDataIDMapper(anIDMapper);
- //aPresent->SetContourPrs( true );
- aPresent->Update();
-
- vtkActor* anActor = vtkActor::New();
- anActor->SetMapper(aPresent->GetMapper());
-
- theRenderer->AddActor(anActor);
- anActor->Delete();
- VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New();
- aScalarBar->SetLookupTable(aPresent->GetBarTable());
+ char* aFileName =0;
+ char* aMeshName =0;
+ char* aFieldName =0;
+ int aTimeStampNumber = 1;
+ int aComponentNumber = 0;
+ bool allInit = false;
+ bool isMeshOk = false;
+ bool isFieldOk = false;
+ bool isTimeStampOk = false;
+ bool isComponentOk = false;
+
+ if(argc == 4 ){
+ aFileName = new char[static_cast<int>(strlen(argv[1])) + 1];
+ aMeshName = new char[static_cast<int>(strlen(argv[2])) + 1];
+ aFieldName = new char[static_cast<int>(strlen(argv[3])) + 1];
+
+ strcpy(aFileName,argv[1]);
+ strcpy(aMeshName,argv[2]);
+ strcpy(aFieldName,argv[3]);
+
+ allInit = true;
+ }
+
+ if(argc == 5) {
+ aFileName = new char[static_cast<int>(strlen(argv[1])) + 1];
+ aMeshName = new char[static_cast<int>(strlen(argv[2])) + 1];
+ aFieldName = new char[static_cast<int>(strlen(argv[3])) + 1];
+
+ strcpy(aFileName,argv[1]);
+ strcpy(aMeshName,argv[2]);
+ strcpy(aFieldName,argv[3]);
+
+ aTimeStampNumber = atoi(argv[4]);
+ allInit = true;
+ }
- theRenderer->AddActor2D(aScalarBar);
- aScalarBar->Delete();
+ if(argc == 6) {
+ aFileName = new char[static_cast<int>(strlen(argv[1])) + 1];
+ aMeshName = new char[static_cast<int>(strlen(argv[2])) + 1];
+ aFieldName = new char[static_cast<int>(strlen(argv[3])) + 1];
+
+ strcpy(aFileName,argv[1]);
+ strcpy(aMeshName,argv[2]);
+ strcpy(aFieldName,argv[3]);
+
+ aTimeStampNumber = atoi(argv[4]);
+ aComponentNumber = atoi(argv[5]);
+ allInit = true;
+ }
- return 0;
- }
-};
-
-//----------------------------------------------------------------------------
-template<class TPrsBuilder>
-int RenderPresentation(const TPrsBuilder& thePrsBuilder)
-{
- vtkRenderWindow *aWindow = vtkRenderWindow::New();
- vtkRenderer *aRenderer = vtkRenderer::New();
-
- aWindow->AddRenderer(aRenderer);
- aRenderer->GetActiveCamera()->ParallelProjectionOn();
-
- vtkRenderWindowInteractor *anInteractor = vtkRenderWindowInteractor::New();
- anInteractor->SetRenderWindow(aWindow);
- aWindow->Delete();
-
- vtkInteractorStyle* aStyle = vtkInteractorStyleTrackballCamera::New();
- anInteractor->SetInteractorStyle(aStyle);
- aStyle->Delete();
-
- int aRet = thePrsBuilder.Publish(aRenderer);
-
- aWindow->Render();
- anInteractor->Start();
-
- return aRet;
-}
-
-//----------------------------------------------------------------------------
-int
-main(int argc, char** argv)
-{
- try{
- if (argc > 1) {
- QFileInfo aFileInfo( argv[1] );
- if ( aFileInfo.isFile() ) {
- QString anExtension = aFileInfo.suffix();
- if ( anExtension == "med" ) {
- //TMeshBulder aBuilder( argv );
- TColoredPrsBulder aBuilder( argv );
- return RenderPresentation( aBuilder );
- } else if ( anExtension == "xls" || anExtension == "txt" )
- return RenderPresentation( TXLSSource( argv ) );
+ if(allInit){
+
+ vtkRenderWindow *aWindow = vtkRenderWindow::New();
+ vtkRenderer *aRenderer = vtkRenderer::New();
+
+ aWindow->AddRenderer(aRenderer);
+ aRenderer->GetActiveCamera()->ParallelProjectionOn();
+
+ vtkRenderWindowInteractor *anInteractor = vtkRenderWindowInteractor::New();
+ anInteractor->SetRenderWindow(aWindow);
+ aWindow->Delete();
+
+ vtkInteractorStyle* aStyle = vtkInteractorStyleTrackballCamera::New();
+ anInteractor->SetInteractorStyle(aStyle);
+ aStyle->Delete();
+
+ VISU_Convertor* aConvertor = CreateConvertor(aFileName);
+ aConvertor->BuildEntities();
+ aConvertor->BuildGroups();
+ aConvertor->BuildFields();
+ aConvertor->BuildMinMax();
+ const VISU::TMeshMap& aMeshMap = aConvertor->GetMeshMap();
+ VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+ if(aMeshMapIter == aMeshMap.end()) return 0;
+ //Iterate by meshes
+ for (;aMeshMapIter != aMeshMap.end();aMeshMapIter++) {
+
+ const std::string& theMeshName = aMeshMapIter->first;
+ if( strcmp(aMeshName, theMeshName.c_str()) )
+ continue;
+ else
+ isMeshOk = true;
+
+ const VISU::PMesh aMesh = aMeshMapIter->second;
+ const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
+
+ aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+ //Iterate by meshes on entity
+ for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++) {
+ const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+ const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
+
+ const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+ VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
+
+ //Iterate by field
+ for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
+ const VISU::PField aField = aFieldMapIter->second;
+ const std::string& theFieldName = aFieldMapIter->first;
+
+ if( strcmp(aFieldName, theFieldName.c_str()) )
+ continue;
+ else
+ isFieldOk = true;
+
+ if(aComponentNumber > aField->myNbComp)
+ continue;
+ else
+ isComponentOk = true;
+
+ const VISU::TValField& aValField = aField->myValField;
+ VISU::TValField::const_iterator aValFieldIter = aValField.find(aTimeStampNumber);
+ if(aValFieldIter == aValField.end())
+ continue;
+ else
+ isTimeStampOk = true;
+
+ int aTimeStamp = aValFieldIter->first;
+
+ vtkActor* anActor = vtkActor::New();
+
+ if(anEntity != VISU::NODE_ENTITY){
+ VISU::PUnstructuredGridIDMapper anUnstructuredGridIDMapper =
+ aConvertor->GetTimeStampOnMesh(theMeshName,
+ anEntity,
+ theFieldName,
+ aTimeStamp);
+
+ vtkUnstructuredGrid* anUnstructuredGrid = anUnstructuredGridIDMapper->GetUnstructuredGridOutput();
+ VISU::WriteToFile( anUnstructuredGrid, "/data/apo/elno_from_id_mapper.vtk" );
+
+ VISU_ElnoDisassembleFilter* aDisassembleFilter = VISU_ElnoDisassembleFilter::New();
+ aDisassembleFilter->SetInput( anUnstructuredGrid );
+ aDisassembleFilter->SetShrinkFactor( 0.999 );
+ VISU::WriteToFile( aDisassembleFilter->GetOutput(), "/data/apo/elno_from_disassemble.vtk" );
+
+ vtkCutter *aCutter = vtkCutter::New();
+
+ vtkPointLocator* aPointLocator = vtkPointLocator::New();
+ aCutter->SetLocator( aPointLocator );
+ aPointLocator->Delete();
+
+ TPresent* aPresent = TPresent::New();
+ aPresent->SetUnstructuredGridIDMapper( anUnstructuredGridIDMapper );
+ //aPresent->SetOrientation( VISU_CutPlanesPL::ZX, 0.0, 0.0, 0 );
+ aPresent->Update();
+
+ aPresent->GetMapper()->InterpolateScalarsBeforeMappingOn();
+ anActor->SetMapper( aPresent->GetMapper() );
+
+ vtkScalarBarActor* aScalarBar = vtkScalarBarActor::New();
+ //aScalarBar->SetLookupTable( aMapperTable );
+ aScalarBar->SetLookupTable( aPresent->GetBarTable() );
+
+
+ vtkScalarBarWidget* aWidget = vtkScalarBarWidget::New();
+ aWidget->SetScalarBarActor( aScalarBar );
+ aWidget->SetInteractor( anInteractor );
+ aWidget->SetEnabled( true );
+
+ aRenderer->AddActor(anActor);
+ aRenderer->AddActor2D(aScalarBar);
+ }else{
+ continue;
+ }
+
+ aWindow->Render();
+ aRenderer->ResetCamera();
+
+ anInteractor->Start();
+ return 0;
+ }
+ }
}
}
+ else{
+ PrintMissing();
+ return 1;
+ }
+
+ if(!isMeshOk) {
+ PrintErr();
+ MESSAGE("Can not find mesh with name `"<<aMeshName<<"' in the file `"<<aFileName<<"'");
+ PrintErr();
+ return 1;
+ }
+ if(!isFieldOk) {
+ PrintErr();
+ MESSAGE("Can not find field with name `"<<aFieldName<<"' on the mesh `"<<aMeshName<<"'");
+ PrintErr();
+ return 1;
+ }
+ if(!isComponentOk) {
+ PrintErr();
+ MESSAGE("Field field with name `"<<aFieldName<<"' containt less then `"<<aComponentNumber<<"' component(s).");
+ PrintErr();
+ return 1;
+ }
+ if(!isTimeStampOk) {
+ PrintErr();
+ MESSAGE("Can not find time stamp with number `"<<aTimeStampNumber<<"' on the field `"<<aFieldName<<"'");
+ PrintErr();
+ }
}catch(std::exception& exc){
MSG(true, "Follow exception was occured :\n"<<exc.what());
}catch(...){
- MSG(true, "Unknown exception was occured!");
+ MSG(true, "Unknown exception was occured in VISU_Convertor_impl");
}
return 1;
}
myFieldTransform->SetInput(myExtractor->GetOutput());
GetMapperHolder()->SetLookupTable(GetMapperTable());
- GetMapper()->SetUseLookupTableScalarRange(true);
+ //GetMapper()->InterpolateScalarsBeforeMappingOn();
+ GetMapper()->SetUseLookupTableScalarRange( true );
GetMapper()->SetColorModeToMapScalars();
GetMapper()->ScalarVisibilityOn();
}
Modified();
}
+vtkDataSet*
+VISU_CutLinesPL
+::InsertCustomPL()
+{
+ return myAppendPolyData->GetOutput();
+}
//----------------------------------------------------------------------------
vtkFloatingPointType
void
Init();
+ vtkDataSet*
+ InsertCustomPL();
+
virtual
void
Update();
#include "VISU_FieldTransform.hxx"
#include "VISU_PipeLineUtils.hxx"
#include "VTKViewer_GeometryFilter.h"
+#include "VISU_MapperHolder.hxx"
+#include "VISU_DeformationPL.hxx"
#include <vtkAppendPolyData.h>
#include <vtkCutter.h>
#include <vtkPlane.h>
+//#include <vtkUnstructuredGrid.h>
+
static vtkFloatingPointType EPS = 1.0E-3;
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_CutPlanesPL);
//----------------------------------------------------------------------------
VISU_CutPlanesPL
-::VISU_CutPlanesPL()
+::VISU_CutPlanesPL():
+ VISU_OptionalDeformationPL()
{
+ if(MYDEBUG) MESSAGE("VISU_CutPlanesPL()::VISU_CutPlanesPL() - "<<this);
+
SetIsShrinkable(false);
+ SetElnoDisassembleState( true );
+
myAppendPolyData = vtkAppendPolyData::New();
myNbParts = 10;
myAng[0][0] = myAng[0][1] = myAng[0][2] = 0.0;
myAng[1][0] = myAng[1][1] = myAng[1][2] = 0.0;
+ UseDeformation(false);
}
VISU_CutPlanesPL
::~VISU_CutPlanesPL()
{
+ if(MYDEBUG) MESSAGE("VISU_CutPlanesPL()::~VISU_CutPlanesPL() - "<<this);
myAppendPolyData->Delete();
myAppendPolyData = NULL;
}
::GetMTime()
{
unsigned long int aTime = Superclass::GetMTime();
-
+
+ if(IsDeformed()) {
+ aTime = std::max(aTime, VISU_OptionalDeformationPL::GetMTime());
+ }
+
aTime = std::max(aTime, myAppendPolyData->GetMTime());
return aTime;
::Init()
{
Superclass::Init();
-
SetNbParts(10);
myBasePlane[0] = YZ;
myDisplacement[0] = 0.5;
myAng[0][0] = myAng[0][1] = myAng[0][2] = 0.0;
+ SetScale(VISU_DeformationPL::GetDefaultScaleFactor(this));
}
VISU_CutPlanesPL
::InsertCustomPL()
{
- return myAppendPolyData->GetOutput();
+ return GetWarpVectorOutput();
}
{
ClearAppendPolyData(myAppendPolyData);
- SetPartPosition();
+ if(!myVectorialField || !IsDeformed()){
+ SetMergeFilterInput(GetMergedInput(),GetMergedInput());
+ }
+
+
+ if(VISU::IsDataOnCells(GetMergedInput()))
+ GetMapper()->SetScalarModeToUseCellData();
+ else
+ GetMapper()->SetScalarModeToUsePointData();
+
+ SetPartPosition();
+
vtkFloatingPointType aDir[3];
GetDir(aDir,
myAng[0],
myBasePlane[0]);
-
+
vtkFloatingPointType aBounds[6];
- GetMergedInput()->GetBounds(aBounds);
+
+ vtkDataSet* aFilterOutput = GetMergeFilterOutput();
+
+ aFilterOutput->GetBounds(aBounds);
CutWithPlanes(myAppendPolyData,
- GetMergedInput(),
+ aFilterOutput,
myNbParts,
aDir,
aBounds,
myPartCondition,
myDisplacement[0]);
+
+
+ SetWarpVectorInput(myAppendPolyData->GetOutput());
Superclass::Update();
}
vtkFloatingPointType aPosition = myPartPosition[thePartNumber];
if(myPartCondition[thePartNumber]){
vtkFloatingPointType aDir[3], aBounds[6], aBoundPrj[3];
- GetMergedInput()->GetBounds(aBounds);
+ if(!IsDeformed())
+ GetMergedInput()->GetBounds(aBounds);
+ else
+ GetMergeFilterOutput()->GetBounds(aBounds);
+
GetDir(aDir,
myAng[theNum],
//----------------------------------------------------------------------------
+void
+VISU_CutPlanesPL::SetVectorialField(VISU::PUnstructuredGridIDMapper theMapper)
+{
+ if(myVectorialField == theMapper)
+ return;
+
+ if(CheckCanDeformate(theMapper->GetOutput())){
+ myVectorialField = theMapper;
+
+ SetMergeFilterInput(GetMergedInput(),theMapper->GetOutput());
+ }
+ else
+ UseDeformation(false);
+
+ Modified();
+}
+
+//----------------------------------------------------------------------------
+VISU::PUnstructuredGridIDMapper VISU_CutPlanesPL::
+getVectorialField()
+{
+ return myVectorialField;
+}
+
+//----------------------------------------------------------------------------
+void VISU_CutPlanesPL::SetMapScale(vtkFloatingPointType theMapScale){
+ Superclass::SetMapScale(theMapScale);
+ if(IsDeformed())
+ VISU_OptionalDeformationPL::SetMapScale(theMapScale);
+}
#include "VISUPipeline.hxx"
#include "VISU_ScalarMapPL.hxx"
+#include "VISU_OptionalDeformationPL.hxx"
+#include "VISU_MapperHolder.hxx"
#include <vector>
//----------------------------------------------------------------------------
-class VISU_PIPELINE_EXPORT VISU_CutPlanesPL : public VISU_ScalarMapPL
+class VISU_PIPELINE_EXPORT VISU_CutPlanesPL : public VISU_ScalarMapPL,
+ public VISU_OptionalDeformationPL
{
public:
vtkTypeMacro(VISU_CutPlanesPL, VISU_ScalarMapPL);
const std::vector<int>& thePlaneCondition,
vtkFloatingPointType theDisplacement);
+ virtual void SetVectorialField(VISU::PUnstructuredGridIDMapper);
+ VISU::PUnstructuredGridIDMapper getVectorialField();
+
+ virtual
+ void
+ SetMapScale(vtkFloatingPointType theMapScale = 1.0);
+
+
protected:
VISU_CutPlanesPL();
#include "VISU_DataSetMapperHolder.hxx"
#include "SALOME_ExtractGeometry.h"
+#include "VISU_ElnoDisassembleFilter.hxx"
#include "VISU_LookupTable.hxx"
#include "VISU_PipeLineUtils.hxx"
#include <vtkImplicitFunctionCollection.h>
#include <vtkMath.h>
+#include <cmath>
+
#ifdef _DEBUG_
static int MYDEBUG = 0;
#else
//----------------------------------------------------------------------------
VISU_DataSetMapperHolder
::VISU_DataSetMapperHolder():
- myExtractGeometry(SALOME_ExtractGeometry::New())
+ myElnoDisassembleFilter( VISU_ElnoDisassembleFilter::New() ),
+ myExtractGeometry( SALOME_ExtractGeometry::New() )
{
if(MYDEBUG) MESSAGE("VISU_DataSetMapperHolder::VISU_DataSetMapperHolder - "<<this);
+ myElnoDisassembleFilter->Delete();
+
// Clipping functionality
myExtractGeometry->Delete();
myExtractGeometry->SetStoreMapping(true);
}
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::SetElnoDisassembleState( bool theIsShrunk )
+{
+ vtkFloatingPointType aShrinkFactor = std::abs( myElnoDisassembleFilter->GetShrinkFactor() );
+ if ( theIsShrunk )
+ myElnoDisassembleFilter->SetShrinkFactor( aShrinkFactor );
+ else
+ myElnoDisassembleFilter->SetShrinkFactor( -aShrinkFactor );
+}
+
+
//----------------------------------------------------------------------------
unsigned long int
VISU_DataSetMapperHolder
VISU_DataSetMapperHolder
::SetUnstructuredGridIDMapper(const VISU::PUnstructuredGridIDMapper& theIDMapper)
{
- myExtractGeometry->SetInput(theIDMapper->GetUnstructuredGridOutput());
+ myElnoDisassembleFilter->SetInput( theIDMapper->GetUnstructuredGridOutput() );
+ myExtractGeometry->SetInput( myElnoDisassembleFilter->GetOutput() );
myUnstructuredGridIDMapper = theIDMapper;
- SetIDMapper(theIDMapper);
+ SetIDMapper( theIDMapper );
}
class vtkDataSetMapper;
class vtkUnstructuredGrid;
class SALOME_ExtractGeometry;
+class VISU_ElnoDisassembleFilter;
//----------------------------------------------------------------------------
ShallowCopy(VISU_MapperHolder *theMapperHolder,
bool theIsCopyInput);
+ void
+ SetElnoDisassembleState( bool theIsShrunk );
+
//! Gets memory size used by the instance (bytes).
virtual
unsigned long int
private:
//----------------------------------------------------------------------------
VISU::PUnstructuredGridIDMapper myUnstructuredGridIDMapper;
- vtkSmartPointer<vtkDataSetMapper> myDataSetMapper;
- vtkSmartPointer<SALOME_ExtractGeometry> myExtractGeometry; //!< Clipping
+ vtkSmartPointer< VISU_ElnoDisassembleFilter > myElnoDisassembleFilter; //!< Handling ELNO data
+ vtkSmartPointer< SALOME_ExtractGeometry > myExtractGeometry; //!< Clipping
+ vtkSmartPointer< vtkDataSetMapper > myDataSetMapper;
};
#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
myContourFilter(vtkContourFilter::New()),
myWarpScalar(vtkWarpScalar::New()),
myIsContour(false),
- myScaleFactor(1.0)
+ myScaleFactor(1.0),
+ myMapScaleFactor(1.0)
{
SetIsShrinkable(false);
SetNumberOfContours(32);
{
if ( VISU::CheckIsSameValue( myWarpScalar->GetScaleFactor(), theScaleFactor ) )
return;
+
myScaleFactor = theScaleFactor;
- myWarpScalar->SetScaleFactor(theScaleFactor);
+ myWarpScalar->SetScaleFactor(theScaleFactor*myMapScaleFactor);
}
::SetMapScale(vtkFloatingPointType theMapScale)
{
Superclass::SetMapScale(theMapScale);
+ myMapScaleFactor = theMapScale;
if ( myIsContour ) {
vtkFloatingPointType aSourceRange[2];
void operator=(const VISU_DeformedGridPL&); // Not implemented.
vtkFloatingPointType myScaleFactor;
+ vtkFloatingPointType myMapScaleFactor;
vtkContourFilter* myContourFilter;
vtkWarpScalar *myWarpScalar;
bool myIsContour;
--- /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
//----------------------------------------------------------------------------
VISU_DeformedShapePL
::VISU_DeformedShapePL():
- myScaleFactor(0.0)
+ myScaleFactor(0.0),
+ myMapScaleFactor(1.0)
{
SetIsShrinkable(true);
{
if(VISU::CheckIsSameValue(myWarpVector->GetScaleFactor(), theScale))
return;
-
- myWarpVector->SetScaleFactor(theScale);
+
+ myWarpVector->SetScaleFactor(theScale*myMapScaleFactor);
myScaleFactor = theScale;
}
VISU_DeformedShapePL
::SetMapScale(vtkFloatingPointType theMapScale)
{
+ myMapScaleFactor = theMapScale;
Superclass::SetMapScale(theMapScale);
- myWarpVector->SetScaleFactor(myScaleFactor*theMapScale);
+ vtkFloatingPointType aMapScale = myScaleFactor * theMapScale;
+ if(VISU::CheckIsSameValue(myWarpVector->GetScaleFactor(), aMapScale))
+ return;
+
+ myWarpVector->SetScaleFactor( aMapScale );
}
bool theIsCopyInput);
vtkFloatingPointType myScaleFactor;
+ vtkFloatingPointType myMapScaleFactor;
vtkWarpVector *myWarpVector;
vtkCellDataToPointData* myCellDataToPointData;
--- /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
vtkInformationVector **theInputVector,
vtkInformationVector *theOutputVector)
{
- vtkDataSet *anInput = VISU::GetInput(theInputVector, 0);
- vtkDataSet *anOutput = VISU::GetOutput(theOutputVector);
+ vtkDataSet *anInput = VISU::GetInput( theInputVector, 0 );
+ vtkDataSet *anOutput = VISU::GetOutput( theOutputVector );
- anOutput->CopyStructure(anInput);
+ anOutput->CopyStructure( anInput );
vtkPointData *anInputPointData = anInput->GetPointData();
vtkPointData *anOutputPointData = anOutput->GetPointData();
- anOutputPointData->PassData(anInputPointData);
- if(VISU::IsDataOnPoints(anInput)){
+ anOutputPointData->PassData( anInputPointData );
+ if ( VISU::IsDataOnPoints( anInput ) ) {
int aNbElems = anInput->GetNumberOfPoints();
- if(anInputPointData->GetAttribute(vtkDataSetAttributes::VECTORS))
- ExecuteScalars(aNbElems, myScalarMode, anInputPointData, anOutputPointData);
+ if ( anInputPointData->GetAttribute( vtkDataSetAttributes::VECTORS ) )
+ ExecuteScalars( aNbElems, myScalarMode, anInputPointData, anOutputPointData );
}
vtkCellData *anInputCellData = anInput->GetCellData();
vtkCellData *anOutputCellData = anOutput->GetCellData();
- anOutputCellData->PassData(anInputCellData);
- if(VISU::IsDataOnCells(anInput)){
+ anOutputCellData->PassData( anInputCellData );
+ if ( VISU::IsDataOnCells( anInput ) ) {
int aNbElems = anInput->GetNumberOfCells();
- if(anInputCellData->GetAttribute(vtkDataSetAttributes::VECTORS))
- ExecuteScalars(aNbElems, myScalarMode, anInputCellData, anOutputCellData);
+ if ( anInputCellData->GetAttribute( vtkDataSetAttributes::VECTORS ) )
+ ExecuteScalars( aNbElems, myScalarMode, anInputCellData, anOutputCellData );
}
return 1;
#include "VISU_LookupTable.hxx"
#include "VISU_PipeLineUtils.hxx"
+#include "VISU_LabelPointsFilter.hxx"
#include <vtkContourFilter.h>
+
//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_IsoSurfacesPL);
{
SetIsShrinkable(false);
+ SetElnoDisassembleState( true );
+
myContourFilter = vtkContourFilter::New();
myCellDataToPointData = vtkCellDataToPointData::New();
return myContourFilter->GetNumberOfContours();
}
+//----------------------------------------------------------------------------
+vtkFloatingPointType
+VISU_IsoSurfacesPL
+::GetValue(int i)
+{
+ return myContourFilter->GetValue(i);
+}
+
//----------------------------------------------------------------------------
void
VISU::CellDataToPoint(myContourFilter,
myCellDataToPointData,
GetMergedInput());
+
}
int
GetNbParts();
+ virtual vtkFloatingPointType GetValue(int i);
+
virtual
void
SetNbParts(int theNb = 10);
--- /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
#include <cmath>
#include <string>
+#include "utilities.h"
+
#ifndef WNT
# ifndef GLX_GLXEXT_LEGACY
# define GLX_GLXEXT_LEGACY
{
#ifdef _DEBUG_RENDERING_PERFORMANCE_
// To control when the mapper is recalculated
- cout<<"VISU_OpenGLPointSpriteMapper::RenderPiece - "
- <<(this->GetMTime() > this->BuildTime)<<"; "
- <<(input->GetMTime() > this->BuildTime)<<"; "
- <<(act->GetProperty()->GetMTime() > this->BuildTime)<<"; "
- <<endl;
+ MESSAGE( "VISU_OpenGLPointSpriteMapper::RenderPiece - "
+ <<(this->GetMTime() > this->BuildTime)<<"; "
+ <<(input->GetMTime() > this->BuildTime)<<"; "
+ <<(act->GetProperty()->GetMTime() > this->BuildTime)<<"; ");
#endif
// sets this->Colors as side effect
this->MapScalars( act->GetProperty()->GetOpacity() );
--- /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
theTarget->SetScalarMode(theSource->GetScalarMode());
theTarget->SetImmediateModeRendering(theSource->GetImmediateModeRendering());
theTarget->SetUseLookupTableScalarRange(theSource->GetUseLookupTableScalarRange());
+ theTarget->SetInterpolateScalarsBeforeMapping(theSource->GetInterpolateScalarsBeforeMapping());
if(theSource->GetArrayAccessMode() == VTK_GET_ARRAY_BY_ID)
theTarget->ColorByArrayComponent(theSource->GetArrayId(), theSource->GetArrayComponent());
else
myIsRelative(true),
myIsContour(false),
myPosition(0.5),
- myScaleFactor(1.0)
+ myScaleFactor(1.0),
+ myMapScaleFactor(1.0)
{
SetIsShrinkable(false);
::SetScaleFactor(vtkFloatingPointType theScaleFactor)
{
myScaleFactor = theScaleFactor;
- myWarpScalar->SetScaleFactor(theScaleFactor);
+ myWarpScalar->SetScaleFactor(theScaleFactor*myMapScaleFactor);
}
VISU_Plot3DPL
::SetMapScale(vtkFloatingPointType theMapScale)
{
+ myMapScaleFactor = theMapScale;
Superclass::SetMapScale(theMapScale);
if ( myIsContour ) {
vtkFloatingPointType myAngle[3];
bool myIsRelative, myIsContour;
- vtkFloatingPointType myPosition, myScaleFactor;
+ vtkFloatingPointType myPosition, myScaleFactor, myMapScaleFactor;
VISU_CutPlanesPL::PlaneOrientation myOrientation;
vtkSmartPointer<vtkCellDataToPointData> myCellDataToPointData;
+++ /dev/null
-// VISU ScalarMapOnDeformedShapePL
-//
-// 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_ScalarMapOnDeformedShapePL.cxx
-// Author: Eugeny Nikolaev
-// Module : VISU
-
-#include "VISU_ScalarMapOnDeformedShapePL.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_PipeLineUtils.hxx"
-
-#include <vtkWarpVector.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkCellDataToPointData.h>
-#include <vtkPointDataToCellData.h>
-
-
-//----------------------------------------------------------------------------
-vtkStandardNewMacro(VISU_ScalarMapOnDeformedShapePL)
-
-//----------------------------------------------------------------------------
-/*!
- * 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_ScalarMapOnDeformedShapePL
-::VISU_ScalarMapOnDeformedShapePL():
- myScaleFactor(0.0)
-{
- myWarpVector = vtkWarpVector::New();
-
- myScalarsMergeFilter = VISU_MergeFilter::New();
- myScalarsMergeFilter->SetMergingInputs(true);
-
- myScalarsExtractor = VISU_Extractor::New();
-
- myScalarsFieldTransform = VISU_FieldTransform::New();
-
- myCellDataToPointData = vtkCellDataToPointData::New();
-}
-
-//----------------------------------------------------------------------------
-/*!
- * Destructor.
- * Delete all fields.
-*/
-VISU_ScalarMapOnDeformedShapePL
-::~VISU_ScalarMapOnDeformedShapePL()
-{
- myWarpVector->Delete();
-
- myScalarsMergeFilter->Delete();
-
- myScalarsExtractor->Delete();
-
- myScalarsFieldTransform->Delete();
-
- myCellDataToPointData->Delete();
-}
-
-//----------------------------------------------------------------------------
-/*!
- * Initial method
- */
-void
-VISU_ScalarMapOnDeformedShapePL
-::Init()
-{
- Superclass::Init();
-
- SetScale(VISU_DeformedShapePL::GetDefaultScale(this));
-}
-
-//----------------------------------------------------------------------------
-/*!
- * Build method
- * Building of deformation and puts result to merge filter.
- */
-void
-VISU_ScalarMapOnDeformedShapePL
-::Build()
-{
- Superclass::Build();
-}
-
-
-//----------------------------------------------------------------------------
-vtkDataSet*
-VISU_ScalarMapOnDeformedShapePL
-::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_ScalarMapOnDeformedShapePL
-::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_ScalarMapOnDeformedShapePL
-::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_ScalarMapOnDeformedShapePL
-::UpdateScalars()
-{
- vtkDataSet* aScalars = GetScalars();
- myScalarsExtractor->SetInput(aScalars);
-
- if(VISU::IsDataOnCells(aScalars))
- GetMapper()->SetScalarModeToUseCellData();
- else
- GetMapper()->SetScalarModeToUsePointData();
-}
-
-//----------------------------------------------------------------------------
-/*!
- * Copy information about pipline.
- * Copy scale and scalars.
- */
-void
-VISU_ScalarMapOnDeformedShapePL
-::DoShallowCopy(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput)
-{
- Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
-
- if(VISU_ScalarMapOnDeformedShapePL *aPipeLine = dynamic_cast<VISU_ScalarMapOnDeformedShapePL*>(thePipeLine)){
- SetScale(aPipeLine->GetScale());
- SetScalars(aPipeLine->GetScalars());
- }
-}
-
-//----------------------------------------------------------------------------
-/*!
- * Set scalars.
- * Sets vtkDataSet with scalars values to VISU_Extractor filter for scalars extraction.
- */
-void
-VISU_ScalarMapOnDeformedShapePL
-::SetScalars(vtkDataSet *theScalars)
-{
- if(GetScalars() == theScalars)
- return;
-
- myScalars = theScalars;
- UpdateScalars();
-}
-
-//----------------------------------------------------------------------------
-/*!
- * Get pointer to input scalars.
- */
-vtkDataSet*
-VISU_ScalarMapOnDeformedShapePL
-::GetScalars()
-{
- return myScalars.GetPointer();
-}
-
-//----------------------------------------------------------------------------
-/*!
- * Sets scale for deformed shape
- */
-void
-VISU_ScalarMapOnDeformedShapePL
-::SetScale(vtkFloatingPointType theScale)
-{
- if(VISU::CheckIsSameValue(myScaleFactor, theScale))
- return;
-
- myWarpVector->SetScaleFactor(theScale);
- myScaleFactor = theScale;
-}
-
-//----------------------------------------------------------------------------
-/*!
- * Gets scale of deformed shape.
- */
-vtkFloatingPointType
-VISU_ScalarMapOnDeformedShapePL
-::GetScale()
-{
- return myWarpVector->GetScaleFactor();
-}
-
-//----------------------------------------------------------------------------
-/*!
- * Set scale factor of deformation.
- */
-void
-VISU_ScalarMapOnDeformedShapePL
-::SetMapScale(vtkFloatingPointType theMapScale)
-{
- Superclass::SetMapScale(theMapScale);
- myWarpVector->SetScaleFactor(myScaleFactor*theMapScale);
-}
-
-//----------------------------------------------------------------------------
-/*!
- * Gets scalar mode.
- */
-int
-VISU_ScalarMapOnDeformedShapePL
-::GetScalarMode()
-{
- return myScalarsExtractor->GetScalarMode();
-}
-
-//----------------------------------------------------------------------------
-/*!
- * Sets scalar mode.
- */
-void
-VISU_ScalarMapOnDeformedShapePL
-::SetScalarMode(int theScalarMode)
-{
- VISU_ScalarMapPL::SetScalarMode(theScalarMode, GetScalars(), myScalarsExtractor);
-}
-
-//----------------------------------------------------------------------------
-void
-VISU_ScalarMapOnDeformedShapePL
-::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_ScalarMapOnDeformedShapePL
-::SetScalarRange(vtkFloatingPointType theRange[2])
-{
- if(VISU::CheckIsSameRange(theRange, GetScalarRange()))
- return;
-
- myScalarsFieldTransform->SetScalarRange(theRange);
- GetBarTable()->SetRange(theRange);
-}
-
-
-//----------------------------------------------------------------------------
-vtkFloatingPointType*
-VISU_ScalarMapOnDeformedShapePL
-::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_ScalarMapOnDeformedShapePL
-::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_ScalarMapOnDeformedShapePL.hxx
-// Author: Eugeny Nikolaev
-// Module : VISU
-
-#ifndef VISU_ScalarMapOnDeformedShapePL_HeaderFile
-#define VISU_ScalarMapOnDeformedShapePL_HeaderFile
-
-#include "VISUPipeline.hxx"
-#include "VISU_ScalarMapPL.hxx"
-
-class VISU_MergeFilter;
-class vtkWarpVector;
-class vtkUnstructuredGrid;
-class vtkCellDataToPointData;
-class vtkPointDataToCellData;
-
-
-//----------------------------------------------------------------------------
-class VISU_PIPELINE_EXPORT VISU_ScalarMapOnDeformedShapePL : public VISU_ScalarMapPL
-{
-public:
- vtkTypeMacro(VISU_ScalarMapOnDeformedShapePL, VISU_ScalarMapPL);
-
- static
- VISU_ScalarMapOnDeformedShapePL*
- 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_ScalarMapOnDeformedShapePL();
-
- virtual
- ~VISU_ScalarMapOnDeformedShapePL();
-
- virtual
- vtkDataSet*
- InsertCustomPL();
-
- virtual
- void
- DoShallowCopy(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput);
-
-private:
- VISU_ScalarMapOnDeformedShapePL(const VISU_ScalarMapOnDeformedShapePL&);
-
- vtkFloatingPointType myScaleFactor;
- vtkWarpVector *myWarpVector;
- VISU_MergeFilter *myScalarsMergeFilter;
- vtkSmartPointer<vtkUnstructuredGrid> myScalars;
- vtkCellDataToPointData* myCellDataToPointData;
- VISU_FieldTransform* myScalarsFieldTransform;
- VISU_Extractor* myScalarsExtractor;
-};
-
-#endif
#include "VISU_ScalarMapPL.hxx"
#include "VISU_DataSetMapperHolder.hxx"
+#include "VISU_ElnoAssembleFilter.hxx"
#include "VISU_FieldTransform.hxx"
#include "VISU_AppendFilter.hxx"
VISU_ScalarMapPL
::VISU_ScalarMapPL():
VISU_UnstructuredGridPL(this),
+ myElnoAssembleFilter( VISU_ElnoAssembleFilter::New() ),
myAppendFilter(VISU_AppendFilter::New()),
myMergeFilter(VISU_MergeFilter::New())
{
SetIsShrinkable(true);
+ SetElnoDisassembleState( false );
+
+ myElnoAssembleFilter->Delete();
+
myAppendFilter->SetMergingInputs(true);
myAppendFilter->Delete();
myMergeFilter->AddField("VISU_FIELD", aDataSet);
myMergeFilter->AddField("VISU_CELLS_MAPPER", aDataSet);
myMergeFilter->AddField("VISU_POINTS_MAPPER", aDataSet);
+ myMergeFilter->AddField("ELNO_POINT_COORDS", aDataSet);
+
+ myElnoAssembleFilter->SetInput( InsertCustomPL() );
- GetDataSetMapper()->SetInput(InsertCustomPL());
+ GetDataSetMapper()->SetInput( myElnoAssembleFilter->GetOutput() );
}
}
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapPL
+::SetElnoDisassembleState( bool theIsShrunk )
+{
+ GetDataSetMapperHolder()->SetElnoDisassembleState( theIsShrunk );
+ myElnoAssembleFilter->SetElnoAssembleState( theIsShrunk );
+}
+
//----------------------------------------------------------------------------
void
VISU_ScalarMapPL
#include "VISU_UnstructuredGridPL.hxx"
class VISU_DataSetMapperHolder;
+class VISU_ElnoAssembleFilter;
class VISU_AppendFilter;
class VISU_MergeFilter;
DoShallowCopy(VISU_PipeLine *thePipeLine,
bool theIsCopyInput);
+ void
+ SetElnoDisassembleState( bool theIsShrunk );
+
private:
VISU_ScalarMapPL(const VISU_ScalarMapPL&); // Not implemented.
void operator=(const VISU_ScalarMapPL&); // Not implemented.
- vtkSmartPointer<VISU_AppendFilter> myAppendFilter;
- vtkSmartPointer<VISU_MergeFilter> myMergeFilter;
+ vtkSmartPointer< VISU_ElnoAssembleFilter > myElnoAssembleFilter;
+ vtkSmartPointer< VISU_AppendFilter > myAppendFilter;
+ vtkSmartPointer< VISU_MergeFilter > myMergeFilter;
};
#endif
//----------------------------------------------------------------------------
template<class TOutputFilter>
-void ToCellCenters(TOutputFilter *theOutputFilter,
- vtkCellCenters *theCellCenters,
- vtkDataSet* theDataSet,
- VISU_UsedPointsFilter* theUsedPointsFilter)
+void ToCellCenters( TOutputFilter *theOutputFilter,
+ vtkCellCenters *theCellCenters,
+ vtkDataSet* theDataSet,
+ VISU_UsedPointsFilter* theUsedPointsFilter )
{
- if(VISU::IsDataOnCells(theDataSet)){
- theCellCenters->SetInput(theDataSet);
+ if ( VISU::IsDataOnCells( theDataSet ) ) {
+ theCellCenters->SetInput( theDataSet );
theCellCenters->VertexCellsOn();
- theOutputFilter->SetInput(theCellCenters->GetOutput());
+ theOutputFilter->SetInput( theCellCenters->GetOutput() );
}else {
- theUsedPointsFilter->SetInput(theDataSet);
- theOutputFilter->SetInput(theUsedPointsFilter->GetOutput());
+ theUsedPointsFilter->SetInput( theDataSet );
+ theOutputFilter->SetInput( theUsedPointsFilter->GetOutput() );
}
}
VISU_VectorsPL
::VISU_VectorsPL()
{
- SetIsShrinkable(false);
+ SetIsShrinkable( false );
- myBaseGlyph = vtkGlyph3D::New();
- myTransformedGlyph = vtkGlyph3D::New();
+ myGlyph = vtkGlyph3D::New();
myGlyphSource = vtkGlyphSource2D::New();
myConeSource = vtkConeSource::New();
VISU_VectorsPL
::~VISU_VectorsPL()
{
- myBaseGlyph->Delete();
- myTransformedGlyph->Delete();
+ myGlyph->Delete();
myCenters->Delete();
{
unsigned long int aTime = Superclass::GetMTime();
- aTime = std::max(aTime, myBaseGlyph->GetMTime());
- aTime = std::max(aTime, myTransformedGlyph->GetMTime());
+ aTime = std::max(aTime, myGlyph->GetMTime());
aTime = std::max(aTime, myCenters->GetMTime());
aTime = std::max(aTime, myGlyphSource->GetMTime());
aTime = std::max(aTime, myConeSource->GetMTime());
//----------------------------------------------------------------------------
void
VISU_VectorsPL
-::SetTransform(VTKViewer_Transform* theTransform)
+::SetTransform( VTKViewer_Transform* theTransform )
{
- GetFieldTransformFilter()->SetSpaceTransform(theTransform);
- myTransformFilter->SetTransform(theTransform);
+ myTransformFilter->SetTransform( theTransform );
myTransformFilter->Modified();
}
VISU_VectorsPL
::GetTransform()
{
- return GetFieldTransformFilter()->GetSpaceTransform();
+ return static_cast< VTKViewer_Transform* >( myTransformFilter->GetTransform() );
}
VISU_VectorsPL
::SetScale(vtkFloatingPointType theScale)
{
- if(myScaleFactor == theScale)
+ if ( VISU::CheckIsSameValue( myScaleFactor, theScale ) )
return;
- myScaleFactor = theScale;
+ myGlyph->SetScaleFactor( theScale );
- myBaseGlyph->SetScaleFactor(myScaleFactor);
- myTransformedGlyph->SetScaleFactor(myScaleFactor);
+ myScaleFactor = theScale;
Modified();
}
VISU_VectorsPL
::GetScale()
{
- return myTransformedGlyph->GetScaleFactor();
+ return myGlyph->GetScaleFactor();
}
{
Superclass::Build();
- ToCellCenters(myBaseGlyph,
- myCenters,
- GetMergedInput(),
- myUsedPointsFilter);
- myBaseGlyph->SetVectorModeToUseVector();
- myBaseGlyph->SetScaleModeToScaleByVector();
- myBaseGlyph->SetColorModeToColorByScalar();
-
- ToCellCenters(myTransformFilter,
- myCenters,
- GetMergedInput(),
- myUsedPointsFilter);
- myTransformedGlyph->SetInput(myTransformFilter->GetOutput());
- myTransformedGlyph->SetVectorModeToUseVector();
- myTransformedGlyph->SetScaleModeToScaleByVector();
- myTransformedGlyph->SetColorModeToColorByScalar();
+ ToCellCenters( myTransformFilter,
+ myCenters,
+ GetMergedInput(),
+ myUsedPointsFilter );
+
+ myGlyph->SetInput( myTransformFilter->GetOutput() );
+ myGlyph->SetVectorModeToUseVector();
+ myGlyph->SetScaleModeToScaleByVector();
+ myGlyph->SetColorModeToColorByScalar();
}
VISU_VectorsPL
::InsertCustomPL()
{
- return myTransformedGlyph->GetOutput();
+ return myGlyph->GetOutput();
}
case CENTER:
myGlyphSource->SetCenter(0.0, 0.0, 0.0);
}
- myBaseGlyph->SetSource(myGlyphSource->GetOutput());
- myTransformedGlyph->SetSource(myGlyphSource->GetOutput());
+ myGlyph->SetSource(myGlyphSource->GetOutput());
}
break;
case CONE2:
case CENTER:
myConeSource->SetCenter(0.0, 0.0, 0.0);
}
- myBaseGlyph->SetSource(myConeSource->GetOutput());
- myTransformedGlyph->SetSource(myConeSource->GetOutput());
+ myGlyph->SetSource(myConeSource->GetOutput());
}
break;
case NONE:
default: {
- myBaseGlyph->SetSource(myLineSource->GetOutput());
- myTransformedGlyph->SetSource(myLineSource->GetOutput());
+ myGlyph->SetSource(myLineSource->GetOutput());
}
}
{
unsigned long int aSize = Superclass::GetMemorySize();
- if(vtkDataSet* aDataSet = myBaseGlyph->GetOutput())
- aSize += aDataSet->GetActualMemorySize() * 1024;
-
- if(vtkDataSet* aDataSet = myTransformedGlyph->GetOutput())
+ if(vtkDataSet* aDataSet = myGlyph->GetOutput())
aSize += aDataSet->GetActualMemorySize() * 1024;
if(vtkDataSet* aDataSet = myCenters->GetOutput())
aSize += aDataSet->GetActualMemorySize() * 1024;
- if(myCellDataToPointData->GetInput())
- if(vtkDataSet* aDataSet = myCellDataToPointData->GetOutput())
- aSize += aDataSet->GetActualMemorySize() * 1024;
-
return aSize;
}
VISU_VectorsPL
::GetOutput()
{
- myBaseGlyph->Update();
- return myBaseGlyph->GetOutput();
+ myGlyph->Update();
+
+ return myGlyph->GetOutput();
}
::SetMapScale(vtkFloatingPointType theMapScale)
{
VISU_ScalarMapPL::SetMapScale(theMapScale);
+ myMapScaleFactor = theMapScale;
- myBaseGlyph->SetScaleFactor(myScaleFactor*theMapScale);
- myTransformedGlyph->SetScaleFactor(myScaleFactor*theMapScale);
+ myGlyph->SetScaleFactor( myScaleFactor*theMapScale );
Modified();
}
GlyphType myTypeGlyph;
GlyphPos myPosGlyph;
- vtkGlyph3D *myBaseGlyph;
- vtkGlyph3D *myTransformedGlyph;
+ vtkGlyph3D *myGlyph;
vtkGlyphSource2D *myGlyphSource;
vtkLineSource *myLineSource;
VisuGUI_StreamLinesDlg.cxx \
VisuGUI_VectorsDlg.cxx \
VisuGUI_Displayer.cxx \
- VisuGUI_ScalarMapOnDeformedShapeDlg.cxx \
+ VisuGUI_DeformedShapeAndScalarMapDlg.cxx \
VisuGUI_SetupPlot2dDlg.cxx \
VisuGUI_BuildProgressDlg.cxx \
VisuGUI_Table3dDlg.cxx \
VisuGUI_CutPlanesDlg_moc.cxx \
VisuGUI_StreamLinesDlg_moc.cxx \
VisuGUI_VectorsDlg_moc.cxx \
- VisuGUI_ScalarMapOnDeformedShapeDlg_moc.cxx \
+ VisuGUI_DeformedShapeAndScalarMapDlg_moc.cxx \
VisuGUI_SetupPlot2dDlg_moc.cxx \
VisuGUI_BuildProgressDlg_moc.cxx \
VisuGUI_Table3dDlg_moc.cxx \
<source>VISU_BAR_HEIGHT</source>
<translation>Bar height (%):</translation>
</message>
+ <message>
+ <source>VISU_AUTOMATIC_FIT_ALL</source>
+ <translation>Automatic Fit All</translation>
+ </message>
+ <message>
+ <source>VISU_DEFORMED_SHAPE_AND_SCALAR_MAP</source>
+ <translation>Def. Shape and Scalar Map</translation>
+ </message>
+ <message>
+ <source>VISU_FLOATING_POINT_PRECISION</source>
+ <translation>Floating Point Precision</translation>
+ </message>
+ <message>
+ <source>VISU_REALLY_DELETE</source>
+ <translation>Do you really want to delete this %1 object(s): %2</translation>
+ </message>
+ <message>
+ <source>WRN_NO_APPROPRIATE_SELECTION</source>
+ <translation>No appropriate objects selected</translation>
+ </message>
</context>
<context>
<name>VVTK_MainWindow</name>
<translation>Scalar Map</translation>
</message>
<message>
- <source>MEN_SCALAR_MAP_ON_DEFORMED_SHAPE</source>
- <translation>Scalar Map on Deformed Shape</translation>
+ <source>MEN_DEFORMED_SHAPE_AND_SCALAR_MAP</source>
+ <translation>Deformed Shape and Scalar Map</translation>
</message>
<message>
<source>MEN_SCALING</source>
<source>MEN_FILE_INFO</source>
<translation>MED File information</translation>
</message>
+ <message>
+ <source>ERR_ERROR_IN_THE_FILE</source>
+ <translation>Error in the file</translation>
+ </message>
+ <message>
+ <source>ERR_FILE_NOT_EXISTS</source>
+ <translation>File does not exist</translation>
+ </message>
+ <message>
+ <source>IMPORT_ERRORS</source>
+ <translation>Import operation has finished with errors:</translation>
+ </message>
+ <message>
+ <source>TLT_IMPORT_TABLE</source>
+ <translation>Import table</translation>
+ </message>
+ <message>
+ <source>UNKNOWN_IMPORT_ERROR</source>
+ <translation>Unknown error</translation>
+ </message>
</context>
<context>
<name>VisuGUI_AxisWg</name>
<source>TXT_ORIENTATION</source>
<translation>Orientation</translation>
</message>
+ <message>
+ <source>LBL_DEFORMATION</source>
+ <translation>Deformation</translation>
+ </message>
+ <message>
+ <source>LBL_DEFROMATION_SCALE</source>
+ <translation>Scale Factor :</translation>
+ </message>
+ <message>
+ <source>LBL_DEFROMATION_VECT</source>
+ <translation>Vectors :</translation>
+ </message>
</context>
<context>
<name>VisuGUI_DeformedShapeDlg</name>
<source>NB_SURFACES</source>
<translation>Number of surfaces:</translation>
</message>
+ <message>
+ <source>MAGNITUDE_COLORING_CHK</source>
+ <translation>Magnitude coloring</translation>
+ </message>
+ <message>
+ <source>SEL_COLOR_BTN</source>
+ <translation>Select Color</translation>
+ </message>
+ <message>
+ <source>SHOW_VALUES_CHK</source>
+ <translation>Show values (nb per surface)</translation>
+ </message>
</context>
<context>
<name>VisuGUI_IsoSurfacesDlg</name>
</message>
</context>
<context>
- <name>VisuGUI_ScalarMapOnDeformedShapeDlg</name>
+ <name>VisuGUI_DeformedShapeAndScalarMapDlg</name>
<message>
<source>&Cancel</source>
<translation></translation>
</message>
<message>
<source>DLG_TITLE</source>
- <translation>Scalar Map on Deformed Shape</translation>
+ <translation>Deformed Shape and Scalar Map</translation>
</message>
<message>
<source>FIELD_ITEM</source>
<translation>Scalar Bar</translation>
</message>
<message>
- <source>SCALAR_MAP_ON_DEFORMED_SHAPE_TAB</source>
- <translation>Scalar Map on Deformed Shape</translation>
+ <source>DEFORMED_SHAPE_AND_SCALAR_MAP_TAB</source>
+ <translation>Deformed Shape and Scalar Map</translation>
</message>
<message>
<source>SCALE_FACTOR</source>
#include "SUIT_ViewManager.h"
#include "SUIT_Desktop.h"
#include "SUIT_DataBrowser.h"
+#include "SUIT_OverrideCursor.h"
#include "CAM_Module.h"
#include "VISU_DeformedShape_i.hh"
#include "VisuGUI_DeformedShapeDlg.h"
-#include "VISU_ScalarMapOnDeformedShape_i.hh"
-#include "VisuGUI_ScalarMapOnDeformedShapeDlg.h"
+#include "VISU_DeformedShapeAndScalarMap_i.hh"
+#include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
#include "VISU_IsoSurfaces_i.hh"
#include "VisuGUI_IsoSurfacesDlg.h"
SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
- // Get file name
+ // Get file name(s)
QStringList aFilter;
aFilter.append( tr( "FLT_MED_FILES" ) );
aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
- SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
- fd->setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
- fd->setFilters( aFilter );
- fd->SetChecked( toUseBuildProgress );
- if( !fd->exec() )
- return;
+ SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
+ fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
+ fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
+ fd.setFilters( aFilter );
+ fd.SetChecked( toUseBuildProgress );
+ if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
+ fd.setDirectory( QDir::currentPath() );
- QFileInfo aFileInfo( fd->selectedFile() );
- toUseBuildProgress = fd->IsChecked();
- delete fd;
+ QStringList fileNames;
+ if ( !fd.exec() )
+ return; // cancelled, return
- // Check the file name
- if ( !aFileInfo.exists() )
- return;
+ fileNames = fd.selectedFiles();
+ toUseBuildProgress = fd.IsChecked();
- if ( !toUseBuildProgress )
- {
- bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
- bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
- bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
- bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
- bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
-
- QString anInfo("Importing From File " + aFileInfo.absoluteFilePath() + "..." );
- application()->putInfo( anInfo );
-
- QApplication::setOverrideCursor(Qt::WaitCursor);
- VISU::Result_var aResult = GetVisuGen(this)->CreateResult( aFileInfo.filePath().toLatin1().data() );
-
- if (CORBA::is_nil(aResult.in())) {
- SUIT_MessageBox::warning(GetDesktop(this),
- tr("WRN_VISU"),
- VisuGUI_BuildProgressDlg::tr("ERR_ERROR_IN_THE_FILE") );
- QApplication::restoreOverrideCursor();
- }else{
- aResult->SetBuildFields( toBuildFields, toBuildMinMax );
- aResult->SetBuildGroups( toBuildGroups );
- aResult->Build( toBuildAll, toBuildAtOnce );
-
- UpdateObjBrowser(this);
- application()->putInfo( anInfo + tr("INF_DONE"));
- QApplication::restoreOverrideCursor();
- }
- }
- else
- {
- VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
- aBuildProgressDlg->setFileName( aFileInfo.filePath() );
- aBuildProgressDlg->setGenerator( GetVisuGen(this) );
- aBuildProgressDlg->show();
+ if ( fileNames.count() == 0 )
+ return; // nothing selected, return
+
+ SUIT_OverrideCursor wc;
+ QStringList errors;
+
+ for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
+ QFileInfo aFileInfo( *it );
+
+ if ( !aFileInfo.exists() ) {
+ // file not exist
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
+ arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
}
+ else {
+ try {
+ if ( !toUseBuildProgress ) {
+ // build progress is not used, use build flags from settings
+ bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
+ bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
+ bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
+ bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
+ bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
+
+ QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
+ application()->putInfo( anInfo );
+
+ VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
+
+ if ( CORBA::is_nil( aResult.in() ) ) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
+ arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
+ }
+ else {
+ aResult->SetBuildFields( toBuildFields, toBuildMinMax );
+ aResult->SetBuildGroups( toBuildGroups );
+ aResult->Build( toBuildAll, toBuildAtOnce );
+ application()->putInfo( anInfo + tr("INF_DONE") );
+ }
+ } // if ( !toUseBuildProgress )
+ else {
+ // use build progress
+ wc.suspend();
+ VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
+ aBuildProgressDlg->setFileName( aFileInfo.filePath() );
+ aBuildProgressDlg->setGenerator( GetVisuGen(this) );
+ aBuildProgressDlg->exec();
+ wc.resume();
+ }
+ } // try
+ catch(...) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
+ }
+ } // else // if ( !aFileInfo.exists() )
+ } // for (...)
+
+ if ( errors.count() > 0 ) {
+ SUIT_MessageBox::critical( GetDesktop(this),
+ tr("ERR_ERROR"),
+ tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
+ }
+ else {
+ UpdateObjBrowser(this);
+ }
}
void
aFilter.append( tr("FLT_TABLE_FILES") );
aFilter.append( tr("FLT_ALL_FILES") );
- QFileInfo aFileInfo =
- SUIT_FileDlg::getFileName(GetDesktop(this),
- "",
- aFilter,
- tr("MEN_IMPORT_TABLE"),
- true);
- if (aFileInfo.exists()) {
- application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.absoluteFilePath() + " ..." );
-
- CORBA::Object_var anObject = GetVisuGen(this)->ImportTables((const char*)aFileInfo.absoluteFilePath().toLatin1());
-
- if (CORBA::is_nil(anObject.in())) {
- SUIT_MessageBox::warning( GetDesktop(this),
- tr("WRN_VISU"),
- tr("ERR_ERROR_IN_THE_FILE") );
- } else {
- application()->putInfo(aFileInfo.absoluteFilePath()+tr("INF_DONE"));
- UpdateObjBrowser(this);
+ QString anInitialPath = "";
+ if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
+ anInitialPath = QDir::currentPath();
+
+ QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
+ anInitialPath,
+ aFilter,
+ tr("TLT_IMPORT_TABLE"));
+ if ( aFiles.count() == 0 )
+ return; // nothing selected
+
+ QStringList errors;
+ for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
+ QFileInfo aFileInfo( *it );
+
+ if ( !aFileInfo.exists() ) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
+ arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
+ }
+ else {
+ try {
+ QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
+ application()->putInfo( anInfo );
+
+ CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData());
+
+ if (CORBA::is_nil(anObject.in())) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
+ arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
+ }
+ else {
+ application()->putInfo( anInfo + tr("INF_DONE") );
+ }
+ }
+ catch(...) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
+ }
}
}
+
+ if ( errors.count() > 0 ) {
+ SUIT_MessageBox::critical( GetDesktop(this),
+ tr("ERR_ERROR"),
+ tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
+ }
+ else {
+ UpdateObjBrowser(this);
+ }
}
void
VisuGUI
::OnCreateDeformedShape()
{
- // CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
- VisuGUI_DeformedShapeDlg::CreatePrs3d(this);
+ CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
}
void
VisuGUI
-::OnCreateScalarMapOnDeformedShape()
+::OnCreateDeformedShapeAndScalarMap()
{
- CreatePrs3d<VISU::ScalarMapOnDeformedShape_i,VisuGUI_ScalarMapOnDeformedShapeDlg,1>(this);
+ CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
}
void
aViewWindow->getRenderer()->ResetCameraClippingRange();
aViewWindow->Repaint();
}
- }}
+ }
+ }
}
}
//----------------------------------------------------------------------------
void
VisuGUI
-::OnEditScalarMapOnDeformedShape()
+::OnEditDeformedShapeAndScalarMap()
{
Handle(SALOME_InteractiveObject) anIO;
if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
- EditPrs3d<VISU::ScalarMapOnDeformedShape_i, VisuGUI_ScalarMapOnDeformedShapeDlg, 1>(this, anIO, aPrs3d);
+ EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
}
//----------------------------------------------------------------------------
VisuGUI
::OnChangeOpacity()
{
- VISU_Actor* anActor = NULL;
- VISU::Prs3d_i* aPrs3d = NULL;
- SVTK_ViewWindow* aViewWindow = NULL;
- if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
- return;
-
VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
aDialog->show();
}
::OnChangeLines()
{
VISU_Actor* anActor = NULL;
+ VISU_ActorBase* anActorBase = NULL;
VISU::Prs3d_i* aPrs3d = NULL;
SVTK_ViewWindow* aViewWindow = NULL;
- if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
- return;
+ float oldlwid;
+ bool isPrs3d = false;
+
+ if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
+ isPrs3d = true;
+ }
+ else {
+ aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
+ anActorBase = VISU::FindActorBase(aViewWindow, aTable);
+ oldlwid = anActorBase->GetLineWidth();
+ }
+
VisuGUI_CursorDlg* CursorDlg =
new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
CursorDlg->SpinBox1->setMinimum(1);
CursorDlg->SpinBox1->setMaximum(10);
- float oldlwid = anActor->GetLineWidth();
int intlwid = int(oldlwid);
CursorDlg->SpinBox1->setValue(intlwid);
if (ret == 1) {
intlwid = CursorDlg->SpinBox1->value();
float newlwid = intlwid;
- anActor->SetLineWidth(newlwid);
+ if (isPrs3d)
+ anActor->SetLineWidth(newlwid);
+ else
+ anActorBase->SetLineWidth(newlwid);
}
delete CursorDlg;
}
int i = 0, nbSelected = aList.Extent();
if (nbSelected < 1) return;
- std::vector<std::string> anEntries(nbSelected);
+ std::vector<std::string> anEntries (nbSelected);
+ QString aNameList;
Handle(SALOME_InteractiveObject) anIO;
for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
anIO = it.Value();
- if (anIO->hasEntry())
- anEntries[i++] = anIO->getEntry();
+ aNameList.append("\n - ");
+ aNameList.append(anIO->getName());
+ if (anIO->hasEntry()) {
+ if (IsRemovable(anIO->getEntry(), this))
+ anEntries[i++] = anIO->getEntry();
+ }
}
nbSelected = i;
- if (nbSelected < 1) return;
+ if (nbSelected < 1) {
+ SUIT_MessageBox::warning(GetDesktop(this),
+ QObject::tr("WRN_VISU"),
+ QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
+ }
+
+ if ( SUIT_MessageBox::question( GetDesktop(this),
+ QObject::tr( "WRN_VISU" ),
+ QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
+ return;
// There is a transaction
_PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
}
}
}
- }else{
+ }
+ else{
DeleteSObject(this, aCStudy, aSObject);
UpdateObjBrowser(this, true, aSObject);
}
return;
VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
- if(aSelectionInfo.empty())
+ if (aSelectionInfo.empty())
return;
- VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
- _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
- if(!aSObject)
- return;
+ VisuGUI_Selection aSel (this);
+ aSel.init("", getApp()->selectionMgr());
+ if (aSel.count() < 1) return;
- //TEST DU PARENT == VISU
- _PTR(StudyBuilder) aBuilder = aCStudy->NewBuilder();
- _PTR(GenericAttribute) anAttr = aBuilder->FindOrCreateAttribute(aSObject, "AttributeName");
- if (anAttr) {
- _PTR(AttributeName) aName (anAttr);
- QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
- if (!Name.isEmpty()) {
- QApplication::setOverrideCursor(Qt::WaitCursor);
-
- // rename specific objects
- if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
- switch(aBase->GetType()){
- case VISU::TCURVE: { // Curve object
- if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
- aCurve->SetName((const char*)Name.toLatin1(), true);
- break;
- }
- case VISU::TTABLE: { // Table object
- if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
- aTable->SetName((const char*)Name.toLatin1(), true);
- break;
- }
- case VISU::TCONTAINER: { // Container object
- if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
- aContainer->SetName((const char*)Name.toLatin1(), true);
- break;
- }
- default: {
- }}
- }
- }
+ bool isAny = false; // is there any appropriate object selected
+ for (int i = 0; i < aSelectionInfo.size(); i++) {
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
+ VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
- if (!Name.isEmpty()) {
- // rename the study object
- Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
- aName->SetValue((const char*)Name.toLatin1()); // rename the SObject
- anIO->setName((const char*)Name.toLatin1()); // rename the InteractiveObject
-
- ViewManagerList aViewManagerList;
- ViewManagerList::Iterator anIt;
- getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
- anIt = aViewManagerList.begin();
- for(; anIt != aViewManagerList.end(); anIt++ )
- {
- if(Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(*anIt)){
- if(SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
- aViewer->renameAll( anIO, (const char*)Name.toLatin1() );
- }
- }
+ _PTR(SObject) aSObject = anObjectInfo.mySObject;
+ if (!aSObject)
+ continue;
- UpdateObjBrowser(this, false);
+ // Check, if the selected object can be renamed
+ QString aStr = aSel.parameter(i, "type" ).toString();
+ if (aStr == "VISU::TSCALARMAP" || aStr == "VISU::TISOSURFACES" ||
+ aStr == "VISU::TDEFORMEDSHAPE" || aStr == "VISU::TCUTPLANES" ||
+ aStr == "VISU::TCUTLINES" || aStr == "VISU::TVECTORS" ||
+ aStr == "VISU::TSTREAMLINES" || aStr == "VISU::TPLOT3D" ||
+ aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" ||
+ aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" ||
+ aStr == "VISU::POINTMAP3D" || aStr == "VISU::TVIEW3D" ||
+ aStr == "VISU::TMESH" || aStr == "VISU::TPOINTMAP3D")
+ {
+ _PTR(GenericAttribute) anAttr;
+ if (aSObject->FindAttribute(anAttr, "AttributeName")) {
+ isAny = true;
+ _PTR(AttributeName) aName (anAttr);
+ QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
+ if (!Name.isEmpty()) {
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+
+ // rename specific objects
+ if (VISU::Base_i* aBase = anObjectInfo.myBase) {
+ switch (aBase->GetType()) {
+ case VISU::TCURVE: { // Curve object
+ if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
+ aCurve->SetName(Name.toLatin1().constData(), true);
+ break;
+ }
+ case VISU::TTABLE: { // Table object
+ if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
+ aTable->SetName(Name.toLatin1().constData(), true);
+ break;
+ }
+ case VISU::TPOINTMAP3D: { // Table object
+ if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
+ aTable3d->SetTitle(Name.toLatin1().constData());
+ aTable3d->UpdateActors();
+ }
+ break;
+ }
+ case VISU::TCONTAINER: { // Container object
+ if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
+ aContainer->SetName(Name.toLatin1().constData(), true);
+ break;
+ }
+ default: {
+ }}
+ }
+
+ // rename the study object
+ Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+ aName->SetValue(Name.toLatin1().constData()); // rename the SObject
+ anIO->setName(Name.toLatin1().constData()); // rename the InteractiveObject
+
+ ViewManagerList aViewManagerList;
+ getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
+ SUIT_ViewManager* aViewManager;
+ foreach( aViewManager, aViewManagerList ) {
+ if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
+ if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
+ aViewer->renameAll( anIO, Name.toLatin1().constData() );
+ }
+ }
+
+ UpdateObjBrowser(this, false);
+
+ QApplication::restoreOverrideCursor();
+ }
+ }
}
+ } // for
- QApplication::restoreOverrideCursor();
+ if (!isAny) {
+ SUIT_MessageBox::warning(GetDesktop(this),
+ QObject::tr("WRN_VISU"),
+ QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
}
}
aScalarMap->SetMapScale(aPercents);
aScalarMap->UpdateActor(anActor);
aViewWindow->getRenderWindow()->Render();
+ aViewWindow->Repaint();
usleep(aTemp);
} catch (std::exception& exc) {
INFOS("Follow exception was occured :\n" << exc.what());
TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
break;
case VISU::TSCALARMAPONDEFORMEDSHAPE:
- TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
+ case VISU::TDEFORMEDSHAPEANDSCALARMAP:
+ TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
break;
case VISU::TCUTPLANES:
TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
{
if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
-
- LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
- SALOME_ListIO aListIO;
- aSelectionMgr->selectedObjects(aListIO);
-
- SalomeApp_Study* aStudy = GetAppStudy(this);
- SALOME_ListIteratorOfListIO anIter(aListIO);
- for (; anIter.More(); anIter.Next()) {
- Handle(SALOME_InteractiveObject) anIO = anIter.Value();
- if (anIO->hasEntry()) {
- QString anEntry(anIO->getEntry());
- VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)anEntry.toLatin1());
- if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase))
- aDlg->addPresentation(aPrsObject);
- }
- }
- if (aDlg->getPrsCount() > 0)
- aDlg->show();
- else
- delete aDlg;
+ aDlg->exec();
}
void
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
// Create actions
- //createAction( VISU_IMPORT_FROM_FILE, "", QIcon(),
- // tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
- // this, SLOT(OnImportFromFile()));
aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
this, SLOT(OnCreateDeformedShape()));
aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
- createAction( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, tr("MEN_SCALAR_MAP_ON_DEFORMED_SHAPE"), QIcon(aPixmap),
- tr("MEN_SCALAR_MAP_ON_DEFORMED_SHAPE"), "", 0, aParent, false,
- this, SLOT(OnCreateScalarMapOnDeformedShape()));
+ createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
+ tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
+ this, SLOT(OnCreateDeformedShapeAndScalarMap()));
aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
this, SLOT(OnShowTable()));
- createAction( VISU_SHOW_TABLE_PLOT, tr("MEN_EDIT_PRS"), QIcon(),
+ createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
tr("MEN_EDIT_PRS"), "", 0, aParent, false,
this, SLOT(OnShowTablePlot()));
tr("MEN_EDIT_PRS"), "", 0, aParent, false,
this, SLOT(OnEditPlot3D()));
- createAction( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
+ createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
tr("MEN_EDIT_PRS"), "", 0, aParent, false,
- this, SLOT(OnEditScalarMapOnDeformedShape()));
-
+ this, SLOT(OnEditDeformedShapeAndScalarMap()));
createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
- createMenu( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, aMenuId, 10 ); // scalar map on deformed shape
+ createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
createTool( VISU_CUT_LINES, aToolId );
createTool( VISU_STREAM_LINES, aToolId );
createTool( VISU_PLOT_3D, aToolId );
- createTool( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, aToolId );
+ createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
aToolId = createTool(tr("TOOL_REPRESENTATION"));
createTool( VISU_POINTS, aToolId );
mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
- mgr->insert( action( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE ), -1, -1, -1 ); // scalar map on deformed shape
+ mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
- mgr->insert( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
// rename
mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
// table commands
- //mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
- //mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
- //mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
+ mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
+ mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
+ mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
mgr->insert( separator(), -1, -1, -1 );
QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
"'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
- "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TCOLOREDPRS3DHOLDER'");
+ "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
// VISU root commands
QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
mgr->setRule( action( VISU_VECTORS ), aRule );
mgr->setRule( action( VISU_STREAM_LINES ), aRule );
- mgr->setRule( action( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE ), aRule );
+ mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
// display/erase commands
QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
QString aTableOrCont = "(type='VISU::TTABLE' and nbChildren>0) or type='VISU::TCONTAINER'";
QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
- QString aPrsVisible = "(($type in {'VISU::TMESH' " + aPrsAll + "}) and isVisible)";
- QString aPrsInvisible = "(($type in {'VISU::TMESH' " + aPrsAll + "})" + andInvisible + ")";
+ QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isVisible)";
+ QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})" + andInvisible + ")";
QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
" or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + "))) ) or " + aComponent;
QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
- " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + "))) ) or" + aComponent;
+ " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + "))) ) or " + aComponent;
- QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' " + aPrsAll + "})"
+ QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})"
" or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or"
" ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent;
mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
- aRule = "selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "}";
+ aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'VVTK'} and selcount=0" );
// 3D presentations commands
- QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
- QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
- QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
+ QString aPrsType = " and $type in {'VISU::TMESH'" + aPrsAll + "}";
+ QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
+ QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
+ QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
- " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
- QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
+ " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
+ QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
- "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' }";
+ "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
aRule = "selcount=1";
mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}";
mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
- mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType + aNotWirefr );
+ mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1" );
// rename command
- QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'";
+ QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
- aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' " + aCurveAll + " " + aPrsAll + "})";
+ aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' 'VISU::TPOINTMAP3D' " + aCurveAll + " " + aPrsAll + "})";
mgr->setRule( action( VISU_RENAME ), aRule );
// copy presentation command
aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
mgr->setRule( action( VISU_COPY_PRS ), aRule );
- // curve commands
+ // Curve commands
aRule = "selcount=1 and type='VISU::TCURVE'";
mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
+ // Table Commands
+ aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
+ mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
+ mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
+ mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
+
// curve container commands
aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
"selcount=1 and type='VISU::TSCALARMAP'" );
mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
"selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
- mgr->setRule( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ),
- "selcount=1 and type='VISU::TSCALARMAPONDEFORMEDSHAPE'" );
+ mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
+ "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
mgr->setRule( action( VISU_EDIT_CUTPLANES ),
"selcount=1 and type='VISU::TCUTPLANES'" );
mgr->setRule( action( VISU_EDIT_CUTLINES ),
"selcount=1 and type='VISU::TSTREAMLINES'" );
mgr->setRule( action( VISU_EDIT_PLOT3D ),
"selcount=1 and type='VISU::TPLOT3D'" );
+ mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
+ "selcount=1 and type='VISU::TPOINTMAP3D'" );
aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
_PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
if ( !aSObject )
continue;
+
+ if ( !isOBClient ) {
+ QString aName = QString( aSObject->GetName().c_str() );
+ while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
+ aName.remove( (aName.length() - 1), 1 );
+ theTitle = aName;
+ }
+
CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
if (CORBA::is_nil(aCORBAObject)) {
VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
} else if (isOBClient) {
if (IsSObjectTable(aSObject)) {
- theMenu->removeAction( action( VISU_DELETE_OBJS ) );
- if (aType == VISU::TPOINTMAP3D) {
- theMenu->addAction( action( VISU_SHOW_TABLE_PLOT ) );
- theMenu->addSeparator();
- theMenu->addAction( action( VISU_ERASE ) );
- theMenu->addAction( action( myEraseAll ) );
- theMenu->addAction( action( VISU_DISPLAY ) );
- theMenu->addAction( action( VISU_DISPLAY_ONLY ) );
- theMenu->addSeparator();
- }
- theMenu->addAction( action( VISU_SHOW_TABLE ) );
+ /* action( VISU_SHOW_TABLE )->addTo(theMenu);
theMenu->addAction( action( VISU_CREATE_CURVES ) );
theMenu->addAction( action( VISU_EXPORT_TABLE ) );
theMenu->addSeparator();
- theMenu->addAction( action( VISU_DELETE_OBJS ) );
+ action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
} else {
if (!CORBA::is_nil(anObject)) {
SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
}
}
}
- } else {
- if (aType == VISU::TPOINTMAP3D) {
- theMenu->removeAction( action( myEraseAll ) );
- theMenu->addAction( action( VISU_SHOW_TABLE_PLOT ) );
- theMenu->addSeparator();
- theMenu->addAction( action( VISU_ERASE ) );
- theMenu->addAction( action( myEraseAll ) );
- theMenu->addAction( action( VISU_DISPLAY ) );
- theMenu->addAction( action( VISU_DISPLAY_ONLY ) );
- theMenu->addSeparator();
- }
}
}
shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
+ action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
+ action(VISU_RENAME )->setEnabled(true); // Rename: Key_F2
+
return true;
}
setToolShown( false );
// Unset actions accelerator keys
- action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey);
+ action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
+
+ action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
+ action(VISU_RENAME )->setEnabled(false); // Rename: Key_F2
SalomeApp_Module::deactivateModule( theStudy );
return true;
setPreferenceProperty( sp, "hstretch", 0 );
setPreferenceProperty( sp, "vstretch", 0 );
- int scalar_def_represent = addPreference( tr( "VISU_SCALAR_MAP_ON_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
+ int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
setPreferenceProperty( scalar_def_represent, "strings", modes1 );
setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
+ int point_precision = addPreference( tr( "VISU_FLOATING_POINT_PRECISION" ), representGr,
+ LightApp_Preferences::IntSpin, "VISU", "floating_point_precision" );
+ setPreferenceProperty( point_precision, "min", 1 );
+ setPreferenceProperty( point_precision, "max", 16 );
+ setPreferenceProperty( point_precision, "step", 1 );
+ addPreference( "", representGr, LightApp_Preferences::Space );
+
addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
sp = addPreference( "", representGr, LightApp_Preferences::Space );
setPreferenceProperty( sp, "hstretch", 0 );
setPreferenceProperty( sp, "vstretch", 0 );
addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
+ addPreference( "", representGr, LightApp_Preferences::Space );
+
+ addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
+ LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
// TAB: 3D Cache ; group: "Cache properties"
int cacheTab = addPreference( tr( "3D Cache" ) );
void OnCreatePlot3D();
void OnCreateManyMesh();
void OnCreatePlot2dView();
- void OnCreateScalarMapOnDeformedShape();
+ void OnCreateDeformedShapeAndScalarMap();
void OnEditScalarMap();
void OnEditDeformedShape();
void OnEditVectors();
void OnEditStreamLines();
void OnEditPlot3D();
- void OnEditScalarMapOnDeformedShape();
+ void OnEditDeformedShapeAndScalarMap();
virtual void OnDisplayPrs();
virtual void OnDisplayOnlyPrs();
#define VISU_CUT_LINES 4017
#define VISU_PLOT2D 4018
#define VISU_PLOT_3D 4019
-#define VISU_SCALAR_MAP_ON_DEFORMED_SHAPE 40110
+#define VISU_DEFORMED_SHAPE_AND_SCALAR_MAP 40110
//#define VISU_DELETE 4021
#define VISU_DELETE_OBJS 4022
#define VISU_SHOW_TABLE 4023
-#define VISU_SHOW_TABLE_PLOT 4029
+#define VISU_EDIT_POINTMAP3D 4029
#define VISU_CREATE_CURVES 4024
#define VISU_EXPORT_TABLE 4025
#define VISU_EDIT_VECTORS 40625
#define VISU_EDIT_STREAMLINES 40626
#define VISU_EDIT_PLOT3D 40627
-#define VISU_EDIT_SCALARMAPONDEFORMEDSHAPE 40628
+#define VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP 40628
#define VISU_EDIT_PRS 4062
#define VISU_CREATE_TABLE 4063
#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_CutPlanes_i.hh"
+#include "VISU_Result_i.hh"
#include "VISU_CutPlanesPL.hxx"
//#include "OB_Browser.h"
#include <QGroupBox>
#include <QPushButton>
#include <QHeaderView>
+#include <QComboBox>
#include <vtkRenderer.h>
#include <vtkPolyData.h>
#include <vtkAppendPolyData.h>
#include <vtkDataSetMapper.h>
+#include <vtkDataSet.h>
using namespace std;
QLabel* aPosLbl = new QLabel(tr( "LBL_POS" ), this);
myPosSpn = new QtxDoubleSpinBox( 0, 1, 0.1, this );
+ GDeformation = new QGroupBox(tr("LBL_DEFORMATION"), this);
+ GDeformation->setCheckable(true);
+ GDeformation->setChecked(false);
+ QGridLayout* GDeformationLayout = new QGridLayout( GDeformation );
+ GDeformationLayout->setSpacing( 6 );
+ GDeformationLayout->setMargin( 11 );
+ connect(GDeformation, SIGNAL(toggled(bool)), this, SLOT(onDeformationCheck(bool)));
+
+ QLabel* LabelDeformation1 = new QLabel (tr("LBL_DEFROMATION_VECT"), GDeformation);
+ GDeformationLayout->addWidget( LabelDeformation1, 0, 0 );
+
+ myVectorialFieldCombo = new QComboBox (GDeformation);
+ GDeformationLayout->addWidget( myVectorialFieldCombo, 0, 1 );
+
+ QLabel* LabelDeformation2 = new QLabel (tr("LBL_DEFROMATION_SCALE"), GDeformation);
+ GDeformationLayout->addWidget( LabelDeformation2, 1, 0 );
+ myScaleSpn = new QtxDoubleSpinBox (0.0, 1.0E+38, 0.1, GDeformation);
+ myScaleSpn->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+ GDeformationLayout->addWidget( myScaleSpn, 1, 1 );
+ connect(myVectorialFieldCombo, SIGNAL(activated(int)), this, SLOT(onVectorialFieldChanged(int)));
+ connect(myScaleSpn, SIGNAL(valueChanged(double)), this, SLOT(onScaleFactorChanged(double)));
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 );
+
+ myScaleSpn->setDecimals( aPrecision*(-1) );
+ myScaleSpn->setValue(0.1);
+
myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), this);
myPreviewCheck->setChecked(false);
connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
TopLayout->setRowStretch ( 3, 3 );
TopLayout->addWidget(aPosLbl, 4, 0 );
TopLayout->addWidget(myPosSpn, 4, 1 );
- TopLayout->addWidget( myPreviewCheck, 5, 0, 1, 2 );
+ TopLayout->addWidget( GDeformation, 5, 0, 1, 2 );
+ TopLayout->addWidget( myPreviewCheck, 6, 0, 1, 2 );
// signals and slots connections
connect( SelPlane, SIGNAL( buttonClicked( int )), this, SLOT( orientationChanged( int ) ) );
setRotation(thePrs->GetRotateX()*180./PI, thePrs->GetRotateY()*180./PI);
setPlanePos(thePrs->GetOrientationType());
myPosSpn->setValue(thePrs->GetDisplacement());
+ InitEntity2VectorialFieldsMap(thePrs);
+ InsertAllVectorialFields();
+ setScaleFactor(thePrs->GetScale());
+ if(myEntity2VectorialFields.size() < 1)
+ GDeformation->setDisabled(true);
+ else{
+ if(thePrs->IsDeformed()){
+ GDeformation->setChecked(true);
+ int idx = myVectorialFieldCombo->findText(thePrs->GetVectorialFieldName());
+ if (idx >= 0)
+ myVectorialFieldCombo->setCurrentIndex(idx);
+ else {
+ myVectorialFieldCombo->addItem(thePrs->GetVectorialFieldName());
+ myVectorialFieldCombo->setCurrentIndex(myVectorialFieldCombo->count()-1);
+ }
+ }
+ }
+
hasInit = true;
// init table
myCutPlanes = VISU::TSameAsFactory<VISU::TCUTPLANES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
}
}
+void VisuGUI_CutPlanesPane::InitEntity2VectorialFieldsMap(VISU::ColoredPrs3d_i* thePrs){
+
+ VISU::Result_var theResult = thePrs->GetResultObject();
+ VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>(GetServant(theResult).in());
+ VISU::Result::Entities_var aEntities = aResult->GetEntities(thePrs->GetMeshName());
+ VISU::Result::TimeStampNumbers_var aScalarTimeStamp = aResult->GetTimeStampNumbers(thePrs->GetMeshName(),
+ thePrs->GetEntity(),
+ thePrs->GetFieldName());
+ CORBA::Long aTimeStampNumber = aScalarTimeStamp->length();
+
+ for(size_t iEntity = 0; iEntity < aEntities->length(); iEntity++){
+ VISU::Entity aEntity = aEntities[iEntity];
+ VISU::Result::EntityNames_var aFields = aResult->GetFields(thePrs->GetMeshName(),aEntity);
+ for(size_t iField = 0; iField < aFields->length(); iField++){
+
+ TVectorialFieldsList aVectorialFields;
+ VISU::Result::TimeStampNumbers_var aTimeStamps = aResult->GetTimeStampNumbers(thePrs->GetMeshName(),aEntity,aFields[iField] );
+
+ if((aResult->GetNumberOfComponents(thePrs->GetMeshName(),aEntity,aFields[iField] ) > 1) &&
+ (aTimeStamps->length() >= aTimeStampNumber)){
+ aVectorialFields.push_back(QString(aFields[iField].in()));
+ }
+ if(aVectorialFields.size() > 0){
+ myEntity2VectorialFields.insert(TEntVectPair(aEntity,aVectorialFields));
+ }
+ }
+ }
+}
+
+void VisuGUI_CutPlanesPane::InsertAllVectorialFields(){
+ TEntity2VectorialFields::const_iterator aFieldIter = myEntity2VectorialFields.begin();
+ for( ;aFieldIter != myEntity2VectorialFields.end();aFieldIter++ ){
+ TVectorialFieldsList aVectorialFields = aFieldIter->second;
+ for(size_t iField = 0;iField < aVectorialFields.size(); iField++)
+ myVectorialFieldCombo->addItem(aVectorialFields[iField]);
+ }
+}
+
+double VisuGUI_CutPlanesPane::getScaleFactor(){
+ return myScaleSpn->value();
+}
+
+void VisuGUI_CutPlanesPane::setScaleFactor(double theFactor){
+ double i=0.1;
+ while (1) { // Calculate Step & Precission
+ if ( int (theFactor/i) >= 0)
+ break;
+ else {
+ i = i*0.1;
+ }
+ }
+
+ myScaleSpn->setSingleStep(i);
+ myScaleSpn->setValue(theFactor);
+
+}
+
void VisuGUI_CutPlanesPane::createPlanes()
{
if (VISU::GetActiveViewWindow<SVTK_ViewWindow>() == NULL) return;
if (!myCutPlanes) return;
if (myPreviewActor != 0) return;
- vtkAppendPolyData* aPolyData = myCutPlanes->GetSpecificPL()->GetAppendPolyData();
- if (!aPolyData->GetOutput()->GetNumberOfCells()) {
+ vtkDataSet* aDataSet = myCutPlanes->GetSpecificPL()->GetWarpVectorOutput();
+ if (!aDataSet->GetNumberOfCells()) {
onPreviewCheck(false);
return;
}
vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
- aPlaneMapper->SetInput(aPolyData->GetOutput());
+ aPlaneMapper->SetInput(aDataSet);
aPlaneMapper->ScalarVisibilityOff();
myPreviewActor = SALOME_Actor::New();
else
thePrs->SetDefault(i);
}
+
+ thePrs->UseDeformation(GDeformation->isChecked());
+
+ if(GDeformation->isChecked()){
+ TEntity2VectorialFields::const_iterator anIter = myEntity2VectorialFields.begin();
+ VISU::Entity anEntity;
+ QString aFieldName;
+ bool isInited = false;
+ for(;anIter != myEntity2VectorialFields.end();anIter++){
+ TVectorialFieldsList aFields = anIter->second;
+ for(int it = 0;it < aFields.size();it++)
+ if(!QString::compare(aFields[it], myVectorialFieldCombo->currentText ())){
+ anEntity = anIter->first;
+ aFieldName = aFields[it];
+ isInited = true;
+ break;
+ }
+ if(isInited)
+ break;
+ }
+ if(isInited)
+ thePrs->SetVectorialField(anEntity,aFieldName.toLatin1().constData());
+
+ thePrs->SetScale(myScaleSpn->value());
+ }
return 1;
}
Rot2->setValue( r2 );
}
+void VisuGUI_CutPlanesPane::onScaleFactorChanged(double theFactor){
+ DrawTable();
+}
+
+void VisuGUI_CutPlanesPane::onVectorialFieldChanged(int pos){
+ InitVectorialField();
+ DrawTable();
+}
+
+void VisuGUI_CutPlanesPane::onDeformationCheck(bool Flag){
+ if(!myCutPlanes || !hasInit) return;
+ myCutPlanes->UseDeformation(Flag);
+ InitVectorialField();
+ DrawTable();
+}
+
+void VisuGUI_CutPlanesPane::InitVectorialField(){
+ if(myCutPlanes->IsDeformed()){
+ TEntity2VectorialFields::const_iterator anIter = myEntity2VectorialFields.begin();
+ VISU::Entity anEntity;
+ QString aFieldName;
+ bool isInited = false;
+ for(;anIter != myEntity2VectorialFields.end();anIter++){
+ TVectorialFieldsList aFields = anIter->second;
+ for(int it = 0;it < aFields.size();it++)
+ if(!QString::compare(aFields[it], myVectorialFieldCombo->currentText ())){
+ anEntity = anIter->first;
+ aFieldName = aFields[it];
+ isInited = true;
+ break;
+ }
+ if(isInited)
+ break;
+ }
+ if(isInited)
+ myCutPlanes->SetVectorialField(anEntity,aFieldName.toLatin1().constData());
+ }
+}
+
/*!
Draw the table of planes positions
*/
myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
myCutPlanes->SetNbPlanes(aNbPlanes);
myCutPlanes->SetDisplacement(myPosSpn->value());
+ myCutPlanes->SetScale(getScaleFactor());
if (aNbRows>0)
for (int i = 0; i < aNbRows; ++i) {
QTableWidgetItem* aItem = myPosTable->item( i, 1 );
storeToPrsObject(myCutPlanes);
myCutPlanes->GetPipeLine()->Update();
createPlanes();
- vf->onFitAll();
+ if(VISU::GetResourceMgr()->booleanValue("VISU","automatic_fit_all",false)) {
+ vf->onFitAll();
+ }
} else {
deletePlanes();
vf->Repaint();
class QTabWidget;
class QTableWidget;
class QCheckBox;
-
-
+class QComboBox;
#include "SALOMEconfig.h"
#include CORBA_CLIENT_HEADER(VISU_Gen)
+#include <map>
+#include <vector>
+
namespace VISU
{
class CutPlanes_i;
+ class Result_i;
};
class SUIT_ViewWindow;
double getRotation1() {return Rot1->value();}
double getRotation2() {return Rot2->value();}
- void initFromPrsObject(VISU::CutPlanes_i* thePrs);
- int storeToPrsObject(VISU::CutPlanes_i* thePrs);
+ double getScaleFactor();
+ void setScaleFactor(double factor);
+
+ void initFromPrsObject(VISU::CutPlanes_i* thePrs);
+ int storeToPrsObject(VISU::CutPlanes_i* thePrs);
private:
+ typedef std::vector<QString> TVectorialFieldsList;
+ typedef std::map<VISU::Entity, TVectorialFieldsList> TEntity2VectorialFields;
+ typedef std::pair<VISU::Entity,TVectorialFieldsList> TEntVectPair;
+ TEntity2VectorialFields myEntity2VectorialFields;
+
void createPlanes();
void deletePlanes();
+ void InitEntity2VectorialFieldsMap(VISU::ColoredPrs3d_i* thePrs);
+ void InsertAllVectorialFields();
+ void InitVectorialField();
+
QLabel* LabelRot1;
QLabel* LabelRot2;
+ QGroupBox* GDeformation;
QSpinBox* nbPlan;
QtxDoubleSpinBox* Rot1;
QtxDoubleSpinBox* Rot2;
QTableWidget* myPosTable;
SALOME::GenericObjPtr<VISU::CutPlanes_i> myCutPlanes;
QCheckBox* myPreviewCheck;
+ QComboBox* myVectorialFieldCombo;
+ QtxDoubleSpinBox* myScaleSpn;
double X1, X2;
double Y1, Y2;
double Z1, Z2;
void onValueChanged(int theRow, int theCol);
void onRotation(double theValue);
void onPreviewCheck(bool thePreview);
+ void onScaleFactorChanged(double);
+ void onDeformationCheck(bool);
+ void onVectorialFieldChanged(int);
};
--- /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 <QtxDoubleSpinBox.h>
+#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 <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QGridLayout>
+#include <QTabWidget>
+#include <QComboBox>
+#include <QPushButton>
+#include <QLabel>
+
+#define MYDEBUG 0
+
+/*!
+ * Constructor
+ */
+VisuGUI_DeformedShapeAndScalarMapDlg::VisuGUI_DeformedShapeAndScalarMapDlg (SalomeApp_Module* theModule)
+ : VisuGUI_ScalarBarBaseDlg(theModule),
+ myIsAnimation(false),
+ myUpdateScalars(true),
+ myVisuGUI(theModule)
+{
+ setWindowTitle(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
+ QWidget* aBox = new QWidget (this);
+ QVBoxLayout* aVBLay = new QVBoxLayout( aBox );
+ aVBLay->setMargin(11);
+ QFrame* TopGroup = new QFrame (aBox);
+ aVBLay->addWidget(TopGroup);
+ TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
+ TopGroup->setLineWidth(1);
+ QGridLayout* TopGroupLayout = new QGridLayout (TopGroup);
+ TopGroupLayout->setSpacing(6);
+ TopGroupLayout->setMargin(11);
+
+ // Scale factor
+ QLabel* ScaleLabel = new QLabel (tr("SCALE_FACTOR"), TopGroup);
+ TopGroupLayout->addWidget(ScaleLabel, 0, 0);
+
+ ScalFact = new QtxDoubleSpinBox (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->setDecimals( aPrecision*(-1) );
+ ScalFact->setValue(0.1);
+ TopGroupLayout->addWidget(ScalFact, 0, 1);
+
+ // Fields combo box
+ QLabel* FieldLabel = new QLabel (tr("FIELD_ITEM"), TopGroup);
+ myFieldsCombo = new QComboBox (TopGroup);
+
+ TopGroupLayout->addWidget(FieldLabel, 1, 0);
+ TopGroupLayout->addWidget(myFieldsCombo,1,1);
+
+ // TimeStamps combo box
+ QLabel* TimeStampLabel = new QLabel (tr("TIMESTAMP_ITEM"), TopGroup);
+ myTimeStampsCombo = new QComboBox (TopGroup);
+
+ TopGroupLayout->addWidget(TimeStampLabel, 2, 0);
+ TopGroupLayout->addWidget(myTimeStampsCombo,2,1);
+ TopGroupLayout->setRowStretch(3,5);
+
+ //
+ 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);
+ QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
+ GroupButtonsLayout->setSpacing(6);
+ GroupButtonsLayout->setMargin(11);
+
+ QPushButton* buttonOk = new QPushButton (tr("&OK"), GroupButtons);
+ buttonOk->setAutoDefault(true);
+ buttonOk->setDefault(true);
+ QPushButton* buttonCancel = new QPushButton (tr("&Cancel") , GroupButtons);
+ buttonCancel->setAutoDefault(true);
+ QPushButton* buttonHelp = new QPushButton (tr("&Help") , GroupButtons);
+ buttonHelp->setAutoDefault(true);
+
+ GroupButtonsLayout->addWidget(buttonOk);
+ GroupButtonsLayout->addSpacing(10);
+ GroupButtonsLayout->addStretch();
+ GroupButtonsLayout->addWidget(buttonCancel);
+ GroupButtonsLayout->addWidget(buttonHelp);
+
+ // 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.toLatin1().constData(),
+ aTimeIter.toInt());
+ }
+ }
+ }
+ }
+ AddAllFieldNames();
+ }
+ int idx = myFieldsCombo->findText(aFieldName.in());
+ if (idx >= 0)
+ myFieldsCombo->setCurrentIndex(idx);
+ else {
+ myFieldsCombo->addItem(aFieldName.in());
+ myFieldsCombo->setCurrentIndex(myFieldsCombo->count()-1);
+ }
+ AddAllTimes(myFieldsCombo->currentText());
+ idx = myTimeStampsCombo->findText(aIteration);
+ if (idx >= 0)
+ myTimeStampsCombo->setCurrentIndex(idx);
+ else {
+ myTimeStampsCombo->addItem(aIteration);
+ myTimeStampsCombo->setCurrentIndex(myTimeStampsCombo->count()-1);
+ }
+ SetScalarField( false );
+
+ VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
+
+ if( !theInit )
+ return;
+
+ myInputPane->initFromPrsObject( myPrsCopy );
+ myTabBox->setCurrentIndex( 0 );
+}
+
+double VisuGUI_DeformedShapeAndScalarMapDlg::getFactor() const
+{
+ return ScalFact->value();
+}
+
+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->setSingleStep(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().toLatin1().constData(),
+ myTimeStampID[ myTimeStampsCombo->currentIndex() ]);
+
+ if(myUpdateScalars)
+ SetScalarField( false );
+
+ VISU::TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Copy(myPrsCopy, thePrs);
+
+ return anIsOk;
+}
+
+int VisuGUI_DeformedShapeAndScalarMapDlg::getCurrentScalarFieldNamePos(){
+ return myFieldsCombo->currentIndex();
+}
+
+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->currentIndex() ], "", 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.toLatin1().constData(),
+ 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->addItem(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->addItem(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 <QDialog>
+
+#include <set>
+#include <vector>
+
+class SalomeApp_Module;
+class VisuGUI_InputPane;
+class QtxDoubleSpinBox;
+class QComboBox;
+class QTabWidget;
+
+namespace VISU
+{
+ class DeformedShapeAndScalarMap_i;
+}
+
+class VisuGUI_DeformedShapeAndScalarMapDlg : public VisuGUI_ScalarBarBaseDlg
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_DeformedShapeAndScalarMapDlg (SalomeApp_Module* theModule);
+ ~VisuGUI_DeformedShapeAndScalarMapDlg();
+
+ double getFactor() const;
+ 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:
+ QtxDoubleSpinBox* 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
ScalFact = new QtxDoubleSpinBox (0.0, 1.0E+38, 0.1, TopGroup);
ScalFact->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
- ScalFact->setDecimals(38);
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 );
+
+ ScalFact->setDecimals( aPrecision*(-1) ); // ScalFact->setDecimals(38);
ScalFact->setValue(0.1);
TopGroupLayout->addWidget(ScalFact, 0, 1);
GroupButtonsLayout->setSpacing(6);
GroupButtonsLayout->setMargin(11);
- QPushButton* buttonOk = new QPushButton (tr("BUT_OK"), GroupButtons);
+ QPushButton* buttonOk = new QPushButton (tr("A&pply and Close"), GroupButtons);
buttonOk->setAutoDefault(TRUE);
buttonOk->setDefault(TRUE);
GroupButtonsLayout->addWidget(buttonOk, 0, 0);
myTabBox->setCurrentIndex(0);
}
+void VisuGUI_DeformedShapeDlg::setFactor(double theFactor)
+{
+ double i=0.1;
+ while (1) { // Calculate Step & Precission
+ if ( int (theFactor/i) > 0)
+ break;
+ else {
+ i = i*0.1;
+ }
+ }
+
+ ScalFact->setSingleStep(i);
+
+ ScalFact->setValue(theFactor);
+}
+
int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
{
if( !isValid() )
VisuGUI* aVisuGUI = dynamic_cast <VisuGUI*>(myModule);
if ( myPrsCopy->GetNumberOfActors() == 0 ) {
PublishInView(aVisuGUI, myPrsCopy, aViewWindow);
- aViewWindow->onFitAll();
+ if(VISU::GetResourceMgr()->booleanValue("VISU","automatic_fit_all",false))
+ aViewWindow->onFitAll();
int aPos = VISU::GetFreePositionOfDefaultScalarBar(aVisuGUI, aViewWindow);
VISU::AddScalarBarPosition(aVisuGUI, aViewWindow, myPrsCopy, aPos);
} else {
aFieldName.toLatin1().data(),
aTimeStampId.toInt(),
aPublishInStudyMode);
-
- VisuGUI_DeformedShapeDlg* aDlg = new VisuGUI_DeformedShapeDlg (theModule);
- aDlg->initFromPrsObject(aPrs3d, true);
- aDlg->UseMagn->setChecked(true);
- VisuGUI_DialogRunner r(aDlg);
- int dlgResult = r.run( false );
-
- if ( dlgResult == 0 )
- aPrs3d->RemoveFromStudy();
- else {
- aDlg->storeToPrsObject( aPrs3d );
- SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
- PublishInView(theModule, aPrs3d, aViewWindow);
- aViewWindow->onFitAll();
- int aPos = VISU::GetFreePositionOfDefaultScalarBar(theModule, aViewWindow);
- VISU::AddScalarBarPosition(theModule, aViewWindow, aPrs3d, aPos);
+
+ if (aPrs3d) {
+ VisuGUI_DeformedShapeDlg* aDlg = new VisuGUI_DeformedShapeDlg (theModule);
+ aDlg->initFromPrsObject(aPrs3d, true);
+ aDlg->UseMagn->setChecked(true);
+ VisuGUI_DialogRunner r(aDlg);
+ int dlgResult = r.run( false );
+
+ if ( dlgResult == 0 )
+ DeletePrs3d(theModule,aPrs3d);
+ else {
+ aDlg->storeToPrsObject( aPrs3d );
+ SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
+ PublishInView(theModule, aPrs3d, aViewWindow);
+ if(VISU::GetResourceMgr()->booleanValue("VISU","automatic_fit_all",false))
+ aViewWindow->onFitAll();
+ int aPos = VISU::GetFreePositionOfDefaultScalarBar(theModule, aViewWindow);
+ VISU::AddScalarBarPosition(theModule, aViewWindow, aPrs3d, aPos);
+ }
+
+ VISU::UpdateObjBrowser(theModule, true, aTimeStamp);
+ delete aDlg;
}
-
- VISU::UpdateObjBrowser(theModule, true, aTimeStamp);
- delete aDlg;
}
}
}
double getFactor()
{ return ScalFact->value(); }
- void setFactor(double theFactor)
- { ScalFact->setValue(theFactor); }
+ void setFactor(double theFactor);
bool isColored()
{ return UseMagn->isChecked(); }
aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aColoredPrs3d).in());
}else if (aType == VISU::TPOINTMAP3D) {
VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBaseServant);
- VISU_PointMap3dActor* aPointMap3dActor = aTable3d->CreateActor();
- if (aPointMap3dActor) {
- aViewWindow->AddActor(aPointMap3dActor);
+ VISU_ActorBase* anActorBase = VISU::FindActorBase(aViewWindow, aTable3d);
+ if (anActorBase) {
+ anActorBase->SetVisibility(true);
aViewWindow->Repaint();
}
+ else {
+ VISU_PointMap3dActor* aPointMap3dActor = aTable3d->CreateActor();
+ if (aPointMap3dActor) {
+ aViewWindow->AddActor(aPointMap3dActor);
+ aPointMap3dActor->SetVisibility(true);
+ aViewWindow->Repaint();
+ }
+ }
}
else
aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aBaseServant);
if(aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER)
return true;
+ if(aBase->GetType() == VISU::TPOINTMAP3D)
+ return dynamic_cast<VISU::PointMap3d_i*>(aBase);
+
return dynamic_cast<VISU::Prs3d_i*>(aBase);
}
else if( viewer_type==SPlot2d_Viewer::Type() )
#include "LightApp_Application.h"
#include "SalomeApp_Module.h"
+#include "LightApp_SelectionMgr.h"
#include "SUIT_Desktop.h"
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
myTextDlg->setTitleText(QString(thePrs->GetTitle()));
vtkFloatingPointType R, G, B;
- thePrs->GetTitleColor(&R, &G, &B);
+ thePrs->GetTitleColor(R, G, B);
myBarDlg->setLabelsFormat(thePrs->GetLabelsFormat());
myBarDlg->setUnitsVisible(thePrs->IsUnitsVisible());
thePrs->IsShadowTitle());
// "Labels"
- thePrs->GetLabelColor(&R, &G, &B);
+ thePrs->GetLabelColor(R, G, B);
myTextDlg->myLabelFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
thePrs->GetLblFontType(),
* Constructor
*/
VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule):
+ myModule(theModule),
VisuGUI_Prs3dDlg(theModule)
{
//setName("VisuGUI_GaussPointsDlg");
// Input pane
myInputPane = new VisuGUI_InputPane(VISU::TGAUSSPOINTS, theModule, this);
+ myInputPane->SetRestoreInitialSelection(false);
connect( myResultsButton, SIGNAL( clicked() ), mySizeBox, SLOT( onToggleResults() ) );
connect( myResultsButton, SIGNAL( toggled( bool ) ), myScalarPane, SLOT( setEnabled( bool ) ) );
myPrsCopy->SetMagnification( mySizeBox->getMagnification() );
myPrsCopy->SetMagnificationIncrement( mySizeBox->getIncrement() );
- VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Copy(myPrsCopy, thePrs);
-
+ VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Copy(myPrsCopy, thePrs);
+
+ //Set created Gauss points presentation selected,
+ //Issue 0019874(EDF 746 VISU: Picking alphanumeric Gauss)
+ if(thePrs){
+ SALOME_ListIO aListIO;
+ LightApp_SelectionMgr* aSelectionMgr = VISU::GetSelectionMgr(myModule);
+ Handle(SALOME_InteractiveObject) anIO = thePrs->GetIO();
+ if(anIO && anIO->hasEntry()) {
+ aListIO.Append(anIO);
+ VISU::UpdateObjBrowser(myModule,true);
+ aSelectionMgr->setSelectedObjects(aListIO);
+ }
+ else
+ myInputPane->SetRestoreInitialSelection(true);
+ }
return anIsOk;
}
QtxDoubleSpinBox* myScaleSpinBox;
SALOME::GenericObjPtr<VISU::GaussPoints_i> myPrsCopy;
+ SalomeApp_Module* myModule;
};
#endif // VISUGUI_GAUSSPOINTSDLS_H
QGroupBox( theDialog ),
myModule( theModule ),
myDialog( theDialog ),
- myPrs( NULL )
+ myPrs( NULL ),
+ isRestoreInitialSelection(true)
{
//setFrameStyle( QFrame::NoFrame );
}
// Restore initial selection
- aSelectionMgr->setSelectedObjects(mySavedSelection);
+ if(isRestoreInitialSelection)
+ aSelectionMgr->setSelectedObjects(mySavedSelection);
}
+void VisuGUI_InputPane::SetRestoreInitialSelection(bool on){
+ isRestoreInitialSelection = on;
+}
+
+bool VisuGUI_InputPane::GetRestoreInitialSelection(){
+ return isRestoreInitialSelection;
+}
//---------------------------------------------------------------
/*!
int storeToPrsObject( VISU::ColoredPrs3d_i* );
bool eventFilter (QObject* object, QEvent* event);
+ void SetRestoreInitialSelection(bool on);
+ bool GetRestoreInitialSelection();
public slots:
virtual void onSelectionChanged();
VISU::Result_var myResult;
int myEntity;
+ bool isRestoreInitialSelection;
VisuGUI_FieldFilter* myFieldFilter;
SALOME_ListIO mySavedSelection;
#include <QLineEdit>
#include <QTabWidget>
#include <QKeyEvent>
-
-
+#include <QColorDialog>
using namespace std;
-
VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane (QWidget* parent,
VisuGUI_ScalarBarPane* theScalarPane)
: QWidget(parent),
LabelMax->setBuddy(MaxIso);
TopGroupLayout->addWidget( MaxIso, 2, 1 );
+ myUseMagnitude = new QCheckBox(tr("MAGNITUDE_COLORING_CHK"), TopGroup);
+ myUseMagnitude->setChecked(true);
+ TopGroupLayout->addWidget( myUseMagnitude, 3, 0 );
+ mySelColor = new QPushButton(tr("SEL_COLOR_BTN"), TopGroup);
+ QPalette pal = mySelColor->palette();
+ pal.setColor(mySelColor->backgroundRole(), Qt::black);
+ pal.setColor(mySelColor->foregroundRole(), Qt::gray);
+ mySelColor->setPalette(pal);
+ mySelColor->setDisabled(true);
+ TopGroupLayout->addWidget( mySelColor, 3, 1 );
+ connect( mySelColor, SIGNAL( clicked() ), this, SLOT( setColor() ) );
+ connect( myUseMagnitude, SIGNAL( toggled(bool) ), mySelColor, SLOT( setDisabled(bool) ) );
+
+ myUseLabels = new QCheckBox(tr("SHOW_VALUES_CHK"), TopGroup);
+ myUseLabels->setChecked(false);
+ TopGroupLayout->addWidget( myUseLabels, 4, 0 );
+ myNbLabels = new QSpinBox( TopGroup );
+ myNbLabels->setMinimum(1);
+ myNbLabels->setMaximum(100);
+ myNbLabels->setSingleStep(1);
+ myNbLabels->setEnabled(false);
+ TopGroupLayout->addWidget( myNbLabels, 4, 1 );
+ connect( myUseLabels, SIGNAL( toggled(bool) ), myNbLabels, SLOT( setEnabled(bool) ) );
+
QPushButton* aUpdateBtn = new QPushButton( "Update scalar bar range with these values", TopGroup);
- TopGroupLayout->addWidget( aUpdateBtn, 3, 0, 1, 2);
+ TopGroupLayout->addWidget( aUpdateBtn, 5, 0, 1, 2);
connect( aUpdateBtn, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) );
}
NbrIso->setValue(thePrs->GetNbSurfaces());
MinIso->setText(QString::number(thePrs->GetSubMin()));
MaxIso->setText(QString::number(thePrs->GetSubMax()));
+ myUseMagnitude->setChecked(thePrs->IsColored());
+ SALOMEDS::Color anOldColor = thePrs->GetColor();
+ QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
+ setColor(aColor);
+
+ myUseLabels->setChecked(thePrs->IsLabeled());
+ myNbLabels->setValue(thePrs->GetNbLabels());
}
int VisuGUI_IsoSurfPane::storeToPrsObject (VISU::IsoSurfaces_i* thePrs)
{
thePrs->SetNbSurfaces(NbrIso->value());
thePrs->SetSubRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
+ thePrs->ShowLabels(myUseLabels->isChecked(), myNbLabels->value());
+ thePrs->ShowColored(myUseMagnitude->isChecked());
+ if(!thePrs->IsColored()){
+ QColor aQColor = color();
+ SALOMEDS::Color aColor;
+ aColor.R = aQColor.red()/255.;
+ aColor.G = aQColor.green()/255.;
+ aColor.B = aQColor.blue()/255.;
+ thePrs->SetColor(aColor);
+ }
return 1;
}
return true;
}
+void VisuGUI_IsoSurfPane::setColor()
+{
+ QColor cnew = QColorDialog::getColor( color(), this );
+ if ( cnew.isValid() )
+ setColor(cnew);
+}
+void VisuGUI_IsoSurfPane::setColor(const QColor& theColor)
+{
+ QPalette pal = mySelColor->palette();
+ pal.setColor(mySelColor->backgroundRole(), theColor);
+ mySelColor->setPalette(pal);
+}
+QColor VisuGUI_IsoSurfPane::color() const
+{
+ return mySelColor->palette().color(mySelColor->backgroundRole());
+}
/*!
{
Q_OBJECT;
- public:
+public:
VisuGUI_IsoSurfPane (QWidget* parent,
VisuGUI_ScalarBarPane* theScalarPane);
~VisuGUI_IsoSurfPane() {};
bool check();
- protected slots:
- void onCBUpdate();
+ void setColor(const QColor& theColor);
+ QColor color() const;
- private:
- QLineEdit* MinIso;
- QLineEdit* MaxIso;
- QSpinBox* NbrIso;
+protected slots:
+ void onCBUpdate();
+ void setColor();
+
+private:
+ QLineEdit* MinIso;
+ QLineEdit* MaxIso;
+ QSpinBox* NbrIso;
+ QCheckBox* myUseMagnitude;
+ QPushButton* mySelColor;
+ QCheckBox* myUseLabels;
+ QSpinBox* myNbLabels;
VisuGUI_ScalarBarPane* myScalarPane;
};
{
Q_OBJECT;
- public:
+public:
VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule);
~VisuGUI_IsoSurfacesDlg();
virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
- protected:
+protected:
virtual QString GetContextHelpFilePath();
protected slots:
void accept();
- private:
+private:
QTabWidget* myTabBox;
VisuGUI_IsoSurfPane* myIsoPane;
VisuGUI_InputPane* myInputPane;
#include "VISU_Actor.h"
#include "LightApp_Application.h"
+#include "LightApp_SelectionMgr.h"
+#include "SALOME_ListIteratorOfListIO.hxx"
#include "SalomeApp_Application.h"
#include "SVTK_ViewWindow.h"
#include "SVTK_ViewModel.h"
VisuGUI_OffsetDlg::VisuGUI_OffsetDlg (VisuGUI* theModule)
: QDialog(VISU::GetDesktop(theModule), Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
- myModule(theModule)
+ myModule(theModule),
+ mySelectionMgr(VISU::GetSelectionMgr(theModule))
{
//myPrsList.setAutoDelete(false);
+ //myPointMapList.setAutoDelete(false);
setWindowTitle(tr("TIT_OFFSETDLG"));
setSizeGripEnabled(TRUE);
connect(buttonApply, SIGNAL(clicked()), this, SLOT(onApply()));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp()));
+ connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
+
+ onSelectionChanged();
+ show();
+}
+
+void VisuGUI_OffsetDlg::setVisible(bool show){
+ if ( show && getPrsCount() > 0 )
+ QDialog::setVisible( show );
+ else
+ QDialog::setVisible( show );
+}
+
+void VisuGUI_OffsetDlg::onSelectionChanged(){
+ if(!mySelectionMgr)
+ return;
+
+ //Clear old selection
+ clearPresentations();
+
+ SALOME_ListIO aListIO;
+ mySelectionMgr->selectedObjects(aListIO);
+
+ SalomeApp_Study* aStudy = VISU::GetAppStudy(myModule);
+ SALOME_ListIteratorOfListIO anIter(aListIO);
+ for (; anIter.More(); anIter.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if (anIO->hasEntry()) {
+ QString anEntry(anIO->getEntry());
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, anEntry.toLatin1().constData());
+ if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase))
+ addPresentation(aPrsObject);
+ else if (VISU::PointMap3d_i* aPrs = dynamic_cast<VISU::PointMap3d_i*>(anObjectInfo.myBase)) {
+ addPointMapPresentation(aPrs);
+ }
+ }
+ }
+}
+
+void VisuGUI_OffsetDlg::clearPresentations(){
+ myPrsList.clear();
+ myPointMapList.clear();
+ myOldOffsets.clear();
+ myOldPointMapOffsets.clear();
}
void VisuGUI_OffsetDlg::addPresentation (VISU::Prs3d_i* thePrs)
}
}
+void VisuGUI_OffsetDlg::addPointMapPresentation (VISU::PointMap3d_i* thePrs)
+{
+ myPointMapList.append(thePrs);
+
+ CORBA::Float anOffset[3];
+ thePrs->GetOffset(anOffset[0],anOffset[1],anOffset[2]);
+ OffsetStruct anOffs(anOffset[0],anOffset[1],anOffset[2]);
+ myOldPointMapOffsets.append(anOffs);
+ if (myPointMapList.count() == 1) {
+ setOffset(anOffs.myOffset);
+ } else if (myPointMapList.count() == 2) {
+ OffsetStruct anOffs;
+ setOffset(anOffs.myOffset);
+ }
+}
+
void VisuGUI_OffsetDlg::setOffset (const vtkFloatingPointType* theOffset)
{
myDxEdt->setValue(theOffset[0]);
if (myPrsList.count() == 0)
return;
- if (isToSave())
+ if (isToSave()) {
thePrs->SetOffset(theOffset[0],theOffset[1],theOffset[2]);
+ thePrs->UpdateActors();
+ return;
+ }
ViewManagerList aViewManagerList;
SalomeApp_Application* anApp = myModule->getApp();
for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
- vw->onAdjustTrihedron();
if (VISU_Actor* anActor = VISU::FindActor(vw, thePrs)) {
+ anActor->SetPosition(theOffset);
+ vw->onAdjustTrihedron();
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
+ }
+ }
+ }
+ }
+ }
+}
+
+void VisuGUI_OffsetDlg::updatePointMapOffset (VISU::PointMap3d_i* thePrs, vtkFloatingPointType* theOffset)
+{
+ if (myPointMapList.count() == 0)
+ return;
+
+ if (isToSave())
+ thePrs->SetOffset(theOffset[0],theOffset[1],theOffset[2]);
+
+ ViewManagerList aViewManagerList;
+ SalomeApp_Application* anApp = myModule->getApp();
+ anApp->viewManagers(aViewManagerList);
+ SUIT_ViewManager* aViewManager;
+ foreach( aViewManager, aViewManagerList ) {
+ QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
+ for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
+ if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
+ if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
+ vw->onAdjustTrihedron();
+
+ if (VISU_ActorBase* anActor = VISU::FindActorBase(vw, thePrs)) {
anActor->SetPosition(theOffset);
vw->highlight(thePrs->GetIO(), 1);
vw->getRenderer()->ResetCameraClippingRange();
for (int i = 0; i < myPrsList.count(); i++) {
updateOffset(myPrsList.at(i), anOffset);
}
+ for (int i = 0; i < myPointMapList.count(); i++) {
+ updatePointMapOffset(myPointMapList.at(i), anOffset);
+ }
QDialog::accept();
}
for (int i = 0; i < myPrsList.count(); i++) {
updateOffset(myPrsList.at(i), myOldOffsets[i].myOffset);
}
+ for (int i = 0; i < myPointMapList.count(); i++) {
+ updatePointMapOffset(myPointMapList.at(i), myOldOffsets[i].myOffset);
+ }
QDialog::reject();
}
{
vtkFloatingPointType anOffset[3];
getOffset(anOffset);
+
for (int i = 0; i < myPrsList.count(); i++) {
updateOffset(myPrsList.at(i), anOffset);
}
+ for (int i = 0; i < myPointMapList.count(); i++) {
+ updatePointMapOffset(myPointMapList.at(i), anOffset);
+ }
}
void VisuGUI_OffsetDlg::onHelp()
#include "VTKViewer.h"
#include "VISU_Prs3d_i.hh"
+#include "VISU_PointMap3d_i.hh"
// QT Includes
#include <QDialog>
class QCheckBox;
class QtxDoubleSpinBox;
class VisuGUI;
+class LightApp_SelectionMgr;
struct OffsetStruct
{
VisuGUI_OffsetDlg (VisuGUI* theModule);
~VisuGUI_OffsetDlg() {};
+ virtual void setVisible(bool);
+
void addPresentation (VISU::Prs3d_i* thePrs);
- int getPrsCount() const { return myPrsList.count(); }
+ void addPointMapPresentation (VISU::PointMap3d_i* thePrs);
+ int getPrsCount() const { return myPrsList.count() + myPointMapList.count(); }
+ void clearPresentations();
void setOffset (const vtkFloatingPointType* theOffset);
void getOffset (vtkFloatingPointType* theOffset) const;
virtual void reject();
void onApply();
void onHelp();
+ void onSelectionChanged();
private:
void updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointType* theOffset);
+ void updatePointMapOffset (VISU::PointMap3d_i* thePrs, vtkFloatingPointType* theOffset);
VisuGUI * myModule;
+ LightApp_SelectionMgr* mySelectionMgr;
QtxDoubleSpinBox * myDxEdt;
QtxDoubleSpinBox * myDyEdt;
QList<VISU::Prs3d_i*> myPrsList;
QList<OffsetStruct> myOldOffsets;
+
+ QList<VISU::PointMap3d_i*> myPointMapList;
+ QList<OffsetStruct> myOldPointMapOffsets;
};
#endif // DIALOGBOX_OFFSET_H
static void renderViewFrame (SVTK_ViewWindow* vw)
{
if (vw) {
- vw->getRenderer()->ResetCameraClippingRange();
+// vw->getRenderer()->ResetCameraClippingRange();
vw->Repaint();
}
}
renderViewFrame(myViewWindow);
- if (fitall) {
+ if (fitall && VISU::GetResourceMgr()->booleanValue("VISU","automatic_fit_all",false)) {
myPreviewActor->SetInfinitive(false);
myViewWindow->onFitAll();
myPreviewActor->SetInfinitive(true);
ENUM2STRING( aResStr, VISU::TISOSURFACES );
ENUM2STRING( aResStr, VISU::TDEFORMEDSHAPE );
ENUM2STRING( aResStr, VISU::TSCALARMAPONDEFORMEDSHAPE );
+ ENUM2STRING( aResStr, VISU::TDEFORMEDSHAPEANDSCALARMAP );
ENUM2STRING( aResStr, VISU::TCUTPLANES );
ENUM2STRING( aResStr, VISU::TCUTLINES );
ENUM2STRING( aResStr, VISU::TVECTORS );
ENUM2STRING( aResStr, VISU::TSTREAMLINES );
ENUM2STRING( aResStr, VISU::TPLOT3D );
ENUM2STRING( aResStr, VISU::TANIMATION );
+ ENUM2STRING( aResStr, VISU::TPOINTMAP3D );
}
}
{
VISU_Actor* anActor = NULL;
VISU::Prs3d_i* aPrs3d = NULL;
+ VISU_ActorBase* anActorBase = NULL;
+ VISU::PointMap3d_i* aPointMap3d = NULL;
SVTK_ViewWindow* aViewWindow = NULL;
- if(!GetPrs3dSelectionInfo<TViewer>(theModule, theEntry, aPrs3d, aViewWindow, anActor))
- return QString();
-
- return get(aPrs3d, aViewWindow, anActor);
+ if(GetPrs3dSelectionInfo<TViewer>(theModule, theEntry, aPrs3d, aViewWindow, anActor)) {
+ return get(aPrs3d, aViewWindow, anActor);
+ } else {
+ aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
+ if ( aSelectionInfo.empty() )
+ return QString();
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ aPointMap3d = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
+ anActorBase = VISU::FindActorBase(aViewWindow, aPointMap3d);
+ return getPointMap(aPointMap3d, aViewWindow, anActorBase);
+ }
}
QString
{
return QString();
}
+
+ QString
+ virtual
+ getPointMap(VISU::PointMap3d_i* thePrs3d,
+ SVTK_ViewWindow* theViewWindow,
+ VISU_ActorBase* theActor)
+ {
+ return QString();
+ }
};
}
return aResStr;
}
+
+ QString
+ virtual
+ getPointMap(VISU::PointMap3d_i* thePrs3d,
+ SVTK_ViewWindow* theViewWindow,
+ VISU_ActorBase* theActorBase)
+ {
+ QString aResStr = "";
+ if (theActorBase) {
+ switch (theActorBase->GetRepresentation()) {
+ ENUM2STRING( aResStr, VISU::WIREFRAME ); // = 1
+ ENUM2STRING( aResStr, VISU::SHADED ); // = 2
+ }
+ }
+ return aResStr;
+ }
};
QString VisuGUI_Selection::representation( const int ind ) const
{
return theActor->IsShrunk() ? "1" : "0";
}
+
+ QString
+ virtual
+ getPointMap(VISU::PointMap3d_i* thePointMap,
+ SVTK_ViewWindow* theViewWindow,
+ VISU_ActorBase* theActorBase)
+ {
+ if (theActorBase)
+ return theActorBase->IsShrunk() ? "1" : "0";
+ else return "0";
+ }
};
QString VisuGUI_Selection::isShrunk( const int ind ) const
myTextDlg->setTitleText(aTitle.in());
myTitle = aTitle.in();
- vtkFloatingPointType R, G, B;
- myScalarMap->GetTitleColor(&R, &G, &B);
-
setPosAndSize( myScalarMap->GetPosX(),
myScalarMap->GetPosY(),
myScalarMap->GetWidth(),
myBarDlg->setLabelsFormat(myScalarMap->GetLabelsFormat());
myBarDlg->setUnitsVisible(myScalarMap->IsUnitsVisible());
- myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
+ vtkFloatingPointType R, G, B;
+ myScalarMap->GetTitleColor(R, G, B);
+
+ QColor aTextColor = QColor((int)(R*255.), (int)(G*255.), (int)(B*255.));
+
+ myTextDlg->myTitleFont->SetData(aTextColor,
myScalarMap->GetTitFontType(),
myScalarMap->IsBoldTitle(),
myScalarMap->IsItalicTitle(),
myScalarMap->IsShadowTitle());
// "Labels"
- myScalarMap->GetLabelColor(&R, &G, &B);
+ myScalarMap->GetLabelColor(R, G, B);
+
+ QColor aLabelColor = QColor((int)(R*255.), (int)(G*255.), (int)(B*255.));
- myTextDlg->myLabelFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
+ myTextDlg->myLabelFont->SetData(aLabelColor,
myScalarMap->GetLblFontType(),
myScalarMap->IsBoldLabel(),
myScalarMap->IsItalicLabel(),
// Display created presentation.
if (aViewWindow) {
PublishInView(theModule, aPrs3d, aViewWindow);
- aViewWindow->onFitAll();
+ if(GetResourceMgr()->booleanValue("VISU","automatic_fit_all",false)){
+ aViewWindow->onFitAll();
+ }
AddScalarBarPosition(theModule, aViewWindow, aPrs3d, aPos);
}
+++ /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_ScalarMapOnDeformedShapeDlg.cxx
-// Author : Eugeny Nikolaev
-// Module : VISU
-
-#include "VisuGUI_ScalarMapOnDeformedShapeDlg.h"
-
-#include "VisuGUI_Tools.h"
-#include "VisuGUI_InputPane.h"
-
-#include "VISU_Result_i.hh"
-#include "VISU_ScalarMapOnDeformedShape_i.hh"
-#include "VISU_ColoredPrs3dFactory.hh"
-
-#include "VISU_ScalarMapPL.hxx"
-#include "VISU_ScalarMapOnDeformedShapePL.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>
-#include <QTabWidget>
-#include <QGroupBox>
-#include <QCheckBox>
-#include <QComboBox>
-#include <QLabel>
-#include <QPushButton>
-#include <QFrame>
-#include <QKeyEvent>
-
-
-using namespace std;
-
-#define MYDEBUG 0
-
-/*!
- * Constructor
- */
-VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (SalomeApp_Module* theModule)
- : VisuGUI_ScalarBarBaseDlg(theModule),
- myIsAnimation(false),
- myUpdateScalars(true),
- myVisuGUI(theModule)
-{
- setWindowTitle(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
- QWidget* aBox = new QWidget (this);
- QVBoxLayout* aVBLay = new QVBoxLayout( aBox );
- aVBLay->setMargin(11);
- QFrame* TopGroup = new QFrame (aBox);
- aVBLay->addWidget( 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);
- TopGroupLayout->addWidget(ScaleLabel, 0, 0);
-
- ScalFact = new QtxDoubleSpinBox (0.0, 1.0E+38, 0.1, TopGroup);
- ScalFact->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
- ScalFact->setDecimals(38);
- ScalFact->setValue(0.1);
- TopGroupLayout->addWidget(ScalFact, 0, 1);
-
- // Fields combo box
- QLabel* FieldLabel = new QLabel (tr("FIELD_ITEM"), TopGroup);
- myFieldsCombo = new QComboBox (TopGroup );
-
- TopGroupLayout->addWidget(FieldLabel, 1, 0);
- TopGroupLayout->addWidget(myFieldsCombo,1,1);
-
- // TimeStamps combo box
- QLabel* TimeStampLabel = new QLabel (tr("TIMESTAMP_ITEM"), TopGroup);
- myTimeStampsCombo = new QComboBox (TopGroup);
-
- TopGroupLayout->addWidget(TimeStampLabel, 2, 0);
- TopGroupLayout->addWidget(myTimeStampsCombo,2,1);
-
- //
- myTabBox->addTab(aBox, tr("SCALAR_MAP_ON_DEFORMED_SHAPE_TAB"));
-
- // Scalar bar pane
- myInputPane = new VisuGUI_InputPane(VISU::TSCALARMAPONDEFORMEDSHAPE, theModule, this);
-
- myTabBox->addTab(GetScalarPane(), tr("SCALAR_BAR_TAB"));
- myTabBox->addTab(myInputPane, tr("INPUT_TAB"));
-
- // Buttons
- QGroupBox* GroupButtons = new QGroupBox (this);
- 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);
- GroupButtonsLayout->setAlignment(Qt::AlignTop);
- GroupButtonsLayout->setSpacing(6);
- GroupButtonsLayout->setMargin(11);
-
- QPushButton* buttonOk = new QPushButton (tr("BUT_OK"), GroupButtons);
- 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("BUT_CANCEL") , GroupButtons);
- buttonCancel->setAutoDefault(TRUE);
- GroupButtonsLayout->addWidget(buttonCancel, 0, 2);
-
- QPushButton* buttonHelp = new QPushButton (tr("BUT_HELP") , GroupButtons);
- 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_ScalarMapOnDeformedShapeDlg::~VisuGUI_ScalarMapOnDeformedShapeDlg()
-{}
-
-void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
- bool theInit )
-{
- if( theInit )
- myPrsCopy = VISU::TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().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.toLatin1().data(),
- aTimeIter.toInt());
- }
- }
- }
- }
- AddAllFieldNames();
- }
- myFieldsCombo->setCurrentIndex(myFieldsCombo->findText(aFieldName.in()));
- AddAllTimes(myFieldsCombo->currentText());
- myTimeStampsCombo->setCurrentIndex(myTimeStampsCombo->findText(aIteration));
- SetScalarField( false );
-
- VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
-
- if( !theInit )
- return;
-
- myInputPane->initFromPrsObject( myPrsCopy );
- myTabBox->setCurrentIndex( 0 );
-}
-
-int
-VisuGUI_ScalarMapOnDeformedShapeDlg
-::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().toLatin1().data(),
- myTimeStampID[ myTimeStampsCombo->currentIndex() ]);
-
-
- if(myUpdateScalars)
- SetScalarField( false );
-
- VISU::TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Copy(myPrsCopy, thePrs);
-
- return anIsOk;
-}
-
-int VisuGUI_ScalarMapOnDeformedShapeDlg::getCurrentScalarFieldNamePos(){
- return myFieldsCombo->currentIndex();
-}
-
-QString VisuGUI_ScalarMapOnDeformedShapeDlg::getCurrentScalarFieldName(){
- return myFieldsCombo->currentText();
-}
-
-int VisuGUI_ScalarMapOnDeformedShapeDlg::getCurrentScalarNbIterations(){
- return myTimeStampsCombo->count();
-}
-
-VISU::Entity
-VisuGUI_ScalarMapOnDeformedShapeDlg
-::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_ScalarMapOnDeformedShapeDlg::SetScalarField( const bool save_scalar_pane ){
- SetScalarField( myTimeStampID[ myTimeStampsCombo->currentIndex() ], "", save_scalar_pane );
-}
-
-void
-VisuGUI_ScalarMapOnDeformedShapeDlg
-::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.toLatin1().data(),
- theIter);
-
- if( save_scalar_pane )
- UpdateScalarField();
-
- QApplication::restoreOverrideCursor();
-}
-
-void VisuGUI_ScalarMapOnDeformedShapeDlg::accept()
-{
- VisuGUI_ScalarBarBaseDlg::accept();
-}
-
-void VisuGUI_ScalarMapOnDeformedShapeDlg::reject()
-{
- VisuGUI_ScalarBarBaseDlg::reject();
-}
-
-QString VisuGUI_ScalarMapOnDeformedShapeDlg::GetContextHelpFilePath()
-{
- return "scalar_map_on_deformed_shape_page.html";
-}
-
-void VisuGUI_ScalarMapOnDeformedShapeDlg::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->addItem(aFieldName);
- }
- }
-}
-
-void VisuGUI_ScalarMapOnDeformedShapeDlg::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->addItem(aTimeStampTime);
- }
- return;
- }
- }
-}
-
-void VisuGUI_ScalarMapOnDeformedShapeDlg::onFieldChanged(int){
- AddAllTimes(myFieldsCombo->currentText());
- SetScalarField();
- UpdateScalarField();
-}
-
-void VisuGUI_ScalarMapOnDeformedShapeDlg::onTimeStampChanged(int){
- SetScalarField();
- UpdateScalarField();
-}
-
-void VisuGUI_ScalarMapOnDeformedShapeDlg::UpdateScalarField(){
- GetScalarPane()->initFromPrsObject(myPrsCopy);
-}
-
-QString
-VisuGUI_ScalarMapOnDeformedShapeDlg
-::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_ScalarMapOnDeformedShapeDlg.h
-// Author : Eugeny Nikolaev
-// Module : VISU
-
-#ifndef VISUGUI_SCALARMAPONDEFORMEDSHAPEDLS_H
-#define VISUGUI_SCALARMAPONDEFORMEDSHAPEDLS_H
-
-#include "VisuGUI_Prs3dDlg.h"
-
-#include "VISUConfig.hh"
-
-#include "QtxDoubleSpinBox.h"
-
-class QComboBox;
-class QTabWidget;
-
-#include <set>
-#include <vector>
-
-class SalomeApp_Module;
-class VisuGUI_InputPane;
-
-namespace VISU
-{
- class ScalarMapOnDeformedShape_i;
-}
-
-class VisuGUI_ScalarMapOnDeformedShapeDlg : public VisuGUI_ScalarBarBaseDlg
-{
- Q_OBJECT
-
-public:
- VisuGUI_ScalarMapOnDeformedShapeDlg (SalomeApp_Module* theModule);
- ~VisuGUI_ScalarMapOnDeformedShapeDlg();
-
- double getFactor()
- { return ScalFact->value(); }
- void setFactor(double theFactor)
- { ScalFact->setValue(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:
- QtxDoubleSpinBox* 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::ScalarMapOnDeformedShape_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
#include "SVTK_ViewWindow.h"
#include "SVTK_Selector.h"
+#include "VISU_ConvertorUtils.hxx"
+
#include "utilities.h"
// OCCT Includes
{
int aVTKID = anVISUActor->GetNodeVTKID(anID);
if(aVTKID >= 0){
+ if ( aVTKID >= 0 ) {
vtkFloatingPointType* aCoord = anVISUActor->GetNodeCoord(anID);
myXValLbl->setText( QString::number( aCoord[0] ) );
myYValLbl->setText( QString::number( aCoord[1] ) );
myZValLbl->setText( QString::number( aCoord[2] ) );
- myIDValLbl->setText( QString::number(anID) );
- myScalarValLbl->setText(getValue(aPntData, aVTKID));
- myVectorValLbl->setText(getVector(aPntData, aVTKID));
+ myIDValLbl->setText( QString::number( anID ) );
+
+ if ( !VISU::IsElnoData( aDataSet ) ) {
+ myScalarValLbl->setText( getValue( aPntData, aVTKID ) );
+ myVectorValLbl->setText( getVector( aPntData, aVTKID ) );
+ } else {
+ myScalarValLbl->setText( "< ELNO data >" );
+ myVectorValLbl->setText( "< ELNO data >" );
+ }
+
const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper();
- VISU::TStructuredId aStructuredId = aMapper->GetIndexesOfNode(anID);
+ VISU::TStructuredId aStructuredId = aMapper->GetIndexesOfNode( anID );
myKValLbl->setText( GetNumber( aStructuredId, 2 ) );
myJValLbl->setText( GetNumber( aStructuredId, 1 ) );
myIValLbl->setText( GetNumber( aStructuredId, 0 ) );
- }
+ }
}
break;
+ }
case 1:
{
vtkCellData* aCellData = aDataSet->GetCellData();
myPrs = thePrs;
// scale
- ScaleSpn->setValue( thePrs->GetScaleFactor() );
+ double aScale = thePrs->GetScaleFactor();
+ if (aScale<0)
+ aScale = 0;
+ ScaleSpn->setValue( aScale );
// prs type
int id = thePrs->GetIsContourPrs() ? CONTOUR_PRS_ID : SURFACE_PRS_ID;
myTitle = aTitle.in();
vtkFloatingPointType R, G, B;
- myBarPrs->GetTitleColor( &R, &G, &B );
+ myBarPrs->GetTitleColor( R, G, B );
setPosAndSize( myBarPrs->GetPosX(),
myBarPrs->GetPosY(),
myBarPrs->IsShadowTitle() );
// "Labels"
- myBarPrs->GetLabelColor( &R, &G, &B );
+ myBarPrs->GetLabelColor( R, G, B );
myTextDlg->myLabelFont->SetData( QColor( (int)(R*255.), (int)(G*255.), (int)(B*255.) ),
myBarPrs->GetLblFontType(),
}
}
+//=======================================================================
+//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::warning( this,tr("WRN_VISU"),
+ tr("MSG_MINMAX_VALUES") );
+ 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::warning( this,
+ tr("WRN_VISU"),
+ tr("WRN_LOGARITHMIC_RANGE") );
+ } else {
+ if ( minVal == 0)
+ SUIT_MessageBox::warning( this,
+ tr("WRN_VISU"),
+ tr("WRN_LOGARITHMIC_RANGE") );
+ else
+ SUIT_MessageBox::warning( this,
+ tr("WRN_VISU"),
+ tr("WRN_LOGARITHMIC_FIELD_RANGE") );
+ RBIrange->setChecked(true);
+ changeRange(1);
+ }
+ return false;
+ }
+ }
+ return true;
+}
+
//=======================================================================
//function : Constructor
//purpose :
: QDialog ( VISU::GetDesktop( theModule ) )
{
setModal( false );
- setWindowTitle( tr( "TITLE" ) );
+ setWindowTitle( tr( "Point Map 3D Definition" ) );
setSizeGripEnabled( true );
QVBoxLayout* TopLayout = new QVBoxLayout( this );
{
}
+//=======================================================================
+//function : accept
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DDlg::accept()
+{
+ if (myScalarBarPane->check())
+ QDialog::accept();
+}
+
//=======================================================================
//function : onApply
//purpose :
//=======================================================================
void VisuGUI_Table3DDlg::onApply()
{
- storeToPrsObject( myPrsCopy );
- myPrsCopy->UpdateActors();
+ if (myScalarBarPane->check()) {
+ storeToPrsObject( myPrsCopy );
+ myPrsCopy->UpdateActors();
+ }
}
//=======================================================================
//=======================================================================
void VisuGUI_Table3DDlg::onHelp()
{
- // "table_3d_page.html";
+ 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::warning( this, QObject::tr("WRN_WARNING"),
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) );
+ }
+
}
//=======================================================================
myIsoPane->initFromPrsObject( thePrs );
myScalarBarPane->initFromPrsObject( thePrs );
}
-
virtual int storeToPrsObject( VISU::PointMap3d_i* );
protected slots:
+ void accept();
void onHelp();
void onApply();
#include "VisuGUI_VectorsDlg.h"
#include "VisuGUI_IsoSurfacesDlg.h"
#include "VisuGUI_StreamLinesDlg.h"
-#include "VisuGUI_ScalarMapOnDeformedShapeDlg.h"
+#include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
#include "VisuGUI_GaussPointsDlg.h"
#include "VISU_TimeAnimation.h"
#include "VISU_CutLines_i.hh"
#include "VISU_Vectors_i.hh"
#include "VISU_StreamLines_i.hh"
-#include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VISU_DeformedShapeAndScalarMap_i.hh"
#include "VISU_GaussPoints_i.hh"
#include "VISU_ViewManager_i.hh"
#define MAXVAL 1e10
#define VALPRECISION 8
+namespace {
+ void GeneratePresentations(int theFieldId, VISU_TimeAnimation* theAnimator)
+ {
+ theAnimator->generatePresentations(theFieldId);
+ FieldData& aFieldData = theAnimator->getFieldData(theFieldId);
+
+
+ int aRefFieldId = ( theAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) ? theFieldId : 0;
+ if(VISU::ColoredPrs3d_i* aInitialPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(theAnimator->getFieldData(aRefFieldId).myPrs[0])){
+ for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) {
+ VISU::ColoredPrs3d_i* aColoredPrs3d = aFieldData.myPrs[aFrameId];
+
+ // Special case for DeformedShape And ScalarMap presentation
+ // Restore time stamp number for all presentations
+ VISU::DeformedShapeAndScalarMap_i* aDeformedAndScalPrs = dynamic_cast<VISU::DeformedShapeAndScalarMap_i*>(aColoredPrs3d);
+ int aTimeStampNum = -1;
+ if(aDeformedAndScalPrs){
+ aTimeStampNum = aDeformedAndScalPrs->GetScalarTimeStampNumber();
+ }
+ aColoredPrs3d->SameAs(aInitialPrs3d);
+
+ if(aDeformedAndScalPrs){
+ aDeformedAndScalPrs->SetScalarField(aDeformedAndScalPrs->GetScalarEntity(),
+ aDeformedAndScalPrs->GetScalarFieldName(),
+ aTimeStampNum);
+ }
+
+ std::string aTitle = aColoredPrs3d->GetCTitle();
+ if ( aFrameId != 0 && theAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) {
+ aColoredPrs3d->SetTitle(aTitle.c_str());
+ }
+ }
+ }
+ }
+}
+
ArrangeDlg::ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator)
: QDialog(theParent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
myAnimator(theAnimator),
vtkActorCollection *aCollection = myViewWindow->getRenderer()->GetActors();
aCollection->InitTraversal();
while(vtkActor* anActor = aCollection->GetNextActor()){
- if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor))
+ if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor)) {
if(anVISUActor->GetVisibility() != 0){
if (VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d()){
if(!myPrsMap.contains(aPrs)){
}
}
}
+ } else { //if PointMap3d Actor
+ if (VISU_ActorBase* anActorBase = dynamic_cast<VISU_ActorBase*>(anActor))
+ if(anActorBase->GetVisibility() != 0)
+ if (VISU::PointMap3d_i* aPrs = dynamic_cast<VISU::PointMap3d_i*>(anActorBase->GetFactory())) {
+ if(!myPointMapPrsMap.contains(aPrs)){
+ Handle(SALOME_InteractiveObject) anIO = aPrs->GetIO();
+ if(!anIO->hasEntry())
+ continue;
+ SalomeApp_Study* aStudy = VISU::GetAppStudy(theModule);
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, anIO->getEntry());
+ if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
+ _PTR(GenericAttribute) anAttr;
+ if (aSObject->FindAttribute(anAttr, "AttributeName")) {
+ _PTR(AttributeName) aName(anAttr);
+ QString strIn(aName->Value().c_str());
+ aPrsNames.append(strIn);
+ myPointMapPrsMap[aPrs] = myOffsets.count();
+ Offset aOffs;
+ anActorBase->GetPosition(aOffs.myOffset);
+ myOffsets.append(aOffs);
+ }
+ }
+ }
+ }
+ }
}
myFieldLst->addItems(aPrsNames);
myFieldLst->setCurrentRow(0);
QApplication::setOverrideCursor( Qt::WaitCursor );
FieldData& aData = myAnimator->getFieldData(myFieldLst->currentRow());
if (aData.myPrs.empty())
- myAnimator->generatePresentations(myFieldLst->currentRow());
+ GeneratePresentations(myFieldLst->currentRow(),myAnimator);
vtkFloatingPointType aBounds[6];
aData.myPrs[0]->GetBounds(aBounds);
vtkFloatingPointType aDist = 0;
if (mySaveChk->isChecked())
aPrs->SetOffset(aOffs.myOffset[0],aOffs.myOffset[1],aOffs.myOffset[2]);
}
+ QMap<VISU::PointMap3d_i*, int>::Iterator itt;
+ for (itt = myPointMapPrsMap.begin(); itt != myPointMapPrsMap.end(); ++itt) {
+ VISU::PointMap3d_i* aPrs = itt.key();
+ Offset& aOffs = myOffsets[itt.value()];
+ if (VISU_ActorBase* anActor = VISU::FindActorBase(myViewWindow, aPrs))
+ anActor->SetPosition(aOffs.myOffset);
+ if (mySaveChk)
+ if (mySaveChk->isChecked())
+ aPrs->SetOffset(aOffs.myOffset[0],aOffs.myOffset[1],aOffs.myOffset[2]);
+ }
} else {
vtkFloatingPointType aDist = 0;
vtkFloatingPointType aShift = 0;
vtkFloatingPointType aPrevDist = 0;
vtkFloatingPointType aPrevShift = 0;
- int i;
+ int i = 0;
QMap<VISU::Prs3d_i*, int>::Iterator it;
- for (it = myPrsMap.begin(), i = 0; it != myPrsMap.end(); ++it, i++) {
+ for (it = myPrsMap.begin(); it != myPrsMap.end(); ++it, i++) {
VISU::Prs3d_i* aPrs = it.key();
if (VISU_Actor* aActor = VISU::FindActor(myViewWindow, aPrs)) {
int aAxis = getAxis();
aPrevDist = aDist;
aPrevShift = aShift;
}
- }
+ } // end of myPrsMap loop
+ // Loop in PointMap3D the same as previous loop
+ QMap<VISU::PointMap3d_i*, int>::Iterator itt;
+ for (itt = myPointMapPrsMap.begin(); itt != myPointMapPrsMap.end(); ++itt, i++) {
+ VISU::PointMap3d_i* aPrs = itt.key();
+ if (VISU_ActorBase* aActor = VISU::FindActorBase(myViewWindow, aPrs)) {
+ int aAxis = getAxis();
+
+ vtkFloatingPointType aZeroOffset[3];
+ aZeroOffset[0] = aZeroOffset[1] = aZeroOffset[2] = 0;
+ aActor->SetPosition(aZeroOffset);
+ aActor->GetMapper()->Update();
+
+ vtkFloatingPointType aBounds[6];
+ aActor->GetBounds(aBounds);
+ switch (aAxis) {
+ case XAxis:
+ aDist = fabs(aBounds[1] - aBounds[0]);
+ break;
+ case YAxis:
+ aDist = fabs(aBounds[3] - aBounds[2]);
+ break;
+ case ZAxis:
+ aDist = fabs(aBounds[5] - aBounds[4]);
+ }
+ vtkFloatingPointType aOffset[3];
+ aOffset[0] = aOffset[1] = aOffset[2] = 0;
+ aOffset[aAxis] =
+ (aBounds[2*aAxis+1] < aBounds[2*aAxis]) ? -aBounds[2*aAxis+1] : -aBounds[2*aAxis];
+
+ if (i > 0) {
+ vtkFloatingPointType aCCDist = (aDist + aPrevDist) / 2.0;
+
+ vtkFloatingPointType dx = fabs(aBounds[1] - aBounds[0]);
+ vtkFloatingPointType dy = fabs(aBounds[3] - aBounds[2]);
+ vtkFloatingPointType dz = fabs(aBounds[5] - aBounds[4]);
+ vtkFloatingPointType max = (dx > dy) ? dx : dy;
+ max = (dz > max) ? dz : max;
+ max /= 100.0;
+
+ if (aCCDist < max) {
+ // set base distance between centers of bounding boxes
+ // to minimal (but big enough) size of current bounding box
+ if (dx < max) dx = FLT_MAX;
+ if (dy < max) dy = FLT_MAX;
+ if (dz < max) dz = FLT_MAX;
+
+ aCCDist = (dx < dy) ? dx : dy;
+ aCCDist = (dz < aCCDist) ? dz : aCCDist;
+ }
+ aShift = aPrevShift + aPrevDist/2.0 + aCCDist*getDistance() - aDist/2.0;
+ }
+
+ aOffset[aAxis] += aShift;
+ aActor->SetPosition(aOffset);
+ if (mySaveChk)
+ if (mySaveChk->isChecked())
+ aPrs->SetOffset(aOffset[0],aOffset[1],aOffset[2]);
+
+ aPrevDist = aDist;
+ aPrevShift = aShift;
+ }
+ } // end of myPointMapPrsMap loop
}
myViewWindow->getRenderer()->ResetCameraClippingRange();
myViewWindow->Repaint();
FieldData& aData = myAnimator->getFieldData( 0 );
_PTR(SObject) aField = aData.myField;
+ if(!aField) return;
+
_PTR(ChildIterator) anIter = aStudy->NewChildIterator(aField);
anIter->Next(); // First is reference on support
for(int index = 1; anIter->More(); anIter->Next(), index++)
TVECTORS_ITEM = 6, // VISU::TVECTORS
TSTREAMLINES_ITEM = 7, // VISU::TSTREAMLINES
TGAUSSPOINTS_ITEM = 8, // VISU::TGAUSSPOINTS
- TSCALARMAPONDEFORMEDSHAPE_ITEM = 9 // VISU::TSCALARMAPONDEFORMEDSHAPE
+ TDEFORMEDSHAPEANDSCALARMAP_ITEM = 9 // VISU::TDEFORMEDSHAPEANDSCALARMAP
};
//------------------------------------------------------------------------
myTypeId2ComboId[TSTREAMLINES_ITEM] = myComboId2TypeId.size();
myComboId2TypeId.push_back(TSTREAMLINES_ITEM);;
- myTypeCombo->addItem("Scalar map on Deformed shape"); // item 9
- myTypeId2ComboId[TSCALARMAPONDEFORMEDSHAPE_ITEM] = myComboId2TypeId.size();
- myComboId2TypeId.push_back(TSCALARMAPONDEFORMEDSHAPE_ITEM);;
+ myTypeCombo->addItem("Deformed shape and Scalar map"); // item 9
+ myTypeId2ComboId[TDEFORMEDSHAPEANDSCALARMAP_ITEM] = myComboId2TypeId.size();
+ myComboId2TypeId.push_back(TDEFORMEDSHAPEANDSCALARMAP_ITEM);;
}
if(anEnableGP){
myTypeCombo->setCurrentIndex(myTypeId2ComboId[TDEFORMEDSHAPE_ITEM]);
break;
case VISU::TSCALARMAPONDEFORMEDSHAPE: //Scalar Map on Deformed Shape
- myTypeCombo->setCurrentIndex(myTypeId2ComboId[TSCALARMAPONDEFORMEDSHAPE_ITEM]);
+ case VISU::TDEFORMEDSHAPEANDSCALARMAP:
+ myTypeCombo->setCurrentIndex(myTypeId2ComboId[TDEFORMEDSHAPEANDSCALARMAP_ITEM]);
break;
case VISU::TVECTORS: //Vectors
myTypeCombo->setCurrentIndex(myTypeId2ComboId[TVECTORS_ITEM]);
case TDEFORMEDSHAPE_ITEM: //Deformed Shape
aData.myPrsType = VISU::TDEFORMEDSHAPE;
break;
- case TSCALARMAPONDEFORMEDSHAPE_ITEM: //Scalar Map on Deformed Shape
- aData.myPrsType = VISU::TSCALARMAPONDEFORMEDSHAPE;
+ case TDEFORMEDSHAPEANDSCALARMAP_ITEM: //Scalar Map on Deformed Shape
+ aData.myPrsType = VISU::TDEFORMEDSHAPEANDSCALARMAP;
break;
case TVECTORS_ITEM: //Vectors
aData.myPrsType = VISU::TVECTORS;
}
}
- if(!aData.myNbFrames || !aData.myPrs[0]){
+ if(!aData.myNbFrames || aData.myPrs.empty() || !aData.myPrs[0]){
QApplication::restoreOverrideCursor();
SUIT_MessageBox::warning(this,
tr("ERROR"),
c.suspend();
EditPrs<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg>(myModule,aData,myAnimator);
break;
- case TSCALARMAPONDEFORMEDSHAPE_ITEM: //Scalar Map on Deformed Shape
+ case TDEFORMEDSHAPEANDSCALARMAP_ITEM: //Scalar Map on Deformed Shape
c.suspend();
{
- typedef VisuGUI_ScalarMapOnDeformedShapeDlg DLG;
- typedef VISU::ScalarMapOnDeformedShape_i TYPE;
+ typedef VisuGUI_DeformedShapeAndScalarMapDlg DLG;
+ typedef VISU::DeformedShapeAndScalarMap_i TYPE;
DLG* aDlg = new DLG (myModule);
TYPE* aPrs3d = dynamic_cast<TYPE*>(aData.myPrs[0]);
aDlg->initFromPrsObject(aPrs3d, true);
- if (aDlg->exec() && aDlg->storeToPrsObject(aData.myPrs[0])) {
- for (int i = 1; i < aData.myNbFrames; i++){
- aData.myPrs[i]->SameAs(aData.myPrs[0]);
- }
+ if (aDlg->exec() && aDlg->storeToPrsObject(aData.myPrs[0])) {
+ for (long aFrameId = 1; aFrameId < aData.myNbFrames; aFrameId++){
+ TYPE* aDeformedPrs3d = dynamic_cast<TYPE*>(aData.myPrs[aFrameId]);
+ //Set correct time stamp number
+ int aTimeStampNum = aDeformedPrs3d->GetScalarTimeStampNumber();
+ aDeformedPrs3d->SameAs(aPrs3d);
+ aDeformedPrs3d->SetScalarField(aDeformedPrs3d->GetScalarEntity(),
+ aDeformedPrs3d->GetScalarFieldName(),
+ aTimeStampNum);
+
+ }
+
+ if ( myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) {
+ for (int aFieldId = 1; aFieldId < myAnimator->getNbFields(); aFieldId++) {
+ FieldData& aFieldData = myAnimator->getFieldData(aFieldId);
+ for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) {
+ TYPE* aDeformedPrs3d = dynamic_cast<TYPE*>(aFieldData.myPrs[aFrameId]);
+ std::string aTitle = aDeformedPrs3d->GetCTitle();
+ //Set correct time stamp number
+ int aTimeStampNum = aDeformedPrs3d->GetScalarTimeStampNumber();
+ aDeformedPrs3d->SameAs(aPrs3d);
+ aDeformedPrs3d->SetTitle(aTitle.c_str());
+ aDeformedPrs3d->SetScalarField(aDeformedPrs3d->GetScalarEntity(),
+ aDeformedPrs3d->GetScalarFieldName(),
+ aTimeStampNum);
+
+ }
+ }
+ }
}
delete aDlg;
}
FieldData& aFieldData = myAnimator->getFieldData(i);
if( aFieldData.myPrs.empty() )
{
- myAnimator->generatePresentations(i);
+ //myAnimator->generatePresentations(i);
+ GeneratePresentations(i,myAnimator);
continue;
}
// when a range or a sequence of the animation has been changed
if( isRegenerate )
{
+ GeneratePresentations(i,myAnimator);
+ /*
VISU::ColoredPrs3d_i* aPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aFieldData.myPrs[0]);
if( !aPrs3d )
continue;
aColoredPrs3d->SetTitle(aTitle.c_str());
}
}
+ */
}
}
if( isRegenerate )
namespace VISU
{
class Prs3d_i;
+ class PointMap3d_i;
}
class SVTK_ViewWindow;
int myCurrent;
QMap<VISU::Prs3d_i*, int> myPrsMap;
+ QMap<VISU::PointMap3d_i*, int> myPointMapPrsMap;
};
theSelectionMgr->setSelectedObjects(aNewListIO);
}
+ /*!
+ * \brief Check, if the object can be deleted
+ *
+ * \param theEntry - entry of the object to check
+ * \param theModule - is used to access Study and VISU_Gen
+ * \retval bool - returns TRUE if the object is removable
+ */
+ bool
+ IsRemovable (const std::string theEntry,
+ const SalomeApp_Module* theModule)
+ {
+ // asv : if selected object is a Save Point object selected in object browser - return false
+ if ( QString( theEntry.c_str() ).startsWith( QObject::tr( "SAVE_POINT_DEF_NAME" ) ) )
+ return false;
+
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule));
+
+ _PTR(SObject) aSObject = aStudy->FindObjectID(theEntry);
+ VISU::Storable::TRestoringMap pMap;
+ if (aSObject) {
+ CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
+ if (!CORBA::is_nil(aCORBAObject)) {
+ VISU::RemovableObject_var aRemovableObj = VISU::RemovableObject::_narrow(aCORBAObject);
+ if (CORBA::is_nil(aRemovableObj)) {
+ // Not removable CORBA object
+ return false;
+ }
+ } else {
+ // Can be removed, if lays directly under VISU
+ // (first sub-level) or is a child of such an object
+ string aNAME, aVisuNAME = GetVisuGen(theModule)->ComponentDataType();
+ _PTR(GenericAttribute) anAttr;
+ _PTR(AttributeString) aComment;
+
+ bool isUnderVISU = false;
+ _PTR(SObject) aFatherSObject = aSObject->GetFather();
+ if (aFatherSObject->FindAttribute(anAttr, "AttributeName")) {
+ // mkr : 24.11.2006 : use AttributeName and module title for correct "Delete"
+ // popup item displaying in object browser popup
+ _PTR(AttributeName) aComment (anAttr);
+ aNAME = aComment->Value();
+ QString aVisuTITLE = theModule->getApp()->moduleTitle(aVisuNAME.c_str());
+ if (!aVisuTITLE.compare(aNAME.c_str())) {
+ isUnderVISU = true;
+ }
+ }
+ if (!isUnderVISU) {
+ // Not directly under VISU component, check father
+ aCORBAObject = VISU::ClientSObjectToObject(aFatherSObject);
+ if (!CORBA::is_nil(aCORBAObject)) {
+ // Father has IOR
+ return false;
+ }
+
+ isUnderVISU = false;
+ aFatherSObject = aFatherSObject->GetFather();
+ if (aFatherSObject->FindAttribute(anAttr, "AttributeString")) {
+ _PTR(AttributeString) aComment (anAttr);
+ aNAME = aComment->Value();
+ if (aNAME == aVisuNAME) {
+ isUnderVISU = true;
+ }
+ }
+ if (!isUnderVISU) {
+ // Father is not directly under VISU component
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
/*!
* \brief Check, if "Delete" popup-menu can be put on current selection
*
for (; anIter.More(); anIter.Next()) {
Handle(SALOME_InteractiveObject) anIO = anIter.Value();
if (anIO->hasEntry()) {
-
- // asv : if selected object is a Save Point object selected in object browser - return false
- if ( QString( anIO->getEntry() ).startsWith( QObject::tr( "SAVE_POINT_DEF_NAME" ) ) )
- return false;
-
- _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
- VISU::Storable::TRestoringMap pMap;
- if (aSObject) {
- CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
- if (!CORBA::is_nil(aCORBAObject)) {
- VISU::RemovableObject_var aRemovableObj = VISU::RemovableObject::_narrow(aCORBAObject);
- if (CORBA::is_nil(aRemovableObj)) {
- // Not removable CORBA object
- return false;
- }
- } else {
- // Can be removed, if lays directly under VISU
- // (first sub-level) or is a child of such an object
- string aNAME, aVisuNAME = GetVisuGen(theModule)->ComponentDataType();
- _PTR(GenericAttribute) anAttr;
- _PTR(AttributeString) aComment;
-
- bool isUnderVISU = false;
- _PTR(SObject) aFatherSObject = aSObject->GetFather();
- if (aFatherSObject->FindAttribute(anAttr, "AttributeName")) {
- // mkr : 24.11.2006 : use AttributeName and module title for correct "Delete"
- // popup item displaying in object browser popup
- _PTR(AttributeName) aComment (anAttr);
- aNAME = aComment->Value().c_str();
- QString aVisuTITLE = theModule->getApp()->moduleTitle(QString(aVisuNAME.c_str()));
- if (!aVisuTITLE.compare(QString(aNAME.c_str()))) {
- isUnderVISU = true;
- }
- }
- if (!isUnderVISU) {
- // Not directly under VISU component, check father
- aCORBAObject = VISU::ClientSObjectToObject(aFatherSObject);
- if (!CORBA::is_nil(aCORBAObject)) {
- // Father has IOR
- return false;
- }
-
- isUnderVISU = false;
- aFatherSObject = aFatherSObject->GetFather();
- if (aFatherSObject->FindAttribute(anAttr, "AttributeString")) {
- _PTR(AttributeString) aComment (anAttr);
- aNAME = aComment->Value();
- if (aNAME == aVisuNAME) {
- isUnderVISU = true;
- }
- }
- if (!isUnderVISU) {
- // Father is not directly under VISU component
- return false;
- }
- }
- }
- }
+ if (!IsRemovable(anIO->getEntry(), theModule))
+ return false;
}
}
return true;
if(aSelectionInfo.empty())
return;
+ VISU::Prs3d_i* aPrs3d;
+ VISU::PointMap3d_i* aTable;
+ VISU_Actor* anActor;
+ VISU_ActorBase* anActorBase;
+
TSelectionItem aSelectionItem = aSelectionInfo.front();
- VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
- if(!aPrs3d)
- return;
+ aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
+ if(!aPrs3d) {
+ aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
+ if(!aTable)
+ return;
+ }
SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
if(!aViewWindow)
return;
- VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
- if(!anActor)
- return;
+ if (aPrs3d) {
+ anActor = FindActor(aViewWindow, aPrs3d);
+ if(!anActor)
+ return;
+ } else {
+ anActorBase = VISU::FindActorBase(aViewWindow, aTable);
+ if(!anActorBase)
+ return;
+ }
switch (theType) {
case VISU::SHRINK:
+ if (aPrs3d) {
if (anActor->IsShrunk())
anActor->UnShrink();
else
anActor->SetShrink();
+ } else if (aTable) {
+ if (anActorBase->IsShrunk())
+ anActorBase->UnShrink();
+ else
+ anActorBase->SetShrink();
+ }
break;
default:
- if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
- aMesh->SetPresentationType(theType);
- RecreateActor(theModule, aMesh);
- } else {
- anActor->SetRepresentation(theType);
+ if (aPrs3d) {
+ if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
+ aMesh->SetPresentationType(theType);
+ RecreateActor(theModule, aMesh);
+ } else {
+ anActor->SetRepresentation(theType);
+ }
+ }
+ else if (aTable) {
+ anActorBase->SetRepresentation(theType);
}
}
aViewWindow->Repaint();
return FindActor(theViewWindow, aPrs3d);
}
+ //------------------------------------------------------------
+ VISU_ActorBase*
+ FindActorBase(const SalomeApp_Study* theStudy,
+ SVTK_ViewWindow* theViewWindow,
+ const QString& theEntry)
+ {
+ TObjectInfo anObjectInfo = GetObjectByEntry(theStudy, theEntry.toLatin1().constData());
+ VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(anObjectInfo.myBase);
+ return FindActorBase(theViewWindow, aTable);
+ }
+
//------------------------------------------------------------
void
RecreateActor (const SalomeApp_Module* theModule,
aPlot->getCurves( clist );
SPlot2d_Curve* plotCurve = 0;
SPlot2d_Curve* tmpCurve;
- for (int i = 0; i < clist.count(); i++) {
- tmpCurve = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
- if (tmpCurve && tmpCurve->hasIO() &&
- theCurve->GetEntry() != tmpCurve->getIO()->getEntry()) {
- plotCurve = tmpCurve;
- } else if (theDisplaying == VISU::eDisplayOnly) {
- aPlot->eraseCurve(clist.at(i));
+ if(theDisplaying == VISU::eErase) {
+ // 23.06.2008 skl for IPAL17672
+ for (int i = 0; i < clist.count(); i++) {
+ tmpCurve = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
+ if (tmpCurve && tmpCurve->hasIO() &&
+ theCurve->GetEntry() == tmpCurve->getIO()->getEntry()) {
+ plotCurve = tmpCurve;
+ aPlot->eraseCurve(clist.at(i));
+ break;
+ }
}
+ UpdateCurve(theCurve, aPlot, plotCurve, theDisplaying);
+ }
+ else {
+ for (int i = 0; i < clist.count(); i++) {
+ tmpCurve = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
+ if (tmpCurve && tmpCurve->hasIO() &&
+ theCurve->GetEntry() != tmpCurve->getIO()->getEntry()) {
+ plotCurve = tmpCurve;
+ }
+ else if (theDisplaying == VISU::eDisplayOnly) {
+ aPlot->eraseCurve(clist.at(i));
+ }
+ }
+ UpdateCurve(theCurve, aPlot, plotCurve, theDisplaying);
}
-
- UpdateCurve(theCurve, aPlot, plotCurve, theDisplaying);
aPlot->Repaint();
}
}
}
aPlot->Repaint();
- aPlot->fitAll();
+ if(GetResourceMgr()->booleanValue("VISU","automatic_fit_all",false)){
+ aPlot->fitAll();
+ }
qApp->processEvents();
}
if(av)(const_cast<VisuGUI*>(av))->OnEraseAll();
}
PublishMeshInView(theModule, pPresent, theViewWindow);
- SetFitAll(theViewWindow);
+ if(GetResourceMgr()->booleanValue("VISU","automatic_fit_all",false)){
+ SetFitAll(theViewWindow);
+ }
#ifdef CHECKTIME
timer.Stop();
MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
case VISU::TSTREAMLINES:
case VISU::TPLOT3D:
case VISU::TSCALARMAPONDEFORMEDSHAPE:
+ case VISU::TDEFORMEDSHAPEANDSCALARMAP:
{
PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
if (aServant.in()) {
void Remove(LightApp_SelectionMgr* theSelectionMgr,
const Handle(SALOME_InteractiveObject)& theIO);
+ bool IsRemovable (const std::string theEntry,
+ const SalomeApp_Module* theModule);
bool IsRemovableSelected(const SalomeApp_Module* theModule);
void DeleteSObject(VisuGUI* theModule,
VISU_Actor* FindActor(const SalomeApp_Study* theStudy,
SVTK_ViewWindow* theViewWindow,
const QString& theEntry);
+ VISU_ActorBase* FindActorBase(const SalomeApp_Study* theStudy,
+ SVTK_ViewWindow* theViewWindow,
+ const QString& theEntry);
void RecreateActor(const SalomeApp_Module* theModule,
VISU::Prs3d_i* thePrs);
VISU_Actor* anActor = VISU::FindActor(VISU::GetAppStudy(myModule), myViewWindow, anIO->getEntry());
if (anActor)
anActor->SetOpacity(opacity);
+ else {
+ VISU_ActorBase* anActor = VISU::FindActorBase(VISU::GetAppStudy(myModule), myViewWindow, anIO->getEntry());
+ if (anActor)
+ anActor->SetOpacity(opacity);
+ }
}
myViewWindow->Repaint();
}
ScaleLabel = new QLabel (tr("LBL_SCALE_FACTOR"), TopGroup );
ScalFact = new QtxDoubleSpinBox( 1e-20, 1.0E+38, 0.1, TopGroup );
- ScalFact->setDecimals( 5 );
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 );
+
+ ScalFact->setDecimals( aPrecision*(-1) ); // ScalFact->setDecimals( 5 );
ScalFact->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
ScalFact->setValue( 0.1 );
/*!
Sets Scale factor
*/
-void VisuGUI_VectorsDlg::setScaleFactor( double sf )
+void VisuGUI_VectorsDlg::setScaleFactor( double theFactor )
{
- ScalFact->setValue( sf );
+ double i=0.1;
+ while (1) { // Calculate Step & Precission
+ if ( int (theFactor/i) > 0)
+ break;
+ else {
+ i = i*0.1;
+ }
+ }
+
+ ScalFact->setSingleStep(i);
+
+ ScalFact->setValue( theFactor );
}
/*!
VISU_ViewManager_i.hh \
VISU_View_i.hh \
VISU_TimeAnimation.h \
- VISU_ScalarMapOnDeformedShape_i.hh \
+ VISU_DeformedShapeAndScalarMap_i.hh \
VISU_ColoredPrs3dFactory.hh \
+ VISU_MonoColorPrs_i.hh \
+ VISU_Deformation_i.hh \
+ VISU_OptionalDeformation_i.hh \
SALOME_GenericObjPointer.hh
+
libVISUEngineImpl_la_SOURCES = \
VISUConfig.cc \
VISU_Result_i.cc \
VISU_CutLines_i.cc \
VISU_Vectors_i.cc \
VISU_StreamLines_i.cc \
- VISU_ScalarMapOnDeformedShape_i.cc \
+ VISU_DeformedShapeAndScalarMap_i.cc \
VISU_ColoredPrs3dCache_i.cc \
VISU_ColoredPrs3dHolder_i.cc \
VISU_ColoredPrs3dFactory.cc \
VISU_Table_i.cc \
VISU_PointMap3d_i.cc \
VISU_DumpPython.cc \
+ VISU_MonoColorPrs_i.cc \
+ VISU_Deformation_i.cc \
+ VISU_OptionalDeformation_i.cc \
SALOME_GenericObjPointer.cc
MOC_FILES = VISU_TimeAnimation_moc.cxx
return VISU::TISOSURFACES;
if ( theComment == "DEFORMEDSHAPE" )
return VISU::TDEFORMEDSHAPE;
- if ( theComment == "SCALARMAPONDEFORMEDSHAPE" )
- return VISU::TSCALARMAPONDEFORMEDSHAPE;
+ if ( theComment == "DEFORMEDSHAPEANDSCALARMAP" )
+ return VISU::TDEFORMEDSHAPEANDSCALARMAP;
if ( theComment == "GAUSSPOINTS" )
return VISU::TGAUSSPOINTS;
if ( theComment == "PLOT3D" )
#include <QtGlobal>
+#include "utilities.h"
+
#ifdef _DEBUG_
static int MYDEBUG = 0;
#else
::CreateHolder(VISU::VISUType theType,
const VISU::ColoredPrs3dHolder::BasicInput& theInput)
{
- if(MYDEBUG) cout << "CreateHolder " << theType << endl;
+ if(MYDEBUG) MESSAGE ("CreateHolder "<<theType);
CORBA::Float aRequiredMemory = 0.0;
if(IsPossible(theType, theInput, aRequiredMemory, "")){
if(VISU::ColoredPrs3d_i* aColoredPrs3d = CreateColoredPrs3d(theType, theInput)){
::RegisterInHolder(VISU::ColoredPrs3d_i* thePrs3d,
const std::string& theHolderEntry)
{
- if(MYDEBUG) cout << "RegisterInHolder " << theHolderEntry.c_str() << " " << thePrs3d << endl;
+ if(MYDEBUG) MESSAGE("RegisterInHolder "<<theHolderEntry.c_str()<<" "<<thePrs3d);
if(thePrs3d){
TPrs3dPtr aPrs3d(thePrs3d);
myHolderMap[theHolderEntry].push_front(aPrs3d);
::GetLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder)
{
const TLastVisitedPrsList& aList = GetLastVisitedPrsList(theHolder);
- if(MYDEBUG) cout << "GetLastVisitedPrs " << theHolder->GetEntry().c_str() << " " << aList.size() << endl;
+ if(MYDEBUG) MESSAGE("GetLastVisitedPrs " << theHolder->GetEntry().c_str() << " " << aList.size() );
if( !aList.empty() )
return aList.front();
return VISU::TPrs3dPtr();
const VISU::ColoredPrs3dHolder::BasicInput& theInput,
VISU::View3D_ptr theView3D)
{
- if(MYDEBUG) cout << "VISU::ColoredPrs3dCache_i::UpdateLastVisitedPrs" << endl;
+ if(MYDEBUG) MESSAGE( "VISU::ColoredPrs3dCache_i::UpdateLastVisitedPrs" );
TPrs3dPtr aPrs3d;
try{
TPrs3dPtr aLastVisitedPrs3d = GetLastVisitedPrs(theHolder);
CORBA::Float aRequiredMemory = 0.0;
if(aPrs3d = FindPrsByInput(aLastVisitedPrsList, theInput)){
aLastVisitedPrsList.push_front(aPrs3d);
- if(MYDEBUG) cout << "FindPrsByInput " << aPrs3d << endl;
+ if(MYDEBUG) MESSAGE( "FindPrsByInput " << aPrs3d );
}else if(anIsCheckPossible && IsPossible(aPrsType, theInput, aRequiredMemory, aHolderEntry)){
if( aRequiredMemory > 1.0 / VTK_LARGE_FLOAT )
ClearMemory(aRequiredMemory, aHolderEntry);
aPrs3d = CreatePrs(aPrsType, theInput, theHolder);
- if(MYDEBUG) cout << "Created " << aPrs3d << endl;
+ if(MYDEBUG) MESSAGE( "Created " << aPrs3d );
}else{
aPrs3d = aLastVisitedPrsList.back();
aPrs3d->SetResultObject(theInput.myResult);
aPrs3d->SetTimeStampNumber(theInput.myTimeStampNumber);
aLastVisitedPrsList.pop_back();
aLastVisitedPrsList.push_front(aPrs3d);
- if(MYDEBUG) cout << "Move only " << aPrs3d << endl;
+ if(MYDEBUG) MESSAGE( "Move only " << aPrs3d );
}
//if(MYDEBUG) PrintCache();
aPrs3d->SameAs(thePrs);
- aPrs3d->UpdateActors();
+
+ // special case for deformed shape
+ VISU::DeformedShapeAndScalarMap_i* dShape =
+ dynamic_cast<VISU::DeformedShapeAndScalarMap_i*>( aPrs3d.get() );
+ if ( dShape && dShape->GetScalarTimeStampNumber() != theInput.myTimeStampNumber )
+ {
+ dShape->SetScalarField( dShape->GetScalarEntity(),
+ dShape->GetScalarFieldName(), theInput.myTimeStampNumber );
+ }
+
if(CORBA::is_nil(theView3D))
return false;
aPrs3d->SetActiveState(true);
}
+
+ aPrs3d->UpdateActors();
ProcessVoidEvent(new TRenderEvent(aViewWindow));
//aViewWindow->getRenderWindow()->Render();
return true;
{
if(MYDEBUG)
{
- cout << "--------------CACHE-----------------" << endl;
- cout << "Cache memory - " << GetMemorySize() << " Mb" << endl;
+ MESSAGE_BEGIN(std::endl << "--------------CACHE-----------------" );
+ MESSAGE_ADD(std::endl << "Cache memory - " << GetMemorySize() << " Mb" );
TColoredPrs3dHolderMap::const_iterator aHolderIter = myHolderMap.begin();
TColoredPrs3dHolderMap::const_iterator aHolderIterEnd = myHolderMap.end();
for(; aHolderIter != aHolderIterEnd; aHolderIter++){
TLastVisitedPrsList::const_iterator aPrsIter = aPrsList.begin();
TLastVisitedPrsList::const_iterator aPrsIterEnd = aPrsList.end();
- cout << "--------------------------" << endl;
- cout << "Holder - " << aHolderIter->first.c_str() << endl;
- cout << "Size - " << aPrsList.size() << endl;
+ MESSAGE_ADD(std::endl << "--------------------------" );
+ MESSAGE_ADD(std::endl << "Holder - " << aHolderIter->first.c_str() );
+ MESSAGE_ADD(std::endl << "Size - " << aPrsList.size() );
for(; aPrsIter != aPrsIterEnd; aPrsIter++)
if(TPrs3dPtr aPrs3d = *aPrsIter)
{
- cout << aPrs3d << " (" << aPrs3d->GetMemorySize() << " Mb)";
+ MESSAGE_ADD(std::endl << aPrs3d << " (" << aPrs3d->GetMemorySize() << " Mb)");
if(aPrsIter == aPrsList.begin())
- cout << " (device)";
- cout << endl;
+ MESSAGE_ADD( " (device)" );
}
}
- cout << "------------------------------------" << endl;
+ MESSAGE_END(std::endl << "------------------------------------" );
}
}
case TDEFORMEDSHAPE:
return VISU::CreatePrs3dByEnum<TDEFORMEDSHAPE>(theStudy, thePublishInStudyMode);
case TSCALARMAPONDEFORMEDSHAPE:
- return VISU::CreatePrs3dByEnum<TSCALARMAPONDEFORMEDSHAPE>(theStudy, thePublishInStudyMode);
+ case TDEFORMEDSHAPEANDSCALARMAP:
+ return VISU::CreatePrs3dByEnum<TDEFORMEDSHAPEANDSCALARMAP>(theStudy, thePublishInStudyMode);
case TISOSURFACES:
return VISU::CreatePrs3dByEnum<TISOSURFACES>(theStudy, thePublishInStudyMode);
case TSTREAMLINES:
aMemory = CheckIsPossible<TDEFORMEDSHAPE>(theInput, theMemoryCheck);
break;
case TSCALARMAPONDEFORMEDSHAPE:
- aMemory = CheckIsPossible<TSCALARMAPONDEFORMEDSHAPE>(theInput, theMemoryCheck);
+ case TDEFORMEDSHAPEANDSCALARMAP:
+ aMemory = CheckIsPossible<TDEFORMEDSHAPEANDSCALARMAP>(theInput, theMemoryCheck);
break;
case TISOSURFACES:
aMemory = CheckIsPossible<TISOSURFACES>(theInput, theMemoryCheck);
#include "VISU_I.hxx"
#include "SALOME_GenericObjPointer.hh"
-#include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VISU_DeformedShapeAndScalarMap_i.hh"
#include "VISU_Plot3D_i.hh"
#include "VISU_GaussPoints_i.hh"
#include "VISU_StreamLines_i.hh"
namespace TL
{
//----------------------------------------------------------------------------
- typedef TList<ScalarMapOnDeformedShape_i,
+ typedef TList<DeformedShapeAndScalarMap_i,
+ TList<DeformedShapeAndScalarMap_i,
TList<DeformedShape_i,
TList<StreamLines_i,
TList<GaussPoints_i,
TList<CutLines_i,
TList<Vectors_i,
TList<Plot3D_i,
- TNullType> > > > > > > > > >
+ TNullType> > > > > > > > > > >
TColoredPrs3dTypeList;
typedef TList<TInt2Type<TSCALARMAPONDEFORMEDSHAPE>,
+ TList<TInt2Type<TDEFORMEDSHAPEANDSCALARMAP>,
TList<TInt2Type<TDEFORMEDSHAPE>,
TList<TInt2Type<TSTREAMLINES>,
TList<TInt2Type<TGAUSSPOINTS>,
TList<TInt2Type<TCUTLINES>,
TList<TInt2Type<TVECTORS>,
TList<TInt2Type<TPLOT3D>,
- TNullType> > > > > > > > > >
+ TNullType> > > > > > > > > > >
TColoredPrs3dEnumList;
ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode) :
myPublishInStudyMode(thePublishInStudyMode),
myIsTimeStampFixed(thePublishInStudyMode == EPublishUnderTimeStamp),
+ myEntity( VISU::Entity( -1 ) ),
+ myPreviousEntity( VISU::Entity( -1 ) ),
+ myTimeStampNumber( -1 ),
+ myPreviousTimeStampNumber( -1 ),
+ myIsUnits( true ),
+ myOrientation( VISU::ColoredPrs3dBase::HORIZONTAL ),
myColoredPL(NULL),
myIsFixedRange(false),
myIsRestored(true)
VISU::ColoredPrs3d_i
::SetEntity(VISU::Entity theEntity)
{
- if(myEntity == theEntity)
+ if ( myEntity == theEntity )
return;
VISU::TSetModified aModified(this);
VISU::ColoredPrs3d_i
::SetTimeStampNumber(CORBA::Long theTimeStampNumber)
{
- if(myTimeStampNumber == theTimeStampNumber)
+ if ( myTimeStampNumber == theTimeStampNumber )
return;
VISU::TSetModified aModified(this);
SetShadowTitle(anOrigin->IsShadowTitle());
SetTitFontType(anOrigin->GetTitFontType());
vtkFloatingPointType r,g,b;
- anOrigin->GetTitleColor(&r,&g,&b);
+ anOrigin->GetTitleColor(r,g,b);
SetTitleColor(r,g,b);
SetBoldLabel(anOrigin->IsBoldLabel());
SetItalicLabel(anOrigin->IsItalicLabel());
SetShadowLabel(anOrigin->IsShadowLabel());
SetLblFontType(anOrigin->GetLblFontType());
- anOrigin->GetLabelColor(&r,&g,&b);
+ anOrigin->GetLabelColor(r,g,b);
SetLabelColor(r,g,b);
myIsTimeStampFixed = anOrigin->IsTimeStampFixed();
VISU::ColoredPrs3d_i
::SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theOrientation)
{
- if(myOrientation == theOrientation)
+ if ( myOrientation == theOrientation )
return;
VISU::TSetModified aModified(this);
//----------------------------------------------------------------------------
void
VISU::ColoredPrs3d_i
-::SetUnitsVisible(CORBA::Boolean isVisible)
+::SetUnitsVisible(CORBA::Boolean theIsVisible)
{
- if( myIsUnits != isVisible ){
- VISU::TSetModified aModified(this);
- myIsUnits = isVisible;
- myParamsTime.Modified();
- }
+ if ( myIsUnits == theIsVisible )
+ return;
+
+ VISU::TSetModified aModified( this );
+
+ myIsUnits = theIsVisible;
+ myParamsTime.Modified();
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void
VISU::ColoredPrs3d_i
-::GetTitleColor(vtkFloatingPointType* theR,
- vtkFloatingPointType* theG,
- vtkFloatingPointType* theB)
+::GetTitleColor(vtkFloatingPointType& theR,
+ vtkFloatingPointType& theG,
+ vtkFloatingPointType& theB)
{
- *theR = myTitleColor[0];
- *theG = myTitleColor[1];
- *theB = myTitleColor[2];
+ theR = myTitleColor[0];
+ theG = myTitleColor[1];
+ theB = myTitleColor[2];
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void
VISU::ColoredPrs3d_i
-::GetLabelColor(vtkFloatingPointType* theR,
- vtkFloatingPointType* theG,
- vtkFloatingPointType* theB)
+::GetLabelColor(vtkFloatingPointType& theR,
+ vtkFloatingPointType& theG,
+ vtkFloatingPointType& theB)
{
- *theR = myLabelColor[0];
- *theG = myLabelColor[1];
- *theB = myLabelColor[2];
+ theR = myLabelColor[0];
+ theG = myLabelColor[1];
+ theB = myLabelColor[2];
}
//----------------------------------------------------------------------------
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;
+ SetTitleColor(aTextColor.red()/255., aTextColor.green()/255., aTextColor.blue()/255.);
+
+ myTitleColor[0] = aTextColor.red() / 255.;
+ myTitleColor[1] = aTextColor.green() / 255.;
+ myTitleColor[2] = aTextColor.blue() / 255.;
myIsBoldLabel = myIsItalicLabel = myIsShadowLabel = true;
myLblFontType = VTK_ARIAL;
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;
+ SetLabelColor(aLabelColor.red()/255., aLabelColor.green()/255., aLabelColor.blue()/255.);
+
+ myLabelColor[0] = aLabelColor.red() / 255.;
+ myLabelColor[1] = aLabelColor.green() / 255.;
+ myLabelColor[2] = aLabelColor.blue() / 255.;
return this;
}
virtual
void
- GetTitleColor(vtkFloatingPointType* theR,
- vtkFloatingPointType* theG,
- vtkFloatingPointType* theB);
+ GetTitleColor(vtkFloatingPointType& theR,
+ vtkFloatingPointType& theG,
+ vtkFloatingPointType& theB);
virtual
void
virtual
void
- GetLabelColor(vtkFloatingPointType* theR,
- vtkFloatingPointType* theG,
- vtkFloatingPointType* theB);
+ GetLabelColor(vtkFloatingPointType& theR,
+ vtkFloatingPointType& theG,
+ vtkFloatingPointType& theB);
virtual
void
#include "ReceiverFactory.hxx"
#include "MED_SliceArray.hxx"
+#include "utilities.h"
+
#define USER_INTERLACE MED_FULL_INTERLACE
#ifdef _DEBUG_
else
aGeom2ProfileIds = aSupport->getNumberFromFile(aMGeom);
int aLen = aGeom2ProfileIds->length();
- if(MYDEBUG) MESSAGE(" - aMGeom="<<aMGeom<<"; aNbCells="<<aLen);
+ if(MYDEBUG) MESSAGE_BEGIN(" - aMGeom="<<aMGeom<<"; aNbCells="<<aLen);
for(int i = 0; i < aLen; i++){
int anId = aGeom2ProfileIds[i];
aGeom2Profile.push_back(anId);
- if(MYDEBUG) cout << "------------------------------->" << anId << endl;
+ if(MYDEBUG) MESSAGE_ADD(std::endl << "------------------------------->" << anId);
}
- if(MYDEBUG) cout << endl;
+ if(MYDEBUG) MESSAGE_END(" ");
} catch(...) {
continue;
}
CutLines_i(EPublishInStudyMode thePublishInStudyMode) :
ColoredPrs3d_i(thePublishInStudyMode),
ScalarMap_i(thePublishInStudyMode),
+ myUseAbsLength( false ),
myCutLinesPL(NULL)
{}
VISU::CutLines_i
::SetUseAbsoluteLength(CORBA::Boolean theAbsLength)
{
- if(myUseAbsLength == theAbsLength)
+ if ( myUseAbsLength == theAbsLength )
return;
VISU::TSetModified aModified(this);
// Module : VISU
#include "VISU_CutPlanesPL.hxx"
+#include "VISU_Convertor.hxx"
#include "VISU_Prs3dUtils.hh"
#include "VISU_CutPlanes_i.hh"
#endif
+
//----------------------------------------------------------------------------
size_t
VISU::CutPlanes_i
::CutPlanes_i(EPublishInStudyMode thePublishInStudyMode):
ColoredPrs3d_i(thePublishInStudyMode),
ScalarMap_i(thePublishInStudyMode),
- myCutPlanesPL(NULL)
-{}
+ myCutPlanesPL(NULL),
+ Deformation_i(this),
+ OptionalDeformation_i(this)
+{
+ if(MYDEBUG) MESSAGE("CutPlanes_i::CutPlanes_i()");
+}
//----------------------------------------------------------------------------
if(aCondList[i].toInt() == 0)
SetPlanePosition(i,aPosList[i].toDouble());
+ OptionalDeformation_i::RestoreDeformation(theSObject,theMap);
+
return this;
}
}
Storable::DataToStream( theStr, "myPlanePosition", (const char*)aStrPos.toLatin1());
Storable::DataToStream( theStr, "myPlaneCondition", (const char*)aStrCon.toLatin1());
+ OptionalDeformation_i::DeformationToStream(theStr);
}
}else
myCutPlanesPL = dynamic_cast<VISU_CutPlanesPL*>(thePipeLine);
+ InitDeformedPipeLine(myCutPlanesPL);
TSuperClass::CreatePipeLine(myCutPlanesPL);
}
return NULL;
}
+void
+VISU::CutPlanes_i::
+SameAs(const Prs3d_i* theOrigin){
+ if(MYDEBUG) MESSAGE("CutPlanes_i::SameAs()");
+ TSuperClass::SameAs(theOrigin);
+ OptionalDeformation_i::SameAsDeformation(dynamic_cast<const Deformation_i*>(theOrigin));
+}
#define VISU_CutPlanes_i_HeaderFile
#include "VISU_ScalarMap_i.hh"
+#include "VISU_OptionalDeformation_i.hh"
class VISU_CutPlanesPL;
{
//----------------------------------------------------------------------------
class VISU_I_EXPORT CutPlanes_i : public virtual POA_VISU::CutPlanes,
- public virtual ScalarMap_i
+ public virtual ScalarMap_i,
+ public virtual OptionalDeformation_i
{
static int myNbPresent;
CutPlanes_i(const CutPlanes_i&);
Restore(SALOMEDS::SObject_ptr theSObject,
const Storable::TRestoringMap& theMap);
+ virtual
+ void
+ SameAs(const Prs3d_i* theOrigin);
+
//! Redefines VISU_ColoredPrs3d_i::CreateActor
virtual
VISU_Actor*
--- /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").toLatin1().constData());
+}
+
+//---------------------------------------------------------------
+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.h"
+
+#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.toLatin1().constData(),
+ 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
::DeformedShape_i(EPublishInStudyMode thePublishInStudyMode):
ColoredPrs3d_i(thePublishInStudyMode),
ScalarMap_i(thePublishInStudyMode),
+ MonoColorPrs_i(thePublishInStudyMode),
myDeformedShapePL(NULL)
{
if(MYDEBUG) MESSAGE("DeformedShape_i::DeformedShape_i");
const std::string& theFieldName,
CORBA::Long theTimeStampNumber)
{
- myIsColored = false;
- myColor.R = myColor.G = myColor.B = 0.5;
return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
}
return NULL;
SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble());
- myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt();
- myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
- myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
- myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
return this;
}
TSuperClass::ToStream(theStr);
Storable::DataToStream( theStr, "myFactor", GetScale() );
-
- Storable::DataToStream( theStr, "myIsColored", myIsColored );
- Storable::DataToStream( theStr, "myColor.R", myColor.R );
- Storable::DataToStream( theStr, "myColor.G", myColor.G );
- Storable::DataToStream( theStr, "myColor.B", myColor.B );
}
}
-//---------------------------------------------------------------
-CORBA::Boolean
-VISU::DeformedShape_i
-::IsColored()
-{
- return myIsColored;
-}
-
-
-//---------------------------------------------------------------
-void
-VISU::DeformedShape_i
-::ShowColored(CORBA::Boolean theColored)
-{
- if(myIsColored == theColored)
- return;
-
- myIsColored = theColored;
- myParamsTime.Modified();
-}
-
-//---------------------------------------------------------------
-SALOMEDS::Color
-VISU::DeformedShape_i
-::GetColor()
-{
- return myColor;
-}
-
-
-//---------------------------------------------------------------
-void
-VISU::DeformedShape_i
-::SetColor(const SALOMEDS::Color& theColor)
-{
- bool anIsSameValue = VISU::CheckIsSameValue(myColor.R, theColor.R);
- anIsSameValue &= VISU::CheckIsSameValue(myColor.G, theColor.G);
- anIsSameValue &= VISU::CheckIsSameValue(myColor.B, theColor.B);
- if(anIsSameValue)
- return;
-
- VISU::TSetModified aModified(this);
-
- myColor = theColor;
- myParamsTime.Modified();
-}
-
-
//---------------------------------------------------------------
void
VISU::DeformedShape_i
bool toShrink = aResourceMgr->booleanValue("VISU", "deformed_shape_shrink", false);
anActor->SetRepresentation(aDispMode);
if (toShrink && !toSupressShrinking) anActor->SetShrink();
- anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
return anActor;
}
-//---------------------------------------------------------------
-VISU_Actor*
-VISU::DeformedShape_i
-::CreateActor()
-{
- return CreateActor(false);
-}
-
-
-//---------------------------------------------------------------
-void
-VISU::DeformedShape_i
-::UpdateActor(VISU_Actor* theActor)
-{
- if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
- if(IsColored()){
- anActor->SetBarVisibility(true);
- GetPipeLine()->GetMapper()->SetScalarVisibility(1);
- }else{
- anActor->SetBarVisibility(false);
- GetPipeLine()->GetMapper()->SetScalarVisibility(0);
- anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
- }
- TSuperClass::UpdateActor(theActor);
- }
-}
#define VISU_DeformedShape_i_HeaderFile
#include <VISU_I.hxx>
-#include "VISU_ScalarMap_i.hh"
+#include "VISU_MonoColorPrs_i.hh"
class VISU_DeformedShapePL;
{
//----------------------------------------------------------------------------
class VISU_I_EXPORT DeformedShape_i : public virtual POA_VISU::DeformedShape,
- public virtual ScalarMap_i
+ public virtual MonoColorPrs_i
{
static int myNbPresent;
DeformedShape_i(const DeformedShape_i&);
public:
//----------------------------------------------------------------------------
- typedef ScalarMap_i TSuperClass;
+ typedef MonoColorPrs_i TSuperClass;
typedef VISU::DeformedShape TInterface;
explicit
CORBA::Double
GetScale();
- virtual
- CORBA::Boolean
- IsColored();
-
- virtual
- void
- ShowColored(CORBA::Boolean theColored);
-
- virtual
- SALOMEDS::Color
- GetColor();
-
- virtual
- void
- SetColor(const SALOMEDS::Color& theColor);
-
VISU_DeformedShapePL*
GetSpecificPL() const
{
CheckIsPossible();
VISU_DeformedShapePL *myDeformedShapePL;
- SALOMEDS::Color myColor;
- bool myIsColored;
public:
static
void
SetMapScale(double theMapScale = 1.0);
- virtual
- VISU_Actor*
- CreateActor();
-
virtual
VISU_Actor*
CreateActor(bool toSupressShrinking);
- virtual
- void
- UpdateActor(VISU_Actor* theActor) ;
};
}
#include "VISU_StreamLines_i.hh"
#include "VISU_Plot3D_i.hh"
#include "VISU_Table_i.hh"
+#include "VISU_PointMap3d_i.hh"
#include "VISU_GaussPoints_i.hh"
-#include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VISU_DeformedShapeAndScalarMap_i.hh"
#include "VISU_ColoredPrs3dCache_i.hh"
#include "VISU_ColoredPrs3dHolder_i.hh"
return thePrefix;
}
+ //---------------------------------------------------------------------------
+ std::string
+ MonoColorPrsToPython(SALOMEDS::SObject_ptr theSObject,
+ VISU::MonoColorPrs_i* theServant,
+ std::ostream& theStr,
+ const std::string& theName,
+ TColoredPrs3dFactory& thePrsFactory,
+ std::string thePrefix)
+ {
+ thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+ theStr<<thePrefix<<endl;
+ theStr<<thePrefix<<theName<<".ShowColored("<<GetBoolean(theServant->IsColored())<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetColor("<<GetColor(theServant->GetColor())<<")"<<endl;
+ return thePrefix;
+ }
//---------------------------------------------------------------------------
std::string
TColoredPrs3dFactory& thePrsFactory,
std::string thePrefix)
{
- thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+ thePrefix = MonoColorPrsToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
theStr<<thePrefix<<endl;
theStr<<thePrefix<<theName<<".SetScale("<<theServant->GetScale()<<")"<<endl;
- theStr<<thePrefix<<theName<<".ShowColored("<<GetBoolean(theServant->IsColored())<<")"<<endl;
- theStr<<thePrefix<<theName<<".SetColor("<<GetColor(theServant->GetColor())<<")"<<endl;
+// theStr<<thePrefix<<theName<<".ShowColored("<<GetBoolean(theServant->IsColored())<<")"<<endl;
+// theStr<<thePrefix<<theName<<".SetColor("<<GetColor(theServant->GetColor())<<")"<<endl;
return thePrefix;
}
TColoredPrs3dFactory& thePrsFactory,
std::string thePrefix)
{
- thePrefix = DeformedShapeToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+ thePrefix = MonoColorPrsToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+ // thePrefix = DeformedShapeToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
theStr<<thePrefix<<endl;
std::string aParam;
//---------------------------------------------------------------------------
std::string
- ScalarMapOnDeformedShapeToPython(SALOMEDS::SObject_ptr theSObject,
- VISU::ScalarMapOnDeformedShape_i* theServant,
- std::ostream& theStr,
- const std::string& theName,
- TColoredPrs3dFactory& thePrsFactory,
- std::string thePrefix)
+ DeformedShapeAndScalarMapToPython(SALOMEDS::SObject_ptr theSObject,
+ VISU::DeformedShapeAndScalarMap_i* theServant,
+ std::ostream& theStr,
+ const std::string& theName,
+ TColoredPrs3dFactory& thePrsFactory,
+ std::string thePrefix)
{
thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
theStr<<thePrefix<<endl;
theStr<<thePrefix<<endl;
theStr<<thePrefix<<theName<<".SetNbSurfaces("<<theServant->GetNbSurfaces()<<")"<<endl;
+ theStr<<thePrefix<<theName<<".ShowLabels("<<theServant->IsLabeled()<<","<<theServant->GetNbLabels()<<")"<<endl;
return thePrefix;
}
theStr<<thePrefix<<theName<<".SetPlanePosition("<<anId<<", "<<theServant->GetPlanePosition(anId)<<")"<<endl;
}
+ theStr<<thePrefix<<theName<<".UseDeformation("<<GetBoolean(theServant->IsDeformed())<<")"<<endl;
+ if(theServant->IsDeformed()){
+ theStr<< thePrefix << theName << ".SetScale(" << theServant->GetScale()<<")"<<endl;
+ std::string aStringEntity;
+ VISU::Entity anEntity = theServant->GetVectorialFieldEntity();
+ switch(anEntity){
+ case NODE:
+ aStringEntity = "VISU.NODE";
+ break;
+ case EDGE:
+ aStringEntity = "VISU.EDGE";
+ break;
+ case FACE:
+ aStringEntity = "VISU.FACE";
+ break;
+ case CELL:
+ aStringEntity = "VISU.CELL";
+ break;
+ }
+ theStr<< thePrefix << theName << ".SetVectorialField("<<aStringEntity<<", '" << theServant->GetVectorialFieldName() <<"')"<<endl;
+ }
return thePrefix;
}
return thePrefix;
}
-
//---------------------------------------------------------------------------
// declaration
void DumpChildrenToPython(SALOMEDS::Study_ptr theStudy,
}
return;
case VISU::TSCALARMAPONDEFORMEDSHAPE:
- if(ScalarMapOnDeformedShape_i* aServant = dynamic_cast<ScalarMapOnDeformedShape_i*>(GetServant(anObj).in())){
- TCreateFromResult aPrsFactory(theSObject, aServant, aName, "ScalarMapOnDeformedShapeOnField", theArgumentName);
- thePrefix = ScalarMapOnDeformedShapeToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix);
+ case VISU::TDEFORMEDSHAPEANDSCALARMAP:
+ if(DeformedShapeAndScalarMap_i* aServant = dynamic_cast<DeformedShapeAndScalarMap_i*>(GetServant(anObj).in())){
+ TCreateFromResult aPrsFactory(theSObject, aServant, aName, "DeformedShapeAndScalarMapOnField", theArgumentName);
+ thePrefix = DeformedShapeAndScalarMapToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix);
theStr<<thePrefix<<"pass"<<endl<<endl;
}
return;
theStr<<thePrefix<<"pass"<<endl<<endl;
}
return;
+ case VISU::TPOINTMAP3D:
+ if (PointMap3d_i* aServant = dynamic_cast<PointMap3d_i*>(GetServant(anObj).in())) {
+ CORBA::Short aTag = theSObject->Tag();
+ theStr<<thePrefix<<"anIsFound, aSObject = "<<theArgumentName<<".FindSubObject("<<aTag<<")"<<endl;
+ theStr<<thePrefix<<"if anIsFound:"<<endl;
+ thePrefix += PREFIX;
+
+ theStr<<thePrefix<<"anID = aSObject.GetID()"<<endl;
+ theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
+
+ // Set name (as this object could be renamed by user)
+ theStr<<thePrefix<<aName<<".SetTitle('"<<aNameInStudy.in()<<"') # 3"<<endl;
+
+ // Set PointMap3D Properties
+
+ theStr<<thePrefix<<aName<<".SetScaleFactor("<<aServant->GetScaleFactor()<<")"<<endl;
+ theStr<<thePrefix<<aName<<".SetContourPrs("<<aServant->GetIsContourPrs()<<")"<<endl;
+ theStr<<thePrefix<<aName<<".SetNbOfContours("<<aServant->GetNbOfContours()<<")"<<endl;
+
+ std::string aParam;
+ switch(aServant->GetScaling()){
+ case LINEAR:
+ aParam = "VISU.LINEAR";
+ break;
+ case LOGARITHMIC:
+ aParam = "VISU.LOGARITHMIC";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetScaling("<<aParam<<")"<<endl;
+
+ theStr<<thePrefix<<aName<<".SetNbColors("<<aServant->GetNbColors()<<")"<<endl;
+ theStr<<thePrefix<<aName<<".SetLabels("<<aServant->GetLabels()<<")"<<endl;
+
+ switch(aServant->GetBarOrientation()){
+ case ColoredPrs3dBase::HORIZONTAL:
+ aParam = "VISU.ColoredPrs3d.HORIZONTAL";
+ break;
+ case ColoredPrs3dBase::VERTICAL:
+ aParam = "VISU.ColoredPrs3d.VERTICAL";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetBarOrientation("<<aParam<<")"<<endl;
+
+ if(aServant->IsRangeFixed())
+ theStr<<thePrefix<<aName<<".SetRange("<<aServant->GetMin()<<", "<<aServant->GetMax()<<")"<<endl;
+ else
+ theStr<<thePrefix<<aName<<".SetSourceRange()"<<endl;
+
+ theStr<<thePrefix<<aName<<".SetPosition("<<aServant->GetPosX()<<", "<<aServant->GetPosY()<<")"<<endl;
+ theStr<<thePrefix<<aName<<".SetSize("<<aServant->GetWidth()<<", "<<aServant->GetHeight()<<")"<<endl;
+
+ float dx, dy, dz;
+ aServant->GetOffset(dx, dy, dz);
+ theStr<<thePrefix<<aName<<".SetOffset("<<dx<<", "<<dy<<", "<<dz<<")"<<endl;
+
+
+ theStr<<thePrefix<<endl;
+
+ theArgumentName = aName;
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
case VISU::TGAUSSPOINTS:
if(GaussPoints_i* aServant = dynamic_cast<GaussPoints_i*>(GetServant(anObj).in())){
TCreateFromResult aPrsFactory(theSObject, aServant, aName, "GaussPointsOnField", theArgumentName);
break;
}
case VISU::TSCALARMAPONDEFORMEDSHAPE:
- if(ScalarMapOnDeformedShape_i* aServant = dynamic_cast<ScalarMapOnDeformedShape_i*>(aDevice)){
- ScalarMapOnDeformedShapeToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ case VISU::TDEFORMEDSHAPEANDSCALARMAP:
+ if(DeformedShapeAndScalarMap_i* aServant = dynamic_cast<DeformedShapeAndScalarMap_i*>(aDevice)){
+ DeformedShapeAndScalarMapToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
break;
}
case VISU::TVECTORS:
vtkTextProperty* aTitleProp = theScalarBar->GetTitleTextProperty();
aTitleProp->SetFontFamily(GetTitFontType());
- GetTitleColor(&anRGB[0],&anRGB[1],&anRGB[2]);
+ GetTitleColor(anRGB[0],anRGB[1],anRGB[2]);
aTitleProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
IsBoldTitle()? aTitleProp->BoldOn() : aTitleProp->BoldOff();
vtkTextProperty* aLabelProp = theScalarBar->GetLabelTextProperty();
aLabelProp->SetFontFamily(GetLblFontType());
- GetLabelColor(&anRGB[0],&anRGB[1],&anRGB[2]);
+ GetLabelColor(anRGB[0],anRGB[1],anRGB[2]);
aLabelProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
IsBoldLabel()? aLabelProp->BoldOn() : aLabelProp->BoldOff();
Storable::RegistryStorableEngine(StreamLines_i::myComment.c_str(),&(StorableEngine<StreamLines_i>));
Storable::RegistryStorableEngine(Plot3D_i::myComment.c_str(),&(StorableEngine<Plot3D_i>));
Storable::RegistryStorableEngine(Vectors_i::myComment.c_str(),&(StorableEngine<Vectors_i>));
- Storable::RegistryStorableEngine(ScalarMapOnDeformedShape_i::myComment.c_str(),&(StorableEngine<ScalarMapOnDeformedShape_i>));
+ Storable::RegistryStorableEngine(DeformedShapeAndScalarMap_i::myComment.c_str(),&(StorableEngine<DeformedShapeAndScalarMap_i>));
Storable::RegistryStorableEngine(ColoredPrs3dHolder_i::myComment.c_str(),&(ColoredPrs3dHolder_i::StorableEngine));
Storable::RegistryStorableEngine(ColoredPrs3dCache_i::myComment.c_str(),&(ColoredPrs3dCache_i::StorableEngine));
//---------------------------------------------------------------
- ScalarMapOnDeformedShape_ptr
+ DeformedShapeAndScalarMap_ptr
VISU_Gen_i
::ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
const char* theMeshName,
const char* theFieldName,
CORBA::Long theIteration)
{
- return Prs3dOnField<VISU::ScalarMapOnDeformedShape_i>(theResult,
- theMeshName,
- theEntity,
- theFieldName,
- theIteration)._retn();
+ return DeformedShapeAndScalarMapOnField(theResult,
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration);
+ }
+
+
+//---------------------------------------------------------------
+ DeformedShapeAndScalarMap_ptr
+ VISU_Gen_i
+ ::DeformedShapeAndScalarMapOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
+ {
+ return Prs3dOnField<VISU::DeformedShapeAndScalarMap_i>(theResult,
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration)._retn();
}
VISU_Gen_i
::CreateTable(const char* theTableEntry)
{
- if(myStudyDocument->GetProperties()->IsLocked())
+ TCollection_AsciiString tmp( (char*)theTableEntry ); // 11.06.2008 IPAL18844
+ if( myStudyDocument->GetProperties()->IsLocked() ||
+ tmp.Length()==0 )
return Table::_nil();
return ProcessEvent(new CreateTableEvent(myStudyDocument, theTableEntry));
SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir, false);
if(MYDEBUG) MESSAGE("Result_i::PasteInto - aListOfFileNames->length() = "<<aListOfFileNames->length());
- std::string aLocalPersistentID;
+ std::ostrstream aLocalPersistentID;
{
std::string aCopyPersist = aTmpDir + "copy_persistent";
- std::ifstream anInputFileStream(aCopyPersist.c_str());
- anInputFileStream>>aLocalPersistentID;
- anInputFileStream.close();
+ std::ifstream anInputFileStream( aCopyPersist.c_str() );
+ anInputFileStream >> aLocalPersistentID.rdbuf();
}
//Just for Result::Restore to find the Comment attribute :(
std::string aFileName(aTmpDir);
if(aListOfFileNames->length() > 1)
aFileName += aListOfFileNames[1].in();
- Storable* aStorable = Storable::Create(aSObject, aLocalPersistentID, aFileName, false);
+ Storable* aStorable = Storable::Create(aSObject, aLocalPersistentID.str(), aFileName, false);
SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
aFilesToRemove->length(1);
const char* theFieldName,
CORBA::Long theIteration);
+ //This function is obsolete. Use DeformedShapeAndScalarMapOnField instead.
virtual
- ScalarMapOnDeformedShape_ptr
+ DeformedShapeAndScalarMap_ptr
ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
const char* theMeshName,
VISU::Entity theEntity,
const char* theFieldName,
CORBA::Long theIteration);
+
+ virtual
+ DeformedShapeAndScalarMap_ptr
+ DeformedShapeAndScalarMapOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration);
+
virtual
Vectors_ptr
VectorsOnField(Result_ptr theResult,
#include "VISU_Vectors_i.hh"
#include "VISU_StreamLines_i.hh"
#include "VISU_GaussPoints_i.hh"
-#include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VISU_DeformedShapeAndScalarMap_i.hh"
#include "VISU_ViewManager_i.hh"
#include "VISU_View_i.hh"
#include "VISU_TimeAnimation.h"
#include "VISU_IsoSurfacesPL.hxx"
#include "VISU_Result_i.hh"
#include "VISU_Actor.h"
+#include "VISU_ScalarMapAct.h"
+#include "VISU_IsoSurfActor.h"
#include "SUIT_ResourceMgr.h"
#include "SALOME_Event.h"
+#include <vtkMapper.h>
#ifdef _DEBUG_
static int MYDEBUG = 0;
::IsoSurfaces_i(EPublishInStudyMode thePublishInStudyMode) :
ColoredPrs3d_i(thePublishInStudyMode),
ScalarMap_i(thePublishInStudyMode),
- myIsoSurfacesPL(NULL)
+ MonoColorPrs_i(thePublishInStudyMode),
+ myIsoSurfacesPL(NULL),
+ myIsLabeled(false),
+ myNbLabels(3)
{}
const std::string& theFieldName,
CORBA::Long theTimeStampNumber)
{
- return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
+ VISU::Storable* aRes = TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
+ myIsColored = true;
+ myColor.R = myColor.G = myColor.B = 0.;
+ //myIsLabeled = false;
+ //myNbLabels = 3;
+ return aRes;
}
SetNbSurfaces(VISU::Storable::FindValue(theMap,"myNbSurface").toInt());
float aMin = VISU::Storable::FindValue(theMap,"myRange[0]").toDouble();
float aMax = VISU::Storable::FindValue(theMap,"myRange[1]").toDouble();
+ myNbLabels = VISU::Storable::FindValue(theMap,"myNbLabels").toInt();
+ myIsLabeled = VISU::Storable::FindValue(theMap,"myIsLabeled").toInt();
SetSubRange(aMin,aMax);
return this;
Storable::DataToStream( theStr, "myNbSurface", int(GetNbSurfaces()) );
Storable::DataToStream( theStr, "myRange[0]", GetSubMin() );
Storable::DataToStream( theStr, "myRange[1]", GetSubMax() );
+ Storable::DataToStream( theStr, "myNbLabels", myNbLabels );
+ Storable::DataToStream( theStr, "myIsLabeled", myIsLabeled );
}
+//---------------------------------------------------------------
+void VISU::IsoSurfaces_i::SameAs(const Prs3d_i* theOrigin)
+{
+ TSuperClass::SameAs(theOrigin);
+
+ if(const IsoSurfaces_i* aPrs3d = dynamic_cast<const IsoSurfaces_i*>(theOrigin)){
+ IsoSurfaces_i* anOrigin = const_cast<IsoSurfaces_i*>(aPrs3d);
+ ShowLabels(anOrigin->IsLabeled(), anOrigin->GetNbLabels());
+ }
+}
+
+
//---------------------------------------------------------------
VISU::IsoSurfaces_i
}
//---------------------------------------------------------------
-VISU_Actor*
-VISU::IsoSurfaces_i
-::CreateActor()
+VISU_Actor* VISU::IsoSurfaces_i::CreateActor()
{
- if(VISU_Actor* anActor = TSuperClass::CreateActor()){
+ VISU_IsoSurfActor* anActor = VISU_IsoSurfActor::New();
+ try{
+ VISU::Prs3d_i::CreateActor(anActor);
+ anActor->SetBarVisibility(true);
anActor->SetVTKMapping(true);
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
int aDispMode = aResourceMgr->integerValue("VISU" , "iso_surfaces_represent", 2);
anActor->SetRepresentation(aDispMode);
- return anActor;
+ UpdateActor(anActor);
+ }catch(...){
+ anActor->Delete();
+ throw ;
}
- return NULL;
+
+ return anActor;
}
+//---------------------------------------------------------------
+void VISU::IsoSurfaces_i::UpdateActor(VISU_ActorBase* theActor)
+{
+ if(VISU_IsoSurfActor* anActor = dynamic_cast<VISU_IsoSurfActor*>(theActor)){
+ anActor->SetLinesLabeled(myIsLabeled, myNbLabels);
+ }
+ TSuperClass::UpdateActor(theActor);
+}
//---------------------------------------------------------------
void
{
myIsoSurfacesPL->SetMapScale(theMapScale);
}
+
+//---------------------------------------------------------------
+CORBA::Boolean VISU::IsoSurfaces_i::IsLabeled()
+{
+ return myIsLabeled;
+}
+
+//---------------------------------------------------------------
+void VISU::IsoSurfaces_i::ShowLabels(CORBA::Boolean theShow, CORBA::Long theNb)
+{
+ if ((myIsLabeled == theShow) && (myNbLabels == theNb)) return;
+ VISU::TSetModified aModified(this);
+ myIsLabeled = theShow;
+ myNbLabels = theNb;
+ myParamsTime.Modified();
+}
+
+//---------------------------------------------------------------
+CORBA::Long VISU::IsoSurfaces_i::GetNbLabels()
+{
+ return myNbLabels;
+}
+
#define VISU_IsoSurfaces_i_HeaderFile
#include "VISU_I.hxx"
-#include "VISU_ScalarMap_i.hh"
+//#include "VISU_ScalarMap_i.hh"
+#include "VISU_MonoColorPrs_i.hh"
class VISU_IsoSurfacesPL;
{
//----------------------------------------------------------------------------
class VISU_I_EXPORT IsoSurfaces_i : public virtual POA_VISU::IsoSurfaces,
- public virtual ScalarMap_i
+ public virtual MonoColorPrs_i
{
static int myNbPresent;
IsoSurfaces_i(const IsoSurfaces_i&);
public:
//----------------------------------------------------------------------------
- typedef ScalarMap_i TSuperClass;
+ typedef MonoColorPrs_i TSuperClass;
typedef VISU::IsoSurfaces TInterface;
explicit
IsoSurfaces_i(EPublishInStudyMode thePublishInStudyModep);
+ virtual void SameAs(const Prs3d_i* theOrigin);
+
virtual
~IsoSurfaces_i();
{
return myIsoSurfacesPL;
}
+
+
+ virtual CORBA::Boolean IsLabeled();
+ virtual void ShowLabels(CORBA::Boolean theShow, CORBA::Long theNb);
+
+ virtual CORBA::Long GetNbLabels();
+
protected:
//! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
virtual
VISU_IsoSurfacesPL* myIsoSurfacesPL;
+ bool myIsLabeled;
+ CORBA::Long myNbLabels;
+
public:
static
size_t
virtual
void
SetMapScale(double theMapScale = 1.0);
+
+ virtual void UpdateActor(VISU_ActorBase* 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.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
//
//
// File : VISU_PointMap3d_i.cc
-// Author : Vadim SANDLER
+// Author : Dmitry Matveitchev
// Module : VISU
#include "VISU_PointMap3d_i.hh"
myActorCollection(vtkActorCollection::New()),
myIsActiveState(true)
{
- MESSAGE("PointMap3d_i::PointMap3d_i - "<<this);
+ if(MYDEBUG) MESSAGE("PointMap3d_i::PointMap3d_i - this = "<<this);
SetStudyDocument(theStudy);
mySObj = theStudy->FindObjectID(theObjectEntry);
myOffset[0] = myOffset[1] = myOffset[2] = 0;
*/
VISU::PointMap3d_i::~PointMap3d_i()
{
- MESSAGE("PointMap3d_i::~PointMap3d_i - "<<this);
+ if(MYDEBUG) MESSAGE("PointMap3d_i::~PointMap3d_i - this = "<<this);
}
//----------------------------------------------------------------------------
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
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" );
SetLabelsFormat(aLabelsFormat.toLatin1().constData());
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);
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());
vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty();
aTitleProp->SetFontFamily(GetTitFontType());
- GetTitleColor(&anRGB[0],&anRGB[1],&anRGB[2]);
+ GetTitleColor(anRGB[0],anRGB[1],anRGB[2]);
aTitleProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
IsBoldTitle()? aTitleProp->BoldOn() : aTitleProp->BoldOff();
vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty();
aLabelProp->SetFontFamily(GetLblFontType());
- GetLabelColor(&anRGB[0],&anRGB[1],&anRGB[2]);
+ GetLabelColor(anRGB[0],anRGB[1],anRGB[2]);
aLabelProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
IsBoldLabel()? aLabelProp->BoldOn() : aLabelProp->BoldOff();
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
*/
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];
vtkFloatingPointType aRange[2];
GetSpecificPL()->GetSourceRange(aRange);
return aRange[0];
-
- UseFixedRange(false);
}
CORBA::Double VISU::PointMap3d_i::GetSourceMax()
GetSpecificPL()->SetSourceRange();
ProcessVoidEvent(new TVoidMemFunEvent<VISU_DeformedGridPL>
(GetSpecificPL(), &VISU_DeformedGridPL::SetSourceRange));
+
+ UseFixedRange(false);
}
CORBA::Boolean VISU::PointMap3d_i::IsRangeFixed()
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)
myIsActiveState = theState;
}
-unsigned long int VISU::PointMap3d_i::GetMTime ()
-{
- unsigned long int aTime = myParamsTime.GetMTime();
- if( GetSpecificPL() )
- aTime = std::max(aTime, GetSpecificPL()->GetMTime());
- return aTime;
-}
-
void VISU::PointMap3d_i::RemoveActor (VISU_ActorBase* theActor)
{
myActorCollection->RemoveItem(theActor);
}
//----------------------------------------------------------------------------
-void VISU::PointMap3d_i::GetTitleColor(vtkFloatingPointType* theR,
- vtkFloatingPointType* theG,
- vtkFloatingPointType* theB)
+void VISU::PointMap3d_i::GetTitleColor(vtkFloatingPointType& theR,
+ vtkFloatingPointType& theG,
+ vtkFloatingPointType& theB)
{
- *theR = myTitleColor[0];
- *theG = myTitleColor[1];
- *theB = myTitleColor[2];
+ theR = myTitleColor[0];
+ theG = myTitleColor[1];
+ theB = myTitleColor[2];
}
//----------------------------------------------------------------------------
}
//----------------------------------------------------------------------------
-void VISU::PointMap3d_i::GetLabelColor(vtkFloatingPointType* theR,
- vtkFloatingPointType* theG,
- vtkFloatingPointType* theB)
+void VISU::PointMap3d_i::GetLabelColor(vtkFloatingPointType& theR,
+ vtkFloatingPointType& theG,
+ vtkFloatingPointType& theB)
{
- *theR = myLabelColor[0];
- *theG = myLabelColor[1];
- *theB = myLabelColor[2];
+ theR = myLabelColor[0];
+ theG = myLabelColor[1];
+ theB = myLabelColor[2];
}
//----------------------------------------------------------------------------
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 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 VISU::Scaling GetScaling();
virtual void SetScaling(VISU::Scaling theScaling);
+ bool IsPositiveTable();
+
// Plot3dBase methods
void SetScaleFactor (CORBA::Double theScaleFactor);
- double GetScaleFactor();
+ CORBA::Double GetScaleFactor();
void SetContourPrs (CORBA::Boolean theIsContourPrs );
- bool GetIsContourPrs();
+ CORBA::Boolean GetIsContourPrs();
void SetNbOfContours (CORBA::Long);
- long GetNbOfContours();
+ CORBA::Long GetNbOfContours();
VISU_DeformedGridPL* GetSpecificPL() const { return myTablePL; }
virtual void SetShadowTitle(bool isShadow);
virtual int GetTitFontType();
virtual void SetTitFontType(int theType);
- virtual void GetTitleColor(vtkFloatingPointType* theR,
- vtkFloatingPointType* theG,
- vtkFloatingPointType* theB);
+ virtual void GetTitleColor(vtkFloatingPointType& theR,
+ vtkFloatingPointType& theG,
+ vtkFloatingPointType& theB);
virtual void SetTitleColor(vtkFloatingPointType theR,
vtkFloatingPointType theG,
vtkFloatingPointType theB);
virtual void SetShadowLabel(bool isShadow);
virtual int GetLblFontType();
virtual void SetLblFontType(int theType);
- virtual void GetLabelColor(vtkFloatingPointType* theR,
- vtkFloatingPointType* theG,
- vtkFloatingPointType* theB);
+ virtual void GetLabelColor(vtkFloatingPointType& theR,
+ vtkFloatingPointType& theG,
+ vtkFloatingPointType& theB);
virtual void SetLabelColor(vtkFloatingPointType theR,
vtkFloatingPointType theG,
vtkFloatingPointType theB);
CORBA::Float myOffset[3];
bool myIsActiveState;
vtkTimeStamp myParamsTime;
+ vtkTimeStamp myUpdateTime;
+
+ Handle(SALOME_InteractiveObject) myIO;
//Font management
#include <boost/bind.hpp>
#ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
#else
static int MYDEBUG = 0;
#endif
{
if(MYDEBUG) MESSAGE("Prs3d_i::~Prs3d_i - this = "<<this);
ProcessVoidEvent(new TInvokeSignalEvent(myRemoveActorsFromRendererSignal));
+ if(myResult) myResult->Destroy();
}
if(GetCResult() == theResult)
return;
- if(theResult)
+ if(theResult) {
SetStudyDocument(theResult->GetStudyDocument());
+ theResult->Register();
+ }
+ if(myResult) {
+ myResult->Destroy();
+ }
VISU::TSetModified aModified(this);
#include <Bnd_Box.hxx>
#ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
#else
static int MYDEBUG = 0;
#endif
myIsBuildParts(false),
myIsPartsDone(false)
{
+ if(MYDEBUG) MESSAGE("Result_i::Result_i - this = "<<this);
myStudy = VISU::GetStudy(myStudyDocument);
}
myIsAllDone(false),
myIsBuildParts(false),
myIsPartsDone(false)
-{}
+{
+ if(MYDEBUG) MESSAGE("Result_i::Result_i - this = "<<this);
+}
//---------------------------------------------------------------
aPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in());
}
- std::string aFileName = aPrefix + "_" + GetFileName();
+ std::string aFileName = aPrefix + "_" + GetFileName().c_str();
BEGMSG(MYDEBUG, "aFileName = '"<<aFileName<<"'\n");
std::string aFile = GetFileInfo().filePath().toLatin1().data();
{
anEntities->length(aMeshOnEntityMap.size());
- VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.end();
+ VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.begin();
for(size_t anId = 0; anIter != aMeshOnEntityMap.end(); anIter++, anId++){
const VISU::TEntity& anEntity = anIter->first;
anEntities[anId] = VISU::Entity(anEntity);
{
aResult->length(aFamilyMap.size());
- VISU::TFamilyMap::const_iterator anIter = aFamilyMap.end();
+ VISU::TFamilyMap::const_iterator anIter = aFamilyMap.begin();
for(size_t anId = 0; anIter != aFamilyMap.end(); anIter++, anId++){
const std::string& aName = anIter->first;
aResult[anId] = aName.c_str();
{
aResult->length(aGroupMap.size());
- VISU::TGroupMap::const_iterator anIter = aGroupMap.end();
+ VISU::TGroupMap::const_iterator anIter = aGroupMap.begin();
for(size_t anId = 0; anIter != aGroupMap.end(); anIter++, anId++){
const std::string& aName = anIter->first;
aResult[anId] = aName.c_str();
{
aResult->length(aFieldMap.size());
- VISU::TFieldMap::const_iterator anIter = aFieldMap.end();
+ VISU::TFieldMap::const_iterator anIter = aFieldMap.begin();
for(size_t anId = 0; anIter != aFieldMap.end(); anIter++, anId++){
const std::string& aName = anIter->first;
aResult[anId] = aName.c_str();
{
aResult->length(aValField.size());
- VISU::TValField::const_iterator anIter = aValField.end();
+ VISU::TValField::const_iterator anIter = aValField.begin();
for(size_t anId = 0; anIter != aValField.end(); anIter++, anId++){
const vtkIdType& aTimeStampNumber = anIter->first;
aResult[anId] = aTimeStampNumber;
VISU::Result_i
::GetFileName() const
{
- if(GetSourceId() == eFile)
+ if(GetSourceId() == eRestoredFile)
return VISU::MakeFileName(myFileName, this);
return myFileName;
+++ /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_ScalarMapOnDeformedShape_i.cc
-// Author : Eugeny Nikolaev
-// Module : VISU
-
-#include "VISU_ScalarMapOnDeformedShape_i.hh"
-#include "VISU_Prs3dUtils.hh"
-#include "VISU_Result_i.hh"
-
-#include "VISU_ScalarMapAct.h"
-#include "VISU_ScalarMapOnDeformedShapePL.hxx"
-#include "VISU_Convertor.hxx"
-
-#include "SUIT_ResourceMgr.h"
-#include "SALOME_Event.h"
-
-#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::ScalarMapOnDeformedShape_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("ScalarMapOnDeformedShape_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::ScalarMapOnDeformedShape_i::myNbPresent = 0;
-
-//---------------------------------------------------------------
-QString
-VISU::ScalarMapOnDeformedShape_i
-::GenerateName()
-{
- return VISU::GenerateName("ScalarDef.Shape",myNbPresent++);
-}
-
-//---------------------------------------------------------------
-const string VISU::ScalarMapOnDeformedShape_i::myComment = "SCALARMAPONDEFORMEDSHAPE";
-
-//---------------------------------------------------------------
-const char*
-VISU::ScalarMapOnDeformedShape_i
-::GetComment() const
-{
- return myComment.c_str();
-}
-
-//----------------------------------------------------------------------------
-const char*
-VISU::ScalarMapOnDeformedShape_i
-::GetIconName()
-{
- if (!IsGroupsUsed())
- return "ICON_TREE_SCALAR_MAP_ON_DEFORMED_SHAPE";
- else
- return "ICON_TREE_SCALAR_MAP_ON_DEFORMED_SHAPE_GROUPS";
-}
-
-//---------------------------------------------------------------
-VISU::ScalarMapOnDeformedShape_i
-::ScalarMapOnDeformedShape_i(EPublishInStudyMode thePublishInStudyMode) :
- ColoredPrs3d_i(thePublishInStudyMode),
- ScalarMap_i(thePublishInStudyMode),
- myScalarMapOnDeformedShapePL(NULL),
- myScalarTimeStampNumber(1)
-{}
-
-
-//---------------------------------------------------------------
-VISU::Storable*
-VISU::ScalarMapOnDeformedShape_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::ScalarMapOnDeformedShape_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.toLatin1().data(),
- aTimeStampNumber);
-
- SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble());
-
- return this;
-}
-
-
-//---------------------------------------------------------------
-void
-VISU::ScalarMapOnDeformedShape_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::ScalarMapOnDeformedShape_i
-::~ScalarMapOnDeformedShape_i()
-{
- if(MYDEBUG) MESSAGE("ScalarMapOnDeformedShape_i::~ScalarMapOnDeformedShape_i()");
-}
-
-
-//---------------------------------------------------------------
-void
-VISU::ScalarMapOnDeformedShape_i
-::SameAs(const Prs3d_i* theOrigin)
-{
- TSuperClass::SameAs(theOrigin);
-
- if(const ScalarMapOnDeformedShape_i* aPrs3d = dynamic_cast<const ScalarMapOnDeformedShape_i*>(theOrigin)){
- ScalarMapOnDeformedShape_i* anOrigin = const_cast<ScalarMapOnDeformedShape_i*>(aPrs3d);
- CORBA::String_var aFieldName = anOrigin->GetScalarFieldName();
-
- SetScalarField(anOrigin->GetScalarEntity(),
- aFieldName,
- anOrigin->GetScalarTimeStampNumber());
- Update();
- }
-}
-
-
-//---------------------------------------------------------------
-void
-VISU::ScalarMapOnDeformedShape_i
-::SetScale(CORBA::Double theScale)
-{
- VISU::TSetModified aModified(this);
-
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ScalarMapOnDeformedShapePL, vtkFloatingPointType>
- (GetSpecificPL(), &VISU_ScalarMapOnDeformedShapePL::SetScale, theScale));
-}
-
-
-//---------------------------------------------------------------
-CORBA::Double
-VISU::ScalarMapOnDeformedShape_i
-::GetScale()
-{
- return myScalarMapOnDeformedShapePL->GetScale();
-}
-
-
-//---------------------------------------------------------------
-void
-VISU::ScalarMapOnDeformedShape_i
-::CreatePipeLine(VISU_PipeLine* thePipeLine)
-{
- if(!thePipeLine){
- myScalarMapOnDeformedShapePL = VISU_ScalarMapOnDeformedShapePL::New();
- }else
- myScalarMapOnDeformedShapePL = dynamic_cast<VISU_ScalarMapOnDeformedShapePL*>(thePipeLine);
-
- myScalarMapOnDeformedShapePL->GetMapper()->SetScalarVisibility(1);
-
- TSuperClass::CreatePipeLine(myScalarMapOnDeformedShapePL);
-}
-
-
-//---------------------------------------------------------------
-bool
-VISU::ScalarMapOnDeformedShape_i
-::CheckIsPossible()
-{
- return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
-}
-
-
-//---------------------------------------------------------------
-VISU_Actor*
-VISU::ScalarMapOnDeformedShape_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::ScalarMapOnDeformedShape_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::ScalarMapOnDeformedShape_i
-::SetField(VISU::PField theField)
-{
- TSuperClass::SetField(theField);
-
- if(!myScalarField)
- myScalarField = theField;
-}
-
-
-//---------------------------------------------------------------
-void
-VISU::ScalarMapOnDeformedShape_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(myScalarMapOnDeformedShapePL && anOutput)
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ScalarMapOnDeformedShapePL, vtkDataSet*>
- (GetSpecificPL(), &VISU_ScalarMapOnDeformedShapePL::SetScalars, anOutput));
-
- myScalarEntity = theEntity;
- myScalarFieldName = theFieldName;
- myScalarTimeStampNumber = theTimeStampNumber;
-
- SetTitle(theFieldName);
- SetScalarMode(GetScalarMode());
- if(!IsRangeFixed() && IsPipeLineExists())
- SetSourceRange();
-
- myParamsTime.Modified();
-}
-
-
-//---------------------------------------------------------------
-VISU::Entity
-VISU::ScalarMapOnDeformedShape_i
-::GetScalarEntity()
-{
- return myScalarEntity;
-}
-
-
-//---------------------------------------------------------------
-char*
-VISU::ScalarMapOnDeformedShape_i
-::GetScalarFieldName()
-{
- return CORBA::string_dup(myScalarFieldName.c_str());
-}
-
-
-//---------------------------------------------------------------
-CORBA::Long
-VISU::ScalarMapOnDeformedShape_i
-::GetScalarTimeStampNumber()
-{
- return myScalarTimeStampNumber;
-}
-
-
-//---------------------------------------------------------------
-VISU::PField
-VISU::ScalarMapOnDeformedShape_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_ScalarMapOnDeformedShape_i.hh
-// Author: Eugeny Nikolaev
-// Module : VISU
-
-#ifndef VISU_ScalarMapOnDeformedShape_i_HeaderFile
-#define VISU_ScalarMapOnDeformedShape_i_HeaderFile
-
-#include "VISU_ScalarMap_i.hh"
-
-class VISU_ScalarMapOnDeformedShapePL;
-
-namespace VISU
-{
- //----------------------------------------------------------------------------
- //! Class of Scalar Map on Deformed Shape presentation.
- class VISU_I_EXPORT ScalarMapOnDeformedShape_i : public virtual POA_VISU::ScalarMapOnDeformedShape,
- public virtual ScalarMap_i
- {
- static int myNbPresent;
- ScalarMapOnDeformedShape_i(const ScalarMapOnDeformedShape_i&);
-
- public:
- //----------------------------------------------------------------------------
- typedef ScalarMap_i TSuperClass;
- typedef VISU::ScalarMapOnDeformedShape TInterface;
-
- explicit
- ScalarMapOnDeformedShape_i(EPublishInStudyMode thePublishInStudyModep);
-
- virtual
- ~ScalarMapOnDeformedShape_i();
-
- virtual
- VISU::VISUType
- GetType()
- {
- return VISU::TSCALARMAPONDEFORMEDSHAPE;
- }
-
- virtual
- void
- SetScale(CORBA::Double theScale);
-
- virtual
- CORBA::Double
- GetScale();
-
- virtual
- void
- SameAs(const Prs3d_i* theOrigin);
-
- VISU_ScalarMapOnDeformedShapePL*
- GetSpecificPL()
- {
- return myScalarMapOnDeformedShapePL;
- }
-
- 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_ScalarMapOnDeformedShapePL *myScalarMapOnDeformedShapePL;
-
- PField myScalarField;
- VISU::Entity myScalarEntity;
- std::string myScalarFieldName;
- CORBA::Long myScalarTimeStampNumber;
- };
-}
-#endif
vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty();
aTitleProp->SetFontFamily(GetTitFontType());
- GetTitleColor(&anRGB[0],&anRGB[1],&anRGB[2]);
+ GetTitleColor(anRGB[0],anRGB[1],anRGB[2]);
aTitleProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
IsBoldTitle()? aTitleProp->BoldOn() : aTitleProp->BoldOff();
vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty();
aLabelProp->SetFontFamily(GetLblFontType());
- GetLabelColor(&anRGB[0],&anRGB[1],&anRGB[2]);
+ GetLabelColor(anRGB[0],anRGB[1],anRGB[2]);
aLabelProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
IsBoldLabel()? aLabelProp->BoldOn() : aLabelProp->BoldOff();
::StreamLines_i(EPublishInStudyMode thePublishInStudyMode) :
ColoredPrs3d_i(thePublishInStudyMode),
ScalarMap_i(thePublishInStudyMode),
- DeformedShape_i(thePublishInStudyMode),
+ MonoColorPrs_i(thePublishInStudyMode),
myStreamLinesPL(NULL),
myAppendFilter(vtkAppendFilter::New())
{}
#ifndef VISU_StreamLines_i_HeaderFile
#define VISU_StreamLines_i_HeaderFile
-#include "VISU_DeformedShape_i.hh"
+//#include "VISU_DeformedShape_i.hh"
+#include "VISU_MonoColorPrs_i.hh"
class VISU_StreamLinesPL;
class vtkAppendFilter;
{
//----------------------------------------------------------------------------
class VISU_I_EXPORT StreamLines_i : public virtual POA_VISU::StreamLines,
- public virtual DeformedShape_i
+ public virtual MonoColorPrs_i
+ //public virtual DeformedShape_i
{
static int myNbPresent;
StreamLines_i(const StreamLines_i&);
public:
//----------------------------------------------------------------------------
- typedef DeformedShape_i TSuperClass;
+ typedef MonoColorPrs_i TSuperClass;
typedef VISU::StreamLines TInterface;
explicit
#include "VISU_TableReader.hxx"
#include "VISU_ConvertorUtils.hxx"
+#include "utilities.h"
+
#ifdef _DEBUG_
static int MYDEBUG = 0;
#else
VISU::Table_i::Table_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry )
: PrsObject_i(theStudy)
{
+ MESSAGE("Table_i::Table_i - "<<this);
mySObj = theStudy->FindObjectID(theObjectEntry);
myOrientation = VISU::Table::HORIZONTAL;
}
*/
VISU::Table_i::~Table_i()
{
- MESSAGE("Table_i::~Table_i");
+ MESSAGE("Table_i::~Table_i - "<<this);
}
//----------------------------------------------------------------------------
SALOMEDS::SObject_var aRealObject = aStudyBuilder->NewObject(aFileObject);
anAttr = aStudyBuilder->FindOrCreateAttribute(aRealObject, "AttributeName");
aName = SALOMEDS::AttributeName::_narrow(anAttr);
- if(MYDEBUG) cout<<"aTable2D.myTitle = "<<aTable2D.myTitle<<endl;
+ if(MYDEBUG) MESSAGE("aTable2D.myTitle = "<<aTable2D.myTitle);
if ( aTable2D.myTitle != "" ) {
aName->SetValue(aTable2D.myTitle.c_str());
} else {
int kEnd = aNewTable2D.myRows[0].myValues.size();
aTableOfReal->SetNbColumns(kEnd);
for(int j = 0, jEnd = aNewTable2D.myRows.size(); j < jEnd; j++){
- if(MYDEBUG) cout<<"j = "<<j<<"; kEnd = "<<kEnd<<endl;
+ if(MYDEBUG) MESSAGE("j = "<<j<<"; kEnd = "<<kEnd);
for(int k = 0; k < kEnd; k++){
QString aVal = aNewTable2D.myRows[j].myValues[k].c_str();
#include "VISU_Mesh_i.hh"
#include "VISU_IsoSurfaces_i.hh"
#include "VISU_DeformedShape_i.hh"
-#include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VISU_DeformedShapeAndScalarMap_i.hh"
#include "VISU_CutPlanes_i.hh"
#include "VISU_Plot3D_i.hh"
#include "VISU_CutLines_i.hh"
aNewData.myNbFrames = 0;
aNewData.myPrsType = VISU::TSCALARMAP;
aNewData.myOffset[0] = aNewData.myOffset[1] = aNewData.myOffset[2] = 0;
+
+ // initialize myResult in aNewData
+ _PTR(SObject) aSObj = theField->GetFather();
+ aSObj = aSObj->GetFather();
+ aSObj = aSObj->GetFather();
+ CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObj);
+ if (CORBA::is_nil(anObject)) return false;
+ aNewData.myResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
+
VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(aNewData.myField);
if(VISU::Storable::FindValue(aMap,"myComment") != "FIELD")
return false;
return aRes;
}
-void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) {
+void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum)
+{
+ int nbf = myFieldsLst.size();
+ if( theFieldNum<0 || theFieldNum>nbf-1 )
+ return;
+
FieldData& aData = myFieldsLst[theFieldNum];
// Delete previous presentations
aSequence);
break;
case VISU::TSCALARMAPONDEFORMEDSHAPE: // Scalar map on deformed shape
- GeneratePresentations<ScalarMapOnDeformedShape_i>(myStudy,
- aData,
- aResult,
- isRangeDefined(),
- myTimeMinVal,
- myTimeMaxVal,
- aSequence);
+ case VISU::TDEFORMEDSHAPEANDSCALARMAP:
+ GeneratePresentations<DeformedShapeAndScalarMap_i>(myStudy,
+ aData,
+ aResult,
+ isRangeDefined(),
+ myTimeMinVal,
+ myTimeMaxVal,
+ aSequence);
break;
default:
MESSAGE("Not implemented for this presentation type: " << aData.myPrsType);
myFieldsAbsFrames.push_back(aData.myNbFrames);
if (theFieldNum == getNbFields() - 1) {
- if ( aData.myPrsType != VISU::TGAUSSPOINTS) {
+ if ( aData.myPrsType != VISU::TGAUSSPOINTS && aData.myPrsType != TDEFORMEDSHAPEANDSCALARMAP && aData.myPrsType != TSCALARMAPONDEFORMEDSHAPE) {
// Initialize the MinMax controller
VISU::PCompositeMinMaxController aMinMaxController(new VISU::TCompositeMinMaxController());
if (myDumpFormat.compare("AVI") != 0) {
QString aFile(myDumpPath);
+ int aFrameNb = myFrame; // parallel animation mode
+ if ( myAnimationMode == VISU::Animation::SUCCESSIVE ) // successive animation mode
+ aFrameNb = getRelativeFrameNumber(myFrame).second;
+
+ int aMaxNb = myFieldsLst[theFieldId].myTiming.size();
+ int nbDigits = QString("%1").arg(aMaxNb).length();
+ QString aFormat = QString("%.%1d_").arg(nbDigits);
+
QString aName;
- if ( myAnimationMode == VISU::Animation::PARALLEL ) // parallel animation mode
- aName = QString("%1").arg(myFieldsLst[theFieldId].myTiming[myFrame]);
- else // successive animation mode
- aName = QString("%1").arg(myFieldsLst[theFieldId].myTiming[getRelativeFrameNumber(myFrame).second]);
+ aName.sprintf(aFormat.toLatin1().data(), aFrameNb);
+ aName += QString("%1").arg(myFieldsLst[theFieldId].myTiming[aFrameNb]);
int aPos = -1;
while ((aPos = aName.indexOf(".")) > -1 )
aPrsCmt = VISU::GaussPoints_i::myComment;
break;
case VISU::TSCALARMAPONDEFORMEDSHAPE:
- aPrsCmt = VISU::ScalarMapOnDeformedShape_i::myComment;
+ case VISU::TDEFORMEDSHAPEANDSCALARMAP:
+ aPrsCmt = VISU::DeformedShapeAndScalarMap_i::myComment;
break;
default:
aPrsCmt = "Unknown presentation";
for (anIter->Init(); anIter->More(); anIter->Next()) {
_PTR(SObject) aRefObj = anIter->Value();
_PTR(SObject) aFieldObj;
+
if (!aRefObj->ReferencedObject(aFieldObj) )
continue;
+ int nbAttr = aFieldObj->GetAllAttributes().size();
+ //std::string name1 = aFieldObj->GetName();
+ if(nbAttr<1)
+ continue;
+
addField(aFieldObj);
if ( isRangeDefined() || isSequenceDefined() )
myFieldsAbsFrames.pop_back();
aData.myPrsType = VISU::TSTREAMLINES;
else if (strName == VISU::GaussPoints_i::myComment.c_str())
aData.myPrsType = VISU::TGAUSSPOINTS;
- else if (strName == VISU::ScalarMapOnDeformedShape_i::myComment.c_str())
- aData.myPrsType = VISU::TSCALARMAPONDEFORMEDSHAPE;
+ else if (strName == VISU::DeformedShapeAndScalarMap_i::myComment.c_str())
+ aData.myPrsType = VISU::TDEFORMEDSHAPEANDSCALARMAP;
else
continue;
generatePresentations(getNbFields()-1);
#include "VISUConfig.hh"
+#include "VISU_Result_i.hh"
+#include "SALOME_GenericObjPointer.hh"
+
#include <vector>
#include <QObject>
namespace VISU
{
- class Result_i;
+ //class Result_i;
class ColoredPrs3d_i;
class ExecutionState;
}
std::vector<VISU_Actor*> myActors; // Actors
std::vector<double> myTiming; // time values
CORBA::Float myOffset[3];
+ typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
+ TResultPtr myResult;
};
::Vectors_i(EPublishInStudyMode thePublishInStudyMode) :
ColoredPrs3d_i(thePublishInStudyMode),
ScalarMap_i(thePublishInStudyMode),
+ MonoColorPrs_i(thePublishInStudyMode),
DeformedShape_i(thePublishInStudyMode),
myLineWidth(1.0),
myVectorsPL(NULL)
VISU::VISUType aType = myPrs->GetType();
if (aType != VISU::TSCALARMAP &&
aType != VISU::TDEFORMEDSHAPE &&
- aType != VISU::TSCALARMAPONDEFORMEDSHAPE) {
+ aType != VISU::TSCALARMAPONDEFORMEDSHAPE &&
+ aType != VISU::TDEFORMEDSHAPEANDSCALARMAP) {
myResult = "Insideframe representation is not available for this type of presentations.";
return;
}
myView.DisplayOnly(cutplanes)
print "Creating Scalar Map On Deformed Shape.......",
-scalarmapondefshape = myVisu.ScalarMapOnDeformedShapeOnField(myResult,myMeshName,myNodeEntity,'vitesse',1);
+scalarmapondefshape = myVisu.DeformedShapeAndScalarMapOnField(myResult,myMeshName,myNodeEntity,'vitesse',1);
if scalarmapondefshape is None : print "Error"
else : print "OK"
scalarmapondefshape.SetScalarField(myCellEntity,'pression',2);
myView1.DisplayOnly(cutplanes1)
print "Creating Scalar Map On Deformed Shape.......",
-scalarmapondefshape1 = myVisu.ScalarMapOnDeformedShapeOnField(myResult1,myMeshName1,myCellEntity,'vectoriel field',1);
+scalarmapondefshape1 = myVisu.DeformedShapeAndScalarMapOnField(myResult1,myMeshName1,myCellEntity,'vectoriel field',1);
if scalarmapondefshape1 is None : print "Error"
else : print "OK"
myView1.DisplayOnly(scalarmapondefshape1)
ChangeRepresentation(scmap, VISU.SHADED, 1, 1, 0.5, 3)
print "Creating Scalar Map On Deformed Shape.......",
-scmap = myVisu.ScalarMapOnDeformedShapeOnField(myResult,myMeshName,VISU.NODE,myFieldName,1);
+scmap = myVisu.DeformedShapeAndScalarMapOnField(myResult,myMeshName,VISU.NODE,myFieldName,1);
ChangeRepresentation(scmap, VISU.SHADED, 1, 1, 0.5, 3)
print "Creating Deformed Shape.......",
else :
aVISUObjList.append(aPrsObj)
- if HasValue(thePrsTypeList,VISU.TSCALARMAPONDEFORMEDSHAPE) :
- print " Creating ScalarMapOnDeformedShapeOnField",
- aPrsObj = theVisu.ScalarMapOnDeformedShapeOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
+ if HasValue(thePrsTypeList,VISU.TSCALARMAPONDEFORMEDSHAPE) or HasValue(thePrsTypeList,VISU.TDEFORMEDSHAPEANDSCALARMAP) :
+ print " Creating DeformedShapeAndScalarMapOnField",
+ aPrsObj = theVisu.DeformedShapeAndScalarMapOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
if aPrsObj is None : print "Error"
else :
print ",OK"
theView.DisplayOnly(aPrsObj)
theView.FitAll()
- aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TSCALARMAPONDEFORMEDSHAPE." + thePictureExt
+ aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TDEFORMEDSHAPEANDSCALARMAP." + thePictureExt
aPictureName = re.sub("\s+","_", aPictureName)
theView.SavePicture(aPictureName)
if theIsAutoDelete :
PRS3D_TYPE_LIST.append(VISU.TVECTORS)
PRS3D_TYPE_LIST.append(VISU.TSTREAMLINES)
PRS3D_TYPE_LIST.append(VISU.TSCALARMAPONDEFORMEDSHAPE)
+PRS3D_TYPE_LIST.append(VISU.TDEFORMEDSHAPEANDSCALARMAP)
#---------------------------------------------------------------
anInput.myFieldName = "pression";
WalkTroughTimeStamps(VISU.TGAUSSPOINTS, anInput, aViewManager)
-#execfile('/data/apo/a.py')
\ No newline at end of file
+#execfile('/data/apo/a.py')
--- /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
#include <QSemaphore>
+#include "utilities.h"
+
#include <vtkImageData.h>
#include <vtkImageClip.h>
#include <vtkJPEGWriter.h>
VVTK_ImageWriter
::~VVTK_ImageWriter()
{
- if(MYDEBUG) cout<<"VVTK_ImageWriter::~VVTK_ImageWriter - this = "<<this<<endl;
+ if(MYDEBUG) MESSAGE("VVTK_ImageWriter::~VVTK_ImageWriter - this = "<<this);
}
aWriter->Delete();
myImageData->Delete();
- if(MYDEBUG) cout<<"VVTK_ImageWriter::run "<<
+ if(MYDEBUG) MESSAGE("VVTK_ImageWriter::run "<<
"- this = "<<this<<
//"; total = "<<mySemaphore->total()<<
- "; available = "<<mySemaphore->available()<<endl;
+ "; available = "<<mySemaphore->available() );
mySemaphore->release();
}
#include <QSemaphore>
-#include <limits>
+#include "utilities.h"
+#include <limits>
#ifdef _DEBUG_
static int MYDEBUG = 0;
int aMax = std::numeric_limits<int>::max() / 2;
mySemaphore = new QSemaphore(aMax);
mySemaphore->acquire( aMax );
- if(MYDEBUG) cout<<"VVTK_ImageWriterMgr::VVTK_ImageWriterMgr "<<
+ if(MYDEBUG) MESSAGE("VVTK_ImageWriterMgr::VVTK_ImageWriterMgr "<<
//"- total = "<<mySemaphore->total()<<
- "; available = "<<mySemaphore->available()<<endl;
+ "; available = "<<mySemaphore->available() );
}
VVTK_ImageWriterMgr
::Stop()
{
- if(MYDEBUG) cout<<"VVTK_ImageWriterMgr::Stop "<<
+ if(MYDEBUG) MESSAGE("VVTK_ImageWriterMgr::Stop "<<
//"- total = "<<mySemaphore->total()<<
- "; available = "<<mySemaphore->available()<<endl;
- if(MYDEBUG) cout<<"VVTK_ImageWriterMgr::Stop - *mySemaphore += "<<myThreads.size()<<endl;
+ "; available = "<<mySemaphore->available() );
+ if(MYDEBUG) MESSAGE("VVTK_ImageWriterMgr::Stop - *mySemaphore += "<<myThreads.size() );
mySemaphore->acquire( myThreads.size() );
for(size_t anId = 0, anEnd = myThreads.size(); anId < anEnd; anId++){
void VVTK_PickingDlg::Update()
{
- float aCursorSize = 0.5;
- float aPyramidHeight = 10.0;
- float aPointTolerance = 0.1;
- QColor aColor = Qt::yellow;
- int anInfoWindowTransparency = 50;
- int anInfoWindowPosition = VISU_PickingSettings::BelowPoint;
- float aZoomFactor = 1.5;
- int aStepNumber = 10;
- bool aDisplayParentMesh = false;
-
- if( !myPickingSettings->GetInitial() )
- {
- myCursorSizeSpinBox->setValue( myPickingSettings->GetCursorSize() );
- myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() );
- myPointToleranceSpinBox->setValue( myPickingSettings->GetPointTolerance() );
- myTransparencySpinBox->setValue( int(myPickingSettings->GetInfoWindowTransparency() * 100.0) );
- myPositionComboBox->setCurrentIndex( myPickingSettings->GetInfoWindowPosition() );
- myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() );
- myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() );
- myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() );
-
- vtkFloatingPointType* aColor = myPickingSettings->GetColor();
-
- //QPalette aPalette( mySelectionColorButton->palette() );
- /*aPalette.setColor( mySelectionColorButton->backgroundRole(),
- QColor( ( int )( aColor[0] * 255.0 ),
- ( int )( aColor[1] * 255.0 ),
- ( int )( aColor[2] * 255.0 ) ) );
- mySelectionColorButton->setPalette( aPalette );*/
- mySelectionColorButton->setColor(
- QColor( ( int )( aColor[0] * 255.0 ),
- ( int )( aColor[1] * 255.0 ),
- ( int )( aColor[2] * 255.0 ) ) );
-
- return;
- }
-
- SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
-
- aCursorSize = aResourceMgr->doubleValue( "VISU", "picking_cursor_size", aCursorSize );
- myCursorSizeSpinBox->setValue( aCursorSize );
-
- aPyramidHeight = aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", aPyramidHeight );
- myPyramidHeightSpinBox->setValue( aPyramidHeight );
-
- aPointTolerance = aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", aPointTolerance );
- myPointToleranceSpinBox->setValue( aPointTolerance );
-
- aColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", aColor );
- //QPalette aPalette( mySelectionColorButton->palette() );
- //aPalette.setColor( mySelectionColorButton->backgroundRole(), aColor );
- mySelectionColorButton->setColor( aColor );
-
- anInfoWindowTransparency = aResourceMgr->integerValue( "VISU", "picking_transparency", anInfoWindowTransparency );
- myTransparencySpinBox->setValue( anInfoWindowTransparency );
-
- anInfoWindowPosition = aResourceMgr->integerValue( "VISU", "picking_position", anInfoWindowPosition );
- myPositionComboBox->setCurrentIndex( anInfoWindowPosition );
-
- aZoomFactor = aResourceMgr->doubleValue( "VISU", "picking_zoom_factor", aZoomFactor );
- myZoomFactorSpinBox->setValue( aZoomFactor );
-
- aStepNumber = aResourceMgr->integerValue( "VISU", "picking_step_number", aStepNumber );
- myStepNumberSpinBox->setValue( aStepNumber );
-
- aDisplayParentMesh = aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", aDisplayParentMesh );
- myDisplayParentMeshCheckBox->setChecked( aDisplayParentMesh );
-
+ myCursorSizeSpinBox->setValue( myPickingSettings->GetCursorSize() );
+ myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() );
+ myPointToleranceSpinBox->setValue( myPickingSettings->GetPointTolerance() );
+ myTransparencySpinBox->setValue( int(myPickingSettings->GetInfoWindowTransparency() * 100.0) );
+ myPositionComboBox->setCurrentIndex( myPickingSettings->GetInfoWindowPosition() );
+ myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() );
+ myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() );
+ myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() );
+
+ vtkFloatingPointType* aColor = myPickingSettings->GetColor();
+ mySelectionColorButton->setColor( QColor( ( int )( aColor[0] * 255.0 ),
+ ( int )( aColor[1] * 255.0 ),
+ ( int )( aColor[2] * 255.0 ) ) );
onClickApply();
}
void VVTK_PickingDlg::onClickApply()
{
- myPickingSettings->SetInitial( false );
-
myPickingSettings->SetCursorSize( myCursorSizeSpinBox->value() );
myPickingSettings->SetPyramidHeight( myPyramidHeightSpinBox->value() );
myPickingSettings->SetPointTolerance( myPointToleranceSpinBox->value() );
myPaused = myPaused ? 0 : 1;
if(myPaused && !myFrameIndexes.empty()){
myFrameIndexes.back() *= -1;
- if(MYDEBUG) cout<<"VVTK_Recorder::Pause - myFrameIndexes.back() = "<<myFrameIndexes.back()<<endl;
+ if(MYDEBUG) MESSAGE("VVTK_Recorder::Pause - myFrameIndexes.back() = "<<myFrameIndexes.back());
}
}
myFrameIndexes.back() = abs(myFrameIndexes.back());
double aPauseTime = fabs((double)(aFrameIndex - myFrameIndex - 1)) / myNbFPS;
if(MYDEBUG)
- cout<<"VVTK_Recorder::DoRecord - aFrameIndex = "<<aFrameIndex<<
- "; aPauseTime = "<<aPauseTime<<endl;
+ MESSAGE("VVTK_Recorder::DoRecord - aFrameIndex = "<<aFrameIndex<<
+ "; aPauseTime = "<<aPauseTime);
myTimeStart += aPauseTime;
}
}
myFrameIndexes.push_back(myFrameIndex);
- if(MYDEBUG) cout<<"VVTK_Recorder::DoRecord - myFrameIndex = "<<myFrameIndex<<endl;
+ if(MYDEBUG) MESSAGE("VVTK_Recorder::DoRecord - myFrameIndex = "<<myFrameIndex);
myRenderWindow->RemoveObserver(myCommand);
myFilter->Modified();
}
std::string aString(aStream.str());
system(aString.c_str());
- if(MYDEBUG) cout<<"VVTK_Recorder::AddSkippedFrames - "<<aString<<endl;
+ if(MYDEBUG) MESSAGE("VVTK_Recorder::AddSkippedFrames - "<<aString);
}
}
std::string aString(aStream.str());
myErrorStatus = system(aString.c_str());
- if(MYDEBUG) cout<<"VVTK_Recorder::MakeFileAVI - "<<aString<<endl;
+ if(MYDEBUG) MESSAGE("VVTK_Recorder::MakeFileAVI - "<<aString);
QFileInfo aFileInfo(myName.c_str());
QString aDirPath = aFileInfo.absoluteDir().path();
aCommand =
QString("rm ") + aDirPath + "/" + aBaseName + "*.jpeg";
- if(MYDEBUG) cout<<"VVTK_Recorder::MakeFileAVI - "<<(const char*)aCommand.toLatin1()<<endl;
+ if(MYDEBUG) MESSAGE("VVTK_Recorder::MakeFileAVI - "<<aCommand.toLatin1().data() );
system((const char*)aCommand.toLatin1());
}