-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 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.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <SUIT_ViewWindow.h>
#include <SUIT_Desktop.h>
+#include <Basics_OCCTVersion.hxx>
+
#include <QMouseEvent>
#include <AIS_InteractiveContext.hxx>
#include <Geom_Line.hxx>
#include <Geom_Plane.hxx>
#include <NCollection_Sequence.hxx>
+#include <Quantity_Length.hxx>
//=================================================================================
// function : Constructor
myIsEnabled = false;
- // remove event filtering from viewer windows
- QVector<SUIT_ViewWindow*> aViews = myVM->getViews();
- QVector<SUIT_ViewWindow*>::iterator aViewIt = aViews.begin();
- for ( ; aViewIt != aViews.end(); ++aViewIt )
- {
- DisconnectView( *aViewIt );
+ if (myVM) {
+ // remove event filtering from viewer windows
+ QVector<SUIT_ViewWindow*> aViews = myVM->getViews();
+ QVector<SUIT_ViewWindow*>::iterator aViewIt = aViews.begin();
+ for ( ; aViewIt != aViews.end(); ++aViewIt )
+ {
+ DisconnectView( *aViewIt );
+ }
}
}
return Operation_None;
}
+#if OCC_VERSION_LARGE >= 0x070400ff
+ Handle(PrsDim_DimensionOwner) anOwner = Handle(PrsDim_DimensionOwner)::DownCast( theEntity );
+#else
Handle(AIS_DimensionOwner) anOwner = Handle(AIS_DimensionOwner)::DownCast( theEntity );
+#endif
if ( anOwner.IsNull() )
{
return Operation_None;
}
- Standard_Real anAngTolerance = M_PI / 30.0; // 6 degree tolerance
+ //Standard_Real anAngTolerance = M_PI / 30.0; // 6 degree tolerance
switch ( anOwner->SelectionMode() )
{
+#if OCC_VERSION_LARGE >= 0x070400ff
+ case PrsDim_DimensionSelectionMode_Line :
+#else
case AIS_DSM_Line :
+#endif
{
if ( ( theKeys & Qt::ControlModifier ) == 0 )
{
return Operation_MoveFlyoutFree;
}
+#if OCC_VERSION_LARGE >= 0x070400ff
+ case PrsDim_DimensionSelectionMode_Text : return Operation_MoveText;
+#else
case AIS_DSM_Text : return Operation_MoveText;
+#endif
default : return Operation_None;
}
}
gp_Pnt aPointOnBase = gp_Pnt( aFirstPoint.XYZ() + aBaseDir.XYZ() * aPointVector.Dot( aBaseDir ) );
// snapping tolerance
- Quantity_Length aSize[2];
+ Standard_Real aSize[2];
theView->Size( aSize[0], aSize[1] );
Standard_Real aSnapTolerance = 1e-2 * Max( aSize[0], aSize[1] );
if ( aNewFlyout <= Precision::Confusion() )
{
myInteractedIO->SetFlyout( 0.0 );
- myViewer->getAISContext()->Redisplay( myInteractedIO );
+ myViewer->getAISContext()->Redisplay( myInteractedIO, Standard_True );
return;
}
myInteractedIO->SetFlyout( aNewFlyout );
myInteractedIO->SetCustomPlane( aNewPlane );
- myViewer->getAISContext()->Redisplay( myInteractedIO );
+ myViewer->getAISContext()->Redisplay( myInteractedIO, Standard_True );
}
//=================================================================================
myInteractedIO->SetFlyout( aFlyout );
- myViewer->getAISContext()->Redisplay( myInteractedIO );
+ myViewer->getAISContext()->Redisplay( myInteractedIO, Standard_True );
}
//=================================================================================
const gp_Pnt& aFirstPoint = anAngle->FirstPoint();
const gp_Pnt& aSecondPoint = anAngle->SecondPoint();
- Standard_Boolean isPositive = anAngle->GetFlyout() > 0.0;
+ //Standard_Boolean isPositive = anAngle->GetFlyout() > 0.0;
gp_Dir aFirstDir = gce_MakeDir( aCenterPoint, aFirstPoint );
gp_Dir aSecondDir = gce_MakeDir( aCenterPoint, aSecondPoint );
myInteractedIO->DimensionAspect()->SetArrowOrientation( aArrPos );
myInteractedIO->SetToUpdate();
- myViewer->getAISContext()->Redisplay( myInteractedIO );
+ myViewer->getAISContext()->Redisplay( myInteractedIO, Standard_True );
}
//=================================================================================
QMouseEvent* aMouseEv = dynamic_cast<QMouseEvent*>( theEvent );
// init detection
- anAISContext->MoveTo( aMouseEv->x(), aMouseEv->y(), aView3d );
+ anAISContext->MoveTo( aMouseEv->x(), aMouseEv->y(), aView3d, Standard_True );
if ( !anAISContext->HasDetected() )
{
return false;
}
+ // commented by mpa 18.03.2015: since OCCT version 6.8.0 it's impossible
+ // to change position of the dimensions presentations (flyout, text),
+ // because anAISContext has 2 detected objects.
+
// check that there is only one detected entity
- anAISContext->InitDetected();
- if ( anAISContext->MoreDetected() )
+ //anAISContext->InitDetected();
+ //if ( anAISContext->MoreDetected() )
+ //{
+ // return false;
+ //}
+
+ Handle(SelectMgr_EntityOwner) aDetectedOwner = anAISContext->DetectedOwner();
+ if( aDetectedOwner.IsNull() )
{
return false;
}
- Handle(SelectMgr_EntityOwner) aDetectedOwner = anAISContext->DetectedOwner();
-
myInteractedIO = Handle(AIS_Dimension)::DownCast( aDetectedOwner->Selectable() );
// try to start operation for the detected entity
}
anAISContext->ClearSelected( Standard_False );
- anAISContext->AddOrRemoveSelected( aDetectedOwner );
+ anAISContext->AddOrRemoveSelected( aDetectedOwner, Standard_True );
emit InteractionStarted( myInteractedIO );
Standard_Real MeasureGUI_DimensionInteractor::SensitivityTolerance( const Handle(V3d_View)& theView )
{
// snapping tolerance
- Quantity_Length aSize[2];
+ Standard_Real aSize[2];
theView->Size( aSize[0], aSize[1] );
return 1e-2 * Max( aSize[0], aSize[1] );
}