Compare commits

...

14 Commits

Author SHA1 Message Date
Wayne Stambaugh 9c9252e8a3 Tag release version 5.1.2. 2019-04-22 17:14:54 -04:00
John Beard 3a744ad72f Use old-style boost includes
The Boost::boost style library dependencies don't work
on some CMake versions (couldn't find library -lBoost::boost)

Use ${Boost_INCLUDE_DIRS} in the target_include_dirs() instead.

Cherry-picked (with changes) from: 1a9aa2e92d
2019-04-22 01:10:50 +01:00
jean-pierre charras 554e2a4bce qfn_wizard.py fixes. 2019-04-21 14:08:01 +02:00
Jeff Young 6e8979d8d8 Add try/catch block around writing a new library.
Fixes: lp:1825203
* https://bugs.launchpad.net/kicad/+bug/1825203

(cherry picked from commit 2bcf38d2b6)
2019-04-18 22:02:24 +01:00
jean-pierre charras 583d416640 DIALOG_CONFIGURE_PATHS: do not allow users to define the env var KIPRJMOD It always defines the project path, and should never be defined by users.
Fixes: lp:1824912
https://bugs.launchpad.net/kicad/+bug/1824912
2019-04-17 14:55:14 +02:00
jean-pierre charras 03b50b4f85 BOARD_NETLIST_UPDATER: fix 2 serious issues in dry run (memory leak and incorrect single pad nets deletion) Single pad nets deletion in dry run was incorrect when a new footprint was added, because in dry run it is not actually added, and the single pad nets deletion does not see these new pads, and can (incorrectly) delete some nets. 2019-04-17 14:55:13 +02:00
John Beard 440e135e3a QA: Remove expected failure from fixed tests
Commit 55fcbddde8 fixed a couple of
failures in the SHAPE_POLY_SET tests, so these no longer
need the expected failure markers.

(cherry picked from commit 371149756d)
2019-04-17 11:48:11 +01:00
John Beard ab39f06003 SHAPE_ARC: fix polyline conversion when radius=0
Prevent a divide-by-zero bug in SHAPE_ARC::ConvertToPolyline.

When the radius is zero, just use the initial angle (it makes
no different anyway, the result is the centre point, which is
the start point.

(cherry picked from commit e312e2b286)
2019-04-17 11:29:28 +01:00
John Beard 98f78f534c QA: Test arc to polylines - this has a bug
Add unit test of SHAPE_ARC::ConvertToPolyline.

This function has a bug when the arc is of zero radius. This
test shows the bug, but does not fix it yet.

(cherry picked from commit ce84c19a38)
2019-04-17 11:29:28 +01:00
Jon Evans d18b12c1a3 Hide simulator settings tabs that aren't implemented yet
Calling Hide() is apparently not enough in Windows

(cherry picked from commit 895d4c9e1a)
2019-04-15 23:21:31 -04:00
Simon Richter 6a7b1aa39a List Boost as a dependency for kicad2step
This is not technically correct (the Boost dependency is introduced through
libcommon), but less invasive as it doesn't pull in libcommon on the linker
command line.
2019-04-15 23:43:42 +01:00
Seth Hillbrand c4be74a9d0 eeschema: Prevent invalid '0' element in components
In the component, an m_unit/m_convert element is 1-indexed as opposed to
the library where they are 0-indexed.  The 0-index in the library is
reserved for those elements that are shared across all conversion/unit
whereas it is invalid for the component.

Fixes: lp:1824764
* https://bugs.launchpad.net/kicad/+bug/1824764
2019-04-15 12:32:29 -07:00
John Beard 9092048dbc Kicad2Step: handle quoted layers
More recent Kicad_pcb files have quoted layer names (i.e.
strings, not symbols). The importer in K2S doesn't handle that,
so it chokes on elements like (layer "Edge.Cuts").

Fixes: lp:1824750
* https://bugs.launchpad.net/kicad/+bug/1824750

(cherry picked from commit c135158364)
2019-04-15 15:01:57 +01:00
Wayne Stambaugh bb419f1201 Begin version 5.1.2 development. 2019-04-14 15:36:47 -04:00
24 changed files with 373 additions and 379 deletions
+1 -1
View File
@@ -35,4 +35,4 @@
# be set after each version tag is added to the git repo. This will
# give developers a reasonable idea where which branch was used to build
# KiCad.
set( KICAD_VERSION "5.1.1" )
set( KICAD_VERSION "5.1.2" )
+9 -2
View File
@@ -339,8 +339,15 @@ void DIALOG_CONFIGURE_PATHS::OnGridCellChanging( wxGridEvent& event )
}
else if( col == EV_NAME_COL && m_EnvVars->GetCellValue( row, EV_NAME_COL ) != text )
{
// Changing name; clear external flag
m_EnvVars->SetCellValue( row, EV_FLAG_COL, wxEmptyString );
if( text == PROJECT_VAR_NAME ) // This env var name is reserved and cannot be added here:
{
wxMessageBox( wxString::Format(
_( "The name %s is reserved, and cannot be used here" ),
PROJECT_VAR_NAME ) );
event.Veto();
}
else // Changing name; clear external flag
m_EnvVars->SetCellValue( row, EV_FLAG_COL, wxEmptyString );
}
}
}
+40 -309
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="13" />
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@@ -14,6 +14,7 @@
<property name="file">dialog_configure_paths_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">DIALOG_CONFIGURE_PATHS_BASE</property>
<property name="namespace"></property>
@@ -52,41 +53,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI">OnUpdateUI</event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@@ -105,7 +71,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
@@ -132,10 +97,10 @@
<property name="cell_vert_alignment">wxALIGN_TOP</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTRE</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="col_label_size">22</property>
<property name="col_label_values">&quot;Name&quot; &quot;Path&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">2</property>
<property name="column_sizes">150,454</property>
<property name="context_help"></property>
@@ -178,10 +143,10 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="row_label_horiz_alignment">wxALIGN_CENTRE</property>
<property name="row_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="row_label_size">0</property>
<property name="row_label_values"></property>
<property name="row_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="row_label_vert_alignment">wxALIGN_CENTER</property>
<property name="row_sizes"></property>
<property name="rows">1</property>
<property name="show">1</property>
@@ -192,61 +157,8 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnGridCellChange">OnGridCellChange</event>
<event name="OnGridCellLeftClick"></event>
<event name="OnGridCellLeftDClick"></event>
<event name="OnGridCellRightClick"></event>
<event name="OnGridCellRightDClick"></event>
<event name="OnGridCmdCellChange"></event>
<event name="OnGridCmdCellLeftClick"></event>
<event name="OnGridCmdCellLeftDClick"></event>
<event name="OnGridCmdCellRightClick"></event>
<event name="OnGridCmdCellRightDClick"></event>
<event name="OnGridCmdColSize"></event>
<event name="OnGridCmdEditorCreated"></event>
<event name="OnGridCmdEditorHidden"></event>
<event name="OnGridCmdEditorShown"></event>
<event name="OnGridCmdLabelLeftClick"></event>
<event name="OnGridCmdLabelLeftDClick"></event>
<event name="OnGridCmdLabelRightClick"></event>
<event name="OnGridCmdLabelRightDClick"></event>
<event name="OnGridCmdRangeSelect"></event>
<event name="OnGridCmdRowSize"></event>
<event name="OnGridCmdSelectCell"></event>
<event name="OnGridColSize"></event>
<event name="OnGridEditorCreated"></event>
<event name="OnGridEditorHidden"></event>
<event name="OnGridEditorShown"></event>
<event name="OnGridLabelLeftClick"></event>
<event name="OnGridLabelLeftDClick"></event>
<event name="OnGridLabelRightClick"></event>
<event name="OnGridLabelRightDClick"></event>
<event name="OnGridRangeSelect"></event>
<event name="OnGridRowSize"></event>
<event name="OnGridSelectCell"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize">OnGridSize</event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -280,6 +192,7 @@
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
@@ -293,9 +206,10 @@
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="hover"></property>
<property name="id">wxID_ANY</property>
<property name="label">Add Environment Variable</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -310,8 +224,9 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="selected"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
@@ -326,29 +241,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAddEnvVar</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -383,6 +275,7 @@
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
@@ -396,9 +289,10 @@
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="hover"></property>
<property name="id">wxID_ANY</property>
<property name="label">Delete Environment Variable</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -413,8 +307,9 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="selected"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
@@ -429,29 +324,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnRemoveEnvVar</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -470,7 +342,6 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
@@ -497,10 +368,10 @@
<property name="cell_vert_alignment">wxALIGN_TOP</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTRE</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="col_label_size">22</property>
<property name="col_label_values">&quot;Alias&quot; &quot;Path&quot; &quot;Description&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">3</property>
<property name="column_sizes">150,300,154</property>
<property name="context_help"></property>
@@ -543,10 +414,10 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="row_label_horiz_alignment">wxALIGN_CENTRE</property>
<property name="row_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="row_label_size">0</property>
<property name="row_label_values"></property>
<property name="row_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="row_label_vert_alignment">wxALIGN_CENTER</property>
<property name="row_sizes"></property>
<property name="rows">1</property>
<property name="show">1</property>
@@ -557,61 +428,8 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnGridCellChange">OnGridCellChange</event>
<event name="OnGridCellLeftClick"></event>
<event name="OnGridCellLeftDClick"></event>
<event name="OnGridCellRightClick">OnGridCellRightClick</event>
<event name="OnGridCellRightDClick"></event>
<event name="OnGridCmdCellChange"></event>
<event name="OnGridCmdCellLeftClick"></event>
<event name="OnGridCmdCellLeftDClick"></event>
<event name="OnGridCmdCellRightClick"></event>
<event name="OnGridCmdCellRightDClick"></event>
<event name="OnGridCmdColSize"></event>
<event name="OnGridCmdEditorCreated"></event>
<event name="OnGridCmdEditorHidden"></event>
<event name="OnGridCmdEditorShown"></event>
<event name="OnGridCmdLabelLeftClick"></event>
<event name="OnGridCmdLabelLeftDClick"></event>
<event name="OnGridCmdLabelRightClick"></event>
<event name="OnGridCmdLabelRightDClick"></event>
<event name="OnGridCmdRangeSelect"></event>
<event name="OnGridCmdRowSize"></event>
<event name="OnGridCmdSelectCell"></event>
<event name="OnGridColSize"></event>
<event name="OnGridEditorCreated"></event>
<event name="OnGridEditorHidden"></event>
<event name="OnGridEditorShown"></event>
<event name="OnGridLabelLeftClick"></event>
<event name="OnGridLabelLeftDClick"></event>
<event name="OnGridLabelRightClick"></event>
<event name="OnGridLabelRightDClick"></event>
<event name="OnGridRangeSelect"></event>
<event name="OnGridRowSize"></event>
<event name="OnGridSelectCell"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -645,6 +463,7 @@
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
@@ -658,9 +477,10 @@
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="hover"></property>
<property name="id">wxID_ANY</property>
<property name="label">Add Path</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -675,8 +495,9 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="selected"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
@@ -691,29 +512,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAddSearchPath</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -738,6 +536,7 @@
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
@@ -751,9 +550,10 @@
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="hover"></property>
<property name="id">wxID_ANY</property>
<property name="label">Move Up</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -768,8 +568,9 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="selected"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
@@ -784,29 +585,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnSearchPathMoveUp</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -831,6 +609,7 @@
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
@@ -844,9 +623,10 @@
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="hover"></property>
<property name="id">wxID_ANY</property>
<property name="label">Move Down</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -861,8 +641,9 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="selected"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
@@ -877,29 +658,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnSearchPathMoveDown</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -934,6 +692,7 @@
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
@@ -947,9 +706,10 @@
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="hover"></property>
<property name="id">wxID_ANY</property>
<property name="label">Delete Path</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -964,8 +724,9 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="selected"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
@@ -980,29 +741,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnDeleteSearchPath</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
@@ -1025,14 +763,7 @@
<property name="minimum_size"></property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick">OnHelp</event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick"></event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
</object>
+5 -1
View File
@@ -256,7 +256,11 @@ const SHAPE_LINE_CHAIN SHAPE_ARC::ConvertToPolyline( double aAccuracy ) const
for( int i = 0; i <= n ; i++ )
{
double a = sa + m_centralAngle * (double) i / (double) n;
double a = sa;
if( n != 0 )
sa += m_centralAngle * (double) i / (double) n;
double x = c.x + r * cos( a * M_PI / 180.0 );
double y = c.y + r * sin( a * M_PI / 180.0 );
+8
View File
@@ -612,6 +612,12 @@ void PGM_BASE::loadCommonSettings()
{
wxLogTrace( traceEnvVars,
"Enumerating over entry %s, %ld.", GetChars( entry ), index );
// Do not store the env var PROJECT_VAR_NAME ("KIPRJMOD") definition if for some reason
// it is found in config. (It is reserved and defined as project path)
if( entry == PROJECT_VAR_NAME )
continue;
entries.Add( entry );
}
@@ -626,7 +632,9 @@ void PGM_BASE::loadCommonSettings()
}
for( ENV_VAR_MAP_ITER it = m_local_env_vars.begin(); it != m_local_env_vars.end(); ++it )
{
SetLocalEnvVariable( it->first, it->second.GetValue() );
}
m_common_settings->SetPath( oldPath );
}
+1 -1
View File
@@ -986,7 +986,7 @@ bool LIB_PART::HasConversion() const
{
for( const LIB_ITEM& item : m_drawings )
{
if( item.m_Convert > 1 )
if( item.m_Convert > LIB_ITEM::LIB_CONVERT::BASE )
return true;
}
@@ -175,7 +175,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow()
if( m_part != nullptr && m_part->HasConversion() )
{
if( m_cmp->GetConvert() > 1 )
if( m_cmp->GetConvert() > LIB_ITEM::LIB_CONVERT::BASE )
m_cbAlternateSymbol->SetValue( true );
}
else
@@ -252,7 +252,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnBrowseLibrary( wxCommandEvent& event
for( int ii = 1; ii <= entry->GetUnitCount(); ii++ )
m_unitChoice->Append( LIB_PART::SubReference( ii, false ) );
if( unit < 0 || unit >= m_unitChoice->GetCount() )
if( unit < 0 || static_cast<unsigned>( unit )>= m_unitChoice->GetCount() )
unit = 0;
m_unitChoice->SetSelection( unit );
@@ -405,15 +405,15 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
m_cmp->SetLibId( id, Prj().SchSymbolLibTable(), Prj().SchLibs()->GetCacheLibrary() );
// For symbols with multiple shapes (De Morgan representation) Set the selected shape:
int conversion = m_cbAlternateSymbol->IsEnabled()
? m_cbAlternateSymbol->GetValue()
: 0;
m_cmp->SetConvert( conversion );
if( m_cbAlternateSymbol->IsEnabled() && m_cbAlternateSymbol->GetValue() )
m_cmp->SetConvert( LIB_ITEM::LIB_CONVERT::DEMORGAN );
else
m_cmp->SetConvert( LIB_ITEM::LIB_CONVERT::BASE );
//Set the part selection in multiple part per package
int unit_selection = m_unitChoice->IsEnabled()
? m_unitChoice->GetSelection() + 1
: 0;
: 1;
m_cmp->SetUnitSelection( &GetParent()->GetCurrentSheet(), unit_selection );
m_cmp->SetUnit( unit_selection );
+9
View File
@@ -63,6 +63,15 @@ DIALOG_SIM_SETTINGS::DIALOG_SIM_SETTINGS( wxWindow* aParent )
m_transFinal->SetValidator( m_spiceValidator );
m_transInitial->SetValidator( m_spiceEmptyValidator );
// Hide pages that aren't fully implemented yet
// wxPanel::Hide() isn't enough on some platforms
m_simPages->RemovePage( m_simPages->FindPage( m_pgDistortion ) );
m_simPages->RemovePage( m_simPages->FindPage( m_pgNoise ) );
m_simPages->RemovePage( m_simPages->FindPage( m_pgOP ) );
m_simPages->RemovePage( m_simPages->FindPage( m_pgPoleZero ) );
m_simPages->RemovePage( m_simPages->FindPage( m_pgSensitivity ) );
m_simPages->RemovePage( m_simPages->FindPage( m_pgTransferFunction ) );
m_sdbSizerOK->SetDefault();
updateNetlistOpts();
+4 -4
View File
@@ -372,14 +372,14 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* aComponent )
aComponent->SetConvert( aComponent->GetConvert() + 1 );
// ensure m_Convert = 0, 1 or 2
// 0 and 1 = shape 1 = not converted
// ensure m_Convert = 1 or 2
// 1 = shape 1 = not converted
// 2 = shape 2 = first converted shape
// > 2 is not used but could be used for more shapes
// like multiple shapes for a programmable component
// When m_Convert = val max, return to the first shape
if( aComponent->GetConvert() > 2 )
aComponent->SetConvert( 1 );
if( aComponent->GetConvert() > LIB_ITEM::LIB_CONVERT::DEMORGAN )
aComponent->SetConvert( LIB_ITEM::LIB_CONVERT::BASE );
// The alternate symbol may cause a change in the connection status so test the
// connections so the connection indicators are drawn correctly.
+2 -4
View File
@@ -68,11 +68,9 @@ void LIB_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Unit" ), msg, BROWN ) );
if( m_Convert == 0 )
msg = _( "All" );
else if( m_Convert == 1 )
if( m_Convert == LIB_ITEM::LIB_CONVERT::BASE )
msg = _( "no" );
else if( m_Convert == 2 )
else if( m_Convert == LIB_ITEM::LIB_CONVERT::DEMORGAN )
msg = _( "yes" );
else
msg = wxT( "?" );
+4 -1
View File
@@ -92,7 +92,6 @@ class LIB_ITEM : public EDA_ITEM
* @param aColor Draw color
*/
virtual void drawEditGraphics( EDA_RECT* aClipBox, wxDC* aDC, COLOR4D aColor ) {}
friend class LIB_PART;
@@ -134,6 +133,10 @@ public:
virtual ~LIB_ITEM() { }
// Define the enums for basic
enum LIB_CONVERT : int { BASE = 1, DEMORGAN = 2 };
/**
* Provide a user-consumable name of the object type. Perform localization when
* called so that run-time language selection works.
+12 -9
View File
@@ -645,14 +645,15 @@ bool LIB_MANAGER::addLibrary( const wxString& aFilePath, bool aCreate, SYMBOL_LI
if( aCreate )
{
// CreateSymbolLib() fails if the file exists
if( wxFileName::Exists( aFilePath ) )
try
{
if( !wxRemoveFile( aFilePath ) )
return false;
aTable->CreateSymbolLib( libName );
}
catch( const IO_ERROR& e )
{
aTable->RemoveRow( libRow );
return false;
}
aTable->CreateSymbolLib( libName );
}
m_frame.SyncLibraries( false );
@@ -682,10 +683,12 @@ std::set<LIB_PART*> LIB_MANAGER::getOriginalParts( const wxString& aLibrary )
LIB_ALIAS* alias = symTable()->LoadSymbol( aLibrary, aliasName );
parts.insert( alias->GetPart() );
}
} catch( const IO_ERROR& e )
}
catch( const IO_ERROR& e )
{
DisplayErrorMessage( &m_frame, wxString::Format( _( "Cannot enumerate "
"library \"%s\"" ), aLibrary ), e.What() );
DisplayErrorMessage( &m_frame, wxString::Format( _( "Cannot enumerate library \"%s\"" ),
aLibrary ),
e.What() );
}
return parts;
+2 -2
View File
@@ -193,8 +193,8 @@ SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aComponent ) :
void SCH_COMPONENT::Init( const wxPoint& pos )
{
m_Pos = pos;
m_unit = 0; // In multi unit chip - which unit to draw.
m_convert = 0; // De Morgan Handling
m_unit = 1; // In multi unit chip - which unit to draw.
m_convert = LIB_ITEM::LIB_CONVERT::BASE; // De Morgan Handling
// The rotation/mirror transformation matrix. pos normal
m_transform = TRANSFORM();
+5 -5
View File
@@ -228,7 +228,7 @@ LIB_VIEW_FRAME::~LIB_VIEW_FRAME()
void LIB_VIEW_FRAME::SetUnitAndConvert( int aUnit, int aConvert )
{
m_unit = aUnit > 0 ? aUnit : 1;
m_convert = aConvert > 0 ? aConvert : 1;
m_convert = aConvert > 0 ? aConvert : LIB_ITEM::LIB_CONVERT::BASE;
m_selection_changed = false;
// Update canvas
@@ -546,7 +546,7 @@ bool LIB_VIEW_FRAME::ReCreateListLib()
m_libraryName = libs[0];
m_entryName = wxEmptyString;
m_unit = 1;
m_convert = 1;
m_convert = LIB_ITEM::LIB_CONVERT::BASE;
}
bool cmp_changed = ReCreateListCmp();
@@ -577,7 +577,7 @@ bool LIB_VIEW_FRAME::ReCreateListCmp()
{
m_libraryName = wxEmptyString;
m_entryName = wxEmptyString;
m_convert = 1;
m_convert = LIB_ITEM::LIB_CONVERT::BASE;
m_unit = 1;
return true;
}
@@ -591,7 +591,7 @@ bool LIB_VIEW_FRAME::ReCreateListCmp()
{
// Select the first library entry when the previous entry name does not exist in
// the current library.
m_convert = 1;
m_convert = LIB_ITEM::LIB_CONVERT::BASE;
m_unit = 1;
index = 0;
changed = true;
@@ -665,7 +665,7 @@ void LIB_VIEW_FRAME::SetSelectedComponent( const wxString& aComponentName )
if( m_selection_changed )
{
m_unit = 1;
m_convert = 1;
m_convert = LIB_ITEM::LIB_CONVERT::BASE;
m_selection_changed = false;
}
+2 -2
View File
@@ -144,11 +144,11 @@ void LIB_VIEW_FRAME::onSelectSymbolBodyStyle( wxCommandEvent& aEvent )
{
default:
case ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT:
m_convert = 1;
m_convert = LIB_ITEM::LIB_CONVERT::BASE;
break;
case ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT:
m_convert = 2;
m_convert = LIB_ITEM::LIB_CONVERT::DEMORGAN;
break;
}
+18
View File
@@ -414,6 +414,24 @@ public:
*/
bool InsertRow( LIB_TABLE_ROW* aRow, bool doReplace = false );
/**
* Removes a row from the table.
* @param aRow is the row to remove
* @return true if the row was found (and removed)
*/
bool RemoveRow( LIB_TABLE_ROW* aRow )
{
for( auto iter = rows.begin(); iter != rows.end(); ++iter )
{
if( *iter == *aRow )
{
rows.erase( iter, iter + 1 );
return true;
}
}
return false;
}
/**
* @return a #LIB_TABLE_ROW pointer if \a aURI is found in this table or in any chained
* fallBack table fragments, else NULL.
+21 -4
View File
@@ -11,7 +11,7 @@
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
*
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 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
@@ -64,6 +64,7 @@ BOARD_NETLIST_UPDATER::BOARD_NETLIST_UPDATER( PCB_EDIT_FRAME* aFrame, BOARD* aBo
m_warningCount = 0;
m_errorCount = 0;
m_newFootprintsCount = 0;
}
@@ -148,6 +149,8 @@ MODULE* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent )
aComponent->GetFPID().Format().wx_str() );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
m_newFootprintsCount++;
if( !m_isDryRun )
{
footprint->SetParent( m_board );
@@ -159,6 +162,8 @@ MODULE* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent )
return footprint;
}
else
delete footprint;
return NULL;
}
@@ -197,11 +202,15 @@ MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcb
aNewComponent->GetFPID().Format().wx_str() );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
m_newFootprintsCount++;
if( !m_isDryRun )
{
m_frame->Exchange_Module( aPcbComponent, newFootprint, m_commit, true, true, true );
return newFootprint;
}
else
delete newFootprint;
return nullptr;
}
@@ -623,6 +632,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
wxString msg;
m_errorCount = 0;
m_warningCount = 0;
m_newFootprintsCount = 0;
MODULE* lastPreexistingFootprint = m_board->m_Modules.GetLast();
cacheCopperZoneConnections();
@@ -707,15 +717,22 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
if( m_deleteUnusedComponents )
deleteUnusedComponents( aNetlist );
if( m_deleteSinglePadNets )
deleteSinglePadNets();
if( !m_isDryRun )
{
m_commit.Push( _( "Update netlist" ) );
m_board->GetConnectivity()->Build( m_board );
testConnectivity( aNetlist );
// Now the connectivity data is rebuilt, we can delete single pads nets
if( m_deleteSinglePadNets )
deleteSinglePadNets();
}
else if( m_deleteSinglePadNets && !m_newFootprintsCount )
// We can delete single net pads in dry run mode only if no new footprints
// are added, because these new footprints are not actually added to the board
// and the current pad list is wrong in this case.
deleteSinglePadNets();
// Update the ratsnest
m_reporter->ReportTail( wxT( "" ), REPORTER::RPT_ACTION );
+3 -1
View File
@@ -11,7 +11,7 @@
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
*
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 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
@@ -161,6 +161,8 @@ private:
int m_warningCount;
int m_errorCount;
int m_newFootprintsCount; // the count of new footprints
// either really new or replaced by new fp.
};
#endif
+7 -7
View File
@@ -37,7 +37,7 @@ class QFNWizard(FootprintWizardBase.FootprintWizard):
self.AddParam("Pads", "pitch", self.uMM, 0.4, designator='e')
self.AddParam("Pads", "width", self.uMM, 0.2, designator='X1')
self.AddParam("Pads", "length", self.uMM, 0.75, designator='Y1')
self.AddParam("Pads", "fillet", self.uMM, 0.3)
self.AddParam("Pads", "offset", self.uMM, 0.0)
self.AddParam("Pads", "oval", self.uBool, True)
self.AddParam("EPad", "epad", self.uBool, True)
@@ -82,8 +82,8 @@ class QFNWizard(FootprintWizardBase.FootprintWizard):
pad_pitch = self.pads["pitch"]
pad_length = self.pads["length"]
# Fillet allows to define how much of the pad is outside of the package
pad_fillet = self.pads["fillet"]
# offset allows to define how much of the pad is outside of the package
pad_offset = self.pads["offset"]
pad_width = self.pads["width"]
v_pitch = self.package["height"]
@@ -95,12 +95,12 @@ class QFNWizard(FootprintWizardBase.FootprintWizard):
pad_shape = pcbnew.PAD_SHAPE_OVAL if self.pads["oval"] else pcbnew.PAD_SHAPE_RECT
h_pad = PA.PadMaker(self.module).SMDPad( pad_length + pad_fillet, pad_width,
h_pad = PA.PadMaker(self.module).SMDPad( pad_length, pad_width,
shape=pad_shape, rot_degree=90.0)
v_pad = PA.PadMaker(self.module).SMDPad( pad_length + pad_fillet, pad_width, shape=pad_shape)
v_pad = PA.PadMaker(self.module).SMDPad( pad_length, pad_width, shape=pad_shape)
h_pitch = h_pitch / 2 - pad_length + (pad_length+pad_fillet)/2
v_pitch = v_pitch / 2 - pad_length + (pad_length+pad_fillet)/2
h_pitch = h_pitch / 2 - pad_length + pad_offset + pad_length/2
v_pitch = v_pitch / 2 - pad_length +pad_offset + pad_length/2
#left row
pin1Pos = pcbnew.wxPoint(-h_pitch, 0)
+80 -7
View File
@@ -31,6 +31,7 @@
#include <geometry/shape_poly_set.h>
#include <unit_test_utils/numeric.h>
#include <unit_test_utils/unit_test_utils.h>
/**
* @brief Utility functions for testing geometry functions.
@@ -81,7 +82,7 @@ bool IsInQuadrant( const VECTOR2<T>& aPoint, QUADRANT aQuadrant )
/*
* @Brief Check if both ends of a segment are in Quadrant 1
*/
bool SegmentCompletelyInQuadrant( const SEG& aSeg, QUADRANT aQuadrant )
inline bool SegmentCompletelyInQuadrant( const SEG& aSeg, QUADRANT aQuadrant )
{
return IsInQuadrant( aSeg.A, aQuadrant)
&& IsInQuadrant( aSeg.B, aQuadrant );
@@ -90,7 +91,7 @@ bool SegmentCompletelyInQuadrant( const SEG& aSeg, QUADRANT aQuadrant )
/*
* @brief Check if at least one end of the segment is in Quadrant 1
*/
bool SegmentEndsInQuadrant( const SEG& aSeg, QUADRANT aQuadrant )
inline bool SegmentEndsInQuadrant( const SEG& aSeg, QUADRANT aQuadrant )
{
return IsInQuadrant( aSeg.A, aQuadrant )
|| IsInQuadrant( aSeg.B, aQuadrant );
@@ -99,14 +100,66 @@ bool SegmentEndsInQuadrant( const SEG& aSeg, QUADRANT aQuadrant )
/*
* @brief Check if a segment is entirely within a certain radius of a point.
*/
bool SegmentCompletelyWithinRadius( const SEG& aSeg, const VECTOR2I& aPt,
const int aRadius )
inline bool SegmentCompletelyWithinRadius( const SEG& aSeg, const VECTOR2I& aPt, const int aRadius )
{
// This is true iff both ends of the segment are within the radius
return ( ( aSeg.A - aPt ).EuclideanNorm() < aRadius )
&& ( ( aSeg.B - aPt ).EuclideanNorm() < aRadius );
}
/**
* Check that two points are the given distance apart, within the given tolerance.
*
* @tparam T the dimension type
* @param aPtA the first point
* @param aPtB the second point
* @param aExpDist the expected distance
* @param aTol the permitted tolerance
*/
template <typename T>
bool IsPointAtDistance( const VECTOR2<T>& aPtA, const VECTOR2<T>& aPtB, T aExpDist, T aTol )
{
const int dist = ( aPtB - aPtA ).EuclideanNorm();
const bool ok = KI_TEST::IsWithin( dist, aExpDist, aTol );
if( !ok )
{
BOOST_TEST_INFO( "Points not at expected distance: distance is " << dist << ", expected "
<< aExpDist );
}
return ok;
}
/**
* Predicate for checking a set of points is within a certain tolerance of
* a circle
* @param aPoints the points to check
* @param aCentre the circle centre
* @param aRad the circle radius
* @param aTolEnds the tolerance for the endpoint-centre distance
* @return true if predicate met
*/
template <typename T>
bool ArePointsNearCircle(
const std::vector<VECTOR2<T>>& aPoints, const VECTOR2<T>& aCentre, T aRad, T aTol )
{
bool ok = true;
for( unsigned i = 0; i < aPoints.size(); ++i )
{
if( !IsPointAtDistance( aPoints[i], aCentre, aRad, aTol ) )
{
BOOST_TEST_INFO( "Point " << i << " " << aPoints[i] << " is not within tolerance ("
<< aTol << ") of radius (" << aRad << ") from centre point "
<< aCentre );
ok = false;
}
}
return ok;
}
/*
* @brief Check if two vectors are perpendicular
*
@@ -135,7 +188,7 @@ bool ArePerpendicular( const VECTOR2<T>& a, const VECTOR2<T>& b, double aToleran
* @param aSize: the side width (must be divisible by 2 if want to avoid rounding)
* @param aCentre: the centre of the square
*/
SHAPE_LINE_CHAIN MakeSquarePolyLine( int aSize, const VECTOR2I& aCentre )
inline SHAPE_LINE_CHAIN MakeSquarePolyLine( int aSize, const VECTOR2I& aCentre )
{
SHAPE_LINE_CHAIN polyLine;
@@ -154,8 +207,7 @@ SHAPE_LINE_CHAIN MakeSquarePolyLine( int aSize, const VECTOR2I& aCentre )
/*
* @brief Fillet every polygon in a set and return a new set
*/
SHAPE_POLY_SET FilletPolySet( SHAPE_POLY_SET& aPolySet, int aRadius,
int aError )
inline SHAPE_POLY_SET FilletPolySet( SHAPE_POLY_SET& aPolySet, int aRadius, int aError )
{
SHAPE_POLY_SET filletedPolySet;
@@ -169,6 +221,27 @@ SHAPE_POLY_SET FilletPolySet( SHAPE_POLY_SET& aPolySet, int aRadius,
return filletedPolySet;
}
} // namespace GEOM_TEST
BOOST_TEST_PRINT_NAMESPACE_OPEN
{
template <>
struct print_log_value<SHAPE_LINE_CHAIN>
{
inline void operator()( std::ostream& os, const SHAPE_LINE_CHAIN& c )
{
os << "SHAPE_LINE_CHAIN: " << c.PointCount() << " points: [\n";
for( int i = 0; i < c.PointCount(); ++i )
{
os << " " << i << ": " << c.CPoint( i ) << "\n";
}
os << "]";
}
};
}
BOOST_TEST_PRINT_NAMESPACE_CLOSE
#endif // GEOM_TEST_UTILS_H
+91
View File
@@ -23,10 +23,13 @@
#include <geometry/shape_arc.h>
#include <geometry/shape_line_chain.h>
#include <unit_test_utils/geometry.h>
#include <unit_test_utils/numeric.h>
#include <unit_test_utils/unit_test_utils.h>
#include "geom_test_utils.h"
BOOST_AUTO_TEST_SUITE( ShapeArc )
@@ -281,4 +284,92 @@ BOOST_AUTO_TEST_CASE( BasicCPAGeom )
}
}
struct ARC_TO_POLYLINE_CASE
{
std::string m_ctx_name;
ARC_CENTRE_PT_ANGLE m_geom;
};
/**
* Predicate for checking a polyline has all the points on (near) a circle of
* given centre and radius
* @param aPolyline the polyline to check
* @param aCentre the circle centre
* @param aRad the circle radius
* @param aTolEnds the tolerance for the endpoint-centre distance
* @return true if predicate met
*/
bool ArePolylinePointsNearCircle(
const SHAPE_LINE_CHAIN& aPolyline, const VECTOR2I& aCentre, int aRad, int aTolEnds )
{
std::vector<VECTOR2I> points;
for( int i = 0; i < aPolyline.PointCount(); ++i )
{
points.push_back( aPolyline.CPoint( i ) );
}
return GEOM_TEST::ArePointsNearCircle( points, aCentre, aRad, aTolEnds );
}
BOOST_AUTO_TEST_CASE( ArcToPolyline )
{
const std::vector<ARC_TO_POLYLINE_CASE> cases = {
{
"Zero rad",
{
{ 0, 0 },
{ 0, 0 },
180,
},
},
{
"Semicircle",
{
{ 0, 0 },
{ -10, 0 },
180,
},
},
{
"Larger semicircle",
{
{ 0, 0 },
{ -1000, 0 },
180,
},
},
};
const int width = 0;
const double accuracy = 1.0;
for( const auto& c : cases )
{
BOOST_TEST_CONTEXT( c.m_ctx_name )
{
const SHAPE_ARC this_arc{ c.m_geom.m_center_point, c.m_geom.m_start_point,
c.m_geom.m_center_angle, width };
const SHAPE_LINE_CHAIN chain = this_arc.ConvertToPolyline( accuracy );
BOOST_TEST_MESSAGE( "Polyline has " << chain.PointCount() << " points" );
BOOST_CHECK_EQUAL( chain.CPoint( 0 ), c.m_geom.m_start_point );
const int radius = ( c.m_geom.m_center_point - c.m_geom.m_start_point ).EuclideanNorm();
const int tol = 2;
BOOST_CHECK_PREDICATE( ArePolylinePointsNearCircle,
( chain )( c.m_geom.m_center_point )( radius )( tol ) );
// TODO: check midpoints are near circle too
}
}
}
BOOST_AUTO_TEST_SUITE_END()
@@ -113,13 +113,11 @@ BOOST_AUTO_TEST_CASE( PointOnEdge )
BOOST_CHECK( !common.holeyPolySet.PointOnEdge( VECTOR2I( 200, 200 ) ) );
}
#ifdef HAVE_EXPECTED_FAILURES
/**
* This test checks that the function Contains, whose behaviour has been updated to also manage
* holey polygons, does the right work.
*/
BOOST_AUTO_TEST_CASE( pointInPolygonSet, *boost::unit_test::expected_failures( 1 ) )
BOOST_AUTO_TEST_CASE( pointInPolygonSet )
{
// Check that the set contains the points that collide with it
for( const VECTOR2I& point : collidingPoints )
@@ -137,7 +135,7 @@ BOOST_AUTO_TEST_CASE( pointInPolygonSet, *boost::unit_test::expected_failures( 1
/**
* This test checks the behaviour of the Collide (with a point) method.
*/
BOOST_AUTO_TEST_CASE( Collide, *boost::unit_test::expected_failures( 1 ) )
BOOST_AUTO_TEST_CASE( Collide )
{
// When clearance = 0, the behaviour should be the same as with Contains
@@ -162,8 +160,6 @@ BOOST_AUTO_TEST_CASE( Collide, *boost::unit_test::expected_failures( 1 ) )
BOOST_CHECK( common.holeyPolySet.Collide( VECTOR2I( 11, 11 ), 5 ) );
}
#endif
/**
* This test checks the behaviour of the CollideVertex method, testing whether the collision with
* vertices is well detected
+1
View File
@@ -7,6 +7,7 @@ include_directories( BEFORE
include_directories( SYSTEM
${OCE_INCLUDE_DIRS}
${OCC_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
)
set( K2S_FILES
+39 -6
View File
@@ -28,6 +28,40 @@
#include "sexpr/sexpr.h"
#include "kicadcurve.h"
#include <core/optional.h>
/**
* Get the layer name from a layer element, if the layer is syntactically
* valid
*
* E.g. (layer "Edge.Cuts") -> "Edge.Cuts"
*
* @param aLayerElem the s-expr element to get the name from
* @return the layer name if valid, else empty
*/
static OPT<std::string> getLayerName( const SEXPR::SEXPR& aLayerElem )
{
OPT<std::string> layer;
if( aLayerElem.GetNumberOfChildren() == 2 )
{
const auto& layerChild = *aLayerElem.GetChild( 1 );
// The layer child can be quoted (string) or unquoted (symbol)
// depending on PCB version.
if( layerChild.IsString() )
{
layer = layerChild.GetString();
}
else if( layerChild.IsSymbol() )
{
layer = layerChild.GetSymbol();
}
}
return layer;
}
KICADCURVE::KICADCURVE()
{
@@ -115,19 +149,18 @@ bool KICADCURVE::Read( SEXPR::SEXPR* aEntry, CURVE_TYPE aCurveType )
}
else if( text == "layer" )
{
if( child->GetNumberOfChildren() < 2
|| !child->GetChild( 1 )->IsSymbol() )
const OPT<std::string> layer = getLayerName( *child );
if( !layer )
{
std::ostringstream ostr;
ostr << "* bad layer data";
ostr << "* bad layer data: " << child->AsString();
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
text = child->GetChild( 1 )->GetSymbol();
// NOTE: for the moment we only process Edge.Cuts
if( text == "Edge.Cuts" )
if( *layer == "Edge.Cuts" )
m_layer = LAYER_EDGE;
}
}