mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0025338: MFC standard samples: 3D selection rectangle blinking
- Added new interactive object AIS_RubberBand to draw rubber rectangle or polygon - Added using of AIS_RubberBand in DRAW view for rectangular selection - Added using of AIS_RubberBand in MFC samples for rectangular selection
This commit is contained in:
@@ -5,16 +5,75 @@
|
||||
#include <stdafx.h>
|
||||
#include "OCC_BaseView.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
OCC_BaseView::OCC_BaseView()
|
||||
: myXmin (0),
|
||||
myYmin (0),
|
||||
myXmax (0),
|
||||
myYmax (0),
|
||||
myCurZoom (0.0),
|
||||
myRect (new AIS_RubberBand (Quantity_Color(Quantity_NOC_WHITE), Aspect_TOL_SOLID, 1.0) )
|
||||
{
|
||||
|
||||
myRect->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt(-1, -1, 0));
|
||||
if (myRect->ZLayer() != Graphic3d_ZLayerId_TopOSD)
|
||||
{
|
||||
myRect->SetZLayer (Graphic3d_ZLayerId_TopOSD);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Destructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
OCC_BaseView::~OCC_BaseView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetDocument
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
OCC_BaseDoc* OCC_BaseView::GetDocument() // non-debug version is inline
|
||||
{
|
||||
return (OCC_BaseDoc*)m_pDocument;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : drawRectangle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void OCC_BaseView::drawRectangle (const Standard_Integer theMinX,
|
||||
const Standard_Integer theMinY,
|
||||
const Standard_Integer theMaxX,
|
||||
const Standard_Integer theMaxY,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const Standard_Boolean toDraw)
|
||||
{
|
||||
if (toDraw)
|
||||
{
|
||||
CRect aRect;
|
||||
GetWindowRect(aRect);
|
||||
myRect->SetRectangle (theMinX, aRect.Height() - theMinY, theMaxX, aRect.Height() - theMaxY);
|
||||
|
||||
if (!theContext->IsDisplayed (myRect))
|
||||
{
|
||||
theContext->Display (myRect, Standard_False);
|
||||
}
|
||||
else
|
||||
{
|
||||
theContext->Redisplay (myRect, Standard_False);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
theContext->Remove (myRect, Standard_False);
|
||||
}
|
||||
|
||||
theContext->CurrentViewer()->RedrawImmediate();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user