#include "EntityGUI_Widgets.h"
#include <SalomeApp_DoubleSpinBox.h>
+#include <OCCViewer_ViewPort3d.h>
+#include <OCCViewer_ViewWindow.h>
+
#include <GEOMBase.h>
#include <GeometryGUI.h>
#include <GEOMImpl_Types.hxx>
myGeometryGUI( GUI ),
myLineWidth( lineWidth )
{
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
setModal( modal );
setAttribute( Qt::WA_DeleteOnClose );
topLayout->setMargin( 9 ); topLayout->setSpacing( 6 );
MainWidget->buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) );
- MainWidget->buttonEnd->setText( tr( "GEOM_BUT_END_SKETCH" ) );
+ MainWidget->buttonEnd->setText( tr( "GEOM_BUT_CLOSE" ) );
MainWidget->buttonClose->setText( tr( "GEOM_BUT_CLOSE_SKETCH" ) );
MainWidget->buttonHelp->setText( tr( "GEOM_BUT_HELP" ) );
- QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
- QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_UNDO" ) ) );
- QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_REDO" ) ) );
+ QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_UNDO" ) ) );
+ QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_REDO" ) ) );
+ QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_LINE_2P" ) ) );
+ QPixmap image4( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC" ) ) );
setWindowTitle( tr( "GEOM_SKETCHER_TITLE" ) );
MainWidget->GroupConstructors->setTitle( tr( "GEOM_SKETCHER_EL" ) );
- MainWidget->RadioButton1->setText( tr( "GEOM_SKETCHER_SEGMENT" ) );
- MainWidget->RadioButton2->setText( tr( "GEOM_SKETCHER_ARC" ) );
+ MainWidget->RadioButton1->setText( "" );
+ MainWidget->RadioButton1->setIcon( image3 );
+ MainWidget->RadioButton2->setText( "" );
+ MainWidget->RadioButton2->setIcon( image4 );
MainWidget->GroupDest->setTitle( tr( "GEOM_SKETCHER_DEST" ) );
MainWidget->GroupDest1->setTitle( tr( "GEOM_SKETCHER_TYPE" ) );
MainWidget->RB_Dest1->setText( tr( "GEOM_SKETCHER_POINT" ) );
GroupD2 = new EntityGUI_Dir2( MainWidget->DestCnt );
- GroupD2->GroupDir2->setTitle( tr( "GEOM_SKETCHER_DIR" ) );
+ GroupD2->GroupDir2->setTitle( tr( "GEOM_SKETCHER_DIST" ) );
GroupD2->RB_Dir21->setText( tr( "GEOM_SKETCHER_LENGTH" ) );
GroupD2->RB_Dir22->setText( tr( "GEOM_SKETCHER_X" ) );
GroupD2->RB_Dir23->setText( tr( "GEOM_SKETCHER_Y" ) );
//=================================================================================
bool EntityGUI_SketcherDlg::eventFilter (QObject* object, QEvent* event)
{
- MESSAGE("EntityGUI_SketcherDlg::eventFilter")
if (event->type() == QEvent::KeyPress) {
QKeyEvent* ke = (QKeyEvent*)event;
if ( ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter ) {
Group2Spin->hide();
Group3Spin->hide();
Group4Spin->hide();
+ globalSelection(); // close local selection to clear it
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
myCommand.append( ":WW" );
}
else {
- // PAL16008 (Sketcher Validation should be equal to Apply&Close)
+ /*// PAL16008 (Sketcher Validation should be equal to Apply&Close)
if ( ( Group1Spin->buttonApply->isEnabled() && Group1Spin->isVisible() ) ||
( Group2Spin->buttonApply->isEnabled() && Group2Spin->isVisible() ) ||
( Group3Spin->buttonApply->isEnabled() && Group3Spin->isVisible() ) ||
( Group2Sel->buttonApply->isEnabled() && Group2Sel->isVisible() ) ||
( Group1Sel1Spin->buttonApply->isEnabled() && Group1Sel1Spin->isVisible() ) ) {
ClickOnApply();
- }
+ }*/
myIsAllAdded = true;
}
(Group4Spin->SpinBox_DX)->setFocus();
(Group4Spin->SpinBox_DX)->selectAll();
}
-
+
return true;
}
{
MESSAGE("EntityGUI_SketcherDlg::OnPointSelected")
+ SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow();
+ OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort();
+ QString theImgFileName = vp->backgroundImageFilename();
+
double x, y;
x = y = 0;
- autoApply = ( getPnt2ConstructorId() == 1 && false ); // If no additional argument needed after selection
- // -> apply automatically --> disabled for now
+ BRepBuilderAPI_MakeVertex mkVertex (thePnt);
+ TopoDS_Shape aShape = mkVertex.Shape();
+
+ // Taking into account LocalCS
+ gp_Ax3 aWPlane = GetActiveLocalCS();
+ gp_Trsf aTrans;
+
+ aTrans.SetTransformation(aWPlane);
+ BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False);
+ aShape = aTransformation.Shape();
+
+ gp_Pnt aTrsfPnt;
+ GEOMBase::VertexToPoint( aShape, aTrsfPnt );
+
+ autoApply = ( (getPnt2ConstructorId() == 1) && (!theImgFileName.isEmpty()) ); // If no additional argument needed after selection and there is a backgroundimage
+ // -> apply automatically
if ( getPnt1ConstructorId() == 0 ){ // Relative selection mode
- x = thePnt.X() - myLastX1;
- y = thePnt.Y() - myLastY1;
+ x = aTrsfPnt.X() - myLastX1;
+ y = aTrsfPnt.Y() - myLastY1;
}
else {
- x = thePnt.X();
- y = thePnt.Y();
+ x = aTrsfPnt.X();
+ y = aTrsfPnt.Y();
}
switch (getPnt2ConstructorId()){
case 1:
bool update
)
{
+ // Get globalCS and working plane
+ gp_Ax3 globalCS = myLCSList.first(); //gp_Ax3(aOrigin, aDirZ, aDirX);
+ gp_Ax3 aWPlane = GetActiveLocalCS();
+
+ // Build point in localCS
gp_Pnt aPnt = gp_Pnt(x,y,0.0);
+
+ // Get transfomation from local to global CS
+ gp_Trsf aTrans;
+ aTrans.SetTransformation(aWPlane, globalCS);
+
BRepBuilderAPI_MakeVertex mkVertex (aPnt);
- TopoDS_Shape aVertex = mkVertex.Shape();
+ TopoDS_Shape aLocalVertex = mkVertex.Shape();
- // Disable activation of selection
- getDisplayer()->SetToActivate( false );
+ // Perform transformation
+ BRepBuilderAPI_Transform aTransformation (aLocalVertex, aTrans, Standard_False);
+ TopoDS_Shape aGlobalVertex = aTransformation.Shape();
- // Build prs
- SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aVertex );
+ // Build prs with vertex in globalCS
+ SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aGlobalVertex );
if ( aPrs != 0 && !aPrs->IsNull() )
GEOMBase_Helper::displayPreview( aPrs, append, update );
- // Enable back activation of selection
- getDisplayer()->SetToActivate( true );
}
//================================================================