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.

120 lines
3.7 KiB

7 years ago
  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-2019 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.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. int 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 GetSize() const
  44. {
  45. return std::max( m_size, KiROUND( GetDefaultLineThickness() * 3 ) );
  46. }
  47. int GetPenSize() const override;
  48. void SwapData( SCH_ITEM* aItem ) override;
  49. void ViewGetLayers( int aLayers[], int& aCount ) const override;
  50. void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) override;
  51. void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
  52. const EDA_RECT GetBoundingBox() const override;
  53. // Geometric transforms (used in block operations):
  54. void Move( const wxPoint& aMoveVector ) override
  55. {
  56. m_pos += aMoveVector;
  57. }
  58. void MirrorY( int aYaxis_position ) override;
  59. void MirrorX( int aXaxis_position ) override;
  60. void Rotate( wxPoint aPosition ) override;
  61. bool IsConnectable() const override { return true; }
  62. bool CanConnect( const SCH_ITEM* aItem ) const override
  63. {
  64. return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
  65. aItem->Type() == SCH_COMPONENT_T;
  66. }
  67. void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
  68. wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override
  69. {
  70. return wxString( _( "No Connect" ) );
  71. }
  72. BITMAP_DEF GetMenuImage() const override;
  73. void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems, SCH_SHEET_PATH* aSheetPath ) override;
  74. wxPoint GetPosition() const override { return m_pos; }
  75. void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
  76. bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
  77. bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
  78. void Plot( PLOTTER* aPlotter ) override;
  79. EDA_ITEM* Clone() const override;
  80. #if defined(DEBUG)
  81. void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
  82. #endif
  83. private:
  84. bool doIsConnected( const wxPoint& aPosition ) const override;
  85. };
  86. #endif // _SCH_NO_CONNECT_H_