Browse Source

Coverity fixes and code cleaning.

newinvert
Wayne Stambaugh 3 years ago
parent
commit
a1fb8e1b1d
  1. 7
      eeschema/dialogs/dialog_lib_text_properties.cpp
  2. 11
      eeschema/sch_edit_frame.cpp
  3. 24
      eeschema/tools/sch_move_tool.cpp
  4. 15
      pagelayout_editor/tools/pl_edit_tool.cpp
  5. 21
      pagelayout_editor/tools/pl_point_editor.cpp
  6. 6
      pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp
  7. 10
      pcbnew/pcb_track.cpp
  8. 120
      pcbnew/pcb_track.h
  9. 2
      pcbnew/router/pns_kicad_iface.cpp

7
eeschema/dialogs/dialog_lib_text_properties.cpp

@ -122,6 +122,8 @@ DIALOG_LIB_TEXT_PROPERTIES::~DIALOG_LIB_TEXT_PROPERTIES()
bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow() bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow()
{ {
wxCHECK( m_CommonUnit, false );
LIB_SYMBOL* symbol = nullptr; LIB_SYMBOL* symbol = nullptr;
if( m_graphicText ) if( m_graphicText )
@ -170,10 +172,11 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow()
auto* tools = m_parent->GetToolManager()->GetTool<SYMBOL_EDITOR_DRAWING_TOOLS>(); auto* tools = m_parent->GetToolManager()->GetTool<SYMBOL_EDITOR_DRAWING_TOOLS>();
symbol = m_parent->GetCurSymbol(); symbol = m_parent->GetCurSymbol();
wxCHECK( cfg && symbol && tools, false );
m_textSize.SetValue( schIUScale.MilsToIU( cfg->m_Defaults.text_size ) ); m_textSize.SetValue( schIUScale.MilsToIU( cfg->m_Defaults.text_size ) );
m_CommonUnit->SetValue(
symbol && symbol->GetUnitCount() > 1 && !tools->GetDrawSpecificUnit() );
m_CommonUnit->SetValue( symbol->GetUnitCount() > 1 && !tools->GetDrawSpecificUnit() );
m_CommonConvert->SetValue( !tools->GetDrawSpecificConvert() ); m_CommonConvert->SetValue( !tools->GetDrawSpecificConvert() );
if( tools->GetLastTextAngle().IsHorizontal() ) if( tools->GetLastTextAngle().IsHorizontal() )

11
eeschema/sch_edit_frame.cpp

@ -1990,18 +1990,18 @@ void SCH_EDIT_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpda
void SCH_EDIT_FRAME::DisplayCurrentSheet() void SCH_EDIT_FRAME::DisplayCurrentSheet()
{ {
wxCHECK( m_toolManager, /* void */ );
m_toolManager->RunAction( ACTIONS::cancelInteractive, true ); m_toolManager->RunAction( ACTIONS::cancelInteractive, true );
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true ); m_toolManager->RunAction( EE_ACTIONS::clearSelection, true );
SCH_SCREEN* screen = GetCurrentSheet().LastScreen(); SCH_SCREEN* screen = GetCurrentSheet().LastScreen();
wxASSERT( screen );
wxCHECK( screen, /* void */ );
if( m_toolManager )
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true ); m_toolManager->RunAction( EE_ACTIONS::clearSelection, true );
SCH_BASE_FRAME::SetScreen( screen ); SCH_BASE_FRAME::SetScreen( screen );
if( m_toolManager )
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
// update the References // update the References
@ -2011,6 +2011,8 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>(); EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
wxCHECK( selectionTool, /* void */ );
auto visit = auto visit =
[&]( EDA_ITEM* item ) [&]( EDA_ITEM* item )
{ {
@ -2058,6 +2060,9 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
SCH_EDITOR_CONTROL* editTool = m_toolManager->GetTool<SCH_EDITOR_CONTROL>(); SCH_EDITOR_CONTROL* editTool = m_toolManager->GetTool<SCH_EDITOR_CONTROL>();
wxCHECK( editTool, /* void */ );
TOOL_EVENT dummy; TOOL_EVENT dummy;
editTool->UpdateNetHighlighting( dummy ); editTool->UpdateNetHighlighting( dummy );

24
eeschema/tools/sch_move_tool.cpp

@ -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) 2019 CERN * Copyright (C) 2019 CERN
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019-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
@ -192,6 +192,7 @@ void SCH_MOVE_TOOL::orthoLineDrag( SCH_LINE* line, const VECTOR2I& splitDelta, i
// start point to be attached to the unselected end of our drag line). // start point to be attached to the unselected end of our drag line).
// //
// Also, new lines are added already so they'll be in the undo list, skip adding them. // Also, new lines are added already so they'll be in the undo list, skip adding them.
if( !foundLine->HasFlag( IS_CHANGED ) && !foundLine->HasFlag( IS_NEW ) ) if( !foundLine->HasFlag( IS_CHANGED ) && !foundLine->HasFlag( IS_NEW ) )
{ {
saveCopyInUndoList( (SCH_ITEM*) foundLine, UNDO_REDO::CHANGED, true ); saveCopyInUndoList( (SCH_ITEM*) foundLine, UNDO_REDO::CHANGED, true );
@ -207,7 +208,6 @@ void SCH_MOVE_TOOL::orthoLineDrag( SCH_LINE* line, const VECTOR2I& splitDelta, i
updateItem( foundLine, true ); updateItem( foundLine, true );
SCH_LINE* bendLine = nullptr; SCH_LINE* bendLine = nullptr;
if( m_lineConnectionCache.count( foundLine ) == 1 if( m_lineConnectionCache.count( foundLine ) == 1
@ -362,16 +362,22 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
m_anchorPos.reset(); m_anchorPos.reset();
if( aEvent.IsAction( &EE_ACTIONS::move ) ) if( aEvent.IsAction( &EE_ACTIONS::move ) )
{
m_isDrag = false; m_isDrag = false;
}
else if( aEvent.IsAction( &EE_ACTIONS::drag ) ) else if( aEvent.IsAction( &EE_ACTIONS::drag ) )
{ {
m_isDrag = true; m_isDrag = true;
isSlice = aEvent.Parameter<bool>(); isSlice = aEvent.Parameter<bool>();
} }
else if( aEvent.IsAction( &EE_ACTIONS::moveActivate ) ) else if( aEvent.IsAction( &EE_ACTIONS::moveActivate ) )
{
m_isDrag = !cfg->m_Input.drag_is_move; m_isDrag = !cfg->m_Input.drag_is_move;
}
else else
{
return 0; return 0;
}
if( m_moveInProgress ) if( m_moveInProgress )
{ {
@ -383,7 +389,17 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
{ {
// Reset the selected items so we can start again with the current m_isDrag // Reset the selected items so we can start again with the current m_isDrag
// state. // state.
try
{
m_frame->RollbackSchematicFromUndo(); m_frame->RollbackSchematicFromUndo();
}
catch( const IO_ERROR& exc )
{
wxLogWarning( wxS( "Exception \"%s\" rolling back schematic undo ocurred." ),
exc.What() );
return 1;
}
m_selectionTool->RemoveItemsFromSel( &m_dragAdditions, QUIET_MODE ); m_selectionTool->RemoveItemsFromSel( &m_dragAdditions, QUIET_MODE );
m_anchorPos = m_cursor - m_moveOffset; m_anchorPos = m_cursor - m_moveOffset;
m_moveInProgress = false; m_moveInProgress = false;
@ -417,6 +433,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
std::vector<DANGLING_END_ITEM> internalPoints; std::vector<DANGLING_END_ITEM> internalPoints;
Activate(); Activate();
// Must be done after Activate() so that it gets set into the correct context // Must be done after Activate() so that it gets set into the correct context
controls->ShowCursor( true ); controls->ShowCursor( true );
@ -971,7 +988,8 @@ void SCH_MOVE_TOOL::trimDanglingLines()
// Delete newly dangling lines: // Delete newly dangling lines:
// Find split segments (one segment is new, the other is changed) that // Find split segments (one segment is new, the other is changed) that
// we aren't dragging and don't have selected // we aren't dragging and don't have selected
if( aChangedItem->HasFlag( IS_BROKEN) && aChangedItem->IsDangling() && !aChangedItem->IsSelected() )
if( aChangedItem->HasFlag( IS_BROKEN) && aChangedItem->IsDangling()
&& !aChangedItem->IsSelected() )
{ {
danglers.insert( aChangedItem ); danglers.insert( aChangedItem );
} }

15
pagelayout_editor/tools/pl_edit_tool.cpp

@ -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) 2019 CERN * Copyright (C) 2019 CERN
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019-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
@ -22,6 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <fmt/format.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/picker_tool.h> #include <tool/picker_tool.h>
#include <drawing_sheet/ds_data_item.h> #include <drawing_sheet/ds_data_item.h>
@ -131,7 +133,18 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
VECTOR2I prevPos; VECTOR2I prevPos;
if( !selection.Front()->IsNew() ) if( !selection.Front()->IsNew() )
{
try
{
m_frame->SaveCopyInUndoList(); m_frame->SaveCopyInUndoList();
}
catch( const fmt::v9::format_error& exc )
{
wxLogWarning( wxS( "Exception \"%s\" serializing string ocurred." ),
exc.what() );
return 1;
}
}
// Main loop: keep receiving events // Main loop: keep receiving events
do do

21
pagelayout_editor/tools/pl_point_editor.cpp

@ -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) 2019 CERN * Copyright (C) 2019 CERN
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019-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
@ -25,6 +25,8 @@
#include <functional> #include <functional>
using namespace std::placeholders; using namespace std::placeholders;
#include <fmt/format.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/actions.h> #include <tool/actions.h>
#include <view/view_controls.h> #include <view/view_controls.h>
@ -45,11 +47,13 @@ enum RECTANGLE_POINTS
RECT_TOPLEFT, RECT_TOPRIGHT, RECT_BOTLEFT, RECT_BOTRIGHT RECT_TOPLEFT, RECT_TOPRIGHT, RECT_BOTLEFT, RECT_BOTRIGHT
}; };
enum LINE_POINTS enum LINE_POINTS
{ {
LINE_START, LINE_END LINE_START, LINE_END
}; };
class EDIT_POINTS_FACTORY class EDIT_POINTS_FACTORY
{ {
public: public:
@ -187,8 +191,18 @@ int PL_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
if( evt->IsDrag( BUT_LEFT ) && m_editedPoint ) if( evt->IsDrag( BUT_LEFT ) && m_editedPoint )
{ {
if( !inDrag ) if( !inDrag )
{
try
{ {
m_frame->SaveCopyInUndoList(); m_frame->SaveCopyInUndoList();
}
catch( const fmt::v9::format_error& exc )
{
wxLogWarning( wxS( "Exception \"%s\" serializing string ocurred." ),
exc.what() );
return 1;
}
controls->ForceCursorPosition( false ); controls->ForceCursorPosition( false );
inDrag = true; inDrag = true;
modified = true; modified = true;
@ -215,14 +229,17 @@ int PL_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
modified = false; modified = false;
} }
else if( evt->IsCancelInteractive() ) else if( evt->IsCancelInteractive() )
{
break; break;
}
if( evt->IsActivate() && !evt->IsMoveTool() ) if( evt->IsActivate() && !evt->IsMoveTool() )
break; break;
} }
else else
{
evt->SetPassEvent(); evt->SetPassEvent();
}
controls->SetAutoPan( inDrag ); controls->SetAutoPan( inDrag );
controls->CaptureCursor( inDrag ); controls->CaptureCursor( inDrag );

6
pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp

@ -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) 2004-2022 KiCad Developers.
* Copyright (C) 2004-2023 KiCad Developers.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@ -497,7 +497,9 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
{ {
for( DIFF_PAIR_COUPLED_SEGMENTS& dp : itemSet.coupled ) for( DIFF_PAIR_COUPLED_SEGMENTS& dp : itemSet.coupled )
{ {
if( ( dp.couplingFailMin || dp.couplingFailMax ) && ( dp.parentP || dp.parentN ) )
wxCHECK2( dp.parentP && dp.parentN, continue );
if( ( dp.couplingFailMin || dp.couplingFailMax ) )
{ {
// We have a candidate violation, now we need to re-query for a constraint // We have a candidate violation, now we need to re-query for a constraint
// given the actual items, because there may be a location-based rule in play. // given the actual items, because there may be a location-based rule in play.

10
pcbnew/pcb_track.cpp

@ -101,6 +101,7 @@ PCB_VIA::PCB_VIA( const PCB_VIA& aOther ) :
PCB_VIA::operator=( aOther ); PCB_VIA::operator=( aOther );
const_cast<KIID&>( m_Uuid ) = aOther.m_Uuid; const_cast<KIID&>( m_Uuid ) = aOther.m_Uuid;
m_zoneLayerOverrides = aOther.m_zoneLayerOverrides;
} }
@ -142,9 +143,7 @@ wxString PCB_VIA::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
default: formatStr = _( "Via %s on %s" ); break; default: formatStr = _( "Via %s on %s" ); break;
} }
return wxString::Format( formatStr,
GetNetnameMsg(),
layerMaskDescribe() );
return wxString::Format( formatStr, GetNetnameMsg(), layerMaskDescribe() );
} }
@ -437,7 +436,6 @@ void PCB_VIA::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
} }
// see class_track.h
INSPECT_RESULT PCB_TRACK::Visit( INSPECTOR inspector, void* testData, INSPECT_RESULT PCB_TRACK::Visit( INSPECTOR inspector, void* testData,
const std::vector<KICAD_T>& aScanTypes ) const std::vector<KICAD_T>& aScanTypes )
{ {
@ -1137,12 +1135,14 @@ VECTOR2I PCB_ARC::GetPosition() const
return center; return center;
} }
double PCB_ARC::GetRadius() const double PCB_ARC::GetRadius() const
{ {
auto center = CalcArcCenter( m_Start, m_Mid , m_End ); auto center = CalcArcCenter( m_Start, m_Mid , m_End );
return GetLineLength( center, m_Start ); return GetLineLength( center, m_Start );
} }
EDA_ANGLE PCB_ARC::GetAngle() const EDA_ANGLE PCB_ARC::GetAngle() const
{ {
VECTOR2I center = GetPosition(); VECTOR2I center = GetPosition();
@ -1152,12 +1152,14 @@ EDA_ANGLE PCB_ARC::GetAngle() const
return angle1.Normalize180() + angle2.Normalize180(); return angle1.Normalize180() + angle2.Normalize180();
} }
EDA_ANGLE PCB_ARC::GetArcAngleStart() const EDA_ANGLE PCB_ARC::GetArcAngleStart() const
{ {
EDA_ANGLE angleStart( m_Start - GetPosition() ); EDA_ANGLE angleStart( m_Start - GetPosition() );
return angleStart.Normalize(); return angleStart.Normalize();
} }
EDA_ANGLE PCB_ARC::GetArcAngleEnd() const EDA_ANGLE PCB_ARC::GetArcAngleEnd() const
{ {
EDA_ANGLE angleEnd( m_End - GetPosition() ); EDA_ANGLE angleEnd( m_End - GetPosition() );

120
pcbnew/pcb_track.h

@ -59,7 +59,6 @@ enum ENDPOINT_T : int
ENDPOINT_END = 1 ENDPOINT_END = 1
}; };
// Via types
// Note that this enum must be synchronized to GAL_LAYER_ID // Note that this enum must be synchronized to GAL_LAYER_ID
enum class VIATYPE : int enum class VIATYPE : int
{ {
@ -132,21 +131,21 @@ public:
const BOX2I GetBoundingBox() const override; const BOX2I GetBoundingBox() const override;
/** /**
* Function GetLength
* returns the length of the track using the hypotenuse calculation.
* @return double - the length of the track
* Get the length of the track using the hypotenuse calculation.
*
* @return the length of the track.
*/ */
virtual double GetLength() const; virtual double GetLength() const;
/** /**
* Function TransformShapeToPolygon
* Convert the track shape to a closed polygon
* Used in filling zones calculations
* Circles (vias) and arcs (ends of tracks) are approximated by segments
* @param aBuffer = a buffer to store the polygon
* @param aClearance = the clearance around the pad
* @param aError = the maximum deviation from true circle
* @param ignoreLineWidth = used for edge cut items where the line width is only for
* Convert the track shape to a closed polygon.
*
* Circles (vias) and arcs (ends of tracks) are approximated by segments.
*
* @param aBuffer is a buffer to store the polygon
* @param aClearance is the clearance around the pad
* @param aError is the maximum deviation from true circle
* @param ignoreLineWidth is used for edge cut items where the line width is only for
* visualization * visualization
*/ */
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance, void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
@ -158,17 +157,16 @@ public:
FLASHING aFlash = FLASHING::DEFAULT ) const override; FLASHING aFlash = FLASHING::DEFAULT ) const override;
/** /**
* Function IsPointOnEnds
* returns STARTPOINT if point if near (dist = min_dist) start point, ENDPOINT if
* Return STARTPOINT if point if near (dist = min_dist) start point, ENDPOINT if
* point if near (dist = min_dist) end point,STARTPOINT|ENDPOINT if point if near * point if near (dist = min_dist) end point,STARTPOINT|ENDPOINT if point if near
* (dist = min_dist) both ends, or 0 if none of the above. * (dist = min_dist) both ends, or 0 if none of the above.
* if min_dist < 0: min_dist = track_width/2
*
* If min_dist < 0: min_dist = track_width/2
*/ */
EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const; EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const;
/** /**
* Function IsNull
* returns true if segment length is zero.
* Return true if segment length is zero.
*/ */
bool IsNull() const bool IsNull() const
{ {
@ -192,8 +190,8 @@ public:
} }
/** /**
* Function GetLocalClearance
* returns any local clearance overrides set in the "classic" (ie: pre-rule) system.
* Return any local clearance overrides set in the "classic" (ie: pre-rule) system.
*
* @param aSource [out] optionally reports the source as a user-readable string * @param aSource [out] optionally reports the source as a user-readable string
* @return int - the clearance in internal units. * @return int - the clearance in internal units.
*/ */
@ -222,7 +220,8 @@ public:
} }
/** /**
* Get last used LOD for the track net name
* Get last used LOD for the track net name.
*
* @return LOD from ViewGetLOD() * @return LOD from ViewGetLOD()
*/ */
double GetCachedLOD() double GetCachedLOD()
@ -231,8 +230,9 @@ public:
} }
/** /**
* Set the cached LOD
* @param aLOD value from ViewGetLOD() or 0.0 to always display
* Set the cached LOD.
*
* @param aLOD value from ViewGetLOD() or 0.0 to always display.
*/ */
void SetCachedLOD( double aLOD ) void SetCachedLOD( double aLOD )
{ {
@ -240,7 +240,8 @@ public:
} }
/** /**
* Get last used zoom scale for the track net name
* Get last used zoom scale for the track net name.
*
* @return scale from GetScale() * @return scale from GetScale()
*/ */
double GetCachedScale() double GetCachedScale()
@ -249,7 +250,8 @@ public:
} }
/** /**
* Set the cached scale
* Set the cached scale.
*
* @param aScale value from GetScale() * @param aScale value from GetScale()
*/ */
void SetCachedScale( double aScale ) void SetCachedScale( double aScale )
@ -269,7 +271,8 @@ public:
protected: protected:
virtual void swapData( BOARD_ITEM* aImage ) override; virtual void swapData( BOARD_ITEM* aImage ) override;
void GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) const;
void GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame,
std::vector<MSG_PANEL_ITEM>& aList ) const;
protected: protected:
int m_Width; ///< Thickness of track, or via diameter int m_Width; ///< Thickness of track, or via diameter
@ -277,7 +280,8 @@ protected:
VECTOR2I m_End; ///< Line end point VECTOR2I m_End; ///< Line end point
double m_CachedLOD; ///< Last LOD used to draw this track's net double m_CachedLOD; ///< Last LOD used to draw this track's net
double m_CachedScale; ///< Last zoom scale used to draw this track's net (we want to redraw when changing zoom)
double m_CachedScale; ///< Last zoom scale used to draw this track's net.
}; };
@ -327,7 +331,8 @@ public:
EDA_ANGLE GetArcAngleEnd() const; EDA_ANGLE GetArcAngleEnd() const;
virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
virtual bool HitTest( const BOX2I& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
virtual bool HitTest( const BOX2I& aRect, bool aContained = true,
int aAccuracy = 0 ) const override;
bool IsCCW() const; bool IsCCW() const;
@ -341,8 +346,8 @@ public:
FLASHING aFlash = FLASHING::DEFAULT ) const override; FLASHING aFlash = FLASHING::DEFAULT ) const override;
/** /**
* Function GetLength
* returns the length of the arc track
* Return the length of the arc track.
*
* @return double - the length of the track * @return double - the length of the track
*/ */
virtual double GetLength() const override virtual double GetLength() const override
@ -410,10 +415,10 @@ public:
virtual void SetLayerSet( LSET aLayers ) override; virtual void SetLayerSet( LSET aLayers ) override;
/** /**
* Function SetLayerPair
* For a via m_layer contains the top layer, the other layer is in m_bottomLayer
* @param aTopLayer = first layer connected by the via
* @param aBottomLayer = last layer connected by the via
* For a via m_layer contains the top layer, the other layer is in m_bottomLayer/
*
* @param aTopLayer is the first layer connected by the via.
* @param aBottomLayer is last layer connected by the via.
*/ */
void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer ); void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
@ -421,11 +426,11 @@ public:
void SetTopLayer( PCB_LAYER_ID aLayer ); void SetTopLayer( PCB_LAYER_ID aLayer );
/** /**
* Function LayerPair
* Return the 2 layers used by the via (the via actually uses
* all layers between these 2 layers)
* @param top_layer = pointer to the first layer (can be null)
* @param bottom_layer = pointer to the last layer (can be null)
* Return the 2 layers used by the via (the via actually uses all layers between these
* 2 layers)
*
* @param[out] top_layer is storage for the first layer of the via (can be null).
* @param[out] bottom_layer is storage for the last layer of the via(can be null).
*/ */
void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const; void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
@ -433,8 +438,7 @@ public:
PCB_LAYER_ID BottomLayer() const; PCB_LAYER_ID BottomLayer() const;
/** /**
* Function SanitizeLayers
* Check so that the layers are correct dependin on the type of via, and
* Check so that the layers are correct depending on the type of via, and
* so that the top actually is on top. * so that the top actually is on top.
*/ */
void SanitizeLayers(); void SanitizeLayers();
@ -495,57 +499,59 @@ public:
} }
/** /**
* Checks to see whether the via should have a pad on the specific layer
* Check to see whether the via should have a pad on the specific layer.
*
* @param aLayer Layer to check for connectivity * @param aLayer Layer to check for connectivity
* @return true if connected by pad or track (or optionally zone) * @return true if connected by pad or track (or optionally zone)
*/ */
bool FlashLayer( int aLayer ) const; bool FlashLayer( int aLayer ) const;
/** /**
* Checks to see if the via is present on any of the layers in the set
* @param aLayers set of layers to check the via against
* @return true if connected by pad or track (or optionally zone) on any of the associated layers
* Check to see if the via is present on any of the layers in the set.
*
* @param aLayers is the set of layers to check the via against.
* @return true if connected by pad or track (or optionally zone) on any of the associated
* layers.
*/ */
bool FlashLayer( LSET aLayers ) const; bool FlashLayer( LSET aLayers ) const;
/** /**
* Function SetDrill
* sets the drill value for vias.
* Set the drill value for vias.
*
* @param aDrill is the new drill diameter * @param aDrill is the new drill diameter
*/ */
void SetDrill( int aDrill ) { m_drill = aDrill; } void SetDrill( int aDrill ) { m_drill = aDrill; }
/** /**
* Function GetDrill
* returns the local drill setting for this PCB_VIA. If you want the calculated value,
* use GetDrillValue() instead.
* Return the local drill setting for this PCB_VIA.
*
* @note Use GetDrillValue() to get the calculated value.
*/ */
int GetDrill() const { return m_drill; } int GetDrill() const { return m_drill; }
/** /**
* Function GetDrillValue
* "calculates" the drill value for vias (m-Drill if > 0, or default
* drill value for the board.
* @return real drill_value
* Calculate the drill value for vias (m-Drill if > 0, or default drill value for the board.
*
* @return the calculated drill value.
*/ */
int GetDrillValue() const; int GetDrillValue() const;
/** /**
* Function SetDrillDefault
* sets the drill value for vias to the default value #UNDEFINED_DRILL_DIAMETER.
* Set the drill value for vias to the default value #UNDEFINED_DRILL_DIAMETER.
*/ */
void SetDrillDefault() { m_drill = UNDEFINED_DRILL_DIAMETER; } void SetDrillDefault() { m_drill = UNDEFINED_DRILL_DIAMETER; }
/** /**
* Checks if the via is a free via (as opposed to one created on a track by the router).
* Check if the via is a free via (as opposed to one created on a track by the router).
*
* Free vias don't have their nets automatically updated by the connectivity algorithm. * Free vias don't have their nets automatically updated by the connectivity algorithm.
*
* @return true if the via is a free via * @return true if the via is a free via
*/ */
bool GetIsFree() const { return m_isFree; } bool GetIsFree() const { return m_isFree; }
void SetIsFree( bool aFree = true ) { m_isFree = aFree; } void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
/** /**
* Function IsDrillDefault
* @return true if the drill value is default value (-1) * @return true if the drill value is default value (-1)
*/ */
bool IsDrillDefault() const { return m_drill <= 0; } bool IsDrillDefault() const { return m_drill <= 0; }

2
pcbnew/router/pns_kicad_iface.cpp

@ -248,7 +248,7 @@ bool PNS_PCBNEW_RULE_RESOLVER::IsNetTieExclusion( const PNS::ITEM* aItem,
return true; return true;
} }
if( drcEngine && collidingItem )
if( drcEngine )
{ {
return drcEngine->IsNetTieExclusion( aItem->Net(), ToLAYER_ID( aItem->Layer() ), return drcEngine->IsNetTieExclusion( aItem->Net(), ToLAYER_ID( aItem->Layer() ),
aCollisionPos, collidingItem ); aCollisionPos, collidingItem );

Loading…
Cancel
Save