Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2019-01-20 09:03:15 +00:00
|
|
|
* Copyright (C) 2013-2019 CERN
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
|
|
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
|
|
|
#include <track.h>
|
|
|
|
#include <pcb_group.h>
|
|
|
|
#include <footprint.h>
|
|
|
|
#include <pad.h>
|
2020-10-04 23:34:59 +00:00
|
|
|
#include <pcb_shape.h>
|
2020-10-15 22:39:33 +00:00
|
|
|
#include <kicad_string.h>
|
2020-11-11 23:05:59 +00:00
|
|
|
#include <zone.h>
|
2020-10-04 23:34:59 +00:00
|
|
|
#include <pcb_text.h>
|
2020-11-14 18:11:28 +00:00
|
|
|
#include <pcb_marker.h>
|
2020-11-11 23:05:59 +00:00
|
|
|
#include <dimension.h>
|
|
|
|
#include <pcb_target.h>
|
2020-11-18 01:21:04 +00:00
|
|
|
#include <core/arraydim.h>
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2017-08-04 12:43:02 +00:00
|
|
|
#include <layers_id_colors_and_visibility.h>
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
#include <pcb_painter.h>
|
2017-10-30 17:21:07 +00:00
|
|
|
#include <pcb_display_options.h>
|
2020-07-08 02:21:45 +00:00
|
|
|
#include <project/net_settings.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <settings/color_settings.h>
|
2017-10-30 17:21:07 +00:00
|
|
|
|
2016-04-06 18:15:49 +00:00
|
|
|
#include <convert_basic_shapes_to_polygon.h>
|
2019-05-14 12:39:34 +00:00
|
|
|
#include <gal/graphics_abstraction_layer.h>
|
|
|
|
#include <geometry/geometry_utils.h>
|
2018-12-19 18:53:27 +00:00
|
|
|
#include <geometry/shape_line_chain.h>
|
2020-10-14 14:55:06 +00:00
|
|
|
#include <geometry/shape_rect.h>
|
2020-06-22 19:35:09 +00:00
|
|
|
#include <geometry/shape_segment.h>
|
2020-10-14 14:55:06 +00:00
|
|
|
#include <geometry/shape_simple.h>
|
2020-06-22 19:35:09 +00:00
|
|
|
#include <geometry/shape_circle.h>
|
2019-06-04 07:23:12 +00:00
|
|
|
|
2013-10-14 14:13:35 +00:00
|
|
|
using namespace KIGFX;
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
|
|
|
PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS()
|
|
|
|
{
|
2014-05-14 08:35:12 +00:00
|
|
|
m_backgroundColor = COLOR4D( 0.0, 0.0, 0.0, 1.0 );
|
2014-05-21 21:13:30 +00:00
|
|
|
m_padNumbers = true;
|
|
|
|
m_netNamesOnPads = true;
|
|
|
|
m_netNamesOnTracks = true;
|
2018-10-08 13:50:59 +00:00
|
|
|
m_netNamesOnVias = true;
|
|
|
|
m_zoneOutlines = true;
|
2020-07-11 17:42:00 +00:00
|
|
|
m_zoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_FILLED;
|
2017-01-31 20:35:52 +00:00
|
|
|
m_clearance = CL_NONE;
|
2020-05-26 22:21:38 +00:00
|
|
|
m_sketchGraphics = false;
|
|
|
|
m_sketchText = false;
|
2020-07-08 02:21:45 +00:00
|
|
|
m_netColorMode = NET_COLOR_MODE::RATSNEST;
|
2020-07-12 15:34:58 +00:00
|
|
|
m_contrastModeDisplay = HIGH_CONTRAST_MODE::NORMAL;
|
2020-09-07 20:43:31 +00:00
|
|
|
m_ratsnestDisplayMode = RATSNEST_MODE::ALL;
|
2014-05-14 08:35:12 +00:00
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
m_trackOpacity = 1.0;
|
|
|
|
m_viaOpacity = 1.0;
|
|
|
|
m_padOpacity = 1.0;
|
|
|
|
m_zoneOpacity = 1.0;
|
|
|
|
|
2013-04-08 08:54:31 +00:00
|
|
|
// By default everything should be displayed as filled
|
2019-01-06 16:43:12 +00:00
|
|
|
for( unsigned int i = 0; i < arrayDim( m_sketchMode ); ++i )
|
2013-04-08 08:54:31 +00:00
|
|
|
{
|
2014-03-24 16:20:23 +00:00
|
|
|
m_sketchMode[i] = false;
|
2013-04-08 08:54:31 +00:00
|
|
|
}
|
|
|
|
|
2013-08-07 07:51:39 +00:00
|
|
|
update();
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void PCB_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
2020-01-13 01:44:19 +00:00
|
|
|
SetBackgroundColor( aSettings->GetColor( LAYER_PCB_BACKGROUND ) );
|
|
|
|
|
2017-04-05 14:29:53 +00:00
|
|
|
// Init board layers colors:
|
2017-03-13 03:19:33 +00:00
|
|
|
for( int i = 0; i < PCB_LAYER_ID_COUNT; i++ )
|
2017-03-07 10:57:52 +00:00
|
|
|
{
|
2020-01-13 01:44:19 +00:00
|
|
|
m_layerColors[i] = aSettings->GetColor( i );
|
2017-07-04 10:48:47 +00:00
|
|
|
|
|
|
|
// Guard: if the alpah channel is too small, the layer is not visible.
|
|
|
|
// clamp it to 0.2
|
|
|
|
if( m_layerColors[i].a < 0.2 )
|
|
|
|
m_layerColors[i].a = 0.2;
|
2017-03-07 10:57:52 +00:00
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2017-04-05 14:29:53 +00:00
|
|
|
// Init specific graphic layers colors:
|
2017-03-13 03:19:33 +00:00
|
|
|
for( int i = GAL_LAYER_ID_START; i < GAL_LAYER_ID_END; i++ )
|
2020-01-13 01:44:19 +00:00
|
|
|
m_layerColors[i] = aSettings->GetColor( i );
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2017-04-05 14:29:53 +00:00
|
|
|
// Default colors for specific layers (not really board layers).
|
2020-01-13 01:44:19 +00:00
|
|
|
m_layerColors[LAYER_PADS_PLATEDHOLES] = aSettings->GetColor( LAYER_PCB_BACKGROUND );
|
2018-01-15 13:52:00 +00:00
|
|
|
m_layerColors[LAYER_VIAS_NETNAMES] = COLOR4D( 0.2, 0.2, 0.2, 0.9 );
|
2017-04-05 14:29:53 +00:00
|
|
|
m_layerColors[LAYER_PADS_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
|
|
|
|
m_layerColors[LAYER_PAD_FR_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
|
|
|
|
m_layerColors[LAYER_PAD_BK_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
|
|
|
|
|
2018-01-03 22:38:25 +00:00
|
|
|
// LAYER_PADS_TH, LAYER_NON_PLATEDHOLES, LAYER_ANCHOR ,LAYER_RATSNEST,
|
|
|
|
// LAYER_VIA_THROUGH, LAYER_VIA_BBLIND, LAYER_VIA_MICROVIA
|
2017-04-05 14:29:53 +00:00
|
|
|
// are initialized from aSettings
|
|
|
|
|
2013-07-08 14:46:04 +00:00
|
|
|
// Netnames for copper layers
|
2014-06-24 16:17:18 +00:00
|
|
|
for( LSEQ cu = LSET::AllCuMask().CuStack(); cu; ++cu )
|
2013-07-08 14:46:04 +00:00
|
|
|
{
|
2016-05-02 14:08:50 +00:00
|
|
|
const COLOR4D lightLabel( 0.8, 0.8, 0.8, 0.7 );
|
|
|
|
const COLOR4D darkLabel = lightLabel.Inverted();
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID layer = *cu;
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2016-05-02 14:08:50 +00:00
|
|
|
if( m_layerColors[layer].GetBrightness() > 0.5 )
|
|
|
|
m_layerColors[GetNetnameLayer( layer )] = darkLabel;
|
|
|
|
else
|
|
|
|
m_layerColors[GetNetnameLayer( layer )] = lightLabel;
|
2013-07-08 14:46:04 +00:00
|
|
|
}
|
|
|
|
|
2013-08-07 07:51:39 +00:00
|
|
|
update();
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-11-07 14:23:09 +00:00
|
|
|
void PCB_RENDER_SETTINGS::LoadDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions,
|
2018-07-01 08:24:57 +00:00
|
|
|
bool aShowPageLimits )
|
2013-04-08 08:50:47 +00:00
|
|
|
{
|
2020-07-11 17:40:23 +00:00
|
|
|
m_hiContrastEnabled = ( aOptions.m_ContrastModeDisplay !=
|
|
|
|
HIGH_CONTRAST_MODE::NORMAL );
|
2019-11-07 14:23:09 +00:00
|
|
|
m_padNumbers = aOptions.m_DisplayPadNum;
|
2020-05-26 22:21:38 +00:00
|
|
|
m_sketchGraphics = !aOptions.m_DisplayGraphicsFill;
|
|
|
|
m_sketchText = !aOptions.m_DisplayTextFill;
|
2019-11-07 14:23:09 +00:00
|
|
|
m_curvedRatsnestlines = aOptions.m_DisplayRatsnestLinesCurved;
|
|
|
|
m_globalRatsnestlines = aOptions.m_ShowGlobalRatsnest;
|
2013-04-08 08:54:31 +00:00
|
|
|
|
|
|
|
// Whether to draw tracks, vias & pads filled or as outlines
|
2019-11-07 14:23:09 +00:00
|
|
|
m_sketchMode[LAYER_PADS_TH] = !aOptions.m_DisplayPadFill;
|
|
|
|
m_sketchMode[LAYER_VIA_THROUGH] = !aOptions.m_DisplayViaFill;
|
|
|
|
m_sketchMode[LAYER_VIA_BBLIND] = !aOptions.m_DisplayViaFill;
|
|
|
|
m_sketchMode[LAYER_VIA_MICROVIA] = !aOptions.m_DisplayViaFill;
|
|
|
|
m_sketchMode[LAYER_TRACKS] = !aOptions.m_DisplayPcbTrackFill;
|
2013-07-02 12:02:42 +00:00
|
|
|
|
2017-01-24 16:58:11 +00:00
|
|
|
// Net names display settings
|
2019-11-07 14:23:09 +00:00
|
|
|
switch( aOptions.m_DisplayNetNamesMode )
|
2013-07-17 11:38:56 +00:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
m_netNamesOnPads = false;
|
|
|
|
m_netNamesOnTracks = false;
|
2019-12-25 11:12:38 +00:00
|
|
|
m_netNamesOnVias = false;
|
2013-07-17 11:38:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
m_netNamesOnPads = true;
|
|
|
|
m_netNamesOnTracks = false;
|
2019-12-25 11:12:38 +00:00
|
|
|
m_netNamesOnVias = true; // Follow pads or tracks? For now we chose pads....
|
2013-07-17 11:38:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
m_netNamesOnPads = false;
|
|
|
|
m_netNamesOnTracks = true;
|
2019-12-25 11:12:38 +00:00
|
|
|
m_netNamesOnVias = false; // Follow pads or tracks? For now we chose pads....
|
2013-07-17 11:38:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
m_netNamesOnPads = true;
|
|
|
|
m_netNamesOnTracks = true;
|
2019-12-25 11:12:38 +00:00
|
|
|
m_netNamesOnVias = true;
|
2013-07-17 11:38:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2017-01-23 15:14:51 +00:00
|
|
|
// Zone display settings
|
2020-07-11 17:42:00 +00:00
|
|
|
m_zoneDisplayMode = aOptions.m_ZoneDisplayMode;
|
2017-01-24 16:58:11 +00:00
|
|
|
|
|
|
|
// Clearance settings
|
2019-11-07 14:23:09 +00:00
|
|
|
switch( aOptions.m_ShowTrackClearanceMode )
|
2017-01-24 16:58:11 +00:00
|
|
|
{
|
2017-10-30 17:21:07 +00:00
|
|
|
case PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE:
|
2017-01-24 16:58:11 +00:00
|
|
|
m_clearance = CL_NONE;
|
|
|
|
break;
|
|
|
|
|
2017-10-30 17:21:07 +00:00
|
|
|
case PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS:
|
2017-01-24 16:58:11 +00:00
|
|
|
m_clearance = CL_NEW | CL_TRACKS;
|
|
|
|
break;
|
|
|
|
|
2017-10-30 17:21:07 +00:00
|
|
|
case PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS:
|
2017-01-24 16:58:11 +00:00
|
|
|
m_clearance = CL_NEW | CL_TRACKS | CL_VIAS;
|
|
|
|
break;
|
|
|
|
|
2017-10-30 17:21:07 +00:00
|
|
|
case PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS:
|
2017-01-24 16:58:11 +00:00
|
|
|
m_clearance = CL_NEW | CL_EDITED | CL_TRACKS | CL_VIAS;
|
|
|
|
break;
|
|
|
|
|
2017-10-30 17:21:07 +00:00
|
|
|
case PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_ALWAYS:
|
2017-01-24 16:58:11 +00:00
|
|
|
m_clearance = CL_NEW | CL_EDITED | CL_EXISTING | CL_TRACKS | CL_VIAS;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-11-07 14:23:09 +00:00
|
|
|
if( aOptions.m_DisplayPadIsol )
|
2017-01-24 16:58:11 +00:00
|
|
|
m_clearance |= CL_PADS;
|
2018-07-01 08:24:57 +00:00
|
|
|
|
2020-07-11 17:40:23 +00:00
|
|
|
m_contrastModeDisplay = aOptions.m_ContrastModeDisplay;
|
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
m_netColorMode = aOptions.m_NetColorMode;
|
2013-04-08 08:50:47 +00:00
|
|
|
|
2020-09-07 20:43:31 +00:00
|
|
|
m_ratsnestDisplayMode = aOptions.m_RatsnestMode;
|
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
m_trackOpacity = aOptions.m_TrackOpacity;
|
|
|
|
m_viaOpacity = aOptions.m_ViaOpacity;
|
|
|
|
m_padOpacity = aOptions.m_PadOpacity;
|
|
|
|
m_zoneOpacity = aOptions.m_ZoneOpacity;
|
2020-07-09 01:59:34 +00:00
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
m_showPageLimits = aShowPageLimits;
|
2020-07-08 02:21:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
|
2013-06-25 15:12:54 +00:00
|
|
|
{
|
2013-08-07 07:51:39 +00:00
|
|
|
int netCode = -1;
|
2018-02-26 15:51:18 +00:00
|
|
|
const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );
|
2020-07-08 02:21:45 +00:00
|
|
|
const BOARD_CONNECTED_ITEM* conItem = dynamic_cast<const BOARD_CONNECTED_ITEM*> ( aItem );
|
2013-06-25 15:12:54 +00:00
|
|
|
|
2020-10-12 22:24:35 +00:00
|
|
|
// Marker shadows
|
|
|
|
if( aLayer == LAYER_MARKER_SHADOWS )
|
2020-11-25 15:45:00 +00:00
|
|
|
return m_backgroundColor.WithAlpha( 0.6 );
|
|
|
|
|
|
|
|
if( !item )
|
|
|
|
return m_layerColors[aLayer];
|
|
|
|
|
|
|
|
// Pad hole color is pad-type-specific: the background color for PTHs (which are assumed
|
|
|
|
// to have an annular ring) and the pad color for NPTHs (which are assumed *not* to have
|
|
|
|
// an annular ring).
|
|
|
|
// However, this means a PTH pad with *no* annular ring won't get drawn, so we need to
|
|
|
|
// special-case that.
|
|
|
|
// We have the opposite issue when printing in B&W: both a PTH hole and its annular ring
|
|
|
|
// will normally get assigned black, so we need to special-case that too.
|
|
|
|
if( aLayer == LAYER_PADS_PLATEDHOLES || aLayer == LAYER_NON_PLATEDHOLES )
|
2020-10-12 22:24:35 +00:00
|
|
|
{
|
2020-11-25 15:45:00 +00:00
|
|
|
const PAD* pad = static_cast<const PAD*>( item );
|
|
|
|
bool hasAnnularRing = pad->GetSizeX() > pad->GetDrillSizeX()
|
|
|
|
&& pad->GetSizeY() > pad->GetDrillSizeY();
|
2020-10-12 22:24:35 +00:00
|
|
|
|
2020-11-27 22:30:35 +00:00
|
|
|
if( !hasAnnularRing && m_layerColors[ aLayer ] == m_layerColors[ LAYER_PCB_BACKGROUND ] )
|
2020-11-25 15:45:00 +00:00
|
|
|
aLayer = LAYER_MOD_TEXT_INVISIBLE;
|
2020-10-12 22:24:35 +00:00
|
|
|
|
2020-11-27 22:30:35 +00:00
|
|
|
if( hasAnnularRing && m_layerColors[ aLayer ] == m_layerColors[ LAYER_PADS_TH ] )
|
|
|
|
aLayer = LAYER_PCB_BACKGROUND;
|
|
|
|
}
|
|
|
|
else if( aLayer == LAYER_VIAS_HOLES )
|
|
|
|
{
|
|
|
|
const VIA* via = static_cast<const VIA*>( item );
|
|
|
|
int annularRingLayer;
|
|
|
|
|
|
|
|
if( via->GetViaType() == VIATYPE::MICROVIA )
|
|
|
|
annularRingLayer = LAYER_VIA_MICROVIA;
|
|
|
|
else if( via->GetViaType() == VIATYPE::BLIND_BURIED )
|
|
|
|
annularRingLayer = LAYER_VIA_BBLIND;
|
|
|
|
else
|
|
|
|
annularRingLayer = LAYER_VIA_THROUGH;
|
|
|
|
|
|
|
|
if( m_layerColors[ aLayer ] == m_layerColors[ annularRingLayer ] )
|
2020-11-25 15:45:00 +00:00
|
|
|
aLayer = LAYER_PCB_BACKGROUND;
|
2020-10-12 22:24:35 +00:00
|
|
|
}
|
|
|
|
|
2020-11-25 15:45:00 +00:00
|
|
|
// Zones should pull from the copper layer
|
|
|
|
if( item && item->Type() == PCB_ZONE_T && IsZoneLayer( aLayer ) )
|
|
|
|
aLayer = aLayer - LAYER_ZONE_START;
|
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
// Normal path: get the layer base color
|
|
|
|
COLOR4D color = m_layerColors[aLayer];
|
|
|
|
|
2020-11-25 15:45:00 +00:00
|
|
|
// Selection disambiguation
|
|
|
|
if( item->IsBrightened() )
|
|
|
|
return color.Brightened( m_selectFactor ).WithAlpha( 0.8 );
|
2017-09-20 19:56:22 +00:00
|
|
|
|
2020-11-25 15:45:00 +00:00
|
|
|
// Normal selection
|
|
|
|
if( item->IsSelected() )
|
|
|
|
color = m_layerColorsSel[aLayer];
|
2013-06-25 15:12:54 +00:00
|
|
|
|
2020-07-08 02:21:45 +00:00
|
|
|
// Try to obtain the netcode for the item
|
|
|
|
if( conItem )
|
|
|
|
netCode = conItem->GetNetCode();
|
|
|
|
|
2020-08-19 22:41:04 +00:00
|
|
|
bool highlighted = m_highlightEnabled && m_highlightNetcodes.count( netCode );
|
2020-10-13 00:32:25 +00:00
|
|
|
bool selected = item->IsSelected();
|
2020-08-19 22:41:04 +00:00
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
// Apply net color overrides
|
2020-08-15 22:49:56 +00:00
|
|
|
if( conItem && m_netColorMode == NET_COLOR_MODE::ALL && IsNetCopperLayer( aLayer ) )
|
2020-07-11 17:42:00 +00:00
|
|
|
{
|
2020-09-04 09:57:33 +00:00
|
|
|
COLOR4D netColor = COLOR4D::UNSPECIFIED;
|
2015-09-01 09:27:38 +00:00
|
|
|
|
2020-09-04 09:57:33 +00:00
|
|
|
auto ii = m_netColors.find( netCode );
|
|
|
|
|
|
|
|
if( ii != m_netColors.end() )
|
|
|
|
netColor = ii->second;
|
|
|
|
|
|
|
|
if( netColor == COLOR4D::UNSPECIFIED )
|
2020-08-19 22:41:04 +00:00
|
|
|
{
|
2020-09-04 09:57:33 +00:00
|
|
|
auto jj = m_netclassColors.find( conItem->GetNetClassName() );
|
|
|
|
|
|
|
|
if( jj != m_netclassColors.end() )
|
|
|
|
netColor = jj->second;
|
2020-08-19 22:41:04 +00:00
|
|
|
}
|
2020-09-04 09:57:33 +00:00
|
|
|
|
2020-09-07 15:51:55 +00:00
|
|
|
if( netColor == COLOR4D::UNSPECIFIED )
|
|
|
|
netColor = color;
|
|
|
|
|
2020-10-13 00:32:25 +00:00
|
|
|
if( selected )
|
2020-08-19 22:41:04 +00:00
|
|
|
{
|
2020-09-07 15:51:55 +00:00
|
|
|
// Selection brightening overrides highlighting
|
|
|
|
netColor.Brighten( m_selectFactor );
|
2020-08-19 22:41:04 +00:00
|
|
|
}
|
2020-09-07 15:51:55 +00:00
|
|
|
else if( m_highlightEnabled )
|
|
|
|
{
|
|
|
|
// Highlight brightens objects on all layers and darkens everything else for contrast
|
|
|
|
if( highlighted )
|
|
|
|
netColor.Brighten( m_highlightFactor );
|
|
|
|
else
|
|
|
|
netColor.Darken( 1.0 - m_highlightFactor );
|
|
|
|
}
|
|
|
|
|
|
|
|
color = netColor;
|
2020-08-15 22:49:56 +00:00
|
|
|
}
|
2020-10-13 00:32:25 +00:00
|
|
|
else if( !selected && m_highlightEnabled )
|
2020-08-15 22:49:56 +00:00
|
|
|
{
|
|
|
|
// Single net highlight mode
|
2020-08-19 22:41:04 +00:00
|
|
|
color = m_highlightNetcodes.count( netCode ) ? m_layerColorsHi[aLayer]
|
|
|
|
: m_layerColorsDark[aLayer];
|
2020-08-15 22:49:56 +00:00
|
|
|
}
|
2020-07-11 17:42:00 +00:00
|
|
|
|
2020-08-19 22:41:04 +00:00
|
|
|
// Apply high-contrast dimming
|
2020-11-05 00:22:15 +00:00
|
|
|
if( m_hiContrastEnabled && !highlighted && !selected )
|
2020-11-04 02:05:02 +00:00
|
|
|
{
|
2020-11-05 00:22:15 +00:00
|
|
|
PCB_LAYER_ID primary = GetPrimaryHighContrastLayer();
|
|
|
|
bool isActive = m_highContrastLayers.count( aLayer );
|
2020-10-13 02:47:20 +00:00
|
|
|
|
2020-11-05 00:22:15 +00:00
|
|
|
// Items drawn on synthetic layers depend on crossing the primary layer for active
|
|
|
|
// state determination
|
|
|
|
if( primary != UNDEFINED_LAYER )
|
|
|
|
{
|
|
|
|
if( item->Type() == PCB_VIA_T )
|
|
|
|
{
|
|
|
|
isActive = static_cast<const VIA*>( item )->IsOnLayer( primary );
|
|
|
|
}
|
|
|
|
else if( item->Type() == PCB_PAD_T )
|
|
|
|
{
|
2020-11-12 22:30:02 +00:00
|
|
|
isActive = static_cast<const PAD*>( item )->IsOnLayer( primary );
|
2020-11-05 00:22:15 +00:00
|
|
|
}
|
|
|
|
else if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T )
|
|
|
|
{
|
|
|
|
// Track itself isn't on a synthetic layer, but its netname annotations are.
|
|
|
|
isActive = static_cast<const TRACK*>( item )->IsOnLayer( primary );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !isActive )
|
|
|
|
{
|
|
|
|
if( m_contrastModeDisplay == HIGH_CONTRAST_MODE::HIDDEN || IsNetnameLayer( aLayer ) )
|
|
|
|
color = COLOR4D::CLEAR;
|
|
|
|
else
|
|
|
|
color = color.Mix( m_layerColors[LAYER_PCB_BACKGROUND], m_hiContrastFactor );
|
|
|
|
}
|
2020-07-08 02:21:45 +00:00
|
|
|
}
|
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
// Apply per-type opacity overrides
|
|
|
|
if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T )
|
|
|
|
color.a *= m_trackOpacity;
|
|
|
|
else if( item->Type() == PCB_VIA_T )
|
|
|
|
color.a *= m_viaOpacity;
|
|
|
|
else if( item->Type() == PCB_PAD_T )
|
|
|
|
color.a *= m_padOpacity;
|
2020-11-11 23:05:59 +00:00
|
|
|
else if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
|
2020-07-11 17:42:00 +00:00
|
|
|
color.a *= m_zoneOpacity;
|
|
|
|
|
2013-07-17 08:21:46 +00:00
|
|
|
// No special modificators enabled
|
2020-07-11 17:42:00 +00:00
|
|
|
return color;
|
2013-09-11 09:39:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PCB_PAINTER::PCB_PAINTER( GAL* aGal ) :
|
|
|
|
PAINTER( aGal )
|
|
|
|
{
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-02-07 10:21:26 +00:00
|
|
|
int PCB_PAINTER::getLineThickness( int aActualThickness ) const
|
|
|
|
{
|
|
|
|
// if items have 0 thickness, draw them with the outline
|
|
|
|
// width, otherwise respect the set value (which, no matter
|
|
|
|
// how small will produce something)
|
|
|
|
if( aActualThickness == 0 )
|
|
|
|
return m_pcbSettings.m_outlineWidth;
|
|
|
|
|
|
|
|
return aActualThickness;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
int PCB_PAINTER::getDrillShape( const PAD* aPad ) const
|
2018-09-28 21:45:48 +00:00
|
|
|
{
|
|
|
|
return aPad->GetDrillShape();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
VECTOR2D PCB_PAINTER::getDrillSize( const PAD* aPad ) const
|
2018-09-28 21:45:48 +00:00
|
|
|
{
|
|
|
|
return VECTOR2D( aPad->GetDrillSize() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PCB_PAINTER::getDrillSize( const VIA* aVia ) const
|
|
|
|
{
|
|
|
|
return aVia->GetDrillValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-18 15:01:23 +00:00
|
|
|
bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
2018-02-26 15:51:18 +00:00
|
|
|
const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );
|
|
|
|
|
|
|
|
if( !item )
|
|
|
|
return false;
|
2014-06-06 09:44:21 +00:00
|
|
|
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
// the "cast" applied in here clarifies which overloaded draw() is called
|
2014-06-06 09:44:21 +00:00
|
|
|
switch( item->Type() )
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
|
|
|
case PCB_TRACE_T:
|
2014-09-10 15:18:42 +00:00
|
|
|
draw( static_cast<const TRACK*>( item ), aLayer );
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
break;
|
|
|
|
|
2019-05-17 00:13:21 +00:00
|
|
|
case PCB_ARC_T:
|
|
|
|
draw( static_cast<const ARC*>( item ), aLayer );
|
|
|
|
break;
|
|
|
|
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
case PCB_VIA_T:
|
2014-09-10 15:18:42 +00:00
|
|
|
draw( static_cast<const VIA*>( item ), aLayer );
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PCB_PAD_T:
|
2020-11-12 22:30:02 +00:00
|
|
|
draw( static_cast<const PAD*>( item ), aLayer );
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
break;
|
|
|
|
|
2020-10-04 14:19:33 +00:00
|
|
|
case PCB_SHAPE_T:
|
|
|
|
case PCB_FP_SHAPE_T:
|
2020-10-04 23:34:59 +00:00
|
|
|
draw( static_cast<const PCB_SHAPE*>( item ), aLayer );
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PCB_TEXT_T:
|
2020-10-04 23:34:59 +00:00
|
|
|
draw( static_cast<const PCB_TEXT*>( item ), aLayer );
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
break;
|
|
|
|
|
2020-10-04 14:19:33 +00:00
|
|
|
case PCB_FP_TEXT_T:
|
2020-10-04 23:34:59 +00:00
|
|
|
draw( static_cast<const FP_TEXT*>( item ), aLayer );
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
break;
|
|
|
|
|
2020-11-13 12:21:02 +00:00
|
|
|
case PCB_FOOTPRINT_T:
|
2020-11-13 15:15:52 +00:00
|
|
|
draw( static_cast<const FOOTPRINT*>( item ), aLayer );
|
2014-07-09 13:02:56 +00:00
|
|
|
break;
|
|
|
|
|
2020-08-11 19:37:07 +00:00
|
|
|
case PCB_GROUP_T:
|
2020-08-12 11:23:30 +00:00
|
|
|
draw( static_cast<const PCB_GROUP*>( item ), aLayer );
|
2020-08-11 19:37:07 +00:00
|
|
|
break;
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
case PCB_ZONE_T:
|
|
|
|
draw( static_cast<const ZONE*>( item ), aLayer );
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
break;
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
case PCB_FP_ZONE_T:
|
|
|
|
draw( static_cast<const ZONE*>( item ), aLayer );
|
2019-10-26 15:49:29 +00:00
|
|
|
break;
|
|
|
|
|
2020-09-12 20:09:40 +00:00
|
|
|
case PCB_DIM_ALIGNED_T:
|
2020-09-17 00:54:58 +00:00
|
|
|
case PCB_DIM_CENTER_T:
|
|
|
|
case PCB_DIM_ORTHOGONAL_T:
|
2020-09-12 20:09:40 +00:00
|
|
|
case PCB_DIM_LEADER_T:
|
2020-11-11 23:05:59 +00:00
|
|
|
draw( static_cast<const DIMENSION_BASE*>( item ), aLayer );
|
2013-04-03 09:19:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PCB_TARGET_T:
|
2014-09-10 15:18:42 +00:00
|
|
|
draw( static_cast<const PCB_TARGET*>( item ) );
|
2013-04-03 09:19:13 +00:00
|
|
|
break;
|
|
|
|
|
2014-03-19 12:42:46 +00:00
|
|
|
case PCB_MARKER_T:
|
2020-11-14 18:11:28 +00:00
|
|
|
draw( static_cast<const PCB_MARKER*>( item ), aLayer );
|
2014-03-24 16:20:23 +00:00
|
|
|
break;
|
2014-03-19 12:42:46 +00:00
|
|
|
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
default:
|
2013-06-25 15:12:54 +00:00
|
|
|
// Painter does not know how to draw the object
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-08 07:57:23 +00:00
|
|
|
void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
|
|
|
VECTOR2D start( aTrack->GetStart() );
|
|
|
|
VECTOR2D end( aTrack->GetEnd() );
|
2013-04-17 10:38:00 +00:00
|
|
|
int width = aTrack->GetWidth();
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2014-05-21 21:13:30 +00:00
|
|
|
if( m_pcbSettings.m_netNamesOnTracks && IsNetnameLayer( aLayer ) )
|
2013-04-08 08:54:31 +00:00
|
|
|
{
|
2013-07-08 07:57:23 +00:00
|
|
|
// If there is a net name - display it on the track
|
2014-02-25 10:47:27 +00:00
|
|
|
if( aTrack->GetNetCode() > NETINFO_LIST::UNCONNECTED )
|
2013-07-08 07:57:23 +00:00
|
|
|
{
|
|
|
|
VECTOR2D line = ( end - start );
|
|
|
|
double length = line.EuclideanNorm();
|
|
|
|
|
|
|
|
// Check if the track is long enough to have a netname displayed
|
|
|
|
if( length < 10 * width )
|
|
|
|
return;
|
|
|
|
|
2018-10-19 11:28:34 +00:00
|
|
|
const wxString& netName = UnescapeString( aTrack->GetShortNetname() );
|
2013-07-08 07:57:23 +00:00
|
|
|
VECTOR2D textPosition = start + line / 2.0; // center of the track
|
2018-01-07 15:00:29 +00:00
|
|
|
|
|
|
|
double textOrientation;
|
|
|
|
|
|
|
|
if( end.y == start.y ) // horizontal
|
|
|
|
textOrientation = 0;
|
|
|
|
else if( end.x == start.x ) // vertical
|
|
|
|
textOrientation = M_PI / 2;
|
|
|
|
else
|
|
|
|
textOrientation = -atan( line.y / line.x );
|
|
|
|
|
2016-05-03 13:15:08 +00:00
|
|
|
double textSize = width;
|
2013-07-08 07:57:23 +00:00
|
|
|
|
2016-05-03 12:40:47 +00:00
|
|
|
m_gal->SetIsStroke( true );
|
|
|
|
m_gal->SetIsFill( false );
|
2020-11-04 02:05:02 +00:00
|
|
|
m_gal->SetStrokeColor( m_pcbSettings.GetColor( aTrack, aLayer ) );
|
2013-07-08 07:57:23 +00:00
|
|
|
m_gal->SetLineWidth( width / 10.0 );
|
2016-05-02 13:56:12 +00:00
|
|
|
m_gal->SetFontBold( false );
|
|
|
|
m_gal->SetFontItalic( false );
|
2020-10-02 20:18:07 +00:00
|
|
|
m_gal->SetFontUnderlined( false );
|
2016-05-02 13:56:12 +00:00
|
|
|
m_gal->SetTextMirrored( false );
|
2013-07-08 07:57:23 +00:00
|
|
|
m_gal->SetGlyphSize( VECTOR2D( textSize * 0.7, textSize * 0.7 ) );
|
|
|
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
|
|
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
2016-05-02 14:04:45 +00:00
|
|
|
m_gal->BitmapText( netName, textPosition, textOrientation );
|
2013-07-08 07:57:23 +00:00
|
|
|
}
|
2013-04-08 08:54:31 +00:00
|
|
|
}
|
2014-02-24 11:56:47 +00:00
|
|
|
else if( IsCopperLayer( aLayer ) )
|
2013-04-08 08:54:31 +00:00
|
|
|
{
|
2013-07-08 07:57:23 +00:00
|
|
|
// Draw a regular track
|
2020-07-11 17:42:00 +00:00
|
|
|
COLOR4D color = m_pcbSettings.GetColor( aTrack, aLayer );
|
2019-01-20 09:03:15 +00:00
|
|
|
bool outline_mode = m_pcbSettings.m_sketchMode[LAYER_TRACKS];
|
2013-07-08 18:42:46 +00:00
|
|
|
m_gal->SetStrokeColor( color );
|
2019-01-20 09:03:15 +00:00
|
|
|
m_gal->SetFillColor( color );
|
|
|
|
m_gal->SetIsStroke( outline_mode );
|
|
|
|
m_gal->SetIsFill( not outline_mode );
|
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
2014-07-09 13:10:32 +00:00
|
|
|
|
2013-07-08 07:57:23 +00:00
|
|
|
m_gal->DrawSegment( start, end, width );
|
2017-01-24 16:58:11 +00:00
|
|
|
|
|
|
|
// Clearance lines
|
|
|
|
constexpr int clearanceFlags = PCB_RENDER_SETTINGS::CL_EXISTING | PCB_RENDER_SETTINGS::CL_TRACKS;
|
|
|
|
|
|
|
|
if( ( m_pcbSettings.m_clearance & clearanceFlags ) == clearanceFlags )
|
|
|
|
{
|
2020-10-12 17:40:03 +00:00
|
|
|
int clearance = aTrack->GetOwnClearance( m_pcbSettings.GetActiveLayer() );
|
2020-09-26 23:11:07 +00:00
|
|
|
|
2017-01-24 16:58:11 +00:00
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
|
|
|
m_gal->SetIsFill( false );
|
|
|
|
m_gal->SetIsStroke( true );
|
|
|
|
m_gal->SetStrokeColor( color );
|
2020-09-26 23:11:07 +00:00
|
|
|
m_gal->DrawSegment( start, end, width + clearance * 2 );
|
2017-01-24 16:58:11 +00:00
|
|
|
}
|
2013-07-08 07:57:23 +00:00
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-17 00:13:21 +00:00
|
|
|
void PCB_PAINTER::draw( const ARC* aArc, int aLayer )
|
|
|
|
{
|
|
|
|
VECTOR2D center( aArc->GetCenter() );
|
|
|
|
int width = aArc->GetWidth();
|
|
|
|
|
|
|
|
if( IsCopperLayer( aLayer ) )
|
|
|
|
{
|
|
|
|
// Draw a regular track
|
2020-07-11 17:42:00 +00:00
|
|
|
COLOR4D color = m_pcbSettings.GetColor( aArc, aLayer );
|
2019-05-17 00:13:21 +00:00
|
|
|
bool outline_mode = m_pcbSettings.m_sketchMode[LAYER_TRACKS];
|
|
|
|
m_gal->SetStrokeColor( color );
|
|
|
|
m_gal->SetFillColor( color );
|
|
|
|
m_gal->SetIsStroke( outline_mode );
|
|
|
|
m_gal->SetIsFill( not outline_mode );
|
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
|
|
|
|
|
|
|
auto radius = aArc->GetRadius();
|
|
|
|
auto start_angle = DECIDEG2RAD( aArc->GetArcAngleStart() );
|
|
|
|
auto angle = DECIDEG2RAD( aArc->GetAngle() );
|
|
|
|
|
|
|
|
m_gal->DrawArcSegment( center, radius, start_angle, start_angle + angle, width );
|
|
|
|
|
|
|
|
// Clearance lines
|
|
|
|
constexpr int clearanceFlags = PCB_RENDER_SETTINGS::CL_EXISTING | PCB_RENDER_SETTINGS::CL_TRACKS;
|
|
|
|
|
|
|
|
if( ( m_pcbSettings.m_clearance & clearanceFlags ) == clearanceFlags )
|
|
|
|
{
|
2020-10-23 12:42:48 +00:00
|
|
|
int clearance = aArc->GetOwnClearance( m_pcbSettings.GetActiveLayer() );
|
|
|
|
|
2019-05-17 00:13:21 +00:00
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
|
|
|
m_gal->SetIsFill( false );
|
|
|
|
m_gal->SetIsStroke( true );
|
|
|
|
m_gal->SetStrokeColor( color );
|
|
|
|
|
|
|
|
m_gal->DrawArcSegment( center, radius, start_angle, start_angle + angle,
|
2020-10-23 12:42:48 +00:00
|
|
|
width + clearance * 2 );
|
2019-05-17 00:13:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-25 06:00:04 +00:00
|
|
|
void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
|
|
|
VECTOR2D center( aVia->GetStart() );
|
2020-11-03 17:28:09 +00:00
|
|
|
double radius = 0.0;
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2017-04-25 09:47:21 +00:00
|
|
|
// Draw description layer
|
|
|
|
if( IsNetnameLayer( aLayer ) )
|
|
|
|
{
|
|
|
|
VECTOR2D position( center );
|
2017-04-22 15:45:03 +00:00
|
|
|
|
2017-04-25 09:47:21 +00:00
|
|
|
// Is anything that we can display enabled?
|
2020-10-13 02:47:20 +00:00
|
|
|
if( !m_pcbSettings.m_netNamesOnVias || aVia->GetNetname().empty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// We won't get CLEAR from GetColor below for a non-through via on an inactive layer in
|
|
|
|
// high contrast mode because LAYER_VIAS_NETNAMES will always be part of the high-contrast
|
|
|
|
// set. So we do another check here to prevent drawing netnames for these vias.
|
|
|
|
if( m_pcbSettings.GetHighContrast() )
|
2017-04-22 15:45:03 +00:00
|
|
|
{
|
2020-10-13 02:47:20 +00:00
|
|
|
bool draw = false;
|
2017-04-25 09:47:21 +00:00
|
|
|
|
2020-10-13 02:47:20 +00:00
|
|
|
for( unsigned int layer : m_pcbSettings.GetHighContrastLayers() )
|
|
|
|
{
|
|
|
|
if( aVia->IsOnLayer( static_cast<PCB_LAYER_ID>( layer ) ) )
|
|
|
|
{
|
|
|
|
draw = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-04-25 09:47:21 +00:00
|
|
|
|
2020-10-13 02:47:20 +00:00
|
|
|
if( !draw )
|
|
|
|
return;
|
|
|
|
}
|
2017-04-25 09:47:21 +00:00
|
|
|
|
2020-10-13 02:47:20 +00:00
|
|
|
double maxSize = PCB_RENDER_SETTINGS::MAX_FONT_SIZE;
|
|
|
|
double size = aVia->GetWidth();
|
2017-04-22 15:45:03 +00:00
|
|
|
|
2020-10-13 02:47:20 +00:00
|
|
|
// Font size limits
|
|
|
|
if( size > maxSize )
|
|
|
|
size = maxSize;
|
2017-04-25 09:47:21 +00:00
|
|
|
|
2020-10-13 02:47:20 +00:00
|
|
|
m_gal->Save();
|
|
|
|
m_gal->Translate( position );
|
2017-04-22 15:45:03 +00:00
|
|
|
|
2020-10-13 02:47:20 +00:00
|
|
|
// Default font settings
|
|
|
|
m_gal->ResetTextAttributes();
|
|
|
|
m_gal->SetStrokeColor( m_pcbSettings.GetColor( NULL, aLayer ) );
|
2017-04-22 15:45:03 +00:00
|
|
|
|
2020-10-13 02:47:20 +00:00
|
|
|
// Set the text position to the pad shape position (the pad position is not the best place)
|
|
|
|
VECTOR2D textpos( 0.0, 0.0 );
|
|
|
|
|
|
|
|
wxString netname = UnescapeString( aVia->GetShortNetname() );
|
|
|
|
// calculate the size of net name text:
|
|
|
|
double tsize = 1.5 * size / netname.Length();
|
|
|
|
tsize = std::min( tsize, size );
|
|
|
|
// Use a smaller text size to handle interline, pen size..
|
|
|
|
tsize *= 0.7;
|
|
|
|
VECTOR2D namesize( tsize, tsize );
|
|
|
|
|
|
|
|
m_gal->SetGlyphSize( namesize );
|
|
|
|
m_gal->SetLineWidth( namesize.x / 12.0 );
|
|
|
|
m_gal->BitmapText( netname, textpos, 0.0 );
|
|
|
|
|
|
|
|
m_gal->Restore();
|
2020-10-13 15:34:38 +00:00
|
|
|
|
|
|
|
return;
|
2017-04-25 09:47:21 +00:00
|
|
|
}
|
2020-11-03 17:28:09 +00:00
|
|
|
else if( aLayer == LAYER_VIAS_HOLES )
|
|
|
|
{
|
|
|
|
radius = getDrillSize( aVia ) / 2.0;
|
|
|
|
}
|
|
|
|
else if( ( aLayer == LAYER_VIA_THROUGH && aVia->GetViaType() == VIATYPE::THROUGH )
|
|
|
|
|| ( aLayer == LAYER_VIA_BBLIND && aVia->GetViaType() == VIATYPE::BLIND_BURIED )
|
|
|
|
|| ( aLayer == LAYER_VIA_MICROVIA && aVia->GetViaType() == VIATYPE::MICROVIA ) )
|
|
|
|
{
|
|
|
|
radius = aVia->GetWidth() / 2.0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2020-11-03 17:28:09 +00:00
|
|
|
/// Vias not connected to copper are optionally not drawn
|
|
|
|
/// We draw instead the hole size to ensure we show the proper clearance
|
|
|
|
if( IsCopperLayer( aLayer ) && !aVia->FlashLayer( aLayer ) )
|
2020-10-19 22:14:46 +00:00
|
|
|
radius = getDrillSize( aVia ) / 2.0 ;
|
2020-07-27 19:41:50 +00:00
|
|
|
|
2014-08-06 11:53:02 +00:00
|
|
|
bool sketchMode = false;
|
2020-07-11 17:42:00 +00:00
|
|
|
COLOR4D color = m_pcbSettings.GetColor( aVia, aLayer );
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2020-10-13 02:47:20 +00:00
|
|
|
if( color == COLOR4D::CLEAR )
|
|
|
|
return;
|
|
|
|
|
2014-08-06 11:53:02 +00:00
|
|
|
switch( aVia->GetViaType() )
|
2013-04-08 08:54:31 +00:00
|
|
|
{
|
2020-11-04 02:05:02 +00:00
|
|
|
case VIATYPE::THROUGH: sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_THROUGH]; break;
|
|
|
|
case VIATYPE::BLIND_BURIED: sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_BBLIND]; break;
|
|
|
|
case VIATYPE::MICROVIA: sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_MICROVIA]; break;
|
|
|
|
default: wxASSERT( false ); break;
|
2014-08-06 11:53:02 +00:00
|
|
|
}
|
|
|
|
|
2019-11-16 14:04:45 +00:00
|
|
|
m_gal->SetIsFill( !sketchMode );
|
|
|
|
m_gal->SetIsStroke( sketchMode );
|
|
|
|
|
|
|
|
if( sketchMode )
|
|
|
|
{
|
|
|
|
// Outline mode
|
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
|
|
|
m_gal->SetStrokeColor( color );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Filled mode
|
|
|
|
m_gal->SetFillColor( color );
|
|
|
|
}
|
|
|
|
|
2020-05-11 14:21:39 +00:00
|
|
|
if( ( aVia->GetViaType() == VIATYPE::BLIND_BURIED || aVia->GetViaType() == VIATYPE::MICROVIA )
|
|
|
|
&& aLayer != LAYER_VIAS_HOLES
|
2020-04-20 16:00:00 +00:00
|
|
|
&& !m_pcbSettings.GetDrawIndividualViaLayers() )
|
2014-08-06 11:53:02 +00:00
|
|
|
{
|
2020-05-11 14:21:39 +00:00
|
|
|
// Outer circles of blind/buried and micro-vias are drawn in a special way to indicate the
|
2019-11-18 23:42:39 +00:00
|
|
|
// top and bottom layers
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID layerTop, layerBottom;
|
2014-08-06 11:53:02 +00:00
|
|
|
aVia->LayerPair( &layerTop, &layerBottom );
|
|
|
|
|
2019-11-18 23:42:39 +00:00
|
|
|
if( !sketchMode )
|
2019-11-16 14:04:45 +00:00
|
|
|
m_gal->SetLineWidth( ( aVia->GetWidth() - aVia->GetDrillValue() ) / 2.0 );
|
2014-11-14 19:19:00 +00:00
|
|
|
|
2020-11-03 17:28:09 +00:00
|
|
|
m_gal->DrawArc( center, radius, M_PI / 2.0, M_PI );
|
|
|
|
m_gal->DrawArc( center, radius, 3.0 * M_PI / 2.0, 2.0 * M_PI );
|
2014-08-06 11:53:02 +00:00
|
|
|
|
2020-11-03 17:28:09 +00:00
|
|
|
if( sketchMode )
|
|
|
|
m_gal->SetStrokeColor( m_pcbSettings.GetColor( aVia, layerTop ) );
|
|
|
|
else
|
|
|
|
m_gal->SetFillColor( m_pcbSettings.GetColor( aVia, layerTop ) );
|
2019-11-16 14:04:45 +00:00
|
|
|
|
2020-11-03 17:28:09 +00:00
|
|
|
m_gal->DrawArc( center, radius, 0.0, M_PI / 2.0 );
|
|
|
|
|
|
|
|
if( sketchMode )
|
|
|
|
m_gal->SetStrokeColor( m_pcbSettings.GetColor( aVia, layerBottom ) );
|
|
|
|
else
|
|
|
|
m_gal->SetFillColor( m_pcbSettings.GetColor( aVia, layerBottom ) );
|
|
|
|
|
|
|
|
m_gal->DrawArc( center, radius, M_PI, 3.0 * M_PI / 2.0 );
|
2013-04-08 08:54:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-04-20 16:00:00 +00:00
|
|
|
// Draw the outer circles of normal vias and the holes for all vias
|
2013-04-08 08:54:31 +00:00
|
|
|
m_gal->DrawCircle( center, radius );
|
|
|
|
}
|
2017-01-24 16:58:11 +00:00
|
|
|
|
|
|
|
// Clearance lines
|
|
|
|
constexpr int clearanceFlags = PCB_RENDER_SETTINGS::CL_EXISTING | PCB_RENDER_SETTINGS::CL_VIAS;
|
|
|
|
|
|
|
|
if( ( m_pcbSettings.m_clearance & clearanceFlags ) == clearanceFlags
|
2017-03-13 03:19:33 +00:00
|
|
|
&& aLayer != LAYER_VIAS_HOLES )
|
2017-01-24 16:58:11 +00:00
|
|
|
{
|
2020-10-12 17:40:03 +00:00
|
|
|
PCB_LAYER_ID activeLayer = m_pcbSettings.GetActiveLayer();
|
|
|
|
|
|
|
|
if( !aVia->FlashLayer( activeLayer ) )
|
2020-10-03 12:44:38 +00:00
|
|
|
{
|
2020-10-12 17:40:03 +00:00
|
|
|
radius = getDrillSize( aVia ) / 2.0 +
|
2020-10-03 12:44:38 +00:00
|
|
|
aVia->GetBoard()->GetDesignSettings().GetHolePlatingThickness();
|
|
|
|
}
|
|
|
|
|
2017-01-24 16:58:11 +00:00
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
|
|
|
m_gal->SetIsFill( false );
|
|
|
|
m_gal->SetIsStroke( true );
|
|
|
|
m_gal->SetStrokeColor( color );
|
2020-10-12 17:40:03 +00:00
|
|
|
m_gal->DrawCircle( center, radius + aVia->GetOwnClearance( activeLayer ) );
|
2017-01-24 16:58:11 +00:00
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
2013-07-08 09:30:50 +00:00
|
|
|
// Draw description layer
|
2013-07-16 11:40:53 +00:00
|
|
|
if( IsNetnameLayer( aLayer ) )
|
2013-07-08 09:30:50 +00:00
|
|
|
{
|
2013-07-17 11:38:56 +00:00
|
|
|
// Is anything that we can display enabled?
|
2014-05-21 21:13:30 +00:00
|
|
|
if( m_pcbSettings.m_netNamesOnPads || m_pcbSettings.m_padNumbers )
|
2013-07-08 11:57:09 +00:00
|
|
|
{
|
2020-08-23 17:11:47 +00:00
|
|
|
bool displayNetname = ( m_pcbSettings.m_netNamesOnPads && !aPad->GetNetname().empty() );
|
|
|
|
EDA_RECT padBBox = aPad->GetBoundingBox();
|
2020-06-29 11:48:55 +00:00
|
|
|
VECTOR2D position = padBBox.Centre();
|
|
|
|
VECTOR2D padsize = VECTOR2D( padBBox.GetSize() );
|
2020-08-04 16:53:36 +00:00
|
|
|
|
|
|
|
if( aPad->GetShape() != PAD_SHAPE_CUSTOM )
|
|
|
|
{
|
|
|
|
// Don't allow a 45º rotation to bloat a pad's bounding box unnecessarily
|
|
|
|
double limit = std::min( aPad->GetSize().x, aPad->GetSize().y ) * 1.1;
|
|
|
|
|
|
|
|
if( padsize.x > limit && padsize.y > limit )
|
|
|
|
{
|
|
|
|
padsize.x = limit;
|
|
|
|
padsize.y = limit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-03 14:06:16 +00:00
|
|
|
double maxSize = PCB_RENDER_SETTINGS::MAX_FONT_SIZE;
|
2013-11-04 17:18:19 +00:00
|
|
|
double size = padsize.y;
|
2013-07-17 11:38:56 +00:00
|
|
|
|
2020-06-29 11:48:55 +00:00
|
|
|
m_gal->Save();
|
|
|
|
m_gal->Translate( position );
|
|
|
|
|
2013-07-17 11:38:56 +00:00
|
|
|
// Keep the size ratio for the font, but make it smaller
|
2013-11-03 14:06:16 +00:00
|
|
|
if( padsize.x < padsize.y )
|
2013-07-17 11:38:56 +00:00
|
|
|
{
|
2020-06-29 11:48:55 +00:00
|
|
|
m_gal->Rotate( DECIDEG2RAD( -900.0 ) );
|
2013-11-04 17:18:19 +00:00
|
|
|
size = padsize.x;
|
2015-06-26 13:41:56 +00:00
|
|
|
std::swap( padsize.x, padsize.y );
|
2013-07-17 11:38:56 +00:00
|
|
|
}
|
2013-07-08 09:30:50 +00:00
|
|
|
|
2013-11-03 14:06:16 +00:00
|
|
|
// Font size limits
|
2013-11-04 17:18:19 +00:00
|
|
|
if( size > maxSize )
|
|
|
|
size = maxSize;
|
2013-11-03 14:06:16 +00:00
|
|
|
|
2013-07-17 11:38:56 +00:00
|
|
|
// Default font settings
|
|
|
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
|
|
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
2016-05-02 13:56:12 +00:00
|
|
|
m_gal->SetFontBold( false );
|
|
|
|
m_gal->SetFontItalic( false );
|
2020-10-02 20:18:07 +00:00
|
|
|
m_gal->SetFontUnderlined( false );
|
2016-05-02 13:56:12 +00:00
|
|
|
m_gal->SetTextMirrored( false );
|
2020-11-04 12:30:12 +00:00
|
|
|
m_gal->SetStrokeColor( m_pcbSettings.GetColor( aPad, aLayer ) );
|
2016-05-03 12:40:47 +00:00
|
|
|
m_gal->SetIsStroke( true );
|
|
|
|
m_gal->SetIsFill( false );
|
2013-07-08 09:30:50 +00:00
|
|
|
|
2020-06-29 11:48:55 +00:00
|
|
|
// We have already translated the GAL to be centered at the center of the pad's
|
|
|
|
// bounding box
|
2016-05-28 19:51:35 +00:00
|
|
|
VECTOR2D textpos( 0.0, 0.0 );
|
2013-11-04 17:18:19 +00:00
|
|
|
|
2020-06-29 11:48:55 +00:00
|
|
|
// Divide the space, to display both pad numbers and netnames and set the Y text
|
|
|
|
// position to display 2 lines
|
2014-05-21 21:13:30 +00:00
|
|
|
if( displayNetname && m_pcbSettings.m_padNumbers )
|
2013-07-17 11:38:56 +00:00
|
|
|
{
|
|
|
|
size = size / 2.0;
|
2013-11-04 17:18:19 +00:00
|
|
|
textpos.y = size / 2.0;
|
|
|
|
}
|
2013-11-03 14:06:16 +00:00
|
|
|
|
2013-11-04 17:18:19 +00:00
|
|
|
if( displayNetname )
|
|
|
|
{
|
2020-08-23 17:11:47 +00:00
|
|
|
wxString netname = UnescapeString( aPad->GetShortNetname() );
|
2020-12-04 16:57:19 +00:00
|
|
|
|
|
|
|
if( netname.StartsWith( "no_connect_" ) )
|
|
|
|
netname = "x";
|
|
|
|
|
2013-11-04 17:18:19 +00:00
|
|
|
// calculate the size of net name text:
|
2018-10-19 11:28:34 +00:00
|
|
|
double tsize = 1.5 * padsize.x / netname.Length();
|
2013-11-04 17:18:19 +00:00
|
|
|
tsize = std::min( tsize, size );
|
|
|
|
// Use a smaller text size to handle interline, pen size..
|
|
|
|
tsize *= 0.7;
|
|
|
|
VECTOR2D namesize( tsize, tsize );
|
2016-05-02 14:04:45 +00:00
|
|
|
|
2013-11-03 14:06:16 +00:00
|
|
|
m_gal->SetGlyphSize( namesize );
|
2013-11-04 17:18:19 +00:00
|
|
|
m_gal->SetLineWidth( namesize.x / 12.0 );
|
2018-10-19 11:28:34 +00:00
|
|
|
m_gal->BitmapText( netname, textpos, 0.0 );
|
2013-11-04 17:18:19 +00:00
|
|
|
}
|
|
|
|
|
2014-05-21 21:13:30 +00:00
|
|
|
if( m_pcbSettings.m_padNumbers )
|
2013-11-04 17:18:19 +00:00
|
|
|
{
|
2020-08-23 17:11:47 +00:00
|
|
|
const wxString& padName = aPad->GetName();
|
2013-11-04 17:18:19 +00:00
|
|
|
textpos.y = -textpos.y;
|
2017-08-10 15:00:28 +00:00
|
|
|
double tsize = 1.5 * padsize.x / padName.Length();
|
2013-11-04 17:18:19 +00:00
|
|
|
tsize = std::min( tsize, size );
|
|
|
|
// Use a smaller text size to handle interline, pen size..
|
|
|
|
tsize *= 0.7;
|
|
|
|
tsize = std::min( tsize, size );
|
|
|
|
VECTOR2D numsize( tsize, tsize );
|
2013-11-03 14:06:16 +00:00
|
|
|
|
|
|
|
m_gal->SetGlyphSize( numsize );
|
2013-11-04 17:18:19 +00:00
|
|
|
m_gal->SetLineWidth( numsize.x / 12.0 );
|
2017-08-10 15:00:28 +00:00
|
|
|
m_gal->BitmapText( padName, textpos, 0.0 );
|
2013-07-17 11:38:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_gal->Restore();
|
|
|
|
}
|
2013-07-08 09:30:50 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-08-07 07:51:39 +00:00
|
|
|
// Pad drawing
|
2020-10-13 10:55:24 +00:00
|
|
|
BOARD_DESIGN_SETTINGS& bds = aPad->GetBoard()->GetDesignSettings();
|
2020-11-25 15:45:00 +00:00
|
|
|
COLOR4D color = m_pcbSettings.GetColor( aPad, aLayer );
|
2017-01-24 16:58:11 +00:00
|
|
|
|
2017-11-29 08:48:41 +00:00
|
|
|
if( m_pcbSettings.m_sketchMode[LAYER_PADS_TH] )
|
2013-04-08 08:54:31 +00:00
|
|
|
{
|
|
|
|
// Outline mode
|
|
|
|
m_gal->SetIsFill( false );
|
|
|
|
m_gal->SetIsStroke( true );
|
2014-05-21 21:13:30 +00:00
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
2013-04-08 08:54:31 +00:00
|
|
|
m_gal->SetStrokeColor( color );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Filled mode
|
|
|
|
m_gal->SetIsFill( true );
|
|
|
|
m_gal->SetIsStroke( false );
|
|
|
|
m_gal->SetFillColor( color );
|
|
|
|
}
|
|
|
|
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
// Choose drawing settings depending on if we are drawing a pad itself or a hole
|
2017-11-29 08:48:41 +00:00
|
|
|
if( aLayer == LAYER_PADS_PLATEDHOLES || aLayer == LAYER_NON_PLATEDHOLES )
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
2020-08-23 17:11:47 +00:00
|
|
|
const SHAPE_SEGMENT* seg = aPad->GetEffectiveHoleShape();
|
2020-07-31 08:54:53 +00:00
|
|
|
|
|
|
|
if( seg->GetSeg().A == seg->GetSeg().B ) // Circular hole
|
2020-10-19 22:14:46 +00:00
|
|
|
m_gal->DrawCircle( seg->GetSeg().A, getDrillSize( aPad ).x / 2 );
|
2020-07-31 08:54:53 +00:00
|
|
|
else
|
|
|
|
m_gal->DrawSegment( seg->GetSeg().A, seg->GetSeg().B, seg->GetWidth() );
|
2019-06-20 22:37:41 +00:00
|
|
|
}
|
2020-11-25 15:45:00 +00:00
|
|
|
else if( aLayer == LAYER_PADS_TH
|
|
|
|
&& aPad->GetSizeX() <= aPad->GetDrillSizeX()
|
|
|
|
&& aPad->GetSizeY() <= aPad->GetDrillSizeY() )
|
|
|
|
{
|
|
|
|
// no annular ring to draw
|
|
|
|
}
|
2019-06-20 22:37:41 +00:00
|
|
|
else
|
2016-04-06 18:15:49 +00:00
|
|
|
{
|
2020-08-23 17:11:47 +00:00
|
|
|
wxSize pad_size = aPad->GetSize();
|
2020-06-22 19:35:09 +00:00
|
|
|
wxSize margin;
|
2017-01-13 17:51:22 +00:00
|
|
|
|
2019-06-20 22:37:41 +00:00
|
|
|
switch( aLayer )
|
2017-01-13 17:51:22 +00:00
|
|
|
{
|
2019-06-20 22:37:41 +00:00
|
|
|
case F_Mask:
|
|
|
|
case B_Mask:
|
2020-08-23 17:11:47 +00:00
|
|
|
margin.x = margin.y = aPad->GetSolderMaskMargin();
|
2019-06-20 22:37:41 +00:00
|
|
|
break;
|
2013-09-03 11:51:53 +00:00
|
|
|
|
2019-06-20 22:37:41 +00:00
|
|
|
case F_Paste:
|
|
|
|
case B_Paste:
|
2020-08-23 17:11:47 +00:00
|
|
|
margin = aPad->GetSolderPasteMargin();
|
2019-06-20 22:37:41 +00:00
|
|
|
break;
|
2013-09-03 11:51:53 +00:00
|
|
|
|
2019-06-20 22:37:41 +00:00
|
|
|
default:
|
2020-06-22 19:35:09 +00:00
|
|
|
margin.x = margin.y = 0;
|
2019-06-20 22:37:41 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-06-22 19:35:09 +00:00
|
|
|
|
|
|
|
if( margin.x != margin.y )
|
|
|
|
{
|
2020-11-12 22:30:02 +00:00
|
|
|
const_cast<PAD*>( aPad )->SetSize( pad_size + margin + margin );
|
2020-06-22 19:35:09 +00:00
|
|
|
margin.x = margin.y = 0;
|
2020-09-22 13:53:53 +00:00
|
|
|
}
|
2020-09-19 05:32:22 +00:00
|
|
|
|
2020-09-22 13:53:53 +00:00
|
|
|
// Once we change the size of the pad, check that there is still a pad remaining
|
|
|
|
if( !aPad->GetSize().x || !aPad->GetSize().y )
|
|
|
|
{
|
|
|
|
// Reset the stored pad size
|
|
|
|
if( aPad->GetSize() != pad_size )
|
2020-11-12 22:30:02 +00:00
|
|
|
const_cast<PAD*>( aPad )->SetSize( pad_size );
|
2020-09-22 13:53:53 +00:00
|
|
|
|
|
|
|
return;
|
2020-06-22 19:35:09 +00:00
|
|
|
}
|
|
|
|
|
2020-10-03 12:44:38 +00:00
|
|
|
auto shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape() );
|
2020-10-14 14:55:06 +00:00
|
|
|
bool simpleShapes = true;
|
2020-06-22 19:35:09 +00:00
|
|
|
|
2020-10-14 14:55:06 +00:00
|
|
|
for( SHAPE* shape : shapes->Shapes() )
|
2020-06-22 19:35:09 +00:00
|
|
|
{
|
2020-10-14 14:55:06 +00:00
|
|
|
// Drawing components of compound shapes in outline mode produces a mess.
|
|
|
|
if( m_pcbSettings.m_sketchMode[LAYER_PADS_TH] )
|
|
|
|
simpleShapes = false;
|
|
|
|
|
|
|
|
if( !simpleShapes )
|
|
|
|
break;
|
|
|
|
|
|
|
|
switch( shape->Type() )
|
|
|
|
{
|
|
|
|
case SH_SEGMENT:
|
|
|
|
case SH_CIRCLE:
|
|
|
|
case SH_RECT:
|
|
|
|
case SH_SIMPLE:
|
|
|
|
// OK so far
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
// Not OK
|
|
|
|
simpleShapes = false;
|
|
|
|
break;
|
|
|
|
}
|
2020-06-22 19:35:09 +00:00
|
|
|
}
|
2020-10-14 14:55:06 +00:00
|
|
|
|
|
|
|
if( simpleShapes )
|
2020-06-22 19:35:09 +00:00
|
|
|
{
|
2020-10-14 14:55:06 +00:00
|
|
|
for( SHAPE* shape : shapes->Shapes() )
|
|
|
|
{
|
|
|
|
switch( shape->Type() )
|
|
|
|
{
|
|
|
|
case SH_SEGMENT:
|
|
|
|
{
|
|
|
|
const SHAPE_SEGMENT* seg = (SHAPE_SEGMENT*) shape;
|
|
|
|
m_gal->DrawSegment( seg->GetSeg().A, seg->GetSeg().B,
|
|
|
|
seg->GetWidth() + 2 * margin.x );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SH_CIRCLE:
|
|
|
|
{
|
|
|
|
const SHAPE_CIRCLE* circle = (SHAPE_CIRCLE*) shape;
|
|
|
|
m_gal->DrawCircle( circle->GetCenter(), circle->GetRadius() + margin.x );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SH_RECT:
|
|
|
|
{
|
|
|
|
const SHAPE_RECT* r = (SHAPE_RECT*) shape;
|
|
|
|
|
2020-12-05 10:51:08 +00:00
|
|
|
// At this point, if margin.x < 0 the actual rectangle size is
|
|
|
|
// smaller than SHAPE_RECT r (the pad size was not modifed)
|
|
|
|
if( margin.x < 0 )
|
|
|
|
m_gal->DrawRectangle( r->GetPosition() - margin,
|
|
|
|
r->GetPosition() + r->GetSize() + margin );
|
|
|
|
else
|
|
|
|
m_gal->DrawRectangle( r->GetPosition(), r->GetPosition() + r->GetSize() );
|
|
|
|
|
|
|
|
if( margin.x > 0 ) // We draw a roudned rect shape
|
2020-10-14 14:55:06 +00:00
|
|
|
{
|
|
|
|
m_gal->DrawSegment( r->GetPosition(),
|
|
|
|
r->GetPosition() + VECTOR2I( r->GetWidth(), 0 ),
|
|
|
|
margin.x * 2 );
|
|
|
|
m_gal->DrawSegment( r->GetPosition() + VECTOR2I( r->GetWidth(), 0 ),
|
|
|
|
r->GetPosition() + r->GetSize(),
|
|
|
|
margin.x * 2 );
|
|
|
|
m_gal->DrawSegment( r->GetPosition() + r->GetSize(),
|
|
|
|
r->GetPosition() + VECTOR2I( 0, r->GetHeight() ),
|
|
|
|
margin.x * 2 );
|
|
|
|
m_gal->DrawSegment( r->GetPosition() + VECTOR2I( 0, r->GetHeight() ),
|
|
|
|
r->GetPosition(),
|
|
|
|
margin.x * 2 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SH_SIMPLE:
|
|
|
|
{
|
|
|
|
const SHAPE_SIMPLE* poly = static_cast<const SHAPE_SIMPLE*>( shape );
|
|
|
|
m_gal->DrawPolygon( poly->Vertices() );
|
|
|
|
|
|
|
|
if( margin.x > 0 )
|
|
|
|
{
|
|
|
|
for( size_t ii = 0; ii < poly->GetSegmentCount(); ++ii )
|
|
|
|
{
|
|
|
|
SEG seg = poly->GetSegment( ii );
|
|
|
|
m_gal->DrawSegment( seg.A, seg.B, margin.x * 2 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
// Better not get here; we already pre-flighted the shapes...
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-06-22 19:35:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-14 14:55:06 +00:00
|
|
|
// This is expensive. Avoid if possible.
|
|
|
|
|
2020-06-22 19:35:09 +00:00
|
|
|
SHAPE_POLY_SET polySet;
|
2020-10-13 10:55:24 +00:00
|
|
|
aPad->TransformShapeWithClearanceToPolygon( polySet, ToLAYER_ID( aLayer ), margin.x,
|
|
|
|
bds.m_MaxError, ERROR_INSIDE );
|
2020-06-22 19:35:09 +00:00
|
|
|
m_gal->DrawPolygon( polySet );
|
|
|
|
}
|
|
|
|
|
2020-08-23 17:11:47 +00:00
|
|
|
if( aPad->GetSize() != pad_size )
|
2020-11-12 22:30:02 +00:00
|
|
|
const_cast<PAD*>( aPad )->SetSize( pad_size );
|
2013-09-03 11:51:53 +00:00
|
|
|
}
|
2017-01-24 16:58:11 +00:00
|
|
|
|
2020-06-21 17:47:26 +00:00
|
|
|
// Clearance outlines
|
2019-06-20 22:37:41 +00:00
|
|
|
constexpr int clearanceFlags = PCB_RENDER_SETTINGS::CL_PADS;
|
2017-01-24 16:58:11 +00:00
|
|
|
|
|
|
|
if( ( m_pcbSettings.m_clearance & clearanceFlags ) == clearanceFlags
|
2020-10-03 12:44:38 +00:00
|
|
|
&& ( aLayer == LAYER_PAD_FR || aLayer == LAYER_PAD_BK || aLayer == LAYER_PADS_TH ) )
|
2017-01-24 16:58:11 +00:00
|
|
|
{
|
2020-10-14 14:55:06 +00:00
|
|
|
bool flashActiveLayer = aPad->FlashLayer( m_pcbSettings.GetActiveLayer() );
|
2020-09-27 20:32:42 +00:00
|
|
|
|
2020-10-14 14:55:06 +00:00
|
|
|
if( flashActiveLayer || aPad->GetDrillSize().x )
|
2020-10-03 12:44:38 +00:00
|
|
|
{
|
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
|
|
|
m_gal->SetIsStroke( true );
|
|
|
|
m_gal->SetIsFill( false );
|
|
|
|
m_gal->SetStrokeColor( color );
|
2020-06-21 17:47:26 +00:00
|
|
|
|
2020-10-12 17:40:03 +00:00
|
|
|
int clearance = aPad->GetOwnClearance( m_pcbSettings.GetActiveLayer() );
|
2020-10-03 12:44:38 +00:00
|
|
|
|
2020-10-22 10:56:30 +00:00
|
|
|
if( flashActiveLayer && clearance > 0 )
|
2020-10-03 12:44:38 +00:00
|
|
|
{
|
|
|
|
auto shape = std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape() );
|
|
|
|
|
|
|
|
if( shape && shape->Size() == 1 && shape->Shapes()[0]->Type() == SH_SEGMENT )
|
|
|
|
{
|
|
|
|
const SHAPE_SEGMENT* seg = (SHAPE_SEGMENT*) shape->Shapes()[0];
|
|
|
|
m_gal->DrawSegment( seg->GetSeg().A, seg->GetSeg().B,
|
|
|
|
seg->GetWidth() + 2 * clearance );
|
|
|
|
}
|
|
|
|
else if( shape && shape->Size() == 1 && shape->Shapes()[0]->Type() == SH_CIRCLE )
|
|
|
|
{
|
|
|
|
const SHAPE_CIRCLE* circle = (SHAPE_CIRCLE*) shape->Shapes()[0];
|
|
|
|
m_gal->DrawCircle( circle->GetCenter(), circle->GetRadius() + clearance );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SHAPE_POLY_SET polySet;
|
|
|
|
aPad->TransformShapeWithClearanceToPolygon( polySet, ToLAYER_ID( aLayer ),
|
2020-10-13 10:55:24 +00:00
|
|
|
clearance,
|
|
|
|
bds.m_MaxError, ERROR_OUTSIDE );
|
2020-10-03 12:44:38 +00:00
|
|
|
m_gal->DrawPolygon( polySet );
|
|
|
|
}
|
|
|
|
}
|
2020-10-22 10:56:30 +00:00
|
|
|
else if( aPad->GetEffectiveHoleShape() && clearance > 0 )
|
2020-10-03 12:44:38 +00:00
|
|
|
{
|
2020-10-13 10:55:24 +00:00
|
|
|
clearance += bds.GetHolePlatingThickness();
|
2020-10-03 12:44:38 +00:00
|
|
|
|
|
|
|
const SHAPE_SEGMENT* seg = aPad->GetEffectiveHoleShape();
|
|
|
|
m_gal->DrawSegment( seg->GetSeg().A, seg->GetSeg().B,
|
|
|
|
seg->GetWidth() + 2 * clearance );
|
|
|
|
}
|
2020-06-21 17:47:26 +00:00
|
|
|
}
|
2017-01-24 16:58:11 +00:00
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-04 23:34:59 +00:00
|
|
|
void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
2020-10-04 23:34:59 +00:00
|
|
|
const COLOR4D& color = m_pcbSettings.GetColor( aShape, aShape->GetLayer() );
|
2020-11-14 01:16:02 +00:00
|
|
|
bool sketch = m_pcbSettings.m_sketchGraphics;
|
|
|
|
int thickness = getLineThickness( aShape->GetWidth() );
|
|
|
|
VECTOR2D start( aShape->GetStart() );
|
|
|
|
VECTOR2D end( aShape->GetEnd() );
|
|
|
|
|
|
|
|
if( sketch )
|
|
|
|
{
|
|
|
|
m_gal->SetIsFill( false );
|
|
|
|
m_gal->SetIsStroke( true );
|
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
|
|
|
}
|
2014-07-09 13:10:32 +00:00
|
|
|
|
2017-03-10 12:47:39 +00:00
|
|
|
m_gal->SetFillColor( color );
|
|
|
|
m_gal->SetStrokeColor( color );
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2020-10-04 23:34:59 +00:00
|
|
|
switch( aShape->GetShape() )
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
|
|
|
case S_SEGMENT:
|
2020-11-14 01:16:02 +00:00
|
|
|
if( sketch )
|
|
|
|
{
|
|
|
|
m_gal->DrawSegment( start, end, thickness );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_gal->SetIsFill( true );
|
|
|
|
m_gal->SetIsStroke( false );
|
|
|
|
|
|
|
|
m_gal->DrawSegment( start, end, thickness );
|
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case S_RECT:
|
2020-06-15 19:50:20 +00:00
|
|
|
{
|
2020-10-04 23:34:59 +00:00
|
|
|
std::vector<wxPoint> pts = aShape->GetRectCorners();
|
2020-06-15 19:50:20 +00:00
|
|
|
|
2020-11-14 01:16:02 +00:00
|
|
|
if( sketch )
|
2020-06-19 20:46:43 +00:00
|
|
|
{
|
2020-11-14 01:16:02 +00:00
|
|
|
m_gal->DrawSegment( pts[0], pts[1], thickness );
|
|
|
|
m_gal->DrawSegment( pts[1], pts[2], thickness );
|
|
|
|
m_gal->DrawSegment( pts[2], pts[3], thickness );
|
|
|
|
m_gal->DrawSegment( pts[3], pts[0], thickness );
|
2020-06-19 20:46:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-14 01:16:02 +00:00
|
|
|
m_gal->SetIsFill( true );
|
|
|
|
m_gal->SetIsStroke( false );
|
|
|
|
|
|
|
|
if( thickness > 0 )
|
|
|
|
{
|
|
|
|
m_gal->DrawSegment( pts[0], pts[1], thickness );
|
|
|
|
m_gal->DrawSegment( pts[1], pts[2], thickness );
|
|
|
|
m_gal->DrawSegment( pts[2], pts[3], thickness );
|
|
|
|
m_gal->DrawSegment( pts[3], pts[0], thickness );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aShape->IsFilled() )
|
|
|
|
{
|
|
|
|
SHAPE_POLY_SET poly;
|
|
|
|
poly.NewOutline();
|
2020-06-19 20:46:43 +00:00
|
|
|
|
2020-11-14 01:16:02 +00:00
|
|
|
for( const wxPoint& pt : pts )
|
|
|
|
poly.Append( pt );
|
2020-06-19 20:46:43 +00:00
|
|
|
|
2020-11-14 01:16:02 +00:00
|
|
|
m_gal->DrawPolygon( poly );
|
|
|
|
}
|
2020-06-19 20:46:43 +00:00
|
|
|
}
|
2020-06-15 19:50:20 +00:00
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case S_ARC:
|
2020-11-14 01:16:02 +00:00
|
|
|
if( sketch )
|
|
|
|
{
|
|
|
|
m_gal->DrawArcSegment( start, aShape->GetRadius(),
|
|
|
|
DECIDEG2RAD( aShape->GetArcAngleStart() ),
|
|
|
|
DECIDEG2RAD( aShape->GetArcAngleStart() + aShape->GetAngle() ), // Change this
|
|
|
|
thickness );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_gal->SetIsFill( true );
|
|
|
|
m_gal->SetIsStroke( false );
|
|
|
|
|
|
|
|
m_gal->DrawArcSegment( start, aShape->GetRadius(),
|
|
|
|
DECIDEG2RAD( aShape->GetArcAngleStart() ),
|
|
|
|
DECIDEG2RAD( aShape->GetArcAngleStart() + aShape->GetAngle() ), // Change this
|
|
|
|
thickness );
|
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case S_CIRCLE:
|
2017-03-10 12:47:39 +00:00
|
|
|
if( sketch )
|
|
|
|
{
|
2020-10-04 23:34:59 +00:00
|
|
|
m_gal->DrawCircle( start, aShape->GetRadius() - thickness / 2 );
|
|
|
|
m_gal->DrawCircle( start, aShape->GetRadius() + thickness / 2 );
|
2017-03-10 12:47:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-14 01:16:02 +00:00
|
|
|
m_gal->SetIsFill( aShape->IsFilled() );
|
|
|
|
m_gal->SetIsStroke( thickness > 0 );
|
2017-03-10 12:47:39 +00:00
|
|
|
m_gal->SetLineWidth( thickness );
|
2020-11-14 01:16:02 +00:00
|
|
|
|
2020-10-04 23:34:59 +00:00
|
|
|
m_gal->DrawCircle( start, aShape->GetRadius() );
|
2017-03-10 12:47:39 +00:00
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case S_POLYGON:
|
2013-07-31 09:36:46 +00:00
|
|
|
{
|
2020-10-04 23:34:59 +00:00
|
|
|
SHAPE_POLY_SET& shape = const_cast<PCB_SHAPE*>( aShape )->GetPolyShape();
|
2020-11-14 13:20:13 +00:00
|
|
|
FOOTPRINT* parentFootprint = aShape->GetParentFootprint();
|
2013-07-31 09:36:46 +00:00
|
|
|
|
2018-12-02 17:00:33 +00:00
|
|
|
if( shape.OutlineCount() == 0 )
|
2017-07-28 08:34:45 +00:00
|
|
|
break;
|
|
|
|
|
2020-11-14 13:20:13 +00:00
|
|
|
if( parentFootprint )
|
|
|
|
{
|
|
|
|
m_gal->Save();
|
|
|
|
m_gal->Translate( parentFootprint->GetPosition() );
|
|
|
|
m_gal->Rotate( -parentFootprint->GetOrientationRadians() );
|
|
|
|
}
|
|
|
|
|
2020-11-14 01:16:02 +00:00
|
|
|
if( sketch )
|
2018-12-02 17:00:33 +00:00
|
|
|
{
|
2020-11-14 01:16:02 +00:00
|
|
|
for( int ii = 0; ii < shape.Outline( 0 ).SegmentCount(); ++ii )
|
|
|
|
{
|
|
|
|
SEG seg = shape.Outline( 0 ).Segment( ii );
|
|
|
|
m_gal->DrawSegment( seg.A, seg.B, thickness );
|
|
|
|
}
|
2018-12-02 17:00:33 +00:00
|
|
|
}
|
2020-11-14 01:16:02 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
m_gal->SetIsFill( true );
|
|
|
|
m_gal->SetIsStroke( false );
|
2018-12-17 13:34:56 +00:00
|
|
|
|
2020-11-14 01:16:02 +00:00
|
|
|
if( thickness > 0 )
|
|
|
|
{
|
|
|
|
for( int ii = 0; ii < shape.Outline( 0 ).SegmentCount(); ++ii )
|
|
|
|
{
|
|
|
|
SEG seg = shape.Outline( 0 ).Segment( ii );
|
|
|
|
m_gal->DrawSegment( seg.A, seg.B, thickness );
|
|
|
|
}
|
|
|
|
}
|
2013-07-31 09:36:46 +00:00
|
|
|
|
2020-11-14 01:16:02 +00:00
|
|
|
if( aShape->IsFilled() )
|
|
|
|
{
|
|
|
|
// On Opengl, a not convex filled polygon is usually drawn by using triangles
|
|
|
|
// as primitives. CacheTriangulation() can create basic triangle primitives to
|
|
|
|
// draw the polygon solid shape on Opengl. GLU tesselation is much slower, so
|
|
|
|
// currently we are using our tesselation.
|
|
|
|
if( m_gal->IsOpenGlEngine() && !shape.IsTriangulationUpToDate() )
|
|
|
|
shape.CacheTriangulation();
|
2017-12-22 11:26:24 +00:00
|
|
|
|
2020-11-14 01:16:02 +00:00
|
|
|
m_gal->DrawPolygon( shape );
|
|
|
|
}
|
|
|
|
}
|
2013-07-31 09:36:46 +00:00
|
|
|
|
2020-11-14 13:20:13 +00:00
|
|
|
if( parentFootprint )
|
|
|
|
m_gal->Restore();
|
2013-07-31 09:36:46 +00:00
|
|
|
}
|
2020-11-14 13:20:13 +00:00
|
|
|
break;
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
|
|
|
case S_CURVE:
|
2020-11-14 01:16:02 +00:00
|
|
|
if( sketch )
|
|
|
|
{
|
|
|
|
// Use thickness as filter value to convert the curve to polyline when the curve
|
|
|
|
// is not supported
|
|
|
|
m_gal->DrawCurve( VECTOR2D( aShape->GetStart() ),
|
|
|
|
VECTOR2D( aShape->GetBezControl1() ),
|
|
|
|
VECTOR2D( aShape->GetBezControl2() ),
|
|
|
|
VECTOR2D( aShape->GetEnd() ), thickness );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_gal->SetIsFill( aShape->IsFilled() );
|
|
|
|
m_gal->SetIsStroke( thickness > 0 );
|
|
|
|
m_gal->SetLineWidth( thickness );
|
|
|
|
|
|
|
|
// Use thickness as filter value to convert the curve to polyline when the curve
|
|
|
|
// is not supported
|
|
|
|
m_gal->DrawCurve( VECTOR2D( aShape->GetStart() ),
|
|
|
|
VECTOR2D( aShape->GetBezControl1() ),
|
|
|
|
VECTOR2D( aShape->GetBezControl2() ),
|
|
|
|
VECTOR2D( aShape->GetEnd() ), thickness );
|
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case S_LAST:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-04 23:34:59 +00:00
|
|
|
void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer )
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
2014-09-13 18:15:45 +00:00
|
|
|
wxString shownText( aText->GetShownText() );
|
2020-04-14 12:25:00 +00:00
|
|
|
|
2014-09-13 18:15:45 +00:00
|
|
|
if( shownText.Length() == 0 )
|
2013-10-02 09:39:08 +00:00
|
|
|
return;
|
2013-07-09 08:00:23 +00:00
|
|
|
|
2014-07-09 13:10:32 +00:00
|
|
|
const COLOR4D& color = m_pcbSettings.GetColor( aText, aText->GetLayer() );
|
2017-01-23 20:30:11 +00:00
|
|
|
VECTOR2D position( aText->GetTextPos().x, aText->GetTextPos().y );
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2020-05-26 22:21:38 +00:00
|
|
|
if( m_pcbSettings.m_sketchText || m_pcbSettings.m_sketchMode[aLayer] )
|
2014-07-09 13:10:32 +00:00
|
|
|
{
|
|
|
|
// Outline mode
|
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Filled mode
|
2020-04-14 12:25:00 +00:00
|
|
|
m_gal->SetLineWidth( getLineThickness( aText->GetEffectiveTextPenWidth() ) );
|
2014-07-09 13:10:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_gal->SetStrokeColor( color );
|
2016-05-04 10:18:25 +00:00
|
|
|
m_gal->SetIsFill( false );
|
|
|
|
m_gal->SetIsStroke( true );
|
2013-10-02 09:39:08 +00:00
|
|
|
m_gal->SetTextAttributes( aText );
|
2020-04-18 20:04:41 +00:00
|
|
|
m_gal->StrokeText( shownText, position, aText->GetTextAngleRadians() );
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-04 23:34:59 +00:00
|
|
|
void PCB_PAINTER::draw( const FP_TEXT* aText, int aLayer )
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
2014-09-13 18:15:45 +00:00
|
|
|
wxString shownText( aText->GetShownText() );
|
2020-05-26 22:21:38 +00:00
|
|
|
|
2014-09-13 18:15:45 +00:00
|
|
|
if( shownText.Length() == 0 )
|
2013-10-02 09:39:08 +00:00
|
|
|
return;
|
2013-08-02 14:53:04 +00:00
|
|
|
|
2014-07-09 13:10:32 +00:00
|
|
|
const COLOR4D& color = m_pcbSettings.GetColor( aText, aLayer );
|
2017-01-23 20:30:11 +00:00
|
|
|
VECTOR2D position( aText->GetTextPos().x, aText->GetTextPos().y );
|
2013-08-02 14:53:04 +00:00
|
|
|
|
2020-05-26 22:21:38 +00:00
|
|
|
if( m_pcbSettings.m_sketchText )
|
2014-07-09 13:10:32 +00:00
|
|
|
{
|
|
|
|
// Outline mode
|
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Filled mode
|
2020-04-14 12:25:00 +00:00
|
|
|
m_gal->SetLineWidth( getLineThickness( aText->GetEffectiveTextPenWidth() ) );
|
2014-07-09 13:10:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_gal->SetStrokeColor( color );
|
2016-05-04 10:18:25 +00:00
|
|
|
m_gal->SetIsFill( false );
|
|
|
|
m_gal->SetIsStroke( true );
|
2013-10-02 09:39:08 +00:00
|
|
|
m_gal->SetTextAttributes( aText );
|
2020-04-18 20:04:41 +00:00
|
|
|
m_gal->StrokeText( shownText, position, aText->GetDrawRotationRadians() );
|
2015-07-03 18:58:13 +00:00
|
|
|
|
|
|
|
// Draw the umbilical line
|
2018-08-06 18:26:37 +00:00
|
|
|
if( aText->IsSelected() )
|
2015-07-03 18:58:13 +00:00
|
|
|
{
|
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
|
|
|
m_gal->SetStrokeColor( COLOR4D( 0.0, 0.0, 1.0, 1.0 ) );
|
|
|
|
m_gal->DrawLine( position, aText->GetParent()->GetPosition() );
|
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
void PCB_PAINTER::draw( const FOOTPRINT* aFootprint, int aLayer )
|
2014-07-09 13:02:56 +00:00
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
if( aLayer == LAYER_ANCHOR )
|
2014-08-04 08:42:20 +00:00
|
|
|
{
|
2020-11-13 02:09:34 +00:00
|
|
|
const COLOR4D color = m_pcbSettings.GetColor( aFootprint, aLayer );
|
2020-09-20 09:06:31 +00:00
|
|
|
|
|
|
|
// Keep the size and width constant, not related to the scale because the anchor
|
|
|
|
// is just a marker on screen
|
|
|
|
double anchorSize = 5.0 / m_gal->GetWorldScale(); // 5 pixels size
|
2020-09-21 15:03:08 +00:00
|
|
|
double anchorThickness = 1.0 / m_gal->GetWorldScale(); // 1 pixels width
|
2014-07-09 13:02:56 +00:00
|
|
|
|
2014-08-04 08:42:20 +00:00
|
|
|
// Draw anchor
|
2020-09-20 09:06:31 +00:00
|
|
|
m_gal->SetIsFill( false );
|
|
|
|
m_gal->SetIsStroke( true );
|
2014-08-04 08:42:20 +00:00
|
|
|
m_gal->SetStrokeColor( color );
|
2020-09-20 09:06:31 +00:00
|
|
|
m_gal->SetLineWidth( anchorThickness );
|
2014-07-09 13:02:56 +00:00
|
|
|
|
2020-11-13 02:09:34 +00:00
|
|
|
VECTOR2D center = aFootprint->GetPosition();
|
2014-08-04 08:42:20 +00:00
|
|
|
m_gal->DrawLine( center - VECTOR2D( anchorSize, 0 ), center + VECTOR2D( anchorSize, 0 ) );
|
|
|
|
m_gal->DrawLine( center - VECTOR2D( 0, anchorSize ), center + VECTOR2D( 0, anchorSize ) );
|
2020-09-20 09:06:31 +00:00
|
|
|
|
2020-09-21 15:03:08 +00:00
|
|
|
#if 0 // For debug purpose only: draw the footing bounding box
|
2020-09-20 09:06:31 +00:00
|
|
|
double bboxThickness = 1.0 / m_gal->GetWorldScale();
|
|
|
|
m_gal->SetLineWidth( bboxThickness );
|
2020-11-13 02:09:34 +00:00
|
|
|
EDA_RECT rect = aFootprint->GetBoundingBoxBase();
|
2020-09-20 09:06:31 +00:00
|
|
|
m_gal->DrawRectangle( VECTOR2D( rect.GetOrigin() ), VECTOR2D( rect.GetEnd() ) );
|
|
|
|
#endif
|
2014-08-04 08:42:20 +00:00
|
|
|
}
|
2014-07-09 13:02:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-12 11:23:30 +00:00
|
|
|
void PCB_PAINTER::draw( const PCB_GROUP* aGroup, int aLayer )
|
2020-08-11 19:37:07 +00:00
|
|
|
{
|
|
|
|
if( aLayer == LAYER_ANCHOR )
|
|
|
|
{
|
|
|
|
const COLOR4D color = m_pcbSettings.GetColor( aGroup, LAYER_ANCHOR );
|
|
|
|
|
|
|
|
EDA_RECT bbox = aGroup->GetBoundingBox();
|
|
|
|
m_gal->SetStrokeColor( color );
|
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth * 2.0f );
|
2020-09-24 15:31:24 +00:00
|
|
|
wxPoint topLeft = bbox.GetPosition();
|
|
|
|
wxPoint width = wxPoint( bbox.GetWidth(), 0 );
|
|
|
|
wxPoint height = wxPoint( 0, bbox.GetHeight() );
|
2020-08-11 19:37:07 +00:00
|
|
|
|
2020-09-24 15:31:24 +00:00
|
|
|
m_gal->DrawLine( topLeft, topLeft + width );
|
|
|
|
m_gal->DrawLine( topLeft + width, topLeft + width + height );
|
|
|
|
m_gal->DrawLine( topLeft + width + height, topLeft + height );
|
|
|
|
m_gal->DrawLine( topLeft + height, topLeft );
|
2020-09-24 01:05:46 +00:00
|
|
|
|
|
|
|
wxString name = aGroup->GetName();
|
|
|
|
|
|
|
|
int ptSize = 12;
|
|
|
|
int scaledSize = abs( KiROUND( m_gal->GetScreenWorldMatrix().GetScale().x * ptSize ) );
|
|
|
|
int unscaledSize = Mils2iu( ptSize );
|
|
|
|
|
|
|
|
// Scale by zoom a bit, but not too much
|
2020-10-09 12:35:59 +00:00
|
|
|
int textSize = ( scaledSize + ( unscaledSize * 2 ) ) / 3;
|
|
|
|
int penWidth = textSize / 10;
|
|
|
|
wxPoint textOffset = wxPoint( width.x / 2, - KiROUND( textSize * 0.5 ) );
|
2020-09-24 15:31:24 +00:00
|
|
|
wxPoint titleHeight = wxPoint( 0, KiROUND( textSize * 2.0 ) );
|
2020-09-24 01:05:46 +00:00
|
|
|
|
|
|
|
if( !name.IsEmpty() && (int) aGroup->GetName().Length() * textSize < bbox.GetWidth() )
|
|
|
|
{
|
2020-09-24 15:31:24 +00:00
|
|
|
m_gal->DrawLine( topLeft, topLeft - titleHeight );
|
|
|
|
m_gal->DrawLine( topLeft - titleHeight, topLeft + width - titleHeight );
|
|
|
|
m_gal->DrawLine( topLeft + width - titleHeight, topLeft + width );
|
|
|
|
|
2020-10-09 12:35:59 +00:00
|
|
|
m_gal->SetFontBold( false );
|
|
|
|
m_gal->SetFontItalic( true );
|
|
|
|
m_gal->SetFontUnderlined( false );
|
|
|
|
m_gal->SetTextMirrored( m_gal->IsFlippedX() );
|
2020-09-24 15:31:24 +00:00
|
|
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
2020-09-24 01:05:46 +00:00
|
|
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
|
|
|
m_gal->SetIsFill( false );
|
|
|
|
m_gal->SetGlyphSize( VECTOR2D( textSize, textSize ) );
|
|
|
|
m_gal->SetLineWidth( penWidth );
|
2020-09-24 15:31:24 +00:00
|
|
|
m_gal->StrokeText( aGroup->GetName(), topLeft + textOffset, 0.0 );
|
2020-09-24 01:05:46 +00:00
|
|
|
}
|
2020-08-11 19:37:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void PCB_PAINTER::draw( const ZONE* aZone, int aLayer )
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
2020-07-11 17:42:00 +00:00
|
|
|
/**
|
|
|
|
* aLayer will be the virtual zone layer (LAYER_ZONE_START, ... in GAL_LAYER_ID)
|
|
|
|
* This is used for draw ordering in the GAL.
|
|
|
|
* The color for the zone comes from the associated copper layer ( aLayer - LAYER_ZONE_START )
|
|
|
|
* and the visibility comes from the combination of that copper layer and LAYER_ZONES
|
|
|
|
*/
|
|
|
|
wxASSERT( IsZoneLayer( aLayer ) );
|
|
|
|
PCB_LAYER_ID layer = static_cast<PCB_LAYER_ID>( aLayer - LAYER_ZONE_START );
|
2020-06-24 02:19:08 +00:00
|
|
|
|
|
|
|
if( !aZone->IsOnLayer( layer ) )
|
2017-10-23 13:35:03 +00:00
|
|
|
return;
|
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
COLOR4D color = m_pcbSettings.GetColor( aZone, layer );
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
std::deque<VECTOR2D> corners;
|
2020-07-11 17:42:00 +00:00
|
|
|
ZONE_DISPLAY_MODE displayMode = m_pcbSettings.m_zoneDisplayMode;
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2013-07-02 12:02:42 +00:00
|
|
|
// Draw the outline
|
2017-12-13 15:57:22 +00:00
|
|
|
const SHAPE_POLY_SET* outline = aZone->Outline();
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2020-05-07 21:42:55 +00:00
|
|
|
if( m_pcbSettings.m_zoneOutlines && outline && outline->OutlineCount() > 0 )
|
2013-07-02 12:02:42 +00:00
|
|
|
{
|
2017-12-13 15:57:22 +00:00
|
|
|
m_gal->SetStrokeColor( color );
|
|
|
|
m_gal->SetIsFill( false );
|
|
|
|
m_gal->SetIsStroke( true );
|
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
2017-02-24 12:26:25 +00:00
|
|
|
|
2018-02-05 18:50:02 +00:00
|
|
|
// Draw each contour (main contour and holes)
|
|
|
|
|
|
|
|
/* This line:
|
|
|
|
* m_gal->DrawPolygon( *outline );
|
|
|
|
* should be enough, but currently does not work to draw holes contours in a complex polygon
|
|
|
|
* so each contour is draw as a simple polygon
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Draw the main contour
|
|
|
|
m_gal->DrawPolyline( outline->COutline( 0 ) );
|
|
|
|
|
|
|
|
// Draw holes
|
|
|
|
int holes_count = outline->HoleCount( 0 );
|
|
|
|
|
|
|
|
for( int ii = 0; ii < holes_count; ++ii )
|
2018-10-08 13:50:59 +00:00
|
|
|
m_gal->DrawPolyline( outline->CHole( 0, ii ) );
|
2018-02-05 18:50:02 +00:00
|
|
|
|
|
|
|
// Draw hatch lines
|
2017-03-07 12:06:00 +00:00
|
|
|
for( const SEG& hatchLine : aZone->GetHatchLines() )
|
|
|
|
m_gal->DrawLine( hatchLine.A, hatchLine.B );
|
2013-07-02 12:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Draw the filling
|
2020-07-11 17:42:00 +00:00
|
|
|
if( displayMode != ZONE_DISPLAY_MODE::HIDE_FILLED )
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
2020-06-24 02:19:08 +00:00
|
|
|
const SHAPE_POLY_SET& polySet = aZone->GetFilledPolysList( layer );
|
2015-07-27 19:45:57 +00:00
|
|
|
|
|
|
|
if( polySet.OutlineCount() == 0 ) // Nothing to draw
|
2013-07-02 12:02:42 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// Set up drawing options
|
2020-09-22 21:05:24 +00:00
|
|
|
int outline_thickness = 0;
|
|
|
|
|
|
|
|
if( aZone->GetFilledPolysUseThickness( layer ) )
|
|
|
|
outline_thickness = aZone->GetMinThickness();
|
|
|
|
|
2019-03-07 20:09:03 +00:00
|
|
|
m_gal->SetStrokeColor( color );
|
2013-07-02 12:02:42 +00:00
|
|
|
m_gal->SetFillColor( color );
|
2019-06-04 07:23:12 +00:00
|
|
|
m_gal->SetLineWidth( outline_thickness );
|
2013-07-02 12:02:42 +00:00
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
if( displayMode == ZONE_DISPLAY_MODE::SHOW_FILLED )
|
2013-07-02 12:02:42 +00:00
|
|
|
{
|
|
|
|
m_gal->SetIsFill( true );
|
2019-06-04 07:23:12 +00:00
|
|
|
m_gal->SetIsStroke( outline_thickness > 0 );
|
2013-07-02 12:02:42 +00:00
|
|
|
}
|
2020-07-11 17:42:00 +00:00
|
|
|
else if( displayMode == ZONE_DISPLAY_MODE::SHOW_OUTLINED )
|
2013-07-02 12:02:42 +00:00
|
|
|
{
|
|
|
|
m_gal->SetIsFill( false );
|
|
|
|
m_gal->SetIsStroke( true );
|
|
|
|
}
|
|
|
|
|
2017-11-23 16:20:27 +00:00
|
|
|
m_gal->DrawPolygon( polySet );
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
}
|
|
|
|
}
|
2013-04-03 09:19:13 +00:00
|
|
|
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
void PCB_PAINTER::draw( const DIMENSION_BASE* aDimension, int aLayer )
|
2013-04-03 09:19:13 +00:00
|
|
|
{
|
2014-05-21 21:13:30 +00:00
|
|
|
const COLOR4D& strokeColor = m_pcbSettings.GetColor( aDimension, aLayer );
|
2013-04-03 09:19:13 +00:00
|
|
|
|
2013-10-02 09:39:08 +00:00
|
|
|
m_gal->SetStrokeColor( strokeColor );
|
|
|
|
m_gal->SetIsFill( false );
|
|
|
|
m_gal->SetIsStroke( true );
|
2020-05-26 22:21:38 +00:00
|
|
|
|
|
|
|
if( m_pcbSettings.m_sketchGraphics )
|
|
|
|
{
|
|
|
|
// Outline mode
|
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Filled mode
|
2020-09-09 03:17:08 +00:00
|
|
|
m_gal->SetLineWidth( getLineThickness( aDimension->GetLineThickness() ) );
|
2020-05-26 22:21:38 +00:00
|
|
|
}
|
2013-10-02 09:39:08 +00:00
|
|
|
|
2020-09-09 03:17:08 +00:00
|
|
|
// Draw dimension shapes
|
2020-09-12 20:09:40 +00:00
|
|
|
// TODO(JE) lift this out
|
|
|
|
for( const std::shared_ptr<SHAPE>& shape : aDimension->GetShapes() )
|
|
|
|
{
|
|
|
|
switch( shape->Type() )
|
|
|
|
{
|
|
|
|
case SH_SEGMENT:
|
|
|
|
{
|
|
|
|
const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
|
|
|
|
m_gal->DrawLine( seg.A, seg.B );
|
|
|
|
break;
|
|
|
|
}
|
2013-10-02 09:39:08 +00:00
|
|
|
|
2020-09-12 20:09:40 +00:00
|
|
|
case SH_CIRCLE:
|
|
|
|
{
|
|
|
|
int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
|
|
|
|
m_gal->DrawCircle( shape->Centre(), radius );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-10-02 09:39:08 +00:00
|
|
|
// Draw text
|
2020-10-04 23:34:59 +00:00
|
|
|
PCB_TEXT& text = aDimension->Text();
|
|
|
|
VECTOR2D position( text.GetTextPos().x, text.GetTextPos().y );
|
2013-10-02 09:39:08 +00:00
|
|
|
|
2020-05-26 22:21:38 +00:00
|
|
|
if( m_pcbSettings.m_sketchText )
|
|
|
|
{
|
|
|
|
// Outline mode
|
|
|
|
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Filled mode
|
|
|
|
m_gal->SetLineWidth( getLineThickness( text.GetEffectiveTextPenWidth() ) );
|
|
|
|
}
|
|
|
|
|
2013-10-02 09:39:08 +00:00
|
|
|
m_gal->SetTextAttributes( &text );
|
2020-09-12 14:23:07 +00:00
|
|
|
m_gal->StrokeText( text.GetShownText(), position, text.GetTextAngleRadians() );
|
2013-04-03 09:19:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_PAINTER::draw( const PCB_TARGET* aTarget )
|
|
|
|
{
|
2014-05-21 21:13:30 +00:00
|
|
|
const COLOR4D& strokeColor = m_pcbSettings.GetColor( aTarget, aTarget->GetLayer() );
|
2013-04-17 11:12:54 +00:00
|
|
|
VECTOR2D position( aTarget->GetPosition() );
|
|
|
|
double size, radius;
|
2013-04-03 09:19:13 +00:00
|
|
|
|
2017-02-07 10:21:26 +00:00
|
|
|
m_gal->SetLineWidth( getLineThickness( aTarget->GetWidth() ) );
|
2013-04-17 11:12:54 +00:00
|
|
|
m_gal->SetStrokeColor( strokeColor );
|
|
|
|
m_gal->SetIsFill( false );
|
|
|
|
m_gal->SetIsStroke( true );
|
|
|
|
|
|
|
|
m_gal->Save();
|
|
|
|
m_gal->Translate( position );
|
|
|
|
|
|
|
|
if( aTarget->GetShape() )
|
2013-04-03 09:19:13 +00:00
|
|
|
{
|
2013-04-17 11:12:54 +00:00
|
|
|
// shape x
|
|
|
|
m_gal->Rotate( M_PI / 4.0 );
|
|
|
|
size = 2.0 * aTarget->GetSize() / 3.0;
|
|
|
|
radius = aTarget->GetSize() / 2.0;
|
2013-04-03 09:19:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-17 11:12:54 +00:00
|
|
|
// shape +
|
|
|
|
size = aTarget->GetSize() / 2.0;
|
|
|
|
radius = aTarget->GetSize() / 3.0;
|
2013-04-03 09:19:13 +00:00
|
|
|
}
|
|
|
|
|
2013-09-16 14:18:43 +00:00
|
|
|
m_gal->DrawLine( VECTOR2D( -size, 0.0 ), VECTOR2D( size, 0.0 ) );
|
|
|
|
m_gal->DrawLine( VECTOR2D( 0.0, -size ), VECTOR2D( 0.0, size ) );
|
2013-04-17 11:12:54 +00:00
|
|
|
m_gal->DrawCircle( VECTOR2D( 0.0, 0.0 ), radius );
|
|
|
|
|
|
|
|
m_gal->Restore();
|
2013-04-03 09:19:13 +00:00
|
|
|
}
|
2013-08-09 13:04:10 +00:00
|
|
|
|
|
|
|
|
2020-11-14 18:11:28 +00:00
|
|
|
void PCB_PAINTER::draw( const PCB_MARKER* aMarker, int aLayer )
|
2014-03-19 12:42:46 +00:00
|
|
|
{
|
2020-10-12 22:24:35 +00:00
|
|
|
bool isShadow = aLayer == LAYER_MARKER_SHADOWS;
|
|
|
|
|
|
|
|
// Don't paint shadows for invisible markers.
|
|
|
|
// It would be nice to do this through layer dependencies but we can't do an "or" there today
|
|
|
|
if( isShadow && aMarker->GetBoard() &&
|
|
|
|
!aMarker->GetBoard()->IsElementVisible( aMarker->GetColorLayer() ) )
|
|
|
|
return;
|
|
|
|
|
2018-12-19 18:53:27 +00:00
|
|
|
SHAPE_LINE_CHAIN polygon;
|
|
|
|
aMarker->ShapeToPolygon( polygon );
|
2014-03-19 12:42:46 +00:00
|
|
|
|
2020-10-12 22:24:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
COLOR4D color = m_pcbSettings.GetColor( aMarker, isShadow ? LAYER_MARKER_SHADOWS
|
|
|
|
: aMarker->GetColorLayer() );
|
2017-11-29 02:57:28 +00:00
|
|
|
|
2016-01-20 14:19:26 +00:00
|
|
|
m_gal->Save();
|
|
|
|
m_gal->Translate( aMarker->GetPosition() );
|
2020-10-12 22:24:35 +00:00
|
|
|
|
|
|
|
if( isShadow )
|
|
|
|
{
|
|
|
|
m_gal->SetStrokeColor( color );
|
|
|
|
m_gal->SetIsStroke( true );
|
|
|
|
m_gal->SetLineWidth( aMarker->MarkerScale() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_gal->SetFillColor( color );
|
|
|
|
m_gal->SetIsFill( true );
|
|
|
|
}
|
2020-11-18 01:21:04 +00:00
|
|
|
|
2018-12-19 18:53:27 +00:00
|
|
|
m_gal->DrawPolygon( polygon );
|
2016-01-20 14:19:26 +00:00
|
|
|
m_gal->Restore();
|
2014-03-19 12:42:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-11-03 14:06:16 +00:00
|
|
|
const double PCB_RENDER_SETTINGS::MAX_FONT_SIZE = Millimeter2iu( 10.0 );
|