Interface margins and axes bounds properties.
[scilab.git] / scilab / modules / renderer / src / cpp / rectangleDrawing / DrawableRectangle.cpp
1 /*------------------------------------------------------------------------*/
2 /* file: DrawableRectangle.cpp                                            */
3 /* Copyright INRIA 2007                                                   */
4 /* Authors : Jean-Baptiste Silvy                                          */
5 /* desc : Class containing the drawing routine for a rectangle object     */
6 /*------------------------------------------------------------------------*/
7
8 #include "DrawableRectangle.h"
9 extern "C"
10 {
11 #include "drawRectangleEntity.h"
12 }
13
14 namespace sciGraphics
15 {
16
17 using namespace std;
18
19 /*------------------------------------------------------------------------------------------*/
20 DrawableRectangle::~DrawableRectangle( void )
21 {
22   
23 }
24 /*------------------------------------------------------------------------------------------*/
25 void DrawableRectangle::draw( void )
26 {
27   initializeDrawing() ;
28   if ( !checkVisibility() )
29   {
30
31     endDrawing();
32     return ;
33   }
34   
35   drawRectangle() ;
36   endDrawing();
37 }
38 /*------------------------------------------------------------------------------------------*/
39 void DrawableRectangle::show( void )
40 {
41   getRectangleImp()->show() ;
42 }
43 /*------------------------------------------------------------------------------------------*/
44 DrawableRectangleImp * DrawableRectangle::getRectangleImp( void )
45 {
46   return dynamic_cast<DrawableRectangleImp *>(m_pImp) ;
47 }
48 /*------------------------------------------------------------------------------------------*/
49 void DrawableRectangle::drawRectangle( void )
50 {
51   getRectangleImp()->drawRectangle() ;
52 }
53 /*------------------------------------------------------------------------------------------*/
54 void DrawableRectangle::getCornersCoordinates( double corner1[3], double corner2[3], double corner3[3], double corner4[3] )
55 {
56   sciRectangle * ppRect = pRECTANGLE_FEATURE(m_pDrawed) ;
57   corner1[0] = ppRect->x ;
58   corner1[1] = ppRect->y ;
59   corner1[2] = ppRect->z ;
60
61   corner2[0] = ppRect->x ;
62   corner2[1] = ppRect->y - ppRect->height ;
63   corner2[2] = ppRect->z ;
64
65   corner3[0] = ppRect->x + ppRect->width  ;
66   corner3[1] = ppRect->y - ppRect->height ;
67   corner3[2] = ppRect->z ;
68
69   corner4[0] = ppRect->x + ppRect->width ;
70   corner4[1] = ppRect->y ;
71   corner4[2] = ppRect->z ;
72
73 }
74 /*------------------------------------------------------------------------------------------*/
75 }