You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
3.6 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
  5. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. /**
  25. * @file sch_no_connect.h
  26. */
  27. #ifndef _SCH_NO_CONNECT_H_
  28. #define _SCH_NO_CONNECT_H_
  29. #include <sch_item_struct.h>
  30. class NETLIST_OBJECT_LIST;
  31. class SCH_NO_CONNECT : public SCH_ITEM
  32. {
  33. wxPoint m_pos; ///< Position of the no connect object.
  34. wxSize m_size; ///< Size of the no connect object.
  35. public:
  36. SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) );
  37. // Do not create a copy constructor. The one generated by the compiler is adequate.
  38. ~SCH_NO_CONNECT() { }
  39. wxString GetClass() const override
  40. {
  41. return wxT( "SCH_NO_CONNECT" );
  42. }
  43. int GetPenSize() const override;
  44. void SwapData( SCH_ITEM* aItem ) override;
  45. void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
  46. GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
  47. void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
  48. const EDA_RECT GetBoundingBox() const override;
  49. // Geometric transforms (used in block operations):
  50. void Move( const wxPoint& aMoveVector ) override
  51. {
  52. m_pos += aMoveVector;
  53. }
  54. void MirrorY( int aYaxis_position ) override;
  55. void MirrorX( int aXaxis_position ) override;
  56. void Rotate( wxPoint aPosition ) override;
  57. bool IsSelectStateChanged( const wxRect& aRect ) override;
  58. bool IsConnectable() const override { return true; }
  59. bool CanConnect( const SCH_ITEM* aItem ) const override
  60. {
  61. return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
  62. aItem->Type() == SCH_COMPONENT_T;
  63. }
  64. void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
  65. wxString GetSelectMenuText() const override { return wxString( _( "No Connect" ) ); }
  66. BITMAP_DEF GetMenuImage() const override;
  67. void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems, SCH_SHEET_PATH* aSheetPath ) override;
  68. wxPoint GetPosition() const override { return m_pos; }
  69. void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
  70. bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override;
  71. bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const override;
  72. void Plot( PLOTTER* aPlotter ) override;
  73. EDA_ITEM* Clone() const override;
  74. #if defined(DEBUG)
  75. void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
  76. #endif
  77. private:
  78. bool doIsConnected( const wxPoint& aPosition ) const override;
  79. };
  80. #endif // _SCH_NO_CONNECT_H_