( trace );
}
}
}
@@ -1295,7 +1320,7 @@ TRACK* TRACK::GetVia( TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLay
}
-TRACK* TRACK::GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, int aEndPoint )
+TRACK* TRACK::GetTrack( TRACK* aStartTrace, TRACK* aEndTrace, int aEndPoint )
{
const int NEIGHTBOUR_COUNT_MAX = 50;
@@ -1466,7 +1491,7 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
}
Track->SetState( BUSY, true );
- segm = ::GetTrace( this, TrackListEnd, Track->m_Start, layerMask );
+ segm = ::GetTrack( this, TrackListEnd, Track->m_Start, layerMask );
Track->SetState( BUSY, false );
if( via )
@@ -1513,7 +1538,7 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
}
Track->SetState( BUSY, true );
- segm = ::GetTrace( this, TrackListEnd, Track->m_End, layerMask );
+ segm = ::GetTrack( this, TrackListEnd, Track->m_End, layerMask );
Track->SetState( BUSY, false );
if( via )
diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h
index 56ac970102..8b727dde17 100644
--- a/pcbnew/class_track.h
+++ b/pcbnew/class_track.h
@@ -38,23 +38,27 @@
class TRACK;
+class VIA;
class D_PAD;
class MSG_PANEL_ITEM;
-// Via attributes (m_Shape parameter)
-#define VIA_THROUGH 3 /* Always a through hole via */
-#define VIA_BLIND_BURIED 2 /* this via can be on internal layers */
-#define VIA_MICROVIA 1 /* this via which connect from an external layer
- * to the near neighbor internal layer */
-#define VIA_NOT_DEFINED 0 /* not yet used */
+// Via types
+enum VIATYPE_T
+{
+ VIA_THROUGH = 3, /* Always a through hole via */
+ VIA_BLIND_BURIED = 2, /* this via can be on internal layers */
+ VIA_MICROVIA = 1, /* this via which connect from an external layer
+ * to the near neighbor internal layer */
+ VIA_NOT_DEFINED = 0 /* not yet used */
+};
#define UNDEFINED_DRILL_DIAMETER -1 //< Undefined via drill diameter.
#define MIN_VIA_DRAW_SIZE 4 /// Minimum size in pixel for full drawing
/**
- * Function GetTrace
+ * Function GetTrack
* is a helper function to locate a trace segment having an end point at \a aPosition
* on \a aLayerMask starting at \a aStartTrace and end at \a aEndTrace.
*
@@ -69,9 +73,8 @@ class MSG_PANEL_ITEM;
* layer mask.
* @return A TRACK object pointer if found otherwise NULL.
*/
-extern TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition,
- LAYER_MSK aLayerMask );
-
+extern TRACK* GetTrack( TRACK* aStartTrace, TRACK* aEndTrace,
+ const wxPoint& aPosition, LAYER_MSK aLayerMask );
class TRACK : public BOARD_CONNECTED_ITEM
{
@@ -85,9 +88,6 @@ protected:
int m_Width; // Thickness of track, or via diameter
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point
- int m_Shape; // vias: shape and type, Track = shape..
-
- int m_Drill; // for vias: via drill (- 1 for default value)
public:
BOARD_CONNECTED_ITEM* start; // pointers to a connected item (pad or track)
@@ -124,9 +124,6 @@ public:
void SetStart( const wxPoint& aStart ) { m_Start = aStart; }
const wxPoint& GetStart() const { return m_Start; }
- int GetShape() const { return m_Shape; }
- void SetShape( int aShape ) { m_Shape = aShape; }
-
// Virtual function
const EDA_RECT GetBoundingBox() const;
@@ -180,47 +177,13 @@ public:
int aClearanceValue,
int aCircleToSegmentsCount,
double aCorrectionFactor ) const;
- /**
- * Function SetDrill
- * sets the drill value for vias.
- * @param aDrill is the new drill diameter
- */
- void SetDrill( int aDrill ) { m_Drill = aDrill; }
-
- /**
- * Function GetDrill
- * returns the local drill setting for this VIA. If you want the calculated value,
- * use GetDrillValue() instead.
- */
- int GetDrill() const { return m_Drill; }
-
- /**
- * Function GetDrillValue
- * "calculates" the drill value for vias (m-Drill if > 0, or default
- * drill value for the board.
- * @return real drill_value
- */
- int GetDrillValue() const;
-
- /**
- * Function SetDrillDefault
- * sets the drill value for vias to the default value #UNDEFINED_DRILL_DIAMETER.
- */
- void SetDrillDefault() { m_Drill = UNDEFINED_DRILL_DIAMETER; }
-
- /**
- * Function IsDrillDefault
- * @return true if the drill value is default value (-1)
- */
- bool IsDrillDefault() { return m_Drill <= 0; }
-
/**
* Function GetLayerMask
* returns a "layer mask", which is a bitmap of all layers on which the
- * TRACK segment or SEGVIA physically resides.
+ * TRACK segment or VIA physically resides.
* @return int - a layer mask, see pcbstruct.h's LAYER_BACK, etc.
*/
- LAYER_MSK GetLayerMask() const;
+ virtual LAYER_MSK GetLayerMask() const;
/**
* Function IsPointOnEnds
@@ -239,13 +202,6 @@ public:
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
- /**
- * Function GetMsgPanelInfoBase
- * Display info about the track segment only, and does not calculate the full track length
- * @param aList A list of #MSG_PANEL_ITEM objects to add status information.
- */
- void GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList );
-
/**
* Function ShowWidth
* returns the width of the track in displayable user units.
@@ -265,28 +221,28 @@ public:
/**
* Function GetVia
- * finds the first SEGVIA object at \a aPosition on \a aLayer starting at the trace.
+ * finds the first VIA object at \a aPosition on \a aLayer starting at the trace.
*
* @param aPosition The wxPoint to HitTest() against.
* @param aLayer The layer to match, pass -1 for a don't care.
- * @return A pointer to a SEGVIA object if found, else NULL.
+ * @return A pointer to a VIA object if found, else NULL.
*/
- TRACK* GetVia( const wxPoint& aPosition, LAYER_NUM aLayer = UNDEFINED_LAYER );
+ VIA* GetVia( const wxPoint& aPosition, LAYER_NUM aLayer = UNDEFINED_LAYER );
/**
* Function GetVia
- * finds the first SEGVIA object at \a aPosition on \a aLayer starting at the trace
+ * finds the first VIA object at \a aPosition on \a aLayer starting at the trace
* and ending at \a aEndTrace.
*
* @param aEndTrace Pointer to the last TRACK object to end search.
* @param aPosition The wxPoint to HitTest() against.
* @param aLayerMask The layers to match, pass -1 for a don't care.
- * @return A pointer to a SEGVIA object if found, else NULL.
+ * @return A pointer to a VIA object if found, else NULL.
*/
- TRACK* GetVia( TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask );
+ VIA* GetVia( TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask );
/**
- * Function GetTrace
+ * Function GetTrack
* return the trace segment connected to the segment at \a aEndPoint from \a
* aStartTrace to \a aEndTrace.
*
@@ -296,7 +252,7 @@ public:
* @param aEndPoint The start or end point of the segment to test against.
* @return A TRACK object pointer if found otherwise NULL.
*/
- TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, int aEndPoint );
+ TRACK* GetTrack( TRACK* aStartTrace, TRACK* aEndTrace, int aEndPoint );
/**
* Function GetEndSegments
@@ -349,6 +305,24 @@ public:
static wxString ShowState( int stateBits );
#endif
+
+protected:
+ /**
+ * Function GetMsgPanelInfoBase
+ * Display info about the track segment only, and does not calculate the full track length
+ * @param aList A list of #MSG_PANEL_ITEM objects to add status information.
+ */
+ virtual void GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList );
+
+
+ /**
+ * Helper function for the common panel info */
+ void GetMsgPanelInfoBase_Common( std::vector< MSG_PANEL_ITEM >& aList );
+
+ /**
+ * Helper for drawing the short netname in tracks */
+ void DrawShortNetname( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
+ EDA_COLOR_T aBgColor );
};
@@ -369,16 +343,22 @@ public:
wxString GetSelectMenuText() const;
+ void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
+ GR_DRAWMODE aDrawMode, const wxPoint& aOffset = ZeroOffset );
+
BITMAP_DEF GetMenuImage() const { return add_zone_xpm; }
EDA_ITEM* Clone() const;
+
+protected:
+ virtual void GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList );
};
-class SEGVIA : public TRACK
+class VIA : public TRACK
{
public:
- SEGVIA( BOARD_ITEM* aParent );
+ VIA( BOARD_ITEM* aParent );
// Do not create a copy constructor. The one generated by the compiler is adequate.
@@ -387,6 +367,8 @@ public:
bool IsOnLayer( LAYER_NUM aLayer ) const;
+ virtual LAYER_MSK GetLayerMask() const;
+
/**
* Function SetLayerPair
* set the .m_Layer member param:
@@ -428,6 +410,52 @@ public:
#if defined (DEBUG)
virtual void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif
+
+ VIATYPE_T GetViaType() const { return m_ViaType; }
+ void SetViaType( VIATYPE_T aViaType ) { m_ViaType = aViaType; }
+
+ /**
+ * Function SetDrill
+ * sets the drill value for vias.
+ * @param aDrill is the new drill diameter
+ */
+ void SetDrill( int aDrill ) { m_Drill = aDrill; }
+
+ /**
+ * Function GetDrill
+ * returns the local drill setting for this VIA. If you want the calculated value,
+ * use GetDrillValue() instead.
+ */
+ int GetDrill() const { return m_Drill; }
+
+ /**
+ * Function GetDrillValue
+ * "calculates" the drill value for vias (m-Drill if > 0, or default
+ * drill value for the board.
+ * @return real drill_value
+ */
+ int GetDrillValue() const;
+
+ /**
+ * Function SetDrillDefault
+ * sets the drill value for vias to the default value #UNDEFINED_DRILL_DIAMETER.
+ */
+ void SetDrillDefault() { m_Drill = UNDEFINED_DRILL_DIAMETER; }
+
+ /**
+ * Function IsDrillDefault
+ * @return true if the drill value is default value (-1)
+ */
+ bool IsDrillDefault() const { return m_Drill <= 0; }
+
+
+protected:
+ virtual void GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList );
+
+private:
+ VIATYPE_T m_ViaType; // Type of via
+
+ int m_Drill; // for vias: via drill (- 1 for default value)
};
diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp
index 63d72de226..443394157d 100644
--- a/pcbnew/clean.cpp
+++ b/pcbnew/clean.cpp
@@ -111,7 +111,7 @@ void PCB_EDIT_FRAME::Clean_Pcb()
* Delete
* - Redundant points on tracks (merge aligned segments)
* - vias on pad
- * - null lenght segments
+ * - null length segments
* Create segments when track ends are incorrectly connected:
* i.e. when a track end covers a pad or a via but is not exactly on the pad or the via center
*/
@@ -201,10 +201,13 @@ bool TRACKS_CLEANER::clean_vias()
{
if( track->GetStart() != track->GetEnd() )
track->SetEnd( track->GetStart() );
- }
- if( track->GetShape() != VIA_THROUGH )
- continue;
+ VIA *via = static_cast( track );
+ /* Important: this cleanup only does thru hole vias, it doesn't
+ * (yet) handle high density interconnects */
+ if( via->GetViaType() != VIA_THROUGH )
+ continue;
+ }
// Search and delete others vias at same location
TRACK* alt_track = track->Next();
@@ -213,17 +216,21 @@ bool TRACKS_CLEANER::clean_vias()
for( ; alt_track != NULL; alt_track = next_track )
{
next_track = alt_track->Next();
+ VIA *alt_via = dynamic_cast( alt_track );
+ if( alt_via )
+ {
- if( alt_track->GetShape() != VIA_THROUGH )
- continue;
+ if( alt_via->GetViaType() != VIA_THROUGH )
+ continue;
- if( alt_track->GetStart() != track->GetStart() )
- continue;
+ if( alt_via->GetStart() != track->GetStart() )
+ continue;
- // delete via
- alt_track->UnLink();
- delete alt_track;
- modified = true;
+ // delete via
+ alt_track->UnLink();
+ delete alt_track;
+ modified = true;
+ }
}
}
@@ -233,7 +240,8 @@ bool TRACKS_CLEANER::clean_vias()
{
next_track = track->Next();
- if( track->GetShape() != VIA_THROUGH )
+ VIA *via = dynamic_cast( track );
+ if( !via || (via->GetViaType() != VIA_THROUGH ))
continue;
// Examine the list of connected pads:
@@ -296,7 +304,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
if( (type_end & START_ON_PAD ) == 0 )
{
- TRACK* other = track->GetTrace( m_Brd->m_Track, NULL, FLG_START );
+ TRACK* other = track->GetTrack( m_Brd->m_Track, NULL, FLG_START );
if( other == NULL ) // Test a connection to zones
{
@@ -309,7 +317,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
}
else
{
- ((SEGVIA*)track)->LayerPair( &top_layer, &bottom_layer );
+ ((VIA*)track)->LayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( track->GetStart(),
top_layer, bottom_layer,
track->GetNetCode() );
@@ -332,8 +340,8 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
// search for another segment following the via
track->SetState( BUSY, true );
- SEGVIA* via = (SEGVIA*) other;
- other = via->GetTrace( m_Brd->m_Track, NULL, FLG_START );
+ VIA* via = (VIA*) other;
+ other = via->GetTrack( m_Brd->m_Track, NULL, FLG_START );
if( other == NULL )
{
@@ -356,7 +364,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
// test if this track end point is connected to an other track
if( (type_end & END_ON_PAD ) == 0 )
{
- TRACK* other = track->GetTrace( m_Brd->m_Track, NULL, FLG_END );
+ TRACK* other = track->GetTrack( m_Brd->m_Track, NULL, FLG_END );
if( other == NULL ) // Test a connection to zones
{
@@ -369,7 +377,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
}
else
{
- ((SEGVIA*)track)->LayerPair( &top_layer, &bottom_layer );
+ ((VIA*)track)->LayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( track->GetEnd(),
top_layer, bottom_layer,
track->GetNetCode() );
@@ -393,8 +401,8 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
track->SetState( BUSY, true );
- SEGVIA* via = (SEGVIA*) other;
- other = via->GetTrace( m_Brd->m_Track, NULL, FLG_END );
+ VIA* via = (VIA*) other;
+ other = via->GetTrack( m_Brd->m_Track, NULL, FLG_END );
if( other == NULL )
{
@@ -500,7 +508,7 @@ bool TRACKS_CLEANER::clean_segments()
// search for a possible point connected to the START point of the current segment
for( segStart = segment->Next(); ; )
{
- segStart = segment->GetTrace( segStart, NULL, FLG_START );
+ segStart = segment->GetTrack( segStart, NULL, FLG_START );
if( segStart )
{
@@ -514,7 +522,7 @@ bool TRACKS_CLEANER::clean_segments()
// We must have only one segment connected
segStart->SetState( BUSY, true );
- other = segment->GetTrace( m_Brd->m_Track, NULL, FLG_START );
+ other = segment->GetTrack( m_Brd->m_Track, NULL, FLG_START );
segStart->SetState( BUSY, false );
if( other == NULL )
@@ -540,7 +548,7 @@ bool TRACKS_CLEANER::clean_segments()
// search for a possible point connected to the END point of the current segment:
for( segEnd = segment->Next(); ; )
{
- segEnd = segment->GetTrace( segEnd, NULL, FLG_END );
+ segEnd = segment->GetTrack( segEnd, NULL, FLG_END );
if( segEnd )
{
@@ -552,7 +560,7 @@ bool TRACKS_CLEANER::clean_segments()
// We must have only one segment connected
segEnd->SetState( BUSY, true );
- other = segment->GetTrace( m_Brd->m_Track, NULL, FLG_END );
+ other = segment->GetTrack( m_Brd->m_Track, NULL, FLG_END );
segEnd->SetState( BUSY, false );
if( other == NULL )
@@ -736,7 +744,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
}
else
{
- other = segment->GetTrace( GetBoard()->m_Track, NULL, FLG_START );
+ other = segment->GetTrack( GetBoard()->m_Track, NULL, FLG_START );
if( other )
net_code_s = other->GetNetCode();
@@ -754,7 +762,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
}
else
{
- other = segment->GetTrace( GetBoard()->m_Track, NULL, FLG_END );
+ other = segment->GetTrack( GetBoard()->m_Track, NULL, FLG_END );
if( other )
net_code_e = other->GetNetCode();
diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp
index 4aee57a556..2470684c6d 100644
--- a/pcbnew/collectors.cpp
+++ b/pcbnew/collectors.cpp
@@ -149,7 +149,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
MODULE* module = NULL;
D_PAD* pad = NULL;
bool pad_through = false;
- SEGVIA* via = NULL;
+ VIA* via = NULL;
MARKER_PCB* marker = NULL;
#if 0 // debugging
@@ -252,7 +252,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
break;
case PCB_VIA_T: // vias are on many layers, so layer test is specific
- via = (SEGVIA*) item;
+ via = (VIA*) item;
break;
case PCB_TRACE_T:
diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp
index dc03481fca..6daa73471e 100644
--- a/pcbnew/dialogs/dialog_gendrill.cpp
+++ b/pcbnew/dialogs/dialog_gendrill.cpp
@@ -140,15 +140,27 @@ void DIALOG_GENDRILL::InitDisplayParams()
for( TRACK* track = m_parent->GetBoard()->m_Track; track != NULL; track = track->Next() )
{
- if( track->Type() != PCB_VIA_T )
- continue;
+ const VIA *via = dynamic_cast( track );
+ if( via )
+ {
+ switch( via->GetViaType() )
+ {
+ case VIA_THROUGH:
+ m_throughViasCount++;
+ break;
- if( track->GetShape() == VIA_THROUGH )
- m_throughViasCount++;
- else if( track->GetShape() == VIA_MICROVIA )
- m_microViasCount++;
- else if( track->GetShape() == VIA_BLIND_BURIED )
- m_blindOrBuriedViasCount++;
+ case VIA_MICROVIA:
+ m_microViasCount++;
+ break;
+
+ case VIA_BLIND_BURIED:
+ m_blindOrBuriedViasCount++;
+ break;
+
+ default:
+ break;
+ }
+ }
}
m_MicroViaDrillValue->Enable( m_microViasCount );
diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp
index c53df84be0..07b8ebf0f9 100644
--- a/pcbnew/drc.cpp
+++ b/pcbnew/drc.cpp
@@ -597,7 +597,7 @@ void DRC::testKeepoutAreas()
if( ! area->GetDoNotAllowVias() )
continue;
- if( ! ((SEGVIA*)segm)->IsOnLayer( area->GetLayer() ) )
+ if( ! ((VIA*)segm)->IsOnLayer( area->GetLayer() ) )
continue;
if( area->Outline()->Distance( segm->GetPosition() ) < segm->GetWidth()/2 )
@@ -645,7 +645,7 @@ bool DRC::doTrackKeepoutDrc( TRACK* aRefSeg )
if( ! area->GetDoNotAllowVias() )
continue;
- if( ! ((SEGVIA*)aRefSeg)->IsOnLayer( area->GetLayer() ) )
+ if( ! ((VIA*)aRefSeg)->IsOnLayer( area->GetLayer() ) )
continue;
if( area->Outline()->Distance( aRefSeg->GetPosition() ) < aRefSeg->GetWidth()/2 )
diff --git a/pcbnew/drc_clearance_test_functions.cpp b/pcbnew/drc_clearance_test_functions.cpp
index 0550f6cfa2..04394d2d08 100644
--- a/pcbnew/drc_clearance_test_functions.cpp
+++ b/pcbnew/drc_clearance_test_functions.cpp
@@ -169,21 +169,22 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// Phase 0 : Test vias
if( aRefSeg->Type() == PCB_VIA_T )
{
+ const VIA *refvia = static_cast( aRefSeg );
// test if the via size is smaller than minimum
- if( aRefSeg->GetShape() == VIA_MICROVIA )
+ if( refvia->GetViaType() == VIA_MICROVIA )
{
- if( aRefSeg->GetWidth() < netclass->GetuViaMinDiameter() )
+ if( refvia->GetWidth() < netclass->GetuViaMinDiameter() )
{
- m_currentMarker = fillMarker( aRefSeg, NULL,
+ m_currentMarker = fillMarker( refvia, NULL,
DRCE_TOO_SMALL_MICROVIA, m_currentMarker );
return false;
}
}
else
{
- if( aRefSeg->GetWidth() < netclass->GetViaMinDiameter() )
+ if( refvia->GetWidth() < netclass->GetViaMinDiameter() )
{
- m_currentMarker = fillMarker( aRefSeg, NULL,
+ m_currentMarker = fillMarker( refvia, NULL,
DRCE_TOO_SMALL_VIA, m_currentMarker );
return false;
}
@@ -192,9 +193,9 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// test if via's hole is bigger than its diameter
// This test is necessary since the via hole size and width can be modified
// and a default via hole can be bigger than some vias sizes
- if( aRefSeg->GetDrillValue() > aRefSeg->GetWidth() )
+ if( refvia->GetDrillValue() > refvia->GetWidth() )
{
- m_currentMarker = fillMarker( aRefSeg, NULL,
+ m_currentMarker = fillMarker( refvia, NULL,
DRCE_VIA_HOLE_BIGGER, m_currentMarker );
return false;
}
@@ -202,12 +203,12 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// For microvias: test if they are blind vias and only between 2 layers
// because they are used for very small drill size and are drill by laser
// and **only one layer** can be drilled
- if( aRefSeg->GetShape() == VIA_MICROVIA )
+ if( refvia->GetViaType() == VIA_MICROVIA )
{
LAYER_NUM layer1, layer2;
bool err = true;
- ( (SEGVIA*) aRefSeg )->LayerPair( &layer1, &layer2 );
+ refvia->LayerPair( &layer1, &layer2 );
if( layer1 > layer2 )
EXCHG( layer1, layer2 );
@@ -222,7 +223,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
if( err )
{
- m_currentMarker = fillMarker( aRefSeg, NULL,
+ m_currentMarker = fillMarker( refvia, NULL,
DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR, m_currentMarker );
return false;
}
diff --git a/pcbnew/drc_marker_functions.cpp b/pcbnew/drc_marker_functions.cpp
index 817d7e17d9..9a5002521d 100644
--- a/pcbnew/drc_marker_functions.cpp
+++ b/pcbnew/drc_marker_functions.cpp
@@ -44,7 +44,8 @@
#include
-MARKER_PCB* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKER_PCB* fillMe )
+MARKER_PCB* DRC::fillMarker( const TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode,
+ MARKER_PCB* fillMe )
{
wxString textA = aTrack->GetSelectMenuText();
wxString textB;
@@ -62,7 +63,7 @@ MARKER_PCB* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, M
}
else if( aItem->Type() == PCB_VIA_T )
{
- posB = position = ((SEGVIA*)aItem)->GetPosition();
+ posB = position = ((VIA*)aItem)->GetPosition();
}
else if( aItem->Type() == PCB_TRACE_T )
{
diff --git a/pcbnew/drc_stuff.h b/pcbnew/drc_stuff.h
index f2daee5b95..927e94936a 100644
--- a/pcbnew/drc_stuff.h
+++ b/pcbnew/drc_stuff.h
@@ -212,14 +212,14 @@ private:
* DRC problem, or unconnected pad problem.
*
* @param aTrack The reference track.
- * @param aItem Another item on the BOARD, such as a SEGVIA, SEGZONE,
+ * @param aItem Another item on the BOARD, such as a VIA, SEGZONE,
* or TRACK.
* @param aErrorCode A categorizing identifier for the particular type
* of error that is being reported.
* @param fillMe A MARKER_PCB* which is to be filled in, or NULL if one is to
* first be allocated, then filled.
*/
- MARKER_PCB* fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKER_PCB* fillMe );
+ MARKER_PCB* fillMarker( const TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKER_PCB* fillMe );
MARKER_PCB* fillMarker( D_PAD* aPad, D_PAD* bPad, int aErrorCode, MARKER_PCB* fillMe );
diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp
index f8e31fddec..a78007761b 100644
--- a/pcbnew/eagle_plugin.cpp
+++ b/pcbnew/eagle_plugin.cpp
@@ -2410,9 +2410,9 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
if( IsCopperLayer( layer_front_most ) &&
IsCopperLayer( layer_back_most ) )
{
- int kidiam;
- int drillz = kicad( v.drill );
- SEGVIA* via = new SEGVIA( m_board );
+ int kidiam;
+ int drillz = kicad( v.drill );
+ VIA* via = new VIA( m_board );
m_board->m_Track.Insert( via, NULL );
via->SetLayerPair( layer_front_most, layer_back_most );
@@ -2439,11 +2439,11 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
m_min_via_hole = drillz;
if( layer_front_most == LAYER_N_FRONT && layer_back_most == LAYER_N_BACK )
- via->SetShape( VIA_THROUGH );
+ via->SetViaType( VIA_THROUGH );
else if( layer_front_most == LAYER_N_FRONT || layer_back_most == LAYER_N_BACK )
- via->SetShape( VIA_MICROVIA );
+ via->SetViaType( VIA_MICROVIA );
else
- via->SetShape( VIA_BLIND_BURIED );
+ via->SetViaType( VIA_BLIND_BURIED );
via->SetTimeStamp( timeStamp( it->second ) );
@@ -2453,8 +2453,6 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
via->SetEnd( pos );
via->SetNetCode( netCode );
-
- via->SetShape( S_CIRCLE ); // @todo should be in SEGVIA constructor
}
m_xpath->pop();
}
diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp
index 92b267c856..98a3ec4fee 100644
--- a/pcbnew/edit.cpp
+++ b/pcbnew/edit.cpp
@@ -394,14 +394,23 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
else
{
- int v_type = GetDesignSettings().m_CurrentViaType;
- if( id == ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA ||
- id == ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA )
- GetDesignSettings().m_CurrentViaType = VIA_BLIND_BURIED;
- else if( id == ID_POPUP_PCB_PLACE_MICROVIA )
- GetDesignSettings().m_CurrentViaType = VIA_MICROVIA;
- else
- GetDesignSettings().m_CurrentViaType = VIA_THROUGH;
+ BOARD_DESIGN_SETTINGS &settings = GetDesignSettings();
+ VIATYPE_T v_type = settings.m_CurrentViaType;
+ switch( id )
+ {
+ case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
+ case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA:
+ settings.m_CurrentViaType = VIA_BLIND_BURIED;
+ break;
+
+ case ID_POPUP_PCB_PLACE_MICROVIA:
+ settings.m_CurrentViaType = VIA_MICROVIA;
+ break;
+
+ default:
+ settings.m_CurrentViaType = VIA_THROUGH;
+ break;
+ }
// place via and switch layer.
if( id == ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA ||
@@ -426,7 +435,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
else
Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
- GetDesignSettings().m_CurrentViaType = v_type;
+ settings.m_CurrentViaType = v_type;
if( DisplayOpt.ContrastModeDisplay )
m_canvas->Refresh();
diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp
index 4c2d5e8327..c371ee0978 100644
--- a/pcbnew/edit_track_width.cpp
+++ b/pcbnew/edit_track_width.cpp
@@ -47,8 +47,10 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
if( aTrackItem->Type() == PCB_VIA_T )
{
- if( !aTrackItem->IsDrillDefault() )
- initial_drill = aTrackItem->GetDrillValue();
+ const VIA *via = static_cast( aTrackItem );
+
+ if( !via->IsDrillDefault() )
+ initial_drill = via->GetDrillValue();
if( net )
{
@@ -60,7 +62,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
new_drill = GetBoard()->GetCurrentViaDrill();
}
- if( aTrackItem->GetShape() == VIA_MICROVIA )
+ if( via->GetViaType() == VIA_MICROVIA )
{
if( net )
new_width = net->GetMicroViaSize();
@@ -107,10 +109,11 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
if( aTrackItem->Type() == PCB_VIA_T )
{
// Set new drill value. Note: currently microvias have only a default drill value
+ VIA *via = static_cast( aTrackItem );
if( new_drill > 0 )
- aTrackItem->SetDrill( new_drill );
+ via->SetDrill( new_drill );
else
- aTrackItem->SetDrillDefault();
+ via->SetDrillDefault();
}
}
}
diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp
index e394ad1ca3..bedbcac572 100644
--- a/pcbnew/editrack-part2.cpp
+++ b/pcbnew/editrack-part2.cpp
@@ -95,9 +95,9 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
// create the via
- SEGVIA* via = new SEGVIA( GetBoard() );
+ VIA* via = new VIA( GetBoard() );
via->SetFlags( IS_NEW );
- via->SetShape( GetDesignSettings().m_CurrentViaType );
+ via->SetViaType( GetDesignSettings().m_CurrentViaType );
via->SetWidth( GetBoard()->GetCurrentViaSize());
via->SetNetCode( GetBoard()->GetHighLightNetCode() );
via->SetEnd( g_CurrentTrackSegment->GetEnd() );
@@ -118,7 +118,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
last_layer = GetScreen()->m_Route_Layer_BOTTOM;
// Adjust the actual via layer pair
- switch ( via->GetShape() )
+ switch ( via->GetViaType() )
{
case VIA_BLIND_BURIED:
via->SetLayerPair( first_layer, last_layer );
diff --git a/pcbnew/exporters/export_d356.cpp b/pcbnew/exporters/export_d356.cpp
index 865986acc9..f75dfbdeba 100644
--- a/pcbnew/exporters/export_d356.cpp
+++ b/pcbnew/exporters/export_d356.cpp
@@ -198,23 +198,23 @@ static void build_via_testpoints( BOARD *aPcb,
{
if( track->Type() == PCB_VIA_T )
{
- SEGVIA *via = (SEGVIA*) track;
- NETINFO_ITEM *net = track->GetNet();
+ VIA *via = (VIA*) track;
+ NETINFO_ITEM *net = track->GetNet();
D356_RECORD rk;
- rk.smd = false;
+ rk.smd = false;
rk.hole = true;
- if( net )
- rk.netname = net->GetNetname();
- else
- rk.netname = wxEmptyString;
+ if( net )
+ rk.netname = net->GetNetname();
+ else
+ rk.netname = wxEmptyString;
rk.refdes = wxT("VIA");
rk.pin = wxT("");
rk.midpoint = true; // Vias are always midpoints
rk.drill = via->GetDrillValue();
rk.mechanical = false;
LAYER_NUM top_layer, bottom_layer;
- via->LayerPair( &top_layer, &bottom_layer );
+ via->LayerPair( &top_layer, &bottom_layer );
rk.access = via_access_code( aPcb, top_layer, bottom_layer );
rk.x_location = via->GetPosition().x - origin.x;
rk.y_location = origin.y - via->GetPosition().y;
diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp
index 8ef7e19214..601c91ae6d 100644
--- a/pcbnew/exporters/export_gencad.cpp
+++ b/pcbnew/exporters/export_gencad.cpp
@@ -222,8 +222,8 @@ static int PadListSortByShape( const void* aRefptr, const void* aObjptr )
// Sort vias for uniqueness
static int ViaSort( const void* aRefptr, const void* aObjptr )
{
- TRACK* padref = *(TRACK**) aRefptr;
- TRACK* padcmp = *(TRACK**) aObjptr;
+ VIA* padref = *(VIA**) aRefptr;
+ VIA* padcmp = *(VIA**) aObjptr;
if( padref->GetWidth() != padcmp->GetWidth() )
return padref->GetWidth() - padcmp->GetWidth();
@@ -253,8 +253,8 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
{
std::vector pads;
std::vector padstacks;
- std::vector