Plot solder mask layer: fix incorrect margin of zones drawn on this layer (zone areas were slighly larger than the actual areas)

Fix a few  minor and very minor other issues: coverity warnings and compil warning.
This commit is contained in:
jean-pierre charras 2015-08-01 12:20:23 +02:00
parent 75d02086ad
commit 4b4d9d9770
7 changed files with 24 additions and 14 deletions

View File

@ -90,6 +90,7 @@ void MARKER_BASE::init()
MARKER_BASE::MARKER_BASE( const MARKER_BASE& aMarker ) MARKER_BASE::MARKER_BASE( const MARKER_BASE& aMarker )
{ {
m_Pos = aMarker.m_Pos; m_Pos = aMarker.m_Pos;
m_ErrorLevel = aMarker.m_ErrorLevel;
m_MarkerType = aMarker.m_MarkerType; m_MarkerType = aMarker.m_MarkerType;
m_Color = aMarker.m_Color; m_Color = aMarker.m_Color;
m_ShapeBoundingBox = aMarker.m_ShapeBoundingBox; m_ShapeBoundingBox = aMarker.m_ShapeBoundingBox;

View File

@ -254,8 +254,7 @@ public:
{ {
if( aIndex < 0 ) if( aIndex < 0 )
aIndex += PointCount(); aIndex += PointCount();
else if( aIndex >= PointCount() )
if( aIndex >= PointCount() )
aIndex -= PointCount(); aIndex -= PointCount();
return m_points[aIndex]; return m_points[aIndex];

View File

@ -1,9 +1,9 @@
/* /*
* 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) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2015 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
@ -108,7 +108,7 @@ void TEXTE_MODULE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
// the mirror is around the Y axis or X axis if aMirrorAroundXAxis = true // the mirror is around the Y axis or X axis if aMirrorAroundXAxis = true
// the position is mirrored, but the text itself is not mirrored // the position is mirrored, but the text itself is not mirrored
if( aMirrorAroundXAxis ) if( aMirrorAroundXAxis )
MIRROR( m_Pos.x, aCentre.x ); MIRROR( m_Pos.y, aCentre.y );
else else
MIRROR( m_Pos.x, aCentre.x ); MIRROR( m_Pos.x, aCentre.x );
NEGATE_AND_NORMALIZE_ANGLE_POS( m_Orient ); NEGATE_AND_NORMALIZE_ANGLE_POS( m_Orient );

View File

@ -647,7 +647,9 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt ); BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt );
itemplotter.SetLayerSet( aLayerMask ); itemplotter.SetLayerSet( aLayerMask );
// Plot edge layer and graphic items // Plot edge layer and graphic items
// They do not have a solder Mask margin, because they are only graphic items
// on this layer (like logos), not actually areas around pads.
itemplotter.PlotBoardGraphicItems(); itemplotter.PlotBoardGraphicItems();
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() ) for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
@ -677,8 +679,8 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
// This extra margin is used to merge too close shapes // This extra margin is used to merge too close shapes
// (distance < aMinThickness), and will be removed when creating // (distance < aMinThickness), and will be removed when creating
// the actual shapes // the actual shapes
SHAPE_POLY_SET areas; // Contains shapes to plot SHAPE_POLY_SET areas; // Contains shapes to plot
SHAPE_POLY_SET initialPolys; // Contains exact shapes to plot SHAPE_POLY_SET initialPolys; // Contains exact shapes to plot
/* calculates the coeff to compensate radius reduction of holes clearance /* calculates the coeff to compensate radius reduction of holes clearance
* due to the segment approx ( 1 /cos( PI/circleToSegmentsCount ) * due to the segment approx ( 1 /cos( PI/circleToSegmentsCount )
@ -736,7 +738,13 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
} }
} }
// Add filled zone areas // Add filled zone areas.
#if 0 // Set to 1 if a solder mask margin must be applied to zones on solder mask
int zone_margin = aBoard->GetDesignSettings().m_SolderMaskMargin;
#else
int zone_margin = 0;
#endif
for( int ii = 0; ii < aBoard->GetAreaCount(); ii++ ) for( int ii = 0; ii < aBoard->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* zone = aBoard->GetArea( ii ); ZONE_CONTAINER* zone = aBoard->GetArea( ii );
@ -745,9 +753,9 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
continue; continue;
zone->TransformOutlinesShapeWithClearanceToPolygon( areas, zone->TransformOutlinesShapeWithClearanceToPolygon( areas,
inflate, true ); inflate+zone_margin, false );
zone->TransformOutlinesShapeWithClearanceToPolygon( initialPolys, zone->TransformOutlinesShapeWithClearanceToPolygon( initialPolys,
0, true ); zone_margin, false );
} }
// To avoid a lot of code, use a ZONE_CONTAINER // To avoid a lot of code, use a ZONE_CONTAINER

View File

@ -95,7 +95,8 @@ void PCB_EDIT_FRAME::InstallExchangeModuleFrame( MODULE* Module )
{ {
DIALOG_EXCHANGE_MODULE dialog( this, Module ); DIALOG_EXCHANGE_MODULE dialog( this, Module );
dialog.ShowQuasiModal(); int ret = dialog.ShowQuasiModal();
(void) ret; // make coverity quiet.
} }

View File

@ -56,7 +56,7 @@ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
// add clearance to outline // add clearance to outline
int clearance = aMinClearanceValue; int clearance = aMinClearanceValue;
if( aUseNetClearance ) if( aUseNetClearance && IsOnCopperLayer() )
{ {
clearance = GetClearance(); clearance = GetClearance();
if( aMinClearanceValue > clearance ) if( aMinClearanceValue > clearance )

View File

@ -1097,7 +1097,8 @@ int gm_print( FILE* f, greymap_t* gm )
} }
} }
fputc( "*#=- "[5 * d / t], f ); /* what a cute trick :) */ if( t )
fputc( "*#=- "[5 * d / t], f ); /* what a cute trick :) */
} }
fputc( '\n', f ); fputc( '\n', f );