Commit 6b90eb3a authored by Maciej Suminski's avatar Maciej Suminski

Refactoring EDIT_POINTS, part 1: separated functions that operate on EDIT_POINTS and EDIT_LINES.

parent e79934b0
...@@ -83,9 +83,15 @@ EDIT_POINT* EDIT_POINTS::Previous( const EDIT_POINT& aPoint ) ...@@ -83,9 +83,15 @@ EDIT_POINT* EDIT_POINTS::Previous( const EDIT_POINT& aPoint )
} }
} }
return NULL;
}
EDIT_LINE* EDIT_POINTS::Previous( const EDIT_LINE& aLine )
{
for( unsigned int i = 0; i < m_lines.size(); ++i ) for( unsigned int i = 0; i < m_lines.size(); ++i )
{ {
if( m_lines[i] == aPoint ) if( m_lines[i] == aLine )
{ {
if( i == 0 ) if( i == 0 )
return &m_lines[m_lines.size() - 1]; return &m_lines[m_lines.size() - 1];
...@@ -111,9 +117,15 @@ EDIT_POINT* EDIT_POINTS::Next( const EDIT_POINT& aPoint ) ...@@ -111,9 +117,15 @@ EDIT_POINT* EDIT_POINTS::Next( const EDIT_POINT& aPoint )
} }
} }
return NULL;
}
EDIT_LINE* EDIT_POINTS::Next( const EDIT_LINE& aLine )
{
for( unsigned int i = 0; i < m_lines.size(); ++i ) for( unsigned int i = 0; i < m_lines.size(); ++i )
{ {
if( m_lines[i] == aPoint ) if( m_lines[i] == aLine )
{ {
if( i == m_lines.size() - 1 ) if( i == m_lines.size() - 1 )
return &m_lines[0]; return &m_lines[0];
......
...@@ -73,7 +73,7 @@ public: ...@@ -73,7 +73,7 @@ public:
} }
/** /**
* Function GetX() * Function GetY()
* *
* Returns Y coordinate of an EDIT_POINT. * Returns Y coordinate of an EDIT_POINT.
*/ */
...@@ -356,6 +356,8 @@ public: ...@@ -356,6 +356,8 @@ public:
*/ */
EDIT_POINT* Previous( const EDIT_POINT& aPoint ); EDIT_POINT* Previous( const EDIT_POINT& aPoint );
EDIT_LINE* Previous( const EDIT_LINE& aLine );
/** /**
* Function Next() * Function Next()
* *
...@@ -367,16 +369,28 @@ public: ...@@ -367,16 +369,28 @@ public:
*/ */
EDIT_POINT* Next( const EDIT_POINT& aPoint ); EDIT_POINT* Next( const EDIT_POINT& aPoint );
EDIT_POINT& operator[]( unsigned int aIndex ) EDIT_LINE* Next( const EDIT_LINE& aLine );
EDIT_POINT& Point( unsigned int aIndex )
{ {
return m_points[aIndex]; return m_points[aIndex];
} }
const EDIT_POINT& operator[]( unsigned int aIndex ) const const EDIT_POINT& Point( unsigned int aIndex ) const
{ {
return m_points[aIndex]; return m_points[aIndex];
} }
EDIT_LINE& Line( unsigned int aIndex )
{
return m_lines[aIndex];
}
const EDIT_LINE& Line( unsigned int aIndex ) const
{
return m_lines[aIndex];
}
/** /**
* Function Size() * Function Size()
* *
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment