0031456: Visualization - move out Dimensions and Relations from package AIS to PrsDims
[occt.git] / samples / mfc / standard / Common / OCC_BaseView.cpp
CommitLineData
7fd59977 1// OCC_BaseView.cpp: implementation of the OCC_BaseView class.
2//
3//////////////////////////////////////////////////////////////////////
4
5#include <stdafx.h>
6#include "OCC_BaseView.h"
7
b12e1c7b 8//=======================================================================
9//function : Constructor
10//purpose :
11//=======================================================================
7fd59977 12OCC_BaseView::OCC_BaseView()
b12e1c7b 13 : myXmin (0),
14 myYmin (0),
15 myXmax (0),
16 myYmax (0),
17 myCurZoom (0.0),
18 myRect (new AIS_RubberBand (Quantity_Color(Quantity_NOC_WHITE), Aspect_TOL_SOLID, 1.0) )
7fd59977 19{
778cd667 20 myRect->SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
b12e1c7b 21 if (myRect->ZLayer() != Graphic3d_ZLayerId_TopOSD)
22 {
23 myRect->SetZLayer (Graphic3d_ZLayerId_TopOSD);
24 }
25
7fd59977 26}
27
b12e1c7b 28//=======================================================================
29//function : Destructor
30//purpose :
31//=======================================================================
7fd59977 32OCC_BaseView::~OCC_BaseView()
33{
34
35}
b12e1c7b 36
37//=======================================================================
38//function : GetDocument
39//purpose :
40//=======================================================================
41OCC_BaseDoc* OCC_BaseView::GetDocument() // non-debug version is inline
42{
43 return (OCC_BaseDoc*)m_pDocument;
44}
45
46//=======================================================================
47//function : drawRectangle
48//purpose :
49//=======================================================================
50void OCC_BaseView::drawRectangle (const Standard_Integer theMinX,
51 const Standard_Integer theMinY,
52 const Standard_Integer theMaxX,
53 const Standard_Integer theMaxY,
54 const Handle(AIS_InteractiveContext)& theContext,
55 const Standard_Boolean toDraw)
56{
57 if (toDraw)
58 {
59 CRect aRect;
60 GetWindowRect(aRect);
61 myRect->SetRectangle (theMinX, aRect.Height() - theMinY, theMaxX, aRect.Height() - theMaxY);
62
63 if (!theContext->IsDisplayed (myRect))
64 {
65 theContext->Display (myRect, Standard_False);
66 }
67 else
68 {
69 theContext->Redisplay (myRect, Standard_False);
70 }
71 }
72 else
73 {
74 theContext->Remove (myRect, Standard_False);
75 }
76
77 theContext->CurrentViewer()->RedrawImmediate();
78}
79