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
4b8df000
Commit
4b8df000
authored
Apr 10, 2015
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: adding teardrops to circular pads
parent
aac3de4a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
31 deletions
+47
-31
class_teardrop.cpp
pcbnew/class_teardrop.cpp
+33
-25
class_teardrop.h
pcbnew/class_teardrop.h
+1
-2
dialog_teardrops_base.fbp
pcbnew/dialogs/dialog_teardrops_base.fbp
+4
-4
edit_teardrops.cpp
pcbnew/edit_teardrops.cpp
+9
-0
No files found.
pcbnew/class_teardrop.cpp
View file @
4b8df000
...
@@ -12,10 +12,26 @@ bool TEARDROP::Create(TRACK &aTrack, ENDPOINT_T endPoint, TEARDROP_TYPE type = T
...
@@ -12,10 +12,26 @@ bool TEARDROP::Create(TRACK &aTrack, ENDPOINT_T endPoint, TEARDROP_TYPE type = T
{
{
bool
result
=
false
;
bool
result
=
false
;
VIA
*
aVia
=
GetViaOnEnd
(
aTrack
,
endPoint
);
BOARD_CONNECTED_ITEM
*
anObject
=
GetObjectOnEnd
(
aTrack
,
endPoint
);
if
(
aVia
==
NULL
)
{
VIA
*
aVia
=
NULL
;
if
(
anObject
==
NULL
)
{
return
false
;
return
false
;
}
}
else
{
switch
(
anObject
->
Type
())
{
case
PCB_VIA_T
:
aVia
=
dynamic_cast
<
VIA
*>
(
anObject
);
break
;
case
PCB_PAD_T
:
aVia
=
new
VIA
(
NULL
);
aVia
->
SetLayer
(
anObject
->
GetLayer
());
aVia
->
SetPosition
(
anObject
->
GetPosition
());
aVia
->
SetWidth
(
2
*
dynamic_cast
<
D_PAD
*>
(
anObject
)
->
GetBoundingRadius
());
break
;
default
:
break
;
}
}
if
(
type
==
TEARDROP_STRAIGHT
)
{
if
(
type
==
TEARDROP_STRAIGHT
)
{
result
=
StraightSegments
(
aTrack
,
*
aVia
,
m_upperSegment
,
m_lowerSegment
,
100
);
result
=
StraightSegments
(
aTrack
,
*
aVia
,
m_upperSegment
,
m_lowerSegment
,
100
);
...
@@ -144,9 +160,10 @@ bool TEARDROP::StraightSegments(TRACK &aTrack, const VIA &aVia, std::vector<VECT
...
@@ -144,9 +160,10 @@ bool TEARDROP::StraightSegments(TRACK &aTrack, const VIA &aVia, std::vector<VECT
}
}
// TODO: m_TracksConnected member is considered a temporary storage. Find another way to get an object
// TODO: m_TracksConnected member is considered a temporary storage. Find another way to get an object
VIA
*
TEARDROP
::
GetVia
OnEnd
(
TRACK
&
aTrack
,
ENDPOINT_T
endPoint
)
BOARD_CONNECTED_ITEM
*
TEARDROP
::
GetObject
OnEnd
(
TRACK
&
aTrack
,
ENDPOINT_T
endPoint
)
{
{
wxPoint
trackPoint
;
wxPoint
trackPoint
;
BOARD_CONNECTED_ITEM
*
item
=
NULL
;
std
::
vector
<
TRACK
*>::
const_iterator
iter
;
std
::
vector
<
TRACK
*>::
const_iterator
iter
;
if
(
endPoint
==
ENDPOINT_START
)
{
if
(
endPoint
==
ENDPOINT_START
)
{
...
@@ -156,34 +173,25 @@ VIA *TEARDROP::GetViaOnEnd(TRACK &aTrack, ENDPOINT_T endPoint)
...
@@ -156,34 +173,25 @@ VIA *TEARDROP::GetViaOnEnd(TRACK &aTrack, ENDPOINT_T endPoint)
trackPoint
=
aTrack
.
GetEnd
();
trackPoint
=
aTrack
.
GetEnd
();
}
}
// Check for vias first
for
(
iter
=
aTrack
.
m_TracksConnected
.
begin
();
iter
!=
aTrack
.
m_TracksConnected
.
end
();
++
iter
)
{
for
(
iter
=
aTrack
.
m_TracksConnected
.
begin
();
iter
!=
aTrack
.
m_TracksConnected
.
end
();
++
iter
)
{
KICAD_T
type
=
(
*
iter
)
->
Type
();
KICAD_T
type
=
(
*
iter
)
->
Type
();
bool
hitTest
=
(
*
iter
)
->
HitTest
(
trackPoint
);
bool
hitTest
=
(
*
iter
)
->
HitTest
(
trackPoint
);
if
(
type
==
PCB_VIA_T
&&
hitTest
==
true
)
{
if
(
type
==
PCB_VIA_T
&&
hitTest
==
true
)
{
return
static_cast
<
VIA
*>
(
*
iter
);
item
=
*
iter
;
}
}
// Check for pads if via was not found on this end of the track
if
(
item
==
NULL
)
{
for
(
std
::
vector
<
D_PAD
*>::
iterator
iter
=
aTrack
.
m_PadsConnected
.
begin
();
iter
!=
aTrack
.
m_PadsConnected
.
end
();
++
iter
)
{
PAD_SHAPE_T
shape
=
(
*
iter
)
->
GetShape
();
bool
hitTest
=
(
*
iter
)
->
HitTest
(
trackPoint
);
if
(
shape
==
PAD_CIRCLE
&&
hitTest
==
true
)
{
item
=
*
iter
;
printf
(
"found circle pad
\n
"
);
}
}
}
}
return
NULL
;
}
bool
TEARDROP
::
BuildTracks
(
TRACK
&
aTrack
,
std
::
vector
<
VECTOR2I
>
points
,
std
::
vector
<
TRACK
*>
tracks
)
{
BOARD
*
board
=
aTrack
.
GetBoard
();
wxPoint
currentPoint
(
0
,
0
);
wxPoint
prevPoint
(
points
[
0
].
x
,
points
[
0
].
y
);
for
(
size_t
i
=
1
;
i
<
points
.
size
();
i
++
)
{
TRACK
*
track
=
new
TRACK
(
aTrack
);
track
->
SetWidth
(
aTrack
.
GetWidth
());
track
->
SetLayer
(
aTrack
.
GetLayer
());
track
->
SetNetCode
(
aTrack
.
GetNetCode
());
currentPoint
.
x
=
points
[
i
].
x
;
currentPoint
.
y
=
points
[
i
].
y
;
track
->
SetStart
(
prevPoint
);
track
->
SetEnd
(
currentPoint
);
board
->
Add
(
track
);
tracks
.
push_back
(
track
);
prevPoint
=
currentPoint
;
}
}
return
true
;
return
item
;
}
}
pcbnew/class_teardrop.h
View file @
4b8df000
...
@@ -99,8 +99,7 @@ private:
...
@@ -99,8 +99,7 @@ private:
*/
*/
bool
SetVector
(
TRACK
&
aTrack
,
const
VIA
&
aVia
,
VECTOR2I
&
startPoint
,
VECTOR2I
&
endPoint
);
bool
SetVector
(
TRACK
&
aTrack
,
const
VIA
&
aVia
,
VECTOR2I
&
startPoint
,
VECTOR2I
&
endPoint
);
VIA
*
GetViaOnEnd
(
TRACK
&
aTrack
,
ENDPOINT_T
endPoint
);
BOARD_CONNECTED_ITEM
*
GetObjectOnEnd
(
TRACK
&
aTrack
,
ENDPOINT_T
endPoint
);
bool
BuildTracks
(
TRACK
&
aTrack
,
const
std
::
vector
<
VECTOR2I
>
points
,
std
::
vector
<
TRACK
*>
tracks
);
};
};
#endif // CLASS_TEARDROP_H
#endif // CLASS_TEARDROP_H
pcbnew/dialogs/dialog_teardrops_base.fbp
View file @
4b8df000
...
@@ -603,7 +603,7 @@
...
@@ -603,7 +603,7 @@
<property
name=
"border"
>
5
</property>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxEXPAND
</property>
<property
name=
"flag"
>
wxEXPAND
</property>
<property
name=
"proportion"
>
1
</property>
<property
name=
"proportion"
>
1
</property>
<object
class=
"wxBoxSizer"
expanded=
"
0
"
>
<object
class=
"wxBoxSizer"
expanded=
"
1
"
>
<property
name=
"minimum_size"
></property>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
m_scopeSizer
</property>
<property
name=
"name"
>
m_scopeSizer
</property>
<property
name=
"orient"
>
wxVERTICAL
</property>
<property
name=
"orient"
>
wxVERTICAL
</property>
...
@@ -622,7 +622,7 @@
...
@@ -622,7 +622,7 @@
<event
name=
"OnUpdateUI"
></event>
<event
name=
"OnUpdateUI"
></event>
<object
class=
"sizeritem"
expanded=
"1"
>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxALL
</property>
<property
name=
"flag"
></property>
<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>
...
@@ -678,7 +678,7 @@
...
@@ -678,7 +678,7 @@
</object>
</object>
<object
class=
"sizeritem"
expanded=
"1"
>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxALL
</property>
<property
name=
"flag"
></property>
<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>
...
@@ -734,7 +734,7 @@
...
@@ -734,7 +734,7 @@
</object>
</object>
<object
class=
"sizeritem"
expanded=
"1"
>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxALL
</property>
<property
name=
"flag"
></property>
<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>
...
...
pcbnew/edit_teardrops.cpp
View file @
4b8df000
#include "edit_teardrops.h"
#include "edit_teardrops.h"
#include "class_board.h"
#include "class_board.h"
#include "class_module.h"
TEARDROPS_EDITOR
::
TEARDROPS_EDITOR
(
PCB_EDIT_FRAME
*
frame
,
KIGFX
::
VIEW
*
view
)
TEARDROPS_EDITOR
::
TEARDROPS_EDITOR
(
PCB_EDIT_FRAME
*
frame
,
KIGFX
::
VIEW
*
view
)
{
{
...
@@ -50,6 +51,7 @@ bool TEARDROPS_EDITOR::AddToAll(const DIALOG_TEARDROPS::TEARDROPS_SETTINGS &sett
...
@@ -50,6 +51,7 @@ bool TEARDROPS_EDITOR::AddToAll(const DIALOG_TEARDROPS::TEARDROPS_SETTINGS &sett
bool
retVal
=
false
;
bool
retVal
=
false
;
bool
added
=
false
;
bool
added
=
false
;
// Iterate through all vias and add teardrops to connected tracks
if
((
settings
.
m_scope
&
DIALOG_TEARDROPS
::
TEARDROPS_SCOPE_VIAS
)
==
DIALOG_TEARDROPS
::
TEARDROPS_SCOPE_VIAS
)
{
if
((
settings
.
m_scope
&
DIALOG_TEARDROPS
::
TEARDROPS_SCOPE_VIAS
)
==
DIALOG_TEARDROPS
::
TEARDROPS_SCOPE_VIAS
)
{
for
(
VIA
*
via
=
GetFirstVia
(
m_frame
->
GetBoard
()
->
m_Track
);
via
!=
NULL
;
for
(
VIA
*
via
=
GetFirstVia
(
m_frame
->
GetBoard
()
->
m_Track
);
via
!=
NULL
;
via
=
GetFirstVia
(
via
->
Next
()))
{
via
=
GetFirstVia
(
via
->
Next
()))
{
...
@@ -69,6 +71,13 @@ bool TEARDROPS_EDITOR::AddToAll(const DIALOG_TEARDROPS::TEARDROPS_SETTINGS &sett
...
@@ -69,6 +71,13 @@ bool TEARDROPS_EDITOR::AddToAll(const DIALOG_TEARDROPS::TEARDROPS_SETTINGS &sett
}
}
}
}
// Iterate through all modules and add teardrops to tracks connected to their pads
if
((
settings
.
m_scope
&
DIALOG_TEARDROPS
::
TEARDROPS_SCOPE_PADS
)
==
DIALOG_TEARDROPS
::
TEARDROPS_SCOPE_PADS
)
{
for
(
MODULE
*
module
=
m_frame
->
GetBoard
()
->
m_Modules
.
GetFirst
();
module
!=
NULL
;
module
=
module
->
Next
())
{
}
}
if
(
added
==
true
)
{
if
(
added
==
true
)
{
m_frame
->
SaveCopyInUndoList
(
m_undoListPicker
,
UR_NEW
);
m_frame
->
SaveCopyInUndoList
(
m_undoListPicker
,
UR_NEW
);
}
}
...
...
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