Implementation of the "21046: EDF 1610 GUI: To be able to change the width of the lines" issue.

This commit is contained in:
rnv 2012-02-14 12:03:57 +00:00
parent a77c8750d4
commit 882dc8f6ee
26 changed files with 815 additions and 23 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -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 <b>Arguments: </b>1 value (width of the edge or isoline).
\image html line_width.png
\n <b>Example:</b>
\image html line_width_1.png
\image html line_width_2.png
*/

View File

@ -33,6 +33,8 @@ deflection coefficient of a shape.</li>
material properties of a shape.</li> material properties of a shape.</li>
<li>\subpage point_marker_page "Point Marker" - allows to change the <li>\subpage point_marker_page "Point Marker" - allows to change the
representation of geometrical vertices.</li> representation of geometrical vertices.</li>
<li>\subpage line_width_page "Line Width" - allows to change the
width of the edges and isolines.</li>
<li><b>Auto color</b> / <b>Disable auto color</b> - activates the auto color <li><b>Auto color</b> / <b>Disable auto color</b> - activates the auto color
mode. When the auto color mode is enabled, the groups created on the mode. When the auto color mode is enabled, the groups created on the
sub-shapes of the selected geometrical object are automatically sub-shapes of the selected geometrical object are automatically

View File

@ -57,6 +57,11 @@
<parameter name="geom_preview" value="false" /> <parameter name="geom_preview" value="false" />
<parameter name="front_material" value="Gold" /> <parameter name="front_material" value="Gold" />
<parameter name="back_material" value="Gold" /> <parameter name="back_material" value="Gold" />
<parameter name="edge_width" value="1" />
<parameter name="isolines_width" value="1" />
<parameter name="preview_edge_width" value="1" />
<parameter name="measures_line_width" value="1" />
<!-- Input field precisions --> <!-- Input field precisions -->
<parameter name="def_precision" value="3" /> <parameter name="def_precision" value="3" />
<parameter name="length_precision" value="6" /> <parameter name="length_precision" value="6" />

View File

@ -37,6 +37,7 @@
#include <SUIT_ViewModel.h> #include <SUIT_ViewModel.h>
#include <SUIT_MessageBox.h> #include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h> #include <SUIT_OverrideCursor.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Module.h> #include <SalomeApp_Module.h>
#include <SalomeApp_Application.h> #include <SalomeApp_Application.h>
@ -317,7 +318,12 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object,
getDisplayer()->SetColor( color == -1 ? Quantity_NOC_VIOLET : color ); getDisplayer()->SetColor( color == -1 ? Quantity_NOC_VIOLET : color );
// set width of displayed shape // 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 // set display mode of displayed shape
int aPrevDispMode = getDisplayer()->SetDisplayMode( displayMode ); int aPrevDispMode = getDisplayer()->SetDisplayMode( displayMode );

View File

@ -313,7 +313,11 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st )
myShadingColor = SalomeApp_Tools::color( col ); myShadingColor = SalomeApp_Tools::color( col );
myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0); myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0);
int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS); 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))); 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 = (resMgr->integerValue("Geometry", "marker_scale", 1)-(int)GEOM::MS_10)*0.5 + 1.0;
myScaleOfMarker = std::min(7.0, std::max(1., myScaleOfMarker)); 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(); Handle(Prs3d_IsoAspect) anAspect = AISShape->Attributes()->UIsoAspect();
anAspect->SetNumber( anUIsoNumber ); anAspect->SetNumber( anUIsoNumber );
anAspect->SetColor( aColor ); anAspect->SetColor( aColor );
if(HasIsosWidth())
anAspect->SetWidth( GetIsosWidth() );
AISShape->Attributes()->SetUIsoAspect( anAspect ); AISShape->Attributes()->SetUIsoAspect( anAspect );
anAspect = AISShape->Attributes()->VIsoAspect(); anAspect = AISShape->Attributes()->VIsoAspect();
anAspect->SetNumber( aVIsoNumber ); anAspect->SetNumber( aVIsoNumber );
if(HasIsosWidth())
anAspect->SetWidth( GetIsosWidth() );
anAspect->SetColor( aColor ); anAspect->SetColor( aColor );
AISShape->Attributes()->SetVIsoAspect( anAspect ); AISShape->Attributes()->SetVIsoAspect( anAspect );
@ -828,6 +837,8 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
double aDC = 0; double aDC = 0;
if(useStudy) { if(useStudy) {
aDC = aPropMap.value(DEFLECTION_COEFF_PROP).toDouble(); aDC = aPropMap.value(DEFLECTION_COEFF_PROP).toDouble();
SetWidth(aPropMap.value(EDGE_WIDTH_PROP).toInt());
SetIsosWidth(aPropMap.value(ISOS_WIDTH_PROP).toInt());
} }
else { else {
aDC = aResMgr->doubleValue("Geometry", "deflection_coeff", 0.001); aDC = aResMgr->doubleValue("Geometry", "deflection_coeff", 0.001);
@ -1003,6 +1014,13 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
if ( aModelB ) if ( aModelB )
delete 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 ??? // 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() ); aProp->SetColor( aColor.Red(), aColor.Green(), aColor.Blue() );
} }
if ( HasWidth() )
{
aProp->SetLineWidth( GetWidth() );
}
while ( anActor != NULL ) while ( anActor != NULL )
{ {
SALOME_Actor* GActor = SALOME_Actor::SafeDownCast( anActor ); 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(); aIsos[0] = uv[0].toInt(); aIsos[1] = uv[1].toInt();
aGeomGActor->SetNbIsos(aIsos); aGeomGActor->SetNbIsos(aIsos);
aGeomGActor->SetOpacity(1.0 - aPropMap.value(TRANSPARENCY_PROP).toDouble()); 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()); aGeomGActor->SetVectorMode(aPropMap.value(VECTOR_MODE_PROP).toInt());
int aDispModeId = aPropMap.value(DISPLAY_MODE_PROP).toInt(); int aDispModeId = aPropMap.value(DISPLAY_MODE_PROP).toInt();
// Specially processing of 'Shading with edges' mode from preferences, // Specially processing of 'Shading with edges' mode from preferences,
@ -1217,6 +1232,13 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
// Release memory // Release memory
delete aModelB; delete aModelB;
if(HasWidth())
aStudy->setObjectProperty( aMgrId, anEntry, EDGE_WIDTH_PROP, GetWidth() );
if(HasIsosWidth())
aStudy->setObjectProperty( aMgrId, anEntry, ISOS_WIDTH_PROP, GetIsosWidth() );
} }
else { else {
// Set the same front and back materials for the selected shape // 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 ) if ( myToActivate )
GActor->PickableOn(); GActor->PickableOn();
else else
@ -1760,6 +1793,23 @@ void GEOM_Displayer::UnsetWidth()
myWidth = -1; 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 * GEOM_Displayer::SetToActivate
@ -1962,12 +2012,20 @@ PropMap GEOM_Displayer::getDefaultPropertyMap(const QString& viewer_type) {
QString aMaterialF = aModelF.getMaterialProperty(); QString aMaterialF = aModelF.getMaterialProperty();
aDefaultMap.insert( FRONT_MATERIAL_PROP , aMaterialF ); aDefaultMap.insert( FRONT_MATERIAL_PROP , aMaterialF );
// Back material //9. Back material
Material_Model aModelB; Material_Model aModelB;
aModelB.fromResources( aResMgr, "Geometry", false ); aModelB.fromResources( aResMgr, "Geometry", false );
QString aMaterialB = aModelB.getMaterialProperty(); QString aMaterialB = aModelB.getMaterialProperty();
aDefaultMap.insert( BACK_MATERIAL_PROP , aMaterialB ); 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; return aDefaultMap;
} }
@ -2005,6 +2063,17 @@ bool GEOM_Displayer::MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault)
theOrigin.insert(BACK_MATERIAL_PROP, theDefault.value(BACK_MATERIAL_PROP)); theOrigin.insert(BACK_MATERIAL_PROP, theDefault.value(BACK_MATERIAL_PROP));
nbInserted++; 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); return (nbInserted > 0);
} }

View File

@ -135,6 +135,11 @@ public:
double GetWidth () const; double GetWidth () const;
bool HasWidth () 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. */ /* Set display mode shape displaying. If it is equal -1 then display mode is used. */
int SetDisplayMode( const int ); int SetDisplayMode( const int );
int GetDisplayMode() const; int GetDisplayMode() const;
@ -215,6 +220,7 @@ protected:
Quantity_Color myShadingColor; Quantity_Color myShadingColor;
int myColor; int myColor;
double myWidth; double myWidth;
int myIsosWidth;
bool myToActivate; bool myToActivate;
int myDisplayMode; int myDisplayMode;
Aspect_TypeOfMarker myTypeOfMarker; Aspect_TypeOfMarker myTypeOfMarker;

View File

@ -11,6 +11,14 @@
<source>CHANGE_ORIENTATION_NEW_OBJ_NAME</source> <source>CHANGE_ORIENTATION_NEW_OBJ_NAME</source>
<translation>Invert</translation> <translation>Invert</translation>
</message> </message>
<message>
<source>EDGE_WIDTH_TLT</source>
<translation>Select Edge Width</translation>
</message>
<message>
<source>ISOS_WIDTH_TLT</source>
<translation>Select Isos Width</translation>
</message>
<message> <message>
<source>CLOSE_CONTOUR_NEW_OBJ_NAME</source> <source>CLOSE_CONTOUR_NEW_OBJ_NAME</source>
<translation>CloseContour</translation> <translation>CloseContour</translation>
@ -2574,6 +2582,34 @@ Please, select face, shell or solid and try again</translation>
<source>MEN_POP_TEXTURE</source> <source>MEN_POP_TEXTURE</source>
<translation>Texture</translation> <translation>Texture</translation>
</message> </message>
<message>
<source>MEN_EDGE_WIDTH</source>
<translation>Edge Width</translation>
</message>
<message>
<source>TOP_EDGE_WIDTH</source>
<translation>Edge Width</translation>
</message>
<message>
<source>STB_EDGE_WIDTH</source>
<translation>Edge Width</translation>
</message>
<message>
<source>MEN_ISOS_WIDTH</source>
<translation>Isos Width</translation>
</message>
<message>
<source>TOP_ISOS_WIDTH</source>
<translation>Isos Width</translation>
</message>
<message>
<source>STB_ISOS_WIDTH</source>
<translation>Isos Width</translation>
</message>
<message>
<source>MEN_LINE_WIDTH</source>
<translation>Line Width</translation>
</message>
<message> <message>
<source>MEN_POP_SETTEXTURE</source> <source>MEN_POP_SETTEXTURE</source>
<translation>Texture</translation> <translation>Texture</translation>
@ -2906,6 +2942,22 @@ Please, select face, shell or solid and try again</translation>
<source>PREF_BACK_MATERIAL</source> <source>PREF_BACK_MATERIAL</source>
<translation>Default back material</translation> <translation>Default back material</translation>
</message> </message>
<message>
<source>PREF_EDGE_WIDTH</source>
<translation>Edges width</translation>
</message>
<message>
<source>PREF_ISOLINES_WIDTH</source>
<translation>Iso lines width</translation>
</message>
<message>
<source>PREF_PREVIEW_EDGE_WIDTH</source>
<translation>Preview edges width</translation>
</message>
<message>
<source>PREF_MEASURES_LINE_WIDTH</source>
<translation>Measures lines width</translation>
</message>
<message> <message>
<source>PROCESS_SHAPE_NEW_OBJ_NAME</source> <source>PROCESS_SHAPE_NEW_OBJ_NAME</source>
<translation>ProcessShape</translation> <translation>ProcessShape</translation>
@ -5003,6 +5055,13 @@ Would you like to continue?</translation>
<translation>Deflection :</translation> <translation>Deflection :</translation>
</message> </message>
</context> </context>
<context>
<name>GEOMToolsGUI_LineWidthDlg</name>
<message>
<source>GEOM_LINE_WIDTH</source>
<translation>Line width:</translation>
</message>
</context>
<context> <context>
<name>GEOMToolsGUI_MarkerDlg</name> <name>GEOMToolsGUI_MarkerDlg</name>
<message> <message>

View File

@ -424,6 +424,8 @@ void GeometryGUI::OnGUIEvent( int id )
case GEOMOp::OpPublishObject: // ROOT GEOM OBJECT - POPUP MENU - PUBLISH case GEOMOp::OpPublishObject: // ROOT GEOM OBJECT - POPUP MENU - PUBLISH
case GEOMOp::OpPointMarker: // POPUP MENU - POINT MARKER case GEOMOp::OpPointMarker: // POPUP MENU - POINT MARKER
case GEOMOp::OpMaterialProperties: // POPUP MENU - MATERIAL PROPERTIES 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"; libName = "GEOMToolsGUI";
break; break;
case GEOMOp::OpDisplayMode: // MENU VIEW - WIREFRAME/SHADING 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::OpShading, "POP_SHADING", "", 0, true );
createGeomAction( GEOMOp::OpShadingWithEdges, "POP_SHADING_WITH_EDGES", "", 0, true ); createGeomAction( GEOMOp::OpShadingWithEdges, "POP_SHADING_WITH_EDGES", "", 0, true );
createGeomAction( GEOMOp::OpTexture, "POP_TEXTURE", "", 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::OpVectors, "POP_VECTORS", "", 0, true );
createGeomAction( GEOMOp::OpDeflection, "POP_DEFLECTION" ); createGeomAction( GEOMOp::OpDeflection, "POP_DEFLECTION" );
createGeomAction( GEOMOp::OpColor, "POP_COLOR" ); 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->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->insert( action( GEOMOp::OpSetTexture ), -1, -1 ); // texture
mgr->setRule( action( GEOMOp::OpSetTexture ), clientOCCorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule ); 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( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpAutoColor ), -1, -1 ); // auto color mgr->insert( action( GEOMOp::OpAutoColor ), -1, -1 ); // auto color
mgr->setRule( action( GEOMOp::OpAutoColor ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule ); mgr->setRule( action( GEOMOp::OpAutoColor ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule );
@ -1684,6 +1696,28 @@ void GeometryGUI::createPreferences()
LightApp_Preferences::Selector, LightApp_Preferences::Selector,
"Geometry", "back_material" ); "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 // Quantities with individual precision settings
int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId ); int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId );
setPreferenceProperty( precGroup, "columns", 2 ); setPreferenceProperty( precGroup, "columns", 2 );
@ -1950,6 +1984,17 @@ void GeometryGUI::storeVisualParameters (int savePoint)
if(aProps.contains(BACK_MATERIAL_PROP)) { if(aProps.contains(BACK_MATERIAL_PROP)) {
param = occParam + BACK_MATERIAL_PROP; param = occParam + BACK_MATERIAL_PROP;
ip->setParameter(entry, param, aProps.value(BACK_MATERIAL_PROP).toString().toLatin1().data()); 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 } // object iterator
} // for (views) } // for (views)
@ -2062,8 +2107,14 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
aListOfMap[viewIndex].insert( FRONT_MATERIAL_PROP, val); aListOfMap[viewIndex].insert( FRONT_MATERIAL_PROP, val);
} else if(paramNameStr == BACK_MATERIAL_PROP) { } else if(paramNameStr == BACK_MATERIAL_PROP) {
aListOfMap[viewIndex].insert( BACK_MATERIAL_PROP, val); 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 } // for names/parameters iterator
QList<SUIT_ViewManager*> lst = getApp()->viewManagers(); QList<SUIT_ViewManager*> lst = getApp()->viewManagers();

View File

@ -54,6 +54,8 @@ namespace GEOMOp {
OpHideChildren = 1251, // POPUP MENU - HIDE CHILDREN OpHideChildren = 1251, // POPUP MENU - HIDE CHILDREN
OpUnpublishObject = 1253, // POPUP MENU - UNPUBLISH OpUnpublishObject = 1253, // POPUP MENU - UNPUBLISH
OpPublishObject = 1254, // GEOM ROOT OBJECT - POPUP MENU - PUBLISH 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 ----------------//-------------------------------- // DisplayGUI ----------------//--------------------------------
OpDisplayMode = 2000, // MENU VIEW - DISPLAY MODE - WIREFRAME/SHADING/SHADING WITH EDGES OpDisplayMode = 2000, // MENU VIEW - DISPLAY MODE - WIREFRAME/SHADING/SHADING WITH EDGES

View File

@ -371,6 +371,12 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
case GEOMOp::OpPublishObject:// GEOM ROOT OBJECT - POPUP - PUBLISH case GEOMOp::OpPublishObject:// GEOM ROOT OBJECT - POPUP - PUBLISH
OnPublishObject(); OnPublishObject();
break; break;
case GEOMOp::OpEdgeWidth:
OnEdgeWidth();
break;
case GEOMOp::OpIsosWidth:
OnIsosWidth();
break;
default: default:
SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break; break;

View File

@ -76,6 +76,8 @@ private:
void OnPublishObject() ; void OnPublishObject() ;
void OnPointMarker(); void OnPointMarker();
void OnMaterialProperties(); void OnMaterialProperties();
void OnEdgeWidth();
void OnIsosWidth();
// Shortcut commands // Shortcut commands
void OnChangeTransparency( bool ); void OnChangeTransparency( bool );

View File

@ -32,6 +32,7 @@
#include "GEOMToolsGUI_MarkerDlg.h" #include "GEOMToolsGUI_MarkerDlg.h"
#include "GEOMToolsGUI_PublishDlg.h" #include "GEOMToolsGUI_PublishDlg.h"
#include "GEOMToolsGUI_MaterialPropertiesDlg.h" #include "GEOMToolsGUI_MaterialPropertiesDlg.h"
#include "GEOMToolsGUI_LineWidthDlg.h"
#include <GeometryGUI.h> #include <GeometryGUI.h>
#include <GeometryGUI_Operations.h> #include <GeometryGUI_Operations.h>
@ -79,6 +80,7 @@
#include <Prs3d_IsoAspect.hxx> #include <Prs3d_IsoAspect.hxx>
#include <Prs3d_PointAspect.hxx> #include <Prs3d_PointAspect.hxx>
#include <Graphic3d_AspectMarker3d.hxx> #include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 #if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
#include <TColStd_HArray1OfByte.hxx> #include <TColStd_HArray1OfByte.hxx>
@ -392,7 +394,6 @@ void GEOMToolsGUI::OnTexture()
if ( !selected.IsEmpty() ) { if ( !selected.IsEmpty() ) {
SUIT_ViewWindow* window = app->desktop()->activeWindow(); SUIT_ViewWindow* window = app->desktop()->activeWindow();
bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
int mgrId = window->getViewManager()->getGlobalId();
if ( isOCC ) { if ( isOCC ) {
QString aTexture = QFileDialog::getOpenFileName(window,tr( "GEOM_SELECT_IMAGE"),QString(), tr("OCC_IMAGE_FILES")); QString aTexture = QFileDialog::getOpenFileName(window,tr( "GEOM_SELECT_IMAGE"),QString(), tr("OCC_IMAGE_FILES"));
if( !aTexture.isEmpty() ) if( !aTexture.isEmpty() )
@ -563,12 +564,17 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType )
} }
for(; ic->MoreCurrent(); ic->NextCurrent()) { for(; ic->MoreCurrent(); ic->NextCurrent()) {
int aMgrId = window->getViewManager()->getGlobalId();
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbUIso) ); QVariant v = aStudy->getObjectProperty( aMgrId, CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP , QVariant() );
CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbVIso) );
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(); CurObject->storeIsoNumbers();
@ -576,8 +582,7 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType )
ic->Redisplay(CurObject); ic->Redisplay(CurObject);
QString anIsos("%1%2%3");anIsos = anIsos.arg(newNbUIso);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(newNbVIso); 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_WIDTH_PROP, anIsos);
aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_PROP, anIsos);
} }
} }
GeometryGUI::Modified(); GeometryGUI::Modified();
@ -940,3 +945,245 @@ void GEOMToolsGUI::OnPublishObject() {
new GEOMToolsGUI_PublishDlg( SUIT_Session::session()->activeApplication()->desktop() ); new GEOMToolsGUI_PublishDlg( SUIT_Session::session()->activeApplication()->desktop() );
publishDlg->exec(); publishDlg->exec();
} }
void GEOMToolsGUI::OnEdgeWidth()
{
SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( 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<OCCViewer_Viewer*>(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<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<SVTK_ViewWindow*>(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<SVTK_Prs*>(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<SalomeApp_Study*>( 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<OCCViewer_Viewer*>( 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<SVTK_ViewWindow*>( 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<SVTK_Prs*>( 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
}

View File

@ -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 <GeometryGUI.h>
#include <GEOM_Constants.h>
#include <LightApp_Application.h>
#include <SalomeApp_IntSpinBox.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_Tools.h>
#include <QLabel>
#include <QChar>
#include <QPushButton>
#include <QGroupBox>
#include <QGridLayout>
#include <QKeyEvent>
//=================================================================================
// 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<GeometryGUI*>(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();
}
}

View File

@ -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 <QDialog>
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

View File

@ -36,7 +36,8 @@ salomeinclude_HEADERS = \
GEOMToolsGUI_DeleteDlg.h \ GEOMToolsGUI_DeleteDlg.h \
GEOMToolsGUI_MarkerDlg.h \ GEOMToolsGUI_MarkerDlg.h \
GEOMToolsGUI_PublishDlg.h \ GEOMToolsGUI_PublishDlg.h \
GEOMToolsGUI_MaterialPropertiesDlg.h GEOMToolsGUI_MaterialPropertiesDlg.h \
GEOMToolsGUI_LineWidthDlg.h
dist_libGEOMToolsGUI_la_SOURCES = \ dist_libGEOMToolsGUI_la_SOURCES = \
GEOMToolsGUI.cxx \ GEOMToolsGUI.cxx \
@ -47,7 +48,8 @@ dist_libGEOMToolsGUI_la_SOURCES = \
GEOMToolsGUI_DeleteDlg.cxx \ GEOMToolsGUI_DeleteDlg.cxx \
GEOMToolsGUI_MarkerDlg.cxx \ GEOMToolsGUI_MarkerDlg.cxx \
GEOMToolsGUI_PublishDlg.cxx \ GEOMToolsGUI_PublishDlg.cxx \
GEOMToolsGUI_MaterialPropertiesDlg.cxx GEOMToolsGUI_MaterialPropertiesDlg.cxx \
GEOMToolsGUI_LineWidthDlg.cxx
MOC_FILES = \ MOC_FILES = \
GEOMToolsGUI_TransparencyDlg_moc.cxx \ GEOMToolsGUI_TransparencyDlg_moc.cxx \
@ -56,7 +58,8 @@ MOC_FILES = \
GEOMToolsGUI_DeleteDlg_moc.cxx \ GEOMToolsGUI_DeleteDlg_moc.cxx \
GEOMToolsGUI_MarkerDlg_moc.cxx \ GEOMToolsGUI_MarkerDlg_moc.cxx \
GEOMToolsGUI_PublishDlg_moc.cxx \ GEOMToolsGUI_PublishDlg_moc.cxx \
GEOMToolsGUI_MaterialPropertiesDlg_moc.cxx GEOMToolsGUI_MaterialPropertiesDlg_moc.cxx \
GEOMToolsGUI_LineWidthDlg_moc.cxx
nodist_libGEOMToolsGUI_la_SOURCES = \ nodist_libGEOMToolsGUI_la_SOURCES = \
$(MOC_FILES) $(MOC_FILES)

View File

@ -33,6 +33,12 @@
// class : MeasureGUI // class : MeasureGUI
// purpose : // 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 class MeasureGUI : public GEOMGUI
{ {
public: public:

View File

@ -377,6 +377,10 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs()
anIO->SetArrowSize(arrowSize); 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 = SOCC_Prs* aPrs =
dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));

View File

@ -24,6 +24,7 @@
// File : MeasureGUI_CheckCompoundOfBlocksDlg.cxx // File : MeasureGUI_CheckCompoundOfBlocksDlg.cxx
// Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com) // Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com)
// //
#include "MeasureGUI.h"
#include "MeasureGUI_CheckCompoundOfBlocksDlg.h" #include "MeasureGUI_CheckCompoundOfBlocksDlg.h"
#include "MeasureGUI_Widgets.h" #include "MeasureGUI_Widgets.h"
@ -188,7 +189,7 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::SelectionIntoArgument()
myObj = aSelectedObject; myObj = aSelectedObject;
myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) ); myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) );
processObject(); processObject();
displayPreview(true); DISPLAY_PREVIEW_MACRO;
} }
//================================================================================= //=================================================================================
@ -228,7 +229,7 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::ActivateThisDialog()
connect( aSel, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect( aSel, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
activateSelection(); activateSelection();
displayPreview(true); DISPLAY_PREVIEW_MACRO
} }
//================================================================================= //=================================================================================
@ -418,9 +419,11 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::onSubShapesListSelectionChanged()
QList<int>::iterator it; QList<int>::iterator it;
for ( it = aIds.begin(); it != aIds.end(); ++it ) { for ( it = aIds.begin(); it != aIds.end(); ++it ) {
aSubShape = anIndices.FindKey(aObjLst[(*it)]); aSubShape = anIndices.FindKey(aObjLst[(*it)]);
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int w = resMgr->integerValue("Geometry", "measures_line_width", 1);
try { try {
getDisplayer()->SetColor( Quantity_NOC_RED ); getDisplayer()->SetColor( Quantity_NOC_RED );
getDisplayer()->SetWidth( 3 ); getDisplayer()->SetWidth( w );
getDisplayer()->SetToActivate( false ); getDisplayer()->SetToActivate( false );
aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs( aSubShape ) : 0; aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs( aSubShape ) : 0;
if ( aPrs ) if ( aPrs )

View File

@ -328,6 +328,10 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
aVert1, aVert2, P, aDist, TCollection_ExtendedString((Standard_CString)aLabel.toLatin1().constData())); aVert1, aVert2, P, aDist, TCollection_ExtendedString((Standard_CString)aLabel.toLatin1().constData()));
anIO->SetArrowSize(aDist/20); 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_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
if (aPrs) if (aPrs)

View File

@ -21,6 +21,7 @@
// File : MeasureGUI_NormaleDlg.cxx // File : MeasureGUI_NormaleDlg.cxx
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. // Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
// //
#include "MeasureGUI.h"
#include "MeasureGUI_NormaleDlg.h" #include "MeasureGUI_NormaleDlg.h"
#include <DlgRef.h> #include <DlgRef.h>
@ -246,7 +247,7 @@ void MeasureGUI_NormaleDlg::SelectionIntoArgument()
GroupArgs->PushButton1->click(); GroupArgs->PushButton1->click();
} }
displayPreview(true); DISPLAY_PREVIEW_MACRO
} }
//================================================================================= //=================================================================================
@ -286,7 +287,7 @@ void MeasureGUI_NormaleDlg::SetEditCurrentArgument()
send->setDown(true); send->setDown(true);
// seems we need it only to avoid preview disappearing, caused by selection mode change // 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() ), connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
this, SLOT( SelectionIntoArgument() ) ); this, SLOT( SelectionIntoArgument() ) );
displayPreview(true); DISPLAY_PREVIEW_MACRO
} }
//================================================================================= //=================================================================================

View File

@ -497,6 +497,12 @@ void GEOM_Actor::SetWireframeProperty(vtkProperty* Prop)
myWireframeFaceActor->SetProperty(Prop); myWireframeFaceActor->SetProperty(Prop);
} }
vtkProperty* GEOM_Actor::GetWireframeProperty()
{
return myWireframeFaceActor->GetProperty();
}
void GEOM_Actor::SetShadingProperty(vtkProperty* Prop) void GEOM_Actor::SetShadingProperty(vtkProperty* Prop)
{ {
#ifdef MYDEBUG #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) void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper)
{ {
#ifdef MYDEBUG #ifdef MYDEBUG
@ -995,6 +1007,27 @@ void GEOM_Actor::StoreIsoNumbers()
myWireframeFaceSource->GetNbIso(myNbIsos[0], myNbIsos[1]); 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() void GEOM_Actor::RestoreIsoNumbers()
{ {
if ( myNbIsos[0] > 0 || myNbIsos[1] > 0 ) if ( myNbIsos[0] > 0 || myNbIsos[1] > 0 )

View File

@ -86,6 +86,9 @@ public:
void SetWireframeProperty(vtkProperty* Prop); void SetWireframeProperty(vtkProperty* Prop);
void SetShadingProperty(vtkProperty* Prop); void SetShadingProperty(vtkProperty* Prop);
vtkProperty* GetWireframeProperty();
vtkProperty* GetShadingProperty();
void setDeflection(double adef); void setDeflection(double adef);
virtual void setDisplayMode(int thenewmode); virtual void setDisplayMode(int thenewmode);
@ -166,6 +169,15 @@ public:
void void
GetNbIsos(int &theNbU,int &theNbV); 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 //! Vector mode management
virtual virtual
void void

View File

@ -45,5 +45,7 @@
#define MARKER_TYPE_PROP "MarkerType" //Marker type property #define MARKER_TYPE_PROP "MarkerType" //Marker type property
#define FRONT_MATERIAL_PROP "FrontMaterial" //Object front material property #define FRONT_MATERIAL_PROP "FrontMaterial" //Object front material property
#define BACK_MATERIAL_PROP "BackMaterial" //Object back 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 #endif //GEOM_CONSTANTS_H