-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
case GEOMOp::OpMaterialProperties: // POPUP MENU - MATERIAL PROPERTIES
case GEOMOp::OpEdgeWidth: // POPUP MENU - LINE WIDTH - EDGE WIDTH
case GEOMOp::OpIsosWidth: // POPUP MENU - LINE WIDTH - ISOS WIDTH
+ case GEOMOp::OpBringToFront: // POPUP MENU - BRING TO FRONT
+ case GEOMOp::OpClsBringToFront: //
libName = "GEOMToolsGUI";
break;
case GEOMOp::OpDisplayMode: // MENU VIEW - WIREFRAME/SHADING
if ( pref ) {
Material_ResourceMgr aMatResMgr;
QStringList aPerfMatNames = aMatResMgr.getPreferenceMaterialsNames();
- setPreferenceProperty( pref->rootItem()->findItem( tr( "PREF_FRONT_MATERIAL" ), true )->id(),
- "strings",
- aPerfMatNames );
- setPreferenceProperty( pref->rootItem()->findItem( tr( "PREF_BACK_MATERIAL" ), true )->id(),
+ setPreferenceProperty( pref->rootItem()->findItem( tr( "PREF_MATERIAL" ), true )->id(),
"strings",
aPerfMatNames );
}
createGeomAction( GEOMOp::OpSelectCompound, "COMPOUND_SEL_ONLY", "", 0, true );
createGeomAction( GEOMOp::OpSelectAll, "ALL_SEL_ONLY", "", 0, true );
createGeomAction( GEOMOp::OpShowOnly, "DISPLAY_ONLY" );
+ createGeomAction( GEOMOp::OpBringToFront, "BRING_TO_FRONT", "", 0, true );
+ createGeomAction( GEOMOp::OpClsBringToFront, "CLS_BRING_TO_FRONT" );
createGeomAction( GEOMOp::OpHide, "ERASE" );
createGeomAction( GEOMOp::OpWireframe, "POP_WIREFRAME", "", 0, true );
mgr->insert( action( GEOMOp::OpGroupEdit ), -1, -1 ); // edit group
mgr->setRule( action( GEOMOp::OpGroupEdit ), QString("client='ObjectBrowser' and type='Group' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
mgr->insert( separator(), -1, -1 ); // -----------
+
+#if OCC_VERSION_LARGE > 0x06050200
+ //QString bringRule = clientOCCorOB + " and ($component={'GEOM'}) and (selcount>0) and isOCC=true and topLevel=false";
+ QString bringRule = clientOCCorOB + " and ($component={'GEOM'}) and (selcount>0) and isOCC=true";
+ mgr->insert( action(GEOMOp::OpBringToFront ), -1, -1 ); // bring to front
+ mgr->setRule(action(GEOMOp::OpBringToFront), bringRule, QtxPopupMgr::VisibleRule );
+ mgr->setRule(action(GEOMOp::OpBringToFront), "topLevel=true", QtxPopupMgr::ToggleRule );
+ mgr->insert( action(GEOMOp::OpClsBringToFront ), -1, -1 ); // clear bring to front
+ mgr->setRule( action(GEOMOp::OpClsBringToFront ), clientOCC, QtxPopupMgr::VisibleRule );
+#endif
+ mgr->insert( separator(), -1, -1 ); // -----------
dispmodeId = mgr->insert( tr( "MEN_DISPLAY_MODE" ), -1, -1 ); // display mode menu
mgr->insert( action( GEOMOp::OpWireframe ), dispmodeId, -1 ); // wireframe
mgr->setRule( action( GEOMOp::OpWireframe ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK + " and isVectorsMode", QtxPopupMgr::ToggleRule );
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpColor ), -1, -1 ); // color
- mgr->setRule( action( GEOMOp::OpColor ), clientOCCorVTKorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( GEOMOp::OpColor ), clientOCCorVTKorOB_AndSomeVisible + " and ($component={'GEOM'})" + "and isPhysicalMaterial=false", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpTransparency ), -1, -1 ); // transparency
mgr->setRule( action( GEOMOp::OpTransparency ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpIsos ), -1, -1 ); // isos
mgr->setRule(action(GEOMOp::OpSelectAll), selectOnly + " and selectionmode='ALL'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpShowOnly ), -1, -1 ); // display only
mgr->setRule(action(GEOMOp::OpShowOnly ), rule.arg( types ).arg( "true" ), QtxPopupMgr::VisibleRule );
- mgr->insert( separator(), -1, -1 );
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpUnpublishObject ), -1, -1 ); // Unpublish object
addPreference( tr( "PREF_ISOS_COLOR" ), genGroup,
LightApp_Preferences::Color, "Geometry", "isos_color" );
+ addPreference( tr( "PREF_TOPLEVEL_COLOR" ), genGroup,
+ LightApp_Preferences::Color, "Geometry", "toplevel_color" );
+
+ addPreference( "", genGroup, LightApp_Preferences::Space );
+
+
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 front_material = addPreference( tr( "PREF_FRONT_MATERIAL" ), genGroup,
+ int material = addPreference( tr( "PREF_MATERIAL" ), genGroup,
LightApp_Preferences::Selector,
- "Geometry", "front_material" );
+ "Geometry", "material" );
- int back_material = addPreference( tr( "PREF_BACK_MATERIAL" ), genGroup,
- LightApp_Preferences::Selector,
- "Geometry", "back_material" );
-
const int nb = 4;
int wd[nb];
int iter=0;
// Set property for default material
Material_ResourceMgr aMatResMgr;
QStringList aPrefMatNames = aMatResMgr.getPreferenceMaterialsNames();
- setPreferenceProperty( front_material, "strings", aPrefMatNames );
- setPreferenceProperty( back_material, "strings", aPrefMatNames );
+ setPreferenceProperty( material, "strings", aPrefMatNames );
// Set property vertex marker type
QList<QVariant> aMarkerTypeIndicesList;
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)) {
ip->setParameter(entry, param, aProps.value(MARKER_TYPE_PROP).toString().toLatin1().data());
}
- if(aProps.contains(FRONT_MATERIAL_PROP)) {
- param = occParam + FRONT_MATERIAL_PROP;
- ip->setParameter(entry, param, aProps.value(FRONT_MATERIAL_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(BACK_MATERIAL_PROP)) {
- param = occParam + BACK_MATERIAL_PROP;
- ip->setParameter(entry, param, aProps.value(BACK_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());
} 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 == 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());
aListOfMap[viewIndex].insert( DEFLECTION_COEFF_PROP, val.toDouble());
} else if(paramNameStr == MARKER_TYPE_PROP) {
aListOfMap[viewIndex].insert( MARKER_TYPE_PROP, val);
- } else if(paramNameStr == FRONT_MATERIAL_PROP) {
- aListOfMap[viewIndex].insert( FRONT_MATERIAL_PROP, val);
- } else if(paramNameStr == BACK_MATERIAL_PROP) {
- aListOfMap[viewIndex].insert( BACK_MATERIAL_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) {
}
}
+/*!
+ \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
\brief Return \c true if rename operation finished successfully, \c false otherwise.
*/
bool GeometryGUI::renameObject( const QString& entry, const QString& name) {
-
- bool appRes = SalomeApp_Module::renameObject(entry,name);
- if( !appRes )
- return false;
-
+
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 ) {
}
return result;
}
+