mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-22 14:40:34 +05:00
rnc:
- Allowed arc and segment creation by selection in the 3D view for the relative selection mode too. - Added a preview of the center point and the end point when creating an arc by center and end point
This commit is contained in:
parent
b9c49001d1
commit
7dedbec49c
@ -51,6 +51,7 @@
|
||||
#include <TopoDS.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
#include <Sketcher_Profile.hxx>
|
||||
|
||||
#include <SalomeApp_Study.h>
|
||||
@ -1173,10 +1174,6 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument()
|
||||
|
||||
int nbSel = aSelList.Extent();
|
||||
MESSAGE("NbSel = "<<nbSel)
|
||||
if (nbSel == 0){
|
||||
myX=tmpX;
|
||||
myY=tmpY;
|
||||
}
|
||||
if (nbSel == 1 && myEditCurrentArgument == Group1Sel->LineEdit1) {
|
||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
|
||||
if ( !CORBA::is_nil(aSelectedObject) ) {
|
||||
@ -1352,7 +1349,13 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nbSel == 0){
|
||||
myX=tmpX;
|
||||
myY=tmpY;
|
||||
}
|
||||
else{
|
||||
GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1506,23 +1509,34 @@ void EntityGUI_SketcherDlg::closeEvent( QCloseEvent* e )
|
||||
void EntityGUI_SketcherDlg::OnPointSelected(Qt::KeyboardModifiers modifiers, const gp_Pnt& thePnt)
|
||||
{
|
||||
MESSAGE("EntityGUI_SketcherDlg::OnPointSelected")
|
||||
|
||||
double x, y;
|
||||
x = y = 0;
|
||||
if ( getPnt1ConstructorId() == 0 ){ // Relative selection mode
|
||||
x = thePnt.X() - myLastX1;
|
||||
y = thePnt.Y() - myLastY1;
|
||||
}
|
||||
else {
|
||||
x = thePnt.X();
|
||||
y = thePnt.Y();
|
||||
}
|
||||
switch (getPnt2ConstructorId()){
|
||||
case 1:
|
||||
Group2Spin->SpinBox_DX->setValue( thePnt.X() );
|
||||
Group2Spin->SpinBox_DY->setValue( thePnt.Y() );
|
||||
Group2Spin->SpinBox_DX->setValue( x );
|
||||
Group2Spin->SpinBox_DY->setValue( y );
|
||||
break;
|
||||
case 0:
|
||||
Group3Spin->SpinBox_DX->setValue( thePnt.X() );
|
||||
Group3Spin->SpinBox_DY->setValue( thePnt.Y() );
|
||||
Group3Spin->SpinBox_DX->setValue( x );
|
||||
Group3Spin->SpinBox_DY->setValue( y );
|
||||
break;
|
||||
case 2:
|
||||
if (modifiers == Qt::MetaModifier){ // Select center with Meta key
|
||||
Group4Spin->SpinBox_DX->setValue( thePnt.X() );
|
||||
Group4Spin->SpinBox_DY->setValue( thePnt.Y() );
|
||||
Group4Spin->SpinBox_DX->setValue( x );
|
||||
Group4Spin->SpinBox_DY->setValue( y );
|
||||
}
|
||||
else{ // The select end point
|
||||
Group4Spin->SpinBox_DZ->setValue( thePnt.X() );
|
||||
Group4Spin->SpinBox_DS->setValue( thePnt.Y() );
|
||||
Group4Spin->SpinBox_DZ->setValue( x );
|
||||
Group4Spin->SpinBox_DS->setValue( y );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1816,6 +1830,26 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue )
|
||||
}
|
||||
|
||||
GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
|
||||
|
||||
double x, y, xc, yc;
|
||||
x = y = xc = yc = 0.0;
|
||||
if ( mySketchType == PT_ABS_CENTER || mySketchType == PT_REL_CENTER )
|
||||
{
|
||||
if ( mySketchType == PT_REL_CENTER ){
|
||||
x = myDX + myLastX1;
|
||||
y = myDY + myLastY1;
|
||||
xc = myDXc + myLastX1;
|
||||
yc = myDYc + myLastY1;
|
||||
}
|
||||
else {
|
||||
x = myX ;
|
||||
y = myY ;
|
||||
xc = myXc;
|
||||
yc = myYc;
|
||||
}
|
||||
displayPntPreview(xc,yc);
|
||||
displayPntPreview(x,y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2249,6 +2283,32 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
|
||||
getDisplayer()->SetToActivate( true );
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : displayPntPreview
|
||||
// Purpose : creates a TopoDS_VERTEX and display a preview of it
|
||||
//================================================================
|
||||
void EntityGUI_SketcherDlg::displayPntPreview(const double x,
|
||||
const double y,
|
||||
bool append,
|
||||
bool update
|
||||
)
|
||||
{
|
||||
gp_Pnt aPnt = gp_Pnt(x,y,0.0);
|
||||
BRepBuilderAPI_MakeVertex mkVertex (aPnt);
|
||||
TopoDS_Shape aVertex = mkVertex.Shape();
|
||||
|
||||
// Disable activation of selection
|
||||
getDisplayer()->SetToActivate( false );
|
||||
|
||||
// Build prs
|
||||
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aVertex );
|
||||
if ( aPrs != 0 && !aPrs->IsNull() )
|
||||
GEOMBase_Helper::displayPreview( aPrs, append, update );
|
||||
|
||||
// Enable back activation of selection
|
||||
getDisplayer()->SetToActivate( true );
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : createShapes
|
||||
// Purpose : Create applyed wire, and last segment from entry object
|
||||
|
@ -73,7 +73,8 @@ public:
|
||||
|
||||
bool eventFilter (QObject* object, QEvent* event);
|
||||
|
||||
bool acceptMouseEvent() const { return ( getPnt1ConstructorId() == 1 ); } //accept mouse event only on absolute selection mode
|
||||
bool acceptMouseEvent() const { return ( getPnt1ConstructorId() == 1
|
||||
|| getPnt1ConstructorId() == 0 ); } //accept mouse event only on absolute and relative selection mode
|
||||
void OnPointSelected( Qt::KeyboardModifiers, const gp_Pnt& ); // called by EntityGUI::OnMousePress()
|
||||
|
||||
protected:
|
||||
@ -106,6 +107,12 @@ private:
|
||||
const int = -1,
|
||||
const int = -1);
|
||||
|
||||
void displayPntPreview( const double = 0.0,
|
||||
const double = 0.0,
|
||||
bool /*append*/ = true,
|
||||
bool /*update*/ = true
|
||||
);
|
||||
|
||||
bool createShapes( GEOM::GEOM_Object_ptr,
|
||||
TopoDS_Shape&,
|
||||
TopoDS_Shape& );
|
||||
|
Loading…
Reference in New Issue
Block a user