Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
690ae645
Commit
690ae645
authored
May 01, 2015
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add DRC check
parent
7e76fd08
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
34 deletions
+92
-34
dialog_teardrops.cpp
pcbnew/dialogs/dialog_teardrops.cpp
+1
-2
dialog_teardrops_base.cpp
pcbnew/dialogs/dialog_teardrops_base.cpp
+0
-3
dialog_teardrops_base.fbp
pcbnew/dialogs/dialog_teardrops_base.fbp
+2
-2
edit_teardrops.cpp
pcbnew/tools/edit_teardrops.cpp
+81
-26
edit_teardrops.h
pcbnew/tools/edit_teardrops.h
+8
-1
No files found.
pcbnew/dialogs/dialog_teardrops.cpp
View file @
690ae645
...
@@ -145,8 +145,7 @@ void DIALOG_TEARDROPS::LockOptionsControls(bool state)
...
@@ -145,8 +145,7 @@ void DIALOG_TEARDROPS::LockOptionsControls(bool state)
if
(
m_tracksSelected
->
GetValue
()
==
true
)
{
if
(
m_tracksSelected
->
GetValue
()
==
true
)
{
m_checkClear
->
Enable
(
true
);
m_checkClear
->
Enable
(
true
);
}
}
// The line below is intentionally commented out unless DRC is taken into consideration
m_checkIgnore
->
Enable
(
true
);
//m_checkIgnore->Enable(true);
m_choiceStyle
->
Enable
(
true
);
m_choiceStyle
->
Enable
(
true
);
}
}
}
}
...
...
pcbnew/dialogs/dialog_teardrops_base.cpp
View file @
690ae645
...
@@ -48,9 +48,6 @@ DIALOG_TEARDROPS_BASE::DIALOG_TEARDROPS_BASE( wxWindow* parent, wxWindowID id, c
...
@@ -48,9 +48,6 @@ DIALOG_TEARDROPS_BASE::DIALOG_TEARDROPS_BASE( wxWindow* parent, wxWindowID id, c
m_optionsSizer
=
new
wxStaticBoxSizer
(
new
wxStaticBox
(
this
,
wxID_ANY
,
wxT
(
"Options"
)
),
wxVERTICAL
);
m_optionsSizer
=
new
wxStaticBoxSizer
(
new
wxStaticBox
(
this
,
wxID_ANY
,
wxT
(
"Options"
)
),
wxVERTICAL
);
m_checkIgnore
=
new
wxCheckBox
(
this
,
wxID_ANY
,
wxT
(
"Ignore DRC"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_checkIgnore
=
new
wxCheckBox
(
this
,
wxID_ANY
,
wxT
(
"Ignore DRC"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_checkIgnore
->
SetValue
(
true
);
m_checkIgnore
->
Enable
(
false
);
m_optionsSizer
->
Add
(
m_checkIgnore
,
0
,
0
,
5
);
m_optionsSizer
->
Add
(
m_checkIgnore
,
0
,
0
,
5
);
m_checkClear
=
new
wxCheckBox
(
this
,
wxID_ANY
,
wxT
(
"Clear selection"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_checkClear
=
new
wxCheckBox
(
this
,
wxID_ANY
,
wxT
(
"Clear selection"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
...
...
pcbnew/dialogs/dialog_teardrops_base.fbp
View file @
690ae645
...
@@ -368,9 +368,9 @@
...
@@ -368,9 +368,9 @@
<property
name=
"proportion"
>
0
</property>
<property
name=
"proportion"
>
0
</property>
<object
class=
"wxCheckBox"
expanded=
"1"
>
<object
class=
"wxCheckBox"
expanded=
"1"
>
<property
name=
"bg"
></property>
<property
name=
"bg"
></property>
<property
name=
"checked"
>
1
</property>
<property
name=
"checked"
>
0
</property>
<property
name=
"context_help"
></property>
<property
name=
"context_help"
></property>
<property
name=
"enabled"
>
0
</property>
<property
name=
"enabled"
>
1
</property>
<property
name=
"fg"
></property>
<property
name=
"fg"
></property>
<property
name=
"font"
></property>
<property
name=
"font"
></property>
<property
name=
"hidden"
>
0
</property>
<property
name=
"hidden"
>
0
</property>
...
...
pcbnew/tools/edit_teardrops.cpp
View file @
690ae645
...
@@ -5,10 +5,15 @@
...
@@ -5,10 +5,15 @@
#include "view/view.h"
#include "view/view.h"
#include "common_actions.h"
#include "common_actions.h"
#include "router/pns_utils.h"
#include "router/pns_utils.h"
#include "router/pns_router.h"
TEARDROPS_EDITOR
::
TEARDROPS_EDITOR
()
:
TEARDROPS_EDITOR
::
TEARDROPS_EDITOR
()
:
TOOL_BASE
(
BATCH
,
TOOL_MANAGER
::
MakeToolId
(
"pcbnew.TeardropsEditor"
),
"pcbnew.TeardropsEditor"
)
TOOL_BASE
(
BATCH
,
TOOL_MANAGER
::
MakeToolId
(
"pcbnew.TeardropsEditor"
),
"pcbnew.TeardropsEditor"
)
{
{
m_frame
=
NULL
;
m_view
=
NULL
;
m_type
=
TEARDROP
::
TEARDROP_STRAIGHT
;
m_strategy
=
DRC_COMPLY
;
}
}
TEARDROPS_EDITOR
::~
TEARDROPS_EDITOR
()
TEARDROPS_EDITOR
::~
TEARDROPS_EDITOR
()
...
@@ -19,6 +24,8 @@ void TEARDROPS_EDITOR::Reset(RESET_REASON aReason)
...
@@ -19,6 +24,8 @@ void TEARDROPS_EDITOR::Reset(RESET_REASON aReason)
{
{
m_frame
=
getEditFrame
<
PCB_EDIT_FRAME
>
();
m_frame
=
getEditFrame
<
PCB_EDIT_FRAME
>
();
m_view
=
getView
();
m_view
=
getView
();
m_type
=
TEARDROP
::
TEARDROP_STRAIGHT
;
m_strategy
=
DRC_COMPLY
;
}
}
void
TEARDROPS_EDITOR
::
FilterSelection
(
SELECTION
&
selection
)
void
TEARDROPS_EDITOR
::
FilterSelection
(
SELECTION
&
selection
)
...
@@ -45,6 +52,14 @@ bool TEARDROPS_EDITOR::EditTeardrops(const DIALOG_TEARDROPS::TEARDROPS_SETTINGS
...
@@ -45,6 +52,14 @@ bool TEARDROPS_EDITOR::EditTeardrops(const DIALOG_TEARDROPS::TEARDROPS_SETTINGS
default
:
default
:
m_type
=
TEARDROP
::
TEARDROP_STRAIGHT
;
m_type
=
TEARDROP
::
TEARDROP_STRAIGHT
;
}
}
if
(
settings
.
m_ignoreDrc
==
true
)
{
m_strategy
=
DRC_IGNORE
;
}
else
{
m_strategy
=
DRC_COMPLY
;
}
FilterSelection
(
selection
);
FilterSelection
(
selection
);
if
(
settings
.
m_mode
==
DIALOG_TEARDROPS
::
TEARDROPS_MODE_ADD
)
{
if
(
settings
.
m_mode
==
DIALOG_TEARDROPS
::
TEARDROPS_MODE_ADD
)
{
if
(
settings
.
m_track
==
DIALOG_TEARDROPS
::
TEARDROPS_TRACKS_ALL
)
{
if
(
settings
.
m_track
==
DIALOG_TEARDROPS
::
TEARDROPS_TRACKS_ALL
)
{
...
@@ -99,27 +114,32 @@ bool TEARDROPS_EDITOR::AddToSelected(SELECTION &selection, const DIALOG_TEARDROP
...
@@ -99,27 +114,32 @@ bool TEARDROPS_EDITOR::AddToSelected(SELECTION &selection, const DIALOG_TEARDROP
{
{
bool
retVal
=
false
;
bool
retVal
=
false
;
bool
added
=
false
;
bool
added
=
false
;
int
addedNum
=
0
;
for
(
size_t
i
=
0
;
i
<
selection
.
items
.
GetCount
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
selection
.
items
.
GetCount
();
i
++
)
{
TRACK
*
track
=
static_cast
<
TRACK
*>
(
selection
.
items
.
GetPickedItem
(
i
));
TRACK
*
track
=
static_cast
<
TRACK
*>
(
selection
.
items
.
GetPickedItem
(
i
));
TEARDROP
teardropEnd
;
TEARDROP
teardropEnd
;
retVal
=
teardropEnd
.
Create
(
*
track
,
ENDPOINT_END
,
m_type
);
retVal
=
teardropEnd
.
Create
(
*
track
,
ENDPOINT_END
,
m_type
);
if
(
retVal
==
true
)
{
if
(
retVal
==
true
)
{
DrawSegments
(
teardropEnd
,
*
track
);
added
=
DrawSegments
(
teardropEnd
,
*
track
);
added
=
true
;
if
(
added
==
true
)
{
addedNum
++
;
}
}
}
TEARDROP
teardropStart
;
TEARDROP
teardropStart
;
retVal
=
teardropStart
.
Create
(
*
track
,
ENDPOINT_START
,
m_type
);
retVal
=
teardropStart
.
Create
(
*
track
,
ENDPOINT_START
,
m_type
);
if
(
retVal
==
true
)
{
if
(
retVal
==
true
)
{
DrawSegments
(
teardropStart
,
*
track
);
added
=
DrawSegments
(
teardropStart
,
*
track
);
added
=
true
;
if
(
added
==
true
)
{
addedNum
++
;
}
}
}
}
}
if
(
settings
.
m_clearSelection
==
true
)
{
if
(
settings
.
m_clearSelection
==
true
)
{
GetManager
()
->
RunAction
(
COMMON_ACTIONS
::
selectionClear
,
true
);
GetManager
()
->
RunAction
(
COMMON_ACTIONS
::
selectionClear
,
true
);
}
}
if
(
added
==
true
)
{
if
(
added
Num
>
0
)
{
m_frame
->
SaveCopyInUndoList
(
m_undoListPicker
,
UR_NEW
);
m_frame
->
SaveCopyInUndoList
(
m_undoListPicker
,
UR_NEW
);
m_undoListPicker
.
ClearItemsList
();
m_undoListPicker
.
ClearItemsList
();
}
}
...
@@ -131,7 +151,7 @@ bool TEARDROPS_EDITOR::IterateTracks(const BOARD_CONNECTED_ITEM *aObject)
...
@@ -131,7 +151,7 @@ bool TEARDROPS_EDITOR::IterateTracks(const BOARD_CONNECTED_ITEM *aObject)
assert
(
aObject
);
assert
(
aObject
);
bool
retVal
=
false
;
bool
retVal
=
false
;
bool
a
dded
=
false
;
bool
flagA
dded
=
false
;
for
(
size_t
i
=
0
;
i
<
aObject
->
m_TracksConnected
.
size
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
aObject
->
m_TracksConnected
.
size
();
i
++
)
{
TRACK
*
track
=
aObject
->
m_TracksConnected
[
i
];
TRACK
*
track
=
aObject
->
m_TracksConnected
[
i
];
...
@@ -141,12 +161,13 @@ bool TEARDROPS_EDITOR::IterateTracks(const BOARD_CONNECTED_ITEM *aObject)
...
@@ -141,12 +161,13 @@ bool TEARDROPS_EDITOR::IterateTracks(const BOARD_CONNECTED_ITEM *aObject)
TEARDROP
teardrop
;
TEARDROP
teardrop
;
retVal
=
teardrop
.
Create
(
*
track
,
endpoint
,
m_type
);
retVal
=
teardrop
.
Create
(
*
track
,
endpoint
,
m_type
);
if
(
retVal
==
true
)
{
if
(
retVal
==
true
)
{
DrawSegments
(
teardrop
,
*
track
);
if
(
DrawSegments
(
teardrop
,
*
track
)
==
true
&&
flagAdded
==
false
)
{
added
=
true
;
flagAdded
=
true
;
}
}
}
}
}
}
}
return
a
dded
;
return
flagA
dded
;
}
}
void
TEARDROPS_EDITOR
::
RemoveAll
()
void
TEARDROPS_EDITOR
::
RemoveAll
()
...
@@ -173,30 +194,64 @@ void TEARDROPS_EDITOR::RemoveAll()
...
@@ -173,30 +194,64 @@ void TEARDROPS_EDITOR::RemoveAll()
}
}
}
}
void
TEARDROPS_EDITOR
::
DrawSegments
(
TEARDROP
&
teardrop
,
TRACK
&
aTrack
)
bool
TEARDROPS_EDITOR
::
DrawSegments
(
TEARDROP
&
teardrop
,
TRACK
&
aTrack
)
{
{
bool
tracksAdded
=
true
;
bool
proceedBuild
=
true
;
ITEM_PICKER
picker
(
NULL
,
UR_NEW
);
ITEM_PICKER
picker
(
NULL
,
UR_NEW
);
PNS_NODE
*
world
=
PNS_ROUTER
::
GetInstance
()
->
GetWorld
();
BOARD
*
board
=
aTrack
.
GetBoard
();
std
::
vector
<
TRACK
*>
tracks
;
std
::
vector
<
VECTOR2I
>
coordinates
;
std
::
vector
<
VECTOR2I
>
coordinates
;
teardrop
.
GetCoordinates
(
coordinates
);
teardrop
.
GetCoordinates
(
coordinates
);
BOARD
*
board
=
aTrack
.
GetBoard
();
wxPoint
currentPoint
(
0
,
0
);
wxPoint
currentPoint
(
0
,
0
);
wxPoint
prevPoint
(
coordinates
[
0
].
x
,
coordinates
[
0
].
y
);
wxPoint
prevPoint
(
coordinates
[
0
].
x
,
coordinates
[
0
].
y
);
for
(
size_t
i
=
1
;
i
<
coordinates
.
size
();
i
++
)
{
for
(
size_t
i
=
1
;
i
<
coordinates
.
size
();
i
++
)
{
TRACK
*
track
=
new
TRACK
(
aTrack
);
if
(
m_strategy
!=
DRC_IGNORE
)
{
track
->
SetWidth
(
aTrack
.
GetWidth
());
PNS_SEGMENT
segment
(
SEG
(
coordinates
[
i
-
1
],
coordinates
[
i
]),
aTrack
.
GetNetCode
());
track
->
SetLayer
(
aTrack
.
GetLayer
());
segment
.
SetWidth
(
aTrack
.
GetWidth
());
track
->
SetNetCode
(
aTrack
.
GetNetCode
());
segment
.
SetLayers
(
PNS_LAYERSET
(
aTrack
.
GetLayer
()));
currentPoint
.
x
=
coordinates
[
i
].
x
;
segment
.
SetParent
(
&
aTrack
);
currentPoint
.
y
=
coordinates
[
i
].
y
;
PNS_NODE
::
OBSTACLES
obstacles
;
track
->
SetStart
(
prevPoint
);
if
(
world
->
QueryColliding
(
&
segment
,
obstacles
,
PNS_ITEM
::
ANY
,
1
)
>
0
)
{
track
->
SetEnd
(
currentPoint
);
// DRC violation found, the segment of a teadrop can not be place
track
->
ClearFlags
();
tracksAdded
=
false
;
track
->
SetState
(
FLAG1
,
true
);
proceedBuild
=
false
;
board
->
Add
(
track
);
break
;
m_view
->
Add
(
track
);
}
}
if
(
proceedBuild
==
true
)
{
TRACK
*
track
=
new
TRACK
(
aTrack
);
track
->
SetWidth
(
aTrack
.
GetWidth
());
track
->
SetLayer
(
aTrack
.
GetLayer
());
track
->
SetNetCode
(
aTrack
.
GetNetCode
());
currentPoint
=
wxPoint
(
coordinates
[
i
].
x
,
coordinates
[
i
].
y
);
track
->
SetStart
(
prevPoint
);
track
->
SetEnd
(
currentPoint
);
track
->
ClearFlags
();
track
->
SetState
(
FLAG1
,
true
);
tracks
.
push_back
(
track
);
prevPoint
=
currentPoint
;
picker
.
SetItem
(
track
);
m_undoListPicker
.
PushItem
(
picker
);
}
prevPoint
=
currentPoint
;
prevPoint
=
currentPoint
;
picker
.
SetItem
(
track
);
m_undoListPicker
.
PushItem
(
picker
);
}
}
if
(
tracksAdded
==
true
)
{
BOOST_FOREACH
(
TRACK
*
item
,
tracks
)
{
board
->
Add
(
item
);
m_view
->
Add
(
item
);
}
}
else
{
// The teardrop can not be created thus delete all allocated tracks and
// remove them from undo list
BOOST_FOREACH
(
TRACK
*
item
,
tracks
)
{
m_undoListPicker
.
PopItem
();
delete
item
;
}
}
return
tracksAdded
;
}
}
pcbnew/tools/edit_teardrops.h
View file @
690ae645
...
@@ -18,10 +18,17 @@ public:
...
@@ -18,10 +18,17 @@ public:
void
Reset
(
RESET_REASON
aReason
);
void
Reset
(
RESET_REASON
aReason
);
private
:
private
:
typedef
enum
{
DRC_COMPLY
,
DRC_IGNORE
,
DRC_ADJUST
}
DRC_STRATEGY
;
PCB_EDIT_FRAME
*
m_frame
;
PCB_EDIT_FRAME
*
m_frame
;
KIGFX
::
VIEW
*
m_view
;
KIGFX
::
VIEW
*
m_view
;
TEARDROP
::
TEARDROP_TYPE
m_type
;
TEARDROP
::
TEARDROP_TYPE
m_type
;
PICKED_ITEMS_LIST
m_undoListPicker
;
PICKED_ITEMS_LIST
m_undoListPicker
;
DRC_STRATEGY
m_strategy
;
/**
/**
* @brief FilterSelection filters selected objects and removes all objects except tracks.
* @brief FilterSelection filters selected objects and removes all objects except tracks.
...
@@ -44,7 +51,7 @@ private:
...
@@ -44,7 +51,7 @@ private:
*/
*/
void
RemoveAll
();
void
RemoveAll
();
void
DrawSegments
(
TEARDROP
&
teardrop
,
TRACK
&
track
);
bool
DrawSegments
(
TEARDROP
&
teardrop
,
TRACK
&
track
);
};
};
#endif // TEARDROPS_EDITOR_H
#endif // TEARDROPS_EDITOR_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment