public:
typedef ::CORBA::Long TypeID;
+ virtual void initFieldMeshInfos();
+
virtual ~MEDPresentation();
static const std::string PROP_NAME; // name of the presentation
virtual void setIntProperty(const std::string& propName, const int propValue);
int getIntProperty(const std::string& propName) const;
- void activateView(); // non const because generates a Python trace
+ // returns True if the view was still alive, False if it must have been recreated
+ // because the user closed it.
+ bool activateView();
+ virtual void recreateViewSetup();
void dumpIntProperties() const;
void dumpStringProperties() const;
typedef std::pair<int, PyObject *> PyObjectId;
static int GeneratePythonId();
- MEDPresentation(MEDPresentation::TypeID fieldHandlerId, const std::string& name,
- const MEDCALC::MEDPresentationViewMode viewMode,
- const MEDCALC::MEDPresentationColorMap colorMap,
- const MEDCALC::MEDPresentationScalarBarRange sbRange);
- std::string getRenderViewCommand() const;
+ MEDPresentation(MEDPresentation::TypeID handlerId, const std::string& name,
+ const MEDCALC::ViewModeType viewMode,
+ const MEDCALC::ColorMapType colorMap,
+ const MEDCALC::ScalarBarRangeType sbRange);
std::string getRenderViewVar() const;
- std::string getResetCameraCommand() const;
- std::string getComponentSelectionCommand() const;
- std::string getColorMapCommand() const;
- std::string getRescaleCommand() const;
+ // The most common elements of the ParaView pipeline:
+ void setOrCreateRenderView();
+ void createSource();
+ void selectFieldComponent();
+ void showObject();
+ void colorBy();
+ void showScalarBar();
+ void rescaleTransferFunction();
+ void selectColorMap();
+ void scalarBarTitle();
+ void resetCameraAndRender();
virtual void internalGeneratePipeline();
PyObject* getPythonObjectFromMain(const char* var) const;
-// void pushPyObjects(PyObjectId obj, PyObjectId disp);
void execPyLine(const std::string & lin);
void pushAndExecPyLine(const std::string & lin);
- MEDPresentation::TypeID getID() const { return _fieldHandlerId; }
+ MEDPresentation::TypeID getID() const { return _handlerId; }
void fillAvailableFieldComponents();
-
-// virtual MEDCALC::MEDPresentationViewMode getViewMode() = 0;
+ void applyCellToPointIfNeeded();
+ void extractFileName(const std::string& name);
+// void convertTo3DVectorField();
template<typename PresentationType, typename PresentationParameters>
void updateComponent(const std::string& newCompo);
template<typename PresentationType, typename PresentationParameters>
- void updateColorMap(MEDCALC::MEDPresentationColorMap colorMap);
+ void updateColorMap(MEDCALC::ColorMapType colorMap);
template<typename PresentationType, typename PresentationParameters>
- void updateScalarBarRange(MEDCALC::MEDPresentationScalarBarRange sbRange);
+ void updateScalarBarRange(MEDCALC::ScalarBarRangeType sbRange);
template<typename PresentationType, typename PresentationParameters>
void getParameters(PresentationParameters& params) const;
void setParameters(const PresentationParameters& params);
private:
- std::string getFieldTypeString(MEDCoupling::TypeOfField fieldType) const;
+ std::string getPVFieldTypeString(MEDCoupling::TypeOfField fieldType) const;
// The following functions are reserved to friend class MEDPresentationManager
void generatePipeline();
void updatePipeline(const PresentationParameters& params);
protected:
+ std::string _meshName;
std::string _fileName;
std::string _fieldName;
- std::string _fieldType;
- MEDPresentation::TypeID _fieldHandlerId;
+ ///! MEDCoupling field type (ON_NODES, ON_CELLS, ON_GAUSS_PT, ON_GAUSS_NE
+ MEDCoupling::TypeOfField _mcFieldType;
+ ///! ParaView field type: "CELLS" or "POINTS"
+ std::string _pvFieldType;
+ ///! ParaView field type: "CELLS" or "POINTS" used in the ColorBy method. Not necessarily equal to _pvFieldType.
+ std::string _colorByType;
+
+ MEDPresentation::TypeID _handlerId; // either a field or a mesh id (a field ID though, most of the time)
int _selectedComponentIndex;
- MEDCALC::MEDPresentationViewMode _viewMode;
- MEDCALC::MEDPresentationColorMap _colorMap;
- MEDCALC::MEDPresentationScalarBarRange _sbRange;
+ MEDCALC::ViewModeType _viewMode;
+ MEDCALC::ColorMapType _colorMap;
+ MEDCALC::ScalarBarRangeType _sbRange;
///! Identifier (in the Python dump) of the render view
int _renderViewPyId;
std::string _dispVar;
///! ParaView LUT variable in the Python scripting commands
std::string _lutVar;
+ ///! ParaView variable in Python holding the data range
+ std::string _rangeVar;
private:
- ///! Pipeline elements
-// std::vector<PyObjectId> _pipeline;
-
- ///! Corresponding display object, if any:
-// std::vector<PyObjectId> _display;
-
///! Presentation properties <key,value>
std::map<std::string, std::string> _propertiesStr;
std::map<std::string, int> _propertiesInt;