sch_junction.h 3.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

charras's avatar
charras committed
25
/**
26
 * @file sch_junction.h
charras's avatar
charras committed
27 28
 */

29 30
#ifndef _SCH_JUNCTION_H_
#define _SCH_JUNCTION_H_
charras's avatar
charras committed
31 32


33
#include <sch_item_struct.h>
34
class NETLIST_OBJECT_LIST;
charras's avatar
charras committed
35

36
class SCH_JUNCTION : public SCH_ITEM
charras's avatar
charras committed
37
{
38 39
    wxPoint m_pos;                  // Position of the junction.
    static int m_symbolSize;        // diameter of the junction graphic symbol
charras's avatar
charras committed
40 41

public:
42
    SCH_JUNCTION( const wxPoint& pos = wxPoint( 0, 0 ) );
43

44
    // Do not create a copy constructor.  The one generated by the compiler is adequate.
45

46
    ~SCH_JUNCTION() { }
charras's avatar
charras committed
47

48
    wxString GetClass() const
charras's avatar
charras committed
49
    {
50
        return wxT( "SCH_JUNCTION" );
charras's avatar
charras committed
51 52
    }

53 54 55
    static int GetSymbolSize() { return m_symbolSize; }
    static void SetSymbolSize( int aSize ) { m_symbolSize = aSize; }

56
    void SwapData( SCH_ITEM* aItem );
57

58
    const EDA_RECT GetBoundingBox() const;    // Virtual
charras's avatar
charras committed
59

60
    void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
61
               GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
62

63
    bool Save( FILE* aFile ) const;
charras's avatar
charras committed
64

65 66 67
    bool Load( LINE_READER& aLine, wxString& aErrorMsg );

    void Move( const wxPoint& aMoveVector )
68
    {
69
        m_pos += aMoveVector;
70 71
    }

72
    void MirrorY( int aYaxis_position );
73

74
    void MirrorX( int aXaxis_position );
75

76
    void Rotate( wxPoint aPosition );
77

78
    void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList );
79

80
    bool IsSelectStateChanged( const wxRect& aRect );
81

82
    bool IsConnectable() const { return true; }
83

84
    void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const;
85

86
    wxString GetSelectMenuText() const { return wxString( _( "Junction" ) ); }
87

88
    BITMAP_DEF GetMenuImage() const { return  add_junction_xpm; }
89

90
    void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems, SCH_SHEET_PATH* aSheetPath );
91

92
    wxPoint GetPosition() const { return m_pos; }
93

94
    void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
95

96
    bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
97

98
    bool HitTest( const EDA_RECT& aRect, bool aContained = false,
99
                          int aAccuracy = 0 ) const;
100
    void Plot( PLOTTER* aPlotter );
101

102
    EDA_ITEM* Clone() const;
103

charras's avatar
charras committed
104
#if defined(DEBUG)
105
    void Show( int nestLevel, std::ostream& os ) const;     // override
charras's avatar
charras committed
106
#endif
107 108

private:
109
    bool doIsConnected( const wxPoint& aPosition ) const;
charras's avatar
charras committed
110 111 112
};


113
#endif    // _SCH_JUNCTION_H_