KiCad PCB EDA Suite
KIGFX::GERBVIEW_RENDER_SETTINGS Class Reference

Store GerbView specific render settings. More...

#include <gerbview_painter.h>

Inheritance diagram for KIGFX::GERBVIEW_RENDER_SETTINGS:
KIGFX::RENDER_SETTINGS

Public Member Functions

 GERBVIEW_RENDER_SETTINGS ()
 
void LoadColors (const COLOR_SETTINGS *aSettings) override
 
void LoadDisplayOptions (const GBR_DISPLAY_OPTIONS &aOptions)
 Load settings related to display options. More...
 
virtual COLOR4D GetColor (const VIEW_ITEM *aItem, int aLayer) const override
 Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using currently used render settings. More...
 
const COLOR4DGetLayerColor (int aLayer) const
 Return the color used to draw a layer. More...
 
void SetLayerColor (int aLayer, const COLOR4D &aColor)
 Change the color used to draw a layer. More...
 
const COLOR4DGetBackgroundColor () override
 Return current background color settings. More...
 
void SetBackgroundColor (const COLOR4D &aColor) override
 Set the background color. More...
 
const COLOR4DGetGridColor () override
 Return current grid color settings. More...
 
const COLOR4DGetCursorColor () override
 Return current cursor color settings. More...
 
bool IsSpotFill () const
 
bool IsLineFill () const
 
bool IsPolygonFill () const
 
bool IsShowNegativeItems () const
 
bool IsShowCodes () const
 
bool IsDiffMode () const
 
void ClearHighlightSelections ()
 Clear all highlight selections (dcode, net, component, attribute selection) More...
 
void SetLayerIsHighContrast (int aLayerId, bool aEnabled=true)
 Set the specified layer as high-contrast. More...
 
bool GetLayerIsHighContrast (int aLayerId) const
 Return information whether the queried layer is marked as high-contrast. More...
 
const std::set< unsigned int > GetHighContrastLayers () const
 Returns the set of currently high-contrast layers. More...
 
PCB_LAYER_ID GetPrimaryHighContrastLayer () const
 Return the board layer which is in high-contrast mode. More...
 
PCB_LAYER_ID GetActiveLayer () const
 
void SetActiveLayer (PCB_LAYER_ID aLayer)
 
void ClearHighContrastLayers ()
 Clear the list of active layers. More...
 
bool IsHighlightEnabled () const
 Return current highlight setting. More...
 
const std::set< int > & GetHighlightNetCodes () const
 Return the netcode of currently highlighted net. More...
 
void SetHighlight (bool aEnabled, int aNetcode=-1, bool aMulti=false)
 Turns on/off highlighting. More...
 
void SetHighlight (std::set< int > &aHighlight, bool aEnabled=true)
 Turns on highlighting and highlights multiple nets. More...
 
void SetHighContrast (bool aEnabled)
 Turns on/off high contrast display mode. More...
 
bool GetHighContrast () const
 
float GetDrawingSheetLineWidth () const
 
int GetDefaultPenWidth () const
 
void SetDefaultPenWidth (int aWidth)
 
int GetMinPenWidth () const
 
void SetMinPenWidth (int aWidth)
 
bool GetShowPageLimits () const
 
void SetShowPageLimits (bool aDraw)
 
bool IsPrinting () const
 
void SetIsPrinting (bool isPrinting)
 
virtual bool IsBackgroundDark () const
 
void SetOutlineWidth (float aWidth)
 Set line width used for drawing outlines. More...
 
void SetHighlightFactor (float aFactor)
 
void SetSelectFactor (float aFactor)
 
void SetHighContrastFactor (float aFactor)
 
wxDC * GetPrintDC () const
 
void SetPrintDC (wxDC *aDC)
 

Public Attributes

wxString m_componentHighlightString
 If set to anything but an empty string, will highlight items with matching component. More...
 
wxString m_netHighlightString
 If set to anything but an empty string, will highlight items with matching net. More...
 
wxString m_attributeHighlightString
 If set to anything but an empty string, will highlight items with matching attribute. More...
 
int m_dcodeHighlightValue
 If set to anything but >0 (in fact 10 the min dcode value), will highlight items with matching dcode. More...
 

Protected Member Functions

virtual void update ()
 Precalculates extra colors for layers (e.g. More...
 

Protected Attributes

bool m_spotFill
 Flag determining if spots should be drawn with fill. More...
 
bool m_lineFill
 Flag determining if lines should be drawn with fill. More...
 
bool m_polygonFill
 Flag determining if polygons should be drawn with fill. More...
 
bool m_showNegativeItems
 Flag determining if negative items should be drawn with a "ghost" color. More...
 
bool m_showCodes
 Flag determining if D-Codes should be drawn. More...
 
bool m_diffMode
 Flag determining if layers should be rendered in "diff" mode. More...
 
PCB_LAYER_ID m_activeLayer
 
std::set< unsigned int > m_highContrastLayers
 
COLOR4D m_layerColors [LAYER_ID_COUNT]
 
COLOR4D m_layerColorsHi [LAYER_ID_COUNT]
 
COLOR4D m_layerColorsSel [LAYER_ID_COUNT]
 
COLOR4D m_hiContrastColor [LAYER_ID_COUNT]
 
COLOR4D m_layerColorsDark [LAYER_ID_COUNT]
 
COLOR4D m_backgroundColor
 
bool m_hiContrastEnabled
 Parameters for display modes. More...
 
float m_hiContrastFactor
 
bool m_highlightEnabled
 
std::set< int > m_highlightNetcodes
 
float m_highlightFactor
 
float m_selectFactor
 
float m_outlineWidth
 
float m_drawingSheetLineWidth
 
int m_defaultPenWidth
 
int m_minPenWidth
 
bool m_showPageLimits
 
bool m_isPrinting
 
wxDC * m_printDC
 

Static Protected Attributes

static const double MAX_FONT_SIZE = Millimeter2iu( 10.0 )
 Maximum font size for D-Codes and other strings. More...
 

Friends

class GERBVIEW_PAINTER
 

Detailed Description

Store GerbView specific render settings.

Definition at line 46 of file gerbview_painter.h.

Constructor & Destructor Documentation

◆ GERBVIEW_RENDER_SETTINGS()

GERBVIEW_RENDER_SETTINGS::GERBVIEW_RENDER_SETTINGS ( )

Definition at line 35 of file gerbview_painter.cpp.

36 {
38 
39  m_spotFill = true;
40  m_lineFill = true;
41  m_polygonFill = true;
42  m_showNegativeItems = false;
43  m_showCodes = false;
44  m_diffMode = true;
45 
50 
51  update();
52 }
bool m_showNegativeItems
Flag determining if negative items should be drawn with a "ghost" color.
bool m_lineFill
Flag determining if lines should be drawn with fill.
static const COLOR4D BLACK
Definition: color4d.h:381
bool m_spotFill
Flag determining if spots should be drawn with fill.
bool m_showCodes
Flag determining if D-Codes should be drawn.
wxString m_netHighlightString
If set to anything but an empty string, will highlight items with matching net.
wxString m_attributeHighlightString
If set to anything but an empty string, will highlight items with matching attribute.
virtual void update()
Precalculates extra colors for layers (e.g.
wxString m_componentHighlightString
If set to anything but an empty string, will highlight items with matching component.
bool m_polygonFill
Flag determining if polygons should be drawn with fill.
int m_dcodeHighlightValue
If set to anything but >0 (in fact 10 the min dcode value), will highlight items with matching dcode.
bool m_diffMode
Flag determining if layers should be rendered in "diff" mode.

References KIGFX::COLOR4D::BLACK, m_attributeHighlightString, KIGFX::RENDER_SETTINGS::m_backgroundColor, m_componentHighlightString, m_dcodeHighlightValue, m_diffMode, m_lineFill, m_netHighlightString, m_polygonFill, m_showCodes, m_showNegativeItems, m_spotFill, and KIGFX::RENDER_SETTINGS::update().

Member Function Documentation

◆ ClearHighContrastLayers()

void KIGFX::RENDER_SETTINGS::ClearHighContrastLayers ( )
inlineinherited

Clear the list of active layers.

Definition at line 118 of file render_settings.h.

119  {
120  m_highContrastLayers.clear();
121  }
std::set< unsigned int > m_highContrastLayers

References KIGFX::RENDER_SETTINGS::m_highContrastLayers.

Referenced by GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer(), PCB_DRAW_PANEL_GAL::SetHighContrastLayer(), and EDA_DRAW_PANEL_GAL::SetHighContrastLayer().

◆ ClearHighlightSelections()

void GERBVIEW_RENDER_SETTINGS::ClearHighlightSelections ( )

Clear all highlight selections (dcode, net, component, attribute selection)

Definition at line 104 of file gerbview_painter.cpp.

105 {
106  // Clear all highlight selections (dcode, net, component, attribute selection)
108  m_netHighlightString.Empty();
111 }
wxString m_netHighlightString
If set to anything but an empty string, will highlight items with matching net.
wxString m_attributeHighlightString
If set to anything but an empty string, will highlight items with matching attribute.
wxString m_componentHighlightString
If set to anything but an empty string, will highlight items with matching component.
int m_dcodeHighlightValue
If set to anything but >0 (in fact 10 the min dcode value), will highlight items with matching dcode.

References m_attributeHighlightString, m_componentHighlightString, m_dcodeHighlightValue, and m_netHighlightString.

Referenced by GERBVIEW_CONTROL::ClearAllLayers().

◆ GetActiveLayer()

PCB_LAYER_ID KIGFX::RENDER_SETTINGS::GetActiveLayer ( ) const
inlineinherited

Definition at line 112 of file render_settings.h.

112 { return m_activeLayer; }

References KIGFX::RENDER_SETTINGS::m_activeLayer.

Referenced by KIGFX::PCB_PAINTER::draw().

◆ GetBackgroundColor()

const COLOR4D& KIGFX::GERBVIEW_RENDER_SETTINGS::GetBackgroundColor ( )
inlineoverridevirtual

Return current background color settings.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 88 of file gerbview_painter.h.

89  {
91  }
COLOR4D m_layerColors[LAYER_ID_COUNT]

References LAYER_GERBVIEW_BACKGROUND, and KIGFX::RENDER_SETTINGS::m_layerColors.

◆ GetColor()

COLOR4D GERBVIEW_RENDER_SETTINGS::GetColor ( const VIEW_ITEM aItem,
int  aLayer 
) const
overridevirtual

Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using currently used render settings.

Parameters
aItemis the VIEW_ITEM.
aLayeris the layer.
Returns
The color.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 113 of file gerbview_painter.cpp.

114 {
115  const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );
116  static const COLOR4D transparent = COLOR4D( 0, 0, 0, 0 );
117  const GERBER_DRAW_ITEM* gbrItem = nullptr;
118 
119  if( item && item->Type() == GERBER_DRAW_ITEM_T )
120  gbrItem = static_cast<const GERBER_DRAW_ITEM*>( item );
121 
122  // All DCODE layers stored under a single color setting
123  if( IsDCodeLayer( aLayer ) )
124  return m_layerColors[ LAYER_DCODES ];
125 
126  if( item && item->IsSelected() )
127  return m_layerColorsSel[aLayer];
128 
129  if( gbrItem && gbrItem->GetLayerPolarity() )
130  {
131  if( m_showNegativeItems )
133  else
134  return transparent;
135  }
136 
137  if( !m_netHighlightString.IsEmpty() && gbrItem &&
139  return m_layerColorsHi[aLayer];
140 
141  if( !m_componentHighlightString.IsEmpty() && gbrItem &&
143  return m_layerColorsHi[aLayer];
144 
145  if( !m_attributeHighlightString.IsEmpty() && gbrItem && gbrItem->GetDcodeDescr() &&
147  return m_layerColorsHi[aLayer];
148 
149  if( m_dcodeHighlightValue> 0 && gbrItem && gbrItem->GetDcodeDescr() &&
151  return m_layerColorsHi[aLayer];
152 
153  // Return grayish color for non-highlighted layers in the high contrast mode
154  if( m_hiContrastEnabled && m_highContrastLayers.count( aLayer ) == 0)
155  return m_hiContrastColor[aLayer];
156 
157  // Catch the case when highlight and high-contraste modes are enabled
158  // and we are drawing a not highlighted track
159  if( m_highlightEnabled )
160  return m_layerColorsDark[aLayer];
161 
162  // No special modificators enabled
163  return m_layerColors[aLayer];
164 }
D_CODE * GetDcodeDescr() const
Return the GetDcodeDescr of this object, or NULL.
bool m_showNegativeItems
Flag determining if negative items should be drawn with a "ghost" color.
bool IsDCodeLayer(int aLayer)
Definition: layer_ids.h:968
bool IsSelected() const
Definition: eda_item.h:123
COLOR4D m_layerColorsHi[LAYER_ID_COUNT]
COLOR4D m_layerColors[LAYER_ID_COUNT]
wxString m_Cmpref
the component reference parent of the data
std::set< unsigned int > m_highContrastLayers
COLOR4D m_hiContrastColor[LAYER_ID_COUNT]
COLOR4D m_layerColorsDark[LAYER_ID_COUNT]
wxString m_netHighlightString
If set to anything but an empty string, will highlight items with matching net.
wxString m_attributeHighlightString
If set to anything but an empty string, will highlight items with matching attribute.
bool m_hiContrastEnabled
Parameters for display modes.
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:190
wxString m_Netname
for items associated to a net: the netname
wxString m_componentHighlightString
If set to anything but an empty string, will highlight items with matching component.
const GBR_NETLIST_METADATA & GetNetAttributes() const
wxString m_AperFunction
the aperture attribute (created by a TA.AperFunction command).
Definition: dcode.h:200
int m_dcodeHighlightValue
If set to anything but >0 (in fact 10 the min dcode value), will highlight items with matching dcode.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
bool GetLayerPolarity() const
COLOR4D m_layerColorsSel[LAYER_ID_COUNT]
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References GERBER_DRAW_ITEM_T, GERBER_DRAW_ITEM::GetDcodeDescr(), GERBER_DRAW_ITEM::GetLayerPolarity(), GERBER_DRAW_ITEM::GetNetAttributes(), IsDCodeLayer(), EDA_ITEM::IsSelected(), LAYER_DCODES, LAYER_NEGATIVE_OBJECTS, D_CODE::m_AperFunction, m_attributeHighlightString, GBR_NETLIST_METADATA::m_Cmpref, m_componentHighlightString, m_dcodeHighlightValue, KIGFX::RENDER_SETTINGS::m_hiContrastColor, KIGFX::RENDER_SETTINGS::m_hiContrastEnabled, KIGFX::RENDER_SETTINGS::m_highContrastLayers, KIGFX::RENDER_SETTINGS::m_highlightEnabled, KIGFX::RENDER_SETTINGS::m_layerColors, KIGFX::RENDER_SETTINGS::m_layerColorsDark, KIGFX::RENDER_SETTINGS::m_layerColorsHi, KIGFX::RENDER_SETTINGS::m_layerColorsSel, m_netHighlightString, GBR_NETLIST_METADATA::m_Netname, D_CODE::m_Num_Dcode, m_showNegativeItems, and EDA_ITEM::Type().

Referenced by KIGFX::GERBVIEW_PAINTER::draw().

◆ GetCursorColor()

const COLOR4D& KIGFX::GERBVIEW_RENDER_SETTINGS::GetCursorColor ( )
inlineoverridevirtual

Return current cursor color settings.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 100 of file gerbview_painter.h.

100 { return m_layerColors[ LAYER_CURSOR ]; }
COLOR4D m_layerColors[LAYER_ID_COUNT]
PCB cursor.
Definition: layer_ids.h:216

References LAYER_CURSOR, and KIGFX::RENDER_SETTINGS::m_layerColors.

◆ GetDefaultPenWidth()

◆ GetDrawingSheetLineWidth()

float KIGFX::RENDER_SETTINGS::GetDrawingSheetLineWidth ( ) const
inlineinherited

◆ GetGridColor()

const COLOR4D& KIGFX::GERBVIEW_RENDER_SETTINGS::GetGridColor ( )
inlineoverridevirtual

Return current grid color settings.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 98 of file gerbview_painter.h.

COLOR4D m_layerColors[LAYER_ID_COUNT]

References LAYER_GERBVIEW_GRID, and KIGFX::RENDER_SETTINGS::m_layerColors.

◆ GetHighContrast()

bool KIGFX::RENDER_SETTINGS::GetHighContrast ( ) const
inlineinherited

◆ GetHighContrastLayers()

const std::set<unsigned int> KIGFX::RENDER_SETTINGS::GetHighContrastLayers ( ) const
inlineinherited

Returns the set of currently high-contrast layers.

Definition at line 90 of file render_settings.h.

91  {
92  return m_highContrastLayers;
93  }
std::set< unsigned int > m_highContrastLayers

References KIGFX::RENDER_SETTINGS::m_highContrastLayers.

Referenced by PCB_GRID_HELPER::computeAnchors(), PCB_GRID_HELPER::queryVisible(), and PCB_SELECTION_TOOL::Selectable().

◆ GetHighlightNetCodes()

const std::set<int>& KIGFX::RENDER_SETTINGS::GetHighlightNetCodes ( ) const
inlineinherited

Return the netcode of currently highlighted net.

Returns
Netcode of currently highlighted net.

Definition at line 138 of file render_settings.h.

139  {
140  return m_highlightNetcodes;
141  }
std::set< int > m_highlightNetcodes

References KIGFX::RENDER_SETTINGS::m_highlightNetcodes.

Referenced by BOARD_INSPECTION_TOOL::HighlightNet(), PNS::TOOL_BASE::highlightNet(), and PCB_EDIT_FRAME::setupUIConditions().

◆ GetLayerColor()

const COLOR4D& KIGFX::GERBVIEW_RENDER_SETTINGS::GetLayerColor ( int  aLayer) const
inline

Return the color used to draw a layer.

Parameters
aLayeris the layer number.

Definition at line 70 of file gerbview_painter.h.

71  {
72  return m_layerColors[aLayer];
73  }
COLOR4D m_layerColors[LAYER_ID_COUNT]

References KIGFX::RENDER_SETTINGS::m_layerColors.

◆ GetLayerIsHighContrast()

bool KIGFX::RENDER_SETTINGS::GetLayerIsHighContrast ( int  aLayerId) const
inlineinherited

Return information whether the queried layer is marked as high-contrast.

Returns
True if the queried layer is marked as active.

Definition at line 82 of file render_settings.h.

83  {
84  return ( m_highContrastLayers.count( aLayerId ) > 0 );
85  }
std::set< unsigned int > m_highContrastLayers

References KIGFX::RENDER_SETTINGS::m_highContrastLayers.

◆ GetMinPenWidth()

int KIGFX::RENDER_SETTINGS::GetMinPenWidth ( ) const
inlineinherited

◆ GetPrimaryHighContrastLayer()

PCB_LAYER_ID KIGFX::RENDER_SETTINGS::GetPrimaryHighContrastLayer ( ) const
inlineinherited

Return the board layer which is in high-contrast mode.

There should only be one board layer which is high-contrast at any given time, although there might be many high-contrast synthetic (GAL) layers.

Definition at line 101 of file render_settings.h.

102  {
103  for( int layer : m_highContrastLayers )
104  {
105  if( layer >= PCBNEW_LAYER_ID_START && layer < PCB_LAYER_ID_COUNT )
106  return (PCB_LAYER_ID) layer;
107  }
108 
109  return UNDEFINED_LAYER;
110  }
std::set< unsigned int > m_highContrastLayers
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64

References KIGFX::RENDER_SETTINGS::m_highContrastLayers, PCB_LAYER_ID_COUNT, PCBNEW_LAYER_ID_START, and UNDEFINED_LAYER.

Referenced by KIGFX::PCB_RENDER_SETTINGS::GetColor(), and PNS_KICAD_IFACE::IsItemVisible().

◆ GetPrintDC()

◆ GetShowPageLimits()

bool KIGFX::RENDER_SETTINGS::GetShowPageLimits ( ) const
inlineinherited

◆ IsBackgroundDark()

virtual bool KIGFX::RENDER_SETTINGS::IsBackgroundDark ( ) const
inlinevirtualinherited

◆ IsDiffMode()

bool KIGFX::GERBVIEW_RENDER_SETTINGS::IsDiffMode ( ) const
inline

Definition at line 127 of file gerbview_painter.h.

128  {
129  return m_diffMode;
130  }
bool m_diffMode
Flag determining if layers should be rendered in "diff" mode.

References m_diffMode.

◆ IsHighlightEnabled()

bool KIGFX::RENDER_SETTINGS::IsHighlightEnabled ( ) const
inlineinherited

Return current highlight setting.

Returns
True if highlight is enabled, false otherwise.

Definition at line 128 of file render_settings.h.

129  {
130  return m_highlightEnabled;
131  }

References KIGFX::RENDER_SETTINGS::m_highlightEnabled.

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), and PNS::TOOL_BASE::highlightNet().

◆ IsLineFill()

bool KIGFX::GERBVIEW_RENDER_SETTINGS::IsLineFill ( ) const
inline

Definition at line 107 of file gerbview_painter.h.

108  {
109  return m_lineFill;
110  }
bool m_lineFill
Flag determining if lines should be drawn with fill.

References m_lineFill.

◆ IsPolygonFill()

bool KIGFX::GERBVIEW_RENDER_SETTINGS::IsPolygonFill ( ) const
inline

Definition at line 112 of file gerbview_painter.h.

113  {
114  return m_polygonFill;
115  }
bool m_polygonFill
Flag determining if polygons should be drawn with fill.

References m_polygonFill.

◆ IsPrinting()

bool KIGFX::RENDER_SETTINGS::IsPrinting ( ) const
inlineinherited

Definition at line 209 of file render_settings.h.

209 { return m_isPrinting; }

References KIGFX::RENDER_SETTINGS::m_isPrinting.

◆ IsShowCodes()

bool KIGFX::GERBVIEW_RENDER_SETTINGS::IsShowCodes ( ) const
inline

Definition at line 122 of file gerbview_painter.h.

123  {
124  return m_showCodes;
125  }
bool m_showCodes
Flag determining if D-Codes should be drawn.

References m_showCodes.

◆ IsShowNegativeItems()

bool KIGFX::GERBVIEW_RENDER_SETTINGS::IsShowNegativeItems ( ) const
inline

Definition at line 117 of file gerbview_painter.h.

118  {
119  return m_showNegativeItems;
120  }
bool m_showNegativeItems
Flag determining if negative items should be drawn with a "ghost" color.

References m_showNegativeItems.

Referenced by KIGFX::GERBVIEW_PAINTER::draw().

◆ IsSpotFill()

bool KIGFX::GERBVIEW_RENDER_SETTINGS::IsSpotFill ( ) const
inline

Definition at line 102 of file gerbview_painter.h.

103  {
104  return m_spotFill;
105  }
bool m_spotFill
Flag determining if spots should be drawn with fill.

References m_spotFill.

◆ LoadColors()

void GERBVIEW_RENDER_SETTINGS::LoadColors ( const COLOR_SETTINGS aSettings)
overridevirtual

Reimplemented from KIGFX::RENDER_SETTINGS.

Definition at line 55 of file gerbview_painter.cpp.

56 {
57  size_t palette_size = aSettings->m_Palette.size();
58  size_t palette_idx = 0;
59 
60  // Layers to draw gerber data read from gerber files:
61  for( int i = GERBVIEW_LAYER_ID_START;
63  {
64  COLOR4D baseColor = aSettings->GetColor( i );
65 
66  if( baseColor == COLOR4D::UNSPECIFIED )
67  baseColor = aSettings->m_Palette[ ( palette_idx++ ) % palette_size ];
68 
69  m_layerColors[i] = baseColor;
70  m_layerColorsHi[i] = baseColor.Brightened( 0.5 );
71  m_layerColorsSel[i] = baseColor.Brightened( 0.8 );
72  m_layerColorsDark[i] = baseColor.Darkened( 0.25 );
73  }
74 
75  // Draw layers specific to Gerbview:
76  // LAYER_DCODES, LAYER_NEGATIVE_OBJECTS, LAYER_GERBVIEW_GRID,
77  // LAYER_GERBVIEW_AXES, LAYER_GERBVIEW_BACKGROUND, LAYER_GERBVIEW_DRAWINGSHEET,
78  for( int i = LAYER_DCODES; i < GERBVIEW_LAYER_ID_END; i++ )
79  m_layerColors[i] = aSettings->GetColor( i );
80 
81  for( int i = GAL_LAYER_ID_START; i < GAL_LAYER_ID_END; i++ )
82  m_layerColors[i] = aSettings->GetColor( i );
83 
84  update();
85 }
COLOR4D m_layerColorsHi[LAYER_ID_COUNT]
COLOR4D m_layerColors[LAYER_ID_COUNT]
COLOR4D Darkened(double aFactor) const
Return a color that is darker by a given factor, without modifying object.
Definition: color4d.h:279
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
Definition: color4d.h:265
COLOR4D m_layerColorsDark[LAYER_ID_COUNT]
virtual void update()
Precalculates extra colors for layers (e.g.
#define GERBER_DRAWLAYERS_COUNT
Definition: layer_ids.h:376
std::vector< COLOR4D > m_Palette
m_Pallete stores a list of colors that are used, in order, when a list of colors needs to be generate...
COLOR4D GetColor(int aLayer) const
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition: color4d.h:377
COLOR4D m_layerColorsSel[LAYER_ID_COUNT]
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References KIGFX::COLOR4D::Brightened(), KIGFX::COLOR4D::Darkened(), GAL_LAYER_ID_END, GAL_LAYER_ID_START, GERBER_DRAWLAYERS_COUNT, GERBVIEW_LAYER_ID_END, GERBVIEW_LAYER_ID_START, COLOR_SETTINGS::GetColor(), LAYER_DCODES, KIGFX::RENDER_SETTINGS::m_layerColors, KIGFX::RENDER_SETTINGS::m_layerColorsDark, KIGFX::RENDER_SETTINGS::m_layerColorsHi, KIGFX::RENDER_SETTINGS::m_layerColorsSel, COLOR_SETTINGS::m_Palette, KIGFX::COLOR4D::UNSPECIFIED, and KIGFX::RENDER_SETTINGS::update().

Referenced by GERBVIEW_FRAME::applyDisplaySettingsToGAL().

◆ LoadDisplayOptions()

void GERBVIEW_RENDER_SETTINGS::LoadDisplayOptions ( const GBR_DISPLAY_OPTIONS aOptions)

Load settings related to display options.

Parameters
aOptionsare settings that you want to use for displaying items.

Definition at line 88 of file gerbview_painter.cpp.

89 {
91  m_lineFill = aOptions.m_DisplayLinesFill;
94  m_showCodes = aOptions.m_DisplayDCodes;
95  m_diffMode = aOptions.m_DiffMode;
99 
100  update();
101 }
bool m_DisplayPolygonsFill
Option to draw polygons (filled/sketch)
bool m_showNegativeItems
Flag determining if negative items should be drawn with a "ghost" color.
COLOR4D m_BgDrawColor
The background color.
bool m_lineFill
Flag determining if lines should be drawn with fill.
bool m_HighContrastMode
High contrast mode (dim un-highlighted objects)
bool m_DisplayNegativeObjects
Option to draw negative objects in a specific color.
bool m_spotFill
Flag determining if spots should be drawn with fill.
bool m_DisplayLinesFill
Option to draw line items (filled/sketch)
bool m_showCodes
Flag determining if D-Codes should be drawn.
bool m_DiffMode
Display layers in diff mode.
bool m_hiContrastEnabled
Parameters for display modes.
virtual void update()
Precalculates extra colors for layers (e.g.
bool m_DisplayFlashedItemsFill
Option to draw flashed items (filled/sketch)
bool m_polygonFill
Flag determining if polygons should be drawn with fill.
bool m_DisplayDCodes
Option to show dcode values on items drawn with a dcode tool.
bool m_diffMode
Flag determining if layers should be rendered in "diff" mode.

References KIGFX::RENDER_SETTINGS::m_backgroundColor, GBR_DISPLAY_OPTIONS::m_BgDrawColor, GBR_DISPLAY_OPTIONS::m_DiffMode, m_diffMode, GBR_DISPLAY_OPTIONS::m_DisplayDCodes, GBR_DISPLAY_OPTIONS::m_DisplayFlashedItemsFill, GBR_DISPLAY_OPTIONS::m_DisplayLinesFill, GBR_DISPLAY_OPTIONS::m_DisplayNegativeObjects, GBR_DISPLAY_OPTIONS::m_DisplayPageLimits, GBR_DISPLAY_OPTIONS::m_DisplayPolygonsFill, KIGFX::RENDER_SETTINGS::m_hiContrastEnabled, GBR_DISPLAY_OPTIONS::m_HighContrastMode, m_lineFill, m_polygonFill, m_showCodes, m_showNegativeItems, KIGFX::RENDER_SETTINGS::m_showPageLimits, m_spotFill, and KIGFX::RENDER_SETTINGS::update().

Referenced by GERBVIEW_FRAME::applyDisplaySettingsToGAL().

◆ SetActiveLayer()

void KIGFX::RENDER_SETTINGS::SetActiveLayer ( PCB_LAYER_ID  aLayer)
inlineinherited

Definition at line 113 of file render_settings.h.

113 { m_activeLayer = aLayer; }

References KIGFX::RENDER_SETTINGS::m_activeLayer.

Referenced by PCB_DRAW_PANEL_GAL::SetHighContrastLayer().

◆ SetBackgroundColor()

void KIGFX::GERBVIEW_RENDER_SETTINGS::SetBackgroundColor ( const COLOR4D aColor)
inlineoverridevirtual

Set the background color.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 93 of file gerbview_painter.h.

94  {
96  }
COLOR4D m_layerColors[LAYER_ID_COUNT]

References LAYER_GERBVIEW_BACKGROUND, and KIGFX::RENDER_SETTINGS::m_layerColors.

◆ SetDefaultPenWidth()

◆ SetHighContrast()

void KIGFX::RENDER_SETTINGS::SetHighContrast ( bool  aEnabled)
inlineinherited

Turns on/off high contrast display mode.

Definition at line 185 of file render_settings.h.

185 { m_hiContrastEnabled = aEnabled; }
bool m_hiContrastEnabled
Parameters for display modes.

References KIGFX::RENDER_SETTINGS::m_hiContrastEnabled.

Referenced by DIALOG_PAD_PROPERTIES::onChangePadMode().

◆ SetHighContrastFactor()

void KIGFX::RENDER_SETTINGS::SetHighContrastFactor ( float  aFactor)
inlineinherited

Definition at line 272 of file render_settings.h.

272 { m_hiContrastFactor = aFactor; }

References KIGFX::RENDER_SETTINGS::m_hiContrastFactor.

Referenced by PCB_BASE_FRAME::LoadSettings().

◆ SetHighlight() [1/2]

void KIGFX::RENDER_SETTINGS::SetHighlight ( bool  aEnabled,
int  aNetcode = -1,
bool  aMulti = false 
)
inlineinherited

Turns on/off highlighting.

It may be done for the active layer or the specified net(s)..

Parameters
aEnabledtells if highlighting should be enabled.
aNetcodeis optional and if specified, turns on highlighting only for the net with number given as the parameter.

Definition at line 152 of file render_settings.h.

153  {
154  m_highlightEnabled = aEnabled;
155 
156  if( aEnabled )
157  {
158  if( !aMulti )
159  m_highlightNetcodes.clear();
160 
161  m_highlightNetcodes.insert( aNetcode );
162  }
163  else
164  m_highlightNetcodes.clear();
165  }
std::set< int > m_highlightNetcodes

References KIGFX::RENDER_SETTINGS::m_highlightEnabled, and KIGFX::RENDER_SETTINGS::m_highlightNetcodes.

Referenced by DIALOG_NET_INSPECTOR::buildNetsList(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PNS::TOOL_BASE::highlightNet(), APPEARANCE_CONTROLS::onNetclassContextMenu(), DIALOG_NET_INSPECTOR::onSelChanged(), DIALOG_NET_INSPECTOR::onSortingChanged(), GERBVIEW_SELECTION_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), and PCB_SELECTION_TOOL::Reset().

◆ SetHighlight() [2/2]

void KIGFX::RENDER_SETTINGS::SetHighlight ( std::set< int > &  aHighlight,
bool  aEnabled = true 
)
inlineinherited

Turns on highlighting and highlights multiple nets.

Parameters
aHighlightis a set of netcodes to highlight
aEnabledtells if highlighting should be enabled.

Definition at line 172 of file render_settings.h.

173  {
174  m_highlightEnabled = aEnabled;
175 
176  if( aEnabled )
177  m_highlightNetcodes = aHighlight;
178  else
179  m_highlightNetcodes.clear();
180  }
std::set< int > m_highlightNetcodes

References KIGFX::RENDER_SETTINGS::m_highlightEnabled, and KIGFX::RENDER_SETTINGS::m_highlightNetcodes.

◆ SetHighlightFactor()

void KIGFX::RENDER_SETTINGS::SetHighlightFactor ( float  aFactor)
inlineinherited

Definition at line 270 of file render_settings.h.

270 { m_highlightFactor = aFactor; }

References KIGFX::RENDER_SETTINGS::m_highlightFactor.

Referenced by PCB_BASE_FRAME::LoadSettings().

◆ SetIsPrinting()

void KIGFX::RENDER_SETTINGS::SetIsPrinting ( bool  isPrinting)
inlineinherited

Definition at line 210 of file render_settings.h.

210 { m_isPrinting = isPrinting; }

References KIGFX::RENDER_SETTINGS::m_isPrinting.

Referenced by BOARD_PRINTOUT::DrawPage().

◆ SetLayerColor()

void KIGFX::GERBVIEW_RENDER_SETTINGS::SetLayerColor ( int  aLayer,
const COLOR4D aColor 
)
inline

Change the color used to draw a layer.

Parameters
aLayeris the layer number.
aColoris the new color.

Definition at line 81 of file gerbview_painter.h.

82  {
83  m_layerColors[aLayer] = aColor;
84 
85  update(); // recompute other shades of the color
86  }
COLOR4D m_layerColors[LAYER_ID_COUNT]
virtual void update()
Precalculates extra colors for layers (e.g.

References KIGFX::RENDER_SETTINGS::m_layerColors, and KIGFX::RENDER_SETTINGS::update().

◆ SetLayerIsHighContrast()

void KIGFX::RENDER_SETTINGS::SetLayerIsHighContrast ( int  aLayerId,
bool  aEnabled = true 
)
inlineinherited

Set the specified layer as high-contrast.

Parameters
aLayerIdis a layer number that should be displayed in a specific mode.
aEnabledis the new layer state ( true = active or false = not active).

Definition at line 69 of file render_settings.h.

70  {
71  if( aEnabled )
72  m_highContrastLayers.insert( aLayerId );
73  else
74  m_highContrastLayers.erase( aLayerId );
75  }
std::set< unsigned int > m_highContrastLayers

References KIGFX::RENDER_SETTINGS::m_highContrastLayers.

Referenced by GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer(), PCB_DRAW_PANEL_GAL::SetHighContrastLayer(), and EDA_DRAW_PANEL_GAL::SetHighContrastLayer().

◆ SetMinPenWidth()

void KIGFX::RENDER_SETTINGS::SetMinPenWidth ( int  aWidth)
inlineinherited

Definition at line 204 of file render_settings.h.

204 { m_minPenWidth = aWidth; }

References KIGFX::RENDER_SETTINGS::m_minPenWidth.

◆ SetOutlineWidth()

void KIGFX::RENDER_SETTINGS::SetOutlineWidth ( float  aWidth)
inlineinherited

Set line width used for drawing outlines.

Parameters
aWidthis the new width.

Definition at line 265 of file render_settings.h.

266  {
267  m_outlineWidth = aWidth;
268  }

References KIGFX::RENDER_SETTINGS::m_outlineWidth.

◆ SetPrintDC()

◆ SetSelectFactor()

void KIGFX::RENDER_SETTINGS::SetSelectFactor ( float  aFactor)
inlineinherited

Definition at line 271 of file render_settings.h.

271 { m_selectFactor = aFactor; }

References KIGFX::RENDER_SETTINGS::m_selectFactor.

Referenced by PCB_BASE_FRAME::LoadSettings().

◆ SetShowPageLimits()

void KIGFX::RENDER_SETTINGS::SetShowPageLimits ( bool  aDraw)
inlineinherited

◆ update()

void RENDER_SETTINGS::update ( )
protectedvirtualinherited

Precalculates extra colors for layers (e.g.

highlighted, darkened and any needed version of base colors).

Definition at line 54 of file render_settings.cpp.

55 {
56  // Calculate darkened/highlighted variants of layer colors
57  for( int i = 0; i < LAYER_ID_COUNT; i++ )
58  {
61 
64 
65  // Linear brightening doesn't work well for colors near white
66  double factor = ( m_selectFactor * 0.6 ) + pow( m_layerColors[i].GetBrightness(), 3 );
67  m_layerColorsSel[i] = m_layerColors[i].Brightened( std::min( factor, 1.0 ) );
68  }
69 }
COLOR4D m_layerColorsHi[LAYER_ID_COUNT]
COLOR4D m_layerColors[LAYER_ID_COUNT]
COLOR4D Darkened(double aFactor) const
Return a color that is darker by a given factor, without modifying object.
Definition: color4d.h:279
COLOR4D m_hiContrastColor[LAYER_ID_COUNT]
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
Definition: color4d.h:265
COLOR4D m_layerColorsDark[LAYER_ID_COUNT]
PCB background color.
Definition: layer_ids.h:215
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Definition: color4d.h:292
#define LAYER_ID_COUNT
Must update this if you add any enums after GerbView!
Definition: layer_ids.h:422
COLOR4D m_layerColorsSel[LAYER_ID_COUNT]

References KIGFX::COLOR4D::Brightened(), KIGFX::COLOR4D::Darkened(), LAYER_ID_COUNT, LAYER_PCB_BACKGROUND, KIGFX::RENDER_SETTINGS::m_hiContrastColor, KIGFX::RENDER_SETTINGS::m_hiContrastFactor, KIGFX::RENDER_SETTINGS::m_highlightFactor, KIGFX::RENDER_SETTINGS::m_layerColors, KIGFX::RENDER_SETTINGS::m_layerColorsDark, KIGFX::RENDER_SETTINGS::m_layerColorsHi, KIGFX::RENDER_SETTINGS::m_layerColorsSel, KIGFX::RENDER_SETTINGS::m_selectFactor, and KIGFX::COLOR4D::Mix().

Referenced by KIGFX::DS_RENDER_SETTINGS::DS_RENDER_SETTINGS(), GERBVIEW_RENDER_SETTINGS(), LoadColors(), KIGFX::PCB_RENDER_SETTINGS::LoadColors(), LoadDisplayOptions(), KIGFX::PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS(), SetLayerColor(), and KIGFX::RENDER_SETTINGS::SetLayerColor().

Friends And Related Function Documentation

◆ GERBVIEW_PAINTER

friend class GERBVIEW_PAINTER
friend

Definition at line 49 of file gerbview_painter.h.

Member Data Documentation

◆ m_activeLayer

PCB_LAYER_ID KIGFX::RENDER_SETTINGS::m_activeLayer
protectedinherited

◆ m_attributeHighlightString

wxString KIGFX::GERBVIEW_RENDER_SETTINGS::m_attributeHighlightString

If set to anything but an empty string, will highlight items with matching attribute.

Definition at line 142 of file gerbview_painter.h.

Referenced by ClearHighlightSelections(), GERBVIEW_RENDER_SETTINGS(), and GetColor().

◆ m_backgroundColor

◆ m_componentHighlightString

wxString KIGFX::GERBVIEW_RENDER_SETTINGS::m_componentHighlightString

If set to anything but an empty string, will highlight items with matching component.

Definition at line 136 of file gerbview_painter.h.

Referenced by ClearHighlightSelections(), GERBVIEW_RENDER_SETTINGS(), and GetColor().

◆ m_dcodeHighlightValue

int KIGFX::GERBVIEW_RENDER_SETTINGS::m_dcodeHighlightValue

If set to anything but >0 (in fact 10 the min dcode value), will highlight items with matching dcode.

Definition at line 146 of file gerbview_painter.h.

Referenced by ClearHighlightSelections(), GERBVIEW_RENDER_SETTINGS(), and GetColor().

◆ m_defaultPenWidth

◆ m_diffMode

bool KIGFX::GERBVIEW_RENDER_SETTINGS::m_diffMode
protected

Flag determining if layers should be rendered in "diff" mode.

Definition at line 165 of file gerbview_painter.h.

Referenced by GERBVIEW_RENDER_SETTINGS(), IsDiffMode(), and LoadDisplayOptions().

◆ m_drawingSheetLineWidth

float KIGFX::RENDER_SETTINGS::m_drawingSheetLineWidth
protectedinherited

◆ m_hiContrastColor

COLOR4D KIGFX::RENDER_SETTINGS::m_hiContrastColor[LAYER_ID_COUNT]
protectedinherited

Definition at line 292 of file render_settings.h.

Referenced by GetColor(), and KIGFX::RENDER_SETTINGS::update().

◆ m_hiContrastEnabled

◆ m_hiContrastFactor

float KIGFX::RENDER_SETTINGS::m_hiContrastFactor
protectedinherited

◆ m_highContrastLayers

◆ m_highlightEnabled

◆ m_highlightFactor

float KIGFX::RENDER_SETTINGS::m_highlightFactor
protectedinherited

◆ m_highlightNetcodes

std::set<int> KIGFX::RENDER_SETTINGS::m_highlightNetcodes
protectedinherited

◆ m_isPrinting

bool KIGFX::RENDER_SETTINGS::m_isPrinting
protectedinherited

◆ m_layerColors

◆ m_layerColorsDark

COLOR4D KIGFX::RENDER_SETTINGS::m_layerColorsDark[LAYER_ID_COUNT]
protectedinherited

◆ m_layerColorsHi

COLOR4D KIGFX::RENDER_SETTINGS::m_layerColorsHi[LAYER_ID_COUNT]
protectedinherited

◆ m_layerColorsSel

COLOR4D KIGFX::RENDER_SETTINGS::m_layerColorsSel[LAYER_ID_COUNT]
protectedinherited

◆ m_lineFill

bool KIGFX::GERBVIEW_RENDER_SETTINGS::m_lineFill
protected

Flag determining if lines should be drawn with fill.

Definition at line 153 of file gerbview_painter.h.

Referenced by KIGFX::GERBVIEW_PAINTER::draw(), GERBVIEW_RENDER_SETTINGS(), IsLineFill(), and LoadDisplayOptions().

◆ m_minPenWidth

◆ m_netHighlightString

wxString KIGFX::GERBVIEW_RENDER_SETTINGS::m_netHighlightString

If set to anything but an empty string, will highlight items with matching net.

Definition at line 139 of file gerbview_painter.h.

Referenced by ClearHighlightSelections(), GERBVIEW_RENDER_SETTINGS(), and GetColor().

◆ m_outlineWidth

◆ m_polygonFill

bool KIGFX::GERBVIEW_RENDER_SETTINGS::m_polygonFill
protected

◆ m_printDC

wxDC* KIGFX::RENDER_SETTINGS::m_printDC
protectedinherited

◆ m_selectFactor

float KIGFX::RENDER_SETTINGS::m_selectFactor
protectedinherited

◆ m_showCodes

bool KIGFX::GERBVIEW_RENDER_SETTINGS::m_showCodes
protected

Flag determining if D-Codes should be drawn.

Definition at line 162 of file gerbview_painter.h.

Referenced by GERBVIEW_RENDER_SETTINGS(), IsShowCodes(), and LoadDisplayOptions().

◆ m_showNegativeItems

bool KIGFX::GERBVIEW_RENDER_SETTINGS::m_showNegativeItems
protected

Flag determining if negative items should be drawn with a "ghost" color.

Definition at line 159 of file gerbview_painter.h.

Referenced by GERBVIEW_RENDER_SETTINGS(), GetColor(), IsShowNegativeItems(), and LoadDisplayOptions().

◆ m_showPageLimits

◆ m_spotFill

bool KIGFX::GERBVIEW_RENDER_SETTINGS::m_spotFill
protected

Flag determining if spots should be drawn with fill.

Definition at line 150 of file gerbview_painter.h.

Referenced by KIGFX::GERBVIEW_PAINTER::draw(), GERBVIEW_RENDER_SETTINGS(), IsSpotFill(), and LoadDisplayOptions().

◆ MAX_FONT_SIZE

const double GERBVIEW_RENDER_SETTINGS::MAX_FONT_SIZE = Millimeter2iu( 10.0 )
staticprotected

Maximum font size for D-Codes and other strings.

Definition at line 168 of file gerbview_painter.h.


The documentation for this class was generated from the following files: