Zones are supported by POINT_EDITOR.

This commit is contained in:
Maciej Suminski 2014-02-28 18:24:29 +01:00
parent d1ffaf0deb
commit 24c9b705a3
1 changed files with 41 additions and 2 deletions

View File

@ -33,6 +33,7 @@
#include "point_editor.h" #include "point_editor.h"
#include <class_drawsegment.h> #include <class_drawsegment.h>
#include <class_zone.h>
/** /**
* Class POINT_EDITOR * Class POINT_EDITOR
@ -52,7 +53,7 @@ public:
{ {
case PCB_LINE_T: case PCB_LINE_T:
{ {
DRAWSEGMENT* segment = static_cast<DRAWSEGMENT*>( aItem ); const DRAWSEGMENT* segment = static_cast<const DRAWSEGMENT*>( aItem );
switch( segment->GetShape() ) switch( segment->GetShape() )
{ {
@ -79,8 +80,19 @@ public:
default: // suppress warnings default: // suppress warnings
break; break;
} }
}
break; break;
}
case PCB_ZONE_AREA_T:
{
const CPolyLine* outline = static_cast<const ZONE_CONTAINER*>( aItem )->Outline();
for( int i = 0; i < outline->GetCornersCount(); ++i )
points->Add( outline->GetPos( i ) );
break;
}
default: default:
break; break;
@ -290,6 +302,21 @@ void POINT_EDITOR::updateItem() const
default: // suppress warnings default: // suppress warnings
break; break;
} }
break;
}
case PCB_ZONE_AREA_T:
{
ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item );
CPolyLine* outline = zone->Outline();
for( int i = 0; i < outline->GetCornersCount(); ++i )
{
outline->SetX( i, (*m_editPoints)[i].GetPosition().x );
outline->SetY( i, (*m_editPoints)[i].GetPosition().y );
}
break; break;
} }
@ -330,7 +357,19 @@ void POINT_EDITOR::updatePoints() const
default: // suppress warnings default: // suppress warnings
break; break;
} }
break;
} }
}
case PCB_ZONE_AREA_T:
{
const ZONE_CONTAINER* zone = static_cast<const ZONE_CONTAINER*>( item );
const CPolyLine* outline = zone->Outline();
for( int i = 0; i < outline->GetCornersCount(); ++i )
(*m_editPoints)[i].SetPosition( outline->GetPos( i ) );
break; break;
} }