eeschema: SCH_PAINTER should draw LIB_BEZIERs too!

This commit is contained in:
Tomasz Włostowski 2019-02-19 10:41:21 +01:00
parent ef60e523a1
commit 9a8afdf6fd
4 changed files with 41 additions and 1 deletions

View File

@ -104,10 +104,22 @@ bool LIB_BEZIER::Inside( EDA_RECT& aRect ) const
void LIB_BEZIER::Move( const wxPoint& aPosition )
{
if ( !m_PolyPoints.size() )
return;
{
m_PolyPoints.push_back( wxPoint(0, 0) );
}
SetOffset( aPosition - m_PolyPoints[0] );
}
const wxPoint LIB_BEZIER::GetOffset() const
{
if ( !m_PolyPoints.size() )
{
return wxPoint(0, 0);
}
return m_PolyPoints[0];
}
void LIB_BEZIER::MirrorHorizontal( const wxPoint& aCenter )
{

View File

@ -67,6 +67,7 @@ public:
void AddPoint( const wxPoint& aPoint ) { m_BezierPoints.push_back( aPoint ); }
void SetOffset( const wxPoint& aOffset ) override;
const wxPoint GetOffset() const;
/**
* @return the number of corners

View File

@ -34,6 +34,7 @@
#include <lib_arc.h>
#include <lib_field.h>
#include <lib_text.h>
#include <lib_bezier.h>
#include <sch_line.h>
#include <sch_component.h>
#include <sch_field.h>
@ -54,6 +55,7 @@
#include <gal/graphics_abstraction_layer.h>
#include <colors_design_settings.h>
#include <geometry/shape_line_chain.h>
#include <bezier_curves.h>
#include "sch_painter.h"
@ -176,6 +178,7 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer )
HANDLE_ITEM(LIB_ARC_T, LIB_ARC);
HANDLE_ITEM(LIB_FIELD_T, LIB_FIELD);
HANDLE_ITEM(LIB_TEXT_T, LIB_TEXT);
HANDLE_ITEM(LIB_BEZIER_T, LIB_BEZIER);
HANDLE_ITEM(SCH_COMPONENT_T, SCH_COMPONENT);
HANDLE_ITEM(SCH_JUNCTION_T, SCH_JUNCTION);
HANDLE_ITEM(SCH_LINE_T, SCH_LINE);
@ -845,6 +848,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer, bool isDangling, bool isMovin
}
void SCH_PAINTER::draw( LIB_BEZIER *aCurve, int aLayer )
{
if( !isUnitAndConversionShown( aCurve ) )
return;
if( setColors( aCurve, aLayer ) )
{
BEZIER_POLY poly ( aCurve->GetPoints() );
std::vector<wxPoint> pts;
std::deque<VECTOR2D> pts_xformed;
poly.GetPoly( pts );
for( const auto &p : pts )
{
pts_xformed.push_back( mapCoords( p ) );
}
m_gal->DrawPolygon( pts_xformed );
}
}
// Draw the target (an open square) for a wire or label which has no connection or is
// being moved.
static void drawDanglingSymbol( GAL* aGal, const wxPoint& aPos )

View File

@ -37,6 +37,7 @@ class LIB_POLYLINE;
class LIB_ARC;
class LIB_FIELD;
class LIB_TEXT;
class LIB_BEZIER;
class SCH_COMPONENT;
class SCH_FIELD;
class SCH_JUNCTION;
@ -141,6 +142,7 @@ private:
void draw( LIB_POLYLINE *, int );
void draw( LIB_FIELD *, int );
void draw( LIB_TEXT *, int );
void draw( LIB_BEZIER *, int );
void draw( SCH_COMPONENT *, int );
void draw( SCH_JUNCTION *, int );
void draw( SCH_FIELD *, int );