[opengtl-commits] [290] add != operator, setWidth and setHeight to Region and a default constructor |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 290
Author: cyrille
Date: 2008-07-02 00:19:54 +0200 (Wed, 02 Jul 2008)
Log Message:
-----------
add != operator, setWidth and setHeight to Region and a default constructor
Modified Paths:
--------------
trunk/OpenGTL/OpenGTL/GTLCore/Region.cpp
trunk/OpenGTL/OpenGTL/GTLCore/Region.h
Modified: trunk/OpenGTL/OpenGTL/GTLCore/Region.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Region.cpp 2008-07-01 22:19:27 UTC (rev 289)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Region.cpp 2008-07-01 22:19:54 UTC (rev 290)
@@ -21,6 +21,10 @@
using namespace GTLCore;
+Region::Region() : m_x(0), m_y(0), m_width(0), m_height(0)
+{
+}
+
Region::Region( int _x, int _y, int _width, int _height )
: m_x(_x), m_y(_y), m_width(_width), m_height(_height)
{
@@ -44,7 +48,22 @@
return m_width;
}
+void Region::setWidth( int _width )
+{
+ m_width = _width;
+}
+
int Region::height() const
{
return m_height;
}
+
+void Region::setHeight( int _height )
+{
+ m_height = _height;
+}
+
+bool Region::operator!=( const Region& _region ) const
+{
+ return x() != _region.x() or y() != _region.y() or width() != _region.width() or height() != _region.height();
+}
Modified: trunk/OpenGTL/OpenGTL/GTLCore/Region.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Region.h 2008-07-01 22:19:27 UTC (rev 289)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Region.h 2008-07-01 22:19:54 UTC (rev 290)
@@ -21,14 +21,23 @@
#define _GTLCORE_REGION_H_
namespace GTLCore {
+ /**
+ * Define a rectangle.
+ *
+ * @ingroup GTLCore
+ */
class Region {
public:
+ Region();
Region( int _x, int _y, int _width, int _height );
~Region();
int x() const;
int y() const;
int width() const;
+ void setWidth( int _width );
int height() const;
+ void setHeight( int _height );
+ bool operator!=( const Region& _region ) const;
private:
int m_x, m_y, m_width, m_height;
};