int( c.Green() * 255 ),
int( c.Blue() * 255 ) );
}
-
-/*!
- \brief Check if size of given rectagle exceeds threshold value for mouse events.
- \param rect Given rectangle
- \return Result of comparison
-*/
-bool OCCViewer::overThreshold( const QRect& rect )
-{
- const int threshold = 3;
- return qMin( rect.height(), rect.width() ) >= threshold;
-}
myIsUseLocalSelection(false),
#endif
myClippingDlg (NULL),
- myFitter(0),
- mySelectionDone(false)
+ myFitter(0)
{
// init CasCade viewers
myV3dViewer = OCCViewer_VService::CreateViewer( TCollection_ExtendedString("Viewer3d").ToExtString() );
myAISContext->HighlightStyle(Prs3d_TypeOfHighlight_LocalSelected)->SetColor( Quantity_NOC_WHITE );
myAISContext->HighlightStyle(Prs3d_TypeOfHighlight_Selected)->SetColor( Quantity_NOC_WHITE );
- // Set overlap detection for common behaviour of Rect selection and Polygon selection
- // (both selects an object with partial overlap)
- myAISContext->MainSelector()->AllowOverlapDetection(true);
-
// display isoline on planar faces (box for ex.)
myAISContext->IsoOnPlane( true );
myEndPnt.setX(theEvent->x()); myEndPnt.setY(theEvent->y());
bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
- // In case of small tremor of a mouse pointer, consider it as a click
- if ( !OCCViewer::overThreshold( QRect( myStartPnt, myEndPnt ) ) && !mySelectionDone)
+ if (myStartPnt == myEndPnt)
{
if (!aHasShift) {
myAISContext->ClearCurrents( false );
myAISContext->Select( Standard_True );
emit selectionChanged();
}
- mySelectionDone = false;
//else
//{
case Rect:
{
QRect* aRect = (QRect*)mypSketcher->data();
- // Use rectangle selection only if the rect has a reasonable size
- // If it is too small then it is very probably tremor of a mouse pointer
- if ( aRect && OCCViewer::overThreshold( *aRect ) )
+ if ( aRect )
{
int aLeft = aRect->left();
int aRight = aRect->right();
QPolygon* aPolygon = (QPolygon*)mypSketcher->data();
if( aPolygon )
{
- QRect aRect = aPolygon->boundingRect();
- if ( OCCViewer::overThreshold( aRect ) ) {
- int size = aPolygon->size();
- TColgp_Array1OfPnt2d anArray(1, size);
-
- QPolygon::Iterator it = aPolygon->begin();
- QPolygon::Iterator itEnd = aPolygon->end();
- for (int index = 1; it != itEnd; ++it, index++)
- {
- QPoint aPoint = *it;
- anArray.SetValue(index, gp_Pnt2d(aPoint.x(), aPoint.y()));
- }
+ int size = aPolygon->size();
+ TColgp_Array1OfPnt2d anArray(1, size);
- if (append)
- ic->ShiftSelect(anArray, getViewPort()->getView(), Standard_False);
- else
- ic->Select(anArray, getViewPort()->getView(), Standard_False);
+ QPolygon::Iterator it = aPolygon->begin();
+ QPolygon::Iterator itEnd = aPolygon->end();
+ for (int index = 1; it != itEnd; ++it, index++)
+ {
+ QPoint aPoint = *it;
+ anArray.SetValue(index, gp_Pnt2d(aPoint.x(), aPoint.y()));
}
+
+ if (append)
+ ic->ShiftSelect(anArray, getViewPort()->getView(), Standard_False);
+ else
+ ic->Select(anArray, getViewPort()->getView(), Standard_False);
}
}
break;
OCCViewer_ViewManager* aViewMgr = ( OCCViewer_ViewManager* )getViewManager();
aViewMgr->getOCCViewer()->performSelectionChanged();
- aViewMgr->getOCCViewer()->doNotSelect();
}
}