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.

125 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. #include <math/util.h> // for KiROUND
  31. class NETLIST_OBJECT_LIST;
  32. class SCH_NO_CONNECT : public SCH_ITEM
  33. {
  34. wxPoint m_pos; ///< Position of the no connect object.
  35. int m_size; ///< Size of the no connect object.
  36. public:
  37. SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) );
  38. // Do not create a copy constructor. The one generated by the compiler is adequate.
  39. ~SCH_NO_CONNECT() { }
  40. static inline bool ClassOf( const EDA_ITEM* aItem )
  41. {
  42. return aItem && SCH_NO_CONNECT_T == aItem->Type();
  43. }
  44. wxString GetClass() const override
  45. {
  46. return wxT( "SCH_NO_CONNECT" );
  47. }
  48. int GetSize() const
  49. {
  50. return m_size;
  51. }
  52. int GetPenWidth() const override;
  53. void SwapData( SCH_ITEM* aItem ) override;
  54. void ViewGetLayers( int aLayers[], int& aCount ) const override;
  55. void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
  56. void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
  57. const EDA_RECT GetBoundingBox() const override;
  58. // Geometric transforms (used in block operations):
  59. void Move( const wxPoint& aMoveVector ) override
  60. {
  61. m_pos += aMoveVector;
  62. }
  63. void MirrorY( int aYaxis_position ) override;
  64. void MirrorX( int aXaxis_position ) override;
  65. void Rotate( wxPoint aPosition ) override;
  66. bool IsConnectable() const override { return true; }
  67. bool CanConnect( const SCH_ITEM* aItem ) const override
  68. {
  69. return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
  70. aItem->Type() == SCH_COMPONENT_T;
  71. }
  72. std::vector<wxPoint> GetConnectionPoints() const override;
  73. wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
  74. {
  75. return wxString( _( "No Connect" ) );
  76. }
  77. BITMAP_DEF GetMenuImage() const override;
  78. wxPoint GetPosition() const override { return m_pos; }
  79. void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
  80. bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
  81. bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
  82. void Plot( PLOTTER* aPlotter ) override;
  83. EDA_ITEM* Clone() const override;
  84. #if defined(DEBUG)
  85. void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
  86. #endif
  87. private:
  88. bool doIsConnected( const wxPoint& aPosition ) const override;
  89. };
  90. #endif // _SCH_NO_CONNECT_H_