00001 00007 #include "shape.h" 00008 #include "boundingbox.h" 00009 00010 Shape::Shape() 00011 { 00012 } 00013 00014 Shape::~Shape() 00015 {} 00016 00017 void Shape::Init(int x, int y) 00018 { 00019 m_box.SetCoord(x, y, x, y); 00020 } 00021 00022 void Shape::ModifyEndShape(int lastMousePosition_x, int lastMousePosition_y) 00023 { 00024 m_box.SetEndX(lastMousePosition_x); 00025 m_box.SetEndY(lastMousePosition_y); 00026 } 00027 00028 const BoundingBox& Shape::GetBoundingBox() const 00029 { 00030 return m_box; 00031 } 00032 00033 void Shape::SetBoundingBox(BoundingBox& bb) 00034 { 00035 m_box = bb; 00036 } 00037 00038 int Shape::GetHeight() const 00039 { 00040 return m_box.GetHeight(); 00041 } 00042 00043 int Shape::GetWidth() const 00044 { 00045 return m_box.GetWidth(); 00046 } 00047 00048 int Shape::GetCenterX() const 00049 { 00050 return m_box.GetOriginX() + m_box.GetWidth() / 2; 00051 } 00052 00053 int Shape::GetCenterY() const 00054 { 00055 return m_box.GetOriginY() + m_box.GetHeight() / 2; 00056 } 00057 00058 bool Shape::Validate() 00059 { 00060 m_box.Validate(); 00061 return !(m_box.IsEmpty()); 00062 } 00063