From 1751e4631c300d14c22d2b32bb81c538c92b22c6 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Sat, 23 Jun 2018 01:35:07 +0200 Subject: [PATCH] Code formatting --- common/gal/opengl/opengl_gal.cpp | 4 ++-- common/geometry/shape_poly_set.cpp | 11 ++++------- include/geometry/shape_poly_set.h | 1 - pcbnew/class_zone.cpp | 9 ++++++--- pcbnew/class_zone.h | 8 ++++---- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index d10bc1a138..d2ae49977f 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -797,13 +797,13 @@ void OPENGL_GAL::DrawPolygon( const VECTOR2D aPointList[], int aListSize ) drawPolygon( points.get(), aListSize ); } + void OPENGL_GAL::drawTriangulatedPolyset( const SHAPE_POLY_SET& aPolySet ) { currentManager->Shader( SHADER_NONE ); currentManager->Color( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); - - if ( isFillEnabled ) + if( isFillEnabled ) { for( int j = 0; j < aPolySet.OutlineCount(); ++j ) { diff --git a/common/geometry/shape_poly_set.cpp b/common/geometry/shape_poly_set.cpp index 8b9b11b968..6bc8f5c549 100644 --- a/common/geometry/shape_poly_set.cpp +++ b/common/geometry/shape_poly_set.cpp @@ -1863,16 +1863,14 @@ SHAPE_POLY_SET &SHAPE_POLY_SET::operator=( const SHAPE_POLY_SET& aOther ) } - - class SHAPE_POLY_SET::TRIANGULATION_CONTEXT { public: TRIANGULATION_CONTEXT( TRIANGULATED_POLYGON* aResultPoly ) : - m_triPoly( aResultPoly ) - { - } + m_triPoly( aResultPoly ) + { + } void AddOutline( const SHAPE_LINE_CHAIN& outl, bool aIsHole = false ) { @@ -1887,9 +1885,7 @@ public: if ( aIsHole ) m_cdt->AddHole( m_points ); else - { m_cdt.reset( new p2t::CDT( m_points ) ); - } } void Triangulate() @@ -2014,6 +2010,7 @@ void SHAPE_POLY_SET::triangulateSingle( const POLYGON& aPoly, aResult.AllocateVertices( totalVertexCount( aPoly ) ); ctx.AddOutline( aPoly[0], false ); + for( unsigned i = 1; i < aPoly.size(); i++ ) { ctx.AddOutline( aPoly[i], true ); // add holes diff --git a/include/geometry/shape_poly_set.h b/include/geometry/shape_poly_set.h index e8928fc46c..00b56f786a 100644 --- a/include/geometry/shape_poly_set.h +++ b/include/geometry/shape_poly_set.h @@ -609,7 +609,6 @@ class SHAPE_POLY_SET : public SHAPE return m_triangulatedPolys[aIndex].get(); } - const SHAPE_LINE_CHAIN& COutline( int aIndex ) const { return m_polys[aIndex][0]; diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 1fd86ce2dd..7b32593729 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -944,10 +944,10 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, double angle ) for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ ) { - wxPoint a ( m_FillSegmList[ic].A ); + wxPoint a( m_FillSegmList[ic].A ); RotatePoint( &a, centre, angle ); m_FillSegmList[ic].A = a; - wxPoint b ( m_FillSegmList[ic].B ); + wxPoint b( m_FillSegmList[ic].B ); RotatePoint( &b, centre, angle ); m_FillSegmList[ic].B = a; } @@ -989,7 +989,7 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref ) for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ ) { MIRROR( m_FillSegmList[ic].A.y, mirror_ref.y ); - MIRROR( m_FillSegmList[ic].B.y, mirror_ref.y ); + MIRROR( m_FillSegmList[ic].B.y, mirror_ref.y ); } } @@ -1303,6 +1303,7 @@ BITMAP_DEF ZONE_CONTAINER::GetMenuImage() const return add_zone_xpm; } + void ZONE_CONTAINER::SwapData( BOARD_ITEM* aImage ) { assert( aImage->Type() == PCB_ZONE_AREA_T ); @@ -1310,11 +1311,13 @@ void ZONE_CONTAINER::SwapData( BOARD_ITEM* aImage ) std::swap( *((ZONE_CONTAINER*) this), *((ZONE_CONTAINER*) aImage) ); } + void ZONE_CONTAINER::CacheTriangulation() { m_FilledPolysList.CacheTriangulation(); } + bool ZONE_CONTAINER::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly ) const { if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations do not like it ... diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index b95024593c..b6b9018c2a 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -551,10 +551,10 @@ public: * Function SetFilledPolysList * sets the list of filled polygons. */ - void SetRawPolysList( SHAPE_POLY_SET& aPolysList ) - { - m_RawPolysList = aPolysList; - } + void SetRawPolysList( SHAPE_POLY_SET& aPolysList ) + { + m_RawPolysList = aPolysList; + } /**