Commit c5973eb8 authored by Mikhail Karpenko's avatar Mikhail Karpenko

Add documentation to .h files and update code formatting

parent c25acdbb
This diff is collapsed.
...@@ -17,92 +17,129 @@ ...@@ -17,92 +17,129 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/**
* @file class_teardrop.h
* @brief Definitions for teardrops.
*/
#ifndef CLASS_TEARDROP_H #ifndef CLASS_TEARDROP_H
#define CLASS_TEARDROP_H #define CLASS_TEARDROP_H
#include "class_track.h" #include "class_track.h"
#include "geometry/seg.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 class TEARDROP
{ {
public: public:
TEARDROP(); TEARDROP();
/** /**
* @brief Defines the type of a teardrop. * @brief The TEARDROP_TYPE defines the type of a teardrop.
*/ */
typedef enum { typedef enum
{
TEARDROP_NONE, ///< The type is undefined TEARDROP_NONE, ///< The type is undefined
TEARDROP_STRAIGHT, ///< The teardrop is created by two straight segments TEARDROP_STRAIGHT, ///< The teardrop is created by two straight segments
TEARDROP_CURVED ///< The teardrop is created by several segments approximating a curve TEARDROP_CURVED ///< The teardrop is created by several segments approximating a curve
} TEARDROP_TYPE; } TEARDROP_TYPE;
/** /**
* @brief GetType returns the type of the teardrop. * @brief Function \a GetType
* @return TEARDROP_TYPE * 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 * @brief Function \a Create
* @param aTrack * creates a teardrop(s) for a given track.
* @return \a true in case the teardrops were successfully built and \a false otherwise * @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: private:
///> Contains the type of teardrop /// Contains the type of teardrop
TEARDROP_TYPE m_type; TEARDROP_TYPE m_type;
///> \a m_upperSegment and \a m_lowerSegment contain coordinates of segments composing a teardrop /// Contains the actual coordinates of teardrop
std::vector<VECTOR2I> m_upperSegment;
std::vector<VECTOR2I> m_lowerSegment;
std::vector<VECTOR2I> m_coordinates; std::vector<VECTOR2I> m_coordinates;
/** /**
* @brief Function \a CurvedSegments computes several points on deltoid curve and moves * @brief Function \a curvedSegments
* these points along the vector defined by \a aTrack. * 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. * 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). * 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] aTrack defines a vector along which the curved segments should be built
* @param [in] aVia used as the center of coordinates * @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. * 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] 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] 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 * @param [in] aDistance 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 * @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 * @brief Function \a splitSegment
* @param aTrack is used to create a vector * splits a segment into given number of subsegments.
* @param startPoint is start point of resulting vector * @param [in] aSegment is a segment to be split
* @param endPoint is end point of resulting vector * @param [i] aSplits is a number of splits
* @return \a true in case the vector is created successfully and \a false otherwise * @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); * @brief Function \a pointOnCurve
inline void PointOnCurve(int angle, double radius, VECTOR2I &point) { * 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; 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 );
} }
}; };
......
/*
* 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" #include "dialog_teardrops.h"
DIALOG_TEARDROPS::DIALOG_TEARDROPS(PCB_EDIT_FRAME *aParent, TEARDROPS_SETTINGS *settings): DIALOG_TEARDROPS::DIALOG_TEARDROPS(PCB_EDIT_FRAME *aParent, TEARDROPS_SETTINGS *aSettings = NULL ):
DIALOG_TEARDROPS_BASE(aParent) DIALOG_TEARDROPS_BASE( aParent )
{ {
m_parent = aParent; m_parent = aParent;
m_settings = settings; m_settings = aSettings;
if (m_settings != NULL) { if( m_settings != NULL )
InitDialogSettings(); {
initDialogSettings();
} }
} }
void DIALOG_TEARDROPS::InitDialogSettings() void DIALOG_TEARDROPS::initDialogSettings()
{ {
wxASSERT(m_settings != NULL); assert(m_settings != NULL);
if (m_modeRemove->GetValue() == true) {
if( m_modeRemove->GetValue() == true )
{
m_settings->m_mode = TEARDROPS_MODE_REMOVE; m_settings->m_mode = TEARDROPS_MODE_REMOVE;
} }
else { else
{
m_settings->m_mode = TEARDROPS_MODE_ADD; m_settings->m_mode = TEARDROPS_MODE_ADD;
} }
if (m_tracksAll->GetValue() == true) { if( m_tracksAll->GetValue() == true )
{
m_settings->m_track = TEARDROPS_TRACKS_ALL; m_settings->m_track = TEARDROPS_TRACKS_ALL;
} }
else { else
{
m_settings->m_track = TEARDROPS_TRACKS_SELECTED; 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; m_settings->m_scope = TEARDROPS_SCOPE_NONE;
if (m_scopeVias->IsChecked() == true) { if( m_scopeVias->IsChecked() == true )
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope | TEARDROPS_SCOPE_VIAS); {
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>( m_settings->m_scope | TEARDROPS_SCOPE_VIAS );
} }
if (m_scopePads->IsChecked() == true) { if( m_scopePads->IsChecked() == true )
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope | TEARDROPS_SCOPE_PADS); {
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>( m_settings->m_scope | TEARDROPS_SCOPE_PADS );
} }
if (m_scopeTracks->IsChecked() == true) { if( m_scopeTracks->IsChecked() == true )
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope | TEARDROPS_SCOPE_TRACKS); {
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_clearSelection = m_checkClear->IsChecked();
m_settings->m_ignoreDrc = m_checkIgnore->IsChecked(); m_settings->m_ignoreDrc = m_checkIgnore->IsChecked();
} }
void DIALOG_TEARDROPS::OnModeAdd(wxCommandEvent &event) void DIALOG_TEARDROPS::OnModeAdd( wxCommandEvent &aEvent )
{ {
event.Skip(); aEvent.Skip();
if (m_settings != NULL) { if( m_settings != NULL )
{
m_settings->m_mode = TEARDROPS_MODE_ADD; m_settings->m_mode = TEARDROPS_MODE_ADD;
LockOptionsControls(false); lockOptionsControls( false );
LockTracksControls(false); lockTracksControls( false );
LockScopeControls(false); lockScopeControls( false );
} }
} }
void DIALOG_TEARDROPS::OnModeRemove(wxCommandEvent &event) void DIALOG_TEARDROPS::OnModeRemove( wxCommandEvent &aEvent )
{ {
event.Skip(); aEvent.Skip();
if (m_settings != NULL) { if( m_settings != NULL )
{
m_settings->m_mode = TEARDROPS_MODE_REMOVE; m_settings->m_mode = TEARDROPS_MODE_REMOVE;
LockOptionsControls(true); lockOptionsControls( true );
LockTracksControls(true); lockTracksControls( true );
LockScopeControls(true); lockScopeControls( true );
} }
} }
void DIALOG_TEARDROPS::OnTracksAll(wxCommandEvent &event) void DIALOG_TEARDROPS::OnTracksAll( wxCommandEvent &aEvent )
{ {
event.Skip(); aEvent.Skip();
if (m_settings != NULL) { if( m_settings != NULL )
{
m_settings->m_track = TEARDROPS_TRACKS_ALL; 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(); aEvent.Skip();
if (m_settings != NULL) { if( m_settings != NULL )
{
m_settings->m_track = TEARDROPS_TRACKS_SELECTED; 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(); aEvent.Skip();
if (m_settings != NULL) { if( m_settings != NULL )
if (m_scopeVias->IsChecked()) { {
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope | TEARDROPS_SCOPE_VIAS); if( m_scopeVias->IsChecked() )
{
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>( m_settings->m_scope | TEARDROPS_SCOPE_VIAS );
} }
else { else
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope & (~TEARDROPS_SCOPE_VIAS)); {
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(); aEvent.Skip();
if (m_settings != NULL) { if( m_settings != NULL )
if (m_scopePads->IsChecked()) { {
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope | TEARDROPS_SCOPE_PADS); if( m_scopePads->IsChecked() )
{
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>( m_settings->m_scope | TEARDROPS_SCOPE_PADS );
} }
else { else
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope & (~TEARDROPS_SCOPE_PADS)); {
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(); aEvent.Skip();
if (m_settings != NULL) { if( m_settings != NULL )
m_settings->m_type = static_cast<TEARDROPS_TYPE>(m_choiceStyle->GetSelection()); {
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(); aEvent.Skip();
if (m_settings != NULL) { if( m_settings != NULL )
{
m_settings->m_clearSelection = m_checkClear->IsChecked(); m_settings->m_clearSelection = m_checkClear->IsChecked();
} }
} }
void DIALOG_TEARDROPS::OnIgnoreDrc(wxCommandEvent &event) void DIALOG_TEARDROPS::OnIgnoreDrc( wxCommandEvent &aEvent )
{ {
event.Skip(); aEvent.Skip();
if (m_settings != NULL) { if( m_settings != NULL )
{
m_settings->m_ignoreDrc = m_checkIgnore->IsChecked(); m_settings->m_ignoreDrc = m_checkIgnore->IsChecked();
} }
} }
void DIALOG_TEARDROPS::LockOptionsControls(bool state) void DIALOG_TEARDROPS::lockOptionsControls( bool state )
{ {
if (state == true) { if( state == true )
if (m_tracksSelected->GetValue() == false) { {
m_checkClear->Enable(false); if( m_tracksSelected->GetValue() == false )
{
m_checkClear->Enable( false );
} }
m_checkIgnore->Enable(false); m_checkIgnore->Enable( false );
m_choiceStyle->Enable(false); m_choiceStyle->Enable( false );
} }
else { else
if (m_tracksSelected->GetValue() == true) { {
m_checkClear->Enable(true); if( m_tracksSelected->GetValue() == true )
{
m_checkClear->Enable( true );
} }
m_checkIgnore->Enable(true); m_checkIgnore->Enable( true );
m_choiceStyle->Enable(true); m_choiceStyle->Enable( true );
} }
} }
void DIALOG_TEARDROPS::LockTracksControls(bool state) void DIALOG_TEARDROPS::lockTracksControls( bool state )
{ {
if (state == true) { if( state == true )
m_tracksAll->Enable(false); {
m_tracksSelected->Enable(false); m_tracksAll->Enable( false );
m_tracksSelected->Enable( false );
} }
else { else
m_tracksAll->Enable(true); {
m_tracksSelected->Enable(true); m_tracksAll->Enable( true );
m_tracksSelected->Enable( true );
} }
} }
void DIALOG_TEARDROPS::LockScopeControls(bool state) void DIALOG_TEARDROPS::lockScopeControls( bool state )
{ {
if (state == true) { if( state == true )
m_scopePads->Enable(false); {
m_scopeVias->Enable(false); m_scopePads->Enable( false );
} m_scopeVias->Enable( false );
else { }
m_scopePads->Enable(true); else
m_scopeVias->Enable(true); {
m_scopePads->Enable( true );
m_scopeVias->Enable( true );
} }
} }
/*
* 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 #ifndef DIALOG_TEARDROPS_H
#define DIALOG_TEARDROPS_H #define DIALOG_TEARDROPS_H
...@@ -5,56 +24,108 @@ ...@@ -5,56 +24,108 @@
#include "dialog_teardrops_base.h" #include "dialog_teardrops_base.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
/**
* @brief The DIALOG_TEARDROPS class
* implements teardrop management dialog for current board.
*/
class DIALOG_TEARDROPS : public DIALOG_TEARDROPS_BASE class DIALOG_TEARDROPS : public DIALOG_TEARDROPS_BASE
{ {
public: public:
typedef enum { /**
* @brief The TEARDROPS_MODE
* defines an action to be performed on teardrops.
*/
typedef enum
{
/// Teardrops addition mode
TEARDROPS_MODE_ADD, TEARDROPS_MODE_ADD,
/// Teardrops removal mode
TEARDROPS_MODE_REMOVE TEARDROPS_MODE_REMOVE
} TEARDROPS_MODE; } TEARDROPS_MODE;
typedef enum {
/**
* @brief The TEARDROPS_TRACKS
* determines selection processing.
*/
typedef enum
{
/// Process all tracks
TEARDROPS_TRACKS_ALL, TEARDROPS_TRACKS_ALL,
/// Process selected tracks only
TEARDROPS_TRACKS_SELECTED TEARDROPS_TRACKS_SELECTED
} TEARDROPS_TRACKS; } TEARDROPS_TRACKS;
typedef enum {
/**
* @brief The TEARDROPS_TYPE
* defines the shape of teardrops.
*/
typedef enum
{
/// The shape is not defined
TEARDROPS_TYPE_NONE = -1, TEARDROPS_TYPE_NONE = -1,
/// The teardops have straight outlines
TEARDROPS_TYPE_STRAIGHT, TEARDROPS_TYPE_STRAIGHT,
/// The teardrops have curved outlines
TEARDROPS_TYPE_CURVED TEARDROPS_TYPE_CURVED
} TEARDROPS_TYPE; } 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, TEARDROPS_SCOPE_NONE,
/// Create teardrops for vias
TEARDROPS_SCOPE_VIAS = 1, TEARDROPS_SCOPE_VIAS = 1,
/// Create teardrops for pads
TEARDROPS_SCOPE_PADS = 2, TEARDROPS_SCOPE_PADS = 2,
/// Create teardrops for tracks (not implemented yet)
TEARDROPS_SCOPE_TRACKS = 4 TEARDROPS_SCOPE_TRACKS = 4
} TEARDROPS_SCOPE; } 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; TEARDROPS_MODE m_mode;
/// Process selection
TEARDROPS_TRACKS m_track; TEARDROPS_TRACKS m_track;
/// Objects scope
TEARDROPS_SCOPE m_scope; TEARDROPS_SCOPE m_scope;
/// Teardrops type
TEARDROPS_TYPE m_type; TEARDROPS_TYPE m_type;
/// Clear selection after the processing has finished
bool m_clearSelection; bool m_clearSelection;
/// Ignore DRC during processing
bool m_ignoreDrc; bool m_ignoreDrc;
} TEARDROPS_SETTINGS; } TEARDROPS_SETTINGS;
DIALOG_TEARDROPS(PCB_EDIT_FRAME *aParent, TEARDROPS_SETTINGS *settings);
DIALOG_TEARDROPS( PCB_EDIT_FRAME *aParent, TEARDROPS_SETTINGS *aSettings );
void OnModeAdd(wxCommandEvent &event);
void OnModeRemove(wxCommandEvent &event); void OnModeAdd( wxCommandEvent &aEvent );
void OnTracksAll(wxCommandEvent &event); void OnModeRemove( wxCommandEvent &aEvent );
void OnTracksSelected(wxCommandEvent &event); void OnTracksAll( wxCommandEvent &aEvent );
void OnStyleChanged(wxCommandEvent &event); void OnTracksSelected( wxCommandEvent &aEvent );
void OnClearSelection(wxCommandEvent &event); void OnStyleChanged( wxCommandEvent &aEvent );
void OnIgnoreDrc(wxCommandEvent &event); void OnClearSelection( wxCommandEvent &aEvent );
void OnScopeVias(wxCommandEvent &event); void OnIgnoreDrc( wxCommandEvent &aEvent );
void OnScopePads(wxCommandEvent &event); void OnScopeVias( wxCommandEvent &aEvent );
void OnScopePads( wxCommandEvent &aEvent );
private: private:
PCB_EDIT_FRAME *m_parent; PCB_EDIT_FRAME *m_parent;
TEARDROPS_SETTINGS *m_settings; TEARDROPS_SETTINGS *m_settings;
void InitDialogSettings(); void initDialogSettings();
void LockOptionsControls(bool state); void lockOptionsControls( bool aState );
void LockTracksControls(bool state); void lockTracksControls( bool aState );
void LockScopeControls(bool state); void lockScopeControls( bool aState );
}; };
#endif // DIALOG_TEARDROPS_H #endif // DIALOG_TEARDROPS_H
This diff is collapsed.
/*
* 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 #ifndef TEARDROPS_EDITOR_H
#define TEARDROPS_EDITOR_H #define TEARDROPS_EDITOR_H
...@@ -7,51 +26,99 @@ ...@@ -7,51 +26,99 @@
#include "class_teardrop.h" #include "class_teardrop.h"
#include "import_export.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 class APIEXPORT TEARDROPS_EDITOR : public TOOL_BASE
{ {
public: public:
TEARDROPS_EDITOR(); TEARDROPS_EDITOR();
~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 /// @copydoc TOOL_INTERACTIVE::Reset
void Reset(RESET_REASON aReason); void Reset( RESET_REASON aReason );
private: 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, DRC_COMPLY,
/// Ignore DRC and finish teardop
DRC_IGNORE, DRC_IGNORE,
/// Try to adjust the outline or size of a teardop (not implemented)
DRC_ADJUST DRC_ADJUST
} DRC_STRATEGY; } 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; DRC_STRATEGY m_strategy;
/** /**
* @brief FilterSelection filters selected objects and removes all objects except tracks. * @brief Function \a filterSelection
* @param selection contains the list of currently selected objects * 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 * @brief Function \a iterateTracks
* @param aObject is a board object a which teardrops should be created. Currently such an object can * 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. * be via or circular pad.
* @return \a true if at least one teardrop was successfully added and \a false otherwise * @return \a true if at least one teardrop was successfully added and \a false otherwise
*/ */
bool IterateTracks(const BOARD_CONNECTED_ITEM *aObject); 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);
/** /**
* @brief RemoveAll removes all teardrops form board. * @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
*/ */
void RemoveAll(); bool addToAll( const DIALOG_TEARDROPS::TEARDROPS_SETTINGS& aSettings );
bool DrawSegments(TEARDROP &teardrop, TRACK &track); /**
* @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
*/
bool addToSelected( SELECTION& aSelection, const DIALOG_TEARDROPS::TEARDROPS_SETTINGS& aSettings );
/**
* @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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment