Commit d1ffaf0d authored by Maciej Suminski's avatar Maciej Suminski

Circles are supported by POINT_EDITOR.

parent 3c656691
...@@ -72,6 +72,10 @@ public: ...@@ -72,6 +72,10 @@ public:
(*points)[2].SetConstraint( new EPC_CIRCLE( (*points)[2], (*points)[0], (*points)[1] ) ); (*points)[2].SetConstraint( new EPC_CIRCLE( (*points)[2], (*points)[0], (*points)[1] ) );
break; break;
case S_CIRCLE:
points->Add( segment->GetCenter() );
points->Add( segment->GetEnd() );
default: // suppress warnings default: // suppress warnings
break; break;
} }
...@@ -219,9 +223,12 @@ void POINT_EDITOR::updateItem() const ...@@ -219,9 +223,12 @@ void POINT_EDITOR::updateItem() const
{ {
case S_SEGMENT: case S_SEGMENT:
if( &(*m_editPoints)[0] == m_dragPoint ) if( &(*m_editPoints)[0] == m_dragPoint )
segment->SetStart( wxPoint( (*m_editPoints)[0].GetPosition().x, (*m_editPoints)[0].GetPosition().y ) ); segment->SetStart( wxPoint( (*m_editPoints)[0].GetPosition().x,
(*m_editPoints)[0].GetPosition().y ) );
else if( &(*m_editPoints)[1] == m_dragPoint ) else if( &(*m_editPoints)[1] == m_dragPoint )
segment->SetEnd( wxPoint( (*m_editPoints)[1].GetPosition().x, (*m_editPoints)[1].GetPosition().y ) ); segment->SetEnd( wxPoint( (*m_editPoints)[1].GetPosition().x,
(*m_editPoints)[1].GetPosition().y ) );
break; break;
...@@ -250,6 +257,7 @@ void POINT_EDITOR::updateItem() const ...@@ -250,6 +257,7 @@ void POINT_EDITOR::updateItem() const
// Adjust the new angle to (counter)clockwise setting // Adjust the new angle to (counter)clockwise setting
bool clockwise = ( segment->GetAngle() > 0 ); bool clockwise = ( segment->GetAngle() > 0 );
if( clockwise && newAngle < 0.0 ) if( clockwise && newAngle < 0.0 )
newAngle += 3600.0; newAngle += 3600.0;
else if( !clockwise && newAngle > 0.0 ) else if( !clockwise && newAngle > 0.0 )
...@@ -257,8 +265,27 @@ void POINT_EDITOR::updateItem() const ...@@ -257,8 +265,27 @@ void POINT_EDITOR::updateItem() const
segment->SetAngle( newAngle ); segment->SetAngle( newAngle );
} }
break;
}
case S_CIRCLE:
{
const VECTOR2I& center = (*m_editPoints)[0].GetPosition();
const VECTOR2I& end = (*m_editPoints)[1].GetPosition();
if( m_dragPoint == &(*m_editPoints)[0] )
{
wxPoint moveVector = wxPoint( center.x, center.y ) - segment->GetCenter();
segment->Move( moveVector );
}
else
{
segment->SetEnd( wxPoint( end.x, end.y ) );
}
break;
} }
break;
default: // suppress warnings default: // suppress warnings
break; break;
...@@ -295,6 +322,11 @@ void POINT_EDITOR::updatePoints() const ...@@ -295,6 +322,11 @@ void POINT_EDITOR::updatePoints() const
(*m_editPoints)[2].SetPosition( segment->GetArcEnd() ); (*m_editPoints)[2].SetPosition( segment->GetArcEnd() );
break; break;
case S_CIRCLE:
(*m_editPoints)[0].SetPosition( segment->GetCenter() );
(*m_editPoints)[1].SetPosition( segment->GetEnd() );
break;
default: // suppress warnings default: // suppress warnings
break; break;
} }
......
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