mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-18 23:50:36 +05:00
Mantis issue 0020626: the discretisation of the circles in the OCC viewer is too rough.
This commit is contained in:
parent
ec1c5fd3a4
commit
207dcdd566
@ -42,6 +42,7 @@
|
|||||||
<parameter name="point_color" value="255, 255, 0" />
|
<parameter name="point_color" value="255, 255, 0" />
|
||||||
<parameter name="isos_color" value="200, 200, 200" />
|
<parameter name="isos_color" value="200, 200, 200" />
|
||||||
<parameter name="type_of_marker" value="1" />
|
<parameter name="type_of_marker" value="1" />
|
||||||
|
<parameter name="deflection_coeff" value="0.001" />
|
||||||
<parameter name="marker_scale" value="1" />
|
<parameter name="marker_scale" value="1" />
|
||||||
</section>
|
</section>
|
||||||
</document>
|
</document>
|
||||||
|
@ -632,7 +632,11 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
|
|||||||
|
|
||||||
// bug [SALOME platform 0019868]
|
// bug [SALOME platform 0019868]
|
||||||
// Set deviation angle. Default one is 12 degrees (Prs3d_Drawer.cxx:18)
|
// Set deviation angle. Default one is 12 degrees (Prs3d_Drawer.cxx:18)
|
||||||
AISShape->SetOwnDeviationAngle( 10*PI/180 );
|
//AISShape->SetOwnDeviationAngle( 10*PI/180 );
|
||||||
|
|
||||||
|
// IMP 0020626
|
||||||
|
double aDC = aResMgr->doubleValue("Geometry", "deflection_coeff", 0.001);
|
||||||
|
AISShape->SetOwnDeviationCoefficient(aDC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2379,6 +2379,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>MEN_POP_ISOS</source>
|
<source>MEN_POP_ISOS</source>
|
||||||
<translation>Isos</translation>
|
<translation>Isos</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>MEN_POP_DEFLECTION</source>
|
||||||
|
<translation>Deflection Coefficient</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>MEN_POP_RENAME</source>
|
<source>MEN_POP_RENAME</source>
|
||||||
<translation>Rename</translation>
|
<translation>Rename</translation>
|
||||||
@ -2575,6 +2579,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>NON_GEOM_OBJECTS_SELECTED</source>
|
<source>NON_GEOM_OBJECTS_SELECTED</source>
|
||||||
<translation>There are objects selected which do not belong to %1 component.</translation>
|
<translation>There are objects selected which do not belong to %1 component.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>PREF_DEFLECTION</source>
|
||||||
|
<translation>Deflection coefficient</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>PREF_DISPLAY_MODE</source>
|
<source>PREF_DISPLAY_MODE</source>
|
||||||
<translation>Default display mode</translation>
|
<translation>Default display mode</translation>
|
||||||
@ -2931,6 +2939,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>STB_POP_ISOS</source>
|
<source>STB_POP_ISOS</source>
|
||||||
<translation>Isolines</translation>
|
<translation>Isolines</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>STB_POP_DEFLECTION</source>
|
||||||
|
<translation>Deflection Coefficient</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>STB_POP_RENAME</source>
|
<source>STB_POP_RENAME</source>
|
||||||
<translation>Rename</translation>
|
<translation>Rename</translation>
|
||||||
@ -3415,6 +3427,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>TOP_POP_ISOS</source>
|
<source>TOP_POP_ISOS</source>
|
||||||
<translation>Isolines</translation>
|
<translation>Isolines</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TOP_POP_DEFLECTION</source>
|
||||||
|
<translation>Deflection Coefficient</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>TOP_POP_RENAME</source>
|
<source>TOP_POP_RENAME</source>
|
||||||
<translation>Rename</translation>
|
<translation>Rename</translation>
|
||||||
@ -4293,6 +4309,17 @@ Would you like to continue?</translation>
|
|||||||
<translation>Delete objects</translation>
|
<translation>Delete objects</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>GEOMToolsGUI_DeflectionDlg</name>
|
||||||
|
<message>
|
||||||
|
<source>GEOM_DEFLECTION_TLT</source>
|
||||||
|
<translation>Select Deflection of Shape</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>GEOM_DEFLECTION</source>
|
||||||
|
<translation>Deflection :</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>GEOMToolsGUI_MarkerDlg</name>
|
<name>GEOMToolsGUI_MarkerDlg</name>
|
||||||
<message>
|
<message>
|
||||||
|
@ -375,6 +375,7 @@ void GeometryGUI::OnGUIEvent( int id )
|
|||||||
id == 411 || // MENU SETTINGS - ADD IN STUDY
|
id == 411 || // MENU SETTINGS - ADD IN STUDY
|
||||||
id == 412 || // MENU SETTINGS - SHADING COLOR
|
id == 412 || // MENU SETTINGS - SHADING COLOR
|
||||||
id == 5103 || // MENU TOOLS - CHECK GEOMETRY
|
id == 5103 || // MENU TOOLS - CHECK GEOMETRY
|
||||||
|
id == 8031 || // POPUP VIEWER - DEFLECTION COEFFICIENT
|
||||||
id == 8032 || // POPUP VIEWER - COLOR
|
id == 8032 || // POPUP VIEWER - COLOR
|
||||||
id == 8033 || // POPUP VIEWER - TRANSPARENCY
|
id == 8033 || // POPUP VIEWER - TRANSPARENCY
|
||||||
id == 8034 || // POPUP VIEWER - ISOS
|
id == 8034 || // POPUP VIEWER - ISOS
|
||||||
@ -897,6 +898,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
createGeomAction( 80311, "POP_WIREFRAME", "", 0, true );
|
createGeomAction( 80311, "POP_WIREFRAME", "", 0, true );
|
||||||
createGeomAction( 80312, "POP_SHADING", "", 0, true );
|
createGeomAction( 80312, "POP_SHADING", "", 0, true );
|
||||||
createGeomAction( 80313, "POP_VECTORS", "", 0, true );
|
createGeomAction( 80313, "POP_VECTORS", "", 0, true );
|
||||||
|
createGeomAction( 8031, "POP_DEFLECTION" );
|
||||||
createGeomAction( 8032, "POP_COLOR" );
|
createGeomAction( 8032, "POP_COLOR" );
|
||||||
createGeomAction( 8033, "POP_TRANSPARENCY" );
|
createGeomAction( 8033, "POP_TRANSPARENCY" );
|
||||||
createGeomAction( 8034, "POP_ISOS" );
|
createGeomAction( 8034, "POP_ISOS" );
|
||||||
@ -1173,6 +1175,8 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
mgr->setRule( action( 8033 ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
|
mgr->setRule( action( 8033 ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
|
||||||
mgr->insert( action( 8034 ), -1, -1 ); // isos
|
mgr->insert( action( 8034 ), -1, -1 ); // isos
|
||||||
mgr->setRule( action( 8034 ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
|
mgr->setRule( action( 8034 ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
|
||||||
|
mgr->insert( action( 8031 ), -1, -1 ); // deflection
|
||||||
|
mgr->setRule( action( 8031 ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
|
||||||
mgr->insert( action( 8039 ), -1, -1 ); // point marker
|
mgr->insert( action( 8039 ), -1, -1 ); // point marker
|
||||||
mgr->setRule( action( 8039 ), QString( "selcount>0 and $typeid in {%1}" ).arg( GEOM_POINT ), QtxPopupMgr::VisibleRule );
|
mgr->setRule( action( 8039 ), QString( "selcount>0 and $typeid in {%1}" ).arg( GEOM_POINT ), QtxPopupMgr::VisibleRule );
|
||||||
mgr->insert( separator(), -1, -1 ); // -----------
|
mgr->insert( separator(), -1, -1 ); // -----------
|
||||||
@ -1566,6 +1570,9 @@ void GeometryGUI::createPreferences()
|
|||||||
int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup,
|
int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup,
|
||||||
LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" );
|
LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" );
|
||||||
|
|
||||||
|
int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup,
|
||||||
|
LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
|
||||||
|
|
||||||
int VertexGroup = addPreference( tr( "PREF_GROUP_VERTEX" ), tabId );
|
int VertexGroup = addPreference( tr( "PREF_GROUP_VERTEX" ), tabId );
|
||||||
setPreferenceProperty( VertexGroup, "columns", 2 );
|
setPreferenceProperty( VertexGroup, "columns", 2 );
|
||||||
|
|
||||||
@ -1592,6 +1599,11 @@ void GeometryGUI::createPreferences()
|
|||||||
setPreferenceProperty( step, "max", 10000 );
|
setPreferenceProperty( step, "max", 10000 );
|
||||||
setPreferenceProperty( step, "precision", 3 );
|
setPreferenceProperty( step, "precision", 3 );
|
||||||
|
|
||||||
|
// Set property for deflection value for spinboxes
|
||||||
|
setPreferenceProperty( defl, "min", 1.0e-07 );
|
||||||
|
setPreferenceProperty( defl, "max", 10000.0 );
|
||||||
|
setPreferenceProperty( defl, "step", 0.0001 );
|
||||||
|
|
||||||
// Set property vertex marker type
|
// Set property vertex marker type
|
||||||
QList<QVariant> aMarkerTypeIndicesList;
|
QList<QVariant> aMarkerTypeIndicesList;
|
||||||
QList<QVariant> aMarkerTypeIconsList;
|
QList<QVariant> aMarkerTypeIconsList;
|
||||||
|
@ -376,6 +376,11 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
|
|||||||
OnCheckGeometry();
|
OnCheckGeometry();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 8031: // DEFLECTION ANGLE - POPUP VIEWER
|
||||||
|
{
|
||||||
|
OnDeflection();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 8032: // COLOR - POPUP VIEWER
|
case 8032: // COLOR - POPUP VIEWER
|
||||||
{
|
{
|
||||||
OnColor();
|
OnColor();
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
// GEOM GEOMGUI : GUI for Geometry component
|
// GEOM GEOMGUI : GUI for Geometry component
|
||||||
// File : GEOMToolsGUI.h
|
// File : GEOMToolsGUI.h
|
||||||
// Author : Damien COQUERET, Open CASCADE S.A.S.
|
// Author : Damien COQUERET, Open CASCADE S.A.S.
|
||||||
//
|
|
||||||
#ifndef GEOMTOOLSGUI_H
|
#ifndef GEOMTOOLSGUI_H
|
||||||
#define GEOMTOOLSGUI_H
|
#define GEOMTOOLSGUI_H
|
||||||
|
|
||||||
@ -69,6 +69,7 @@ private:
|
|||||||
void OnColor();
|
void OnColor();
|
||||||
void OnTransparency();
|
void OnTransparency();
|
||||||
void OnNbIsos();
|
void OnNbIsos();
|
||||||
|
void OnDeflection();
|
||||||
void OnOpen();
|
void OnOpen();
|
||||||
void OnSelectOnly(int mode);
|
void OnSelectOnly(int mode);
|
||||||
void OnShowHideChildren( bool );
|
void OnShowHideChildren( bool );
|
||||||
|
@ -19,15 +19,16 @@
|
|||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
// GEOM GEOMGUI : GUI for Geometry component
|
// GEOM GEOMGUI : GUI for Geometry component
|
||||||
// File : GEOMToolsGUI_1.cxx
|
// File : GEOMToolsGUI_1.cxx
|
||||||
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
|
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
|
||||||
//
|
|
||||||
#include <PyConsole_Console.h>
|
#include <PyConsole_Console.h>
|
||||||
|
|
||||||
#include "GEOMToolsGUI.h"
|
#include "GEOMToolsGUI.h"
|
||||||
#include "GEOMToolsGUI_TransparencyDlg.h"
|
#include "GEOMToolsGUI_TransparencyDlg.h"
|
||||||
#include "GEOMToolsGUI_NbIsosDlg.h"
|
#include "GEOMToolsGUI_NbIsosDlg.h"
|
||||||
|
#include "GEOMToolsGUI_DeflectionDlg.h"
|
||||||
#include "GEOMToolsGUI_MarkerDlg.h"
|
#include "GEOMToolsGUI_MarkerDlg.h"
|
||||||
|
|
||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
@ -54,6 +55,7 @@
|
|||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
#include <SUIT_OverrideCursor.h>
|
#include <SUIT_OverrideCursor.h>
|
||||||
#include <SUIT_MessageBox.h>
|
#include <SUIT_MessageBox.h>
|
||||||
|
#include <SUIT_Tools.h>
|
||||||
|
|
||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
#include <SalomeApp_Study.h>
|
#include <SalomeApp_Study.h>
|
||||||
@ -75,8 +77,15 @@
|
|||||||
|
|
||||||
// QT Includes
|
// QT Includes
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
|
#include <QInputDialog>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include <vtkRenderer.h>
|
#include <vtkRenderer.h>
|
||||||
|
|
||||||
@ -341,7 +350,9 @@ void GEOMToolsGUI::OnColor()
|
|||||||
if ( !io.IsNull() ) {
|
if ( !io.IsNull() ) {
|
||||||
Quantity_Color aColor;
|
Quantity_Color aColor;
|
||||||
io->Color( aColor );
|
io->Color( aColor );
|
||||||
QColor initcolor( (int)( aColor.Red() * 255.0 ), (int)( aColor.Green() * 255.0 ), (int)( aColor.Blue() * 255.0 ) );
|
QColor initcolor ((int)( aColor.Red() * 255.0 ),
|
||||||
|
(int)( aColor.Green() * 255.0 ),
|
||||||
|
(int)( aColor.Blue() * 255.0 ));
|
||||||
QColor c = QColorDialog::getColor( initcolor, app->desktop() );
|
QColor c = QColorDialog::getColor( initcolor, app->desktop() );
|
||||||
if ( c.isValid() ) {
|
if ( c.isValid() ) {
|
||||||
SUIT_OverrideCursor();
|
SUIT_OverrideCursor();
|
||||||
@ -350,7 +361,8 @@ void GEOMToolsGUI::OnColor()
|
|||||||
io = GEOMBase::GetAIS( It.Value(), true );
|
io = GEOMBase::GetAIS( It.Value(), true );
|
||||||
if ( !io.IsNull() ) {
|
if ( !io.IsNull() ) {
|
||||||
// Set color for a point
|
// Set color for a point
|
||||||
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
|
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>
|
||||||
|
( window->getViewManager()->getViewModel() );
|
||||||
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
|
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
|
||||||
Handle(AIS_Drawer) aCurDrawer = io->Attributes();
|
Handle(AIS_Drawer) aCurDrawer = io->Attributes();
|
||||||
Handle(Prs3d_PointAspect) aCurPointAspect = aCurDrawer->PointAspect();
|
Handle(Prs3d_PointAspect) aCurPointAspect = aCurDrawer->PointAspect();
|
||||||
@ -359,13 +371,13 @@ void GEOMToolsGUI::OnColor()
|
|||||||
Aspect_TypeOfMarker aCurTypeOfMarker;
|
Aspect_TypeOfMarker aCurTypeOfMarker;
|
||||||
aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale );
|
aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale );
|
||||||
if ( aCurTypeOfMarker != Aspect_TOM_USERDEFINED ) {
|
if ( aCurTypeOfMarker != Aspect_TOM_USERDEFINED ) {
|
||||||
aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aCurTypeOfMarker, aColor, aCurScale) );
|
aCurDrawer->SetPointAspect(new Prs3d_PointAspect(aCurTypeOfMarker, aColor, aCurScale));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Standard_Integer aWidth, aHeight;
|
Standard_Integer aWidth, aHeight;
|
||||||
aCurPointAspect->GetTextureSize( aWidth, aHeight );
|
aCurPointAspect->GetTextureSize( aWidth, aHeight );
|
||||||
Handle(Graphic3d_HArray1OfBytes) aTexture = aCurPointAspect->GetTexture();
|
Handle(Graphic3d_HArray1OfBytes) aTexture = aCurPointAspect->GetTexture();
|
||||||
aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aColor, 1, aWidth, aHeight, aTexture ) );
|
aCurDrawer->SetPointAspect(new Prs3d_PointAspect(aColor, 1, aWidth, aHeight, aTexture));
|
||||||
}
|
}
|
||||||
ic->SetLocalAttributes(io, aCurDrawer);
|
ic->SetLocalAttributes(io, aCurDrawer);
|
||||||
|
|
||||||
@ -453,7 +465,8 @@ void GEOMToolsGUI::OnNbIsos()
|
|||||||
//
|
//
|
||||||
// Warning. It's works incorrect. must be recheked.
|
// Warning. It's works incorrect. must be recheked.
|
||||||
//
|
//
|
||||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >
|
||||||
|
( SUIT_Session::session()->activeApplication() );
|
||||||
if ( !app )
|
if ( !app )
|
||||||
return;
|
return;
|
||||||
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
|
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
|
||||||
@ -521,6 +534,106 @@ void GEOMToolsGUI::OnNbIsos()
|
|||||||
} // end vtkviewer
|
} // end vtkviewer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GEOMToolsGUI::OnDeflection()
|
||||||
|
{
|
||||||
|
SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->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());
|
||||||
|
|
||||||
|
Standard_Real aDC, aPrevDC;
|
||||||
|
Standard_Boolean isOwnDC = CurObject->OwnDeviationCoefficient(aDC, aPrevDC);
|
||||||
|
if (!isOwnDC)
|
||||||
|
aDC = ic->DeviationCoefficient();
|
||||||
|
|
||||||
|
GEOMToolsGUI_DeflectionDlg * DeflectionDlg = new GEOMToolsGUI_DeflectionDlg
|
||||||
|
(SUIT_Session::session()->activeApplication()->desktop());
|
||||||
|
DeflectionDlg->setDC(aDC);
|
||||||
|
if (DeflectionDlg->exec()) {
|
||||||
|
SUIT_OverrideCursor();
|
||||||
|
double aNewDC = DeflectionDlg->getDC();
|
||||||
|
for (; ic->MoreCurrent(); ic->NextCurrent()) {
|
||||||
|
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
|
||||||
|
ic->SetDeviationCoefficient(CurObject, aNewDC, Standard_True);
|
||||||
|
ic->Redisplay(CurObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
|
||||||
|
double aDC = 0.;
|
||||||
|
|
||||||
|
vtkActor* anAct = aCollection->GetNextActor();
|
||||||
|
if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct))
|
||||||
|
aDC = anActor->GetDeflection();
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
GEOMToolsGUI_DeflectionDlg* DeflectionDlg = new GEOMToolsGUI_DeflectionDlg
|
||||||
|
(SUIT_Session::session()->activeApplication()->desktop());
|
||||||
|
DeflectionDlg->setDC(aDC);
|
||||||
|
if (DeflectionDlg->exec()) {
|
||||||
|
SUIT_OverrideCursor();
|
||||||
|
aDC = DeflectionDlg->getDC();
|
||||||
|
while (anAct != NULL) {
|
||||||
|
if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
|
||||||
|
// There are no casting to needed actor.
|
||||||
|
bool isRel = anActor->GetIsRelative();
|
||||||
|
anActor->SetDeflection(aDC, isRel);
|
||||||
|
}
|
||||||
|
anAct = aCollection->GetNextActor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // end vtkviewer
|
||||||
|
}
|
||||||
|
|
||||||
void GEOMToolsGUI::OnOpen()
|
void GEOMToolsGUI::OnOpen()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
184
src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.cxx
Normal file
184
src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.cxx
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
|
//
|
||||||
|
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||||
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
|
//
|
||||||
|
// 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.cxx
|
||||||
|
// Author : OCC Team
|
||||||
|
|
||||||
|
#include "GEOMToolsGUI_DeflectionDlg.h"
|
||||||
|
#include <GeometryGUI.h>
|
||||||
|
#include <LightApp_Application.h>
|
||||||
|
#include <SalomeApp_DoubleSpinBox.h>
|
||||||
|
|
||||||
|
#include <SUIT_MessageBox.h>
|
||||||
|
#include <SUIT_ResourceMgr.h>
|
||||||
|
#include <SUIT_Session.h>
|
||||||
|
#include <SUIT_Tools.h>
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// class : GEOMToolsGUI_DeflectionDlg()
|
||||||
|
// purpose : Constructs a GEOMToolsGUI_DeflectionDlg 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_DeflectionDlg::GEOMToolsGUI_DeflectionDlg (QWidget* parent)
|
||||||
|
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
|
||||||
|
{
|
||||||
|
setObjectName("GEOMToolsGUI_DeflectionDlg");
|
||||||
|
setModal(true);
|
||||||
|
|
||||||
|
setWindowTitle(tr("GEOM_DEFLECTION_TLT"));
|
||||||
|
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_DEFLECTION"));
|
||||||
|
GroupC1Layout->addWidget(TextLabel1, 0, 0);
|
||||||
|
|
||||||
|
SpinBox = new SalomeApp_DoubleSpinBox (GroupC1);
|
||||||
|
SpinBox->setObjectName("SpinBoxU");
|
||||||
|
SpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
|
||||||
|
SpinBox->setMinimum(0);
|
||||||
|
SpinBox->setValue(1);
|
||||||
|
GroupC1Layout->addWidget(SpinBox, 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 = "deflection_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_DeflectionDlg()
|
||||||
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
|
//=================================================================================
|
||||||
|
GEOMToolsGUI_DeflectionDlg::~GEOMToolsGUI_DeflectionDlg()
|
||||||
|
{
|
||||||
|
// no need to delete child widgets, Qt does it all for us
|
||||||
|
}
|
||||||
|
|
||||||
|
double GEOMToolsGUI_DeflectionDlg::getDC() const
|
||||||
|
{
|
||||||
|
return SpinBox->text().toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GEOMToolsGUI_DeflectionDlg::setDC (const double v)
|
||||||
|
{
|
||||||
|
SpinBox->setValue(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ClickOnHelp()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void GEOMToolsGUI_DeflectionDlg::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_DeflectionDlg::keyPressEvent (QKeyEvent* e)
|
||||||
|
{
|
||||||
|
QDialog::keyPressEvent(e);
|
||||||
|
if (e->isAccepted())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (e->key() == Qt::Key_F1) {
|
||||||
|
e->accept();
|
||||||
|
ClickOnHelp();
|
||||||
|
}
|
||||||
|
}
|
61
src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.h
Normal file
61
src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.h
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
|
//
|
||||||
|
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||||
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
|
//
|
||||||
|
// 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_DEFLECTIONDLG_H
|
||||||
|
#define GEOMTOOLSGUI_DEFLECTIONDLG_H
|
||||||
|
|
||||||
|
#include "GEOM_ToolsGUI.hxx"
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
class SalomeApp_DoubleSpinBox;
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// class : GEOMToolsGUI_DeflectionDlg
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_DeflectionDlg : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
GEOMToolsGUI_DeflectionDlg( QWidget* );
|
||||||
|
~GEOMToolsGUI_DeflectionDlg();
|
||||||
|
|
||||||
|
double getDC() const;
|
||||||
|
void setDC( const double );
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void ClickOnHelp();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void keyPressEvent( QKeyEvent* );
|
||||||
|
|
||||||
|
private:
|
||||||
|
SalomeApp_DoubleSpinBox* SpinBox;
|
||||||
|
QString myHelpFileName;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GEOMTOOLSGUI_DEFLECTIONDLG_H
|
@ -33,6 +33,7 @@ salomeinclude_HEADERS = \
|
|||||||
GEOMToolsGUI.h \
|
GEOMToolsGUI.h \
|
||||||
GEOM_ToolsGUI.hxx \
|
GEOM_ToolsGUI.hxx \
|
||||||
GEOMToolsGUI_NbIsosDlg.h \
|
GEOMToolsGUI_NbIsosDlg.h \
|
||||||
|
GEOMToolsGUI_DeflectionDlg.h \
|
||||||
GEOMToolsGUI_TransparencyDlg.h \
|
GEOMToolsGUI_TransparencyDlg.h \
|
||||||
GEOMToolsGUI_DeleteDlg.h \
|
GEOMToolsGUI_DeleteDlg.h \
|
||||||
GEOMToolsGUI_MarkerDlg.h
|
GEOMToolsGUI_MarkerDlg.h
|
||||||
@ -42,12 +43,14 @@ dist_libGEOMToolsGUI_la_SOURCES = \
|
|||||||
GEOMToolsGUI_1.cxx \
|
GEOMToolsGUI_1.cxx \
|
||||||
GEOMToolsGUI_TransparencyDlg.cxx \
|
GEOMToolsGUI_TransparencyDlg.cxx \
|
||||||
GEOMToolsGUI_NbIsosDlg.cxx \
|
GEOMToolsGUI_NbIsosDlg.cxx \
|
||||||
|
GEOMToolsGUI_DeflectionDlg.cxx \
|
||||||
GEOMToolsGUI_DeleteDlg.cxx \
|
GEOMToolsGUI_DeleteDlg.cxx \
|
||||||
GEOMToolsGUI_MarkerDlg.cxx
|
GEOMToolsGUI_MarkerDlg.cxx
|
||||||
|
|
||||||
MOC_FILES = \
|
MOC_FILES = \
|
||||||
GEOMToolsGUI_TransparencyDlg_moc.cxx \
|
GEOMToolsGUI_TransparencyDlg_moc.cxx \
|
||||||
GEOMToolsGUI_NbIsosDlg_moc.cxx \
|
GEOMToolsGUI_NbIsosDlg_moc.cxx \
|
||||||
|
GEOMToolsGUI_DeflectionDlg_moc.cxx \
|
||||||
GEOMToolsGUI_DeleteDlg_moc.cxx \
|
GEOMToolsGUI_DeleteDlg_moc.cxx \
|
||||||
GEOMToolsGUI_MarkerDlg_moc.cxx
|
GEOMToolsGUI_MarkerDlg_moc.cxx
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user