From: rnv Date: Tue, 14 Feb 2012 12:03:57 +0000 (+0000) Subject: Implementation of the "21046: EDF 1610 GUI: To be able to change the width of the... X-Git-Tag: V6_5_0a1~68 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=882dc8f6ee23cedf50cf3c718fb864dec115b35e;p=modules%2Fgeom.git Implementation of the "21046: EDF 1610 GUI: To be able to change the width of the lines" issue. --- diff --git a/doc/salome/gui/GEOM/images/line_width.png b/doc/salome/gui/GEOM/images/line_width.png new file mode 100755 index 000000000..bf5c713a8 Binary files /dev/null and b/doc/salome/gui/GEOM/images/line_width.png differ diff --git a/doc/salome/gui/GEOM/images/line_width_1.png b/doc/salome/gui/GEOM/images/line_width_1.png new file mode 100755 index 000000000..e7fc005f2 Binary files /dev/null and b/doc/salome/gui/GEOM/images/line_width_1.png differ diff --git a/doc/salome/gui/GEOM/images/line_width_2.png b/doc/salome/gui/GEOM/images/line_width_2.png new file mode 100755 index 000000000..4d49df5cb Binary files /dev/null and b/doc/salome/gui/GEOM/images/line_width_2.png differ diff --git a/doc/salome/gui/GEOM/input/line_width.doc b/doc/salome/gui/GEOM/input/line_width.doc new file mode 100644 index 000000000..3850a8dcd --- /dev/null +++ b/doc/salome/gui/GEOM/input/line_width.doc @@ -0,0 +1,18 @@ +/*! + +\page line_width_page Line Width + +\n In this menu you can change the width of the edges and isolines displayed within +a shape. + +\n Arguments: 1 value (width of the edge or isoline). + +\image html line_width.png + +\n Example: + +\image html line_width_1.png + +\image html line_width_2.png + +*/ diff --git a/doc/salome/gui/GEOM/input/viewing_geom_obj.doc b/doc/salome/gui/GEOM/input/viewing_geom_obj.doc index 9ff681259..b269619a9 100644 --- a/doc/salome/gui/GEOM/input/viewing_geom_obj.doc +++ b/doc/salome/gui/GEOM/input/viewing_geom_obj.doc @@ -33,6 +33,8 @@ deflection coefficient of a shape. material properties of a shape.
  • \subpage point_marker_page "Point Marker" - allows to change the representation of geometrical vertices.
  • +
  • \subpage line_width_page "Line Width" - allows to change the +width of the edges and isolines.
  • Auto color / Disable auto color - activates the auto color mode. When the auto color mode is enabled, the groups created on the sub-shapes of the selected geometrical object are automatically diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index 8ea7476e7..f910e6569 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -57,6 +57,11 @@ + + + + + diff --git a/src/GEOMBase/GEOMBase_Helper.cxx b/src/GEOMBase/GEOMBase_Helper.cxx index 50c5c46e6..04a0be7b4 100755 --- a/src/GEOMBase/GEOMBase_Helper.cxx +++ b/src/GEOMBase/GEOMBase_Helper.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -317,7 +318,12 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object, getDisplayer()->SetColor( color == -1 ? Quantity_NOC_VIOLET : color ); // set width of displayed shape - getDisplayer()->SetWidth( lineWidth ); + int lw = lineWidth; + if(lw == -1) { + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + lw = resMgr->integerValue("Geometry", "preview_edge_width", -1); + } + getDisplayer()->SetWidth( lw ); // set display mode of displayed shape int aPrevDispMode = getDisplayer()->SetDisplayMode( displayMode ); diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 31d7d4b0c..8d7bb7603 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -313,7 +313,11 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st ) myShadingColor = SalomeApp_Tools::color( col ); myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0); + int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS); + myWidth = resMgr->integerValue("Geometry", "edge_width", -1); + myIsosWidth = resMgr->integerValue("Geometry", "isolines_width", -1); + myTypeOfMarker = (Aspect_TypeOfMarker)(std::min((int)Aspect_TOM_RING3, std::max((int)Aspect_TOM_POINT, aType))); myScaleOfMarker = (resMgr->integerValue("Geometry", "marker_scale", 1)-(int)GEOM::MS_10)*0.5 + 1.0; myScaleOfMarker = std::min(7.0, std::max(1., myScaleOfMarker)); @@ -696,10 +700,15 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) Handle(Prs3d_IsoAspect) anAspect = AISShape->Attributes()->UIsoAspect(); anAspect->SetNumber( anUIsoNumber ); anAspect->SetColor( aColor ); + if(HasIsosWidth()) + anAspect->SetWidth( GetIsosWidth() ); AISShape->Attributes()->SetUIsoAspect( anAspect ); + anAspect = AISShape->Attributes()->VIsoAspect(); anAspect->SetNumber( aVIsoNumber ); + if(HasIsosWidth()) + anAspect->SetWidth( GetIsosWidth() ); anAspect->SetColor( aColor ); AISShape->Attributes()->SetVIsoAspect( anAspect ); @@ -828,6 +837,8 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) double aDC = 0; if(useStudy) { aDC = aPropMap.value(DEFLECTION_COEFF_PROP).toDouble(); + SetWidth(aPropMap.value(EDGE_WIDTH_PROP).toInt()); + SetIsosWidth(aPropMap.value(ISOS_WIDTH_PROP).toInt()); } else { aDC = aResMgr->doubleValue("Geometry", "deflection_coeff", 0.001); @@ -1003,6 +1014,13 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) if ( aModelB ) delete aModelB; + if(HasWidth()) + aStudy->setObjectProperty( aMgrId, anIO->getEntry(), EDGE_WIDTH_PROP, GetWidth() ); + + if(HasIsosWidth()) + aStudy->setObjectProperty( aMgrId, anIO->getEntry(), ISOS_WIDTH_PROP, GetIsosWidth() ); + + } // AISShape->SetName(???); ??? necessary to set name ??? @@ -1133,11 +1151,6 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) aProp->SetColor( aColor.Red(), aColor.Green(), aColor.Blue() ); } - if ( HasWidth() ) - { - aProp->SetLineWidth( GetWidth() ); - } - while ( anActor != NULL ) { SALOME_Actor* GActor = SALOME_Actor::SafeDownCast( anActor ); @@ -1172,6 +1185,8 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) aIsos[0] = uv[0].toInt(); aIsos[1] = uv[1].toInt(); aGeomGActor->SetNbIsos(aIsos); aGeomGActor->SetOpacity(1.0 - aPropMap.value(TRANSPARENCY_PROP).toDouble()); + SetWidth(aPropMap.value(EDGE_WIDTH_PROP).toInt()); + SetIsosWidth(aPropMap.value(ISOS_WIDTH_PROP).toInt()); aGeomGActor->SetVectorMode(aPropMap.value(VECTOR_MODE_PROP).toInt()); int aDispModeId = aPropMap.value(DISPLAY_MODE_PROP).toInt(); // Specially processing of 'Shading with edges' mode from preferences, @@ -1217,6 +1232,13 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) // Release memory delete aModelB; + + if(HasWidth()) + aStudy->setObjectProperty( aMgrId, anEntry, EDGE_WIDTH_PROP, GetWidth() ); + + if(HasIsosWidth()) + aStudy->setObjectProperty( aMgrId, anEntry, ISOS_WIDTH_PROP, GetIsosWidth() ); + } else { // Set the same front and back materials for the selected shape @@ -1292,6 +1314,17 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) } } + if ( HasWidth() ) + { + aGeomGActor->SetWidth( GetWidth() ); + } + + + if ( HasIsosWidth() ) + { + aGeomGActor->SetIsosWidth( GetIsosWidth() ); + } + if ( myToActivate ) GActor->PickableOn(); else @@ -1760,6 +1793,23 @@ void GEOM_Displayer::UnsetWidth() myWidth = -1; } + +int GEOM_Displayer::GetIsosWidth() const +{ + return myIsosWidth; +} + +void GEOM_Displayer::SetIsosWidth(const int width) +{ + myIsosWidth = width; +} + +bool GEOM_Displayer::HasIsosWidth() const +{ + return myIsosWidth != -1; +} + + //================================================================= /*! * GEOM_Displayer::SetToActivate @@ -1962,12 +2012,20 @@ PropMap GEOM_Displayer::getDefaultPropertyMap(const QString& viewer_type) { QString aMaterialF = aModelF.getMaterialProperty(); aDefaultMap.insert( FRONT_MATERIAL_PROP , aMaterialF ); - // Back material + //9. Back material Material_Model aModelB; aModelB.fromResources( aResMgr, "Geometry", false ); QString aMaterialB = aModelB.getMaterialProperty(); aDefaultMap.insert( BACK_MATERIAL_PROP , aMaterialB ); + //10. Width of the edges + aDefaultMap.insert( EDGE_WIDTH_PROP , aResMgr->integerValue("Geometry", "edge_width", 1)); + + + //11. Width of iso-lines + aDefaultMap.insert( ISOS_WIDTH_PROP , aResMgr->integerValue("Geometry", "isolines_width", 1)); + + return aDefaultMap; } @@ -2005,6 +2063,17 @@ bool GEOM_Displayer::MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault) theOrigin.insert(BACK_MATERIAL_PROP, theDefault.value(BACK_MATERIAL_PROP)); nbInserted++; } + + if(!theOrigin.contains(EDGE_WIDTH_PROP)) { + theOrigin.insert(EDGE_WIDTH_PROP, theDefault.value(EDGE_WIDTH_PROP)); + nbInserted++; + } + + if(!theOrigin.contains(ISOS_WIDTH_PROP)) { + theOrigin.insert(ISOS_WIDTH_PROP, theDefault.value(ISOS_WIDTH_PROP)); + nbInserted++; + } + return (nbInserted > 0); } diff --git a/src/GEOMGUI/GEOM_Displayer.h b/src/GEOMGUI/GEOM_Displayer.h index 30337eaac..c7ced1329 100644 --- a/src/GEOMGUI/GEOM_Displayer.h +++ b/src/GEOMGUI/GEOM_Displayer.h @@ -134,6 +134,11 @@ public: void UnsetWidth(); double GetWidth () const; bool HasWidth () const; + + /* Set width for iso-lines displaying. If it is equal -1 then default width is used. */ + void SetIsosWidth ( const int ); + int GetIsosWidth () const; + bool HasIsosWidth () const; /* Set display mode shape displaying. If it is equal -1 then display mode is used. */ int SetDisplayMode( const int ); @@ -215,6 +220,7 @@ protected: Quantity_Color myShadingColor; int myColor; double myWidth; + int myIsosWidth; bool myToActivate; int myDisplayMode; Aspect_TypeOfMarker myTypeOfMarker; diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 14a87c7aa..a993e8be3 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -11,6 +11,14 @@ CHANGE_ORIENTATION_NEW_OBJ_NAME Invert + + EDGE_WIDTH_TLT + Select Edge Width + + + ISOS_WIDTH_TLT + Select Isos Width + CLOSE_CONTOUR_NEW_OBJ_NAME CloseContour @@ -2574,6 +2582,34 @@ Please, select face, shell or solid and try again MEN_POP_TEXTURE Texture + + MEN_EDGE_WIDTH + Edge Width + + + TOP_EDGE_WIDTH + Edge Width + + + STB_EDGE_WIDTH + Edge Width + + + MEN_ISOS_WIDTH + Isos Width + + + TOP_ISOS_WIDTH + Isos Width + + + STB_ISOS_WIDTH + Isos Width + + + MEN_LINE_WIDTH + Line Width + MEN_POP_SETTEXTURE Texture @@ -2906,6 +2942,22 @@ Please, select face, shell or solid and try again PREF_BACK_MATERIAL Default back material + + PREF_EDGE_WIDTH + Edges width + + + PREF_ISOLINES_WIDTH + Iso lines width + + + PREF_PREVIEW_EDGE_WIDTH + Preview edges width + + + PREF_MEASURES_LINE_WIDTH + Measures lines width + PROCESS_SHAPE_NEW_OBJ_NAME ProcessShape @@ -4779,7 +4831,7 @@ Number of sketch points too small EMPTY_NAME Please, specify a non-empty group name - + GROUP_NAME Group Name @@ -5003,6 +5055,13 @@ Would you like to continue? Deflection : + + GEOMToolsGUI_LineWidthDlg + + GEOM_LINE_WIDTH + Line width: + + GEOMToolsGUI_MarkerDlg diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index cfa64c465..a230d3725 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -424,6 +424,8 @@ void GeometryGUI::OnGUIEvent( int id ) case GEOMOp::OpPublishObject: // ROOT GEOM OBJECT - POPUP MENU - PUBLISH case GEOMOp::OpPointMarker: // POPUP MENU - POINT MARKER 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 libName = "GEOMToolsGUI"; break; case GEOMOp::OpDisplayMode: // MENU VIEW - WIREFRAME/SHADING @@ -844,6 +846,8 @@ void GeometryGUI::initialize( CAM_Application* app ) createGeomAction( GEOMOp::OpShading, "POP_SHADING", "", 0, true ); createGeomAction( GEOMOp::OpShadingWithEdges, "POP_SHADING_WITH_EDGES", "", 0, true ); createGeomAction( GEOMOp::OpTexture, "POP_TEXTURE", "", 0, true ); + createGeomAction( GEOMOp::OpEdgeWidth, "EDGE_WIDTH"); + createGeomAction( GEOMOp::OpIsosWidth, "ISOS_WIDTH"); createGeomAction( GEOMOp::OpVectors, "POP_VECTORS", "", 0, true ); createGeomAction( GEOMOp::OpDeflection, "POP_DEFLECTION" ); createGeomAction( GEOMOp::OpColor, "POP_COLOR" ); @@ -1234,6 +1238,14 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->setRule( action( GEOMOp::OpMaterialProperties ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'}) and selcount>0 and isVisible", QtxPopupMgr::VisibleRule ); mgr->insert( action( GEOMOp::OpSetTexture ), -1, -1 ); // texture mgr->setRule( action( GEOMOp::OpSetTexture ), clientOCCorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule ); + + int lineW = mgr->insert( tr( "MEN_LINE_WIDTH" ), -1, -1 ); // line width menu + mgr->insert( action( GEOMOp::OpEdgeWidth ), lineW, -1 ); // edge width + mgr->setRule( action( GEOMOp::OpEdgeWidth ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); + + mgr->insert( action( GEOMOp::OpIsosWidth ), lineW, -1 ); // isos width + mgr->setRule( action( GEOMOp::OpIsosWidth ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); + mgr->insert( separator(), -1, -1 ); // ----------- mgr->insert( action( GEOMOp::OpAutoColor ), -1, -1 ); // auto color mgr->setRule( action( GEOMOp::OpAutoColor ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule ); @@ -1679,11 +1691,33 @@ void GeometryGUI::createPreferences() int front_material = addPreference( tr( "PREF_FRONT_MATERIAL" ), genGroup, LightApp_Preferences::Selector, "Geometry", "front_material" ); - + int back_material = addPreference( tr( "PREF_BACK_MATERIAL" ), genGroup, LightApp_Preferences::Selector, "Geometry", "back_material" ); + 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 ); @@ -1950,6 +1984,17 @@ void GeometryGUI::storeVisualParameters (int savePoint) 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()); + } + + 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) @@ -2062,8 +2107,14 @@ void GeometryGUI::restoreVisualParameters (int savePoint) aListOfMap[viewIndex].insert( FRONT_MATERIAL_PROP, val); } else if(paramNameStr == BACK_MATERIAL_PROP) { aListOfMap[viewIndex].insert( BACK_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 lst = getApp()->viewManagers(); diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h index 5ff8d5921..227c23283 100644 --- a/src/GEOMGUI/GeometryGUI_Operations.h +++ b/src/GEOMGUI/GeometryGUI_Operations.h @@ -54,6 +54,8 @@ namespace GEOMOp { OpHideChildren = 1251, // POPUP MENU - HIDE CHILDREN OpUnpublishObject = 1253, // POPUP MENU - UNPUBLISH OpPublishObject = 1254, // GEOM ROOT OBJECT - POPUP MENU - PUBLISH + OpEdgeWidth = 1260, // POPUP MENU - LINE WIDTH - EDGE WIDTH + OpIsosWidth = 1261, // POPUP MENU - LINE WIDTH - ISOS WIDTH // DisplayGUI ----------------//-------------------------------- OpDisplayMode = 2000, // MENU VIEW - DISPLAY MODE - WIREFRAME/SHADING/SHADING WITH EDGES diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index f1abd61d0..3c5c6f1d1 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -371,6 +371,12 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) case GEOMOp::OpPublishObject:// GEOM ROOT OBJECT - POPUP - PUBLISH OnPublishObject(); break; + case GEOMOp::OpEdgeWidth: + OnEdgeWidth(); + break; + case GEOMOp::OpIsosWidth: + OnIsosWidth(); + break; default: SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); break; diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.h b/src/GEOMToolsGUI/GEOMToolsGUI.h index 5706765f0..2141f0c97 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI.h @@ -76,6 +76,8 @@ private: void OnPublishObject() ; void OnPointMarker(); void OnMaterialProperties(); + void OnEdgeWidth(); + void OnIsosWidth(); // Shortcut commands void OnChangeTransparency( bool ); diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx index 8420eb5cd..31b734b33 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx @@ -32,6 +32,7 @@ #include "GEOMToolsGUI_MarkerDlg.h" #include "GEOMToolsGUI_PublishDlg.h" #include "GEOMToolsGUI_MaterialPropertiesDlg.h" +#include "GEOMToolsGUI_LineWidthDlg.h" #include #include @@ -79,6 +80,7 @@ #include #include #include +#include #if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 #include @@ -392,7 +394,6 @@ void GEOMToolsGUI::OnTexture() if ( !selected.IsEmpty() ) { SUIT_ViewWindow* window = app->desktop()->activeWindow(); bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); - int mgrId = window->getViewManager()->getGlobalId(); if ( isOCC ) { QString aTexture = QFileDialog::getOpenFileName(window,tr( "GEOM_SELECT_IMAGE"),QString(), tr("OCC_IMAGE_FILES")); if( !aTexture.isEmpty() ) @@ -563,12 +564,17 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType ) } for(; ic->MoreCurrent(); ic->NextCurrent()) { + int aMgrId = window->getViewManager()->getGlobalId(); CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); - CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbUIso) ); - CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbVIso) ); + QVariant v = aStudy->getObjectProperty( aMgrId, CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP , QVariant() ); + + int width = v.isValid() ? v.toInt() : 1; + + CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width , newNbUIso) ); + CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width , newNbVIso) ); CurObject->storeIsoNumbers(); @@ -576,8 +582,7 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType ) ic->Redisplay(CurObject); QString anIsos("%1%2%3");anIsos = anIsos.arg(newNbUIso);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(newNbVIso); - int aMgrId = window->getViewManager()->getGlobalId(); - aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_PROP, anIsos); + aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_WIDTH_PROP, anIsos); } } GeometryGUI::Modified(); @@ -940,3 +945,245 @@ void GEOMToolsGUI::OnPublishObject() { new GEOMToolsGUI_PublishDlg( SUIT_Session::session()->activeApplication()->desktop() ); publishDlg->exec(); } + + +void GEOMToolsGUI::OnEdgeWidth() +{ + SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + + + bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()); + bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type()); + int mgrId = window->getViewManager()->getGlobalId(); + + if (isOCC) { // if is OCCViewer + OCCViewer_Viewer* vm = dynamic_cast(window->getViewManager()->getViewModel()); + Handle (AIS_InteractiveContext) ic = vm->getAISContext(); + ic->InitCurrent(); + if (ic->MoreCurrent()) { + Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + + int aWidth = (int)CurObject->Width(); + + GEOMToolsGUI_LineWidthDlg * Dlg = new GEOMToolsGUI_LineWidthDlg + (SUIT_Session::session()->activeApplication()->desktop(),"EDGE_WIDTH_TLT"); + Dlg->setTheLW(aWidth); + int aNewWidth = 0; + if (Dlg->exec()) { + aNewWidth = Dlg->getTheLW(); + bool ok = (aNewWidth != aWidth && aNewWidth != 0 ); + if (ok) { + for(; ic->MoreCurrent(); ic->NextCurrent()) { + CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + CurObject->SetWidth(aNewWidth); + ic->Redisplay(CurObject); + appStudy->setObjectProperty(mgrId,CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP, aNewWidth); + } + } + } + } + else { + return; + } + GeometryGUI::Modified(); + } + else if (isVTK) { // if is VTKViewer + SalomeApp_Application* app = dynamic_cast + (SUIT_Session::session()->activeApplication()); + if (!app) + return; + + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if (!aSelMgr) + return; + + SALOME_ListIO selected; + aSelMgr->selectedObjects(selected); + if (selected.IsEmpty()) + return; + + SVTK_ViewWindow* vtkVW = dynamic_cast(window); + if (!vtkVW) + return; + + SALOME_View* view = GEOM_Displayer::GetActiveView(); + + vtkActorCollection* aCollection = vtkActorCollection::New(); + + for (SALOME_ListIteratorOfListIO It (selected); It.More(); It.Next()) { + Handle(SALOME_InteractiveObject) anIObject = It.Value(); + SALOME_Prs* aPrs = view->CreatePrs(anIObject->getEntry()); + SVTK_Prs* vtkPrs = dynamic_cast(aPrs); + if (vtkPrs) { + vtkActorCollection* anActors = vtkPrs->GetObjects(); + anActors->InitTraversal(); + vtkActor* anAct = anActors->GetNextActor(); + aCollection->AddItem(anAct); + } + } + + if (aCollection) + aCollection->InitTraversal(); + else + return; + + int aWidth = 1; + + vtkActor* anAct = aCollection->GetNextActor(); + if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) + aWidth = anActor->GetWidth(); + else + return; + + GEOMToolsGUI_LineWidthDlg * Dlg = new GEOMToolsGUI_LineWidthDlg + (SUIT_Session::session()->activeApplication()->desktop(),"EDGE_WIDTH_TLT"); + + Dlg->setTheLW(aWidth); + if (Dlg->exec()) { + SUIT_OverrideCursor(); + aWidth = Dlg->getTheLW(); + while (anAct != NULL) { + if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) { + // There are no casting to needed actor. + anActor->SetWidth(aWidth); + appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), EDGE_WIDTH_PROP, aWidth); + } + anAct = aCollection->GetNextActor(); + } + } + GeometryGUI::Modified(); + } // end vtkviewer +} + + +void GEOMToolsGUI::OnIsosWidth() { + SalomeApp_Application* app = + dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + SalomeApp_Study* aStudy = dynamic_cast( app->activeStudy() ); + SUIT_ViewWindow* window = app->desktop()->activeWindow(); + + bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); + + if(isOCC){ // if is OCCViewer + + OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); + Handle (AIS_InteractiveContext) ic = vm->getAISContext(); + + ic->InitCurrent(); + if ( ic->MoreCurrent() ) { + Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + CurObject->restoreIsoNumbers(); + Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); + + Handle(Graphic3d_AspectLine3d) asp = CurDrawer->UIsoAspect()->Aspect(); + + Quantity_Color C; + Aspect_TypeOfLine T; + Standard_Real W; + asp->Values(C,T,W); + + int aWidth = (int)W; + + GEOMToolsGUI_LineWidthDlg * Dlg = + new GEOMToolsGUI_LineWidthDlg( SUIT_Session::session()->activeApplication()->desktop(),"ISOS_WIDTH_TLT" ); + + Dlg->setTheLW( aWidth ); + + if ( Dlg->exec() ) { + SUIT_OverrideCursor(); + aWidth = Dlg->getTheLW(); + } else //Cancel case + return; + + for(; ic->MoreCurrent(); ic->NextCurrent()) { + int aMgrId = window->getViewManager()->getGlobalId(); + CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + + Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); + + CurObject->Attributes()->UIsoAspect()->SetWidth(aWidth); + CurObject->Attributes()->VIsoAspect()->SetWidth(aWidth); + + ic->Redisplay(CurObject); + + aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_WIDTH_PROP, aWidth); + } + GeometryGUI::Modified(); + } + } + else if(isVTK){ // if is VTKViewer + // + // Warning. It's works incorrect. must be recheked. + // + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* > + ( SUIT_Session::session()->activeApplication() ); + if ( !app ) + return; + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( !aSelMgr ) + return; + SALOME_ListIO selected; + aSelMgr->selectedObjects( selected ); + if ( selected.IsEmpty() ) + return; + + SVTK_ViewWindow* vtkVW = dynamic_cast( window ); + if ( !vtkVW ) + return; + + SALOME_View* view = GEOM_Displayer::GetActiveView(); + + vtkActorCollection* aCollection = vtkActorCollection::New(); + + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle(SALOME_InteractiveObject) anIObject = It.Value(); + SALOME_Prs* aPrs = view->CreatePrs( anIObject->getEntry() ); + SVTK_Prs* vtkPrs = dynamic_cast( aPrs ); + if ( vtkPrs ) { + vtkActorCollection* anActors = vtkPrs->GetObjects(); + anActors->InitTraversal(); + vtkActor* anAct = anActors->GetNextActor(); + aCollection->AddItem(anAct); + } + } + + if(aCollection) + aCollection->InitTraversal(); + else + return; + + int aWidth = 1; + + vtkActor* anAct = aCollection->GetNextActor(); + if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) { + aWidth = anActor->GetIsosWidth(); + } + else + return; + + GEOMToolsGUI_LineWidthDlg* Dlg = + new GEOMToolsGUI_LineWidthDlg( SUIT_Session::session()->activeApplication()->desktop(), "ISOS_WIDTH_TLT" ); + + Dlg->setTheLW( aWidth ); + if (Dlg->exec() ) { + SUIT_OverrideCursor(); + aWidth = Dlg->getTheLW(); + } else + return; //Cancel case + + while( anAct!= NULL ) { + if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) { + // There are no casting to needed actor. + anActor->SetIsosWidth(aWidth); + int aMgrId = window->getViewManager()->getGlobalId(); + aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), ISOS_WIDTH_PROP, aWidth); + } + anAct = aCollection->GetNextActor(); + } + + view->Repaint(); + GeometryGUI::Modified(); + } // end vtkviewer +} diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.cxx new file mode 100644 index 000000000..49c845da2 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.cxx @@ -0,0 +1,192 @@ +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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/ or email : webmaster.salome@opencascade.com +// + +// GEOM GEOMGUI : GUI for Geometry component +// File : GEOMToolsGUI_LineWidthDlg.cxx +// Author : OCC Team +// +#include "GEOMToolsGUI_LineWidthDlg.h" +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : GEOMToolsGUI_LineWidthDlg() +// purpose : Constructs a GEOMToolsGUI_LineWidthDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= + +GEOMToolsGUI_LineWidthDlg::GEOMToolsGUI_LineWidthDlg (QWidget* parent, const QString& title) + : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +{ + setObjectName("GEOMToolsGUI_LineWidthDlg"); + setModal(true); + + setWindowTitle(tr(title.toLatin1().constData())); + setSizeGripEnabled(TRUE); + QGridLayout* MyDialogLayout = new QGridLayout(this); + MyDialogLayout->setSpacing(6); + MyDialogLayout->setMargin(11); + + + /***************************************************************/ + QGroupBox* GroupC1 = new QGroupBox (this); + GroupC1->setObjectName("GroupC1"); + QGridLayout* GroupC1Layout = new QGridLayout (GroupC1); + GroupC1Layout->setAlignment(Qt::AlignTop); + GroupC1Layout->setSpacing(6); + GroupC1Layout->setMargin(11); + + QLabel* TextLabel1 = new QLabel (GroupC1); + TextLabel1->setObjectName("TextLabel1"); + TextLabel1->setText(tr("GEOM_LINE_WIDTH")); + GroupC1Layout->addWidget(TextLabel1, 0, 0); + + + mySpinBox = new SalomeApp_IntSpinBox (GroupC1); + mySpinBox->setRange( 1, 5 ); + mySpinBox->setSingleStep( 1 ); + + mySpinBox->setObjectName("SpinBoxU"); + mySpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); + mySpinBox->setValue(1); + GroupC1Layout->addWidget(mySpinBox, 0, 1); + + + /***************************************************************/ + QGroupBox* GroupButtons = new QGroupBox (this); + GroupButtons->setObjectName("GroupButtons"); + QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons); + GroupButtonsLayout->setAlignment(Qt::AlignTop); + GroupButtonsLayout->setSpacing(6); + GroupButtonsLayout->setMargin(11); + + QPushButton* buttonOk = new QPushButton (GroupButtons); + buttonOk->setObjectName("buttonOk"); + buttonOk->setText(tr("GEOM_BUT_OK")); + buttonOk->setAutoDefault(TRUE); + buttonOk->setDefault(TRUE); + GroupButtonsLayout->addWidget(buttonOk, 0, 0); + + GroupButtonsLayout->addItem(new QSpacerItem (20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1); + + QPushButton* buttonCancel = new QPushButton (GroupButtons); + buttonCancel->setObjectName("buttonCancel"); + buttonCancel->setText(tr("GEOM_BUT_CANCEL")); + buttonCancel->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonCancel, 0, 1); + + QPushButton* buttonHelp = new QPushButton (GroupButtons); + buttonHelp->setObjectName("buttonHelp"); + buttonHelp->setText(tr("GEOM_BUT_HELP")); + buttonHelp->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonHelp, 0, 2); + /***************************************************************/ + + MyDialogLayout->addWidget(GroupC1, 0, 0); + MyDialogLayout->addWidget(GroupButtons, 1, 0); + + myHelpFileName = "line_width_page.html"; + + // signals and slots connections + connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); + + // Move widget on the botton right corner of main widget + SUIT_Tools::centerWidget(this, parent); +} + + +//================================================================================= +// function : ~GEOMToolsGUI_LineWidthDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GEOMToolsGUI_LineWidthDlg::~GEOMToolsGUI_LineWidthDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +int GEOMToolsGUI_LineWidthDlg::getTheLW() const +{ + return mySpinBox->text().toInt(); +} + +void GEOMToolsGUI_LineWidthDlg::setTheLW (const int v) +{ + mySpinBox->setValue(v); +} + + +//================================================================================= +// function : ClickOnHelp() +// purpose : +//================================================================================= +void GEOMToolsGUI_LineWidthDlg::ClickOnHelp() +{ + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + GeometryGUI* aGeomGUI = dynamic_cast(app->module("Geometry")); + app->onHelpContextModule(aGeomGUI ? app->moduleName(aGeomGUI->moduleName()) : QString(""), myHelpFileName); + } + else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif + SUIT_MessageBox::warning + (0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), + QObject::tr("BUT_OK")); + } +} + +//================================================================================= +// function : keyPressEvent() +// purpose : +//================================================================================= +void GEOMToolsGUI_LineWidthDlg::keyPressEvent (QKeyEvent* e) +{ + QDialog::keyPressEvent(e); + if (e->isAccepted()) + return; + + if (e->key() == Qt::Key_F1) { + e->accept(); + ClickOnHelp(); + } +} diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.h new file mode 100644 index 000000000..09bfe4446 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.h @@ -0,0 +1,59 @@ +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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/ or email : webmaster.salome@opencascade.com +// + +// GEOM GEOMGUI : GUI for Geometry component +// File : GEOMToolsGUI_DeflectionDlg.h +// Author : OCC Team +// +#ifndef GEOMTOOLSGUI_LINEWIDTHDLG_H +#define GEOMTOOLSGUI_LINEWIDTHDLG_H + +#include "GEOM_ToolsGUI.hxx" + +#include + +class SalomeApp_IntSpinBox; + +//================================================================================= +// class : GEOMToolsGUI_LineWidthDlg +// purpose : +//================================================================================= +class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_LineWidthDlg : public QDialog +{ + Q_OBJECT + +public: + GEOMToolsGUI_LineWidthDlg( QWidget*, const QString& ); + ~GEOMToolsGUI_LineWidthDlg(); + + int getTheLW() const; + void setTheLW( const int ); + +private slots: + void ClickOnHelp(); + +private: + void keyPressEvent( QKeyEvent* ); + +private: + SalomeApp_IntSpinBox* mySpinBox; + QString myHelpFileName; +}; + +#endif // GEOMTOOLSGUI_LINEWIDTHDLG_H diff --git a/src/GEOMToolsGUI/Makefile.am b/src/GEOMToolsGUI/Makefile.am index 63afb84f2..c3a32d6f4 100644 --- a/src/GEOMToolsGUI/Makefile.am +++ b/src/GEOMToolsGUI/Makefile.am @@ -36,7 +36,8 @@ salomeinclude_HEADERS = \ GEOMToolsGUI_DeleteDlg.h \ GEOMToolsGUI_MarkerDlg.h \ GEOMToolsGUI_PublishDlg.h \ - GEOMToolsGUI_MaterialPropertiesDlg.h + GEOMToolsGUI_MaterialPropertiesDlg.h \ + GEOMToolsGUI_LineWidthDlg.h dist_libGEOMToolsGUI_la_SOURCES = \ GEOMToolsGUI.cxx \ @@ -47,7 +48,8 @@ dist_libGEOMToolsGUI_la_SOURCES = \ GEOMToolsGUI_DeleteDlg.cxx \ GEOMToolsGUI_MarkerDlg.cxx \ GEOMToolsGUI_PublishDlg.cxx \ - GEOMToolsGUI_MaterialPropertiesDlg.cxx + GEOMToolsGUI_MaterialPropertiesDlg.cxx \ + GEOMToolsGUI_LineWidthDlg.cxx MOC_FILES = \ GEOMToolsGUI_TransparencyDlg_moc.cxx \ @@ -56,7 +58,8 @@ MOC_FILES = \ GEOMToolsGUI_DeleteDlg_moc.cxx \ GEOMToolsGUI_MarkerDlg_moc.cxx \ GEOMToolsGUI_PublishDlg_moc.cxx \ - GEOMToolsGUI_MaterialPropertiesDlg_moc.cxx + GEOMToolsGUI_MaterialPropertiesDlg_moc.cxx \ + GEOMToolsGUI_LineWidthDlg_moc.cxx nodist_libGEOMToolsGUI_la_SOURCES = \ $(MOC_FILES) diff --git a/src/MeasureGUI/MeasureGUI.h b/src/MeasureGUI/MeasureGUI.h index 4a9f28201..d196684f8 100644 --- a/src/MeasureGUI/MeasureGUI.h +++ b/src/MeasureGUI/MeasureGUI.h @@ -33,6 +33,12 @@ // class : MeasureGUI // purpose : //================================================================================= + +#define DISPLAY_PREVIEW_MACRO \ +SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); \ +int w = resMgr->integerValue("Geometry", "measures_line_width", 1); \ +displayPreview(true, false, true, true, w, -1, -1); + class MeasureGUI : public GEOMGUI { public: diff --git a/src/MeasureGUI/MeasureGUI_AngleDlg.cxx b/src/MeasureGUI/MeasureGUI_AngleDlg.cxx index d80594e04..d628fa594 100644 --- a/src/MeasureGUI/MeasureGUI_AngleDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_AngleDlg.cxx @@ -377,6 +377,10 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs() anIO->SetArrowSize(arrowSize); } + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int w = resMgr->integerValue("Geometry", "measures_line_width", 1); + anIO->SetWidth(w); + SOCC_Prs* aPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); diff --git a/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.cxx b/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.cxx index c61cbc0af..2c8166beb 100644 --- a/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.cxx @@ -24,6 +24,7 @@ // File : MeasureGUI_CheckCompoundOfBlocksDlg.cxx // Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com) // +#include "MeasureGUI.h" #include "MeasureGUI_CheckCompoundOfBlocksDlg.h" #include "MeasureGUI_Widgets.h" @@ -188,7 +189,7 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::SelectionIntoArgument() myObj = aSelectedObject; myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) ); processObject(); - displayPreview(true); + DISPLAY_PREVIEW_MACRO; } //================================================================================= @@ -228,7 +229,7 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::ActivateThisDialog() connect( aSel, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); activateSelection(); - displayPreview(true); + DISPLAY_PREVIEW_MACRO } //================================================================================= @@ -418,9 +419,11 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::onSubShapesListSelectionChanged() QList::iterator it; for ( it = aIds.begin(); it != aIds.end(); ++it ) { aSubShape = anIndices.FindKey(aObjLst[(*it)]); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int w = resMgr->integerValue("Geometry", "measures_line_width", 1); try { getDisplayer()->SetColor( Quantity_NOC_RED ); - getDisplayer()->SetWidth( 3 ); + getDisplayer()->SetWidth( w ); getDisplayer()->SetToActivate( false ); aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs( aSubShape ) : 0; if ( aPrs ) diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index ecd82d3e3..3b8bc2a13 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -327,6 +327,10 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs() Handle(AIS_LengthDimension) anIO = new AIS_LengthDimension( aVert1, aVert2, P, aDist, TCollection_ExtendedString((Standard_CString)aLabel.toLatin1().constData())); anIO->SetArrowSize(aDist/20); + + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int w = resMgr->integerValue("Geometry", "measures_line_width", 1); + anIO->SetWidth(w); SOCC_Prs* aPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); diff --git a/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx b/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx index 44fc3639a..4b8ab9329 100644 --- a/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx @@ -21,6 +21,7 @@ // File : MeasureGUI_NormaleDlg.cxx // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. // +#include "MeasureGUI.h" #include "MeasureGUI_NormaleDlg.h" #include @@ -246,7 +247,7 @@ void MeasureGUI_NormaleDlg::SelectionIntoArgument() GroupArgs->PushButton1->click(); } - displayPreview(true); + DISPLAY_PREVIEW_MACRO } //================================================================================= @@ -286,7 +287,7 @@ void MeasureGUI_NormaleDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(true); + DISPLAY_PREVIEW_MACRO } //================================================================================= @@ -313,7 +314,7 @@ void MeasureGUI_NormaleDlg::ActivateThisDialog() connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - displayPreview(true); + DISPLAY_PREVIEW_MACRO } //================================================================================= diff --git a/src/OBJECT/GEOM_Actor.cxx b/src/OBJECT/GEOM_Actor.cxx index 318ea45b8..9b956bf68 100644 --- a/src/OBJECT/GEOM_Actor.cxx +++ b/src/OBJECT/GEOM_Actor.cxx @@ -497,6 +497,12 @@ void GEOM_Actor::SetWireframeProperty(vtkProperty* Prop) myWireframeFaceActor->SetProperty(Prop); } + +vtkProperty* GEOM_Actor::GetWireframeProperty() +{ + return myWireframeFaceActor->GetProperty(); +} + void GEOM_Actor::SetShadingProperty(vtkProperty* Prop) { #ifdef MYDEBUG @@ -506,6 +512,12 @@ void GEOM_Actor::SetShadingProperty(vtkProperty* Prop) } +vtkProperty* GEOM_Actor::GetShadingProperty() +{ + return myShadingFaceProp; +} + + void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper) { #ifdef MYDEBUG @@ -995,6 +1007,27 @@ void GEOM_Actor::StoreIsoNumbers() myWireframeFaceSource->GetNbIso(myNbIsos[0], myNbIsos[1]); } +void GEOM_Actor::SetIsosWidth(const int width) { + myWireframeFaceActor->GetProperty()->SetLineWidth(width); +} + +int GEOM_Actor::GetIsosWidth() const { + return myWireframeFaceActor->GetProperty()->GetLineWidth(); +} + +void GEOM_Actor::SetWidth(const int width) { + myIsolatedEdgeActor->GetProperty()->SetLineWidth(width); + myOneFaceEdgeActor->GetProperty()->SetLineWidth(width); + mySharedEdgeActor->GetProperty()->SetLineWidth(width); + myHighlightProp->SetLineWidth(width); + myPreHighlightProp->SetLineWidth(width+1); + +} + +int GEOM_Actor::GetWidth() const { + return myIsolatedEdgeActor->GetProperty()->GetLineWidth(); +} + void GEOM_Actor::RestoreIsoNumbers() { if ( myNbIsos[0] > 0 || myNbIsos[1] > 0 ) diff --git a/src/OBJECT/GEOM_Actor.h b/src/OBJECT/GEOM_Actor.h index a6e890d65..c0c31fc5a 100644 --- a/src/OBJECT/GEOM_Actor.h +++ b/src/OBJECT/GEOM_Actor.h @@ -86,6 +86,9 @@ public: void SetWireframeProperty(vtkProperty* Prop); void SetShadingProperty(vtkProperty* Prop); + vtkProperty* GetWireframeProperty(); + vtkProperty* GetShadingProperty(); + void setDeflection(double adef); virtual void setDisplayMode(int thenewmode); @@ -166,6 +169,15 @@ public: void GetNbIsos(int &theNbU,int &theNbV); + virtual + void SetIsosWidth(const int width); + + int GetIsosWidth() const; + + virtual void SetWidth(const int width); + + int GetWidth() const; + //! Vector mode management virtual void diff --git a/src/OBJECT/GEOM_Constants.h b/src/OBJECT/GEOM_Constants.h index 49bdabe8a..655dfc125 100644 --- a/src/OBJECT/GEOM_Constants.h +++ b/src/OBJECT/GEOM_Constants.h @@ -45,5 +45,7 @@ #define MARKER_TYPE_PROP "MarkerType" //Marker type property #define FRONT_MATERIAL_PROP "FrontMaterial" //Object front material property #define BACK_MATERIAL_PROP "BackMaterial" //Object back material property +#define EDGE_WIDTH_PROP "EdgeWidth" //Width of the edge +#define ISOS_WIDTH_PROP "IsosWidth" //Width of the iso-lines #endif //GEOM_CONSTANTS_H