2009-01-02 17:07:50 +00:00
|
|
|
/************************************************************************/
|
|
|
|
/* classes to handle items used in schematic: wires, bus, junctions ... */
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
#ifndef CLASS_SCHEMATIC_ITEMS_H
|
|
|
|
#define CLASS_SCHEMATIC_ITEMS_H
|
|
|
|
|
2009-07-01 17:32:16 +00:00
|
|
|
#define DRAWJUNCTION_DIAMETER 32 /* Size (diameter) of junctions between wires */
|
2009-01-02 17:07:50 +00:00
|
|
|
#define DRAWNOCONNECT_SIZE 48 /* Rayon du symbole No Connexion */
|
|
|
|
|
|
|
|
/* flags pour BUS ENTRY (bus to bus ou wire to bus */
|
|
|
|
#define WIRE_TO_BUS 0
|
|
|
|
#define BUS_TO_BUS 1
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class EDA_DrawLineStruct
|
|
|
|
* is a segment decription base class to describe items which have 2 end
|
|
|
|
* points (track, wire, draw line ...)
|
|
|
|
*/
|
|
|
|
class EDA_DrawLineStruct : public SCH_ITEM
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int m_Width; // 0 = line, > 0 = tracks, bus ...
|
|
|
|
wxPoint m_Start; // Line start point
|
|
|
|
wxPoint m_End; // Line end point
|
|
|
|
|
|
|
|
bool m_StartIsDangling;
|
2009-04-05 20:49:15 +00:00
|
|
|
bool m_EndIsDangling; // TRUE si Start ou End not connected (wires, tracks...)
|
2009-01-02 17:07:50 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
EDA_DrawLineStruct( const wxPoint& pos, int layer );
|
|
|
|
~EDA_DrawLineStruct() { }
|
|
|
|
|
|
|
|
EDA_DrawLineStruct* Next() const { return (EDA_DrawLineStruct*) Pnext; }
|
|
|
|
EDA_DrawLineStruct* Back() const { return (EDA_DrawLineStruct*) Pback; }
|
|
|
|
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "EDA_DrawLine" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool IsOneEndPointAt( const wxPoint& pos );
|
|
|
|
EDA_DrawLineStruct* GenCopy();
|
|
|
|
|
|
|
|
bool IsNull()
|
|
|
|
{
|
|
|
|
return m_Start == m_End;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EDA_Rect GetBoundingBox();
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
|
|
|
int draw_mode, int Color = -1 );
|
2009-01-02 17:07:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Save
|
2009-04-05 20:49:15 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.brd"
|
|
|
|
* format.
|
2009-01-02 17:07:50 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
|
|
|
bool Save( FILE* aFile ) const;
|
|
|
|
|
2009-06-30 19:21:41 +00:00
|
|
|
/** Function GetPenSize
|
|
|
|
* @return the size of the "pen" that be used to draw or plot this item
|
|
|
|
*/
|
|
|
|
virtual int GetPenSize( );
|
|
|
|
|
2009-01-02 17:07:50 +00:00
|
|
|
#if defined(DEBUG)
|
|
|
|
void Show( int nestLevel, std::ostream& os );
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class DrawNoConnectStruct : public SCH_ITEM /* Symboles de non connexion */
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxPoint m_Pos; /* XY coordinates of NoConnect. */
|
|
|
|
|
|
|
|
public:
|
|
|
|
DrawNoConnectStruct( const wxPoint& pos );
|
|
|
|
~DrawNoConnectStruct() { }
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "DrawNoConnect" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DrawNoConnectStruct* GenCopy();
|
2009-06-30 19:21:41 +00:00
|
|
|
|
|
|
|
/** Function GetPenSize
|
|
|
|
* @return the size of the "pen" that be used to draw or plot this item
|
|
|
|
*/
|
|
|
|
virtual int GetPenSize( );
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
|
|
|
const wxPoint& offset, int draw_mode,
|
|
|
|
int Color = -1 );
|
2009-01-02 17:07:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Save
|
2009-04-05 20:49:15 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.brd"
|
|
|
|
* format.
|
2009-01-02 17:07:50 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
|
|
|
bool Save( FILE* aFile ) const;
|
|
|
|
|
2009-01-31 18:08:47 +00:00
|
|
|
/** Function HitTest
|
|
|
|
* @return true if the point aPosRef is within item area
|
|
|
|
* @param aPosRef = a wxPoint to test
|
|
|
|
*/
|
|
|
|
bool HitTest( const wxPoint& aPosRef );
|
|
|
|
|
2009-01-02 17:07:50 +00:00
|
|
|
EDA_Rect GetBoundingBox();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class DrawBusEntryStruct
|
|
|
|
* Struct de descr 1 raccord a 45 degres de BUS ou WIRE
|
|
|
|
*/
|
|
|
|
class DrawBusEntryStruct : public SCH_ITEM
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int m_Width;
|
|
|
|
wxPoint m_Pos;
|
|
|
|
wxSize m_Size;
|
|
|
|
|
|
|
|
public:
|
|
|
|
DrawBusEntryStruct( const wxPoint& pos, int shape, int id );
|
|
|
|
~DrawBusEntryStruct() { }
|
|
|
|
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "DrawBusEntry" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DrawBusEntryStruct* GenCopy();
|
|
|
|
wxPoint m_End() const; // retourne la coord de fin du raccord
|
2009-04-05 20:49:15 +00:00
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
|
|
|
const wxPoint& offset, int draw_mode,
|
|
|
|
int Color = -1 );
|
2009-01-02 17:07:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Save
|
2009-04-05 20:49:15 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.brd"
|
|
|
|
* format.
|
2009-01-02 17:07:50 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
|
|
|
bool Save( FILE* aFile ) const;
|
|
|
|
|
|
|
|
EDA_Rect GetBoundingBox();
|
2009-06-30 19:21:41 +00:00
|
|
|
|
|
|
|
/** Function GetPenSize
|
|
|
|
* @return the size of the "pen" that be used to draw or plot this item
|
|
|
|
*/
|
|
|
|
virtual int GetPenSize( );
|
|
|
|
|
2009-01-02 17:07:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawPolylineStruct : public SCH_ITEM /* Polyligne (serie de segments) */
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int m_Width; /* Tickness */
|
|
|
|
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
|
|
|
|
|
|
|
|
public:
|
|
|
|
DrawPolylineStruct( int layer );
|
|
|
|
~DrawPolylineStruct();
|
|
|
|
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "DrawPolyline" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DrawPolylineStruct* GenCopy();
|
2009-04-05 20:49:15 +00:00
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
|
|
|
const wxPoint& offset, int draw_mode,
|
|
|
|
int Color = -1 );
|
2009-01-02 17:07:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Save
|
2009-04-05 20:49:15 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.brd"
|
|
|
|
* format.
|
2009-01-02 17:07:50 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
|
|
|
bool Save( FILE* aFile ) const;
|
|
|
|
|
|
|
|
/** Function AddPoint
|
|
|
|
* add a corner to m_PolyPoints
|
|
|
|
*/
|
|
|
|
void AddPoint( const wxPoint& point )
|
|
|
|
{
|
|
|
|
m_PolyPoints.push_back( point );
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Function GetCornerCount
|
|
|
|
* @return the number of corners
|
|
|
|
*/
|
|
|
|
|
|
|
|
unsigned GetCornerCount() const { return m_PolyPoints.size(); }
|
2009-06-30 19:21:41 +00:00
|
|
|
|
|
|
|
/** Function GetPenSize
|
|
|
|
* @return the size of the "pen" that be used to draw or plot this item
|
|
|
|
*/
|
|
|
|
virtual int GetPenSize( );
|
|
|
|
|
2009-01-02 17:07:50 +00:00
|
|
|
};
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
|
|
|
class DrawJunctionStruct : public SCH_ITEM
|
2009-01-02 17:07:50 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxPoint m_Pos; /* XY coordinates of connection. */
|
|
|
|
|
|
|
|
public:
|
|
|
|
DrawJunctionStruct( const wxPoint& pos );
|
|
|
|
~DrawJunctionStruct() { }
|
|
|
|
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "DrawJunction" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-31 18:08:47 +00:00
|
|
|
/** Function HitTest
|
|
|
|
* @return true if the point aPosRef is within item area
|
|
|
|
* @param aPosRef = a wxPoint to test
|
|
|
|
*/
|
|
|
|
bool HitTest( const wxPoint& aPosRef );
|
|
|
|
|
2009-01-02 17:07:50 +00:00
|
|
|
EDA_Rect GetBoundingBox();
|
|
|
|
|
|
|
|
DrawJunctionStruct* GenCopy();
|
|
|
|
|
2009-06-30 19:21:41 +00:00
|
|
|
/** Function GetPenSize
|
|
|
|
* @return the size of the "pen" that be used to draw or plot this item
|
|
|
|
*/
|
|
|
|
virtual int GetPenSize( );
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
|
|
|
const wxPoint& offset, int draw_mode,
|
|
|
|
int Color = -1 );
|
2009-01-02 17:07:50 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
|
|
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
|
|
|
bool Save( FILE* aFile ) const;
|
|
|
|
|
|
|
|
#if defined(DEBUG)
|
|
|
|
void Show( int nestLevel, std::ostream& os );
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* CLASS_SCHEMATIC_ITEMS_H */
|