Commenting and formatting. No functional changes.

This commit is contained in:
Jeff Young 2023-03-13 11:25:30 +00:00
parent 664e5629f2
commit 0fb1ccff21
9 changed files with 50 additions and 114 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2018 Jean-Pierre Charras <jp.charras at wanadoo.fr>. * Copyright (C) 1992-2018 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -137,23 +137,6 @@ void DS_DATA_MODEL::Remove( DS_DATA_ITEM* aItem )
} }
int DS_DATA_MODEL::GetItemIndex( DS_DATA_ITEM* aItem ) const
{
unsigned idx = 0;
while( idx < m_list.size() )
{
if( m_list[idx] == aItem )
return (int) idx;
idx++;
}
return -1;
}
/* return the item from its index aIdx, or NULL if does not exist
*/
DS_DATA_ITEM* DS_DATA_MODEL::GetItem( unsigned aIdx ) const DS_DATA_ITEM* DS_DATA_MODEL::GetItem( unsigned aIdx ) const
{ {
if( aIdx < m_list.size() ) if( aIdx < m_list.size() )

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -38,21 +38,13 @@ wxString GetDefaultPlotExtension( PLOT_FORMAT aFormat )
{ {
switch( aFormat ) switch( aFormat )
{ {
case PLOT_FORMAT::DXF: case PLOT_FORMAT::DXF: return DXF_PLOTTER::GetDefaultFileExtension();
return DXF_PLOTTER::GetDefaultFileExtension(); case PLOT_FORMAT::POST: return PS_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::POST: case PLOT_FORMAT::PDF: return PDF_PLOTTER::GetDefaultFileExtension();
return PS_PLOTTER::GetDefaultFileExtension(); case PLOT_FORMAT::HPGL: return HPGL_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::PDF: case PLOT_FORMAT::GERBER: return GERBER_PLOTTER::GetDefaultFileExtension();
return PDF_PLOTTER::GetDefaultFileExtension(); case PLOT_FORMAT::SVG: return SVG_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::HPGL: default: wxFAIL; return wxEmptyString;
return HPGL_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::GERBER:
return GERBER_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::SVG:
return SVG_PLOTTER::GetDefaultFileExtension();
default:
wxASSERT( false );
return wxEmptyString;
} }
} }
@ -174,7 +166,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
break; break;
bitmap->m_ImageBitmap->PlotImage( plotter, drawItem->GetPosition(), plotColor, bitmap->m_ImageBitmap->PlotImage( plotter, drawItem->GetPosition(), plotColor,
PLOTTER::USE_DEFAULT_LINE_WIDTH ); PLOTTER::USE_DEFAULT_LINE_WIDTH );
} }
break; break;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -114,11 +114,6 @@ public:
void Append( DS_DATA_ITEM* aItem ); void Append( DS_DATA_ITEM* aItem );
void Remove( DS_DATA_ITEM* aItem ); void Remove( DS_DATA_ITEM* aItem );
/**
* @return the index of aItem, or -1 if does not exist.
*/
int GetItemIndex( DS_DATA_ITEM* aItem ) const;
/** /**
* @return is the item from its index \a aIdx, or NULL if does not exist. * @return is the item from its index \a aIdx, or NULL if does not exist.
*/ */

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -109,6 +109,7 @@ protected:
m_flags = 0; m_flags = 0;
} }
protected:
DS_DATA_ITEM* m_peer; // the parent DS_DATA_ITEM item in the DS_DATA_MODEL DS_DATA_ITEM* m_peer; // the parent DS_DATA_ITEM item in the DS_DATA_MODEL
int m_index; // the index in the parent's repeat count int m_index; // the index in the parent's repeat count
int m_penWidth; int m_penWidth;
@ -194,7 +195,6 @@ public:
*/ */
SHAPE_POLY_SET m_Polygons; SHAPE_POLY_SET m_Polygons;
private: private:
VECTOR2I m_pos; // position of reference point, from the DS_DATA_ITEM_POLYGONS parent VECTOR2I m_pos; // position of reference point, from the DS_DATA_ITEM_POLYGONS parent
// (used only in drawing sheet editor to draw anchors) // (used only in drawing sheet editor to draw anchors)
@ -287,9 +287,9 @@ public:
#endif #endif
private: private:
VECTOR2I m_markerPos; // position of the marker VECTOR2I m_markerPos; // position of the marker
VECTOR2I m_pageSize; // full size of the page VECTOR2I m_pageSize; // full size of the page
double m_markerSize; double m_markerSize;
}; };
@ -500,11 +500,6 @@ public:
return nullptr; return nullptr;
} }
void GetAllItems( std::vector<DS_DRAW_ITEM_BASE*>* aList )
{
*aList = m_graphicList;
}
/** /**
* Draws the item list created by BuildDrawItemsList * Draws the item list created by BuildDrawItemsList
*/ */

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -129,8 +129,8 @@ private:
* *
* @param aDC The device context. * @param aDC The device context.
* @param aPageInfo for margins and page size (in mils). * @param aPageInfo for margins and page size (in mils).
* @param aSheetName The sheet name, for basic inscriptions. * @param aSheetName The sheet name, for basic inscriptions.
* @param aSheetPath The sheetpath (full sheet name), for basic inscriptions. * @param aSheetPath The sheetpath (full sheet name), for basic inscriptions.
* @param aFileName The file name, for basic inscriptions. * @param aFileName The file name, for basic inscriptions.
* @param aTitleBlock The sheet title block, for text variable resolution. * @param aTitleBlock The sheet title block, for text variable resolution.
* @param aProperties Optional properties for text variable resolution. * @param aProperties Optional properties for text variable resolution.

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -88,19 +88,13 @@ public:
* Can be used to override which layer ID is used for drawing sheet item colors * Can be used to override which layer ID is used for drawing sheet item colors
* @param aLayerId is the color to use (defaults to LAYER_DRAWINGSHEET if this is not called) * @param aLayerId is the color to use (defaults to LAYER_DRAWINGSHEET if this is not called)
*/ */
void SetColorLayer( int aLayerId ) void SetColorLayer( int aLayerId ) { m_colorLayer = aLayerId; }
{
m_colorLayer = aLayerId;
}
/** /**
* Overrides the layer used to pick the color of the page border (normally LAYER_GRID) * Overrides the layer used to pick the color of the page border (normally LAYER_GRID)
* @param aLayerId is the layer to use * @param aLayerId is the layer to use
*/ */
void SetPageBorderColorLayer( int aLayerId ) void SetPageBorderColorLayer( int aLayerId ) { m_pageBorderColorLayer = aLayerId; }
{
m_pageBorderColorLayer = aLayerId;
}
const PAGE_INFO& GetPageInfo() { return *m_pageInfo; } const PAGE_INFO& GetPageInfo() { return *m_pageInfo; }
const TITLE_BLOCK& GetTitleBlock() { return *m_titleBlock; } const TITLE_BLOCK& GetTitleBlock() { return *m_titleBlock; }
@ -133,6 +127,7 @@ protected:
void buildDrawList( KIGFX::VIEW* aView, const std::map<wxString, wxString>* aProperties, void buildDrawList( KIGFX::VIEW* aView, const std::map<wxString, wxString>* aProperties,
DS_DRAW_ITEM_LIST* aDrawList ) const; DS_DRAW_ITEM_LIST* aDrawList ) const;
protected:
/// the factor between mils (units used in drawing sheet and internal units) /// the factor between mils (units used in drawing sheet and internal units)
/// it is the value IU_PER_MILS used in the caller /// it is the value IU_PER_MILS used in the caller
int m_mils2IUscalefactor; int m_mils2IUscalefactor;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018 CERN * Copyright (C) 2018 CERN
* Author: Maciej Suminski <maciej.suminski@cern.ch> * Author: Maciej Suminski <maciej.suminski@cern.ch>
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
@ -37,8 +37,8 @@
#include <advanced_config.h> #include <advanced_config.h>
PCBNEW_PRINTOUT_SETTINGS::PCBNEW_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo ) PCBNEW_PRINTOUT_SETTINGS::PCBNEW_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo ) :
: BOARD_PRINTOUT_SETTINGS( aPageInfo ) BOARD_PRINTOUT_SETTINGS( aPageInfo )
{ {
m_DrillMarks = DRILL_MARKS::SMALL_DRILL_SHAPE; m_DrillMarks = DRILL_MARKS::SMALL_DRILL_SHAPE;
m_Pagination = ALL_LAYERS; m_Pagination = ALL_LAYERS;
@ -77,7 +77,7 @@ void PCBNEW_PRINTOUT_SETTINGS::Save( APP_SETTINGS_BASE* aConfig )
PCBNEW_PRINTOUT::PCBNEW_PRINTOUT( BOARD* aBoard, const PCBNEW_PRINTOUT_SETTINGS& aParams, PCBNEW_PRINTOUT::PCBNEW_PRINTOUT( BOARD* aBoard, const PCBNEW_PRINTOUT_SETTINGS& aParams,
const KIGFX::VIEW* aView, const wxString& aTitle ) : const KIGFX::VIEW* aView, const wxString& aTitle ) :
BOARD_PRINTOUT( aParams, aView, aTitle ), m_pcbnewSettings( aParams ) BOARD_PRINTOUT( aParams, aView, aTitle ), m_pcbnewSettings( aParams )
{ {
m_board = aBoard; m_board = aBoard;
} }
@ -309,19 +309,10 @@ int KIGFX::PCB_PRINT_PAINTER::getDrillShape( const PAD* aPad ) const
SHAPE_SEGMENT KIGFX::PCB_PRINT_PAINTER::getPadHoleShape( const PAD* aPad ) const SHAPE_SEGMENT KIGFX::PCB_PRINT_PAINTER::getPadHoleShape( const PAD* aPad ) const
{ {
SHAPE_SEGMENT segm;
if( m_drillMarkReal ) if( m_drillMarkReal )
{ return KIGFX::PCB_PAINTER::getPadHoleShape( aPad );
segm = KIGFX::PCB_PAINTER::getPadHoleShape( aPad );
}
else else
{ return SHAPE_SEGMENT( aPad->GetPosition(), aPad->GetPosition(), m_drillMarkSize );
segm = SHAPE_SEGMENT( aPad->GetPosition(),
aPad->GetPosition(), m_drillMarkSize );
}
return segm;
} }

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2018 CERN * Copyright (C) 2018 CERN
* Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -50,7 +50,7 @@ class PCBNEW_PRINTOUT : public BOARD_PRINTOUT
{ {
public: public:
PCBNEW_PRINTOUT( BOARD* aBoard, const PCBNEW_PRINTOUT_SETTINGS& aParams, PCBNEW_PRINTOUT( BOARD* aBoard, const PCBNEW_PRINTOUT_SETTINGS& aParams,
const KIGFX::VIEW* aView, const wxString& aTitle ); const KIGFX::VIEW* aView, const wxString& aTitle );
bool OnPrintPage( int aPage ) override; bool OnPrintPage( int aPage ) override;
@ -68,8 +68,7 @@ protected:
std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) override; std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) override;
private: private:
BOARD* m_board; BOARD* m_board;
PCBNEW_PRINTOUT_SETTINGS m_pcbnewSettings; PCBNEW_PRINTOUT_SETTINGS m_pcbnewSettings;
}; };
@ -104,11 +103,9 @@ protected:
int getViaDrillSize( const PCB_VIA* aVia ) const override; int getViaDrillSize( const PCB_VIA* aVia ) const override;
///< Flag deciding whether use the actual hole size or user-specified size for drill marks protected:
bool m_drillMarkReal; bool m_drillMarkReal; ///< Actual hole size or user-specified size for drill marks
int m_drillMarkSize; ///< User-specified size (in internal units)
///< User-specified size for drill marks (expressed in internal units)
int m_drillMarkSize;
}; };
}; // namespace KIGFX }; // namespace KIGFX

View File

@ -726,8 +726,8 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
for( int kk = 0; kk <= outlines.HoleCount(ii); kk++ ) for( int kk = 0; kk <= outlines.HoleCount(ii); kk++ )
{ {
cornerList.clear(); cornerList.clear();
const SHAPE_LINE_CHAIN& path = const SHAPE_LINE_CHAIN& path = ( kk == 0 ) ? outlines.COutline( ii )
( kk == 0 ) ? outlines.COutline( ii ) : outlines.CHole( ii, kk - 1 ); : outlines.CHole( ii, kk - 1 );
aPlotter->PlotPoly( path, FILL_T::NO_FILL ); aPlotter->PlotPoly( path, FILL_T::NO_FILL );
} }
@ -737,8 +737,8 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
if( aPlotOpt.GetDrillMarksType() != DRILL_MARKS::NO_DRILL_SHAPE ) if( aPlotOpt.GetDrillMarksType() != DRILL_MARKS::NO_DRILL_SHAPE )
{ {
int smallDrill = ( aPlotOpt.GetDrillMarksType() == DRILL_MARKS::SMALL_DRILL_SHAPE ) int smallDrill = ( aPlotOpt.GetDrillMarksType() == DRILL_MARKS::SMALL_DRILL_SHAPE )
? pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize ) : ? pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize )
INT_MAX; : INT_MAX;
for( FOOTPRINT* footprint : aBoard->Footprints() ) for( FOOTPRINT* footprint : aBoard->Footprints() )
{ {
@ -756,8 +756,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
else else
{ {
// Note: small drill marks have no significance when applied to slots // Note: small drill marks have no significance when applied to slots
aPlotter->ThickSegment( slot->GetSeg().A, aPlotter->ThickSegment( slot->GetSeg().A, slot->GetSeg().B,
slot->GetSeg().B,
slot->GetWidth(), SKETCH, nullptr ); slot->GetWidth(), SKETCH, nullptr );
} }
} }
@ -782,26 +781,16 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
* *
* Solder mask layers have a minimum thickness value and cannot be drawn like standard layers, * Solder mask layers have a minimum thickness value and cannot be drawn like standard layers,
* unless the minimum thickness is 0. * unless the minimum thickness is 0.
* Currently the algo is:
* 1 - build all pad shapes as polygons with a size inflated by
* mask clearance + (min width solder mask /2)
* 2 - Merge shapes
* 3 - deflate result by (min width solder mask /2)
* 4 - ORing result by all pad shapes as polygons with a size inflated by
* mask clearance only (because deflate sometimes creates shape artifacts)
* 5 - draw result as polygons
* *
* The algorithm is somewhat complicated to allow for min web thickness while also preserving * The algorithm is somewhat complicated to allow for min web thickness while also preserving
* pad attributes in Gerber. * pad attributes in Gerber.
* *
* create initial polygons for every shape (pad or polygon), * 1 - create initial polygons for every shape
* inflate and deflate polygons * 2 - inflate and deflate polygons with Min Thickness/2, and merges the result
* with Min Thickness/2, and merges the result (like initial algo) * 3 - substract all initial polygons from (2), leaving the areas where the thickness was less
* remove all initial polygons. * than min thickness
* The remaining polygons are areas with thickness < min thickness * 4 - plot all initial shapes by flashing (or using regions), including Gerber attribute data
* plot all initial shapes by flashing (or using regions) for pad and polygons * 5 - plot remaining polygons from (2) (witout any Gerber attributes)
* (shapes will be better) and remaining polygons to
* remove areas with thickness < min thickness from final mask
*/ */
void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
@ -827,9 +816,8 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
// Extra margin is half the min width for solder mask, which is used to merge too-close shapes // Extra margin is half the min width for solder mask, which is used to merge too-close shapes
// (distance < aMinThickness), and will be removed when creating the actual shapes. // (distance < aMinThickness), and will be removed when creating the actual shapes.
// Will contain shapes inflated by inflate value that will be merged and deflated by // Will contain shapes inflated by inflate value that will be merged and deflated by inflate
// inflate value to build final polygons // value to build final polygons
// After calculations the remaining polygons are polygons to plot
SHAPE_POLY_SET areas; SHAPE_POLY_SET areas;
// Will contain exact shapes of all items on solder mask // Will contain exact shapes of all items on solder mask
@ -972,8 +960,8 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
int numSegs = GetArcToSegmentCount( inflate, maxError, FULL_CIRCLE ); int numSegs = GetArcToSegmentCount( inflate, maxError, FULL_CIRCLE );
// Merge all polygons: After deflating, not merged (not overlapping) polygons // Merge all polygons: After deflating, not merged (not overlapping) polygons will have the
// will have the initial shape (with perhaps small changes due to deflating transform) // initial shape (with perhaps small changes due to deflating transform)
areas.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); areas.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
areas.Deflate( inflate, numSegs ); areas.Deflate( inflate, numSegs );