This commit is contained in:
Jeff Young 2021-09-09 21:49:16 +01:00
parent 9ee28ea8f5
commit 4ba3937f8a
10 changed files with 100 additions and 152 deletions

View File

@ -200,8 +200,7 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( const GERBER_DRAW_ITEM* aGbrIt
Double2Str( MapToPcbUnits(seg_end.x) ).c_str(),
Double2Str( MapToPcbUnits(seg_end.y) ).c_str(),
TO_UTF8( GetPCBDefaultLayerName( aLayer ) ),
Double2Str( MapToPcbUnits( aGbrItem->m_Size.x ) ).c_str()
);
Double2Str( MapToPcbUnits( aGbrItem->m_Size.x ) ).c_str() );
}
else
{
@ -212,8 +211,7 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( const GERBER_DRAW_ITEM* aGbrIt
Double2Str( MapToPcbUnits(seg_end.y) ).c_str(),
Double2Str( angle ).c_str(),
TO_UTF8( GetPCBDefaultLayerName( aLayer ) ),
Double2Str( MapToPcbUnits( aGbrItem->m_Size.x ) ).c_str()
);
Double2Str( MapToPcbUnits( aGbrItem->m_Size.x ) ).c_str() );
}
}
break;
@ -369,8 +367,7 @@ void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( const GERBER_DRAW_ITEM* aGb
{
seg_start = curr_start;
wxPoint curr_end = start;
RotatePoint( &curr_end, aGbrItem->m_ArcCentre,
-RAD2DECIDEG( DELTA_ANGLE * ii ) );
RotatePoint( &curr_end, aGbrItem->m_ArcCentre, -RAD2DECIDEG( DELTA_ANGLE * ii ) );
seg_end = curr_end;
// Reverse Y axis:

View File

@ -66,9 +66,11 @@ void GERBER_DRAW_ITEM::SetNetAttributes( const GBR_NETLIST_METADATA& aNetAttribu
{
m_netAttributes = aNetAttributes;
if( ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) ||
( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_PAD ) )
if( ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP )
|| ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_PAD ) )
{
m_GerberImageFile->m_ComponentsList.insert( std::make_pair( m_netAttributes.m_Cmpref, 0 ) );
}
if( ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_NET ) )
m_GerberImageFile->m_NetnamesList.insert( std::make_pair( m_netAttributes.m_Netname, 0 ) );
@ -90,13 +92,9 @@ bool GERBER_DRAW_ITEM::GetTextD_CodePrms( int& aSize, wxPoint& aPos, double& aOr
return false; // No D_Code for this item
if( m_Flashed || m_Shape == GBR_ARC )
{
aPos = m_Start;
}
else // it is a line:
{
aPos = ( m_Start + m_End) / 2;
}
aPos = GetABPosition( aPos );
@ -227,29 +225,14 @@ wxString GERBER_DRAW_ITEM::ShowGBRShape() const
{
switch( m_Shape )
{
case GBR_SEGMENT:
return _( "Line" );
case GBR_ARC:
return _( "Arc" );
case GBR_CIRCLE:
return _( "Circle" );
case GBR_SPOT_OVAL:
return wxT( "spot_oval" );
case GBR_SPOT_CIRCLE:
return wxT( "spot_circle" );
case GBR_SPOT_RECT:
return wxT( "spot_rect" );
case GBR_SPOT_POLY:
return wxT( "spot_poly" );
case GBR_POLYGON:
return wxT( "polygon" );
case GBR_SEGMENT: return _( "Line" );
case GBR_ARC: return _( "Arc" );
case GBR_CIRCLE: return _( "Circle" );
case GBR_SPOT_OVAL: return wxT( "spot_oval" );
case GBR_SPOT_CIRCLE: return wxT( "spot_circle" );
case GBR_SPOT_RECT: return wxT( "spot_rect" );
case GBR_SPOT_POLY: return wxT( "spot_poly" );
case GBR_POLYGON: return wxT( "polygon" );
case GBR_SPOT_MACRO:
{
@ -262,8 +245,7 @@ wxString GERBER_DRAW_ITEM::ShowGBRShape() const
return name;
}
default:
return wxT( "??" );
default: return wxT( "??" );
}
}
@ -760,15 +742,19 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_
if( ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_PAD ) )
{
if( m_netAttributes.m_PadPinFunction.IsEmpty() )
{
cmp_pad_msg.Printf( _( "Cmp: %s Pad: %s" ),
m_netAttributes.m_Cmpref,
m_netAttributes.m_Padname.GetValue() );
}
else
{
cmp_pad_msg.Printf( _( "Cmp: %s Pad: %s Fct %s" ),
m_netAttributes.m_Cmpref,
m_netAttributes.m_Padname.GetValue(),
m_netAttributes.m_PadPinFunction.GetValue() );
}
}
else if( ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) )
{
@ -943,7 +929,6 @@ bool GERBER_DRAW_ITEM::HitTest( const EDA_RECT& aRefArea, bool aContained, int a
void GERBER_DRAW_ITEM::Show( int nestLevel, std::ostream& os ) const
{
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" shape=\"" << m_Shape << '"' <<
" addr=\"" << std::hex << this << std::dec << '"' <<
" layer=\"" << GetLayer() << '"' <<
@ -971,8 +956,7 @@ void GERBER_DRAW_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
const BOX2I GERBER_DRAW_ITEM::ViewBBox() const
{
EDA_RECT bbox = GetBoundingBox();
return BOX2I( VECTOR2I( bbox.GetOrigin() ),
VECTOR2I( bbox.GetSize() ) );
return BOX2I( VECTOR2I( bbox.GetOrigin() ), VECTOR2I( bbox.GetSize() ) );
}

View File

@ -22,10 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file gerber_draw_item.h
*/
#ifndef GERBER_DRAW_ITEM_H
#define GERBER_DRAW_ITEM_H
@ -50,7 +46,8 @@ namespace KIGFX
/* Shapes id for basic shapes ( .m_Shape member ) */
enum Gbr_Basic_Shapes {
enum Gbr_Basic_Shapes
{
GBR_SEGMENT = 0, // usual segment : line with rounded ends
GBR_ARC, // Arcs (with rounded ends)
GBR_CIRCLE, // ring
@ -252,6 +249,7 @@ public:
///< @copydoc EDA_ITEM::GetMenuImage()
BITMAPS GetMenuImage() const override;
public:
bool m_UnitsMetric; // store here the gerber units (inch/mm). Used
// only to calculate aperture macros shapes sizes
int m_Shape; // Shape and type of this gerber item
@ -283,6 +281,7 @@ public:
// This polygon is to draw this item (mainly GBR_POLYGON), according to layer parameters
SHAPE_POLY_SET m_AbsolutePolygon; // the polygon to draw, in absolute coordinates
private:
// These values are used to draw this item, according to gerber layers parameters
// Because they can change inside a gerber image, they are stored here
@ -300,9 +299,4 @@ private:
};
class GERBER_NEGATIVE_IMAGE_BACKDROP : public EDA_ITEM
{
};
#endif /* GERBER_DRAW_ITEM_H */

View File

@ -1,13 +1,8 @@
/**
* @file gerber_file_image.cpp
* a GERBER class handle for a given layer info about used D_CODES and how the layer is drawn
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2019 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -105,15 +100,13 @@ GERBER_FILE_IMAGE::GERBER_FILE_IMAGE( int aLayer ) :
GERBER_FILE_IMAGE::~GERBER_FILE_IMAGE()
{
for( auto item : GetItems() )
for( GERBER_DRAW_ITEM* item : GetItems() )
delete item;
m_drawings.clear();
for( unsigned ii = 0; ii < arrayDim( m_Aperture_List ); ii++ )
{
delete m_Aperture_List[ii];
}
delete m_FileFunction;
}
@ -144,9 +137,7 @@ D_CODE* GERBER_FILE_IMAGE::GetDCODE( int aDCODE ) const
unsigned ndx = aDCODE - FIRST_DCODE;
if( ndx < (unsigned) arrayDim( m_Aperture_List ) )
{
return m_Aperture_List[ndx];
}
return nullptr;
}
@ -236,14 +227,18 @@ bool GERBER_FILE_IMAGE::HasNegativeItems()
if( m_hasNegativeItems < 0 ) // negative items are not yet searched: find them if any
{
if( m_ImageNegative ) // A negative layer is expected having always negative objects.
{
m_hasNegativeItems = 1;
}
else
{
m_hasNegativeItems = 0;
for( GERBER_DRAW_ITEM* item : GetItems() )
{
if( item->GetLayer() != m_GraphicLayer )
continue;
if( item->HasNegativeItems() )
{
m_hasNegativeItems = 1;
@ -252,6 +247,7 @@ bool GERBER_FILE_IMAGE::HasNegativeItems()
}
}
}
return m_hasNegativeItems == 1;
}
@ -262,10 +258,13 @@ int GERBER_FILE_IMAGE::GetDcodesCount()
for( unsigned ii = 0; ii < arrayDim( m_Aperture_List ); ii++ )
{
if( m_Aperture_List[ii] )
{
if( m_Aperture_List[ii]->m_InUse || m_Aperture_List[ii]->m_Defined )
++count;
}
}
return count;
}
@ -295,8 +294,7 @@ void GERBER_FILE_IMAGE::InitToolTable()
*/
void GERBER_FILE_IMAGE::StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem )
{
if( GetLayerParams().m_XRepeatCount < 2 &&
GetLayerParams().m_YRepeatCount < 2 )
if( GetLayerParams().m_XRepeatCount < 2 && GetLayerParams().m_YRepeatCount < 2 )
return; // Nothing to repeat
// Duplicate item:

View File

@ -20,18 +20,14 @@
#include <kiface_base.h>
#include <pgm_base.h>
#include <eda_base_frame.h>
#include <base_units.h>
#include <bitmaps.h>
#include <wildcards_and_files_ext.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <gerbview_id.h>
#include <gerber_file_image.h>
#include <gerber_file_image_list.h>
#include <gerbview_draw_panel_gal.h>
#include <gerbview_settings.h>
#include <gal/graphics_abstraction_layer.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <settings/settings_manager.h>
#include <tool/tool_manager.h>
@ -50,7 +46,6 @@
#include <view/view.h>
#include <base_screen.h>
#include <gerbview_painter.h>
#include <widgets/msgpanel.h>
#include <wx/wupdlock.h>
#include "widgets/gbr_layer_box_selector.h"
@ -412,7 +407,7 @@ void GERBVIEW_FRAME::SetElementVisibility( int aLayerID, bool aNewState )
view->UpdateAllItemsConditionally( KIGFX::REPAINT, []( KIGFX::VIEW_ITEM* aItem )
{
auto item = dynamic_cast<GERBER_DRAW_ITEM*>( aItem );
GERBER_DRAW_ITEM* item = dynamic_cast<GERBER_DRAW_ITEM*>( aItem );
// GetLayerPolarity() returns true for negative items
return ( item && item->GetLayerPolarity() );
@ -513,11 +508,10 @@ void GERBVIEW_FRAME::SortLayersByX2Attributes()
std::unordered_map<int, int> view_remapping;
for( auto it : remapping )
for( const std::pair<const int, int>& entry : remapping )
{
view_remapping[ GERBER_DRAW_LAYER( it.first) ] = GERBER_DRAW_LAYER( it.second );
view_remapping[ GERBER_DCODE_LAYER( GERBER_DRAW_LAYER( it.first) ) ] =
GERBER_DCODE_LAYER( GERBER_DRAW_LAYER( it.second ) );
view_remapping[ entry.first ] = GERBER_DRAW_LAYER( entry.second );
view_remapping[ GERBER_DCODE_LAYER( entry.first ) ] = GERBER_DCODE_LAYER( entry.second );
}
GetCanvas()->GetView()->ReorderLayerData( view_remapping );
@ -530,7 +524,7 @@ void GERBVIEW_FRAME::UpdateDiffLayers()
auto target = GetCanvas()->GetBackend() == GERBVIEW_DRAW_PANEL_GAL::GAL_TYPE_OPENGL
? KIGFX::TARGET_CACHED
: KIGFX::TARGET_NONCACHED;
auto view = GetCanvas()->GetView();
KIGFX::VIEW* view = GetCanvas()->GetView();
int lastVisibleLayer = -1;

View File

@ -659,15 +659,12 @@ void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aT
}
for( DRC_TEST_PROVIDER* provider : m_testProviders )
{
if( provider->IsEnabled() )
{
ReportAux( wxString::Format( "Run DRC provider: '%s'", provider->GetName() ) );
if( !provider->Run() )
break;
}
}
}

View File

@ -89,16 +89,6 @@ public:
virtual const wxString GetName() const;
virtual const wxString GetDescription() const;
bool IsEnabled() const
{
return m_enabled;
}
void Enable( bool aEnable )
{
m_enabled = aEnable;
}
protected:
int forEachGeometryItem( const std::vector<KICAD_T>& aTypes, LSET aLayers,
const std::function<bool(BOARD_ITEM*)>& aFunc );
@ -122,7 +112,6 @@ protected:
DRC_ENGINE* m_drcEngine;
std::unordered_map<const DRC_RULE*, int> m_stats;
bool m_isRuleDriven = true;
bool m_enabled = true;
wxString m_msg; // Allocating strings gets expensive enough to want to avoid it
};

View File

@ -38,9 +38,6 @@
- DRCE_DISABLED_LAYER_ITEM, ///< item on a disabled layer
- DRCE_INVALID_OUTLINE, ///< invalid board outline
- DRCE_UNRESOLVED_VARIABLE,
TODO:
- if grows too big, split into separate providers
*/
class DRC_TEST_PROVIDER_MISC : public DRC_TEST_PROVIDER

View File

@ -22,7 +22,6 @@
*/
#include <pcb_edit_frame.h>
#include <bitmaps.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/pcb_tool_base.h>

View File

@ -1473,8 +1473,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
// If rotating a group, record position of all the descendants for undo
if( item->Type() == PCB_GROUP_T )
{
static_cast<PCB_GROUP*>( item )->RunOnDescendants(
[&]( BOARD_ITEM* bItem )
static_cast<PCB_GROUP*>( item )->RunOnDescendants( [&]( BOARD_ITEM* bItem )
{
m_commit->Modify( bItem );
});
@ -2204,7 +2203,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent )
}
// Be sure that there is at least one item that we can modify
const auto& selection = m_selectionTool->RequestSelection(
const PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
sTool->FilterCollectorForMarkers( aCollector );