Browse Source
router: multiple changes
router: multiple changes
- re-worked PNS_LINE_PLACER and PNS_ROUTER classes a bit, removing duplicate class members - cleaned up Andrew's blind/buried via fixes - fixed 'custom via width' dialog bug updating the width even when closed/cancelled - fixed incorrect radius of drawn microviaspull/1/head
committed by
Maciej Suminski
23 changed files with 736 additions and 696 deletions
-
22pcbnew/dialogs/dialog_track_via_size.cpp
-
8pcbnew/dialogs/dialog_track_via_size.h
-
38pcbnew/dialogs/dialog_track_via_size_base.cpp
-
211pcbnew/dialogs/dialog_track_via_size_base.fbp
-
15pcbnew/dialogs/dialog_track_via_size_base.h
-
3pcbnew/pcb_painter.cpp
-
1pcbnew/router/CMakeLists.txt
-
2pcbnew/router/pns_dragger.cpp
-
52pcbnew/router/pns_itemset.cpp
-
82pcbnew/router/pns_itemset.h
-
60pcbnew/router/pns_joint.h
-
2pcbnew/router/pns_layerset.h
-
186pcbnew/router/pns_line_placer.cpp
-
40pcbnew/router/pns_line_placer.h
-
191pcbnew/router/pns_router.cpp
-
38pcbnew/router/pns_router.h
-
33pcbnew/router/pns_routing_settings.h
-
159pcbnew/router/pns_sizes_settings.cpp
-
95pcbnew/router/pns_sizes_settings.h
-
2pcbnew/router/pns_via.h
-
1pcbnew/router/router_preview_item.cpp
-
186pcbnew/router/router_tool.cpp
-
5pcbnew/router/router_tool.h
@ -1,61 +1,57 @@ |
|||
///////////////////////////////////////////////////////////////////////////
|
|||
// C++ code generated with wxFormBuilder (version Nov 6 2013)
|
|||
// C++ code generated with wxFormBuilder (version Jun 6 2014)
|
|||
// http://www.wxformbuilder.org/
|
|||
//
|
|||
// PLEASE DO "NOT" EDIT THIS FILE!
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
#include "dialog_shim.h"
|
|||
|
|||
#include "dialog_track_via_size_base.h"
|
|||
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
DIALOG_TRACK_VIA_SIZE_BASE::DIALOG_TRACK_VIA_SIZE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) |
|||
{ |
|||
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); |
|||
this->SetSizeHints( wxSize( 280,240 ), wxDefaultSize ); |
|||
|
|||
wxBoxSizer* bSizes; |
|||
bSizes = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
m_trackWidth = new WX_UNIT_TEXT( this, _("Track width:") ); |
|||
bSizes->Add( m_trackWidth, 0, wxALL, 5 ); |
|||
bSizes->Add( m_trackWidth, 0, wxALL|wxEXPAND, 5 ); |
|||
|
|||
m_viaDiameter = new WX_UNIT_TEXT( this, _("Via diameter:") ); |
|||
bSizes->Add( m_viaDiameter, 0, wxALL, 5 ); |
|||
bSizes->Add( m_viaDiameter, 0, wxALL|wxEXPAND, 5 ); |
|||
|
|||
m_viaDrill = new WX_UNIT_TEXT( this, _("Via drill:") ); |
|||
bSizes->Add( m_viaDrill, 0, wxALL, 5 ); |
|||
|
|||
wxBoxSizer* bButtons; |
|||
bButtons = new wxBoxSizer( wxHORIZONTAL ); |
|||
|
|||
m_ok = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
bButtons->Add( m_ok, 1, wxALL, 5 ); |
|||
|
|||
m_cancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
bButtons->Add( m_cancel, 1, wxALL, 5 ); |
|||
bSizes->Add( m_viaDrill, 0, wxALL|wxEXPAND, 5 ); |
|||
|
|||
m_stdButtons = new wxStdDialogButtonSizer(); |
|||
m_stdButtonsOK = new wxButton( this, wxID_OK ); |
|||
m_stdButtons->AddButton( m_stdButtonsOK ); |
|||
m_stdButtonsCancel = new wxButton( this, wxID_CANCEL ); |
|||
m_stdButtons->AddButton( m_stdButtonsCancel ); |
|||
m_stdButtons->Realize(); |
|||
|
|||
bSizes->Add( bButtons, 0, wxEXPAND, 5 ); |
|||
bSizes->Add( m_stdButtons, 0, wxEXPAND|wxALL, 5 ); |
|||
|
|||
|
|||
this->SetSizer( bSizes ); |
|||
this->Layout(); |
|||
bSizes->Fit( this ); |
|||
|
|||
this->Centre( wxBOTH ); |
|||
|
|||
// Connect Events
|
|||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onClose ) ); |
|||
m_ok->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onOkClick ), NULL, this ); |
|||
m_cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onCancelClick ), NULL, this ); |
|||
m_stdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onCancelClick ), NULL, this ); |
|||
m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onOkClick ), NULL, this ); |
|||
} |
|||
|
|||
DIALOG_TRACK_VIA_SIZE_BASE::~DIALOG_TRACK_VIA_SIZE_BASE() |
|||
{ |
|||
// Disconnect Events
|
|||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onClose ) ); |
|||
m_ok->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onOkClick ), NULL, this ); |
|||
m_cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onCancelClick ), NULL, this ); |
|||
m_stdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onCancelClick ), NULL, this ); |
|||
m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onOkClick ), NULL, this ); |
|||
|
|||
} |
|||
@ -0,0 +1,159 @@ |
|||
/*
|
|||
* KiRouter - a push-and-(sometimes-)shove PCB router |
|||
* |
|||
* Copyright (C) 2014 CERN |
|||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch> |
|||
* |
|||
* 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 <class_board.h>
|
|||
|
|||
#include "pns_item.h"
|
|||
#include "pns_via.h"
|
|||
#include "pns_solid.h"
|
|||
#include "pns_node.h"
|
|||
#include "pns_sizes_settings.h"
|
|||
|
|||
int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem ) |
|||
{ |
|||
VECTOR2I p; |
|||
|
|||
assert( aItem->Owner() != NULL ); |
|||
|
|||
switch( aItem->Kind() ) |
|||
{ |
|||
case PNS_ITEM::VIA: |
|||
p = static_cast<PNS_VIA*>( aItem )->Pos(); |
|||
break; |
|||
|
|||
case PNS_ITEM::SOLID: |
|||
p = static_cast<PNS_SOLID*>( aItem )->Pos(); |
|||
break; |
|||
|
|||
case PNS_ITEM::SEGMENT: |
|||
return static_cast<PNS_SEGMENT*>( aItem )->Width(); |
|||
|
|||
default: |
|||
return 0; |
|||
} |
|||
|
|||
PNS_JOINT* jt = aItem->Owner()->FindJoint( p, aItem ); |
|||
|
|||
assert( jt != NULL ); |
|||
|
|||
int mval = INT_MAX; |
|||
|
|||
PNS_ITEMSET linkedSegs = jt->Links().ExcludeItem( aItem ).FilterKinds( PNS_ITEM::SEGMENT ); |
|||
|
|||
BOOST_FOREACH( PNS_ITEM* item, linkedSegs.Items() ) |
|||
{ |
|||
int w = static_cast<PNS_SEGMENT*>( item )->Width(); |
|||
mval = std::min( w, mval ); |
|||
} |
|||
|
|||
return ( mval == INT_MAX ? 0 : mval ); |
|||
} |
|||
|
|||
void PNS_SIZES_SETTINGS::Init( BOARD* aBoard, PNS_ITEM* aStartItem, int aNet ) |
|||
{ |
|||
BOARD_DESIGN_SETTINGS &bds = aBoard->GetDesignSettings(); |
|||
|
|||
NETCLASSPTR netClass; |
|||
int net = aNet; |
|||
|
|||
if( aStartItem ) |
|||
net = aStartItem->Net(); |
|||
|
|||
if( net >= 0 ) |
|||
{ |
|||
NETINFO_ITEM* ni = aBoard->FindNet( net ); |
|||
|
|||
if( ni ) |
|||
{ |
|||
wxString netClassName = ni->GetClassName(); |
|||
netClass = bds.m_NetClasses.Find( netClassName ); |
|||
} |
|||
} |
|||
|
|||
if( !netClass ) |
|||
netClass = bds.GetDefault(); |
|||
|
|||
m_trackWidth = 0; |
|||
|
|||
if( bds.m_UseConnectedTrackWidth && aStartItem != NULL ) |
|||
{ |
|||
m_trackWidth = inheritTrackWidth( aStartItem ); |
|||
} |
|||
|
|||
if( !m_trackWidth && ( bds.UseNetClassTrack() && netClass != NULL ) ) // netclass value
|
|||
{ |
|||
m_trackWidth = netClass->GetTrackWidth(); |
|||
} |
|||
|
|||
if( !m_trackWidth ) |
|||
{ |
|||
m_trackWidth = bds.GetCurrentTrackWidth(); |
|||
} |
|||
|
|||
if( bds.UseNetClassVia() && netClass != NULL ) // netclass value
|
|||
{ |
|||
m_viaDiameter = netClass->GetViaDiameter(); |
|||
m_viaDrill = netClass->GetViaDrill(); |
|||
} |
|||
else |
|||
{ |
|||
m_viaDiameter = bds.GetCurrentViaSize(); |
|||
m_viaDrill = bds.GetCurrentViaDrill(); |
|||
} |
|||
|
|||
m_layerPairs.clear(); |
|||
} |
|||
|
|||
void PNS_SIZES_SETTINGS::ClearLayerPairs() |
|||
{ |
|||
m_layerPairs.clear(); |
|||
} |
|||
|
|||
void PNS_SIZES_SETTINGS::AddLayerPair( int aL1, int aL2 ) |
|||
{ |
|||
int top = std::min( aL1, aL2 ); |
|||
int bottom = std::max( aL1, aL2 ); |
|||
|
|||
m_layerPairs[bottom] = top; |
|||
m_layerPairs[top] = bottom; |
|||
} |
|||
|
|||
void PNS_SIZES_SETTINGS::ImportCurrent( BOARD_DESIGN_SETTINGS& aSettings ) |
|||
{ |
|||
m_trackWidth = aSettings.GetCurrentTrackWidth(); |
|||
m_viaDiameter = aSettings.GetCurrentViaSize(); |
|||
m_viaDrill = aSettings.GetCurrentViaDrill(); |
|||
} |
|||
|
|||
int PNS_SIZES_SETTINGS::GetLayerTop() const |
|||
{ |
|||
if( m_layerPairs.empty() ) |
|||
return F_Cu; |
|||
else |
|||
return m_layerPairs.begin()->first; |
|||
} |
|||
|
|||
int PNS_SIZES_SETTINGS::GetLayerBottom() const |
|||
{ |
|||
if( m_layerPairs.empty() ) |
|||
return B_Cu; |
|||
else |
|||
return m_layerPairs.begin()->second; |
|||
} |
|||
@ -0,0 +1,95 @@ |
|||
/* |
|||
* KiRouter - a push-and-(sometimes-)shove PCB router |
|||
* |
|||
* Copyright (C) 2014 CERN |
|||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch> |
|||
* |
|||
* 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 __PNS_SIZES_SETTINGS_H |
|||
#define __PNS_SIZES_SETTINGS_H |
|||
|
|||
#include <map> |
|||
#include <boost/optional.hpp> |
|||
|
|||
#include "../class_track.h" // for VIATYPE_T |
|||
|
|||
class BOARD; |
|||
class BOARD_DESIGN_SETTINGS; |
|||
class PNS_ITEM; |
|||
|
|||
class PNS_SIZES_SETTINGS { |
|||
|
|||
public: |
|||
PNS_SIZES_SETTINGS() : |
|||
m_trackWidth( 100000 ), |
|||
m_diffPairWidth( 100000 ), |
|||
m_diffPairGap( 125000 ), |
|||
m_viaDiameter( 500000 ), |
|||
m_viaDrill( 200000 ), |
|||
m_viaType( VIA_THROUGH ) |
|||
{}; |
|||
|
|||
~PNS_SIZES_SETTINGS() {}; |
|||
|
|||
void Init( BOARD* aBoard, PNS_ITEM* aStartItem = NULL, int aNet = -1 ); |
|||
void ImportCurrent ( BOARD_DESIGN_SETTINGS& aSettings ); |
|||
|
|||
void ClearLayerPairs(); |
|||
void AddLayerPair( int aL1, int aL2 ); |
|||
|
|||
int TrackWidth() const { return m_trackWidth; } |
|||
void SetTrackWidth( int aWidth ) { m_trackWidth = aWidth; } |
|||
|
|||
int DiffPairWidth() const { return m_diffPairWidth; } |
|||
|
|||
int DiffPairGap() const { return m_diffPairGap; } |
|||
|
|||
int ViaDiameter() const { return m_viaDiameter; } |
|||
void SetViaDiameter( int aDiameter) { m_viaDiameter = aDiameter; } |
|||
|
|||
int ViaDrill() const { return m_viaDrill; } |
|||
void SetViaDrill( int aDrill ) { m_viaDrill = aDrill; } |
|||
|
|||
boost::optional<int> PairedLayer ( int aLayerId ) |
|||
{ |
|||
if( m_layerPairs.find(aLayerId) == m_layerPairs.end() ) |
|||
return boost::optional<int>(); |
|||
|
|||
return m_layerPairs [ aLayerId ]; |
|||
} |
|||
|
|||
int GetLayerTop() const; |
|||
int GetLayerBottom() const; |
|||
|
|||
void SetViaType( VIATYPE_T aViaType ) { m_viaType = aViaType; } |
|||
VIATYPE_T ViaType() const { return m_viaType; } |
|||
|
|||
private: |
|||
|
|||
int inheritTrackWidth( PNS_ITEM *aItem ); |
|||
|
|||
int m_trackWidth; |
|||
int m_diffPairWidth; |
|||
int m_diffPairGap; |
|||
int m_viaDiameter; |
|||
int m_viaDrill; |
|||
|
|||
VIATYPE_T m_viaType; |
|||
|
|||
std::map<int, int> m_layerPairs; |
|||
}; |
|||
|
|||
#endif // __PNS_SIZES_SETTINGS_H |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue