}
const std::string
-MEDPresentation::getProperty(const std::string& propName)
+MEDPresentation::getProperty(const std::string& propName) const
{
- if (_properties.find(propName) != _properties.end()) {
- return _properties[propName];
+ std::map<std::string, std::string>::const_iterator it = _properties.find(propName);
+ if (it != _properties.end()) {
+ return (*it).second;
}
else {
std::cerr << "getProperty(): no property named " << propName << std::endl;
}
}
-PyObject * MEDPresentation::getPythonObjectFromMain(const char * python_var)
+PyObject * MEDPresentation::getPythonObjectFromMain(const char * python_var) const
{
// TODO: improve to avoid getting dict at each call
return PyDict_GetItemString(global_dict, python_var);
}
-std::string MEDPresentation::getFieldTypeString(MEDCoupling::TypeOfField fieldType)
+std::string MEDPresentation::getFieldTypeString(MEDCoupling::TypeOfField fieldType) const
{
switch(fieldType)
{
}
std::string
-MEDPresentation::getRenderViewCommand(MEDCALC::MEDPresentationViewMode viewMode)
+MEDPresentation::getRenderViewCommand(MEDCALC::MEDPresentationViewMode viewMode) const
{
std::string cmd = std::string("pvs._DisableFirstRenderCameraReset();");
if (viewMode == MEDCALC::VIEW_MODE_OVERLAP) {
} else if (viewMode == MEDCALC::VIEW_MODE_SPLIT_VIEW) {
cmd += std::string("__view1 = pvs.CreateView('RenderView');");
}
- cmd += std::string("__view1.ResetCamera();");
return cmd;
}
std::string
-MEDPresentation::getColorMapCommand(MEDCALC::MEDPresentationColorMap colorMap)
+MEDPresentation::getResetCameraCommand() const
+{
+ return std::string("__view1.ResetCamera();");
+}
+
+
+std::string
+MEDPresentation::getColorMapCommand(MEDCALC::MEDPresentationColorMap colorMap) const
{
switch(colorMap) {
case MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW: return "Blue to Red Rainbow";
virtual ~MEDPresentation() {}
void setProperty(const std::string& propName, const std::string& propValue);
- const std::string getProperty(const std::string& propName);
+ const std::string getProperty(const std::string& propName) const;
protected:
MEDPresentation(MEDPresentation::TypeID fieldHandlerId, std::string name);
- std::string getRenderViewCommand(MEDCALC::MEDPresentationViewMode viewMode);
- std::string getColorMapCommand(MEDCALC::MEDPresentationColorMap colorMap);
+ std::string getRenderViewCommand(MEDCALC::MEDPresentationViewMode viewMode) const;
+ std::string getResetCameraCommand() const;
+ std::string getColorMapCommand(MEDCALC::MEDPresentationColorMap colorMap) const;
virtual void internalGeneratePipeline() = 0;
- PyObject * getPythonObjectFromMain(const char * var);
+ PyObject * getPythonObjectFromMain(const char * var) const;
void pushInternal(PyObject * obj, PyObject * disp = NULL);
- MEDPresentation::TypeID getID() { return _fieldHandlerId; }
+ MEDPresentation::TypeID getID() const { return _fieldHandlerId; }
private:
void generatePipeline(); // reserved to friend class MEDPresentationManager
- std::string getFieldTypeString(MEDCoupling::TypeOfField fieldType);
+ std::string getFieldTypeString(MEDCoupling::TypeOfField fieldType) const;
protected:
cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
cmd += std::string("pvs.Render();");
+ cmd += getResetCameraCommand();
+
//std::cerr << "Python command:" << std::endl;
//std::cerr << cmd << std::endl;
PyRun_SimpleString(cmd.c_str());
cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
cmd += std::string("pvs.Render();");
+ cmd += getResetCameraCommand();
+
//std::cerr << "Python command:" << std::endl;
//std::cerr << cmd << std::endl;
PyRun_SimpleString(cmd.c_str());
cmd += std::string("__disp1.SetRepresentationType('Point Sprite');");
cmd += std::string("pvs.Render();");
+ cmd += getResetCameraCommand();
+
//std::cerr << "Python command:" << std::endl;
//std::cerr << cmd << std::endl;
PyRun_SimpleString(cmd.c_str());
cmd += std::string("__lut.ApplyPreset('")+getColorMapCommand(_params.colorMap)+std::string("',True);");
cmd += std::string("pvs.Render();");
+ cmd += getResetCameraCommand();
+
//std::cerr << "Python command:" << std::endl;
//std::cerr << cmd << std::endl;
PyRun_SimpleString(cmd.c_str());
cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
cmd += std::string("pvs.Render();");
+ cmd += getResetCameraCommand();
+
//std::cerr << "Python command:" << std::endl;
//std::cerr << cmd << std::endl;
PyRun_SimpleString(cmd.c_str());
cmd += std::string("__disp1.SetRepresentationType('3D Glyphs');");
cmd += std::string("pvs.Render();");
+ cmd += getResetCameraCommand();
+
//std::cerr << "Python command:" << std::endl;
//std::cerr << cmd << std::endl;
PyRun_SimpleString(cmd.c_str());