2011-09-14 20:04:58 +00:00
|
|
|
/**
|
|
|
|
* @file class_track.h
|
|
|
|
* @brief Definitions for tracks, vias and zones.
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#ifndef CLASS_TRACK_H
|
|
|
|
#define CLASS_TRACK_H
|
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
|
|
|
|
#include "class_board_item.h"
|
2011-12-07 15:49:32 +00:00
|
|
|
#include "class_board_connected_item.h"
|
2009-11-16 13:57:25 +00:00
|
|
|
#include "PolyLine.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
class TRACK;
|
2011-11-30 11:45:49 +00:00
|
|
|
class D_PAD;
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2011-07-14 15:42:44 +00:00
|
|
|
// Via attributes (m_Shape parameter)
|
2008-01-12 20:31:56 +00:00
|
|
|
#define VIA_THROUGH 3 /* Always a through hole via */
|
|
|
|
#define VIA_BLIND_BURIED 2 /* this via can be on internal layers */
|
2011-08-01 15:29:27 +00:00
|
|
|
#define VIA_MICROVIA 1 /* this via which connect from an external layer
|
|
|
|
* to the near neighbor internal layer */
|
2008-01-12 20:31:56 +00:00
|
|
|
#define VIA_NOT_DEFINED 0 /* not yet used */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-09-16 14:13:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetTrace
|
|
|
|
* 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.
|
|
|
|
* <p>
|
|
|
|
* The segments of track that are flagged as deleted or busy are ignored. Layer
|
|
|
|
* visibility is also ignored.
|
|
|
|
* </p>
|
|
|
|
* @param aStartTrace A pointer to the TRACK object to begin searching.
|
|
|
|
* @param aEndTrace A pointer to the TRACK object to stop the search. A NULL value
|
|
|
|
* searches to the end of the list.
|
|
|
|
* @param aPosition A wxPoint object containing the position to test.
|
|
|
|
* @param aLayerMask A layer or layers to mask the hit test. Use -1 to ignore
|
|
|
|
* layer mask.
|
|
|
|
* @return A TRACK object pointer if found otherwise NULL.
|
|
|
|
*/
|
|
|
|
extern TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition,
|
|
|
|
int aLayerMask );
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-18 18:13:55 +00:00
|
|
|
class TRACK : public BOARD_CONNECTED_ITEM
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
// make SetNext() and SetBack() private so that they may not be called from anywhere.
|
|
|
|
// list management is done on TRACKs using DLIST<TRACK> only.
|
|
|
|
private:
|
2010-12-08 20:12:46 +00:00
|
|
|
void SetNext( EDA_ITEM* aNext ) { Pnext = aNext; }
|
|
|
|
void SetBack( EDA_ITEM* aBack ) { Pback = aBack; }
|
2008-12-04 04:28:11 +00:00
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
public:
|
2008-12-14 19:45:05 +00:00
|
|
|
int m_Width; // Thickness of track, or via diameter
|
2007-10-16 19:05:33 +00:00
|
|
|
wxPoint m_Start; // Line start point
|
|
|
|
wxPoint m_End; // Line end point
|
|
|
|
int m_Shape; // vias: shape and type, Track = shape..
|
|
|
|
|
2008-01-12 20:31:56 +00:00
|
|
|
protected:
|
2008-02-09 08:34:45 +00:00
|
|
|
int m_Drill; // for vias: via drill (- 1 for default value)
|
2008-01-12 20:31:56 +00:00
|
|
|
|
|
|
|
public:
|
2011-11-03 19:07:59 +00:00
|
|
|
BOARD_CONNECTED_ITEM* start; // pointers to a connected item (pad or track)
|
|
|
|
BOARD_CONNECTED_ITEM* end;
|
2007-10-16 19:05:33 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
double m_Param; // Auxiliary variable ( used in some computations )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
protected:
|
2007-09-15 04:25:54 +00:00
|
|
|
TRACK( const TRACK& track ); // protected so Copy() is used instead.
|
2007-10-16 19:05:33 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
public:
|
2011-10-01 19:24:27 +00:00
|
|
|
TRACK( BOARD_ITEM* aParent, KICAD_T idtype = PCB_TRACE_T );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Copy
|
|
|
|
* will copy this object whether it is a TRACK or a SEGVIA returning
|
|
|
|
* the corresponding type.
|
2011-09-14 20:04:58 +00:00
|
|
|
* Because of the way SEGVIA and SEGZONE are derived from TRACK and because there are
|
|
|
|
* virtual functions being used, we can no longer simply copy a TRACK and
|
|
|
|
* expect it to be a via or zone. We must construct a true SEGVIA or SEGZONE so its
|
|
|
|
* constructor can initialize the virtual function table properly. This factory type
|
|
|
|
* of function called Copy() can duplicate either a TRACK, SEGVIA, or SEGZONE.
|
|
|
|
*
|
2007-10-16 19:05:33 +00:00
|
|
|
* @return - TRACK*, SEGVIA*, or SEGZONE*, declared as the least common
|
2011-09-14 20:04:58 +00:00
|
|
|
* denominator: TRACK
|
2007-09-01 12:00:30 +00:00
|
|
|
*/
|
2007-10-16 19:05:33 +00:00
|
|
|
TRACK* Copy() const;
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
TRACK* Next() const { return (TRACK*) Pnext; }
|
|
|
|
TRACK* Back() const { return (TRACK*) Pback; }
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
/**
|
|
|
|
* Function Move
|
|
|
|
* move this object.
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aMoveVector - the move vector for this object.
|
2009-08-01 19:26:05 +00:00
|
|
|
*/
|
2011-08-01 15:29:27 +00:00
|
|
|
virtual void Move( const wxPoint& aMoveVector )
|
2009-08-01 19:26:05 +00:00
|
|
|
{
|
|
|
|
m_Start += aMoveVector;
|
2011-12-01 22:50:41 +00:00
|
|
|
m_End += aMoveVector;
|
2009-08-01 19:26:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Rotate
|
|
|
|
* Rotate this object.
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aRotCentre - the rotation point.
|
2009-08-01 19:26:05 +00:00
|
|
|
* @param aAngle - the rotation angle in 0.1 degree.
|
|
|
|
*/
|
2011-12-14 04:29:25 +00:00
|
|
|
virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
|
2009-08-01 19:26:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Flip
|
|
|
|
* Flip this object, i.e. change the board side for this object
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aCentre - the rotation point.
|
2009-08-01 19:26:05 +00:00
|
|
|
*/
|
2011-08-01 15:29:27 +00:00
|
|
|
virtual void Flip( const wxPoint& aCentre );
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
void SetPosition( const wxPoint& aPos ) { m_Start = aPos; } // overload
|
|
|
|
const wxPoint GetPosition() const { return m_Start; } // overload
|
2011-11-29 17:25:30 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
void SetWidth( int aWidth ) { m_Width = aWidth; }
|
|
|
|
int GetWidth() const { return m_Width; }
|
2011-11-30 07:43:46 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
void SetEnd( const wxPoint& aEnd ) { m_End = aEnd; }
|
|
|
|
const wxPoint& GetEnd() const { return m_End; }
|
2011-11-29 17:25:30 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
void SetStart( const wxPoint& aStart ) { m_Start = aStart; }
|
|
|
|
const wxPoint& GetStart() const { return m_Start; }
|
2011-11-30 07:43:46 +00:00
|
|
|
|
2011-03-29 19:33:07 +00:00
|
|
|
EDA_RECT GetBoundingBox() const;
|
2008-03-05 22:39:33 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
2007-10-31 14:14:21 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
2007-10-30 21:30:58 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
2008-01-12 20:31:56 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2008-01-12 20:31:56 +00:00
|
|
|
|
2007-10-31 06:40:15 +00:00
|
|
|
/**
|
|
|
|
* Function GetBestInsertPoint
|
|
|
|
* searches the "best" insertion point within the track linked list.
|
2007-11-02 18:21:43 +00:00
|
|
|
* The best point is the begging of the corresponding net code section.
|
|
|
|
* (The BOARD::m_Track and BOARD::m_Zone lists are sorted by netcode.)
|
2008-01-12 20:31:56 +00:00
|
|
|
* @param aPcb The BOARD to search for the insertion point.
|
2007-10-31 06:40:15 +00:00
|
|
|
* @return TRACK* - the item found in the linked list (or NULL if no track)
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
TRACK* GetBestInsertPoint( BOARD* aPcb );
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-10-19 06:31:17 +00:00
|
|
|
/* Search (within the track linked list) the first segment matching the netcode
|
|
|
|
* ( the linked list is always sorted by net codes )
|
2007-10-16 19:05:33 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
TRACK* GetStartNetCode( int NetCode );
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-10-19 06:31:17 +00:00
|
|
|
/* Search (within the track linked list) the last segment matching the netcode
|
|
|
|
* ( the linked list is always sorted by net codes )
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
TRACK* GetEndNetCode( int NetCode );
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-10-13 06:18:44 +00:00
|
|
|
/**
|
|
|
|
* Function GetLength
|
|
|
|
* returns the length of the track using the hypotenuse calculation.
|
|
|
|
* @return double - the length of the track
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
double GetLength() const
|
2007-12-01 03:42:52 +00:00
|
|
|
{
|
2011-12-14 04:29:25 +00:00
|
|
|
double dx = m_Start.x - m_End.x;
|
|
|
|
double dy = m_Start.y - m_End.y;
|
2008-01-12 20:31:56 +00:00
|
|
|
|
2007-12-01 03:42:52 +00:00
|
|
|
return hypot( dx, dy );
|
|
|
|
}
|
2007-10-16 19:05:33 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
/* Display on screen: */
|
2011-09-14 20:04:58 +00:00
|
|
|
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode,
|
|
|
|
const wxPoint& aOffset = ZeroOffset );
|
2007-08-08 20:51:08 +00:00
|
|
|
|
|
|
|
/* divers */
|
2011-12-14 04:29:25 +00:00
|
|
|
int GetShape() const { return m_Shape & 0xFF; }
|
2011-11-30 07:43:46 +00:00
|
|
|
void SetShape( int aShape ) { m_Shape = aShape; }
|
2008-02-09 08:34:45 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function TransformShapeWithClearanceToPolygon
|
2009-11-14 19:47:52 +00:00
|
|
|
* Convert the track shape to a closed polygon
|
|
|
|
* Used in filling zones calculations
|
|
|
|
* Circles (vias) and arcs (ends of tracks) are approximated by segments
|
|
|
|
* @param aCornerBuffer = a buffer to store the polygon
|
|
|
|
* @param aClearanceValue = the clearance around the pad
|
|
|
|
* @param aCircleToSegmentsCount = the number of segments to approximate a circle
|
|
|
|
* @param aCorrectionFactor = the correction to apply to circles radius to keep
|
2011-07-14 15:42:44 +00:00
|
|
|
* clearance when the circle is approximated by segment bigger or equal
|
2009-11-14 19:47:52 +00:00
|
|
|
* to the real clearance value (usually near from 1.0)
|
|
|
|
*/
|
2009-11-16 08:13:40 +00:00
|
|
|
void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
2009-11-14 19:47:52 +00:00
|
|
|
int aClearanceValue,
|
|
|
|
int aCircleToSegmentsCount,
|
|
|
|
double aCorrectionFactor );
|
2008-02-09 08:34:45 +00:00
|
|
|
/**
|
2008-01-12 20:31:56 +00:00
|
|
|
* Function SetDrillValue
|
2008-02-09 08:34:45 +00:00
|
|
|
* Set the drill value for vias
|
|
|
|
* @param drill_value = new drill value
|
|
|
|
*/
|
2011-12-14 04:29:25 +00:00
|
|
|
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;
|
2008-01-12 20:31:56 +00:00
|
|
|
|
2008-02-09 08:34:45 +00:00
|
|
|
/**
|
2008-01-12 20:31:56 +00:00
|
|
|
* Function SetDrillDefault
|
2008-02-09 08:34:45 +00:00
|
|
|
* Set the drill value for vias at default value (-1)
|
|
|
|
*/
|
2011-12-14 04:29:25 +00:00
|
|
|
void SetDrillDefault() { m_Drill = -1; }
|
2008-02-09 08:34:45 +00:00
|
|
|
|
|
|
|
/**
|
2008-01-12 20:31:56 +00:00
|
|
|
* Function IsDrillDefault
|
2008-02-09 08:34:45 +00:00
|
|
|
* @return true if the drill value is default value (-1)
|
|
|
|
*/
|
2011-12-14 04:29:25 +00:00
|
|
|
bool IsDrillDefault() { return m_Drill <= 0; }
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-10-01 13:51:07 +00:00
|
|
|
/**
|
|
|
|
* Function ReturnMaskLayer
|
2007-10-16 19:05:33 +00:00
|
|
|
* returns a "layer mask", which is a bitmap of all layers on which the
|
2007-10-01 13:51:07 +00:00
|
|
|
* TRACK segment or SEGVIA physically resides.
|
2009-12-21 13:05:11 +00:00
|
|
|
* @return int - a layer mask, see pcbstruct.h's LAYER_BACK, etc.
|
2007-10-01 13:51:07 +00:00
|
|
|
*/
|
2011-10-31 13:44:13 +00:00
|
|
|
int ReturnMaskLayer() const;
|
2007-10-16 19:05:33 +00:00
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
/**
|
|
|
|
* Function IsPointOnEnds
|
|
|
|
* returns STARTPOINT if point if near (dist = min_dist) start point, ENDPOINT if
|
|
|
|
* point if near (dist = min_dist) end point,STARTPOINT|ENDPOINT if point if near
|
|
|
|
* (dist = min_dist) both ends, or 0 if none of the above.
|
|
|
|
* if min_dist < 0: min_dist = track_width/2
|
|
|
|
*/
|
|
|
|
int IsPointOnEnds( const wxPoint& point, int min_dist = 0 );
|
2007-10-16 19:05:33 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
/**
|
|
|
|
* Function IsNull
|
|
|
|
* returns true if segment length is zero.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
bool IsNull();
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-08-20 19:33:15 +00:00
|
|
|
/**
|
2009-04-17 08:51:02 +00:00
|
|
|
* Function DisplayInfo
|
2007-08-20 19:33:15 +00:00
|
|
|
* has knowledge about the frame and how and where to put status information
|
|
|
|
* about this object into the frame's message panel.
|
2010-12-08 20:12:46 +00:00
|
|
|
* Is virtual from EDA_ITEM.
|
2009-10-14 18:14:58 +00:00
|
|
|
* Display info about the track segment and the full track length
|
2011-01-21 19:30:59 +00:00
|
|
|
* @param frame A EDA_DRAW_FRAME in which to print status information.
|
2007-10-16 19:05:33 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void DisplayInfo( EDA_DRAW_FRAME* frame );
|
2007-10-16 19:05:33 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
/**
|
|
|
|
* Function DisplayInfoBase
|
|
|
|
* has knowledge about the frame and how and where to put status information
|
|
|
|
* about this object into the frame's message panel.
|
|
|
|
* Display info about the track segment only, and does not calculate the full track length
|
2011-01-21 19:30:59 +00:00
|
|
|
* @param frame A EDA_DRAW_FRAME in which to print status information.
|
2009-10-14 18:14:58 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void DisplayInfoBase( EDA_DRAW_FRAME* frame );
|
2007-08-20 19:33:15 +00:00
|
|
|
|
2007-10-11 00:11:59 +00:00
|
|
|
/**
|
|
|
|
* Function ShowWidth
|
|
|
|
* returns the width of the track in displayable user units.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
wxString ShowWidth() const;
|
2007-10-16 19:05:33 +00:00
|
|
|
|
2007-08-30 22:20:52 +00:00
|
|
|
/**
|
|
|
|
* Function Visit
|
|
|
|
* is re-implemented here because TRACKs and SEGVIAs are in the same list
|
|
|
|
* within BOARD. If that were not true, then we could inherit the
|
2010-12-08 20:12:46 +00:00
|
|
|
* version from EDA_ITEM. This one does not iterate through scanTypes
|
2007-10-16 19:05:33 +00:00
|
|
|
* but only looks at the first item in the list.
|
2007-08-30 22:20:52 +00:00
|
|
|
* @param inspector An INSPECTOR instance to use in the inspection.
|
|
|
|
* @param testData Arbitrary data used by the inspector.
|
2007-10-16 19:05:33 +00:00
|
|
|
* @param scanTypes Which KICAD_T types are of interest and the order
|
2007-08-30 22:20:52 +00:00
|
|
|
* is significant too, terminated by EOT.
|
|
|
|
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
|
|
|
|
* else SCAN_CONTINUE, and determined by the inspector.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
|
|
|
|
const KICAD_T scanTypes[] );
|
2007-10-16 19:05:33 +00:00
|
|
|
|
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
/**
|
|
|
|
* Function HitTest
|
|
|
|
* tests if the given wxPoint is within the bounds of this object.
|
|
|
|
* @param refPos A wxPoint to test
|
|
|
|
* @return bool - true if a hit, else false
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
bool HitTest( const wxPoint& refPos );
|
2007-08-08 20:51:08 +00:00
|
|
|
|
|
|
|
/**
|
2010-12-29 17:47:32 +00:00
|
|
|
* Function HitTest (overlaid)
|
2008-01-06 12:43:57 +00:00
|
|
|
* tests if the given wxRect intersect this object.
|
2008-01-12 20:31:56 +00:00
|
|
|
* For now, an ending point must be inside this rect.
|
2011-03-29 19:33:07 +00:00
|
|
|
* @param refArea an EDA_RECT to test
|
2008-01-06 12:43:57 +00:00
|
|
|
* @return bool - true if a hit, else false
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
bool HitTest( EDA_RECT& refArea );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetVia
|
|
|
|
* finds the first SEGVIA object at \a aPosition on \a aLayer starting at the trace.
|
|
|
|
*
|
|
|
|
* @param aPosition The wxPoint to HitTest() against.
|
|
|
|
* @param aLayerMask The layer to match, pass -1 for a don't care.
|
|
|
|
* @return A pointer to a SEGVIA object if found, else NULL.
|
|
|
|
*/
|
|
|
|
TRACK* GetVia( const wxPoint& aPosition, int aLayerMask = -1 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetVia
|
|
|
|
* finds the first SEGVIA 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.
|
|
|
|
*/
|
|
|
|
TRACK* GetVia( TRACK* aEndTrace, const wxPoint& aPosition, int aLayerMask );
|
2008-01-06 12:43:57 +00:00
|
|
|
|
2011-09-16 14:13:02 +00:00
|
|
|
/**
|
|
|
|
* Function GetTrace
|
|
|
|
* return the trace segment connected to the segment at \a aEndPoint from \a
|
|
|
|
* aStartTrace to \a aEndTrace.
|
|
|
|
*
|
|
|
|
* @param aStartTrace A pointer to the TRACK object to begin searching.
|
|
|
|
* @param aEndTrace A pointer to the TRACK object to stop the search. A NULL value
|
|
|
|
* searches to the end of the list.
|
|
|
|
* @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 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetEndSegments
|
|
|
|
* get the segments connected to the end point of the track.
|
|
|
|
* return 1 if OK, 0 when a track is a closed loop
|
|
|
|
* and the beginning and the end of the track in *StartTrack and *EndTrack
|
|
|
|
* Modify *StartTrack en *EndTrack :
|
|
|
|
* (*StartTrack)->m_Start coordinate is the beginning of the track
|
|
|
|
* (*EndTrack)->m_End coordinate is the end of the track
|
|
|
|
* Segments connected must be consecutive in list
|
|
|
|
*/
|
|
|
|
int GetEndSegments( int NbSegm, TRACK** StartTrack, TRACK** EndTrack );
|
|
|
|
|
2008-01-12 20:31:56 +00:00
|
|
|
/**
|
2007-08-08 20:51:08 +00:00
|
|
|
* Function GetClass
|
|
|
|
* returns the class name.
|
|
|
|
* @return wxString
|
|
|
|
*/
|
|
|
|
wxString GetClass() const
|
|
|
|
{
|
2007-10-16 19:05:33 +00:00
|
|
|
return wxT( "TRACK" );
|
2007-08-08 20:51:08 +00:00
|
|
|
}
|
2007-10-16 19:05:33 +00:00
|
|
|
|
2010-04-08 11:33:43 +00:00
|
|
|
/**
|
|
|
|
* Function GetClearance
|
|
|
|
* returns the clearance in internal units. If \a aItem is not NULL then the
|
|
|
|
* returned clearance is the greater of this object's clearance and
|
|
|
|
* aItem's clearance. If \a aItem is NULL, then this objects clearance
|
|
|
|
* is returned.
|
|
|
|
* @param aItem is another BOARD_CONNECTED_ITEM or NULL
|
|
|
|
* @return int - the clearance in internal units.
|
|
|
|
*/
|
|
|
|
virtual int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const;
|
|
|
|
|
2011-07-14 15:42:44 +00:00
|
|
|
virtual wxString GetSelectMenuText() const;
|
2007-10-16 19:05:33 +00:00
|
|
|
|
2011-08-29 03:04:59 +00:00
|
|
|
virtual BITMAP_DEF GetMenuImage() const { return showtrack_xpm; }
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
#if defined (DEBUG)
|
|
|
|
|
2011-12-14 17:25:42 +00:00
|
|
|
void Show( int nestLevel, std::ostream& os ) const; // overload
|
2008-12-04 04:28:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ShowState
|
|
|
|
* converts a set of state bits to a wxString
|
|
|
|
* @param stateBits Is an OR-ed together set of bits like BUSY, EDIT, etc.
|
|
|
|
*/
|
|
|
|
static wxString ShowState( int stateBits );
|
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
#endif
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
class SEGZONE : public TRACK
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-12-04 04:28:11 +00:00
|
|
|
SEGZONE( BOARD_ITEM* aParent );
|
2007-10-16 19:05:33 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
/**
|
|
|
|
* Function GetClass
|
|
|
|
* returns the class name.
|
|
|
|
* @return wxString
|
|
|
|
*/
|
|
|
|
wxString GetClass() const
|
|
|
|
{
|
2007-10-16 19:05:33 +00:00
|
|
|
return wxT( "ZONE" );
|
2007-08-08 20:51:08 +00:00
|
|
|
}
|
2007-09-13 11:28:58 +00:00
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
|
|
|
|
SEGZONE* Next() const { return (SEGZONE*) Pnext; }
|
2011-07-14 15:42:44 +00:00
|
|
|
|
|
|
|
virtual wxString GetSelectMenuText() const;
|
|
|
|
|
2011-08-29 03:04:59 +00:00
|
|
|
virtual BITMAP_DEF GetMenuImage() const { return add_zone_xpm; }
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
class SEGVIA : public TRACK
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-12-04 04:28:11 +00:00
|
|
|
SEGVIA( BOARD_ITEM* aParent );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
|
|
|
SEGVIA( const SEGVIA& source ) :
|
|
|
|
TRACK( source )
|
|
|
|
{
|
|
|
|
}
|
2007-10-16 19:05:33 +00:00
|
|
|
|
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode,
|
|
|
|
const wxPoint& aOffset = ZeroOffset );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-08-30 22:20:52 +00:00
|
|
|
/**
|
|
|
|
* Function IsOnLayer
|
2007-10-16 19:05:33 +00:00
|
|
|
* tests to see if this object is on the given layer. Is virtual
|
2010-12-29 17:47:32 +00:00
|
|
|
* from BOARD_ITEM. Tests the starting and ending range of layers for the via.
|
|
|
|
* @param aLayer the layer to test for.
|
2007-08-30 22:20:52 +00:00
|
|
|
* @return bool - true if on given layer, else false.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
bool IsOnLayer( int aLayer ) const;
|
2007-10-16 19:05:33 +00:00
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
/**
|
|
|
|
* Function SetLayerPair
|
|
|
|
* set the .m_Layer member param:
|
|
|
|
* For a via m_Layer contains the 2 layers :
|
|
|
|
* top layer and bottom layer used by the via.
|
|
|
|
* The via connect all layers from top layer to bottom layer
|
|
|
|
* 4 bits for the first layer and 4 next bits for the secaon layer
|
|
|
|
* @param top_layer = first layer connected by the via
|
|
|
|
* @param bottom_layer = last layer connected by the via
|
|
|
|
*/
|
|
|
|
void SetLayerPair( int top_layer, int bottom_layer );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ReturnLayerPair
|
|
|
|
* Return the 2 layers used by the via (the via actually uses
|
|
|
|
* all layers between these 2 layers)
|
|
|
|
* @param top_layer = pointer to the first layer (can be null)
|
|
|
|
* @param bottom_layer = pointer to the last layer (can be null)
|
|
|
|
*/
|
|
|
|
void ReturnLayerPair( int* top_layer, int* bottom_layer ) const;
|
2007-10-16 19:05:33 +00:00
|
|
|
|
2011-11-29 17:25:30 +00:00
|
|
|
const wxPoint GetPosition() const // overload
|
2008-01-12 20:31:56 +00:00
|
|
|
{
|
|
|
|
return m_Start;
|
2007-12-01 03:42:52 +00:00
|
|
|
}
|
2008-01-12 20:31:56 +00:00
|
|
|
|
2011-11-29 17:25:30 +00:00
|
|
|
void SetPosition( const wxPoint& aPoint ) { m_Start = aPoint; m_End = aPoint; } // overload
|
2008-01-12 20:31:56 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
/**
|
|
|
|
* Function GetClass
|
|
|
|
* returns the class name.
|
|
|
|
* @return wxString
|
|
|
|
*/
|
|
|
|
wxString GetClass() const
|
|
|
|
{
|
2007-10-16 19:05:33 +00:00
|
|
|
return wxT( "VIA" );
|
2007-08-08 20:51:08 +00:00
|
|
|
}
|
2007-10-01 04:14:29 +00:00
|
|
|
|
2011-07-14 15:42:44 +00:00
|
|
|
virtual wxString GetSelectMenuText() const;
|
|
|
|
|
2011-08-29 03:04:59 +00:00
|
|
|
virtual BITMAP_DEF GetMenuImage() const { return via_sketch_xpm; }
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
#if defined (DEBUG)
|
2011-12-14 17:25:42 +00:00
|
|
|
void Show( int nestLevel, std::ostream& os ) const; // overload
|
2007-10-16 19:05:33 +00:00
|
|
|
#endif
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* CLASS_TRACK_H */
|