#include "BasicGUI_MarkerDlg.h"
#include "DlgRef_SpinBox.h"
-#include "QAD_Desktop.h"
-#include "QAD_RightFrame.h"
-#include "VTKViewer_ViewFrame.h"
-#include "OCCViewer_ViewFrame.h"
-#include "QAD_Config.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
+#include "SalomeApp_Application.h"
+#include "SalomeApp_SelectionMgr.h"
+
+#include <qlabel.h>
+
#include "GEOMImpl_Types.hxx"
#include "utilities.h"
// class : BasicGUI_MarkerDlg()
// purpose : Constructor
//=================================================================================
-BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( QWidget* theParent, SALOME_Selection* theSel )
-: GEOMBase_Skeleton( theParent, "BasicGUI_MarkerDlg", theSel, false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* theParent )
+: GEOMBase_Skeleton( theParent, "BasicGUI_MarkerDlg", false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI)
{
- QPixmap iconCS1 ( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_MARKER" ) ) );
- QPixmap iconCS2 ( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_MARKER2" ) ) );
- QPixmap iconCS3 ( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_MARKER3" ) ) );
- QPixmap iconSelect( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap iconCS1 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER" ) ) );
+ QPixmap iconCS2 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER2" ) ) );
+ QPixmap iconCS3 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER3" ) ) );
+ QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption( tr( "CAPTION" ) );
Layout1->addWidget( Group1, 2, 0 );
Layout1->addWidget( Group2, 2, 0 );
- Init( theSel );
+ Init();
}
// function : Init()
// purpose :
//=================================================================================
-void BasicGUI_MarkerDlg::Init( SALOME_Selection* theSel )
+void BasicGUI_MarkerDlg::Init()
{
myBlockPreview = false;
myConstructorId = -1;
Group2->LineEdit1->setReadOnly( true );
Group2->LineEdit2->setReadOnly( true );
Group2->LineEdit3->setReadOnly( true );
-
- GeometryGUI* aGeomGUI = GeometryGUI::GetGeomGUI();
-
+
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( onClose() ) );
- connect( aGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( onDeactivate() ) );
- connect( aGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onClose() ) );
+ connect( myGeometryGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( onDeactivate() ) );
+ connect( myGeometryGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onClose() ) );
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( onOk() ) );
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onApply() ) );
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
+ connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
initName( tr( "LCS_NAME" ) );
- QString aStr = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" );
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
+
for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter )
{
- anIter.data()->RangeStepAndValidator( -999.999, 999.999, aStr.toDouble(), 3 );
+ anIter.data()->RangeStepAndValidator( -999.999, 999.999, step, 3 );
connect( anIter.data(), SIGNAL( valueChanged( double ) ),
this, SLOT( onValueChanged( double ) ) );
}
ConstructorsClicked( 0 );
+
+ //@
+ /*
QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()->
getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
OCCViewer_ViewFrame* aOCCFrame = dynamic_cast<OCCViewer_ViewFrame*>( aFrame );
if ( aOCCFrame )
aOCCFrame->AdjustTrihedrons( true );
+ */
}
//=================================================================================
myConstructorId = constructorId;
- disconnect(mySelection, 0, this, 0);
+ disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
switch (constructorId)
{
}
}
- connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionDone()));
+ connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionDone()));
onSelectionDone();
}
//=================================================================================
void BasicGUI_MarkerDlg::onSelectionDone0()
{
- if ( mySelection->IObjectCount() == 1 )
+ if ( IObjectCount() == 1 )
{
Standard_Boolean aRes = Standard_False;
- Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
+ Handle(SALOME_InteractiveObject) anIO = firstIObject();
GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( aRes && !aSelectedObj->_is_nil() )
myData[ DX2 ]->SetValue( aYDir.X() );
myData[ DY2 ]->SetValue( aYDir.Y() );
myData[ DZ2 ]->SetValue( aYDir.Z() );
- //mySelection->ClearIObjects();
+ ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->clearSelected();
}
}
else
{
- if ( mySelection->HasIndex( anIO ) )
+ TColStd_IndexedMapOfInteger aMap;
+ ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap );
+ if ( aMap.Extent() == 1 )
{
- TColStd_IndexedMapOfInteger aMap;
- mySelection->GetIndex( anIO, aMap );
- if ( aMap.Extent() == 1 )
- {
- int anIndex = aMap( 1 );
- TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes( aShape, aShapes );
- aShape = aShapes.FindKey( anIndex );
- //mySelection->ClearIObjects();
- }
- }
+ int anIndex = aMap( 1 );
+ TopTools_IndexedMapOfShape aShapes;
+ TopExp::MapShapes( aShape, aShapes );
+ aShape = aShapes.FindKey( anIndex );
+ ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->clearSelected();
+ }
+
if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
{
myEditCurrentArgument->setText("");
QString aName;
- if ( mySelection->IObjectCount() == 1 ) {
+ if ( IObjectCount() == 1 ) {
Standard_Boolean aRes = Standard_False;
- Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
+ Handle(SALOME_InteractiveObject) anIO = firstIObject();
GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( !CORBA::is_nil( aSelectedObj ) && aRes ) {
TopoDS_Shape aShape;
if ( myGeomBase->GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) {
GEOM::short_array anIndexes;
- if ( mySelection->HasIndex( anIO ) ) {
- TColStd_IndexedMapOfInteger aMap;
- mySelection->GetIndex( anIO, aMap );
+
+ TColStd_IndexedMapOfInteger aMap;
+ ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap );
+
+ if ( !aMap.IsEmpty() ) {
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
}
- if ( getConstructorId() == 1 ) {
+ if ( getConstructorId() == 1 ) {
if ( !aShape.IsNull() ) {
gp_Pnt aPnt;
if (aShape.ShapeType() == TopAbs_VERTEX) {
aPnt = aSystem.CentreOfMass();
}
-
+
gp_Ax3 anAx3;
anAx3.Transform(aShape.Location().Transformation());
if(aShape.ShapeType() == TopAbs_FACE) {
anAx3 = aPln.Position();
}
}
-
+
gp_Dir aDirX = anAx3.XDirection();
gp_Dir aDirY = anAx3.YDirection();
-
+
myData[ X ]->SetValue( aPnt.X() );
myData[ Y ]->SetValue( aPnt.Y() );
myData[ Z ]->SetValue( aPnt.Z() );
-
+
myData[ DX1 ]->SetValue( aDirX.X() );
myData[ DY1 ]->SetValue( aDirX.Y() );
myData[ DZ1 ]->SetValue( aDirX.Z() );
-
+
myData[ DX2 ]->SetValue( aDirY.X() );
myData[ DY2 ]->SetValue( aDirY.Y() );
myData[ DZ2 ]->SetValue( aDirY.Z() );
-
+
myEditCurrentArgument->setText( aName );
}
else {
myData[ X ]->SetValue( 0 );
myData[ Y ]->SetValue( 0 );
myData[ Z ]->SetValue( 0 );
-
+
myData[ DX1 ]->SetValue( 0 );
myData[ DY1 ]->SetValue( 0 );
myData[ DZ1 ]->SetValue( 0 );
-
+
myData[ DX2 ]->SetValue( 0 );
myData[ DY2 ]->SetValue( 0 );
myData[ DZ2 ]->SetValue( 0 );
gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape)));
gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape)));
gp_Dir aDir(gp_Vec(aP1, aP2));
-
+
myData[ DX1 ]->SetValue( aDir.X() );
myData[ DY1 ]->SetValue( aDir.Y() );
myData[ DZ1 ]->SetValue( aDir.Z() );
gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape)));
gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape)));
gp_Dir aDir(gp_Vec(aP1, aP2));
-
+
myData[ DX2 ]->SetValue( aDir.X() );
myData[ DY2 ]->SetValue( aDir.Y() );
myData[ DZ2 ]->SetValue( aDir.Z() );
myData[ X ]->SetValue( 0 );
myData[ Y ]->SetValue( 0 );
myData[ Z ]->SetValue( 0 );
-
+
myData[ DX1 ]->SetValue( 0 );
myData[ DY1 ]->SetValue( 0 );
myData[ DZ1 ]->SetValue( 0 );
-
+
myData[ DX2 ]->SetValue( 0 );
myData[ DY2 ]->SetValue( 0 );
myData[ DZ2 ]->SetValue( 0 );
}
}
}
-
+
displayPreview();
}
void BasicGUI_MarkerDlg::onActivate()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
+ connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
ConstructorsClicked( getConstructorId() );
}
//=================================================================================
GEOM::GEOM_IOperations_ptr BasicGUI_MarkerDlg::createOperation()
{
- return getGeomEngine()->GetIBasicOperations( getStudyId() );
+ return myGeometryGUI->GetGeomGen()->GetIBasicOperations( getStudyId() );
}
//=================================================================================