-// 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
case GEOMOp::OpFillet2d: // MENU OPERATION - FILLET 2D
case GEOMOp::OpFillet1d: // MENU OPERATION - FILLET 1D
case GEOMOp::OpSharedShapes: // MENU OPERATION - GET SHARED SHAPES
+ case GEOMOp::OpExtrudedBoss: // MENU OPERATION - EXTRUDED BOSS
+ case GEOMOp::OpExtrudedCut: // MENU OPERATION - EXTRUDED CUT
libName = "OperationGUI";
break;
case GEOMOp::OpSewing: // MENU REPAIR - SEWING
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::OpClipping, "CLIPPING" );
createGeomAction( GEOMOp::OpShapesOnShape, "GET_SHAPES_ON_SHAPE" );
createGeomAction( GEOMOp::OpSharedShapes, "GET_SHARED_SHAPES" );
+ createGeomAction( GEOMOp::OpExtrudedCut, "EXTRUDED_CUT" );
+ createGeomAction( GEOMOp::OpExtrudedBoss, "EXTRUDED_BOSS" );
createGeomAction( GEOMOp::OpFillet1d, "FILLET_1D" );
createGeomAction( GEOMOp::OpFillet2d, "FILLET_2D" );
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 );
createMenu( GEOMOp::OpArc, basicId, -1 );
createMenu( GEOMOp::OpCurve, basicId, -1 );
createMenu( separator(), basicId, -1 );
+ createMenu( GEOMOp::Op2dSketcher, basicId, -1 );
+ createMenu( GEOMOp::Op3dSketcher, basicId, -1 );
createMenu( GEOMOp::OpVector, basicId, -1 );
createMenu( GEOMOp::OpPlane, basicId, -1 );
createMenu( GEOMOp::OpLCS, basicId, -1 );
createMenu( GEOMOp::OpCone, primId, -1 );
createMenu( GEOMOp::OpRectangle, primId, -1 );
createMenu( GEOMOp::OpDisk, primId, -1 );
+ createMenu( GEOMOp::OpPipeTShape,primId, -1 );
int genId = createMenu( tr( "MEN_GENERATION" ), newEntId, -1 );
createMenu( GEOMOp::OpPrism, genId, -1 );
createMenu( GEOMOp::OpFilling, genId, -1 );
createMenu( GEOMOp::OpPipe, genId, -1 );
- int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
- createMenu( GEOMOp::OpPipeTShape, advId, -1 );
+// int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
+// createMenu( GEOMOp::OpPipeTShape, advId, -1 );
// createMenu( GEOMOp::OpPipeTShapeGroups, advId, -1 );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
createMenu( separator(), newEntId, -1 );
- createMenu( GEOMOp::Op2dSketcher, newEntId, -1 );
- createMenu( GEOMOp::Op3dSketcher, newEntId, -1 );
-
- createMenu( separator(), newEntId, -1 );
-
createMenu( GEOMOp::OpExplode, newEntId, -1 );
int buildId = createMenu( tr( "MEN_BUILD" ), newEntId, -1 );
createMenu( GEOMOp::OpFillet2d, operId, -1 );
createMenu( GEOMOp::OpFillet3d, operId, -1 );
createMenu( GEOMOp::OpChamfer, operId, -1 );
+ createMenu( GEOMOp::OpExtrudedBoss, operId, -1 );
+ createMenu( GEOMOp::OpExtrudedCut, operId, -1 );
//createMenu( GEOMOp::OpClipping, operId, -1 );
int repairId = createMenu( tr( "MEN_REPAIR" ), -1, -1, 10 );
*/
// ---- create toolbars --------------------------
-
+
int basicTbId = createTool( tr( "TOOL_BASIC" ) );
- createTool( GEOMOp::OpPoint, basicTbId );
- createTool( GEOMOp::OpLine, basicTbId );
- createTool( GEOMOp::OpCircle, basicTbId );
- createTool( GEOMOp::OpEllipse, basicTbId );
- createTool( GEOMOp::OpArc, basicTbId );
- createTool( GEOMOp::OpCurve, basicTbId );
- createTool( GEOMOp::OpVector, basicTbId );
- createTool( GEOMOp::OpPlane, basicTbId );
- createTool( GEOMOp::OpLCS, basicTbId );
+ createTool( GEOMOp::OpPoint, basicTbId );
+ createTool( GEOMOp::OpLine, basicTbId );
+ createTool( GEOMOp::OpCircle, basicTbId );
+ createTool( GEOMOp::OpEllipse, basicTbId );
+ createTool( GEOMOp::OpArc, basicTbId );
+ createTool( GEOMOp::OpCurve, basicTbId );
+ createTool( GEOMOp::OpVector, basicTbId );
+ createTool( GEOMOp::Op2dSketcher, basicTbId ); //rnc
+ createTool( GEOMOp::Op3dSketcher, basicTbId ); //rnc
+ createTool( GEOMOp::OpPlane, basicTbId );
+ createTool( GEOMOp::OpLCS, basicTbId );
createTool( GEOMOp::OpOriginAndVectors, basicTbId );
-
+
+// int sketchTbId = createTool( tr( "TOOL_SKETCH" ) );
+// createTool( GEOMOp::Op2dSketcher, sketchTbId );
+// createTool( GEOMOp::Op3dSketcher, sketchTbId );
+
int primTbId = createTool( tr( "TOOL_PRIMITIVES" ) );
- createTool( GEOMOp::OpBox, primTbId );
- createTool( GEOMOp::OpCylinder, primTbId );
- createTool( GEOMOp::OpSphere, primTbId );
- createTool( GEOMOp::OpTorus, primTbId );
- createTool( GEOMOp::OpCone, primTbId );
- createTool( GEOMOp::OpRectangle, primTbId );
- createTool( GEOMOp::OpDisk, primTbId );
-
+ createTool( GEOMOp::OpBox, primTbId );
+ createTool( GEOMOp::OpCylinder, primTbId );
+ createTool( GEOMOp::OpSphere, primTbId );
+ createTool( GEOMOp::OpTorus, primTbId );
+ createTool( GEOMOp::OpCone, primTbId );
+ createTool( GEOMOp::OpRectangle, primTbId );
+ createTool( GEOMOp::OpDisk, primTbId );
+ createTool( GEOMOp::OpPipeTShape, primTbId ); //rnc
+
+// int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) ); //rnc
+// createTool( GEOMOp::OpPipeTShape, advancedTbId );
+
int boolTbId = createTool( tr( "TOOL_BOOLEAN" ) );
- createTool( GEOMOp::OpFuse, boolTbId );
- createTool( GEOMOp::OpCommon, boolTbId );
- createTool( GEOMOp::OpCut, boolTbId );
- createTool( GEOMOp::OpSection, boolTbId );
-
- int genTbId = createTool( tr( "TOOL_GENERATION" ) );
+ createTool( GEOMOp::OpFuse, boolTbId );
+ createTool( GEOMOp::OpCommon, boolTbId );
+ createTool( GEOMOp::OpCut, boolTbId );
+ createTool( GEOMOp::OpSection, boolTbId );
+
+ int genTbId = createTool( tr( "TOOL_GENERATION" ) );
createTool( GEOMOp::OpPrism, genTbId );
createTool( GEOMOp::OpRevolution, genTbId );
createTool( GEOMOp::OpFilling, genTbId );
createTool( GEOMOp::OpPipe, genTbId );
-
+
int transTbId = createTool( tr( "TOOL_TRANSFORMATION" ) );
createTool( GEOMOp::OpTranslate, transTbId );
createTool( GEOMOp::OpRotate, transTbId );
createTool( separator(), transTbId );
createTool( GEOMOp::OpMultiTranslate, transTbId );
createTool( GEOMOp::OpMultiRotate, transTbId );
-
+
int operTbId = createTool( tr( "TOOL_OPERATIONS" ) );
- createTool( GEOMOp::Op2dSketcher, operTbId );
- createTool( GEOMOp::Op3dSketcher, operTbId );
- createTool( separator(), operTbId );
createTool( GEOMOp::OpExplode, operTbId );
- createTool( separator(), operTbId );
-#ifdef WITH_OPENCV
- createTool( GEOMOp::OpFeatureDetect, operTbId );
-#endif
- createTool( GEOMOp::OpPictureImport, operTbId );
- createTool( separator(), operTbId );
-
createTool( GEOMOp::OpPartition, operTbId );
createTool( GEOMOp::OpArchimede, operTbId );
createTool( GEOMOp::OpShapesOnShape, operTbId );
createTool( GEOMOp::OpSharedShapes, operTbId );
- createTool( separator(), operTbId );
- createTool( GEOMOp::OpFillet1d, operTbId );
- createTool( GEOMOp::OpFillet2d, operTbId );
- createTool( GEOMOp::OpFillet3d, operTbId );
- createTool( GEOMOp::OpChamfer, operTbId );
-
+
+ int featTbId = createTool( tr( "TOOL_FEATURES" ) );
+ createTool( GEOMOp::OpFillet1d, featTbId );
+ createTool( GEOMOp::OpFillet2d, featTbId );
+ createTool( GEOMOp::OpFillet3d, featTbId );
+ createTool( GEOMOp::OpChamfer, featTbId );
+ createTool( GEOMOp::OpExtrudedBoss, featTbId );
+ createTool( GEOMOp::OpExtrudedCut, featTbId );
+
int buildTbId = createTool( tr( "TOOL_BUILD" ) );
createTool( GEOMOp::OpEdge, buildTbId );
createTool( GEOMOp::OpWire, buildTbId );
createTool( GEOMOp::OpCheckShape, measureTbId );
createTool( GEOMOp::OpCheckCompound, measureTbId );
createTool( GEOMOp::OpCheckSelfInters, measureTbId );
+
+ int picturesTbId = createTool( tr( "TOOL_PICTURES" ) );
+ createTool( GEOMOp::OpPictureImport, picturesTbId );
+ #ifdef WITH_OPENCV
+ createTool( GEOMOp::OpFeatureDetect, picturesTbId );
+ #endif
- int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
- createTool( GEOMOp::OpPipeTShape, advancedTbId );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
// ---- create popup menus --------------------------
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;
}
+