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.

68 lines
2.3 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2023 Ethan Chien <liangtie.qian@gmail.com>
  5. * Copyright The 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. #include "zone_painter.h"
  25. #include "board_edges_bounding_item.h"
  26. #include "zone_manager_preference.h"
  27. #include <layer_ids.h>
  28. #include <convert_basic_shapes_to_polygon.h>
  29. #include <gal/graphics_abstraction_layer.h>
  30. #include <callback_gal.h>
  31. #include <geometry/geometry_utils.h>
  32. #include <geometry/shape_line_chain.h>
  33. #include <geometry/shape_rect.h>
  34. #include <geometry/shape_segment.h>
  35. #include <geometry/shape_simple.h>
  36. #include <geometry/shape_circle.h>
  37. #include <bezier_curves.h>
  38. #include <kiface_base.h>
  39. #include <gr_text.h>
  40. #include <pgm_base.h>
  41. #include <wx/gdicmn.h>
  42. #include <board_item.h>
  43. #include <zone.h>
  44. bool ZONE_PAINTER::Draw( const KIGFX::VIEW_ITEM* aItem, int aLayer )
  45. {
  46. const BOARD_EDGES_BOUNDING_ITEM* item = dynamic_cast<const BOARD_EDGES_BOUNDING_ITEM*>( aItem );
  47. if( item )
  48. {
  49. draw( item, aLayer );
  50. return true;
  51. }
  52. return KIGFX::PCB_PAINTER::Draw( aItem, aLayer );
  53. }
  54. void ZONE_PAINTER::draw( const BOARD_EDGES_BOUNDING_ITEM* aBox, int aLayer )
  55. {
  56. m_gal->Save();
  57. m_gal->SetFillColor( ZONE_MANAGER_PREFERENCE::GetBoundBoundingFillColor() );
  58. m_gal->SetLineWidth( 0 );
  59. m_gal->SetIsFill( true );
  60. m_gal->SetIsStroke( false );
  61. m_gal->DrawRectangle( aBox->ViewBBox() );
  62. m_gal->Restore();
  63. }