sch_junction.h 3.07 KB
Newer Older
charras's avatar
charras committed
1
/**
2
 * @file sch_junction.h
3
 *
charras's avatar
charras committed
4 5
 */

6 7
#ifndef _SCH_JUNCTION_H_
#define _SCH_JUNCTION_H_
charras's avatar
charras committed
8 9


10
#include "sch_item_struct.h"
charras's avatar
charras committed
11

12

13
class SCH_JUNCTION : public SCH_ITEM
charras's avatar
charras committed
14 15 16
{
public:
    wxPoint m_Pos;                  /* XY coordinates of connection. */
17
    wxSize  m_Size;
charras's avatar
charras committed
18 19

public:
20
    SCH_JUNCTION( const wxPoint& pos = wxPoint( 0, 0 ) );
21 22 23

    SCH_JUNCTION( const SCH_JUNCTION& aJunction );

24
    ~SCH_JUNCTION() { }
charras's avatar
charras committed
25 26 27

    virtual wxString GetClass() const
    {
28
        return wxT( "SCH_JUNCTION" );
charras's avatar
charras committed
29 30
    }

31 32
    /**
     * Function GetBoundingBox
33 34 35 36 37
     * returns the orthogonal, bounding box of this object for display
     * purposes.  This box should be an enclosing perimeter for visible
     * components of this object, and the units should be in the pcb or
     * schematic coordinate system.  It is OK to overestimate the size
     * by a few counts.
38
     */
39
    EDA_RECT GetBoundingBox() const;
charras's avatar
charras committed
40

41
    SCH_JUNCTION* GenCopy();
charras's avatar
charras committed
42

43
    virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
44
                       int aDrawMode, int aColor = -1 );
45

charras's avatar
charras committed
46 47
    /**
     * Function Save
48 49
     * writes the data structures for this object out to a FILE in "*.sch"
     * format.
charras's avatar
charras committed
50 51 52
     * @param aFile The FILE to write to.
     * @return bool - true if success writing else false.
     */
53
    bool Save( FILE* aFile ) const;
charras's avatar
charras committed
54

55 56 57 58 59 60 61 62 63 64
    /**
     * Load schematic junction entry from \a aLine in a .sch file.
     *
     * @param aLine - Essentially this is file to read schematic junction from.
     * @param aErrorMsg - Description of the error if an error occurs while loading the
     *                    schematic junction.
     * @return True if the schematic junction loaded successfully.
     */
    virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );

65 66 67 68
    /**
     * Function Move
     * moves then item to a new position by \a aMoveVector.
     * @param aMoveVector The displacement vector.
69
     */
70
    virtual void Move( const wxPoint& aMoveVector )
71 72 73 74
    {
        m_Pos += aMoveVector;
    }

75 76 77
    /**
     * Function Mirror_Y
     * mirrors the item relative to \a aYaxis_position.
78 79
     * @param aYaxis_position = the y axis position
     */
80
    virtual void Mirror_Y( int aYaxis_position );
81

82
    virtual void Mirror_X( int aXaxis_position );
83

84
    virtual void Rotate( wxPoint rotationPoint );
85

86 87 88 89
    virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList );

    virtual bool IsSelectStateChanged( const wxRect& aRect );

90 91
    virtual bool IsConnectable() const { return true; }

92 93
    virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;

94 95 96 97
    virtual wxString GetSelectMenuText() const { return wxString( _( "Junction" ) ); }

    virtual const char** GetMenuImage() const { return (const char**) add_junction_xpm; }

charras's avatar
charras committed
98
#if defined(DEBUG)
99
    void Show( int nestLevel, std::ostream& os );
charras's avatar
charras committed
100
#endif
101 102

private:
103
    virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
104
    virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
105 106
    virtual bool doIsConnected( const wxPoint& aPosition ) const;
    virtual EDA_ITEM* doClone() const;
charras's avatar
charras committed
107 108 109
};


110
#endif    // _SCH_JUNCTION_H_