mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-22 15:00:33 +05:00
rnc: Modification to take into account the Local Coord. System when selecting a point in the viewer or doing a preview of a point
This commit is contained in:
parent
bc4ee77be9
commit
a21596709a
@ -1522,16 +1522,30 @@ void EntityGUI_SketcherDlg::OnPointSelected(Qt::KeyboardModifiers modifiers, con
|
|||||||
double x, y;
|
double x, y;
|
||||||
x = y = 0;
|
x = y = 0;
|
||||||
|
|
||||||
|
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 && false ); // If no additional argument needed after selection
|
autoApply = ( getPnt2ConstructorId() == 1 && false ); // If no additional argument needed after selection
|
||||||
// -> apply automatically --> disabled for now
|
// -> apply automatically --> disabled for now
|
||||||
|
|
||||||
if ( getPnt1ConstructorId() == 0 ){ // Relative selection mode
|
if ( getPnt1ConstructorId() == 0 ){ // Relative selection mode
|
||||||
x = thePnt.X() - myLastX1;
|
x = aTrsfPnt.X() - myLastX1;
|
||||||
y = thePnt.Y() - myLastY1;
|
y = aTrsfPnt.Y() - myLastY1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x = thePnt.X();
|
x = aTrsfPnt.X();
|
||||||
y = thePnt.Y();
|
y = aTrsfPnt.Y();
|
||||||
}
|
}
|
||||||
switch (getPnt2ConstructorId()){
|
switch (getPnt2ConstructorId()){
|
||||||
case 1:
|
case 1:
|
||||||
@ -2296,15 +2310,29 @@ void EntityGUI_SketcherDlg::displayPntPreview(const double x,
|
|||||||
bool update
|
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);
|
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);
|
BRepBuilderAPI_MakeVertex mkVertex (aPnt);
|
||||||
TopoDS_Shape aVertex = mkVertex.Shape();
|
TopoDS_Shape aLocalVertex = mkVertex.Shape();
|
||||||
|
|
||||||
|
// Perform transformation
|
||||||
|
BRepBuilderAPI_Transform aTransformation (aLocalVertex, aTrans, Standard_False);
|
||||||
|
TopoDS_Shape aGlobalVertex = aTransformation.Shape();
|
||||||
|
|
||||||
// Disable activation of selection
|
// Disable activation of selection
|
||||||
getDisplayer()->SetToActivate( false );
|
getDisplayer()->SetToActivate( false );
|
||||||
|
|
||||||
// Build prs
|
// Build prs with vertex in globalCS
|
||||||
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aVertex );
|
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aGlobalVertex );
|
||||||
if ( aPrs != 0 && !aPrs->IsNull() )
|
if ( aPrs != 0 && !aPrs->IsNull() )
|
||||||
GEOMBase_Helper::displayPreview( aPrs, append, update );
|
GEOMBase_Helper::displayPreview( aPrs, append, update );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user