From 24c9b705a32e7764573fd9f56d06b216ab698da9 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Fri, 28 Feb 2014 18:24:29 +0100 Subject: [PATCH] Zones are supported by POINT_EDITOR. --- pcbnew/tools/point_editor.cpp | 43 +++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/point_editor.cpp b/pcbnew/tools/point_editor.cpp index cf464dc436..59e67ff732 100644 --- a/pcbnew/tools/point_editor.cpp +++ b/pcbnew/tools/point_editor.cpp @@ -33,6 +33,7 @@ #include "point_editor.h" #include +#include /** * Class POINT_EDITOR @@ -52,7 +53,7 @@ public: { case PCB_LINE_T: { - DRAWSEGMENT* segment = static_cast( aItem ); + const DRAWSEGMENT* segment = static_cast( aItem ); switch( segment->GetShape() ) { @@ -79,8 +80,19 @@ public: default: // suppress warnings break; } + + break; + } + + case PCB_ZONE_AREA_T: + { + const CPolyLine* outline = static_cast( aItem )->Outline(); + + for( int i = 0; i < outline->GetCornersCount(); ++i ) + points->Add( outline->GetPos( i ) ); + + break; } - break; default: break; @@ -290,6 +302,21 @@ void POINT_EDITOR::updateItem() const default: // suppress warnings break; } + + break; + } + + case PCB_ZONE_AREA_T: + { + ZONE_CONTAINER* zone = static_cast( 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; } @@ -330,7 +357,19 @@ void POINT_EDITOR::updatePoints() const default: // suppress warnings break; } + + break; } + } + + case PCB_ZONE_AREA_T: + { + const ZONE_CONTAINER* zone = static_cast( item ); + const CPolyLine* outline = zone->Outline(); + + for( int i = 0; i < outline->GetCornersCount(); ++i ) + (*m_editPoints)[i].SetPosition( outline->GetPos( i ) ); + break; }