38 PCB_DIFF_PAINTER( KIGFX::GAL* aGal, std::map<KIID, KIGFX::COLOR4D> aOverrides ) :
40 m_overrides( std::
move( aOverrides ) ),
41 m_dimmed( std::make_shared<std::set<KIID>>() )
47 std::shared_ptr<std::set<KIID>> DimmedSet()
const {
return m_dimmed; }
49 bool Draw(
const KIGFX::VIEW_ITEM* aItem,
int aLayer )
override
51 const EDA_ITEM* edaItem =
dynamic_cast<const EDA_ITEM*
>( aItem );
55 KIID key = edaItem->
m_Uuid;
57 if( m_overrides.count( key ) == 0 )
59 if(
const BOARD_ITEM* boardItem =
dynamic_cast<const BOARD_ITEM*
>( aItem ) )
61 if(
const FOOTPRINT* fp = boardItem->GetParentFootprint() )
66 auto it = m_overrides.find( key );
68 if( it != m_overrides.end() && m_dimmed->count( key ) == 0 )
73 KIGFX::PCB_RENDER_SETTINGS* settings = GetSettings();
88 std::map<KIID, KIGFX::COLOR4D> m_overrides;
89 std::shared_ptr<std::set<KIID>> m_dimmed;
100 std::vector<KIGFX::VIEW_ITEM*> items;
102 items.push_back( &aFootprint );
105 items.push_back( field );
108 items.push_back( item );
111 items.push_back(
pad );
114 items.push_back( zone );
122 std::vector<KIGFX::VIEW_ITEM*> items;
125 items.push_back( track );
128 items.push_back( zone );
131 items.push_back( item );
136 items.insert( items.end(), fpItems.begin(), fpItems.end() );
174 std::map<KIID, KIGFX::COLOR4D> aOverrides )
176 auto painter = std::make_unique<PCB_DIFF_PAINTER>( aGal, std::move( aOverrides ) );
184 const KIGFX::COLOR4D& aColor,
const std::map<KIID, KIGFX::COLOR4D>& aOverrides,
185 const std::vector<KIGFX::VIEW_ITEM*>& aExtraItems,
186 const std::map<KIID, KICAD_DIFF::CATEGORY>& aCategories )
188 auto painter = std::make_unique<PCB_DIFF_PAINTER>( aCanvas.
GetGAL(), aOverrides );
191 std::shared_ptr<std::set<KIID>> dimmed = painter->DimmedSet();
203 dimmed->insert( eda->
m_Uuid );
205 dimmed->erase( eda->
m_Uuid );
208 std::vector<KIGFX::VIEW_ITEM*> items;
213 items.insert( items.end(), refItems.begin(), refItems.end() );
219 items.insert( items.end(), compItems.begin(), compItems.end() );
222 items.insert( items.end(), aExtraItems.begin(), aExtraItems.end() );
228 std::map<KIGFX::VIEW_ITEM*, KICAD_DIFF::CATEGORY> itemCategories;
237 auto it = aCategories.find( edaItem->
m_Uuid );
239 if( it != aCategories.end() )
240 itemCategories[viewItem] = it->second;
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
const ZONES & Zones() const
const FOOTPRINTS & Footprints() const
const TRACKS & Tracks() const
const DRAWINGS & Drawings() const
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
A base class for most all the KiCad significant classes used in schematics and boards.
A color representation with 4 components: red, green, blue, alpha.
Abstract interface for drawing on a 2D-surface.
Contains methods for drawing PCB-specific items.
virtual bool Draw(const VIEW_ITEM *aItem, int aLayer) override
Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item.
PCB specific render settings.
void SetBackgroundColor(const COLOR4D &aColor) override
Set the background color.
void LoadDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Load settings related to display options (high-contrast mode, full or outline modes for vias/pads/tra...
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Change the color used to draw a layer.
void SetHighContrast(bool aEnabled)
Turns on/off high contrast display mode.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
An abstract base class for deriving all objects that can be added to a VIEW.
double m_TrackOpacity
Opacity override for all tracks.
double m_FilledShapeOpacity
Opacity override for graphic shapes.
double m_ZoneOpacity
Opacity override for filled zone areas.
double m_ImageOpacity
Opacity override for user images.
double m_PadOpacity
Opacity override for SMD pads and PTHs.
double m_ViaOpacity
Opacity override for all types of via.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
ZONE_DISPLAY_MODE m_ZoneDisplayMode
Handle a list of polygons defining a copper zone.
#define LAYER_ID_COUNT
Must update this if you add any enums after Gerbview!
@ LAYER_PCB_BACKGROUND
PCB background color.
std::vector< KIGFX::VIEW_ITEM * > CollectBoardDiffContextItems(BOARD &aBoard)
void ConfigurePcbDiffCanvasContext(WIDGET_DIFF_CANVAS &aCanvas, BOARD *aReference, BOARD *aComparison, const KIGFX::COLOR4D &aColor, const std::map< KIID, KIGFX::COLOR4D > &aOverrides, const std::vector< KIGFX::VIEW_ITEM * > &aExtraItems, const std::map< KIID, KICAD_DIFF::CATEGORY > &aCategories)
std::unique_ptr< KIGFX::PAINTER > MakePcbDiffContextPainter(KIGFX::GAL *aGal, const KIGFX::COLOR4D &aColor, std::map< KIID, KIGFX::COLOR4D > aOverrides)
void ConfigurePcbDiffContextRenderSettings(KIGFX::PCB_RENDER_SETTINGS &aSettings, const KIGFX::COLOR4D &aColor)
std::vector< KIGFX::VIEW_ITEM * > CollectFootprintDiffContextItems(FOOTPRINT &aFootprint)
void ApplyPcbGalLayerOrder(KIGFX::VIEW *aView)
Apply pcbnew's canonical GAL layer order (copper and zones below silk, fab and courtyard) to any view...
wxString result
Test unit parsing edge cases and error handling.