From: srn Date: Thu, 2 Feb 2006 14:52:15 +0000 (+0000) Subject: Removed VisualParameters X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1caba595c9e26bd2cf18b86205cc4f021df660de;p=modules%2Fgui.git Removed VisualParameters --- diff --git a/src/SalomeApp/Makefile.in b/src/SalomeApp/Makefile.in index ca78f8ae2..98b8492b2 100755 --- a/src/SalomeApp/Makefile.in +++ b/src/SalomeApp/Makefile.in @@ -25,8 +25,8 @@ EXPORT_HEADERS= SalomeApp.h \ SalomeApp_Filter.h \ SalomeApp_TypeFilter.h \ SalomeApp_StudyPropertiesDlg.h \ - SalomeApp_CheckFileDlg.h \ - SalomeApp_VisualParameters.h + SalomeApp_CheckFileDlg.h +# SalomeApp_VisualParameters.h # .po files to transform in .qm PO_FILES = SalomeApp_images.po \ @@ -49,8 +49,8 @@ LIB_SRC= SalomeApp_Module.cxx \ SalomeApp_TypeFilter.cxx \ SalomeApp_StudyPropertiesDlg.cxx \ SalomeApp_ListView.cxx \ - SalomeApp_CheckFileDlg.cxx \ - SalomeApp_VisualParameters.cxx + SalomeApp_CheckFileDlg.cxx +# SalomeApp_VisualParameters.cxx LIB_MOC = SalomeApp_Application.h \ SalomeApp_DataModel.h \ diff --git a/src/SalomeApp/SalomeApp_Module.cxx b/src/SalomeApp/SalomeApp_Module.cxx index 3a8a5061c..abe7dfb4a 100644 --- a/src/SalomeApp/SalomeApp_Module.cxx +++ b/src/SalomeApp/SalomeApp_Module.cxx @@ -104,54 +104,9 @@ void SalomeApp_Module::extractContainers( const SALOME_ListIO& source, SALOME_Li * This method is called just before the study document is saved, so the module has a possibility * to store visual parameters in AttributeParameter attribue(s) */ -//#include "SalomeApp_VisualParameters.h" void SalomeApp_Module::storeVisualParameters(int savePoint) { cout << "SalomeApp_Module::storeVisualParameters" << endl; - /* - SalomeApp_VisualParameters vp("test", 1); - _PTR(AttributeParameter) ap = vp.getContainer(); - - vector v; - v.push_back(0); - v.push_back(1); - v.push_back(1); - vp.setColor("0:1", v); - vp.setLineWidth("0:1", 0.1); - - cout << "CHECK 1 "; - vector vr = ap->GetRealArray(1); - for(int i = 0; iGetRealArray(1); - for(int i = 0; i vr = ap->GetRealArray(1); - for(int i = 0; i v = vp.getColor("0:1"); - for(int i = 0; i<3; i++) cout << "0:1 color " << v[i] << endl; - cout << "color 2" << endl; - v = vp.getColor("0:2"); - for(int i = 0; i<3; i++) cout << "0:2 color " << v[i] << endl; - cout << "Line width " << vp.getLineWidth("0:1") << endl; - cout << "Display mode for 0:1 " << vp.getPresentationMode("0:1") << endl; - cout << "Display mode for 0:2 " << vp.getPresentationMode("0:2") << endl; - cout << "Transparency " << vp.getTransparency("0:2") << endl; - */ } diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index 56d4d1945..a1e2b8afa 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -673,8 +673,9 @@ vector SalomeApp_Study::getSavePoints() //================================================================ QString SalomeApp_Study::getNameOfSavePoint(int savePoint) { - ViewerContainer container(savePoint); - return container.getSavePointName(); + _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters("Interface Applicative", savePoint); + if(!AP->IsSet("AP_SAVEPOINT_NAME", 3)) return ""; + return AP->GetString("AP_SAVEPOINT_NAME"); } //================================================================ @@ -684,8 +685,8 @@ QString SalomeApp_Study::getNameOfSavePoint(int savePoint) //================================================================ void SalomeApp_Study::setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint) { - ViewerContainer container(savePoint); - container.setSavePointName(nameOfSavePoint); + _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters("Interface Applicative", savePoint); + AP->SetString("AP_SAVEPOINT_NAME", nameOfSavePoint.latin1()); } //================================================================ @@ -702,7 +703,7 @@ int SalomeApp_Study::storeState() vector savePoints = getSavePoints(); //Calculate a new savePoint number = the last save point number + 1 if(savePoints.size() > 0) savePoint = savePoints[savePoints.size()-1] + 1; - + /* //Remove the previous content of the attribute ViewerContainer container(savePoint); container.init(); @@ -745,7 +746,7 @@ int SalomeApp_Study::storeState() container.addModule(module->moduleName()); module->storeVisualParameters(savePoint); } - + */ return savePoint; } @@ -758,6 +759,7 @@ void SalomeApp_Study::restoreState(int savePoint) { cout << "SalomeApp_Study::restoreState: " << savePoint << endl; + /* ViewerContainer container(savePoint); //Remove all already existent veiwers and their views @@ -823,20 +825,6 @@ void SalomeApp_Study::restoreState(int savePoint) QString activeModuleName = container.getActiveModule(); if(activeModuleName != "") ((SalomeApp_Application*)application())->activateModule(activeModuleName); - -} - -//================================================================ -// Function : getStateParameters -/*! Purpose : Return an attribute that stores the saved state parameters -*/ -//================================================================ -_PTR(AttributeParameter) SalomeApp_Study::getStateParameters(int savePoint) -{ - _PTR(StudyBuilder) builder = studyDS()->NewBuilder(); - _PTR(SObject) so = studyDS()->FindComponent("Interface Applicative"); - if(!so) so = builder->NewComponent("Interface Applicative"); - _PTR(SObject) newSO = builder->NewObjectToTag(so, savePoint); - return builder->FindOrCreateAttribute(newSO, "AttributeParameter"); + */ } diff --git a/src/SalomeApp/SalomeApp_Study.h b/src/SalomeApp/SalomeApp_Study.h index 475508c93..fbf9c9834 100644 --- a/src/SalomeApp/SalomeApp_Study.h +++ b/src/SalomeApp/SalomeApp_Study.h @@ -71,7 +71,6 @@ public: void setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint); virtual int storeState(); virtual void restoreState(int savePoint); - _PTR(AttributeParameter) getStateParameters(int savePoint); protected: virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles ); diff --git a/src/SalomeApp/SalomeApp_VisualParameters.cxx b/src/SalomeApp/SalomeApp_VisualParameters.cxx deleted file mode 100644 index 853f7ac38..000000000 --- a/src/SalomeApp/SalomeApp_VisualParameters.cxx +++ /dev/null @@ -1,542 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ -// -#include "SalomeApp_VisualParameters.h" -#include - -using namespace std; - -#define PT_INTEGER 0 -#define PT_REAL 1 -#define PT_BOOLEAN 2 -#define PT_STRING 3 -#define PT_REALARRAY 4 -#define PT_INTARRAY 5 -#define PT_STRARRAY 6 - -#define ONE_ENTRY_DBL_ARGS_LENGTH 12 -#define IDX_COLOR_R 0 -#define IDX_COLOR_G 1 -#define IDX_COLOR_B 2 -#define IDX_TRANSPARENCY 3 -#define IDX_LINE_WIDTH 4 -#define IDX_CLIPPING 5 //[5:11] -#define CLIPPING_LENGTH 6 - -#define ONE_ENTRY_INT_ARGS_LENGTH 4 -#define IDX_DISPLAY_MODE 0 -#define IDX_DISPLAYED 1 -#define IDX_TYPE 2 - -#define AP_ENTRIES 0 //StrArray -#define AP_DOUBLE_ARGS 1 //RealArray -#define AP_INT_ARGS 1 //IntArray -#define AP_MODULE_NAME 1 //String -/*! - Constructor -*/ -SalomeApp_VisualParameters::SalomeApp_VisualParameters(const string& moduleName, const int savePoint) -{ - SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if( !study ) return; - _PTR(AttributeParameter) main_ap = study->getStateParameters(savePoint); - _PTR(SObject) main_so = main_ap->GetSObject(); - - - _PTR(ChildIterator) it = study->studyDS()->NewChildIterator(main_so); - for(; it->More(); it->Next()) { - _PTR(SObject) so(it->Value()); - _PTR(GenericAttribute) ga; - if(so->FindAttribute(ga, "AttributeParameter")) { - _PTR(AttributeParameter) par(ga); - if(!par->IsSet(AP_MODULE_NAME, PT_STRING)) continue; - if(par->GetString(AP_MODULE_NAME) == moduleName) { - _ap = par; - return; - } - } - } - - _PTR(StudyBuilder) builder = study->studyDS()->NewBuilder(); - _PTR(SObject) so = builder->NewObject(main_so); - _ap = builder->FindOrCreateAttribute(so, "AttributeParameter"); - setModuleName(moduleName); -} - -/*! - sets a name of the module for which the parameters are stored -*/ -void SalomeApp_VisualParameters::setModuleName(const string& moduleName) -{ - if(!_ap) return; - _ap->SetString(AP_MODULE_NAME, moduleName); -} - -/*! - returns a name of the module for which the parameters are stored -*/ -string SalomeApp_VisualParameters::getModuleName() -{ - if(!_ap) return ""; - if(!_ap->IsSet(AP_MODULE_NAME, PT_STRING)) return ""; - return _ap->GetString(AP_MODULE_NAME); -} - -/*! - sets a color (RGB values) for the obect with id \a entry -*/ -void SalomeApp_VisualParameters::setColor(const string& entry, const vector& color) -{ - int entryID = getEntryID(entry); - if(entryID < 0 || color.size() < 3) return; - vector vr; - if(!_ap->IsSet(AP_DOUBLE_ARGS, PT_REALARRAY)) return; - vr = _ap->GetRealArray(AP_DOUBLE_ARGS); - int idx = entryID*ONE_ENTRY_DBL_ARGS_LENGTH; - - vr[idx+IDX_COLOR_R] = color[0]; - vr[idx+IDX_COLOR_G] = color[1]; - vr[idx+IDX_COLOR_B] = color[2]; - _ap->SetRealArray(AP_DOUBLE_ARGS, vr); -} - -/*! - returns a color (RGB values) for the obect with id \a entry -*/ -vector SalomeApp_VisualParameters::getColor(const string& entry) -{ - vector color, vr; - int entryID = getEntryID(entry); - if(entryID < 0) return color; - if(!_ap->IsSet(AP_DOUBLE_ARGS, PT_REALARRAY)) return color; - vr = _ap->GetRealArray(AP_DOUBLE_ARGS); - int idx = entryID*ONE_ENTRY_DBL_ARGS_LENGTH; - - color.push_back(vr[idx+IDX_COLOR_R]); - color.push_back(vr[idx+IDX_COLOR_G]); - color.push_back(vr[idx+IDX_COLOR_B]); - - return color; -} - -/*! - sets a transparency for the obect with id \a entry -*/ -void SalomeApp_VisualParameters::setTransparency(const string& entry, const double& value) -{ - int entryID = getEntryID(entry); - if(entryID < 0) return; - if(!_ap->IsSet(AP_DOUBLE_ARGS, PT_REALARRAY)) return; - vector vr = _ap->GetRealArray(AP_DOUBLE_ARGS); - int idx = entryID*ONE_ENTRY_DBL_ARGS_LENGTH; - - vr[idx+IDX_TRANSPARENCY] = value; - _ap->SetRealArray(AP_DOUBLE_ARGS, vr); -} - -/*! - returns a transparency for the obect with id \a entry -*/ -double SalomeApp_VisualParameters::getTransparency(const string& entry) -{ - int entryID = getEntryID(entry); - if(entryID < 0) return -1.0; - if(!_ap->IsSet(AP_DOUBLE_ARGS, PT_REALARRAY)) return -1.0; - vector vr = _ap->GetRealArray(AP_DOUBLE_ARGS); - int idx = entryID*ONE_ENTRY_DBL_ARGS_LENGTH; - - return vr[idx+IDX_TRANSPARENCY]; -} - -/*! - sets a line width for the obect with id \a entry -*/ -void SalomeApp_VisualParameters::setLineWidth(const string& entry, const double& value) -{ - int entryID = getEntryID(entry); - if(entryID < 0) return; - if(!_ap->IsSet(AP_DOUBLE_ARGS, PT_REALARRAY)) return; - vector vr = _ap->GetRealArray(AP_DOUBLE_ARGS); - int idx = entryID*ONE_ENTRY_DBL_ARGS_LENGTH; - - vr[idx+IDX_LINE_WIDTH] = value; - _ap->SetRealArray(AP_DOUBLE_ARGS, vr); -} - -/*! - returns a line width for the obect with id \a entry -*/ -double SalomeApp_VisualParameters::getLineWidth(const string& entry) -{ - int entryID = getEntryID(entry); - if(entryID < 0) return -1.0; - if(!_ap->IsSet(AP_DOUBLE_ARGS, PT_REALARRAY)) return -1.0; - vector vr = _ap->GetRealArray(AP_DOUBLE_ARGS); - int idx = entryID*ONE_ENTRY_DBL_ARGS_LENGTH; - - return vr[idx+IDX_LINE_WIDTH]; -} - -/*! - sets a represenatation mode of the obect with id \a entry -*/ -void SalomeApp_VisualParameters::setPresentationMode(const string& entry, const int mode) -{ - int entryID = getEntryID(entry); - if(entryID < 0) return; - if(!_ap->IsSet(AP_INT_ARGS, PT_INTARRAY)) return; - vector vr = _ap->GetIntArray(AP_INT_ARGS); - int idx = entryID*ONE_ENTRY_INT_ARGS_LENGTH; - - vr[idx+IDX_DISPLAY_MODE] = mode; - _ap->SetIntArray(AP_INT_ARGS, vr); -} - -/*! - returns a represenatation mode of the obect with id \a entry -*/ -int SalomeApp_VisualParameters::getPresentationMode(const string& entry) -{ - int entryID = getEntryID(entry); - if(entryID < 0) return -1; - if(!_ap->IsSet(AP_INT_ARGS, PT_INTARRAY)) return -1; - vector vr = _ap->GetIntArray(AP_INT_ARGS); - int idx = entryID*ONE_ENTRY_INT_ARGS_LENGTH; - - return vr[idx+IDX_DISPLAY_MODE]; -} - -/*! - marks the object with id \a entry as displayed -*/ -void SalomeApp_VisualParameters::setDisplayed(const string& entry) -{ - int entryID = getEntryID(entry); - if(entryID < 0) return; - if(!_ap->IsSet(AP_INT_ARGS, PT_INTARRAY)) return; - vector vr = _ap->GetIntArray(AP_INT_ARGS); - int idx = entryID*ONE_ENTRY_INT_ARGS_LENGTH; - - vr[idx+IDX_DISPLAYED] = 1; - _ap->SetIntArray(AP_INT_ARGS, vr); -} - -/*! - returns true if the object with id \a entry is displayed -*/ -bool SalomeApp_VisualParameters::isDisplayed(const string& entry) -{ - int entryID = getEntryID(entry); - if(entryID < 0) return -1; - if(!_ap->IsSet(AP_INT_ARGS, PT_INTARRAY)) return -1; - vector vr = _ap->GetIntArray(AP_INT_ARGS); - int idx = entryID*ONE_ENTRY_INT_ARGS_LENGTH; - - return (vr[idx+IDX_DISPLAYED] == 1); -} - -/*! - sets a type of the displayed object with id \a entry -*/ -void SalomeApp_VisualParameters::setTypeOfDisplayed(const string& entry, const int type) -{ - int entryID = getEntryID(entry); - if(entryID < 0) return; - if(!_ap->IsSet(AP_INT_ARGS, PT_INTARRAY)) return; - vector vr = _ap->GetIntArray(AP_INT_ARGS); - int idx = entryID*ONE_ENTRY_INT_ARGS_LENGTH; - - vr[idx+IDX_TYPE] = type; - _ap->SetIntArray(AP_INT_ARGS, vr); -} - -/*! - gets a type of displayed object with id \a entry -*/ -int SalomeApp_VisualParameters::getTypeOfDisplayed(const string& entry) -{ - int entryID = getEntryID(entry); - if(entryID < 0) return -1; - if(!_ap->IsSet(AP_INT_ARGS, PT_INTARRAY)) return -1; - vector vr = _ap->GetIntArray(AP_INT_ARGS); - int idx = entryID*ONE_ENTRY_INT_ARGS_LENGTH; - - return vr[idx+IDX_TYPE]; -} - -/*! - sets clipping plane definitions for the object with id \a entry -*/ -void SalomeApp_VisualParameters::setClipping(const string& entry, const vector& color) -{ -} - -/*! - returns clipping plane definitions for the object with id \a entry -*/ -vector SalomeApp_VisualParameters::getClipping(const string& entry) -{ - vector v; - return v; -} - -/*! - returns a list of stored entries -*/ -vector SalomeApp_VisualParameters::getEntries() -{ - vector v; - if(!_ap) return v; - if(!_ap->IsSet(AP_ENTRIES, PT_STRARRAY)) return v; - return _ap->GetStrArray(AP_ENTRIES); -} - -/*! - returns an id of the \a entry -*/ -int SalomeApp_VisualParameters::getEntryID(const std::string& entry) -{ - if(!_ap) return -1; - vector v = getEntries(); - int idx = 0; - for(int i = 0; i v = getEntries(); - v.push_back(entry); - _ap->SetStrArray(AP_ENTRIES, v); - - //Add double parameters of the entry - vector vr, new_vr; - if(_ap->IsSet(AP_DOUBLE_ARGS, PT_REALARRAY)) vr = _ap->GetRealArray(AP_DOUBLE_ARGS); - int length = vr.size(), new_length = vr.size(); - new_length += ONE_ENTRY_DBL_ARGS_LENGTH; - new_vr.resize(new_length); - for(int i = 0; iSetRealArray(AP_DOUBLE_ARGS, new_vr); - - - //Add int parameters of the entry - vector vi, new_vi; - if(_ap->IsSet(AP_INT_ARGS, PT_INTARRAY)) vi = _ap->GetIntArray(AP_INT_ARGS); - length = vi.size(); - new_length = vi.size(); - new_length += ONE_ENTRY_INT_ARGS_LENGTH; - new_vi.resize(new_length); - for(int i = 0; iSetIntArray(AP_INT_ARGS, new_vi); - - return (v.size()-1); -} - - - -/*###############################################################################################*/ - -#define AP_ID_OF_VIEWERS 1 //Int array -#define AP_ID_OF_VIEWS 2 //Int array -#define AP_MODULES 1 //String array -#define AP_ACTIVE_VIEW 1 //INT -#define AP_ACTIVE_MODULE 1 //STRING -#define AP_SAVE_POINT_NAME 2 //STRING - -#define START_VIEWER_ID 100 -#define START_VIEW_ID 200 - -ViewerContainer::ViewerContainer(int savePoint) -{ - SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if( !study ) return; - _ap = study->getStateParameters(savePoint); -} - -int ViewerContainer::getNbViewers() -{ - if(!_ap) return -1; - if(!_ap->IsSet(AP_ID_OF_VIEWERS, PT_INTARRAY)) return 0; - return _ap->GetIntArray(AP_ID_OF_VIEWERS).size(); -} - -void ViewerContainer::setActiveViewID(int viewerID) -{ - if(!_ap) return; - _ap->SetInt(AP_ACTIVE_VIEW, viewerID); -} - -int ViewerContainer::getActiveViewID() -{ - if(!_ap) return -1; - if(!_ap->IsSet(AP_ACTIVE_VIEW, PT_INTEGER)) return -1; - return _ap->GetInt(AP_ACTIVE_VIEW); -} - -int ViewerContainer::getViewerID(int viewerNumber) -{ - if(!_ap) return -1; - vector v; - if(_ap->IsSet(AP_ID_OF_VIEWERS, PT_INTARRAY)) v = _ap->GetIntArray(AP_ID_OF_VIEWERS); - if(v.size() < viewerNumber) return -1; - return v[viewerNumber-1]; -} - -string ViewerContainer::getViewerType(int viewerID) -{ - if(!_ap) return ""; - if(!_ap->IsSet(viewerID, PT_STRING)) return ""; - return _ap->GetString(viewerID); -} - -int ViewerContainer::addViewer(const QString& type) -{ - if(!_ap) return -1; - vector v; - if(_ap->IsSet(AP_ID_OF_VIEWERS, PT_INTARRAY)) v = _ap->GetIntArray(AP_ID_OF_VIEWERS); - int viewerID = _currentViewerID; - v.push_back(viewerID); - _ap->SetIntArray(AP_ID_OF_VIEWERS, v); //Added a new viewer to the list of viewers - _ap->SetString(viewerID, type.latin1()); //Viewer type - - //Compute the next viewer ID - _currentViewerID++; - - return viewerID; -} - -int ViewerContainer::getNbViews(int viewerID) -{ - if(!_ap) return -1; - if(!_ap->IsSet(viewerID, PT_INTARRAY)) return 0; - return _ap->GetIntArray(viewerID).size(); -} - -int ViewerContainer::getViewID(int viewerID, int viewNumber) -{ - if(!_ap) return -1; - //Get a list of view ID's associated with the given viewer - vector v; - if(_ap->IsSet(viewerID, PT_INTARRAY)) v = _ap->GetIntArray(viewerID); - if(v.size() < viewNumber) return -1; - return v[viewNumber-1]; -} - -int ViewerContainer::addView(int viewerID, const QString& caption, const QString& parameters) -{ - if(!_ap) return -1; - //Get a list of view ID's associated with the given viewer - vector v; - if(_ap->IsSet(viewerID, PT_INTARRAY)) v = _ap->GetIntArray(viewerID); - int viewID = _currentViewID; - - v.push_back(viewID); - _ap->SetIntArray(viewerID, v); //Add a view to the list of viewer's views - - vector vs; - vs.push_back(caption.latin1()); - vs.push_back(parameters.latin1()); - _ap->SetStrArray(viewID, vs); //Store view's caption and parameters - - - - //Compute the next view ID - _currentViewID++; - - return viewID; -} - -QString ViewerContainer::getViewCaption(int viewID) -{ - if(!_ap) return ""; - vector vs; - if(_ap->IsSet(viewID, PT_STRARRAY)) vs = _ap->GetStrArray(viewID); - if(vs.size() < 2) return ""; - return vs[0]; -} - -QString ViewerContainer::getViewParameters(int viewID) -{ - if(!_ap) return ""; - vector vs; - if(_ap->IsSet(viewID, PT_STRARRAY)) vs = _ap->GetStrArray(viewID); - if(vs.size() < 2) return ""; - return vs[1]; -} - -void ViewerContainer::addModule(const QString& name) -{ - vector v; - if(!_ap) return; - if(_ap->IsSet(AP_MODULES, PT_STRARRAY)) v = _ap->GetStrArray(AP_MODULES); - v.push_back(name.latin1()); - _ap->SetStrArray(AP_MODULES, v); -} - -void ViewerContainer::setActiveModule(const QString& name) -{ - if(!_ap) return; - _ap->SetString(AP_ACTIVE_MODULE, name.latin1()); -} - -QString ViewerContainer::getActiveModule() -{ - if(!_ap) return ""; - if(!_ap->IsSet(AP_ACTIVE_MODULE, PT_STRING)) return ""; - return _ap->GetString(AP_ACTIVE_MODULE); -} - -vector ViewerContainer::getModules() -{ - vector v; - if(!_ap) return v; - if(!_ap->IsSet(AP_MODULES, PT_STRARRAY)) return v; - return _ap->GetStrArray(AP_MODULES); -} - -void ViewerContainer::setSavePointName(const QString& name) -{ - if(!_ap) return; - _ap->SetString(AP_SAVE_POINT_NAME, name.latin1()); -} - -QString ViewerContainer::getSavePointName() -{ - if(!_ap) return ""; - if(!_ap->IsSet(AP_SAVE_POINT_NAME, PT_STRING)) return ""; - return _ap->GetString(AP_SAVE_POINT_NAME); -} - - -void ViewerContainer::init() -{ - _ap->Clear(); - _currentViewerID = START_VIEWER_ID; - _currentViewID = START_VIEW_ID; -} diff --git a/src/SalomeApp/SalomeApp_VisualParameters.h b/src/SalomeApp/SalomeApp_VisualParameters.h deleted file mode 100644 index 5866b1cf6..000000000 --- a/src/SalomeApp/SalomeApp_VisualParameters.h +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ -// -#ifndef SALOMEAPP_VisualParameters_H -#define SALOMEAPP_VisualParameters_H - -#include "SalomeApp.h" - -#include -#include -#include - -#include "SUIT_Session.h" -#include "SalomeApp_Study.h" - -#include - -/*! - Class which an interface to store the visual parameters of the objects -*/ -class SALOMEAPP_EXPORT SalomeApp_VisualParameters -{ -public: - SalomeApp_VisualParameters(const std::string& moduleName, const int savePoint); - - void setModuleName(const std::string& moduleName); - std::string getModuleName(); - - void setColor(const std::string& entry, const std::vector& color); - std::vector getColor(const std::string& entry); - - void setTransparency(const std::string& entry, const double& value); - double getTransparency(const std::string& entry); - - void setLineWidth(const std::string& entry, const double& value); - double getLineWidth(const std::string& entry); - - void setPresentationMode(const std::string& entry, const int mode); - int getPresentationMode(const std::string& entry); - - void setDisplayed(const std::string& entry); - bool isDisplayed(const std::string& entry); - - void setTypeOfDisplayed(const std::string& entry, const int type); - int getTypeOfDisplayed(const std::string& entry); - - void setClipping(const std::string& entry, const std::vector& color); - std::vector getClipping(const std::string& entry); - - _PTR(AttributeParameter) getContainer() { return _ap; } - - - std::vector getEntries(); - int getEntryID(const std::string& entry); - - protected: - int addEntry(const std::string& entry); - - private: - _PTR(AttributeParameter) _ap; - -}; - -/*! - * \brief internal class -*/ -class SALOMEAPP_EXPORT ViewerContainer -{ - public: - ViewerContainer(int savePoint); - - /*! returns a number of viewers*/ - int getNbViewers(); - /*! sets an active view ID*/ - void setActiveViewID(int viewID); - /*! returns an active view ID*/ - int getActiveViewID(); - /*! returns an ID of the viewer with given number [1:nbViewers]*/ - int getViewerID(int viewerNumber); - /*! returns a type of the viewer with given ID*/ - std::string getViewerType(int viewerID); - /*! returns the added viewer ID */ - int addViewer(const QString& type); - /*! returns a number of views of the viewer with given ID*/ - int getNbViews(int viewerID); - /*! returns an ID of the view with given number [1:nbViews]*/ - int getViewID(int viewerID, int viewNumber); - /*! adds a view of the viewer */ - int addView(int viewerID, const QString& caption, const QString& parameters); - /*! return a caption of the view with given ID*/ - QString getViewCaption(int viewID); - /*! return parameters of the view with given ID*/ - QString getViewParameters(int viewID); - - - void addModule(const QString& name); - void setActiveModule(const QString& name); - QString getActiveModule(); - std::vector getModules(); - - void setSavePointName(const QString& name); - QString getSavePointName(); - - void init(); - - _PTR(AttributeParameter) getContainer() { return _ap; } - - protected: - _PTR(AttributeParameter) _ap; - int _currentViewerID; - int _currentViewID; -}; - -#endif