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
c5973eb8
Commit
c5973eb8
authored
May 07, 2015
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add documentation to .h files and update code formatting
parent
c25acdbb
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
827 additions
and
417 deletions
+827
-417
class_teardrop.cpp
pcbnew/class_teardrop.cpp
+223
-135
class_teardrop.h
pcbnew/class_teardrop.h
+79
-42
dialog_teardrops.cpp
pcbnew/dialogs/dialog_teardrops.cpp
+138
-89
dialog_teardrops.h
pcbnew/dialogs/dialog_teardrops.h
+91
-20
edit_teardrops.cpp
pcbnew/tools/edit_teardrops.cpp
+212
-114
edit_teardrops.h
pcbnew/tools/edit_teardrops.h
+84
-17
No files found.
pcbnew/class_teardrop.cpp
View file @
c5973eb8
This diff is collapsed.
Click to expand it.
pcbnew/class_teardrop.h
View file @
c5973eb8
...
...
@@ -17,93 +17,130 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file class_teardrop.h
* @brief Definitions for teardrops.
*/
#ifndef CLASS_TEARDROP_H
#define CLASS_TEARDROP_H
#include "class_track.h"
#include "geometry/seg.h"
/**
* @brief The TEARDROP class
* is base definition of a teardrop. It is intended for calculation and holding of points which
* compose a teardrop. This class does not contain any methods which create actual tracks.
*/
class
TEARDROP
{
public
:
TEARDROP
();
/**
* @brief
D
efines the type of a teardrop.
* @brief
The TEARDROP_TYPE d
efines the type of a teardrop.
*/
typedef
enum
{
TEARDROP_NONE
,
///< The type is undefined
TEARDROP_STRAIGHT
,
///< The teardrop is created by two straight segments
TEARDROP_CURVED
///< The teardrop is created by several segments approximating a curve
typedef
enum
{
TEARDROP_NONE
,
///< The type is undefined
TEARDROP_STRAIGHT
,
///< The teardrop is created by two straight segments
TEARDROP_CURVED
///< The teardrop is created by several segments approximating a curve
}
TEARDROP_TYPE
;
/**
* @brief GetType returns the type of the teardrop.
* @return TEARDROP_TYPE
* @brief Function \a GetType
* returns the type of the teardrop.
* @return TEARDROP_TYPE - the type of the teardrop
*/
TEARDROP_TYPE
GetType
()
const
{
return
m_type
;
}
TEARDROP_TYPE
GetType
()
const
{
return
m_type
;
}
/**
* @brief Function Create creates a teardrop(s) for a given track
* @param aTrack
* @return \a true in case the teardrops were successfully built and \a false otherwise
* @brief Function \a Create
* creates a teardrop(s) for a given track.
* @param [in] aTrack is a track at which teardrop(s) should be created
* @param [in] aEndPoint is an end point at which a teardrop should be created
* @param [in] aType defines the type of a teardrop
* @return bool - \a true in case the teardrops were successfully built and \a false otherwise
*/
bool
Create
(
TRACK
&
aTrack
,
ENDPOINT_T
endPoint
,
TEARDROP_TYPE
type
);
bool
Create
(
TRACK
&
aTrack
,
ENDPOINT_T
aEndPoint
,
TEARDROP_TYPE
aType
);
void
GetCoordinates
(
std
::
vector
<
VECTOR2I
>
&
points
)
const
{
points
=
m_coordinates
;}
/**
* @brief Function \a GetCoordinates
* returns the coordinates of created teardrop.
* @param [out] aPoints is a container for coordinates
*/
void
GetCoordinates
(
std
::
vector
<
VECTOR2I
>&
aPoints
)
const
{
aPoints
=
m_coordinates
;
}
private
:
///
>
Contains the type of teardrop
/// Contains the type of teardrop
TEARDROP_TYPE
m_type
;
///> \a m_upperSegment and \a m_lowerSegment contain coordinates of segments composing a teardrop
std
::
vector
<
VECTOR2I
>
m_upperSegment
;
std
::
vector
<
VECTOR2I
>
m_lowerSegment
;
/// Contains the actual coordinates of teardrop
std
::
vector
<
VECTOR2I
>
m_coordinates
;
/**
* @brief Function \a CurvedSegments computes several points on deltoid curve and moves
* these points along the vector defined by \a aTrack.
* @brief Function \a curvedSegments
* computes several points on deltoid curve and moves these points along the vector
* defined by \a aTrack.
*
* This function computes the coordinates of points only and does not build actual track segments.
* See deltiod description and its parametric equations on [wiki page](http://en.wikipedia.org/wiki/Deltoid_curve).
* @param [in] aTrack defines a vector along which the curved segments should be built
* @param [in] aVia used as the center of coordinates
* @return \a true in case the segments were successfully built and \a false otherwise
* @return
bool -
\a true in case the segments were successfully built and \a false otherwise
*/
bool
CurvedSegments
(
TRACK
&
aTrack
,
const
VIA
&
aVia
);
bool
curvedSegments
(
TRACK
&
aTrack
,
const
VIA
&
aVia
);
/**
* @brief Function \a StraightSegments builds two tangent lines for a circle from a givent point.
* @brief Function \a straightSegments
* builds two tangent lines to a circle from a givent point.
*
* This function computes the coordinates of points only and does not build actual track segments.
* @param [in] aTrack defines a vector along which the segments should be built
* @param [in] aVia represents a circle to which the segments should be built
* @param [in] distance is distance ratio (in percent) from circle center in respect to its diameter
* @return \a true in case the segments were successfully built and \a false otherwise
* @param [in] aDistance is distance ratio (in percent) from circle center in respect to its diameter
* @return bool - \a true in case the segments were successfully built and \a false otherwise
*/
bool
straightSegments
(
TRACK
&
aTrack
,
const
VIA
&
aVia
,
int
aDistance
);
/**
* @brief Function \a setVector
* creates a vector from \a aTrack directed into \a aVia.
* @param [in] aTrack is used to create a vector
* @param [in] aVia is an object to which the vector should be pointed to
* @param [out] aStartPoint is start point of resulting vector
* @param [out] aEndPoint is end point of resulting vector
* @return bool - \a true in case the vector is created successfully and \a false otherwise
*/
bool
setVector
(
TRACK
&
aTrack
,
const
VIA
&
aVia
,
VECTOR2I
&
aStartPoint
,
VECTOR2I
&
aEndPoint
);
/**
* @brief Function \a getObjectOnEnd
* returns an object (via or pad) at the given end of a track.
* @param [in] aTrack is a reference track
* @param [in] aEndPoint defines the end in question
* @return BOARD_CONNECTED_ITEM - the object found or NULL otherwise
*/
bool
StraightSegments
(
TRACK
&
aTrack
,
const
VIA
&
aVia
,
int
distance
);
BOARD_CONNECTED_ITEM
*
getObjectOnEnd
(
TRACK
&
aTrack
,
ENDPOINT_T
aEndPoint
);
/**
* @brief Function
SetVector creates a vector from \a aTrack directed into \a aVia
*
@param aTrack is used to create a vector
* @param
startPoint is start point of resulting vector
* @param
endPoint is end point of resulting vector
* @
return \a true in case the vector is created successfully and \a false otherwise
* @brief Function
\a splitSegment
*
splits a segment into given number of subsegments.
* @param
[in] aSegment is a segment to be split
* @param
[i] aSplits is a number of splits
* @
param [out] aPoints is a container for split points
*/
bool
SetVector
(
TRACK
&
aTrack
,
const
VIA
&
aVia
,
VECTOR2I
&
startPoint
,
VECTOR2I
&
endPoint
);
void
splitSegment
(
const
SEG
&
aSegment
,
int
aSplits
,
std
::
vector
<
VECTOR2I
>&
aPoints
);
BOARD_CONNECTED_ITEM
*
GetObjectOnEnd
(
TRACK
&
aTrack
,
ENDPOINT_T
endPoint
);
void
SplitSegment
(
const
SEG
&
segment
,
int
splits
,
std
::
vector
<
VECTOR2I
>
&
points
);
inline
void
PointOnCurve
(
int
angle
,
double
radius
,
VECTOR2I
&
point
)
{
/**
* @brief Function \a pointOnCurve
* calculates a single point on a deltoid curve.
* @param [in] aAngle is an angle at which the point should be calculated
* @param [in] aRadius is the radius of a rolling circle
* @param [out] aPoint is a container for calculated point
*/
inline
void
pointOnCurve
(
int
aAngle
,
double
aRadius
,
VECTOR2I
&
aPoint
)
{
double
coeff
=
M_PI
/
180
.
0
;
point
.
x
=
2
*
radius
*
cos
(
coeff
*
angle
)
+
radius
*
cos
(
2
*
coeff
*
angle
);
point
.
y
=
2
*
radius
*
sin
(
coeff
*
angle
)
-
radius
*
sin
(
2
*
coeff
*
angle
);
aPoint
.
x
=
2
*
aRadius
*
cos
(
coeff
*
aAngle
)
+
aRadius
*
cos
(
2
*
coeff
*
aAngle
);
aPoint
.
y
=
2
*
aRadius
*
sin
(
coeff
*
aAngle
)
-
aRadius
*
sin
(
2
*
coeff
*
aAngle
);
}
};
#endif // CLASS_TEARDROP_H
#endif
// CLASS_TEARDROP_H
pcbnew/dialogs/dialog_teardrops.cpp
View file @
c5973eb8
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Elphel, Inc.
*
* 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
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dialog_teardrops.h"
DIALOG_TEARDROPS
::
DIALOG_TEARDROPS
(
PCB_EDIT_FRAME
*
aParent
,
TEARDROPS_SETTINGS
*
settings
)
:
DIALOG_TEARDROPS_BASE
(
aParent
)
DIALOG_TEARDROPS
::
DIALOG_TEARDROPS
(
PCB_EDIT_FRAME
*
aParent
,
TEARDROPS_SETTINGS
*
aSettings
=
NULL
)
:
DIALOG_TEARDROPS_BASE
(
aParent
)
{
m_parent
=
aParent
;
m_settings
=
settings
;
if
(
m_settings
!=
NULL
)
{
InitDialogSettings
();
m_settings
=
aSettings
;
if
(
m_settings
!=
NULL
)
{
initDialogSettings
();
}
}
void
DIALOG_TEARDROPS
::
I
nitDialogSettings
()
void
DIALOG_TEARDROPS
::
i
nitDialogSettings
()
{
wxASSERT
(
m_settings
!=
NULL
);
if
(
m_modeRemove
->
GetValue
()
==
true
)
{
assert
(
m_settings
!=
NULL
);
if
(
m_modeRemove
->
GetValue
()
==
true
)
{
m_settings
->
m_mode
=
TEARDROPS_MODE_REMOVE
;
}
else
{
else
{
m_settings
->
m_mode
=
TEARDROPS_MODE_ADD
;
}
if
(
m_tracksAll
->
GetValue
()
==
true
)
{
if
(
m_tracksAll
->
GetValue
()
==
true
)
{
m_settings
->
m_track
=
TEARDROPS_TRACKS_ALL
;
}
else
{
else
{
m_settings
->
m_track
=
TEARDROPS_TRACKS_SELECTED
;
}
m_settings
->
m_type
=
static_cast
<
TEARDROPS_TYPE
>
(
m_choiceStyle
->
GetSelection
()
);
m_settings
->
m_type
=
static_cast
<
TEARDROPS_TYPE
>
(
m_choiceStyle
->
GetSelection
()
);
m_settings
->
m_scope
=
TEARDROPS_SCOPE_NONE
;
if
(
m_scopeVias
->
IsChecked
()
==
true
)
{
m_settings
->
m_scope
=
static_cast
<
TEARDROPS_SCOPE
>
(
m_settings
->
m_scope
|
TEARDROPS_SCOPE_VIAS
);
if
(
m_scopeVias
->
IsChecked
()
==
true
)
{
m_settings
->
m_scope
=
static_cast
<
TEARDROPS_SCOPE
>
(
m_settings
->
m_scope
|
TEARDROPS_SCOPE_VIAS
);
}
if
(
m_scopePads
->
IsChecked
()
==
true
)
{
m_settings
->
m_scope
=
static_cast
<
TEARDROPS_SCOPE
>
(
m_settings
->
m_scope
|
TEARDROPS_SCOPE_PADS
);
if
(
m_scopePads
->
IsChecked
()
==
true
)
{
m_settings
->
m_scope
=
static_cast
<
TEARDROPS_SCOPE
>
(
m_settings
->
m_scope
|
TEARDROPS_SCOPE_PADS
);
}
if
(
m_scopeTracks
->
IsChecked
()
==
true
)
{
m_settings
->
m_scope
=
static_cast
<
TEARDROPS_SCOPE
>
(
m_settings
->
m_scope
|
TEARDROPS_SCOPE_TRACKS
);
if
(
m_scopeTracks
->
IsChecked
()
==
true
)
{
m_settings
->
m_scope
=
static_cast
<
TEARDROPS_SCOPE
>
(
m_settings
->
m_scope
|
TEARDROPS_SCOPE_TRACKS
);
}
m_settings
->
m_clearSelection
=
m_checkClear
->
IsChecked
();
m_settings
->
m_ignoreDrc
=
m_checkIgnore
->
IsChecked
();
}
void
DIALOG_TEARDROPS
::
OnModeAdd
(
wxCommandEvent
&
event
)
void
DIALOG_TEARDROPS
::
OnModeAdd
(
wxCommandEvent
&
aEvent
)
{
event
.
Skip
();
if
(
m_settings
!=
NULL
)
{
aEvent
.
Skip
();
if
(
m_settings
!=
NULL
)
{
m_settings
->
m_mode
=
TEARDROPS_MODE_ADD
;
LockOptionsControls
(
false
);
LockTracksControls
(
false
);
LockScopeControls
(
false
);
lockOptionsControls
(
false
);
lockTracksControls
(
false
);
lockScopeControls
(
false
);
}
}
void
DIALOG_TEARDROPS
::
OnModeRemove
(
wxCommandEvent
&
event
)
void
DIALOG_TEARDROPS
::
OnModeRemove
(
wxCommandEvent
&
aEvent
)
{
event
.
Skip
();
if
(
m_settings
!=
NULL
)
{
aEvent
.
Skip
();
if
(
m_settings
!=
NULL
)
{
m_settings
->
m_mode
=
TEARDROPS_MODE_REMOVE
;
LockOptionsControls
(
true
);
LockTracksControls
(
true
);
LockScopeControls
(
true
);
lockOptionsControls
(
true
);
lockTracksControls
(
true
);
lockScopeControls
(
true
);
}
}
void
DIALOG_TEARDROPS
::
OnTracksAll
(
wxCommandEvent
&
event
)
void
DIALOG_TEARDROPS
::
OnTracksAll
(
wxCommandEvent
&
aEvent
)
{
event
.
Skip
();
if
(
m_settings
!=
NULL
)
{
aEvent
.
Skip
();
if
(
m_settings
!=
NULL
)
{
m_settings
->
m_track
=
TEARDROPS_TRACKS_ALL
;
}
m_checkClear
->
Enable
(
false
);
m_checkClear
->
Enable
(
false
);
}
void
DIALOG_TEARDROPS
::
OnTracksSelected
(
wxCommandEvent
&
event
)
void
DIALOG_TEARDROPS
::
OnTracksSelected
(
wxCommandEvent
&
aEvent
)
{
event
.
Skip
();
if
(
m_settings
!=
NULL
)
{
aEvent
.
Skip
();
if
(
m_settings
!=
NULL
)
{
m_settings
->
m_track
=
TEARDROPS_TRACKS_SELECTED
;
}
m_checkClear
->
Enable
(
true
);
m_checkClear
->
Enable
(
true
);
}
void
DIALOG_TEARDROPS
::
OnScopeVias
(
wxCommandEvent
&
event
)
void
DIALOG_TEARDROPS
::
OnScopeVias
(
wxCommandEvent
&
aEvent
)
{
event
.
Skip
();
if
(
m_settings
!=
NULL
)
{
if
(
m_scopeVias
->
IsChecked
())
{
m_settings
->
m_scope
=
static_cast
<
TEARDROPS_SCOPE
>
(
m_settings
->
m_scope
|
TEARDROPS_SCOPE_VIAS
);
aEvent
.
Skip
();
if
(
m_settings
!=
NULL
)
{
if
(
m_scopeVias
->
IsChecked
()
)
{
m_settings
->
m_scope
=
static_cast
<
TEARDROPS_SCOPE
>
(
m_settings
->
m_scope
|
TEARDROPS_SCOPE_VIAS
);
}
else
{
m_settings
->
m_scope
=
static_cast
<
TEARDROPS_SCOPE
>
(
m_settings
->
m_scope
&
(
~
TEARDROPS_SCOPE_VIAS
));
else
{
m_settings
->
m_scope
=
static_cast
<
TEARDROPS_SCOPE
>
(
m_settings
->
m_scope
&
(
~
TEARDROPS_SCOPE_VIAS
)
);
}
}
}
void
DIALOG_TEARDROPS
::
OnScopePads
(
wxCommandEvent
&
event
)
void
DIALOG_TEARDROPS
::
OnScopePads
(
wxCommandEvent
&
aEvent
)
{
event
.
Skip
();
if
(
m_settings
!=
NULL
)
{
if
(
m_scopePads
->
IsChecked
())
{
m_settings
->
m_scope
=
static_cast
<
TEARDROPS_SCOPE
>
(
m_settings
->
m_scope
|
TEARDROPS_SCOPE_PADS
);
aEvent
.
Skip
();
if
(
m_settings
!=
NULL
)
{
if
(
m_scopePads
->
IsChecked
()
)
{
m_settings
->
m_scope
=
static_cast
<
TEARDROPS_SCOPE
>
(
m_settings
->
m_scope
|
TEARDROPS_SCOPE_PADS
);
}
else
{
m_settings
->
m_scope
=
static_cast
<
TEARDROPS_SCOPE
>
(
m_settings
->
m_scope
&
(
~
TEARDROPS_SCOPE_PADS
));
else
{
m_settings
->
m_scope
=
static_cast
<
TEARDROPS_SCOPE
>
(
m_settings
->
m_scope
&
(
~
TEARDROPS_SCOPE_PADS
)
);
}
}
}
void
DIALOG_TEARDROPS
::
OnStyleChanged
(
wxCommandEvent
&
event
)
void
DIALOG_TEARDROPS
::
OnStyleChanged
(
wxCommandEvent
&
aEvent
)
{
event
.
Skip
();
if
(
m_settings
!=
NULL
)
{
m_settings
->
m_type
=
static_cast
<
TEARDROPS_TYPE
>
(
m_choiceStyle
->
GetSelection
());
aEvent
.
Skip
();
if
(
m_settings
!=
NULL
)
{
m_settings
->
m_type
=
static_cast
<
TEARDROPS_TYPE
>
(
m_choiceStyle
->
GetSelection
()
);
}
}
void
DIALOG_TEARDROPS
::
OnClearSelection
(
wxCommandEvent
&
event
)
void
DIALOG_TEARDROPS
::
OnClearSelection
(
wxCommandEvent
&
aEvent
)
{
event
.
Skip
();
if
(
m_settings
!=
NULL
)
{
aEvent
.
Skip
();
if
(
m_settings
!=
NULL
)
{
m_settings
->
m_clearSelection
=
m_checkClear
->
IsChecked
();
}
}
void
DIALOG_TEARDROPS
::
OnIgnoreDrc
(
wxCommandEvent
&
event
)
void
DIALOG_TEARDROPS
::
OnIgnoreDrc
(
wxCommandEvent
&
aEvent
)
{
event
.
Skip
();
if
(
m_settings
!=
NULL
)
{
aEvent
.
Skip
();
if
(
m_settings
!=
NULL
)
{
m_settings
->
m_ignoreDrc
=
m_checkIgnore
->
IsChecked
();
}
}
void
DIALOG_TEARDROPS
::
LockOptionsControls
(
bool
state
)
void
DIALOG_TEARDROPS
::
lockOptionsControls
(
bool
state
)
{
if
(
state
==
true
)
{
if
(
m_tracksSelected
->
GetValue
()
==
false
)
{
m_checkClear
->
Enable
(
false
);
if
(
state
==
true
)
{
if
(
m_tracksSelected
->
GetValue
()
==
false
)
{
m_checkClear
->
Enable
(
false
);
}
m_checkIgnore
->
Enable
(
false
);
m_choiceStyle
->
Enable
(
false
);
}
else
{
if
(
m_tracksSelected
->
GetValue
()
==
true
)
{
m_checkClear
->
Enable
(
true
);
m_checkIgnore
->
Enable
(
false
);
m_choiceStyle
->
Enable
(
false
);
}
else
{
if
(
m_tracksSelected
->
GetValue
()
==
true
)
{
m_checkClear
->
Enable
(
true
);
}
m_checkIgnore
->
Enable
(
true
);
m_choiceStyle
->
Enable
(
true
);
m_checkIgnore
->
Enable
(
true
);
m_choiceStyle
->
Enable
(
true
);
}
}
void
DIALOG_TEARDROPS
::
LockTracksControls
(
bool
state
)
void
DIALOG_TEARDROPS
::
lockTracksControls
(
bool
state
)
{
if
(
state
==
true
)
{
m_tracksAll
->
Enable
(
false
);
m_tracksSelected
->
Enable
(
false
);
if
(
state
==
true
)
{
m_tracksAll
->
Enable
(
false
);
m_tracksSelected
->
Enable
(
false
);
}
else
{
m_tracksAll
->
Enable
(
true
);
m_tracksSelected
->
Enable
(
true
);
else
{
m_tracksAll
->
Enable
(
true
);
m_tracksSelected
->
Enable
(
true
);
}
}
void
DIALOG_TEARDROPS
::
LockScopeControls
(
bool
state
)
void
DIALOG_TEARDROPS
::
lockScopeControls
(
bool
state
)
{
if
(
state
==
true
)
{
m_scopePads
->
Enable
(
false
);
m_scopeVias
->
Enable
(
false
);
}
else
{
m_scopePads
->
Enable
(
true
);
m_scopeVias
->
Enable
(
true
);
if
(
state
==
true
)
{
m_scopePads
->
Enable
(
false
);
m_scopeVias
->
Enable
(
false
);
}
else
{
m_scopePads
->
Enable
(
true
);
m_scopeVias
->
Enable
(
true
);
}
}
pcbnew/dialogs/dialog_teardrops.h
View file @
c5973eb8
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Elphel, Inc.
*
* 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
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DIALOG_TEARDROPS_H
#define DIALOG_TEARDROPS_H
...
...
@@ -5,56 +24,108 @@
#include "dialog_teardrops_base.h"
#include "wxPcbStruct.h"
/**
* @brief The DIALOG_TEARDROPS class
* implements teardrop management dialog for current board.
*/
class
DIALOG_TEARDROPS
:
public
DIALOG_TEARDROPS_BASE
{
public
:
typedef
enum
{
/**
* @brief The TEARDROPS_MODE
* defines an action to be performed on teardrops.
*/
typedef
enum
{
/// Teardrops addition mode
TEARDROPS_MODE_ADD
,
/// Teardrops removal mode
TEARDROPS_MODE_REMOVE
}
TEARDROPS_MODE
;
typedef
enum
{
/**
* @brief The TEARDROPS_TRACKS
* determines selection processing.
*/
typedef
enum
{
/// Process all tracks
TEARDROPS_TRACKS_ALL
,
/// Process selected tracks only
TEARDROPS_TRACKS_SELECTED
}
TEARDROPS_TRACKS
;
typedef
enum
{
/**
* @brief The TEARDROPS_TYPE
* defines the shape of teardrops.
*/
typedef
enum
{
/// The shape is not defined
TEARDROPS_TYPE_NONE
=
-
1
,
/// The teardops have straight outlines
TEARDROPS_TYPE_STRAIGHT
,
/// The teardrops have curved outlines
TEARDROPS_TYPE_CURVED
}
TEARDROPS_TYPE
;
typedef
enum
{
/**
* @brief The TEARDROPS_SCOPE
* defines the types of objects for which teardrops should be created. This is a bit field, each
* bit correcponds to an object type.
*/
typedef
enum
{
/// No objects are specified
TEARDROPS_SCOPE_NONE
,
/// Create teardrops for vias
TEARDROPS_SCOPE_VIAS
=
1
,
/// Create teardrops for pads
TEARDROPS_SCOPE_PADS
=
2
,
/// Create teardrops for tracks (not implemented yet)
TEARDROPS_SCOPE_TRACKS
=
4
}
TEARDROPS_SCOPE
;
typedef
struct
{
/**
* @brief The TEARDROPS_SETTINGS
* class is a container for all the settings specified by the user.
*/
typedef
struct
{
/// The action to be performed (addition, deletion)
TEARDROPS_MODE
m_mode
;
/// Process selection
TEARDROPS_TRACKS
m_track
;
/// Objects scope
TEARDROPS_SCOPE
m_scope
;
/// Teardrops type
TEARDROPS_TYPE
m_type
;
/// Clear selection after the processing has finished
bool
m_clearSelection
;
/// Ignore DRC during processing
bool
m_ignoreDrc
;
}
TEARDROPS_SETTINGS
;
DIALOG_TEARDROPS
(
PCB_EDIT_FRAME
*
aParent
,
TEARDROPS_SETTINGS
*
settings
);
void
OnModeAdd
(
wxCommandEvent
&
event
);
void
OnModeRemove
(
wxCommandEvent
&
event
);
void
OnTracksAll
(
wxCommandEvent
&
event
);
void
OnTracksSelected
(
wxCommandEvent
&
event
);
void
OnStyleChanged
(
wxCommandEvent
&
event
);
void
OnClearSelection
(
wxCommandEvent
&
event
);
void
OnIgnoreDrc
(
wxCommandEvent
&
event
);
void
OnScopeVias
(
wxCommandEvent
&
event
);
void
OnScopePads
(
wxCommandEvent
&
event
);
DIALOG_TEARDROPS
(
PCB_EDIT_FRAME
*
aParent
,
TEARDROPS_SETTINGS
*
aSettings
);
void
OnModeAdd
(
wxCommandEvent
&
aEvent
);
void
OnModeRemove
(
wxCommandEvent
&
aEvent
);
void
OnTracksAll
(
wxCommandEvent
&
aEvent
);
void
OnTracksSelected
(
wxCommandEvent
&
aEvent
);
void
OnStyleChanged
(
wxCommandEvent
&
aEvent
);
void
OnClearSelection
(
wxCommandEvent
&
aEvent
);
void
OnIgnoreDrc
(
wxCommandEvent
&
aEvent
);
void
OnScopeVias
(
wxCommandEvent
&
aEvent
);
void
OnScopePads
(
wxCommandEvent
&
aEvent
);
private
:
PCB_EDIT_FRAME
*
m_parent
;
TEARDROPS_SETTINGS
*
m_settings
;
void
I
nitDialogSettings
();
void
LockOptionsControls
(
bool
state
);
void
LockTracksControls
(
bool
state
);
void
LockScopeControls
(
bool
state
);
void
i
nitDialogSettings
();
void
lockOptionsControls
(
bool
aState
);
void
lockTracksControls
(
bool
aState
);
void
lockScopeControls
(
bool
aState
);
};
#endif // DIALOG_TEARDROPS_H
pcbnew/tools/edit_teardrops.cpp
View file @
c5973eb8
This diff is collapsed.
Click to expand it.
pcbnew/tools/edit_teardrops.h
View file @
c5973eb8
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Elphel, Inc.
*
* 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
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TEARDROPS_EDITOR_H
#define TEARDROPS_EDITOR_H
...
...
@@ -7,51 +26,99 @@
#include "class_teardrop.h"
#include "import_export.h"
/**
* @brief The TEARDROPS_EDITOR class
* creates actual tracks on the board in accordance with the preferences provided by
* the DIALOG_TEARDROPS class.
*/
class
APIEXPORT
TEARDROPS_EDITOR
:
public
TOOL_BASE
{
public
:
TEARDROPS_EDITOR
();
~
TEARDROPS_EDITOR
();
bool
EditTeardrops
(
const
DIALOG_TEARDROPS
::
TEARDROPS_SETTINGS
&
settings
);
/**
* @brief Function \a EditTeardrops
* is invoked for any manupulation with the teardrops on current board.
* @param [in] aSettings contains user defined settings provided by teadrops editor dialog window
* @return bool - \a true in case teardrops were successfully created and \a false otherwise
*/
bool
EditTeardrops
(
const
DIALOG_TEARDROPS
::
TEARDROPS_SETTINGS
&
aSettings
);
/// @copydoc TOOL_INTERACTIVE::Reset
void
Reset
(
RESET_REASON
aReason
);
void
Reset
(
RESET_REASON
aReason
);
private
:
typedef
enum
{
/**
* The DRC_STRATEGY
* defines the strategy when DRC violation is detected during teardop creation.
*/
typedef
enum
{
/// Do not violate DRC and quit teardrop building
DRC_COMPLY
,
/// Ignore DRC and finish teardop
DRC_IGNORE
,
/// Try to adjust the outline or size of a teardop (not implemented)
DRC_ADJUST
}
DRC_STRATEGY
;
PCB_EDIT_FRAME
*
m_frame
;
KIGFX
::
VIEW
*
m_view
;
PCB_EDIT_FRAME
*
m_frame
;
KIGFX
::
VIEW
*
m_view
;
TEARDROP
::
TEARDROP_TYPE
m_type
;
PICKED_ITEMS_LIST
m_undoListPicker
;
DRC_STRATEGY
m_strategy
;
/**
* @brief FilterSelection filters selected objects and removes all objects except tracks.
* @param selection contains the list of currently selected objects
* @brief Function \a filterSelection
* filters selected objects and removes all objects which can not be processed.
* @param [in,out] aSelection contains the list of currently selected objects on input and
* a list of valid for processing objects on output
*/
void
FilterSelection
(
SELECTION
&
selection
);
void
filterSelection
(
SELECTION
&
aSelection
);
/**
* @brief IterateTracks creates teardrop for all tracks connected to \a aObject
* @param aObject is a board object a which teardrops should be created. Currently such an object can
* @brief Function \a iterateTracks
* creates teardrop(s) for all tracks connected to \a aObject.
* @param [in] aObject is a board object at which teardrops should be created. Currently such an object can
* be via or circular pad.
* @return \a true if at least one teardrop was successfully added and \a false otherwise
*/
bool
IterateTracks
(
const
BOARD_CONNECTED_ITEM
*
aObject
);
bool
AddToAll
(
const
DIALOG_TEARDROPS
::
TEARDROPS_SETTINGS
&
settings
);
bool
AddToSelected
(
SELECTION
&
selection
,
const
DIALOG_TEARDROPS
::
TEARDROPS_SETTINGS
&
settings
);
bool
iterateTracks
(
const
BOARD_CONNECTED_ITEM
*
aObject
);
/**
* @brief Function \a addToAll
* adds teardrops to all tracks on the board.
* @param [in] aSettings contains user defined settings
* @return bool - \a true in case teardops were successfully added and \a false otherwise
*/
bool
addToAll
(
const
DIALOG_TEARDROPS
::
TEARDROPS_SETTINGS
&
aSettings
);
/**
* @brief RemoveAll removes all teardrops form board.
* @brief Function \a addToSelected
* adds teardrops to selected tracks.
* @param [in] aSelection contains a filtered list of selected tracks
* @param [in] aSettings contains user defined settings
* @return bool - \a true in case teardops were successfully added and \a false otherwise
*/
void
RemoveAll
(
);
bool
addToSelected
(
SELECTION
&
aSelection
,
const
DIALOG_TEARDROPS
::
TEARDROPS_SETTINGS
&
aSettings
);
bool
DrawSegments
(
TEARDROP
&
teardrop
,
TRACK
&
track
);
/**
* @brief Function \a RemoveAll
* removes all teardrops form current board.
*/
void
removeAll
();
/**
* @brief Function \a drawSegments
* adds tracks composing a teardop to the board.
* @param [in] aTeardrop is a teardrop which should be created on the board
* @param [in] aTrack is a parent track, some of its parameters are copied to newly created
* segments
* @return bool - \a true in case all the tracks were successfully added and \a false
* otherwise
*/
bool
drawSegments
(
TEARDROP
&
aTeardrop
,
TRACK
&
aTrack
);
};
#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