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.

70 lines
1.9 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. #pragma once
  20. #include <origin_viewitem.h>
  21. #include <geometry/point_types.h>
  22. namespace KIGFX
  23. {
  24. /**
  25. * View item to draw an origin marker with an optional
  26. * snap type indicator.
  27. */
  28. class SNAP_INDICATOR : public ORIGIN_VIEWITEM
  29. {
  30. public:
  31. SNAP_INDICATOR( const COLOR4D& aColor = COLOR4D::WHITE, int aSize = 16,
  32. const VECTOR2D& aPosition = VECTOR2D( 0, 0 ) );
  33. SNAP_INDICATOR( const VECTOR2D& aPosition, EDA_ITEM_FLAGS flags );
  34. SNAP_INDICATOR* Clone() const override;
  35. const BOX2I ViewBBox() const override;
  36. void ViewDraw( int aLayer, VIEW* aView ) const override;
  37. #if defined( DEBUG )
  38. void Show( int x, std::ostream& st ) const override {}
  39. #endif
  40. /**
  41. * Get class name.
  42. *
  43. * @return string "SNAP_INDICATOR"
  44. */
  45. wxString GetClass() const override { return wxT( "SNAP_INDICATOR" ); }
  46. /**
  47. * Set a mask of point types that this snap item represents.
  48. *
  49. * This is a mask of POINT_TYPE.
  50. */
  51. void SetSnapTypes( int aSnapTypes ) { m_snapTypes = aSnapTypes; }
  52. int GetSnapTypes() const { return m_snapTypes; }
  53. private:
  54. int m_snapTypes = POINT_TYPE::PT_NONE;
  55. };
  56. } // namespace KIGFX