//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-
// File : VISU_Gen.idl
// Author : Alexey Petrov
-//
+
/*! \file VISU_Gen.idl This file conatins a set of interfaces of the %VISU module.
* This module provides various forms of data visualization in %SALOME application.
* These forms include data tables, XY plots, 3d representations
* of the scaling, which can be applied on different presentations.
*/
enum Scaling{ LINEAR, /*!< Linear type of scaling. */
- LOGARITHMIC /*!< Logarithmic type of scaling. */
- };
+ LOGARITHMIC /*!< Logarithmic type of scaling. */
+ };
/*!
* This enumeration contains a set of elements defining
boolean isAuto;
string name;
};
-
+
interface Base {
/*!
* Returns ID of the object.
* which the curve is constructed on the graphics.
*/
enum MarkerType { NONE,
- CIRCLE,
- RECTANGLE,
- DIAMOND,
- DTRIANGLE,
- UTRIANGLE,
- LTRIANGLE,
- RTRIANGLE,
- CROSS,
- XCROSS
+ CIRCLE,
+ RECTANGLE,
+ DIAMOND,
+ DTRIANGLE,
+ UTRIANGLE,
+ LTRIANGLE,
+ RTRIANGLE,
+ CROSS,
+ XCROSS
};
/*!
*
* This is a root class for all 3D presentations, which can be displayed in %VISU module.
*/
- interface Prs3d : PrsObject, SALOME::GenericObj
+ interface Prs3d : PrsObject, SALOME::GenericObj
{
/*!
* Move the 3D presentation according to the given offset parameters
* type of presentation of the mesh.
*/
enum PresentationType{ POINT,
- WIREFRAME,
- SHADED,
- INSIDEFRAME,
- SURFACEFRAME,
- FEATURE_EDGES,
- SHRINK
+ WIREFRAME,
+ SHADED,
+ INSIDEFRAME,
+ SURFACEFRAME,
+ FEATURE_EDGES,
+ SHRINK
};
/*!
/*!
* Sets the type of representation of a 2D quadratic mesh elements.
* \param theType The type of representation of 2D quadratic mesh elements.
- * This parameter is taken from
- * <VAR>Quadratic2DPresentationType</VAR> enumeration.
+ * This parameter is taken from
+ * <VAR>Quadratic2DPresentationType</VAR> enumeration.
*/
void SetQuadratic2DPresentationType(in Quadratic2DPresentationType theType);
* \return The type of representation of the 2D quadratic mesh elements.
*/
Quadratic2DPresentationType GetQuadratic2DPresentationType();
-
+
/*!
* Switches shrink mode of presentation
* Note: SetPresentationType(SHRINK) is same as SetShrink(True)
/*!
* Gets the min boundary of the scalar bar from source data.
*/
- double GetSourceMin();
+ double GetSourceMin();
/*!
* Gets the max boundary of the scalar bar from source data.
*/
long GetScalarMode();
- /*!
+ /*!
* Set the visibility of a distribution curve.
* \param theIs is used to switch on/off the visibility of a distribution curve.
*/
* \param theGroupName - group name
*/
void AddMeshOnGroup(in string theGroupName);
-
+
/*!
* PrsMerger method:
* Remove all groups.(The scalar map will be placed on all mesh).
* Apply input parameters to last visited presentation in the cache.
*/
boolean Apply(in ColoredPrs3d thePrs3d,
- in BasicInput theInput,
- in View3D theView3D);
+ in BasicInput theInput,
+ in View3D theView3D);
/*!
* Gets the last visited presentation in the cache.
*/
VISUType GetPrsType();
- /*! Defines timestamp representation.
+ /*! Defines timestamp representation.
*/
struct TimeStampInfo
{
long myNumber;
};
- /*! Defines representation range of timestamps.
+ /*! Defines representation range of timestamps.
*/
typedef sequence<TimeStampInfo> TimeStampsRange;
/*! Creates %ColoredPrs3dHolder.*/
ColoredPrs3dHolder CreateHolder(in VISUType theType,
- in ColoredPrs3dHolder::BasicInput theInput);
+ in ColoredPrs3dHolder::BasicInput theInput);
/*! Gets a memory which is required to create a holder. */
EnlargeType GetRequiredMemory(in VISUType theType,
- in ColoredPrs3dHolder::BasicInput theInput,
- out float theRequiredMemory);
+ in ColoredPrs3dHolder::BasicInput theInput,
+ out float theRequiredMemory);
};
* bar is displayed along with each colored field presentation and serves for
* consulting the correspondance between colors and data values.
*/
-
+
interface ScaledPrs3d {
/*!
* Sets the type of scaling of the values reflected by the scalar bar.
* Presentation parameters of the Gauss Points presentation.
*/
//-------------------------------------------------------
- interface GaussPoints : ColoredPrs3d
+ interface GaussPoints : ColoredPrs3d
{
//! Set flag indicating which scalar bar is active.
void SetIsActiveLocalScalarBar(in boolean theFlag);
//! Get value of the distance between global and local scalar bars.
double GetSpacing();
-
+
/*!
* Returns visibility state of scalar bar
*/
*/
void SetBarVisible(in boolean theVisible);
- /*!
+ /*!
* Set the Multicolored mode.
* \param theIsColored is used to switch between Results and Geometry modes.
* Multiple colors are using when the presentation is
/*!
* This enumeration contains a set of elements defining the type of representation of the vector head.
*/
- enum PrimitiveType {
+ enum PrimitiveType {
SPRITE,
POINT,
SPHERE
//! Defines how many faces of can be drawn in the Geometrical Sphere primitive mode
long GetFaceLimit();
-
-
+
+
};
*
* Presentation parameters of the deformed shape presentation.
*/
- interface DeformedShape : MonoColorPrs
+ interface DeformedShape : MonoColorPrs
{
/*!
* Sets the scale of the presentatable object.
* \param theFieldName - the name of vectorial field
*/
void SetVectorialField(in Entity theEntity,
- in string theFieldName);
+ in string theFieldName);
/*!
* Get vectorial entity
* Get scalar field name
*/
string GetVectorialFieldName();
-
+
};
//-------------------------------------------------------
* Presentation parameters of the scalar map on deformed shape presentation.
*/
interface DeformedShapeAndScalarMap : ScalarMap {
-
+
/*!
* Sets the scale of the presentatable object.
* \param theScale Double value defining the scale of this presentable object.
* \param theTimeStampNumber - the timestamp number for the scalar field
*/
void SetScalarField(in Entity theEntity,
- in string theFieldName,
- in long theTimeStampNumber);
+ in string theFieldName,
+ in long theTimeStampNumber);
/*!
* the type of orientation in 3D space of the cutting plane.
*/
enum Orientation { XY, /*!< The object is located in the plane formed by X and Y axis. */
- YZ, /*!< The object is located in the plane formed by Y and Z axis. */
- ZX }; /*!< The object is located in the plane formed by Z and X axis. */
+ YZ, /*!< The object is located in the plane formed by Y and Z axis. */
+ ZX }; /*!< The object is located in the plane formed by Z and X axis. */
/*!
* Sets the orientation in 3D space of cutting plane for the presentation.
* \param theIsRelative Define, whether the input position is relative.
*/
void SetPlanePosition (in double thePlanePosition,
- in boolean theIsRelative);
+ in boolean theIsRelative);
/*!
* Gets the position of the cutting plane
*/
enum Orientation {XY, /*!< The object is located in the plane formed by X and Y axis. */
YZ, /*!< The object is located in the plane formed by Y and Z axis. */
- ZX}; /*!< The object is located in the plane formed by Z and X axis. */
+ ZX}; /*!< The object is located in the plane formed by Z and X axis. */
/*!
* Sets the type of orientation in 3D space of cut planes presentation.
* for definition of direction of the stream lines.
*/
enum Direction{ FORWARD,
- BACKWARD,
- BOTH
+ BACKWARD,
+ BOTH
};
/*! Sets the parameters of the stream lines presentation.
* \return True if all parameters are properly set.
*/
boolean SetParams(in double theIntStep,
- in double thePropogationTime,
- in double theStepLength,
- in Prs3d thePrs3d,
- in double thePercents,
- in Direction theDirection);
+ in double thePropogationTime,
+ in double theStepLength,
+ in Prs3d thePrs3d,
+ in double thePercents,
+ in Direction theDirection);
/*! Gets the value of integration step of the stream lines presentation.
*/
* <BR><B>Time stamp</B> represents a subfield: the results
* of calculations are taken in one definite moment.
*/
- interface Animation : Base
+ interface Animation : Base
{
/*!
* This enumeration contains a set of available animation modes.
*/
enum AnimationMode{ PARALLEL, /*!< parallel mode of animation. */
- SUCCESSIVE /*!< succcessive mode of animation. */
+ SUCCESSIVE /*!< succcessive mode of animation. */
};
-
+
/*! Defines the field which will be used as a base for generation of the animation.
* \param theObject The %SObject corresponding to the field.
*/
void restoreFromStudy(in SALOMEDS::SObject theSObj);
boolean isSavedInStudy();
-
+
/*!
* Sets the animation mode.
* \param theMode The value of this parameter is taken from the <VAR>AnimationMode</VAR> enumeration.
raises (SALOME::SALOME_Exception);
};
-
+
//-------------------------------------------------------
interface XYPlot;
/*! \brief Interface %Evolution
*
*/
- interface Evolution : Base
+ interface Evolution : Base
{
/*!
* Defines the field which will be used as a base for generation of the evolution.
* in other sources (MED object or file). This data is needed
* for further construction of graphical presentations.
*/
- interface Result : RemovableObject, SALOME::GenericObj
+ interface Result : RemovableObject, SALOME::GenericObj
{
/*! Reads all data from the corresponding sources. By default the data is loaded on demand.
*/
long GetNumberOfComponents(in EntityName theMeshName, in Entity theEntity, in EntityName theFieldName);
/*! Gets existing numbers of time stamps for the given mesh name, entity and name of field */
- TimeStampNumbers GetTimeStampNumbers(in EntityName theMeshName, in Entity theEntity, in EntityName theFieldName);
+ TimeStampNumbers GetTimeStampNumbers(in EntityName theMeshName, in Entity theEntity,
+ in EntityName theFieldName);
/*! Gets time values of time stamps for the given mesh name, entity and name of field */
double_array GetTimeStampValues(in EntityName theMeshName, in Entity theEntity, in EntityName theFieldName);
/*! Gets current resolution of multi resolution structure for the given mesh and part names */
void SetResolution(in EntityName theMeshName, in EntityName thePartName, in Resolution theResolution);
-
+
/*! Gets information about imported MED file */
SALOME_MED::MedFileInfo GetMEDFileInfo();
* post-processing presentations from given %Result and %Table object reference,
* using the views provided by %ViewManager.
*/
- interface VISU_Gen : Engines::Component, SALOMEDS::Driver, Base
+ interface VISU_Gen : Engines::EngineComponent, SALOMEDS::Driver, Base
{
/*! Sets a definite study to be current.
*/
* \param theNewName Name to be given to the study object.
*/
void RenameEntityInStudy(in Result theResult,
- in string theMeshName,
- in Entity theEntity,
- in string theNewName);
+ in string theMeshName,
+ in Entity theEntity,
+ in string theNewName);
void RenameFamilyInStudy(in Result theResult,
- in string theMeshName,
- in Entity theEntity,
- in string theSubMeshName,
- in string theNewName);
+ in string theMeshName,
+ in Entity theEntity,
+ in string theSubMeshName,
+ in string theNewName);
void RenameGroupInStudy(in Result theResult,
- in string theMeshName,
- in string theSubMeshName,
- in string theNewName);
+ in string theMeshName,
+ in string theSubMeshName,
+ in string theNewName);
/*!
* Creates a mesh on the basis of the data generated in other sources (MED object or file).
* \param theEntity Type of entity where the field is defined.
*/
Mesh FamilyMeshOnEntity(in Result theResult, in string theMeshName,
- in Entity theEntity, in string theFamilyName);
+ in Entity theEntity, in string theFamilyName);
/*!
* Creates a mesh on the basis of a group of families.
* \param theTimeStampNumber Number of iteration on the field
*/
ScalarMap ScalarMapOnField(in Result theResult, in string theMeshName,
- in Entity theEntity, in string theFieldName,
- in long theTimeStampNumber);
+ in Entity theEntity, in string theFieldName,
+ in long theTimeStampNumber);
/*!
* Creates a Gauss Points presentation.
* \param theTimeStampNumber Number of iteration on the field
*/
GaussPoints GaussPointsOnField(in Result theResult, in string theMeshName,
- in Entity theEntity, in string theFieldName,
- in long theTimeStampNumber);
+ in Entity theEntity, in string theFieldName,
+ in long theTimeStampNumber);
/*!
* Creates a deformed shape presentation.
* \param theTimeStampNumber Number of iteration on the field
*/
DeformedShape DeformedShapeOnField(in Result theResult, in string theMeshName,
- in Entity theEntity, in string theFieldName,
- in long theTimeStampNumber);
+ in Entity theEntity, in string theFieldName,
+ in long theTimeStampNumber);
/*!
* Creates a deformed shape presentation. This function is obsolete. Use DeformedShapeAndScalarMapOnField instead.
* \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);
+ in Entity theEntity, in string theFieldName,
+ in long theTimeStampNumber);
/*!
* Creates a deformed shape presentation.
* \param theTimeStampNumber Number of iteration on the field
*/
DeformedShapeAndScalarMap DeformedShapeAndScalarMapOnField(in Result theResult, in string theMeshName,
- in Entity theEntity, in string theFieldName,
- in long theTimeStampNumber);
+ in Entity theEntity, in string theFieldName,
+ in long theTimeStampNumber);
/*!
* Creates a vector presentation.
* \param theTimeStampNumber Number of iteration on the field
*/
Vectors VectorsOnField(in Result theResult, in string theMeshName,
- in Entity theEntity, in string theFieldName,
- in long theTimeStampNumber);
+ in Entity theEntity, in string theFieldName,
+ in long theTimeStampNumber);
/*!
* Creates an iso surface presentation.
* \param theTimeStampNumber Number of iteration on the field
*/
IsoSurfaces IsoSurfacesOnField(in Result theResult, in string theMeshName,
- in Entity theEntity, in string theFieldName,
- in long theTimeStampNumber);
+ in Entity theEntity, in string theFieldName,
+ in long theTimeStampNumber);
/*!
* Creates an stream lines presentation.
* \param theTimeStampNumber Number of iteration on the field
*/
StreamLines StreamLinesOnField(in Result theResult, in string theMeshName,
- in Entity theEntity, in string theFieldName,
- in long theTimeStampNumber);
+ in Entity theEntity, in string theFieldName,
+ in long theTimeStampNumber);
/*!
* Creates a presentation of cut planes.
* \param theTimeStampNumber Number of iteration on the field
*/
CutPlanes CutPlanesOnField(in Result theResult, in string theMeshName,
- in Entity theEntity, in string theFieldName,
- in long theTimeStampNumber);
+ in Entity theEntity, in string theFieldName,
+ in long theTimeStampNumber);
/*!
* Creates a presentation of cut lines.
* \param theTimeStampNumber Number of iteration on the field
*/
CutLines CutLinesOnField(in Result theResult, in string theMeshName,
- in Entity theEntity, in string theFieldName,
- in long theTimeStampNumber);
+ in Entity theEntity, in string theFieldName,
+ in long theTimeStampNumber);
/*!
* Creates a presentation of cut segment.
* \param theTimeStampNumber Number of iteration on the field
*/
CutSegment CutSegmentOnField(in Result theResult, in string theMeshName,
- in Entity theEntity, in string theFieldName,
- in long theTimeStampNumber);
+ in Entity theEntity, in string theFieldName,
+ in long theTimeStampNumber);
/*!
* Creates a Plot3D presentation.
* \param theTimeStampNumber Number of iteration on the field
*/
Plot3D Plot3DOnField(in Result theResult, in string theMeshName,
- in Entity theEntity, in string theFieldName,
- in long theTimeStampNumber);
+ in Entity theEntity, in string theFieldName,
+ in long theTimeStampNumber);
/*!
* Creates a table presentation.
* \param theVRow Index of the row in the table: ordinate of the point.
*/
Curve CreateCurve(in Table theTable, in long theHRow, in long theVRow);
-
+
/*!
* Creates a curve on the basis of points, whose values are taken from the table.
- * Each point has also assigned value, that will be shown as tooltip in Plot2d
+ * Each point has also assigned value, that will be shown as tooltip in Plot2d
* \param theTable Table containing the data for construction of curves.
* \param theHRow Index of the row in the table: abscissa of the point.
* \param theVRow Index of the row in the table: ordinate of the point.
* \param theZRow Index of the row in the table: assigned value (so-called as Z).
- */
+ */
Curve CreateCurveWithZ( in Table theTable, in long theHRow, in long theVRow, in long theZRow );
/*!
* \param theVRow Index of the row in the table: ordinate of the point.
* \param theZRow Index of the row in the table: assigned value (so-called as Z).
* \param theIsV2 Flag allowed to display the curve using right axis of Plot2d view.
- */
+ */
Curve CreateCurveWithZExt( in Table theTable, in long theHRow, in long theVRow, in long theZRow,
in boolean theIsV2 );
*/
ColoredPrs3dCache GetColoredPrs3dCache(in SALOMEDS::Study theStudy);
-
+
/* Clipping planes management */
- /*Create a clipping plane and return its ID (position in corresponded array)
+ /*Create a clipping plane and return its ID (position in corresponded array)
Id of clipping plane could be changed after deletion of other clipping plane
*/
- long CreateClippingPlane(in double X, in double Y, in double Z,
- in double dX, in double dY, in double dZ,
- in boolean auto, in string name);
-
- void EditClippingPlane(in long id, in double X, in double Y, in double Z,
- in double dX, in double dY, in double dZ,
- in boolean auto, in string name);
-
+ long CreateClippingPlane(in double X, in double Y, in double Z,
+ in double dX, in double dY, in double dZ,
+ in boolean auto, in string name);
+
+ void EditClippingPlane(in long id, in double X, in double Y, in double Z,
+ in double dX, in double dY, in double dZ,
+ in boolean auto, in string name);
+
/* Returns clipping plane by its Id */
ClippingPlane GetClippingPlane(in long id);
-
+
/* Deletes clipping plane by its Id */
boolean DeleteClippingPlane(in long id);
-
+
/* Applyes a clipping plane with Id to presentation thePrs */
boolean ApplyClippingPlane(in Prs3d thePrs, in long id);
/* Detaches a clipping plane with Id from presentation thePrs */
boolean DetachClippingPlane(in Prs3d thePrs, in long id);
-
-
+
+
/* Get number of clipping planes */
long GetClippingPlanesNb();
* the following types: 3d, Table, XY plot.
* %View interface is a base for all types of %view interfaces.
*/
- interface View: Base, SALOME::GenericObj
+ interface View: Base, SALOME::GenericObj
{
/*! \brief %ViewRepresentation enumeration
*
string SetPresentationType(in ScalarMap thePrs, in PresentationType thePrsType);
- /*! Set representation type of 2D quadratic elements
+ /*! Set representation type of 2D quadratic elements
* of the given presentation in this view.
* \param thePrs Object to set a representation type of 2D quadratic elements.
* \param theType Representation type of 2D quadratic elements to be set to the given object.
/*! Get representation type of the 2D quadratic mesh elements of given presentation in this view.
* \param thePrs Object to get a representation type of 2D quadratic mesh elements.
- * \return <VAR>Quadratic2DPresentationType</VAR> Representation type of 2D quadratic mesh elements
+ * \return <VAR>Quadratic2DPresentationType</VAR> Representation type of 2D quadratic mesh elements
* in this view.
- */
+ */
Quadratic2DPresentationType GetQuadratic2DPresentationType(in ScalarMap thePrs);
-
+
/*! Get shrink state of the given presentation in this view.
* \param thePrs Object to get a shrink state of.
/*! Set range of the 2D plot to XY axis of the 2D viewer.
*/
void FitRange(in double xMin, in double xMax,
- in double yMin, in double yMax);
+ in double yMin, in double yMax);
void GetFitRanges(out double xMin,out double xMax,
- out double yMin,out double yMax);
+ out double yMin,out double yMax);
};
//-------------------------------------------------------
// 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_Engine_i.hh"
#include "utilities.h"
extern "C" {
VISU_ENGINE_EXPORT
- PortableServer::ObjectId *
+ PortableServer::ObjectId *
VISUEngine_factory(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId,
- const char *instanceName, const char *interfaceName)
+ const char *instanceName, const char *interfaceName)
{
MESSAGE("VisuEngine_factory : "<<interfaceName);
// Check session: MZN: 24.11.2006 PAL 13948
SALOME::Session_var aSession = SALOME::Session::_narrow(anObject);
if (CORBA::is_nil(aSession))
return NULL;
-
+
VISU::VISU_Gen_i * pVISU_Gen = new VISU::VISU_Gen_i(aSession, orb, poa, contId, instanceName, interfaceName);
return pVISU_Gen->getId() ;
}
namespace VISU{
//===========================================================================
VISU_Gen_i::VISU_Gen_i(SALOME::Session_ptr session,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
- const char *instanceName,
- const char *interfaceName) :
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName) :
Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
{
_thisObj = this ;
_id = _poa->activate_object(_thisObj);
#ifndef WIN32
- Engines::Component_var aComponent = session->GetComponent("libVISUEngineImpl.so");
+ Engines::EngineComponent_var aComponent = session->GetComponent("libVISUEngineImpl.so");
#else
- Engines::Component_var aComponent = session->GetComponent("VISUEngineImpl.dll");
+ Engines::EngineComponent_var aComponent = session->GetComponent("VISUEngineImpl.dll");
#endif
myVisuGen = VISU::VISU_Gen::_narrow(aComponent);
- }
+ }
VISU_Gen_i::~VISU_Gen_i(){
if(MYDEBUG) MESSAGE("VISU_Gen_i::~VISU_Gen_i");
//===========================================================================
bool VISU_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
- const SALOMEDS::TMPFile & theStream,
- const char* theURL,
- bool isMultiFile)
+ const SALOMEDS::TMPFile & theStream,
+ const char* theURL,
+ bool isMultiFile)
{
return myVisuGen->Load(theComponent,theStream,theURL,isMultiFile);
}
bool VISU_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
- const SALOMEDS::TMPFile & theStream,
- const char* theURL,
- bool isMultiFile)
+ const SALOMEDS::TMPFile & theStream,
+ const char* theURL,
+ bool isMultiFile)
{
return Load(theComponent, theStream, theURL, isMultiFile);
}
char* VISU_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
- const char* aLocalPersistentID,
- CORBA::Boolean isMultiFile,
- CORBA::Boolean isASCII)
+ const char* aLocalPersistentID,
+ CORBA::Boolean isMultiFile,
+ CORBA::Boolean isASCII)
{
return myVisuGen->LocalPersistentIDToIOR(theSObject, aLocalPersistentID, isMultiFile, isASCII);
}
//===========================================================================
SALOMEDS::TMPFile* VISU_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
- const char* theURL,
- bool isMultiFile)
+ const char* theURL,
+ bool isMultiFile)
{
return myVisuGen->Save(theComponent,theURL,isMultiFile);
}
SALOMEDS::TMPFile* VISU_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent,
- const char* theURL,
- bool isMultiFile)
+ const char* theURL,
+ bool isMultiFile)
{
return myVisuGen->Save(theComponent,theURL,isMultiFile);
}
char* VISU_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
- const char* IORString,
- CORBA::Boolean isMultiFile,
- CORBA::Boolean isASCII)
+ const char* IORString,
+ CORBA::Boolean isMultiFile,
+ CORBA::Boolean isASCII)
{
return myVisuGen->IORToLocalPersistentID(theSObject, IORString, isMultiFile, isASCII);
}
CORBA::Boolean VISU_Gen_i::ExportTableToFile(SALOMEDS::SObject_ptr theTable,
- const char* theFileName)
+ const char* theFileName)
{
return myVisuGen->ExportTableToFile(theTable, theFileName);
}
}
- Mesh_ptr VISU_Gen_i::MeshOnEntity(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity)
+ Mesh_ptr VISU_Gen_i::MeshOnEntity(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity)
{
return myVisuGen->MeshOnEntity(theResult,theMeshName,theEntity);
}
- Mesh_ptr VISU_Gen_i::FamilyMeshOnEntity(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFamilyName)
+ Mesh_ptr VISU_Gen_i::FamilyMeshOnEntity(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFamilyName)
{
return myVisuGen->FamilyMeshOnEntity(theResult,theMeshName,theEntity,theFamilyName);
}
- Mesh_ptr VISU_Gen_i::GroupMesh(Result_ptr theResult,
- const char* theMeshName,
- const char* theGroupName)
+ Mesh_ptr VISU_Gen_i::GroupMesh(Result_ptr theResult,
+ const char* theMeshName,
+ const char* theGroupName)
{
return myVisuGen->GroupMesh(theResult,theMeshName,theGroupName);
}
- void VISU_Gen_i::RenameEntityInStudy(Result_ptr theResult, const char* theMeshName,
- VISU::Entity theEntity, const char* theNewName)
+ void VISU_Gen_i::RenameEntityInStudy(Result_ptr theResult, const char* theMeshName,
+ VISU::Entity theEntity, const char* theNewName)
{
myVisuGen->RenameEntityInStudy(theResult,theMeshName,theEntity,theNewName);
}
- void VISU_Gen_i::RenameFamilyInStudy(Result_ptr theResult, const char* theMeshName,
- VISU::Entity theEntity, const char* theFamilyName,
- const char* theNewName)
+ void VISU_Gen_i::RenameFamilyInStudy(Result_ptr theResult, const char* theMeshName,
+ VISU::Entity theEntity, const char* theFamilyName,
+ const char* theNewName)
{
myVisuGen->RenameFamilyInStudy(theResult,theMeshName,theEntity,theFamilyName,theNewName);
}
- void VISU_Gen_i::RenameGroupInStudy(Result_ptr theResult, const char* theMeshName,
- const char* theGroupName, const char* theNewName)
+ void VISU_Gen_i::RenameGroupInStudy(Result_ptr theResult, const char* theMeshName,
+ const char* theGroupName, const char* theNewName)
{
myVisuGen->RenameGroupInStudy(theResult,theMeshName,theGroupName,theNewName);
}
ScalarMap_ptr
VISU_Gen_i
- ::ScalarMapOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ ::ScalarMapOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return myVisuGen->ScalarMapOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
- GaussPoints_ptr
+ GaussPoints_ptr
VISU_Gen_i
- ::GaussPointsOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ ::GaussPointsOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return myVisuGen->GaussPointsOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
- DeformedShape_ptr
+ DeformedShape_ptr
VISU_Gen_i
- ::DeformedShapeOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ ::DeformedShapeOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return myVisuGen->DeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
- DeformedShapeAndScalarMap_ptr
+ DeformedShapeAndScalarMap_ptr
VISU_Gen_i
- ::ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ ::ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return DeformedShapeAndScalarMapOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
- DeformedShapeAndScalarMap_ptr
+ DeformedShapeAndScalarMap_ptr
VISU_Gen_i
- ::DeformedShapeAndScalarMapOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ ::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
+ Vectors_ptr
VISU_Gen_i
- ::VectorsOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ ::VectorsOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return myVisuGen->VectorsOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
- IsoSurfaces_ptr
+ IsoSurfaces_ptr
VISU_Gen_i
- ::IsoSurfacesOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ ::IsoSurfacesOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return myVisuGen->IsoSurfacesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
- StreamLines_ptr
+ StreamLines_ptr
VISU_Gen_i
- ::StreamLinesOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ ::StreamLinesOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return myVisuGen->StreamLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
- CutPlanes_ptr
+ CutPlanes_ptr
VISU_Gen_i
- ::CutPlanesOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ ::CutPlanesOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return myVisuGen->CutPlanesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
- CutLines_ptr
+ CutLines_ptr
VISU_Gen_i
- ::CutLinesOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ ::CutLinesOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return myVisuGen->CutLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
- CutSegment_ptr
+ CutSegment_ptr
VISU_Gen_i
- ::CutSegmentOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ ::CutSegmentOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return myVisuGen->CutSegmentOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
- Plot3D_ptr
+ Plot3D_ptr
VISU_Gen_i
- ::Plot3DOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ ::Plot3DOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return myVisuGen->Plot3DOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
}
- Curve_ptr VISU_Gen_i::CreateCurve(Table_ptr theTable,
- CORBA::Long theHRow,
- CORBA::Long theVRow)
+ Curve_ptr VISU_Gen_i::CreateCurve(Table_ptr theTable,
+ CORBA::Long theHRow,
+ CORBA::Long theVRow)
{
return myVisuGen->CreateCurve(theTable,theHRow,theVRow);
}
- Curve_ptr VISU_Gen_i::CreateCurveWithZ(Table_ptr theTable,
- CORBA::Long theHRow,
- CORBA::Long theVRow,
- CORBA::Long theZRow)
+ Curve_ptr VISU_Gen_i::CreateCurveWithZ(Table_ptr theTable,
+ CORBA::Long theHRow,
+ CORBA::Long theVRow,
+ CORBA::Long theZRow)
{
return myVisuGen->CreateCurveWithZ(theTable,theHRow,theVRow,theZRow);
}
SALOMEDS::SObject_ptr VISU_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
- SALOMEDS::SObject_ptr theSObject,
- CORBA::Object_ptr theObject,
- const char* theName)
- throw (SALOME::SALOME_Exception)
+ SALOMEDS::SObject_ptr theSObject,
+ CORBA::Object_ptr theObject,
+ const char* theName)
+ throw (SALOME::SALOME_Exception)
{
return myVisuGen->PublishInStudy(theStudy, theSObject, theObject, theName);
}
-
+
CORBA::Boolean VISU_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) {
return myVisuGen->CanCopy(theObject);
}
-
+
SALOMEDS::TMPFile* VISU_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) {
return myVisuGen->CopyFrom(theObject, theObjectID);
}
-
+
CORBA::Boolean VISU_Gen_i::CanPaste(const char* theComponentName, CORBA::Long theObjectID) {
return myVisuGen->CanPaste(theComponentName, theObjectID);
}
-
+
SALOMEDS::SObject_ptr VISU_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
- CORBA::Long theObjectID,
- SALOMEDS::SObject_ptr theObject)
+ CORBA::Long theObjectID,
+ SALOMEDS::SObject_ptr theObject)
{
return myVisuGen->PasteInto(theStream,theObjectID,theObject);
}
Engines::TMPFile* VISU_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
CORBA::Boolean theIsPublished,
- CORBA::Boolean& theIsValidScript)
+ CORBA::Boolean& theIsValidScript)
{
return myVisuGen->DumpPython(theStudy, theIsPublished, theIsValidScript);
- }
+ }
VISU::ColoredPrs3dCache_ptr
VISU_Gen_i::
- CORBA::Long VISU_Gen_i::CreateClippingPlane(CORBA::Double X,CORBA::Double Y, CORBA::Double Z,
- CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ,
- CORBA::Boolean isAuto, const char* name)
+ CORBA::Long VISU_Gen_i::CreateClippingPlane(CORBA::Double X,CORBA::Double Y, CORBA::Double Z,
+ CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ,
+ CORBA::Boolean isAuto, const char* name)
{
return myVisuGen->CreateClippingPlane(X, Y, Z, dX, dY, dZ, isAuto, name);
}
-
- void VISU_Gen_i::EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double Y, CORBA::Double Z,
- CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ,
- CORBA::Boolean isAuto, const char* name)
+
+ void VISU_Gen_i::EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double Y, CORBA::Double Z,
+ CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ,
+ CORBA::Boolean isAuto, const char* name)
{
myVisuGen->EditClippingPlane(id, X, Y, Z, dX, dY, dZ, isAuto, name);
}
-
+
/* Returns clipping plane by its Id */
VISU::ClippingPlane* VISU_Gen_i::GetClippingPlane(CORBA::Long id)
{
return myVisuGen->GetClippingPlane(id);
}
-
+
/* Deletes clipping plane by its Id */
CORBA::Boolean VISU_Gen_i::DeleteClippingPlane(CORBA::Long id)
{
return myVisuGen->DeleteClippingPlane(id);
}
-
+
/* Applyes a clipping plane with Id to presentation thePrs */
CORBA::Boolean VISU_Gen_i::ApplyClippingPlane(Prs3d_ptr thePrs, CORBA::Long id)
{
return myVisuGen->ApplyClippingPlane(thePrs, id);
}
-
+
CORBA::Boolean VISU_Gen_i::DetachClippingPlane(Prs3d_ptr thePrs, CORBA::Long id)
{
return myVisuGen->DetachClippingPlane(thePrs, id);
}
-
+
/* Get number of clipping planes */
CORBA::Long VISU_Gen_i::GetClippingPlanesNb()
{
const VISU::double_array& theTStamps )
{
return myVisuGen->VTK2MED(theVTKFiles, theMEDFile, theMeshName, theTStamps);
- }
+ }
/* Load texture from file */
CORBA::Long VISU_Gen_i::LoadTexture(const char* theTextureFile)
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// VISU VISUGUI : GUI of VISU component
// File : VisuGUI_Tools.cxx
// Author : Sergey Anikin
// Module : VISU
-//
+
#include "VisuGUI_Tools.h"
#include "VisuGUI_ViewTools.h"
#include "VisuGUI_Prs3dTools.h"
SalomeApp_Study*
GetAppStudy(const CAM_Module* theModule)
{
- return theModule && theModule->application() ?
+ return theModule && theModule->application() ?
dynamic_cast<SalomeApp_Study*>(theModule->application()->activeStudy()) : 0;
}
static VISU_Gen_i* aGen = 0;
if(!aGen){
SALOME_LifeCycleCORBA aLCC(SalomeApp_Application::namingService());
- Engines::Component_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","VISU");
+ Engines::EngineComponent_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","VISU");
VISU_Gen_var aVISU = VISU_Gen::_narrow(aComponent);
if(!CORBA::is_nil(aVISU))
aGen = VISU_Gen_i::GetVisuGenImpl();
}
-
+
if(aGen)
aGen->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(theModule))));
else
static SALOME_MED::MED_Gen_var aGen;
if(CORBA::is_nil(aGen)){
SALOME_LifeCycleCORBA aLCC(SalomeApp_Application::namingService());
- Engines::Component_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","MED");
+ Engines::EngineComponent_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","MED");
aGen = SALOME_MED::MED_Gen::_narrow(aComponent);
}
if(CORBA::is_nil(aGen))
if(VISU::Base_i* aBase = GetServantInterface<VISU::Base_i>(anObject))
anObjectInfo.myBase = aBase;
}
-
+
return anObjectInfo;
}
VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
if(aSelectionInfo.empty())
return false;
-
+
VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
thePrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
if(!thePrs3d)
return false;
-
+
theViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
if(!theViewWindow)
return false;
-
+
thenActor = FindActor(theViewWindow, thePrs3d);
if(!thenActor)
return false;
-
+
return true;
}
}
}
}
- }
-
+ }
+
thePrs->RemoveFromStudy();
-
}
//------------------------------------------------------------
TSelectionItem aSelectionItem = aSelectionInfo.front();
aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
if(!aPrs3d) {
- aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
+ aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
if(!aTable)
return;
}
TSelectionInfo aSelectionInfo = GetSelectedObjects(theModule);
if(aSelectionInfo.empty())
return;
-
+
TSelectionItem aSelectionItem = aSelectionInfo.front();
VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
-
+
if(!aPrs3d || !aViewWindow)
return;
-
+
VISU_Actor *anActor = FindActor(aViewWindow, aPrs3d);
if(!anActor)
return;
-
+
if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
aMesh->SetQuadratic2DPresentationType(theType);
RecreateActor(theModule, aMesh);
}
}
}
-
+
//------------------------------------------------------------
void
SetShading ( const SalomeApp_Module* theModule,
{
if(theSource->Depth() < 3) // Bug of SALOMEDS : can\t get father from root object
return NULL;
-
+
_PTR(SObject) aSObj = theSource->GetFather();
if (!aSObj)
return NULL;
//------------------------------------------------------------
bool
ComputeVisiblePropBounds(SVTK_ViewWindow* theViewWindow,
- vtkFloatingPointType allBounds[6],
+ vtkFloatingPointType allBounds[6],
const char* theActorClassName)
{
vtkRenderer *aRen = theViewWindow->getRenderer();
VTK::ActorCollectionCopy aCopy(aRen->GetActors());
- vtkActorCollection *anActColl = aCopy.GetActors();
+ vtkActorCollection *anActColl = aCopy.GetActors();
vtkProp *prop;
vtkFloatingPointType *bounds;
int somethingVisible = false;
allBounds[1] = allBounds[3] = allBounds[5] = -VTK_LARGE_FLOAT;
// loop through all props
for (anActColl->InitTraversal(); (prop = anActColl->GetNextProp()); ) {
- // if it's invisible, or has no geometry, we can skip the rest
+ // if it's invisible, or has no geometry, we can skip the rest
if (prop->GetVisibility() && prop->IsA(theActorClassName)) {
bounds = prop->GetBounds();
// make sure we haven't got bogus bounds
bounds[4] > -VTK_LARGE_FLOAT && bounds[5] < VTK_LARGE_FLOAT)
{
somethingVisible = true;
- if (bounds[0] < allBounds[0]) allBounds[0] = bounds[0];
- if (bounds[1] > allBounds[1]) allBounds[1] = bounds[1];
- if (bounds[2] < allBounds[2]) allBounds[2] = bounds[2];
- if (bounds[3] > allBounds[3]) allBounds[3] = bounds[3];
- if (bounds[4] < allBounds[4]) allBounds[4] = bounds[4];
- if (bounds[5] > allBounds[5]) allBounds[5] = bounds[5];
+ if (bounds[0] < allBounds[0]) allBounds[0] = bounds[0];
+ if (bounds[1] > allBounds[1]) allBounds[1] = bounds[1];
+ if (bounds[2] < allBounds[2]) allBounds[2] = bounds[2];
+ if (bounds[3] > allBounds[3]) allBounds[3] = bounds[3];
+ if (bounds[4] < allBounds[4]) allBounds[4] = bounds[4];
+ if (bounds[5] > allBounds[5]) allBounds[5] = bounds[5];
}//not bogus
}
}
// implementation moved to VISU_I package (see VISU_Tools.h)
VISU::PlotRemoveCurve( theModule->getApp(), pCrv );
}
-
+
//------------------------------------------------------------
void
PlotContainer(const SalomeApp_Module* theModule,
CreateMesh(VisuGUI* theModule,
const Handle(SALOME_InteractiveObject)& theIO,
SVTK_ViewWindow* theViewWindow)
- {
+ {
_PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule));
//if (CheckLock(aStudy))
// return;
std::set<int>::const_iterator aIter = aIndexes.begin();
for (int i = 1,length = aIndexes.size(); i <= length; i++) {
std::set<int>::const_iterator aIter = aIndexes.find(i);
- if (aIter == aIndexes.end()) { minIndx = i; break; }
+ if (aIter == aIndexes.end()) { minIndx = i; break; }
else minIndx = i + 1;
}
return minIndx;
if (!aFolder) {
_PTR(StudyBuilder) aBuilder = theStudy->NewBuilder();
aFolder = aBuilder->NewObject(aVisuSO);
-
+
_PTR(GenericAttribute) anAttr;
anAttr = aBuilder->FindOrCreateAttribute(aFolder,"AttributeName");
_PTR(AttributeName) aName(anAttr);
}
//------------------------------------------------------------
- void initSpinBox( SalomeApp_IntSpinBox* sb,
- const int bottom,
- const int top,
+ void initSpinBox( SalomeApp_IntSpinBox* sb,
+ const int bottom,
+ const int top,
const int step )
{
sb->setAcceptNames( false );
sb->setRange( bottom, top );
sb->setSingleStep( step );
}
-
+
//------------------------------------------------------------
- void initSpinBox( SalomeApp_DoubleSpinBox* sb,
- const double& bottom,
- const double& top,
- const double& step,
+ void initSpinBox( SalomeApp_DoubleSpinBox* sb,
+ const double& bottom,
+ const double& top,
+ const double& step,
const char* quantity )
{
// Obtain precision from preferences
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int precision = resMgr->integerValue( "VISU", quantity, 3 );
-
- sb->setPrecision ( precision );
+
+ sb->setPrecision ( precision );
sb->setDecimals ( qAbs(precision) );
sb->setRange ( bottom, top );
sb->setSingleStep ( step );
sb->setDefaultValue( bottom );
sb->setAcceptNames ( false );
-
+
// Add a hint for the user saying how to tune precision
QString userPropName = QObject::tr( QString( "VISU_PREF_%1" ).arg( quantity ).toLatin1().constData() );
- sb->setProperty( "validity_tune_hint",
- QVariant( QObject::tr( "VISU_PRECISION_HINT" ).arg( userPropName ) ) );
+ sb->setProperty( "validity_tune_hint",
+ QVariant( QObject::tr( "VISU_PRECISION_HINT" ).arg( userPropName ) ) );
}
}
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// VISU OBJECT : interactive object for VISU entities implementation
// File : VISU_Gen_i.cc
// Author : Alexey PETROV
// Module : VISU
-//
+
#include "VISU_Gen_i.hh"
#include "VISU_Result_i.hh"
#include "VISU_PrsObject_i.hh"
using namespace std;
-extern "C"
+extern "C"
VISU_I_EXPORT VISU::VISU_Gen_ptr
GetImpl(CORBA::ORB_ptr theORB,
- PortableServer::POA_ptr thePOA,
- SALOME_NamingService* theNamingService,
- QMutex* theMutex)
+ PortableServer::POA_ptr thePOA,
+ SALOME_NamingService* theNamingService,
+ QMutex* theMutex)
{
if(MYDEBUG) MESSAGE("extern 'C' GetImpl");
VISU::VISU_Gen_i *aVISU_Gen = new VISU::VISU_Gen_i(theORB,thePOA,theNamingService,theMutex);
static std::string VISU_TMP_DIR;
static CORBA::Boolean myIsMultiFile;
- const CORBA::Boolean IsMultiFile()
- {
+ const CORBA::Boolean IsMultiFile()
+ {
return myIsMultiFile;
}
//----------------------------------------------------------------------------
- _PTR(SComponent)
+ _PTR(SComponent)
ClientFindOrCreateVisuComponent (_PTR(Study) theStudyDocument)
{
_PTR(SComponent) aSComponent = theStudyDocument->FindComponent("VISU");
if (aLocked) theStudyDocument->GetProperties()->SetLocked(false);
aSComponent = aStudyBuilder->NewComponent("VISU");
_PTR(GenericAttribute) anAttr =
- aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeName");
+ aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeName");
_PTR(AttributeName) aName (anAttr);
CORBA::ORB_var anORB = Base_i::GetORB();
SALOME_NamingService *NamingService = new SALOME_NamingService( anORB );
CORBA::Object_var objVarN = NamingService->Resolve("/Kernel/ModulCatalog");
SALOME_ModuleCatalog::ModuleCatalog_var Catalogue =
- SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN);
+ SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN);
SALOME_ModuleCatalog::Acomponent_var Comp = Catalogue->GetComponent( "VISU" );
if (!Comp->_is_nil()) {
- aName->SetValue(Comp->componentusername());
+ aName->SetValue(Comp->componentusername());
}
anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributePixMap");
//----------------------------------------------------------------------------
- SALOMEDS::SComponent_var
+ SALOMEDS::SComponent_var
FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument)
{
SALOMEDS::SComponent_var aSComponent = theStudyDocument->FindComponent("VISU");
SALOME_ModuleCatalog::ModuleCatalog_var Catalogue = SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN);
SALOME_ModuleCatalog::Acomponent_var Comp = Catalogue->GetComponent( "VISU" );
if ( !Comp->_is_nil() ) {
- aName->SetValue( Comp->componentusername() );
+ aName->SetValue( Comp->componentusername() );
}
anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributePixMap");
//----------------------------------------------------------------------------
void
- RegistryStorable()
+ RegistryStorable()
{
Storable::RegistryStorableEngine(Result_i::myComment.c_str(),&(Result_i::StorableEngine));
if(!theFileNames.empty()){
aListOfFileNames->length(theFileNames.size());
for(int aCounter = theFileNames.size(); aCounter > 0; aCounter--)
- aListOfFileNames[aCounter-1] = theFileNames[aCounter-1].c_str();
+ aListOfFileNames[aCounter-1] = theFileNames[aCounter-1].c_str();
}
return aListOfFileNames._retn();
}
VTK::MarkerTexture aMarkerTexture;
if( string( markerGrpName ).substr( 0, 6 ) == string( "Marker" ) ) {
- aTopGroup = new HDFgroup( markerGrpName, aFile );
+ aTopGroup = new HDFgroup( markerGrpName, aFile );
aTopGroup->OpenOnDisk();
aMarkerId = atoi( string( markerGrpName ).substr( 6 ).c_str() );
aDataset->CloseOnDisk();
}
- aTopGroup->CloseOnDisk();
+ aTopGroup->CloseOnDisk();
}
if( aMarkerId > 0 )
//----------------------------------------------------------------------------
VISU_Gen_i
::VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA,
- SALOME_NamingService* theNamingService, QMutex* theMutex) :
+ SALOME_NamingService* theNamingService, QMutex* theMutex) :
Engines_Component_i()
{
if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : "<<theMutex);
Prs3d_ptr
VISU_Gen_i
::CreatePrs3d(VISUType theType,
- SALOMEDS::Study_ptr theStudy)
+ SALOMEDS::Study_ptr theStudy)
{
if(ColoredPrs3d_i* aPrs3d = CreatePrs3d_i(theType, theStudy, ColoredPrs3d_i::EPublishIndependently))
return aPrs3d->_this();
//----------------------------------------------------------------------------
void
- CorrectSObjectType(SALOMEDS::SObject_ptr theSObject,
- SALOMEDS::StudyBuilder_ptr theBuilder)
+ CorrectSObjectType(SALOMEDS::SObject_ptr theSObject,
+ SALOMEDS::StudyBuilder_ptr theBuilder)
{
SALOMEDS::GenericAttribute_var anAttr;
bool isAttrStringFound = false;
if ( isAttrStringFound || theSObject->FindAttribute(anAttr, "AttributeString") ) {
SALOMEDS::AttributeString_var aAttComment = SALOMEDS::AttributeString::_narrow(anAttr);
if ( aAttComment ) {
- CORBA::String_var aValue = aAttComment->Value();
- std::string aString = Storable::CorrectPersistentString(aValue.in());
- aAttComment->SetValue( aString.c_str() );
+ CORBA::String_var aValue = aAttComment->Value();
+ std::string aString = Storable::CorrectPersistentString(aValue.in());
+ aAttComment->SetValue( aString.c_str() );
}
}
}
//----------------------------------------------------------------------------
- CORBA::Boolean
+ CORBA::Boolean
LoadWithMarkerMap(SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile & theStream,
const char* theURL,
for (anIter->InitEx(true); anIter->More(); anIter->Next()) {
SALOMEDS::SObject_var aSObject = anIter->Value();
- CorrectSObjectType(aSObject, aStudyBuilder);
+ CorrectSObjectType(aSObject, aStudyBuilder);
}
VISU_TMP_DIR = theIsMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
//----------------------------------------------------------------------------
- CORBA::Boolean
+ CORBA::Boolean
VISU_Gen_i
::Load(SALOMEDS::SComponent_ptr theComponent,
- const SALOMEDS::TMPFile & theStream,
- const char* theURL,
- CORBA::Boolean theIsMultiFile)
+ const SALOMEDS::TMPFile & theStream,
+ const char* theURL,
+ CORBA::Boolean theIsMultiFile)
{
Mutex mt(myMutex);
return LoadWithMarkerMap(theComponent, theStream, theURL, theIsMultiFile, false, myMarkerMap);
//----------------------------------------------------------------------------
- CORBA::Boolean
+ CORBA::Boolean
VISU_Gen_i
::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
- const SALOMEDS::TMPFile & theStream,
- const char* theURL,
- bool theIsMultiFile)
+ const SALOMEDS::TMPFile & theStream,
+ const char* theURL,
+ bool theIsMultiFile)
{
Mutex mt(myMutex);
return LoadWithMarkerMap(theComponent, theStream, theURL, theIsMultiFile, true, myMarkerMap);
//----------------------------------------------------------------------------
- char*
+ char*
VISU_Gen_i
::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
- const char* theLocalPersistentID,
- CORBA::Boolean theIsMultiFile,
- CORBA::Boolean theIsASCII)
+ const char* theLocalPersistentID,
+ CORBA::Boolean theIsMultiFile,
+ CORBA::Boolean theIsASCII)
{
CORBA::String_var aString("");
if(strcmp(theLocalPersistentID,"") != 0) {
- Storable* aStorable = Storable::Create(theSObject,
- theLocalPersistentID,
- VISU_TMP_DIR,
- theIsMultiFile);
- if(aStorable != NULL)
- aString = aStorable->GetID();
+ Storable* aStorable = Storable::Create(theSObject,
+ theLocalPersistentID,
+ VISU_TMP_DIR,
+ theIsMultiFile);
+ if(aStorable != NULL)
+ aString = aStorable->GetID();
}
return aString._retn();
}
//----------------------------------------------------------------------------
- SALOMEDS::TMPFile*
+ SALOMEDS::TMPFile*
VISU_Gen_i
::Save(SALOMEDS::SComponent_ptr theComponent,
- const char* theURL,
- bool theIsMultiFile)
+ const char* theURL,
+ bool theIsMultiFile)
{
if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - theURL = '"<<theURL<<"'");
SALOMEDS::SObject_var aSObject = anIter->Value();
CORBA::Object_var anObj = SObjectToObject(aSObject);
if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(anObj).in())){
- aResult->Save(theComponent,
- theURL,
- theIsMultiFile,
- false,
- aFileNames,
- aFiles);
+ aResult->Save(theComponent,
+ theURL,
+ theIsMultiFile,
+ false,
+ aFileNames,
+ aFiles);
}
}
if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - aFileNames.size() - "<<aFileNames.size());
SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0);
if(aFileNames.empty())
return aStreamFile._retn();
-
+
SALOMEDS::ListOfFileNames_var aListOfFileNames = GetListOfFileNames(aFileNames);
SALOMEDS::ListOfFileNames_var aListOfFiles = GetListOfFileNames(aFiles);
//----------------------------------------------------------------------------
- SALOMEDS::TMPFile*
+ SALOMEDS::TMPFile*
VISU_Gen_i
::SaveASCII(SALOMEDS::SComponent_ptr theComponent,
- const char* theURL,
- bool theIsMultiFile)
+ const char* theURL,
+ bool theIsMultiFile)
{
std::string anURL = theIsMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
if(MYDEBUG) MESSAGE("VISU_Gen_i::SaveASCII - "<<anURL);
SALOMEDS::SObject_var aSObject = anIter->Value();
CORBA::Object_var anObj = SObjectToObject(aSObject);
if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(anObj).in())){
- aResult->Save(theComponent,
- anURL,
- theIsMultiFile,
- true,
- aFileNames,
- aFiles);
+ aResult->Save(theComponent,
+ anURL,
+ theIsMultiFile,
+ true,
+ aFileNames,
+ aFiles);
}
}
if(MYDEBUG) MESSAGE("VISU_Gen_i::SaveASCII - aFileNames.size() - "<<aFileNames.size());
//----------------------------------------------------------------------------
- char*
+ char*
VISU_Gen_i
::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
- const char* theIORString,
- CORBA::Boolean theIsMultiFile,
- CORBA::Boolean theIsASCII)
+ const char* theIORString,
+ CORBA::Boolean theIsMultiFile,
+ CORBA::Boolean theIsASCII)
{
CORBA::String_var aString("");
if(strcmp(theIORString, "") != 0){
CORBA::Object_var anObj = GetORB()->string_to_object(theIORString);
if(Storable* aStorable = dynamic_cast<Storable*>(GetServant(anObj).in())){
- aString = aStorable->ToString().c_str();
- return aString._retn();
+ aString = aStorable->ToString().c_str();
+ return aString._retn();
}
}
return aString._retn();
//----------------------------------------------------------------------------
- char*
+ char*
VISU_Gen_i
::GetID()
{
std::string myStudyName;
public:
TEvent(const std::string theStudyName):myStudyName(theStudyName)
- {}
+ {}
virtual void Execute()
- {
- bool isActive = false;
- SUIT_Session* aSession = SUIT_Session::session();
- QList<SUIT_Application*> anApplications = aSession->applications();
- QList<SUIT_Application*>::Iterator anIter = anApplications.begin();
- SUIT_Application* aFirstApp = *anIter;
- while (anIter != anApplications.end()) {
- SUIT_Application* anApp = *anIter;
- if (SUIT_Study* aSStudy = anApp->activeStudy()) {
- if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
+ {
+ bool isActive = false;
+ SUIT_Session* aSession = SUIT_Session::session();
+ QList<SUIT_Application*> anApplications = aSession->applications();
+ QList<SUIT_Application*>::Iterator anIter = anApplications.begin();
+ SUIT_Application* aFirstApp = *anIter;
+ while (anIter != anApplications.end()) {
+ SUIT_Application* anApp = *anIter;
+ if (SUIT_Study* aSStudy = anApp->activeStudy()) {
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
if (_PTR(Study) aCStudy = aStudy->studyDS()) {
- if(MYDEBUG) MESSAGE("There is an application with active study : StudyId = "
- << aCStudy->StudyId() << "; Name = '" << aCStudy->Name() << "'");
- if (myStudyName == aCStudy->Name()) {
- isActive = true;
- break;
- }
- }
- }
- }
- anIter++;
- }
- if (!isActive) {
- MESSAGE("!!! anApp->onLoadDoc(myStudyName) !!!");
- // Has to be loaded in an empty or in a new application
- SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aFirstApp);
- anApp->onLoadDoc(myStudyName.c_str());
- }
- }
+ if(MYDEBUG) MESSAGE("There is an application with active study : StudyId = "
+ << aCStudy->StudyId() << "; Name = '" << aCStudy->Name() << "'");
+ if (myStudyName == aCStudy->Name()) {
+ isActive = true;
+ break;
+ }
+ }
+ }
+ }
+ anIter++;
+ }
+ if (!isActive) {
+ MESSAGE("!!! anApp->onLoadDoc(myStudyName) !!!");
+ // Has to be loaded in an empty or in a new application
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aFirstApp);
+ anApp->onLoadDoc(myStudyName.c_str());
+ }
+ }
};
if (!CORBA::is_nil(theStudy))
// Load MED component if necessary
if(!myStudyDocument->FindComponent("MED")->_is_nil())
- {
- SALOME_LifeCycleCORBA aLCC(SalomeApp_Application::namingService());
- Engines::Component_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","MED");
- SALOME_MED::MED_Gen_var aMedEngine = SALOME_MED::MED_Gen::_narrow(aComponent);
-
- if(!CORBA::is_nil(aMedEngine))
- {
- SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
- try {
- aStudyBuilder->LoadWith( myStudyDocument->FindComponent( "MED" ), aMedEngine );
- }
- catch( const SALOME::SALOME_Exception& ) {
- // Oops, something went wrong while loading
- // See also SalomeApp_Study::openDataModel()
- }
- }
- }
+ {
+ SALOME_LifeCycleCORBA aLCC(SalomeApp_Application::namingService());
+ Engines::EngineComponent_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","MED");
+ SALOME_MED::MED_Gen_var aMedEngine = SALOME_MED::MED_Gen::_narrow(aComponent);
+
+ if(!CORBA::is_nil(aMedEngine))
+ {
+ SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
+ try {
+ aStudyBuilder->LoadWith( myStudyDocument->FindComponent( "MED" ), aMedEngine );
+ }
+ catch( const SALOME::SALOME_Exception& ) {
+ // Oops, something went wrong while loading
+ // See also SalomeApp_Study::openDataModel()
+ }
+ }
+ }
} else {
INFOS("CORBA::is_nil(theStudy)");
}
//----------------------------------------------------------------------------
- SALOMEDS::Study_ptr
+ SALOMEDS::Study_ptr
VISU_Gen_i
::GetCurrentStudy()
{
//----------------------------------------------------------------------------
- ViewManager_ptr
+ ViewManager_ptr
VISU_Gen_i
::GetViewManager()
{
//----------------------------------------------------------------------------
- SALOMEDS::SObject_ptr
+ SALOMEDS::SObject_ptr
VISU_Gen_i
::ImportTables(const char* theFileName, bool theFirstStrAsTitle)
{
//----------------------------------------------------------------------------
- CORBA::Boolean
+ CORBA::Boolean
VISU_Gen_i
::ExportTableToFile(SALOMEDS::SObject_ptr theTable,
- const char* theFileName)
+ const char* theFileName)
{
return VISU::ExportTableToFile(theTable, theFileName);
}
return Result::_nil();
Result_i* aResult = Result_i::New(myStudyDocument,
- Result_i::eFile,
- Result_i::eImportFile,
- true,
- true,
- true,
- true);
+ Result_i::eFile,
+ Result_i::eImportFile,
+ true,
+ true,
+ true,
+ true);
if(aResult->Create(theFileName) != NULL)
return aResult->_this();
return Result::_nil();
Result_i* aResult = Result_i::New(myStudyDocument,
- Result_i::eFile,
- Result_i::eImportFile,
- false,
- true,
- true,
- true);
+ Result_i::eFile,
+ Result_i::eImportFile,
+ false,
+ true,
+ true,
+ true);
if(aResult->Create(theFileName) != NULL)
return aResult->_this();
return Result::_nil();
Result_i* aResult = Result_i::New(myStudyDocument,
- Result_i::eRestoredFile,
- Result_i::eCopyAndImportFile,
- true,
- true,
- true,
- true);
+ Result_i::eRestoredFile,
+ Result_i::eCopyAndImportFile,
+ true,
+ true,
+ true,
+ true);
if(aResult->Create(theFileName) != NULL)
return aResult->_this();
else
return Result::_nil();
Result_i* aResult = Result_i::New(myStudyDocument,
- Result_i::eComponent,
- Result_i::eImportMed,
- true,
- true,
- true,
- true);
+ Result_i::eComponent,
+ Result_i::eImportMed,
+ true,
+ true,
+ true,
+ true);
if (aResult->Create(theMedSObject) != NULL)
{
return aResult->_this();
}
else
aResult->_remove_ref();
-
+
return VISU::Result::_nil();
}
return Result::_nil();
Result_i* aResult = Result_i::New(myStudyDocument,
- Result_i::eComponent,
- Result_i::eImportMedField,
- true,
- true,
- true,
- true);
+ Result_i::eComponent,
+ Result_i::eImportMedField,
+ true,
+ true,
+ true,
+ true);
if (aResult->Create(theField) != NULL)
return aResult->_this();
else
aResult->_remove_ref();
-
+
return VISU::Result::_nil();
}
void
VISU_Gen_i
::RenameMeshInStudy(Result_ptr theResult,
- const std::string& theMeshName,
- int theEntity, // -1 for group indication
- const std::string& theSubMeshName, // Family or Group name
- const std::string& theNewName)
+ const std::string& theMeshName,
+ int theEntity, // -1 for group indication
+ const std::string& theSubMeshName, // Family or Group name
+ const std::string& theNewName)
{
Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
- if (!aResult)
+ if (!aResult)
return;
SALOMEDS::Study_var aStudyDocument = aResult->GetStudyDocument();
- if (aStudyDocument->GetProperties()->IsLocked())
+ if (aStudyDocument->GetProperties()->IsLocked())
return;
VISU::VISUType aType;
if (theEntity >= 0)
if (theSubMeshName == "")
- aType = VISU::TENTITY;
+ aType = VISU::TENTITY;
else
- aType = VISU::TFAMILY;
+ aType = VISU::TFAMILY;
else
aType = VISU::TGROUP;
}
string anEntry = aResult->GetEntry(aRestoringMap);
- if (anEntry == "")
+ if (anEntry == "")
return;
SALOMEDS::SObject_ptr aSObject = aStudyDocument->FindObjectID(anEntry.c_str());
void
VISU_Gen_i
::RenameEntityInStudy(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theNewName)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theNewName)
{
RenameMeshInStudy(theResult, theMeshName, (int)theEntity, "", theNewName);
}
void
VISU_Gen_i
::RenameFamilyInStudy(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFamilyName,
- const char* theNewName)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFamilyName,
+ const char* theNewName)
{
RenameMeshInStudy(theResult, theMeshName, (int)theEntity, theFamilyName, theNewName);
}
//----------------------------------------------------------------------------
- void
+ void
VISU_Gen_i
::RenameGroupInStudy(Result_ptr theResult,
- const char* theMeshName,
- const char* theGroupName,
- const char* theNewName)
+ const char* theMeshName,
+ const char* theGroupName,
+ const char* theNewName)
{
RenameMeshInStudy(theResult, theMeshName, -1, theGroupName, theNewName);
}
Mesh_ptr
VISU_Gen_i
::MeshOnEntity(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity)
+ const char* theMeshName,
+ VISU::Entity theEntity)
{
Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
- if (!aResult)
+ if (!aResult)
return VISU::Mesh::_nil();
SALOMEDS::Study_var aStudyDocument = aResult->GetStudyDocument();
- if (aStudyDocument->GetProperties()->IsLocked())
+ if (aStudyDocument->GetProperties()->IsLocked())
return VISU::Mesh::_nil();
Mesh_i* aPresent = new Mesh_i();
//----------------------------------------------------------------------------
- Mesh_ptr
+ Mesh_ptr
VISU_Gen_i
::FamilyMeshOnEntity(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFamilyName)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFamilyName)
{
Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
- if (!aResult)
+ if (!aResult)
return VISU::Mesh::_nil();
SALOMEDS::Study_var aStudyDocument = aResult->GetStudyDocument();
- if (aStudyDocument->GetProperties()->IsLocked())
+ if (aStudyDocument->GetProperties()->IsLocked())
return VISU::Mesh::_nil();
Mesh_i* aPresent = new Mesh_i();
Mesh_ptr
VISU_Gen_i
::GroupMesh(Result_ptr theResult,
- const char* theMeshName,
- const char* theGroupName)
+ const char* theMeshName,
+ const char* theGroupName)
{
Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
- if (!aResult)
+ if (!aResult)
return VISU::Mesh::_nil();
SALOMEDS::Study_var aStudyDocument = aResult->GetStudyDocument();
- if (aStudyDocument->GetProperties()->IsLocked())
+ if (aStudyDocument->GetProperties()->IsLocked())
return VISU::Mesh::_nil();
Mesh_i* aPresent = new Mesh_i();
//----------------------------------------------------------------------------
- ScalarMap_ptr
+ ScalarMap_ptr
VISU_Gen_i
::ScalarMapOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return Prs3dOnField<VISU::ScalarMap_i>(theResult,
- theMeshName,
- theEntity,
- theFieldName,
- theIteration)._retn();
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration)._retn();
}
GaussPoints_ptr
VISU_Gen_i
::GaussPointsOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return Prs3dOnField<VISU::GaussPoints_i>(theResult,
- theMeshName,
- theEntity,
- theFieldName,
- theIteration)._retn();
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration)._retn();
}
//---------------------------------------------------------------
- DeformedShape_ptr
+ DeformedShape_ptr
VISU_Gen_i
::DeformedShapeOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return Prs3dOnField<VISU::DeformedShape_i>(theResult,
- theMeshName,
- theEntity,
- theFieldName,
- theIteration)._retn();
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration)._retn();
}
//---------------------------------------------------------------
- DeformedShapeAndScalarMap_ptr
+ DeformedShapeAndScalarMap_ptr
VISU_Gen_i
::ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return DeformedShapeAndScalarMapOnField(theResult,
- theMeshName,
- theEntity,
- theFieldName,
- theIteration);
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration);
}
-
+
//---------------------------------------------------------------
- DeformedShapeAndScalarMap_ptr
+ DeformedShapeAndScalarMap_ptr
VISU_Gen_i
::DeformedShapeAndScalarMapOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return Prs3dOnField<VISU::DeformedShapeAndScalarMap_i>(theResult,
- theMeshName,
- theEntity,
- theFieldName,
- theIteration)._retn();
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration)._retn();
}
-
+
//---------------------------------------------------------------
- Vectors_ptr
+ Vectors_ptr
VISU_Gen_i
::VectorsOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return Prs3dOnField<VISU::Vectors_i>(theResult,
- theMeshName,
- theEntity,
- theFieldName,
- theIteration)._retn();
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration)._retn();
}
//---------------------------------------------------------------
- IsoSurfaces_ptr
+ IsoSurfaces_ptr
VISU_Gen_i
::IsoSurfacesOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return Prs3dOnField<VISU::IsoSurfaces_i>(theResult,
- theMeshName,
- theEntity,
- theFieldName,
- theIteration)._retn();
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration)._retn();
}
//---------------------------------------------------------------
- StreamLines_ptr
+ StreamLines_ptr
VISU_Gen_i
::StreamLinesOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return Prs3dOnField<VISU::StreamLines_i>(theResult,
- theMeshName,
- theEntity,
- theFieldName,
- theIteration)._retn();
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration)._retn();
}
//---------------------------------------------------------------
- Plot3D_ptr
+ Plot3D_ptr
VISU_Gen_i
::Plot3DOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return Prs3dOnField<VISU::Plot3D_i>(theResult,
- theMeshName,
- theEntity,
- theFieldName,
- theIteration)._retn();
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration)._retn();
}
CutPlanes_ptr
VISU_Gen_i
::CutPlanesOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return Prs3dOnField<VISU::CutPlanes_i>(theResult,
- theMeshName,
- theEntity,
- theFieldName,
- theIteration)._retn();
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration)._retn();
}
CutLines_ptr
VISU_Gen_i
::CutLinesOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return Prs3dOnField<VISU::CutLines_i>(theResult,
- theMeshName,
- theEntity,
- theFieldName,
- theIteration)._retn();
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration)._retn();
}
//---------------------------------------------------------------
CutSegment_ptr
VISU_Gen_i
::CutSegmentOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return Prs3dOnField<VISU::CutSegment_i>(theResult,
- theMeshName,
- theEntity,
- theFieldName,
- theIteration)._retn();
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration)._retn();
}
//---------------------------------------------------------------
const char* myTableEntry;
typedef Table_ptr TResult;
TResult myResult;
-
+
CreateTableEvent(SALOMEDS::Study_var theStudy, const char* theTableEntry)
{
myStudyDocument = theStudy;
myTableEntry = theTableEntry;
myResult = Table::_nil();
}
-
+
virtual
void
Execute()
SALOMEDS::SObject_var SO = myStudyDocument->FindObjectID(myTableEntry);
SALOMEDS::GenericAttribute_var anAttr;
if ( SO->FindAttribute(anAttr, "AttributeTableOfReal") ) {
- SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
- if ( isSparseMatrix( aTableOfReal ) ) {
- PointMap3d_i* pPresent = new PointMap3d_i(myStudyDocument,myTableEntry);
- if(pPresent->Create() != NULL)
- myResult = pPresent->_this();
- else {
- pPresent->_remove_ref();
- myResult = VISU::Table::_nil();
- }
- return;
- }
+ SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+ if ( isSparseMatrix( aTableOfReal ) ) {
+ PointMap3d_i* pPresent = new PointMap3d_i(myStudyDocument,myTableEntry);
+ if(pPresent->Create() != NULL)
+ myResult = pPresent->_this();
+ else {
+ pPresent->_remove_ref();
+ myResult = VISU::Table::_nil();
+ }
+ return;
+ }
}
Table_i* pPresent = new Table_i(myStudyDocument,myTableEntry);
if(pPresent->Create() != NULL)
- myResult = pPresent->_this();
+ myResult = pPresent->_this();
else {
- pPresent->_remove_ref();
- myResult = VISU::Table::_nil();
+ pPresent->_remove_ref();
+ myResult = VISU::Table::_nil();
}
}
{
int aCols = theTableOfReal->GetNbColumns();
int aRows = theTableOfReal->GetNbRows();
-
+
for (int i=1; i<=aCols; i++) {
- for (int j=1; j<=aRows; j++) {
- if ( !(theTableOfReal->HasValue(j, i)) )
- return false;
- }
+ for (int j=1; j<=aRows; j++) {
+ if ( !(theTableOfReal->HasValue(j, i)) )
+ return false;
+ }
}
return true;
}
{
TCollection_AsciiString tmp( (char*)theTableEntry ); // 11.06.2008 IPAL18844
if( myStudyDocument->GetProperties()->IsLocked() ||
- tmp.Length()==0 )
+ tmp.Length()==0 )
return Table::_nil();
return ProcessEvent(new CreateTableEvent(myStudyDocument, theTableEntry));
Curve_ptr
VISU_Gen_i
::CreateCurve(Table_ptr theTable,
- CORBA::Long theHRow,
- CORBA::Long theVRow)
+ CORBA::Long theHRow,
+ CORBA::Long theVRow)
{
return CreateCurveWithZExt( theTable, theHRow, theVRow, 0, false );
}
Curve_ptr
VISU_Gen_i
::CreateCurveWithZ(Table_ptr theTable,
- CORBA::Long theHRow,
- CORBA::Long theVRow,
- CORBA::Long theZRow)
+ CORBA::Long theHRow,
+ CORBA::Long theVRow,
+ CORBA::Long theZRow)
{
return CreateCurveWithZExt( theTable, theHRow, theVRow, theZRow, false );
}
VISU_Gen_i
::Close(SALOMEDS::SComponent_ptr theComponent)
{
- if ( !CORBA::is_nil( myStudyDocument ) && !CORBA::is_nil( theComponent ) &&
- myStudyDocument->StudyId() == theComponent->GetStudy()->StudyId())
+ if ( !CORBA::is_nil( myStudyDocument ) && !CORBA::is_nil( theComponent ) &&
+ myStudyDocument->StudyId() == theComponent->GetStudy()->StudyId())
myStudyDocument = SALOMEDS::Study::_nil();
}
//---------------------------------------------------------------
- char*
+ char*
VISU_Gen_i
::ComponentDataType()
{
//---------------------------------------------------------------
bool
VISU_Gen_i
- ::CanPublishInStudy(CORBA::Object_ptr theIOR)
+ ::CanPublishInStudy(CORBA::Object_ptr theIOR)
{
Result_var aResultObj = Result::_narrow(theIOR);
return !(aResultObj->_is_nil());
SALOMEDS::SObject_ptr
VISU_Gen_i
::PublishInStudy(SALOMEDS::Study_ptr theStudy,
- SALOMEDS::SObject_ptr theSObject,
- CORBA::Object_ptr theObject,
- const char* theName)
+ SALOMEDS::SObject_ptr theSObject,
+ CORBA::Object_ptr theObject,
+ const char* theName)
throw (SALOME::SALOME_Exception)
{
Unexpect aCatch(SalomeException);
Mutex mt(myMutex);
SALOMEDS::SObject_var aResultSO;
Result_i* aResultObj = dynamic_cast<Result_i*>(GetServant(theObject).in());
- if (!aResultObj)
+ if (!aResultObj)
return aResultSO._retn();
const QFileInfo& aFileInfo = aResultObj->GetFileInfo();
CORBA::String_var anEntry = aResultObj->Create((const char*)aFileInfo.absoluteFilePath().toLatin1())->GetID();
//---------------------------------------------------------------
- CORBA::Boolean
+ CORBA::Boolean
VISU_Gen_i
- ::CanCopy(SALOMEDS::SObject_ptr theObject)
+ ::CanCopy(SALOMEDS::SObject_ptr theObject)
{
CORBA::Object_var anObj = SObjectToObject(theObject);
if (Storable* aStorable = dynamic_cast<Storable*>(GetServant(anObj).in()))
//---------------------------------------------------------------
- SALOMEDS::TMPFile*
+ SALOMEDS::TMPFile*
VISU_Gen_i
- ::CopyFrom(SALOMEDS::SObject_ptr theObject,
- CORBA::Long& theObjectID)
+ ::CopyFrom(SALOMEDS::SObject_ptr theObject,
+ CORBA::Long& theObjectID)
{
theObjectID = 0;
SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile;
SALOMEDS::ListOfFileNames_var aListOfFileNames = new SALOMEDS::ListOfFileNames;
aListOfFileNames->length(aFileNames.size());
for(size_t anId = 0; anId < aFileNames.size(); anId++)
- aListOfFileNames[anId] = aFileNames[anId].c_str();
+ aListOfFileNames[anId] = aFileNames[anId].c_str();
if(anIsDone)
- aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir, aListOfFileNames.in(), false);
+ aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir, aListOfFileNames.in(), false);
SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aListOfFileNames.in(), true);
}
//---------------------------------------------------------------
- CORBA::Boolean
+ CORBA::Boolean
VISU_Gen_i
::CanPaste(const char* theComponentName, CORBA::Long theObjectID) {
// The VISU component can paste only objects copied by VISU component
SALOMEDS::SObject_ptr
VISU_Gen_i
::PasteInto(const SALOMEDS::TMPFile& theStream,
- CORBA::Long theObjectID,
- SALOMEDS::SObject_ptr theSObject)
+ CORBA::Long theObjectID,
+ SALOMEDS::SObject_ptr theSObject)
{
if (theObjectID != 1)
return SALOMEDS::SObject::_nil();
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
CORBA::String_var aComponentID(aComponent->GetID());
CORBA::String_var aSObjectID(theSObject->GetID());
-
+
SALOMEDS::SObject_var aSObject;
if (strcmp(aComponentID, aSObjectID) == 0) //create the new result SObject
aSObject = aStudyBuilder->NewObject(aComponent);
else
aSObject = SALOMEDS::SObject::_duplicate(theSObject);
-
+
std::string aTmpDir = SALOMEDS_Tool::GetTmpDir();
- SALOMEDS::ListOfFileNames_var aListOfFileNames =
+ SALOMEDS::ListOfFileNames_var aListOfFileNames =
SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir, false);
if(MYDEBUG) MESSAGE("Result_i::PasteInto - aListOfFileNames->length() = "<<aListOfFileNames->length());
-
+
std::ostringstream aLocalPersistentID;
{
std::string aCopyPersist = aTmpDir + "copy_persistent";
std::ifstream anInputFileStream( aCopyPersist.c_str() );
anInputFileStream >> aLocalPersistentID.rdbuf();
}
-
+
//Just for Result::Restore to find the Comment attribute :(
SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeString");
-
+
std::string aFileName(aTmpDir);
if(aListOfFileNames->length() > 1)
aFileName += aListOfFileNames[1].in();
Storable* aStorable = Storable::Create(aSObject, aLocalPersistentID.str(), aFileName, false);
-
+
SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
aFilesToRemove->length(1);
aFilesToRemove[0] = aListOfFileNames[0];
SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir, aFilesToRemove.in(), true);
-
+
anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeIOR");
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
CORBA::String_var anIORValue(aStorable->GetID());
anIOR->SetValue(anIORValue);
-
+
return aSObject._retn();
}
return ColoredPrs3dCache_i::GetInstance(theStudy);
}
-
- CORBA::Long VISU_Gen_i::CreateClippingPlane(CORBA::Double X,CORBA::Double Y, CORBA::Double Z,
- CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ,
- CORBA::Boolean isAuto, const char* name)
+
+ CORBA::Long VISU_Gen_i::CreateClippingPlane(CORBA::Double X,CORBA::Double Y, CORBA::Double Z,
+ CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ,
+ CORBA::Boolean isAuto, const char* name)
{
return myClippingPlaneMgr.CreateClippingPlane(X, Y, Z, dX, dY, dZ, isAuto, name);
}
-
- void VISU_Gen_i::EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double Y, CORBA::Double Z,
- CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ,
- CORBA::Boolean isAuto, const char* name)
+
+ void VISU_Gen_i::EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double Y, CORBA::Double Z,
+ CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ,
+ CORBA::Boolean isAuto, const char* name)
{
myClippingPlaneMgr.EditClippingPlane(id, X, Y, Z, dX, dY, dZ, isAuto, name);
}
-
+
/* Returns clipping plane by its Id */
VISU::ClippingPlane* VISU_Gen_i::GetClippingPlane(CORBA::Long id)
{
VISU_CutPlaneFunction* aPlane = myClippingPlaneMgr.GetClippingPlane(id);
-
+
if (aPlane != NULL) {
double aOrigin[3];
double aDir[3];
}
return NULL;
}
-
+
/* Deletes clipping plane by its Id */
CORBA::Boolean VISU_Gen_i::DeleteClippingPlane(CORBA::Long id)
{
return myClippingPlaneMgr.DeleteClippingPlane(id);
}
-
+
/* Applyes a clipping plane with Id to presentation thePrs */
CORBA::Boolean VISU_Gen_i::ApplyClippingPlane(Prs3d_ptr thePrs, CORBA::Long id)
{
VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(thePrs).in());
return myClippingPlaneMgr.DetachClippingPlane(aPrs, id);
}
-
+
/* Get number of clipping planes */
CORBA::Long VISU_Gen_i::GetClippingPlanesNb()
{
CORBA::Boolean
VISU_Gen_i
::VTK2MED( const VISU::string_array& theVTKFiles,
- const char* theMEDFile,
- const char* theMeshName,
- const VISU::double_array& theTStamps )
+ const char* theMEDFile,
+ const char* theMeshName,
+ const VISU::double_array& theTStamps )
{
if ( !theMEDFile || !theVTKFiles.length() )
return false;
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// VISU OBJECT : interactive object for VISU entities implementation
// File : VISU_Result_i.cc
// Author : Alexey PETROV
// Module : VISU
-//
+
#include "VISU_MultiResult_i.hh"
#include "VISU_ResultUtils.hh"
#include "VISU_Prs3d_i.hh"
namespace VISU
{
//---------------------------------------------------------------
- Result_var
+ Result_var
FindResult(SALOMEDS::SObject_ptr theSObject)
{
SALOMEDS::SComponent_var aSComponent = theSObject->GetFatherComponent();
while (strcmp(aComponentID, aFatherID) != 0) {
CORBA::Object_var anObject = SObjectToObject(aFather);
if (!CORBA::is_nil(anObject)) {
- aResult = Result::_narrow(anObject);
- if (!aResult->_is_nil()) return aResult;
+ aResult = Result::_narrow(anObject);
+ if (!aResult->_is_nil()) return aResult;
}
aFather = aFather->GetFather();
aFatherID = aFather->GetID();
//---------------------------------------------------------------
- Result_i*
+ Result_i*
GetResult(SALOMEDS::Study_ptr theStudy,
- const std::string& theResultEntry)
+ const std::string& theResultEntry)
{
Result_i* result = NULL;
if (!CORBA::is_nil(theStudy)) {
SALOMEDS::SComponent_var aSComponent = theStudy->FindComponent("VISU");
if (!CORBA::is_nil(aSComponent)) {
- std::string compid = aSComponent->GetID();
- std::string aResultEntry = theResultEntry;
- if (theResultEntry.substr(0, compid.length()) != compid) aResultEntry = compid + theResultEntry.substr(compid.length());
- SALOMEDS::SObject_var aSObject = theStudy->FindObjectID(aResultEntry.c_str());
- CORBA::Object_var anObject = SObjectToObject(aSObject);
- result = dynamic_cast<VISU::Result_i*>(GetServant(anObject).in());
+ std::string compid = aSComponent->GetID();
+ std::string aResultEntry = theResultEntry;
+ if (theResultEntry.substr(0, compid.length()) != compid) aResultEntry = compid + theResultEntry.substr(compid.length());
+ SALOMEDS::SObject_var aSObject = theStudy->FindObjectID(aResultEntry.c_str());
+ CORBA::Object_var anObject = SObjectToObject(aSObject);
+ result = dynamic_cast<VISU::Result_i*>(GetServant(anObject).in());
}
}
return result;
//---------------------------------------------------------------
void
CreateReference (SALOMEDS::Study_ptr theStudyDocument,
- const string& theFatherEntry,
- const string& theRefEntry)
+ const string& theFatherEntry,
+ const string& theRefEntry)
{
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder();
SALOMEDS::SObject_var aFather = theStudyDocument->FindObjectID(theFatherEntry.c_str());
//---------------------------------------------------------------
VISU::Result_i
::Result_i(SALOMEDS::Study_ptr theStudy,
- const ESourceId& theSourceId,
- const ECreationId& theCreationId,
- CORBA::Boolean theIsBuildImmediately,
- CORBA::Boolean theIsBuildFields,
- CORBA::Boolean theIsBuildMinMax,
- CORBA::Boolean theIsBuildGroups):
+ const ESourceId& theSourceId,
+ const ECreationId& theCreationId,
+ CORBA::Boolean theIsBuildImmediately,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsBuildMinMax,
+ CORBA::Boolean theIsBuildGroups):
myStudyDocument(SALOMEDS::Study::_duplicate(theStudy)),
myCreationId(theCreationId),
mySourceId(theSourceId),
::~Result_i()
{
MESSAGE("Result_i::~Result_i() - this = "<<this);
- if (GetSourceId() == eRestoredFile)
+ if (GetSourceId() == eRestoredFile)
VISU::RemoveFile(myFileInfo.filePath().toLatin1().data());
}
TRemoveFromStudy(VISU::Result_i* theRemovable):
myRemovable(theRemovable)
{}
-
+
virtual
void
Execute()
//---------------------------------------------------------------
-void
+void
VISU::Result_i
::ConnectObserver(TResultObserver* theObserver,
- boost::signalslib::connection& theConnection)
+ boost::signalslib::connection& theConnection)
{
if(theConnection.connected())
theConnection.disconnect();
- theConnection =
- myUpdateObserverSignal.connect(boost::bind(boost::bind(&TResultObserver::UpdateFromResult,
- theObserver,
- _1),
- this));
+ theConnection =
+ myUpdateObserverSignal.connect(boost::bind(boost::bind(&TResultObserver::UpdateFromResult,
+ theObserver,
+ _1),
+ this));
}
//---------------------------------------------------------------
-void
+void
VISU::Result_i
::UpdateObservers()
{
TEvent(VISU::Result_i::TUpdateObserverSignal& theUpdateObserverSignal):
myUpdateObserverSignal(theUpdateObserverSignal)
{}
-
+
virtual
void
Execute()
::BuildAll()
{
if(MYDEBUG) MESSAGE("Result_i::Build - myIsAllDone = "<<myIsAllDone);
- if(myIsAllDone)
+ if(myIsAllDone)
return 1;
- if(!IsPossible())
+ if(!IsPossible())
return 0;
try{
const VISU::TMeshMap& aMeshMap = myInput->GetMeshMap();
//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 string& aFieldName = aFieldMapIter->first;
- const VISU::PField aField = aFieldMapIter->second;
- const VISU::TValField& aValField = aField->myValField;
- VISU::TValField::const_iterator aValFieldIter = aValField.begin();
- for(; aValFieldIter != aValField.end(); aValFieldIter++){
- int aTimeStamp = aValFieldIter->first;
- try{
- myInput->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
- }catch(std::exception& exc){
- INFOS("Follow exception was occured :\n"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was occured!!!");
- }
- }
- }
- //Importing groups
- const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
- VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
- for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
- const string& aGroupName = aGroupMapIter->first;
- try{
- myInput->GetMeshOnGroup(aMeshName,aGroupName);
- }catch(std::exception& exc){
- INFOS("Follow exception was occured :\n"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was occured!!!");
- }
- }
- //Import families
- const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
- VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
- for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
- const string& aFamilyName = aFamilyMapIter->first;
- try{
- myInput->GetFamilyOnEntity(aMeshName,anEntity,aFamilyName);
- }catch(std::exception& exc){
- INFOS("Follow exception was occured :\n"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was occured!!!");
- }
- }
- //Import mesh on entity
- try{
- myInput->GetMeshOnEntity(aMeshName,anEntity);
- }catch(std::exception& exc){
- INFOS("Follow exception was occured :\n"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was occured!!!");
- }
+ 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 string& aFieldName = aFieldMapIter->first;
+ const VISU::PField aField = aFieldMapIter->second;
+ const VISU::TValField& aValField = aField->myValField;
+ VISU::TValField::const_iterator aValFieldIter = aValField.begin();
+ for(; aValFieldIter != aValField.end(); aValFieldIter++){
+ int aTimeStamp = aValFieldIter->first;
+ try{
+ myInput->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
+ }catch(std::exception& exc){
+ INFOS("Follow exception was occured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was occured!!!");
+ }
+ }
+ }
+ //Importing groups
+ const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
+ VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
+ for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
+ const string& aGroupName = aGroupMapIter->first;
+ try{
+ myInput->GetMeshOnGroup(aMeshName,aGroupName);
+ }catch(std::exception& exc){
+ INFOS("Follow exception was occured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was occured!!!");
+ }
+ }
+ //Import families
+ const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+ VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+ for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+ const string& aFamilyName = aFamilyMapIter->first;
+ try{
+ myInput->GetFamilyOnEntity(aMeshName,anEntity,aFamilyName);
+ }catch(std::exception& exc){
+ INFOS("Follow exception was occured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was occured!!!");
+ }
+ }
+ //Import mesh on entity
+ try{
+ myInput->GetMeshOnEntity(aMeshName,anEntity);
+ }catch(std::exception& exc){
+ INFOS("Follow exception was occured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was occured!!!");
+ }
}
}
myIsAllDone = 1;
CORBA::Boolean
VISU::Result_i
::Build(CORBA::Boolean theIsBuildAll,
- CORBA::Boolean theIsAtOnce)
+ CORBA::Boolean theIsAtOnce)
{
if(theIsBuildAll)
theIsAtOnce = true;
if(Build(SALOMEDS::SObject::_nil(), theIsAtOnce)){
-
+
// Set icon
SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributePixMap_var aPixmap;
SALOMEDS::AttributeUserID_var aId;
-
+
anAttr = aStudyBuilder->FindOrCreateAttribute( mySObject, "AttributePixMap" );
aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr );
aPixmap ->SetPixMap("ICON_TREE_RESULT");
anAttr = aStudyBuilder->FindOrCreateAttribute( mySObject, auid.c_str() );
aId = SALOMEDS::AttributeUserID::_narrow( anAttr );
aId ->SetValue("VISU.RESULT");
-
+
if(theIsBuildAll)
return BuildAll();
return true;
}
-
+
return false;
}
//---------------------------------------------------------------
VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject,
- CORBA::Boolean theIsAtOnce)
+ CORBA::Boolean theIsAtOnce)
{
if(!myInput)
return NULL;
CORBA::String_var anIOR(GetID());
QString aComment;
aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s",
- GetComment(),
- myFileInfo.filePath().toLatin1().data(),
- GetInitFileName().c_str()); // Restoring of Python dump
- std::string aResultEntry =
+ GetComment(),
+ myFileInfo.filePath().toLatin1().data(),
+ GetInitFileName().c_str()); // Restoring of Python dump
+ std::string aResultEntry =
CreateAttributes(myStudy,
- aSComponentEntry.in(),
- NO_ICON,
- anIOR.in(),
- GetName(),
- NO_PERFSITENT_REF,
- aComment.toLatin1().data(),
- true);
+ aSComponentEntry.in(),
+ NO_ICON,
+ anIOR.in(),
+ GetName(),
+ NO_PERFSITENT_REF,
+ aComment.toLatin1().data(),
+ true);
mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
if(!CORBA::is_nil(theSObject)){
CORBA::String_var aString = theSObject->GetID();
if(theIsAtOnce){
BuildEntities(this,
- myInput,
- &myIsEntitiesDone,
- aResultEntry,
- theIsAtOnce,
- myIsBuildGroups,
- myIsBuildFields,
- myIsBuildParts,
- myStudy);
-
+ myInput,
+ &myIsEntitiesDone,
+ aResultEntry,
+ theIsAtOnce,
+ myIsBuildGroups,
+ myIsBuildFields,
+ myIsBuildParts,
+ myStudy);
+
BuildGroups(this,
- myInput,
- &myIsGroupsDone,
- myIsBuildGroups,
- theIsAtOnce,
- myStudy);
+ myInput,
+ &myIsGroupsDone,
+ myIsBuildGroups,
+ theIsAtOnce,
+ myStudy);
BuildFieldDataTree(this,
- myInput,
- &myIsFieldsDone,
- myIsBuildFields,
- &myIsMinMaxDone,
- myIsBuildMinMax,
- myStudy);
+ myInput,
+ &myIsFieldsDone,
+ myIsBuildFields,
+ &myIsMinMaxDone,
+ myIsBuildMinMax,
+ myStudy);
} else {
boost::thread aThread(boost::bind(boost::bind(&Result_i::BuildDataTree, this, _1),
- aResultEntry));
+ aResultEntry));
}
return this;
::BuildDataTree(const std::string& theResultEntry)
{
BuildEntities(this,
- myInput,
- &myIsEntitiesDone,
- theResultEntry,
- false,
- myIsBuildGroups,
- myIsBuildFields,
- myIsBuildParts,
- myStudy);
+ myInput,
+ &myIsEntitiesDone,
+ theResultEntry,
+ false,
+ myIsBuildGroups,
+ myIsBuildFields,
+ myIsBuildParts,
+ myStudy);
{
boost::thread aThread(boost::bind(&BuildGroups,
- this,
- myInput,
- &myIsGroupsDone,
- myIsBuildGroups,
- false,
- myStudy));
+ this,
+ myInput,
+ &myIsGroupsDone,
+ myIsBuildGroups,
+ false,
+ myStudy));
}
{
boost::thread aThread(boost::bind(&BuildFieldDataTree,
- this,
- myInput,
- &myIsFieldsDone,
- myIsBuildFields,
- &myIsMinMaxDone,
- myIsBuildMinMax,
- myStudy));
+ this,
+ myInput,
+ &myIsFieldsDone,
+ myIsBuildFields,
+ &myIsMinMaxDone,
+ myIsBuildMinMax,
+ myStudy));
}
}
VISU::Storable*
VISU::Result_i
::Create(const char* theFileName)
-{
+{
try {
myFileInfo.setFile(theFileName);
myFileName = myFileInfo.fileName().toLatin1().data();
std::string aFileName = VISU::MakeFileName(myFileInfo.fileName().toLatin1().data(), this);
QString aPathToCopy(aTmpDir + aFileName.c_str());
if(!VISU::CopyFile(myFileInfo.absoluteFilePath().toLatin1().data(), aPathToCopy.toLatin1().data()))
- return NULL;
+ return NULL;
myFileInfo.setFile(aPathToCopy);
myFileName = myFileInfo.fileName().toLatin1().data();
if(myInput){
if(myIsBuildImmediately)
- Build(SALOMEDS::SObject::_nil());
+ Build(SALOMEDS::SObject::_nil());
return this;
}
}catch(std::exception& exc){
if(theIsMultiFile || theIsASCII){
std::string aPathToCopy(theURL + aFileName);
BEGMSG(MYDEBUG, "aPathToCopy = '"<<aPathToCopy<<"'\n");
-
+
if(!VISU::CopyFile(aFile, aPathToCopy))
- return false;
+ return false;
if(theIsASCII)
- HDFascii::ConvertFromHDFToASCII(const_cast<char*>(aPathToCopy.c_str()), true);
+ HDFascii::ConvertFromHDFToASCII(const_cast<char*>(aPathToCopy.c_str()), true);
}
theFileNames.push_back(aFileName);
//---------------------------------------------------------------
-CORBA::Boolean
+CORBA::Boolean
VISU::Result_i
-::CanCopy(SALOMEDS::SObject_ptr theObject)
+::CanCopy(SALOMEDS::SObject_ptr theObject)
{
switch(GetCreationId()){
case Result_i::eImportFile:
- case Result_i::eCopyAndImportFile:
+ case Result_i::eCopyAndImportFile:
return true;
}
-
+
return false;
}
//---------------------------------------------------------------
bool
VISU::Result_i
-::CopyFrom(SALOMEDS::SObject_ptr theObject,
- CORBA::Long& theObjectID,
- const std::string& theTmpDir,
- TFileNames& theFileNames)
+::CopyFrom(SALOMEDS::SObject_ptr theObject,
+ CORBA::Long& theObjectID,
+ const std::string& theTmpDir,
+ TFileNames& theFileNames)
{
if(!Storable::CopyFrom(theObject, theObjectID, theTmpDir, theFileNames))
return false;
-
+
SALOMEDS::Study_var aStudy = theObject->GetStudy();
CORBA::String_var anURL = aStudy->URL();
std::string aPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in());
VISU::Storable*
VISU::Result_i
::Restore(SALOMEDS::SObject_ptr theSObject,
- const Storable::TRestoringMap& theMap,
- const string& thePrefix,
- CORBA::Boolean theIsMultiFile)
+ const Storable::TRestoringMap& theMap,
+ const string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
{
if(MYDEBUG) MESSAGE("Result_i::Restore - " << thePrefix);
mySObject = SALOMEDS::SObject::_duplicate(theSObject);
for (int i = 0; i < myFileName.length(); i++)
{
if (myFileName[i] == ':')
- myFileName[i] = '_';
+ myFileName[i] = '_';
}
#endif
SetInitFileName(VISU::Storable::FindValue(theMap, "myInitFileName").toLatin1().data());
-
+
SALOMEDS::SObject_var aRefSObj, aTargetRefSObj;
if (theSObject->FindSubObject(1, aRefSObj) && aRefSObj->ReferencedObject(aTargetRefSObj)) {
if(MYDEBUG) MESSAGE("Result_i::GetInput - There is some reference.");
CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
myFileInfo.setFile(aDataType.in());
if(MYDEBUG) MESSAGE("Result_i::GetInput - aDataType = " << aDataType);
- Engines::Component_var aEngComp =
- Base_i::myEnginesLifeCycle->FindOrLoad_Component("FactoryServer", aDataType.in());
+ Engines::EngineComponent_var aEngComp =
+ Base_i::myEnginesLifeCycle->FindOrLoad_Component("FactoryServer", aDataType.in());
if (CORBA::is_nil(aEngComp))
- throw std::runtime_error("Restore - There is no aEngComp for the aDataType !!!");
+ throw std::runtime_error("Restore - There is no aEngComp for the aDataType !!!");
SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aEngComp);
aStudyBuilder->LoadWith(aCompRefSObj, aDriver);
SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(aMedObject);
if (!CORBA::is_nil(aField)) {
// create field converter
- myInput.reset(CreateMEDFieldConvertor(aField));
- myInput->Build();
+ myInput.reset(CreateMEDFieldConvertor(aField));
+ myInput->Build();
}
else if (strcmp(aDataType, "MED") == 0) {
// create MED converter
- myInput.reset(CreateMEDConvertor(aTargetRefSObj));
- myInput->Build();
+ myInput.reset(CreateMEDConvertor(aTargetRefSObj));
+ myInput->Build();
}
else {
- throw std::runtime_error("GetInput - There is no convertor for the aDataType !!!");
+ throw std::runtime_error("GetInput - There is no convertor for the aDataType !!!");
}
} else {
myFileInfo.setFile(thePrefix.c_str());
std::string aStudyPrefix ("");
if (theIsMultiFile) {
- CORBA::String_var anURL(GetStudyDocument()->URL());
- aStudyPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in());
+ CORBA::String_var anURL(GetStudyDocument()->URL());
+ aStudyPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in());
}
if (!myFileInfo.isFile()) {
- std::string aFileName = thePrefix + aStudyPrefix + "_" + myFileName;
- myFileInfo.setFile(aFileName.c_str());
+ std::string aFileName = thePrefix + aStudyPrefix + "_" + myFileName;
+ myFileInfo.setFile(aFileName.c_str());
}
if(MYDEBUG)
- MESSAGE("Result_i::Restore - aFileName = " << myFileInfo.filePath().toLatin1().data() << "; " << myFileInfo.isFile());
-
+ MESSAGE("Result_i::Restore - aFileName = " << myFileInfo.filePath().toLatin1().data() << "; " << myFileInfo.isFile());
+
if (HDFascii::isASCII(myFileInfo.filePath().toLatin1().data())) {
- MESSAGE("ConvertFromASCIIToHDF(" << myFileInfo.filePath().toLatin1().data() << ")");
- char* aResultPath = HDFascii::ConvertFromASCIIToHDF(myFileInfo.filePath().toLatin1().data());
- MESSAGE("ConvertFromASCIIToHDF() DONE : " << aResultPath);
- char* aHDFFileName = new char[strlen(aResultPath) + 19];
- sprintf(aHDFFileName, "%shdf_from_ascii.hdf", aResultPath);
-
- if (theIsMultiFile) { // set this file as new - temporary
- static QString aCommand;
- aCommand.sprintf(" %s %s%s",aHDFFileName, aResultPath, myFileInfo.baseName().toLatin1().data());
- aCommand = QDir::convertSeparators( aCommand );
- aCommand.prepend( MOVE_COMMAND );
-
- if (system(aCommand.toLatin1().data()) == -1) {
- if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - Can't execute the command :" << aCommand.toLatin1().data());
- return NULL;
- } else {
- if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - " << aCommand.toLatin1().data());
- }
- myFileInfo.setFile(QString(aResultPath) + myFileInfo.baseName());
- } else { // change current temporary file to the new: with hdf-format
- static QString aCommand;
- aCommand.sprintf(" %s %s\0",aHDFFileName, myFileInfo.filePath().toLatin1().data());
- aCommand = QDir::convertSeparators( aCommand );
- aCommand.prepend( MOVE_COMMAND );
-
- if (system(aCommand.toLatin1().data()) == -1) {
- if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - Can't execute the command :" << aCommand.toLatin1().data());
- return NULL;
- } else {
- if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - " << aCommand.toLatin1().data());
- }
- SALOMEDS::ListOfFileNames_var anEmptyList = new SALOMEDS::ListOfFileNames;
- SALOMEDS_Tool::RemoveTemporaryFiles(aResultPath, anEmptyList.in(), true);
- }
- mySourceId = eRestoredFile;
- delete(aResultPath);
- delete(aHDFFileName);
+ MESSAGE("ConvertFromASCIIToHDF(" << myFileInfo.filePath().toLatin1().data() << ")");
+ char* aResultPath = HDFascii::ConvertFromASCIIToHDF(myFileInfo.filePath().toLatin1().data());
+ MESSAGE("ConvertFromASCIIToHDF() DONE : " << aResultPath);
+ char* aHDFFileName = new char[strlen(aResultPath) + 19];
+ sprintf(aHDFFileName, "%shdf_from_ascii.hdf", aResultPath);
+
+ if (theIsMultiFile) { // set this file as new - temporary
+ static QString aCommand;
+ aCommand.sprintf(" %s %s%s",aHDFFileName, aResultPath, myFileInfo.baseName().toLatin1().data());
+ aCommand = QDir::convertSeparators( aCommand );
+ aCommand.prepend( MOVE_COMMAND );
+
+ if (system(aCommand.toLatin1().data()) == -1) {
+ if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - Can't execute the command :" << aCommand.toLatin1().data());
+ return NULL;
+ } else {
+ if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - " << aCommand.toLatin1().data());
+ }
+ myFileInfo.setFile(QString(aResultPath) + myFileInfo.baseName());
+ } else { // change current temporary file to the new: with hdf-format
+ static QString aCommand;
+ aCommand.sprintf(" %s %s\0",aHDFFileName, myFileInfo.filePath().toLatin1().data());
+ aCommand = QDir::convertSeparators( aCommand );
+ aCommand.prepend( MOVE_COMMAND );
+
+ if (system(aCommand.toLatin1().data()) == -1) {
+ if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - Can't execute the command :" << aCommand.toLatin1().data());
+ return NULL;
+ } else {
+ if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - " << aCommand.toLatin1().data());
+ }
+ SALOMEDS::ListOfFileNames_var anEmptyList = new SALOMEDS::ListOfFileNames;
+ SALOMEDS_Tool::RemoveTemporaryFiles(aResultPath, anEmptyList.in(), true);
+ }
+ mySourceId = eRestoredFile;
+ delete(aResultPath);
+ delete(aHDFFileName);
} else if (!theIsMultiFile) {
- mySourceId = eRestoredFile;
+ mySourceId = eRestoredFile;
} else {
- mySourceId = eSavedFile;
+ mySourceId = eSavedFile;
}
if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - mySourceId = " << mySourceId);
myInput.reset(CreateConvertor(myFileInfo.filePath().toLatin1().data()));
myInput->BuildEntities();
if(myIsBuildFields){
- myInput->BuildFields();
- myIsFieldsDone = true;
- if(myIsBuildMinMax){
- myInput->BuildMinMax();
- myIsMinMaxDone = true;
- }
+ myInput->BuildFields();
+ myIsFieldsDone = true;
+ if(myIsBuildMinMax){
+ myInput->BuildMinMax();
+ myIsMinMaxDone = true;
+ }
}
if(myIsBuildGroups){
- myInput->BuildGroups();
- myIsGroupsDone = true;
+ myInput->BuildGroups();
+ myIsGroupsDone = true;
}
QString aComment;
aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s",
- GetComment(),
- myFileInfo.filePath().toLatin1().data(),
- GetInitFileName().c_str()); // Restoring of Python dump
+ GetComment(),
+ myFileInfo.filePath().toLatin1().data(),
+ GetInitFileName().c_str()); // Restoring of Python dump
SALOMEDS::GenericAttribute_var anAttr;
if (!theSObject->FindAttribute(anAttr, "AttributeString"))
- throw std::runtime_error("Build - There is no AttributeString for the SObject !!!");
+ throw std::runtime_error("Build - There is no AttributeString for the SObject !!!");
SALOMEDS::AttributeString_var aCmnt = SALOMEDS::AttributeString::_narrow(anAttr);
aCmnt->SetValue(aComment.toLatin1().data());
}
//---------------------------------------------------------------
VISU::Result_i::PInput
VISU::Result_i
-::GetInput(const std::string& theMeshName,
- VISU::Entity theEntity,
- const std::string& theFieldName,
- CORBA::Long theTimeStampNumber)
+::GetInput(const std::string& theMeshName,
+ VISU::Entity theEntity,
+ const std::string& theFieldName,
+ CORBA::Long theTimeStampNumber)
{
return myInput;
}
//---------------------------------------------------------------
-CORBA::Boolean
+CORBA::Boolean
VISU::Result_i
-::IsDone()
+::IsDone()
{
- return
- myIsEntitiesDone &&
+ return
+ myIsEntitiesDone &&
(myIsBuildFields? myIsFieldsDone: true) &&
(myIsBuildMinMax? myIsMinMaxDone: true) &&
(myIsBuildGroups? myIsGroupsDone: true);
}
-CORBA::Boolean
+CORBA::Boolean
VISU::Result_i
-::IsEntitiesDone()
+::IsEntitiesDone()
{
return myIsEntitiesDone;
}
void
VISU::Result_i
-::SetBuildFields(CORBA::Boolean theIsBuildFields,
- CORBA::Boolean theIsCalculateMinMax)
+::SetBuildFields(CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsCalculateMinMax)
{
myIsBuildFields = theIsBuildFields;
if(theIsBuildFields)
myIsBuildGroups = theIsBuildGroups;
}
-CORBA::Boolean
+CORBA::Boolean
VISU::Result_i
-::IsFieldsDone()
+::IsFieldsDone()
{
return myIsFieldsDone;
}
-CORBA::Boolean
+CORBA::Boolean
VISU::Result_i
-::IsGroupsDone()
+::IsGroupsDone()
{
return myIsGroupsDone;
}
-CORBA::Boolean
+CORBA::Boolean
VISU::Result_i
-::IsMinMaxDone()
+::IsMinMaxDone()
{
return myIsMinMaxDone;
}
-CORBA::Boolean
+CORBA::Boolean
VISU::Result_i
::IsPartsDone()
{
//---------------------------------------------------------------
-VISU::Result::EntityNames*
+VISU::Result::EntityNames*
VISU::Result_i
::GetMeshNames()
{
const std::string& aName = anIter->first;
aResult[anId] = aName.c_str();
}
-
+
return aResult._retn();
}
//---------------------------------------------------------------
-VISU::Result::Entities*
+VISU::Result::Entities*
VISU::Result_i
::GetEntities(const char* theMeshName)
{
VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
if(anIter == aMeshMap.end())
return anEntities._retn();
-
+
const VISU::PMesh& aMesh = anIter->second;
const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
if(aMeshOnEntityMap.empty())
//---------------------------------------------------------------
-VISU::Result::EntityNames*
+VISU::Result::EntityNames*
VISU::Result_i
-::GetFamilies(const char* theMeshName,
- VISU::Entity theEntity)
+::GetFamilies(const char* theMeshName,
+ VISU::Entity theEntity)
{
VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
if(anIter == aMeshMap.end())
return aResult._retn();
-
+
const VISU::PMesh& aMesh = anIter->second;
const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
if(aMeshOnEntityMap.empty())
const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
if(aFamilyMap.empty())
return aResult._retn();
-
+
{
aResult->length(aFamilyMap.size());
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();
+ const std::string& aName = anIter->first;
+ aResult[anId] = aName.c_str();
}
}
}
//---------------------------------------------------------------
-VISU::Result::EntityNames*
+VISU::Result::EntityNames*
VISU::Result_i
::GetGroups(const char* theMeshName)
{
VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
if(anIter == aMeshMap.end())
return aResult._retn();
-
+
const VISU::PMesh& aMesh = anIter->second;
const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
if(aGroupMap.empty())
//---------------------------------------------------------------
VISU::Result::EntityNames*
VISU::Result_i
-::GetFields(const char* theMeshName,
- VISU::Entity theEntity)
+::GetFields(const char* theMeshName,
+ VISU::Entity theEntity)
{
VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
if(anIter == aMeshMap.end())
return aResult._retn();
-
+
const VISU::PMesh& aMesh = anIter->second;
const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
if(aMeshOnEntityMap.empty())
const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
if(aFieldMap.empty())
return aResult._retn();
-
+
{
aResult->length(aFieldMap.size());
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();
+ const std::string& aName = anIter->first;
+ aResult[anId] = aName.c_str();
}
}
}
//---------------------------------------------------------------
-VISU::Result::TimeStampNumbers*
+VISU::Result::TimeStampNumbers*
VISU::Result_i
-::GetTimeStampNumbers(const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName)
+::GetTimeStampNumbers(const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName)
{
VISU::Result::TimeStampNumbers_var aResult = new VISU::Result::TimeStampNumbers();
const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
if(anIter == aMeshMap.end())
return aResult._retn();
-
+
const VISU::PMesh& aMesh = anIter->second;
const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
if(aMeshOnEntityMap.empty())
{
VISU::TFieldMap::const_iterator anIter = aFieldMap.find(theFieldName);
if(anIter == aFieldMap.end())
- return aResult._retn();
+ return aResult._retn();
{
- const VISU::PField& aField = anIter->second;
- const VISU::TValField& aValField = aField->myValField;
- if(aValField.empty())
- return aResult._retn();
-
- {
- aResult->length(aValField.size());
- 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;
- }
- }
+ const VISU::PField& aField = anIter->second;
+ const VISU::TValField& aValField = aField->myValField;
+ if(aValField.empty())
+ return aResult._retn();
+
+ {
+ aResult->length(aValField.size());
+ 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::double_array*
VISU::Result_i
-::GetTimeStampValues(const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName)
+::GetTimeStampValues(const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName)
{
VISU::double_array_var aResult = new VISU::double_array();
const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
if(anIter == aMeshMap.end())
return aResult._retn();
-
+
const VISU::PMesh& aMesh = anIter->second;
const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
if(aMeshOnEntityMap.empty())
{
VISU::TFieldMap::const_iterator anIter = aFieldMap.find(theFieldName);
if(anIter == aFieldMap.end())
- return aResult._retn();
+ return aResult._retn();
{
- const VISU::PField& aField = anIter->second;
- const VISU::TValField& aValField = aField->myValField;
- if(aValField.empty())
- return aResult._retn();
-
- {
- aResult->length(aValField.size());
- VISU::TValField::const_iterator anIter = aValField.begin();
- for(size_t anId = 0; anIter != aValField.end(); anIter++, anId++){
- const PValForTime& aValForTime = anIter->second;
- aResult[anId] = aValForTime->myTime.first;
- }
- }
+ const VISU::PField& aField = anIter->second;
+ const VISU::TValField& aValField = aField->myValField;
+ if(aValField.empty())
+ return aResult._retn();
+
+ {
+ aResult->length(aValField.size());
+ VISU::TValField::const_iterator anIter = aValField.begin();
+ for(size_t anId = 0; anIter != aValField.end(); anIter++, anId++){
+ const PValForTime& aValForTime = anIter->second;
+ aResult[anId] = aValForTime->myTime.first;
+ }
+ }
}
}
}
//---------------------------------------------------------------
-CORBA::Long
+CORBA::Long
VISU::Result_i
-::GetNumberOfComponents(const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName)
+::GetNumberOfComponents(const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName)
{
CORBA::Long aResult = 0;
const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
if(anIter == aMeshMap.end())
return aResult;
-
+
const VISU::PMesh& aMesh = anIter->second;
const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
if(aMeshOnEntityMap.empty())
{
VISU::TFieldMap::const_iterator anIter = aFieldMap.find(theFieldName);
if(anIter == aFieldMap.end())
- return aResult;
+ return aResult;
{
- const VISU::PField& aField = anIter->second;
- aResult = aField->myNbComp;
+ const VISU::PField& aField = anIter->second;
+ aResult = aField->myNbComp;
}
}
}
//---------------------------------------------------------------
-VISU::Result::EntityNames*
+VISU::Result::EntityNames*
VISU::Result_i
::GetPartNames(const char* theMeshName)
{
//---------------------------------------------------------------
-VISU::Result::Resolutions*
+VISU::Result::Resolutions*
VISU::Result_i
-::GetResolutions(const char* theMeshName,
- const char* thePartName)
+::GetResolutions(const char* theMeshName,
+ const char* thePartName)
{
VISU::Result::Resolutions_var aResult = new VISU::Result::Resolutions();
return aResult._retn();
//---------------------------------------------------------------
VISU::Result::Resolution
VISU::Result_i
-::GetResolution(const char* theMeshName,
- const char* thePartName)
+::GetResolution(const char* theMeshName,
+ const char* thePartName)
{
return VISU::Result::HIDDEN;
}
//---------------------------------------------------------------
-void
+void
VISU::Result_i
-::SetResolution(const char* theMeshName,
- const char* thePartName,
- VISU::Result::Resolution theResolution)
+::SetResolution(const char* theMeshName,
+ const char* thePartName,
+ VISU::Result::Resolution theResolution)
{}
CORBA::Boolean theIsBuildGroups)
{
return new RESULT_CLASS_NAME(theStudy,
- theSourceId,
- theCreationId,
- theIsBuildImmediately,
- theIsBuildFields,
- theIsBuildMinMax,
- theIsBuildGroups);
+ theSourceId,
+ theCreationId,
+ theIsBuildImmediately,
+ theIsBuildFields,
+ theIsBuildMinMax,
+ theIsBuildGroups);
}
VISU::Storable*
VISU::Result_i
::StorableEngine(SALOMEDS::SObject_ptr theSObject,
- const Storable::TRestoringMap& theMap,
- const std::string& thePrefix,
- CORBA::Boolean theIsMultiFile)
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
{
VISU::Result_i* aResult = new RESULT_CLASS_NAME();
return aResult->Restore(theSObject, theMap, thePrefix, theIsMultiFile);
//---------------------------------------------------------------
-void
+void
VISU::Result_i
::ToStream(std::ostringstream& theStr)
{
aCommand.sprintf(" %s %s", aTempFileName, theTargetFileName);
aCommand = QDir::convertSeparators( aCommand );
aCommand.prepend( COPY_COMMAND );
-
+
if(system(aCommand.toLatin1().data()) != 0) {
if(MYDEBUG) MESSAGE("VISU_Gen_i::Copy - Cann't execute the command :"<<aCommand.toLatin1().data());
return false;
}
-void
+void
VISU::Result_i
::SetInitFileName(const std::string& theFileName)
{
SALOMEDS::SObject_var
VISU::Result_i
-::GetSObject() const
-{
+::GetSObject() const
+{
return mySObject;
}
SALOMEDS::Study_var
VISU::Result_i
-::GetStudyDocument() const
-{
+::GetStudyDocument() const
+{
return myStudyDocument;
}
-_PTR(Study)
+_PTR(Study)
VISU::Result_i
-::GetStudy() const
-{
+::GetStudy() const
+{
return myStudy;
}
return mySComponent;
}
-std::string
+std::string
VISU::Result_i
::GetEntry(const Storable::TRestoringMap& theRestoringMap)
{
return Storable::FindEntry(myStudyDocument,
- GetEntry(),
- theRestoringMap);
+ GetEntry(),
+ theRestoringMap);
}
//function : GetAxisInfo
//purpose :
//=======================================================================
-const VISU::Result_i::TAxisInfo*
+const VISU::Result_i::TAxisInfo*
VISU::Result_i
::GetAxisInfo(const string& theMeshName,
- TAxis theAxis,
- gp_Dir& thePlaneNormal)
+ TAxis theAxis,
+ gp_Dir& thePlaneNormal)
{
const TAxisInfo* components = NULL;
theMesh = aIter->second;
VISU::PUnstructuredGridIDMapper anIDMapper = myInput->GetMeshOnEntity(theMeshName,
- CELL_ENTITY);
+ CELL_ENTITY);
vtkUnstructuredGrid* aMesh = anIDMapper->GetUnstructuredGridOutput();
if ( !aMesh || aMesh->GetNumberOfCells() == 0 ) {
float minSize[3] = { FLT_MAX, FLT_MAX, FLT_MAX };
bool axesComputed = false;
for ( vtkIdType iCell = 0; iCell < aMesh->GetNumberOfCells(); ++iCell ) {
- vtkCell* cell = aMesh->GetCell( iCell );
-
- if (cell->GetCellType() != VTK_HEXAHEDRON &&
- cell->GetCellType() != VTK_QUADRATIC_HEXAHEDRON )
- continue;
- vtkPoints * points = cell->GetPoints();
- vtkFloatingPointType coords[ 4 ][3];
- points->GetPoint( 0, coords[0] );
- points->GetPoint( 1, coords[1] );
- points->GetPoint( 3, coords[2] );
- points->GetPoint( 4, coords[3] );
- gp_Pnt p0( coords[0][0], coords[0][1], coords[0][2] );
- for ( iAx = 0; iAx < nbAxes; ++iAx ) {
- vtkFloatingPointType* coo = coords[ iAx + 1 ];
- gp_Pnt p( coo[0], coo[1], coo[2] );
- // min size
- vtkFloatingPointType size = p0.SquareDistance( p );
- if ( size > FLT_MIN && size < minSize[ iAx ] )
- minSize[ iAx ] = size;
- // axis direction
- if ( !axesComputed ) {
- gp_Vec dir( p0, p );
- if ( dir.SquareMagnitude() <= gp::Resolution() ) {
- break;
- }
- axDirs[ iAx ] = dir;
- }
- }
- if ( iAx == nbAxes )
- axesComputed = true;
+ vtkCell* cell = aMesh->GetCell( iCell );
+
+ if (cell->GetCellType() != VTK_HEXAHEDRON &&
+ cell->GetCellType() != VTK_QUADRATIC_HEXAHEDRON )
+ continue;
+ vtkPoints * points = cell->GetPoints();
+ vtkFloatingPointType coords[ 4 ][3];
+ points->GetPoint( 0, coords[0] );
+ points->GetPoint( 1, coords[1] );
+ points->GetPoint( 3, coords[2] );
+ points->GetPoint( 4, coords[3] );
+ gp_Pnt p0( coords[0][0], coords[0][1], coords[0][2] );
+ for ( iAx = 0; iAx < nbAxes; ++iAx ) {
+ vtkFloatingPointType* coo = coords[ iAx + 1 ];
+ gp_Pnt p( coo[0], coo[1], coo[2] );
+ // min size
+ vtkFloatingPointType size = p0.SquareDistance( p );
+ if ( size > FLT_MIN && size < minSize[ iAx ] )
+ minSize[ iAx ] = size;
+ // axis direction
+ if ( !axesComputed ) {
+ gp_Vec dir( p0, p );
+ if ( dir.SquareMagnitude() <= gp::Resolution() ) {
+ break;
+ }
+ axDirs[ iAx ] = dir;
+ }
+ }
+ if ( iAx == nbAxes )
+ axesComputed = true;
}
if ( !axesComputed ) {
- MESSAGE("No good hexahedrons in the mesh: " << theMeshName );
- return components;
+ MESSAGE("No good hexahedrons in the mesh: " << theMeshName );
+ return components;
}
-
+
// compute axes dirs
gInfo = & myMeshName2GridInfoMap[ theMeshName ];
for ( iAx = 0; iAx < nbAxes; ++iAx ) {
- int iPrev = ( iAx == 0 ) ? 2 : iAx - 1;
- int iNext = ( iAx == 2 ) ? 0 : iAx + 1;
- gInfo->myAxis[ iAx ] = axDirs[ iPrev ] ^ axDirs[ iNext ];
+ int iPrev = ( iAx == 0 ) ? 2 : iAx - 1;
+ int iNext = ( iAx == 2 ) ? 0 : iAx + 1;
+ gInfo->myAxis[ iAx ] = axDirs[ iPrev ] ^ axDirs[ iNext ];
}
-
+
// get and sort intermediate component values - projections of nodes
// on axis direction; define bnd box
set< vtkFloatingPointType > comps[ 3 ];
vtkPoints * points = aMesh->GetPoints();
vtkIdType iP, nbP = aMesh->GetNumberOfPoints();
for ( iP = 0; iP < nbP; ++iP ) {
- vtkFloatingPointType coo[3];
- points->GetPoint( iP, coo );
- gp_Pnt p( coo[0], coo[1], coo[2] );
- box.Add( p );
- for ( iAx = 0; iAx < nbAxes; ++iAx ) {
- const gp_Dir& dir = gInfo->myAxis[ iAx ];
- vtkFloatingPointType dot = dir.XYZ() * p.XYZ();
- comps[ iAx ].insert( dot );
- }
+ vtkFloatingPointType coo[3];
+ points->GetPoint( iP, coo );
+ gp_Pnt p( coo[0], coo[1], coo[2] );
+ box.Add( p );
+ for ( iAx = 0; iAx < nbAxes; ++iAx ) {
+ const gp_Dir& dir = gInfo->myAxis[ iAx ];
+ vtkFloatingPointType dot = dir.XYZ() * p.XYZ();
+ comps[ iAx ].insert( dot );
+ }
}
-
+
// find a range of projections of bnd box corners on each axis
vtkFloatingPointType range[3], firstValue[3];
double x[2],y[2],z[2];
box.Get(x[0],y[0],z[0],x[1],y[1],z[1]);
for ( iAx = 0; iAx < nbAxes; ++iAx ) {
- set< vtkFloatingPointType > bndComps;
- const gp_Dir& dir = gInfo->myAxis[ iAx ];
- for ( int iX = 0; iX < 2; ++iX ) {
- for ( int iY = 0; iY < 2; ++iY ) {
- for ( int iZ = 0; iZ < 2; ++iZ ) {
- gp_Pnt p( x[ iX ], y[ iY ], z[ iZ ] );
- vtkFloatingPointType dot = dir.XYZ() * p.XYZ();
- bndComps.insert( dot );
- }
- }
- }
- firstValue[ iAx ] = *bndComps.begin();
- range[ iAx ] = *bndComps.rbegin() - *bndComps.begin();
+ set< vtkFloatingPointType > bndComps;
+ const gp_Dir& dir = gInfo->myAxis[ iAx ];
+ for ( int iX = 0; iX < 2; ++iX ) {
+ for ( int iY = 0; iY < 2; ++iY ) {
+ for ( int iZ = 0; iZ < 2; ++iZ ) {
+ gp_Pnt p( x[ iX ], y[ iY ], z[ iZ ] );
+ vtkFloatingPointType dot = dir.XYZ() * p.XYZ();
+ bndComps.insert( dot );
+ }
+ }
+ }
+ firstValue[ iAx ] = *bndComps.begin();
+ range[ iAx ] = *bndComps.rbegin() - *bndComps.begin();
}
-
+
// compute component values
for ( iAx = 0; iAx < nbAxes; ++iAx ) {
- list< vtkFloatingPointType > values;
- int nbVals = 0;
- set< vtkFloatingPointType >& comp = comps[ iAx ];
- set< vtkFloatingPointType >::iterator val = comp.begin();
- vtkFloatingPointType bnd = -1., rng = range[ iAx ], first = firstValue[ iAx ];
- vtkFloatingPointType tol = 0.1 * sqrt( minSize[ iAx ]) / rng;
- for ( ; val != comp.end(); ++val ) {
- vtkFloatingPointType value = ( *val - first ) / rng;
- if ( value > bnd ) {
- values.push_back( value );
- bnd = value + tol;
- nbVals++;
- }
- }
- // store values in gInfo
- vector< vtkFloatingPointType >& myComp = gInfo->myComponets[ iAx ];
- myComp.resize( nbVals );
- list< vtkFloatingPointType >::iterator v = values.begin();
- for ( int i = 0; v != values.end(); ++v ){
- myComp[ i++ ] = *v;
- }
+ list< vtkFloatingPointType > values;
+ int nbVals = 0;
+ set< vtkFloatingPointType >& comp = comps[ iAx ];
+ set< vtkFloatingPointType >::iterator val = comp.begin();
+ vtkFloatingPointType bnd = -1., rng = range[ iAx ], first = firstValue[ iAx ];
+ vtkFloatingPointType tol = 0.1 * sqrt( minSize[ iAx ]) / rng;
+ for ( ; val != comp.end(); ++val ) {
+ vtkFloatingPointType value = ( *val - first ) / rng;
+ if ( value > bnd ) {
+ values.push_back( value );
+ bnd = value + tol;
+ nbVals++;
+ }
+ }
+ // store values in gInfo
+ vector< vtkFloatingPointType >& myComp = gInfo->myComponets[ iAx ];
+ myComp.resize( nbVals );
+ list< vtkFloatingPointType >::iterator v = values.begin();
+ for ( int i = 0; v != values.end(); ++v ){
+ myComp[ i++ ] = *v;
+ }
}
}
else {
gInfo = & myMeshName2GridInfoMap[ theMeshName ];
switch ( aMeshDim ) {
case 3: {
- gp_Dir aDir(0.0,0.0,1.0);
- gInfo->myAxis[ 2 ] = aDir;
+ gp_Dir aDir(0.0,0.0,1.0);
+ gInfo->myAxis[ 2 ] = aDir;
}
case 2: {
- gp_Dir aDir(0.0,1.0,0.0);
- gInfo->myAxis[ 1 ] = aDir;
+ gp_Dir aDir(0.0,1.0,0.0);
+ gInfo->myAxis[ 1 ] = aDir;
}
case 1: {
- gp_Dir aDir(1.0,0.0,0.0);
- gInfo->myAxis[ 0 ] = aDir;
+ gp_Dir aDir(1.0,0.0,0.0);
+ gInfo->myAxis[ 0 ] = aDir;
}}
-
+
TStructuredId aStructuredId = theMesh->GetStructure();
vector<vtkFloatingPointType> PointsCoords[3];
vtkPoints* aPoints = aMesh->GetPoints();
switch ( aMeshDim ) {
case 3: {
- TStructuredId aCoordIJK;
- vtkIdType nbZ = aStructuredId[2];
- for ( int i = 0; i < nbZ; i++ ) {
- aCoordIJK[2] = i + 1;
- vtkIdType aObjID = anIDMapper->GetObjectIDByIndexes(aCoordIJK);
- vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID);
- vtkFloatingPointType* aPCoord = aPoints->GetPoint(aVTKID);
- PointsCoords[2].push_back(aPCoord[2]);
- }
+ TStructuredId aCoordIJK;
+ vtkIdType nbZ = aStructuredId[2];
+ for ( int i = 0; i < nbZ; i++ ) {
+ aCoordIJK[2] = i + 1;
+ vtkIdType aObjID = anIDMapper->GetObjectIDByIndexes(aCoordIJK);
+ vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID);
+ vtkFloatingPointType* aPCoord = aPoints->GetPoint(aVTKID);
+ PointsCoords[2].push_back(aPCoord[2]);
+ }
}
case 2: {
- TStructuredId aCoordIJK;
- vtkIdType nbJ = aStructuredId[1];
- for ( int i = 0; i < nbJ; i++ ) {
- aCoordIJK[1] = i + 1;
- vtkIdType aObjID = anIDMapper->GetObjectIDByIndexes(aCoordIJK);
- vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID);
- vtkFloatingPointType* aPCoord = aPoints->GetPoint(aVTKID);
- PointsCoords[1].push_back(aPCoord[1]);
- }
+ TStructuredId aCoordIJK;
+ vtkIdType nbJ = aStructuredId[1];
+ for ( int i = 0; i < nbJ; i++ ) {
+ aCoordIJK[1] = i + 1;
+ vtkIdType aObjID = anIDMapper->GetObjectIDByIndexes(aCoordIJK);
+ vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID);
+ vtkFloatingPointType* aPCoord = aPoints->GetPoint(aVTKID);
+ PointsCoords[1].push_back(aPCoord[1]);
+ }
}
case 1: {
- TStructuredId aCoordIJK;
- vtkIdType nbI = aStructuredId[0];
- for ( int i = 0; i < nbI; i++ ) {
- aCoordIJK[0] = i + 1;
- vtkIdType aObjID = anIDMapper->GetObjectIDByIndexes(aCoordIJK);
- vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID);
- vtkFloatingPointType* aPCoord = aPoints->GetPoint(aVTKID);
- PointsCoords[0].push_back(aPCoord[0]);
- }
+ TStructuredId aCoordIJK;
+ vtkIdType nbI = aStructuredId[0];
+ for ( int i = 0; i < nbI; i++ ) {
+ aCoordIJK[0] = i + 1;
+ vtkIdType aObjID = anIDMapper->GetObjectIDByIndexes(aCoordIJK);
+ vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID);
+ vtkFloatingPointType* aPCoord = aPoints->GetPoint(aVTKID);
+ PointsCoords[0].push_back(aPCoord[0]);
+ }
}}
for ( int i = 0; i < aMeshDim; i++ ) {
- vector< vtkFloatingPointType >& myComp = gInfo->myComponets[ i ];
- int aSize = PointsCoords[i].size();
- if ( aSize > 0 ) {
- vtkFloatingPointType aLen = PointsCoords[i][aSize-1] - PointsCoords[i][0];
- myComp.resize(aSize);
- myComp[0] = 0;
- for ( int k = 1; k < aSize; k++ ) {
- myComp[k]=myComp[k-1] + (PointsCoords[i][k]-PointsCoords[i][k-1])/aLen;
- }
- }
+ vector< vtkFloatingPointType >& myComp = gInfo->myComponets[ i ];
+ int aSize = PointsCoords[i].size();
+ if ( aSize > 0 ) {
+ vtkFloatingPointType aLen = PointsCoords[i][aSize-1] - PointsCoords[i][0];
+ myComp.resize(aSize);
+ myComp[0] = 0;
+ for ( int k = 1; k < aSize; k++ ) {
+ myComp[k]=myComp[k-1] + (PointsCoords[i][k]-PointsCoords[i][k-1])/aLen;
+ }
+ }
}
}
}