Commit 3480c41c authored by Maciej Suminski's avatar Maciej Suminski

PNS router handles net class settings (dependent on the selected start item).

parent 79631def
...@@ -114,11 +114,29 @@ public: ...@@ -114,11 +114,29 @@ public:
* Function GetCurrentNetClassName * Function GetCurrentNetClassName
* @return the current net class name. * @return the current net class name.
*/ */
const wxString& GetCurrentNetClassName() const inline const wxString& GetCurrentNetClassName() const
{ {
return m_currentNetClassName; return m_currentNetClassName;
} }
/**
* Function UseNetClassTrack
* returns true if netclass values should be used to obtain appropriate track width.
*/
inline bool UseNetClassTrack() const
{
return ( m_trackWidthIndex == 0 && !m_useCustomTrackVia );
}
/**
* Function UseNetClassVia
* returns true if netclass values should be used to obtain appropriate via size.
*/
inline bool UseNetClassVia() const
{
return ( m_viaSizeIndex == 0 && !m_useCustomTrackVia );
}
/** /**
* Function SetCurrentNetClass * Function SetCurrentNetClass
* Must be called after a netclass selection (or after a netclass parameter change * Must be called after a netclass selection (or after a netclass parameter change
...@@ -159,7 +177,7 @@ public: ...@@ -159,7 +177,7 @@ public:
* Function GetTrackWidthIndex * Function GetTrackWidthIndex
* @return the current track width list index. * @return the current track width list index.
*/ */
unsigned GetTrackWidthIndex() const { return m_trackWidthIndex; } inline unsigned GetTrackWidthIndex() const { return m_trackWidthIndex; }
/** /**
* Function SetTrackWidthIndex * Function SetTrackWidthIndex
...@@ -175,7 +193,7 @@ public: ...@@ -175,7 +193,7 @@ public:
* ( using the default netclass value or a preset/custom value ) * ( using the default netclass value or a preset/custom value )
* the default netclass is always in m_TrackWidthList[0] * the default netclass is always in m_TrackWidthList[0]
*/ */
int GetCurrentTrackWidth() const inline int GetCurrentTrackWidth() const
{ {
return m_useCustomTrackVia ? m_customTrackWidth : m_TrackWidthList[m_trackWidthIndex]; return m_useCustomTrackVia ? m_customTrackWidth : m_TrackWidthList[m_trackWidthIndex];
} }
...@@ -187,7 +205,7 @@ public: ...@@ -187,7 +205,7 @@ public:
* (UseCustomTrackViaSize()). * (UseCustomTrackViaSize()).
* @param aWidth is the new track width. * @param aWidth is the new track width.
*/ */
void SetCustomTrackWidth( int aWidth ) inline void SetCustomTrackWidth( int aWidth )
{ {
m_customTrackWidth = aWidth; m_customTrackWidth = aWidth;
} }
...@@ -196,7 +214,7 @@ public: ...@@ -196,7 +214,7 @@ public:
* Function GetCustomTrackWidth * Function GetCustomTrackWidth
* @return Current custom width for a track. * @return Current custom width for a track.
*/ */
int GetCustomTrackWidth() const inline int GetCustomTrackWidth() const
{ {
return m_customTrackWidth; return m_customTrackWidth;
} }
...@@ -205,7 +223,10 @@ public: ...@@ -205,7 +223,10 @@ public:
* Function GetViaSizeIndex * Function GetViaSizeIndex
* @return the current via size list index. * @return the current via size list index.
*/ */
unsigned GetViaSizeIndex() const { return m_viaSizeIndex; } inline unsigned GetViaSizeIndex() const
{
return m_viaSizeIndex;
}
/** /**
* Function SetViaSizeIndex * Function SetViaSizeIndex
...@@ -221,7 +242,7 @@ public: ...@@ -221,7 +242,7 @@ public:
* ( using the default netclass value or a preset/custom value ) * ( using the default netclass value or a preset/custom value )
* the default netclass is always in m_TrackWidthList[0] * the default netclass is always in m_TrackWidthList[0]
*/ */
int GetCurrentViaSize() const inline int GetCurrentViaSize() const
{ {
if( m_useCustomTrackVia ) if( m_useCustomTrackVia )
return m_customViaSize.m_Diameter; return m_customViaSize.m_Diameter;
...@@ -236,7 +257,7 @@ public: ...@@ -236,7 +257,7 @@ public:
* (UseCustomTrackViaSize()). * (UseCustomTrackViaSize()).
* @param aSize is the new drill diameter. * @param aSize is the new drill diameter.
*/ */
void SetCustomViaSize( int aSize ) inline void SetCustomViaSize( int aSize )
{ {
m_customViaSize.m_Diameter = aSize; m_customViaSize.m_Diameter = aSize;
} }
...@@ -245,7 +266,7 @@ public: ...@@ -245,7 +266,7 @@ public:
* Function GetCustomViaSize * Function GetCustomViaSize
* @return Current custom size for the via diameter. * @return Current custom size for the via diameter.
*/ */
int GetCustomViaSize() const inline int GetCustomViaSize() const
{ {
return m_customViaSize.m_Diameter; return m_customViaSize.m_Diameter;
} }
...@@ -265,7 +286,7 @@ public: ...@@ -265,7 +286,7 @@ public:
* (UseCustomTrackViaSize()). * (UseCustomTrackViaSize()).
* @param aDrill is the new drill size. * @param aDrill is the new drill size.
*/ */
void SetCustomViaDrill( int aDrill ) inline void SetCustomViaDrill( int aDrill )
{ {
m_customViaSize.m_Drill = aDrill; m_customViaSize.m_Drill = aDrill;
} }
...@@ -274,7 +295,7 @@ public: ...@@ -274,7 +295,7 @@ public:
* Function GetCustomViaDrill * Function GetCustomViaDrill
* @return Current custom size for the via drill. * @return Current custom size for the via drill.
*/ */
int GetCustomViaDrill() const inline int GetCustomViaDrill() const
{ {
return m_customViaSize.m_Drill; return m_customViaSize.m_Drill;
} }
...@@ -286,7 +307,7 @@ public: ...@@ -286,7 +307,7 @@ public:
* tracks and vias. * tracks and vias.
* @param aEnabled decides if custom settings should be used for new tracks/vias. * @param aEnabled decides if custom settings should be used for new tracks/vias.
*/ */
void UseCustomTrackViaSize( bool aEnabled ) inline void UseCustomTrackViaSize( bool aEnabled )
{ {
m_useCustomTrackVia = aEnabled; m_useCustomTrackVia = aEnabled;
} }
...@@ -295,7 +316,7 @@ public: ...@@ -295,7 +316,7 @@ public:
* Function UseCustomTrackViaSize * Function UseCustomTrackViaSize
* @return True if custom sizes of tracks & vias are enabled, false otherwise. * @return True if custom sizes of tracks & vias are enabled, false otherwise.
*/ */
bool UseCustomTrackViaSize() const inline bool UseCustomTrackViaSize() const
{ {
return m_useCustomTrackVia; return m_useCustomTrackVia;
} }
...@@ -305,7 +326,7 @@ public: ...@@ -305,7 +326,7 @@ public:
* returns a bit-mask of all the layers that are visible * returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form. * @return int - the visible layers in bit-mapped form.
*/ */
LAYER_MSK GetVisibleLayers() const inline LAYER_MSK GetVisibleLayers() const
{ {
return m_visibleLayers; return m_visibleLayers;
} }
...@@ -322,7 +343,7 @@ public: ...@@ -322,7 +343,7 @@ public:
* changes the bit-mask of visible layers * changes the bit-mask of visible layers
* @param aMask = The new bit-mask of visible layers * @param aMask = The new bit-mask of visible layers
*/ */
void SetVisibleLayers( LAYER_MSK aMask ) inline void SetVisibleLayers( LAYER_MSK aMask )
{ {
m_visibleLayers = aMask & m_enabledLayers & FULL_LAYERS; m_visibleLayers = aMask & m_enabledLayers & FULL_LAYERS;
} }
...@@ -333,7 +354,7 @@ public: ...@@ -333,7 +354,7 @@ public:
* @param aLayer = The layer to be tested * @param aLayer = The layer to be tested
* @return bool - true if the layer is visible. * @return bool - true if the layer is visible.
*/ */
bool IsLayerVisible( LAYER_NUM aLayer ) const inline bool IsLayerVisible( LAYER_NUM aLayer ) const
{ {
// If a layer is disabled, it is automatically invisible // If a layer is disabled, it is automatically invisible
return m_visibleLayers & m_enabledLayers & GetLayerMask( aLayer ); return m_visibleLayers & m_enabledLayers & GetLayerMask( aLayer );
...@@ -352,7 +373,7 @@ public: ...@@ -352,7 +373,7 @@ public:
* returns a bit-mask of all the element categories that are visible * returns a bit-mask of all the element categories that are visible
* @return int - the visible element categories in bit-mapped form. * @return int - the visible element categories in bit-mapped form.
*/ */
int GetVisibleElements() const inline int GetVisibleElements() const
{ {
return m_visibleElements; return m_visibleElements;
} }
...@@ -362,7 +383,7 @@ public: ...@@ -362,7 +383,7 @@ public:
* changes the bit-mask of visible element categories * changes the bit-mask of visible element categories
* @param aMask = The new bit-mask of visible element categories * @param aMask = The new bit-mask of visible element categories
*/ */
void SetVisibleElements( int aMask ) inline void SetVisibleElements( int aMask )
{ {
m_visibleElements = aMask; m_visibleElements = aMask;
} }
...@@ -375,7 +396,7 @@ public: ...@@ -375,7 +396,7 @@ public:
* @return bool - true if the element is visible. * @return bool - true if the element is visible.
* @see enum PCB_VISIBLE * @see enum PCB_VISIBLE
*/ */
bool IsElementVisible( int aElementCategory ) const inline bool IsElementVisible( int aElementCategory ) const
{ {
assert( aElementCategory >= 0 && aElementCategory < END_PCB_VISIBLE_LIST ); assert( aElementCategory >= 0 && aElementCategory < END_PCB_VISIBLE_LIST );
...@@ -414,7 +435,7 @@ public: ...@@ -414,7 +435,7 @@ public:
* @param aLayer = The of the layer to be tested * @param aLayer = The of the layer to be tested
* @return bool - true if the layer is enabled * @return bool - true if the layer is enabled
*/ */
bool IsLayerEnabled( LAYER_NUM aLayer ) const inline bool IsLayerEnabled( LAYER_NUM aLayer ) const
{ {
return m_enabledLayers & GetLayerMask( aLayer ); return m_enabledLayers & GetLayerMask( aLayer );
} }
...@@ -423,7 +444,7 @@ public: ...@@ -423,7 +444,7 @@ public:
* Function GetCopperLayerCount * Function GetCopperLayerCount
* @return int - the number of neabled copper layers * @return int - the number of neabled copper layers
*/ */
int GetCopperLayerCount() const inline int GetCopperLayerCount() const
{ {
return m_copperLayerCount; return m_copperLayerCount;
} }
...@@ -443,8 +464,8 @@ public: ...@@ -443,8 +464,8 @@ public:
*/ */
void AppendConfigs( PARAM_CFG_ARRAY* aResult ); void AppendConfigs( PARAM_CFG_ARRAY* aResult );
int GetBoardThickness() const { return m_boardThickness; } inline int GetBoardThickness() const { return m_boardThickness; }
void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; } inline void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; }
private: private:
/// Index for #m_ViasDimensionsList to select the current via size. /// Index for #m_ViasDimensionsList to select the current via size.
......
...@@ -274,6 +274,8 @@ void BOARD_DESIGN_SETTINGS::SetViaSizeIndex( unsigned aIndex ) ...@@ -274,6 +274,8 @@ void BOARD_DESIGN_SETTINGS::SetViaSizeIndex( unsigned aIndex )
m_viaSizeIndex = m_ViasDimensionsList.size(); m_viaSizeIndex = m_ViasDimensionsList.size();
else else
m_viaSizeIndex = aIndex; m_viaSizeIndex = aIndex;
m_useCustomTrackVia = false;
} }
...@@ -296,6 +298,8 @@ void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex( unsigned aIndex ) ...@@ -296,6 +298,8 @@ void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex( unsigned aIndex )
m_trackWidthIndex = m_TrackWidthList.size(); m_trackWidthIndex = m_TrackWidthList.size();
else else
m_trackWidthIndex = aIndex; m_trackWidthIndex = aIndex;
m_useCustomTrackVia = false;
} }
......
...@@ -764,12 +764,6 @@ void PNS_LINE_PLACER::SetLayer(int aLayer) ...@@ -764,12 +764,6 @@ void PNS_LINE_PLACER::SetLayer(int aLayer)
} }
void PNS_LINE_PLACER::SetWidth(int aWidth)
{
m_currentWidth = aWidth;
}
void PNS_LINE_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) void PNS_LINE_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
{ {
VECTOR2I p( aP ); VECTOR2I p( aP );
...@@ -995,6 +989,7 @@ void PNS_LINE_PLACER::UpdateSizes( const PNS_ROUTING_SETTINGS& aSettings ) ...@@ -995,6 +989,7 @@ void PNS_LINE_PLACER::UpdateSizes( const PNS_ROUTING_SETTINGS& aSettings )
m_head.SetWidth( trackWidth ); m_head.SetWidth( trackWidth );
m_tail.SetWidth( trackWidth ); m_tail.SetWidth( trackWidth );
m_currentWidth = trackWidth;
m_viaDiameter = aSettings.GetViaDiameter(); m_viaDiameter = aSettings.GetViaDiameter();
m_viaDrill = aSettings.GetViaDrill(); m_viaDrill = aSettings.GetViaDrill();
} }
......
...@@ -252,7 +252,7 @@ private: ...@@ -252,7 +252,7 @@ private:
* and redundant vertexes. If a simplification bhas been found, replaces the * and redundant vertexes. If a simplification bhas been found, replaces the
* old line with the simplified one in aNode. * old line with the simplified one in aNode.
*/ */
void simplifyNewLine ( PNS_NODE *aNode, PNS_SEGMENT *aLatest ); void simplifyNewLine( PNS_NODE *aNode, PNS_SEGMENT *aLatest );
/** /**
* Function handleViaPlacement() * Function handleViaPlacement()
...@@ -338,13 +338,13 @@ private: ...@@ -338,13 +338,13 @@ private:
void routeStep( const VECTOR2I& aP ); void routeStep( const VECTOR2I& aP );
///> route step, walkaround mode ///> route step, walkaround mode
bool rhWalkOnly ( const VECTOR2I& aP, PNS_LINE& aNewHead); bool rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead);
///> route step, shove mode ///> route step, shove mode
bool rhShoveOnly ( const VECTOR2I& aP, PNS_LINE& aNewHead); bool rhShoveOnly( const VECTOR2I& aP, PNS_LINE& aNewHead);
///> route step, mark obstacles mode ///> route step, mark obstacles mode
bool rhMarkObstacles ( const VECTOR2I& aP, PNS_LINE& aNewHead ); bool rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead );
///> current routing direction ///> current routing direction
DIRECTION_45 m_direction; DIRECTION_45 m_direction;
...@@ -386,7 +386,9 @@ private: ...@@ -386,7 +386,9 @@ private:
///> current via drill ///> current via drill
int m_viaDrill; int m_viaDrill;
///> current track width
int m_currentWidth; int m_currentWidth;
int m_currentNet; int m_currentNet;
int m_currentLayer; int m_currentLayer;
......
...@@ -484,7 +484,30 @@ bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem ) ...@@ -484,7 +484,30 @@ bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem )
m_placer = new PNS_LINE_PLACER( this ); m_placer = new PNS_LINE_PLACER( this );
m_placer->SetLayer( m_currentLayer ); m_placer->SetLayer( m_currentLayer );
m_placer->SetWidth( m_settings.GetTrackWidth() );
const BOARD_DESIGN_SETTINGS& dsnSettings = m_board->GetDesignSettings();
if( dsnSettings.UseNetClassTrack() && aStartItem != NULL ) // netclass value
{
m_settings.SetTrackWidth( aStartItem->Parent()->GetNetClass()->GetTrackWidth() );
}
else
{
m_settings.SetTrackWidth( dsnSettings.GetCurrentTrackWidth() );
}
if( dsnSettings.UseNetClassVia() && aStartItem != NULL ) // netclass value
{
m_settings.SetViaDiameter( aStartItem->Parent()->GetNetClass()->GetViaDiameter() );
m_settings.SetViaDrill( aStartItem->Parent()->GetNetClass()->GetViaDrill() );
}
else
{
m_settings.SetViaDiameter( dsnSettings.GetCurrentViaSize() );
m_settings.SetViaDrill( dsnSettings.GetCurrentViaDrill() );
}
m_placer->UpdateSizes( m_settings );
m_placer->Start( aP, aStartItem ); m_placer->Start( aP, aStartItem );
m_currentEnd = aP; m_currentEnd = aP;
m_currentEndItem = NULL; m_currentEndItem = NULL;
......
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