+ if ( obj ) {
+ QString aName = QString( obj->GetName().c_str() );
+ aName.remove( QRegExp("\\s+$") );
+ title = aName;
+ }
+ }
+}
+
+void GeometryGUI::createPreferences()
+{
+ int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
+
+ int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId );
+ setPreferenceProperty( genGroup, "columns", 2 );
+
+ int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), genGroup,
+ LightApp_Preferences::Selector,
+ "Geometry", "display_mode" );
+
+ addPreference( tr( "PREF_SHADING_COLOR" ), genGroup,
+ LightApp_Preferences::Color, "Geometry", "shading_color" );
+
+ addPreference( tr( "PREF_EDGES_IN_SHADING" ), genGroup,
+ LightApp_Preferences::Color, "Geometry", "edges_in_shading_color" );
+
+ addPreference( tr( "PREF_WIREFRAME_COLOR" ), genGroup,
+ LightApp_Preferences::Color, "Geometry", "wireframe_color" );
+
+ addPreference( tr( "PREF_FREE_BOUND_COLOR" ), genGroup,
+ LightApp_Preferences::Color, "Geometry", "free_bound_color" );
+
+ addPreference( tr( "PREF_LINE_COLOR"), genGroup,
+ LightApp_Preferences::Color, "Geometry", "line_color" );
+
+ addPreference( tr( "PREF_POINT_COLOR"), genGroup,
+ LightApp_Preferences::Color, "Geometry", "point_color" );
+
+ addPreference( tr( "PREF_ISOS_COLOR" ), genGroup,
+ LightApp_Preferences::Color, "Geometry", "isos_color" );
+
+ addPreference( tr( "PREF_TOPLEVEL_COLOR" ), genGroup,
+ LightApp_Preferences::Color, "Geometry", "toplevel_color" );
+
+ int top_lev_dm = addPreference( tr( "PREF_TOPLEVEL_DM" ), genGroup,
+ LightApp_Preferences::Selector, "Geometry", "toplevel_dm" );
+
+ int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" );
+
+ int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup,
+ LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
+
+ int material = addPreference( tr( "PREF_MATERIAL" ), genGroup,
+ LightApp_Preferences::Selector,
+ "Geometry", "material" );
+
+ const int nb = 4;
+ int wd[nb];
+ int iter=0;
+
+ wd[iter++] = addPreference( tr( "PREF_EDGE_WIDTH" ), genGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "edge_width" );
+
+ wd[iter++] = addPreference( tr( "PREF_ISOLINES_WIDTH" ), genGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "isolines_width" );
+
+ wd[iter++] = addPreference( tr( "PREF_PREVIEW_EDGE_WIDTH" ), genGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "preview_edge_width" );
+
+ wd[iter++] = addPreference( tr( "PREF_MEASURES_LINE_WIDTH" ), genGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "measures_line_width" );
+
+ for (int i = 0; i < nb; i++) {
+ setPreferenceProperty( wd[i], "min", 1 );
+ setPreferenceProperty( wd[i], "max", 5 );
+ }
+
+ // Quantities with individual precision settings
+ int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId );
+ setPreferenceProperty( precGroup, "columns", 2 );
+
+ const int nbQuantities = 8;
+ int prec[nbQuantities], ii = 0;
+ prec[ii++] = addPreference( tr( "GEOM_PREF_length_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "length_precision" );
+ prec[ii++] = addPreference( tr( "GEOM_PREF_angle_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "angle_precision" );
+ prec[ii++] = addPreference( tr( "GEOM_PREF_len_tol_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "len_tol_precision" );
+ prec[ii++] = addPreference( tr( "GEOM_PREF_ang_tol_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "ang_tol_precision" );
+ prec[ii++] = addPreference( tr( "GEOM_PREF_weight_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "weight_precision" );
+ prec[ii++] = addPreference( tr( "GEOM_PREF_density_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "density_precision" );
+ prec[ii++] = addPreference( tr( "GEOM_PREF_parametric_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "parametric_precision" );
+ prec[ii ] = addPreference( tr( "GEOM_PREF_param_tol_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "param_tol_precision" );
+
+ // Set property for precision value for spinboxes
+ for ( ii = 0; ii < nbQuantities; ii++ ){
+ setPreferenceProperty( prec[ii], "min", -14 );
+ setPreferenceProperty( prec[ii], "max", 14 );
+ setPreferenceProperty( prec[ii], "precision", 2 );
+ }
+
+ int VertexGroup = addPreference( tr( "PREF_GROUP_VERTEX" ), tabId );
+ setPreferenceProperty( VertexGroup, "columns", 2 );
+
+ int typeOfMarker = addPreference( tr( "PREF_TYPE_OF_MARKER" ), VertexGroup,
+ LightApp_Preferences::Selector, "Geometry", "type_of_marker" );
+
+ int markerScale = addPreference( tr( "PREF_MARKER_SCALE" ), VertexGroup,
+ LightApp_Preferences::Selector, "Geometry", "marker_scale" );
+
+ // Set property for default display mode
+ QStringList aModesList;
+ aModesList.append( tr("MEN_WIREFRAME") );
+ aModesList.append( tr("MEN_SHADING") );
+ aModesList.append( tr("MEN_SHADING_WITH_EDGES") );
+
+ QList<QVariant> anIndexesList;
+ anIndexesList.append(0);
+ anIndexesList.append(1);
+ anIndexesList.append(2);
+
+ setPreferenceProperty( dispmode, "strings", aModesList );
+ setPreferenceProperty( dispmode, "indexes", anIndexesList );
+
+ // Set property for top level display mode
+ QStringList aTopModesList;
+ aTopModesList.append( tr("MEN_SHOW_ADD_WACTOR") );
+ aTopModesList.append( tr("MEN_KEEP_CURRENT_DM") );
+ aTopModesList.append( tr("MEN_WIREFRAME") );
+ aTopModesList.append( tr("MEN_SHADING") );
+ aTopModesList.append( tr("MEN_SHADING_WITH_EDGES") );
+
+ QList<QVariant> aTopIndexesList;
+ aTopIndexesList.append(0);
+ aTopIndexesList.append(1);
+ aTopIndexesList.append(2);
+ aTopIndexesList.append(3);
+ aTopIndexesList.append(4);
+
+ setPreferenceProperty( top_lev_dm, "strings", aTopModesList );
+ setPreferenceProperty( top_lev_dm, "indexes", aTopIndexesList );
+
+ // Set property for step value for spinboxes
+ setPreferenceProperty( step, "min", 1 );
+ setPreferenceProperty( step, "max", 10000 );
+ setPreferenceProperty( step, "precision", 3 );
+
+ // Set property for deflection value for spinboxes
+ setPreferenceProperty( defl, "min", DEFLECTION_MIN );
+ setPreferenceProperty( defl, "max", 1.0 );
+ setPreferenceProperty( defl, "step", 1.0e-04 );
+ setPreferenceProperty( defl, "precision", 6 );
+
+ // Set property for default material
+ Material_ResourceMgr aMatResMgr;
+ setPreferenceProperty( material, "strings", aMatResMgr.materials() );
+
+ // Set property vertex marker type
+ QList<QVariant> aMarkerTypeIndicesList;
+ QList<QVariant> aMarkerTypeIconsList;
+
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ for ( int i = GEOM::MT_POINT; i < GEOM::MT_USER; i++ ) {
+ QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
+ QPixmap pixmap = resMgr->loadPixmap( "GEOM", tr( qPrintable( icoFile ) ) );
+ aMarkerTypeIndicesList << (i-1);
+ aMarkerTypeIconsList << pixmap;
+ }
+
+ setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
+ setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
+
+ // Set property for vertex marker scale
+ QList<QVariant> aMarkerScaleIndicesList;
+ QStringList aMarkerScaleValuesList;
+
+ for ( int iii = GEOM::MS_10; iii <= GEOM::MS_70; iii++ ) {
+ aMarkerScaleIndicesList << iii;
+ aMarkerScaleValuesList << QString::number( (iii-(int)GEOM::MS_10)*0.5 + 1.0 );
+ }
+
+ setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
+ setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
+
+ int originGroup = addPreference( tr( "PREF_GROUP_ORIGIN_AND_BASE_VECTORS" ), tabId );
+ setPreferenceProperty( originGroup, "columns", 2 );
+
+ int baseVectorsLength = addPreference( tr( "PREF_BASE_VECTORS_LENGTH" ), originGroup,
+ LightApp_Preferences::DblSpin, "Geometry", "base_vectors_length" );
+ setPreferenceProperty( baseVectorsLength, "min", 0.01 );
+ setPreferenceProperty( baseVectorsLength, "max", 1000 );
+
+ addPreference( tr( "PREF_AUTO_CREATE" ), originGroup,
+ LightApp_Preferences::Bool, "Geometry", "auto_create_base_objects" );
+
+ int operationsGroup = addPreference( tr( "PREF_GROUP_OPERATIONS" ), tabId );
+ setPreferenceProperty( operationsGroup, "columns", 2 );
+
+ addPreference( tr( "GEOM_PREVIEW" ), operationsGroup,
+ LightApp_Preferences::Bool, "Geometry", "geom_preview" );
+}
+
+void GeometryGUI::preferencesChanged( const QString& section, const QString& param )
+{
+ if (section == "Geometry") {
+ SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+ if (param == QString("SettingsGeomStep")) {
+ double spin_step = aResourceMgr->doubleValue(section, param, 100.);
+ EmitSignalDefaultStepValueChanged(spin_step);
+ }
+ else if (param == QString("toplevel_color")) {
+ QColor c = aResourceMgr->colorValue( "Geometry", "toplevel_color", QColor( 170, 85, 0 ) );
+ GEOM_AISShape::setTopLevelColor(SalomeApp_Tools::color(c));
+ }
+ else if (param == QString("toplevel_dm")) {
+ GEOM_AISShape::setTopLevelDisplayMode((GEOM_AISShape::TopLevelDispMode)aResourceMgr->integerValue("Geometry", "toplevel_dm", 0));
+ }
+ }
+}
+
+LightApp_Displayer* GeometryGUI::displayer()
+{
+ if ( !myDisplayer )
+ myDisplayer = new GEOM_Displayer( dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() ) );
+ return myDisplayer;
+}
+
+void GeometryGUI::setLocalSelectionMode(const int mode)
+{
+ myLocalSelectionMode = mode;
+}
+
+int GeometryGUI::getLocalSelectionMode() const
+{
+ return myLocalSelectionMode;
+}
+
+const char gSeparator = '_'; // character used to separate parameter names
+const char gDigitsSep = ':'; // character used to separate numeric parameter values (color = r:g:b)
+
+/*!
+ * \brief Store visual parameters
+ *
+ * This method is called just before the study document is saved.
+ * Store visual parameters in AttributeParameter attribute(s)
+ */
+void GeometryGUI::storeVisualParameters (int savePoint)
+{
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
+ if ( !appStudy || !appStudy->studyDS() )
+ return;
+ _PTR(Study) studyDS = appStudy->studyDS();
+
+ // componentName is used for encoding of entries when storing them in IParameters
+ std::string componentName = myComponentGeom->ComponentDataType();
+ //_PTR(SComponent) aSComponent = studyDS->FindComponent("GEOM");
+ //if (!aSComponent) return;
+
+ // IParameters
+ _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative",
+ componentName.c_str(),
+ savePoint);
+ _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
+
+ QList<SUIT_ViewManager*> lst;
+ QList<SUIT_ViewManager*>::Iterator it;
+
+ // main cycle to store parameters of displayed objects
+ lst.clear();
+ getApp()->viewManagers(lst);
+ for (it = lst.begin(); it != lst.end(); it++) {
+ SUIT_ViewManager* vman = *it;
+ QString vType = vman->getType();
+ int aMgrId = vman->getGlobalId();
+ // saving VTK actors properties
+ QVector<SUIT_ViewWindow*> views = vman->getViews();
+ for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++) {
+ const ObjMap anObjects = appStudy->getObjectMap(aMgrId);
+ ObjMap::ConstIterator o_it = anObjects.begin();
+ for (; o_it != anObjects.end(); o_it++) {
+ const PropMap aProps = o_it.value();
+
+ //Check that object exists in the study
+ _PTR(SObject) obj( studyDS->FindObjectID( o_it.key().toLatin1().data() ) );
+ if ( !obj || !(aProps.count() > 0))
+ continue;
+ // entry is "encoded" = it does NOT contain component adress, since it is a
+ // subject to change on next component loading
+
+ std::string entry = ip->encodeEntry(o_it.key().toLatin1().data(), componentName);
+
+ _PTR(GenericAttribute) anAttr;
+ if (!obj->FindAttribute(anAttr, "AttributeIOR"))
+ continue;
+
+ std::string param,occParam = vType.toLatin1().data();
+ occParam += NAME_SEPARATOR;
+ occParam += QString::number(aMgrId).toLatin1().data();
+ occParam += NAME_SEPARATOR;
+
+ if (aProps.contains(VISIBILITY_PROP)) {
+ param = occParam + VISIBILITY_PROP;
+ ip->setParameter(entry, param, aProps.value(VISIBILITY_PROP).toInt() == 1 ? "On" : "Off");
+ }
+
+ if (aProps.contains(DISPLAY_MODE_PROP)) {
+ param = occParam + DISPLAY_MODE_PROP;
+ ip->setParameter(entry, param, QString::number(aProps.value(DISPLAY_MODE_PROP).toInt()).toLatin1().data());
+ }
+
+ if (aProps.contains(COLOR_PROP)) {
+ QColor c = aProps.value(COLOR_PROP).value<QColor>();
+ QString colorStr = QString::number(c.red()/255.);
+ colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.green()/255.);
+ colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.blue()/255.);
+ param = occParam + COLOR_PROP;
+ ip->setParameter(entry, param, colorStr.toLatin1().data());
+ }
+
+ if (vType == SVTK_Viewer::Type()) {
+ if (aProps.contains(OPACITY_PROP)) {
+ param = occParam + OPACITY_PROP;
+ ip->setParameter(entry, param, QString::number(1. - aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
+ }
+ } else if (vType == SOCC_Viewer::Type()) {
+ if (aProps.contains(TRANSPARENCY_PROP)) {
+ param = occParam + TRANSPARENCY_PROP;
+ ip->setParameter(entry, param, QString::number(aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
+ }
+
+ if (aProps.contains(TOP_LEVEL_PROP)) {
+ param = occParam + TOP_LEVEL_PROP;
+ Standard_Boolean val = aProps.value(TOP_LEVEL_PROP).value<Standard_Boolean>();
+ if (val == Standard_True)
+ ip->setParameter(entry, param, "1");
+ }
+ }
+
+ if (aProps.contains(ISOS_PROP)) {
+ param = occParam + ISOS_PROP;
+ ip->setParameter(entry, param, aProps.value(ISOS_PROP).toString().toLatin1().data());
+ }
+
+ if (aProps.contains(VECTOR_MODE_PROP)) {
+ param = occParam + VECTOR_MODE_PROP;
+ ip->setParameter(entry, param, QString::number(aProps.value(VECTOR_MODE_PROP).toInt()).toLatin1().data());
+ }
+
+ if (aProps.contains(DEFLECTION_COEFF_PROP)) {
+ param = occParam + DEFLECTION_COEFF_PROP;
+ ip->setParameter(entry, param, QString::number(aProps.value(DEFLECTION_COEFF_PROP).toDouble()).toLatin1().data());
+ }
+
+ //Marker type of the vertex - ONLY for the "Vertex" and "Compound of the Vertex"
+ if (aProps.contains(MARKER_TYPE_PROP)) {
+ param = occParam + MARKER_TYPE_PROP;
+ ip->setParameter(entry, param, aProps.value(MARKER_TYPE_PROP).toString().toLatin1().data());
+ }
+
+ if (aProps.contains(MATERIAL_PROP)) {
+ param = occParam + MATERIAL_PROP;
+ ip->setParameter(entry, param, aProps.value(MATERIAL_PROP).toString().toLatin1().data());
+ }
+
+ if (aProps.contains(EDGE_WIDTH_PROP)) {
+ param = occParam + EDGE_WIDTH_PROP;
+ ip->setParameter(entry, param, aProps.value(EDGE_WIDTH_PROP).toString().toLatin1().data());
+ }
+
+ if (aProps.contains(ISOS_WIDTH_PROP)) {
+ param = occParam + ISOS_WIDTH_PROP;
+ ip->setParameter(entry, param, aProps.value(ISOS_WIDTH_PROP).toString().toLatin1().data());
+ }
+ } // object iterator
+ } // for (views)
+ } // for (viewManagers)
+}
+
+/*!
+ * \brief Restore visual parameters
+ *
+ * This method is called after the study document is opened.
+ * Restore visual parameters from AttributeParameter attribute(s)
+ */
+void GeometryGUI::restoreVisualParameters (int savePoint)
+{
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
+ if (!appStudy || !appStudy->studyDS())
+ return;
+ _PTR(Study) studyDS = appStudy->studyDS();
+
+ // componentName is used for encoding of entries when storing them in IParameters
+ std::string componentName = myComponentGeom->ComponentDataType();
+ //_PTR(SComponent) aSComponent = studyDS->FindComponent("GEOM");
+ //if (!aSComponent) return;
+
+ // IParameters
+ _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative",
+ componentName.c_str(),
+ savePoint);
+ _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
+
+ std::vector<std::string> entries = ip->getEntries();
+
+ for (std::vector<std::string>::iterator entIt = entries.begin(); entIt != entries.end(); ++entIt)
+ {
+ // entry is a normal entry - it should be "decoded" (setting base adress of component)
+ QString entry (ip->decodeEntry(*entIt).c_str());
+
+ // Check that the entry corresponds to a real object in the Study
+ // as the object may be deleted or modified after the visual state is saved.
+ _PTR(SObject) so = studyDS->FindObjectID(entry.toLatin1().data());
+ if (!so) continue; //Skip the not existent entry
+
+ std::vector<std::string> paramNames = ip->getAllParameterNames( *entIt );
+ std::vector<std::string> paramValues = ip->getAllParameterValues( *entIt );
+
+ std::vector<std::string>::iterator namesIt = paramNames.begin();
+ std::vector<std::string>::iterator valuesIt = paramValues.begin();
+
+ // actors are stored in a map after displaying of them for
+ // quicker access in the future: map < viewID to actor >
+ NCollection_DataMap<int, GEOM_Actor* > vtkActors;
+ NCollection_DataMap<int, Handle(GEOM_AISShape)> occActors;
+
+ QString viewerTypStr;
+ QString viewIndexStr;
+ int viewIndex;
+ QVector<PropMap> aListOfMap;
+
+ for (; namesIt != paramNames.end(); ++namesIt, ++valuesIt)
+ {
+ // visual parameters are stored in strings as follows: ViewerType_ViewIndex_ParamName.
+ // '_' is used as separator and should not be used in viewer type or parameter names.
+ QStringList lst = QString((*namesIt).c_str()).split(NAME_SEPARATOR, QString::SkipEmptyParts);
+ if (lst.size() != 3)
+ continue;
+
+ viewerTypStr = lst[0];
+ viewIndexStr = lst[1];
+ QString paramNameStr = lst[2];
+
+ bool ok;
+ viewIndex = viewIndexStr.toUInt(&ok);
+ if (!ok) // bad conversion of view index to integer
+ continue;
+
+ if ((viewIndex + 1) > aListOfMap.count()) {
+ aListOfMap.resize(viewIndex + 1);
+ }
+
+ QString val((*valuesIt).c_str());
+ if (paramNameStr == VISIBILITY_PROP) {
+ aListOfMap[viewIndex].insert(VISIBILITY_PROP, val == "On" ? 1 : 0);
+ } else if (paramNameStr == OPACITY_PROP) {
+ aListOfMap[viewIndex].insert(TRANSPARENCY_PROP, 1. - val.toDouble());
+ } else if (paramNameStr == TRANSPARENCY_PROP) {
+ aListOfMap[viewIndex].insert( TRANSPARENCY_PROP, val.toDouble() );
+ } else if (paramNameStr == TOP_LEVEL_PROP) {
+ aListOfMap[viewIndex].insert( TRANSPARENCY_PROP, val == "1" ? Standard_True : Standard_False );
+ } else if (paramNameStr == DISPLAY_MODE_PROP) {
+ aListOfMap[viewIndex].insert( DISPLAY_MODE_PROP, val.toInt());
+ } else if (paramNameStr == ISOS_PROP) {
+ aListOfMap[viewIndex].insert( ISOS_PROP, val);
+ } else if (paramNameStr == COLOR_PROP) {
+ QStringList rgb = val.split(DIGIT_SEPARATOR);
+ if (rgb.count() == 3) {
+ QColor c(int(rgb[0].toDouble()*255), int(rgb[1].toDouble()*255), int(rgb[2].toDouble()*255));
+ aListOfMap[viewIndex].insert( COLOR_PROP, c);
+ }
+ } else if (paramNameStr == VECTOR_MODE_PROP) {
+ aListOfMap[viewIndex].insert( VECTOR_MODE_PROP, val.toInt());
+ } else if (paramNameStr == DEFLECTION_COEFF_PROP) {
+ aListOfMap[viewIndex].insert( DEFLECTION_COEFF_PROP, val.toDouble());
+ } else if (paramNameStr == MARKER_TYPE_PROP) {
+ aListOfMap[viewIndex].insert( MARKER_TYPE_PROP, val);
+ } else if (paramNameStr == MATERIAL_PROP) {
+ aListOfMap[viewIndex].insert( MATERIAL_PROP, val);
+ } else if (paramNameStr == EDGE_WIDTH_PROP) {
+ aListOfMap[viewIndex].insert( EDGE_WIDTH_PROP, val);
+ } else if (paramNameStr == ISOS_WIDTH_PROP) {
+ aListOfMap[viewIndex].insert( ISOS_WIDTH_PROP, val);
+ }
+ } // for names/parameters iterator
+
+ QList<SUIT_ViewManager*> lst = getApp()->viewManagers();
+
+ for (int index = 0; index < aListOfMap.count(); index++) {
+
+ appStudy->setObjectPropMap(index, entry, aListOfMap[index]);
+
+ //Get Visibility property of the current PropMap
+ if (aListOfMap[index].value(VISIBILITY_PROP) == 1) {
+ SUIT_ViewManager* vman = lst.at(index);
+ SUIT_ViewModel* vmodel = vman->getViewModel();
+ displayer()->Display(entry, true, dynamic_cast<SALOME_View*>(vmodel));
+ }
+ }
+ } // for entries iterator
+
+ // update all VTK and OCC views
+ QList<SUIT_ViewManager*> lst;
+ getApp()->viewManagers(lst);
+ for (QList<SUIT_ViewManager*>::Iterator it = lst.begin(); it != lst.end(); it++) {
+ SUIT_ViewModel* vmodel = (*it)->getViewModel();
+ if (!vmodel)
+ continue;
+ if (vmodel->getType() == SVTK_Viewer::Type()) {
+ SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) (*it)->getActiveView();
+ vtkView->getRenderer()->ResetCameraClippingRange();
+ vtkView->Repaint();
+ }
+ else if (vmodel->getType() == SOCC_Viewer::Type()) {
+ //SOCC_ViewWindow* occView = (SOCC_ViewWindow*) (*it)->getActiveView();
+ SALOME_View* occVMod = dynamic_cast<SALOME_View*>(vmodel);
+ if (occVMod)
+ occVMod->Repaint();
+ }
+ }
+}
+
+void GeometryGUI::onViewAboutToShow()
+{
+ SUIT_ViewWindow* window = application()->desktop()->activeWindow();
+ QAction* a = action( GEOMOp::OpSwitchVectors );
+ if ( window ) {
+ a->setEnabled(true);
+ bool vmode = window->property("VectorsMode").toBool();
+ a->setText ( vmode == 1 ? tr( "MEN_VECTOR_MODE_OFF" ) : tr("MEN_VECTOR_MODE_ON") );
+ } else {
+ a->setText ( tr("MEN_VECTOR_MODE_ON") );
+ a->setEnabled(false);
+ }
+}
+
+/*!
+ \brief Return action by id
+ \param id identifier of the action
+ \return action
+*/
+QAction* GeometryGUI::getAction(const int id) {
+ return action(id);
+}
+
+/*!
+ \brief Check if this object is can't be renamed in place
+
+ This method can be re-implemented in the subclasses.
+ Return true in case if object isn't reference or component (module root).
+
+ \param entry column id
+ \return \c true if the item can be renamed by the user in place (e.g. in the Object browser)
+*/
+bool GeometryGUI::renameAllowed( const QString& entry) const {
+
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
+ SalomeApp_DataObject* obj = appStudy ? dynamic_cast<SalomeApp_DataObject*>(appStudy->findObjectByEntry(entry)) : 0;
+
+ return (app && appStudy && obj && !appStudy->isComponent(entry) && !obj->isReference());
+}
+
+/*!
+ Rename object by entry.
+ \param entry entry of the object
+ \param name new name of the object
+ \brief Return \c true if rename operation finished successfully, \c false otherwise.
+*/
+bool GeometryGUI::renameObject( const QString& entry, const QString& name)
+{
+ bool result = false;
+
+ SalomeApp_Application* app =
+ dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication());
+ SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
+
+ if (!appStudy)
+ return result;
+
+ _PTR(Study) aStudy = appStudy->studyDS();
+
+ if (!aStudy)
+ return result;
+
+ bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked();
+ if ( aLocked ) {
+ SUIT_MessageBox::warning ( app->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED") );
+ return result;
+ }
+
+ _PTR(SObject) obj ( aStudy->FindObjectID(qPrintable(entry)) );
+ _PTR(GenericAttribute) anAttr;
+ if ( obj ) {
+ if ( obj->FindAttribute(anAttr, "AttributeName") ) {
+ _PTR(AttributeName) aName (anAttr);
+
+ GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj));
+ if (!CORBA::is_nil(anObj)) {
+ aName->SetValue( name.toLatin1().data() ); // rename the SObject
+ anObj->SetName( name.toLatin1().data() ); // Rename the corresponding GEOM_Object
+ result = true;
+ }
+ }