KiCad PCB EDA Suite
KIGFX::SCH_VIEW Class Reference

#include <sch_view.h>

Inheritance diagram for KIGFX::SCH_VIEW:
KIGFX::VIEW

Public Types

typedef std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
 

Public Member Functions

 SCH_VIEW (bool aIsDynamic, SCH_BASE_FRAME *aFrame)
 
 ~SCH_VIEW ()
 
void DisplaySheet (SCH_SHEET *aSheet)
 
void DisplaySheet (SCH_SCREEN *aScreen)
 
void DisplayComponent (LIB_PART *aPart)
 
void ResizeSheetWorkingArea (SCH_SCREEN *aScreen)
 
void ClearPreview ()
 
void AddToPreview (EDA_ITEM *aItem, bool aTakeOwnership=true)
 
void ShowPreview (bool aShow=true)
 
void SetScale (double aScale, VECTOR2D aAnchor={ 0, 0 }) override
 Function SetScale() Sets the scaling factor, zooming around a given anchor point. More...
 
void ClearHiddenFlags ()
 Clear the hide flag of all items in the view. More...
 
void HideWorksheet ()
 
void HighlightItem (EDA_ITEM *aItem, LIB_PIN *aPin=nullptr)
 
virtual void Add (VIEW_ITEM *aItem, int aDrawPriority=-1)
 Function Add() Adds a VIEW_ITEM to the view. More...
 
virtual void Remove (VIEW_ITEM *aItem)
 Function Remove() Removes a VIEW_ITEM from the view. More...
 
virtual int Query (const BOX2I &aRect, std::vector< LAYER_ITEM_PAIR > &aResult) const
 Function Query() Finds all visible items that touch or are within the rectangle aRect. More...
 
void SetVisible (VIEW_ITEM *aItem, bool aIsVisible=true)
 Sets the item visibility. More...
 
void Hide (VIEW_ITEM *aItem, bool aHide=true)
 Temporarily hides the item in the view (e.g. More...
 
bool IsVisible (const VIEW_ITEM *aItem) const
 Returns information if the item is visible (or not). More...
 
virtual void Update (VIEW_ITEM *aItem, int aUpdateFlags)
 For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has changed. More...
 
virtual void Update (VIEW_ITEM *aItem)
 
void SetRequired (int aLayerId, int aRequiredId, bool aRequired=true)
 Function SetRequired() Marks the aRequiredId layer as required for the aLayerId layer. More...
 
void CopySettings (const VIEW *aOtherView)
 Function CopySettings() Copies layers and visibility settings from another view. More...
 
void SetGAL (GAL *aGal)
 Function SetGAL() Assigns a rendering device for the VIEW. More...
 
GALGetGAL () const
 Function GetGAL() Returns the GAL this view is using to draw graphical primitives. More...
 
void SetPainter (PAINTER *aPainter)
 Function SetPainter() Sets the painter object used by the view for drawing VIEW_ITEMS. More...
 
PAINTERGetPainter () const
 Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS. More...
 
void SetViewport (const BOX2D &aViewport)
 Function SetViewport() Sets the visible area of the VIEW. More...
 
BOX2D GetViewport () const
 Function GetViewport() Returns the current viewport visible area rectangle. More...
 
void SetMirror (bool aMirrorX, bool aMirrorY)
 Function SetMirror() Controls the mirroring of the VIEW. More...
 
bool IsMirroredX () const
 Function IsMirroredX() Returns true if view is flipped across the X axis. More...
 
bool IsMirroredY () const
 Function IsMirroredX() Returns true if view is flipped across the Y axis. More...
 
double GetScale () const
 Function GetScale() More...
 
void SetBoundary (const BOX2D &aBoundary)
 Function SetBoundary() Sets limits for view area. More...
 
void SetBoundary (const BOX2I &aBoundary)
 Function SetBoundary() Sets limits for view area. More...
 
const BOX2DGetBoundary () const
 Function GetBoundary() More...
 
void SetScaleLimits (double aMaximum, double aMinimum)
 Function SetScaleLimits() Sets minimum and maximum values for scale. More...
 
void SetCenter (const VECTOR2D &aCenter)
 Function SetCenter() Sets the center point of the VIEW (i.e. More...
 
void SetCenter (VECTOR2D aCenter, const BOX2D &occultingScreenRect)
 Function SetCenter() Sets the center point of the VIEW, attempting to avoid occultingScreenRect (for instance, the screen rect of a modeless dialog in front of the VIEW). More...
 
const VECTOR2DGetCenter () const
 Function GetCenter() Returns the center point of this VIEW (in world space coordinates) More...
 
VECTOR2D ToWorld (const VECTOR2D &aCoord, bool aAbsolute=true) const
 Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates. More...
 
double ToWorld (double aSize) const
 Function ToWorld() Converts a screen space one dimensional size to a one dimensional size in world space coordinates. More...
 
VECTOR2D ToScreen (const VECTOR2D &aCoord, bool aAbsolute=true) const
 Function ToScreen() Converts a world space point/vector to a point/vector in screen space coordinates. More...
 
double ToScreen (double aSize) const
 Function ToScreen() Converts a world space one dimensionsal size to a one dimensional size in screen space. More...
 
const VECTOR2IGetScreenPixelSize () const
 Function GetScreenPixelSize() Returns the size of the our rendering area, in pixels. More...
 
void AddLayer (int aLayer, bool aDisplayOnly=false)
 Function AddLayer() Adds a new layer to the view. More...
 
void ClearLayer (int aLayer)
 Function ClearLayer() Removes all items from a given layer. More...
 
void Clear ()
 Function Clear() Removes all items from the view. More...
 
void SetLayerVisible (int aLayer, bool aVisible=true)
 Function SetLayerVisible() Controls the visibility of a particular layer. More...
 
bool IsLayerVisible (int aLayer) const
 Function IsLayerVisible() Returns information about visibility of a particular layer. More...
 
void SetLayerDisplayOnly (int aLayer, bool aDisplayOnly=true)
 
void SetLayerTarget (int aLayer, RENDER_TARGET aTarget)
 Function SetLayerTarget() Changes the rendering target for a particular layer. More...
 
void SetLayerOrder (int aLayer, int aRenderingOrder)
 Function SetLayerOrder() Sets rendering order of a particular layer. More...
 
int GetLayerOrder (int aLayer) const
 Function GetLayerOrder() Returns rendering order of a particular layer. More...
 
void SortLayers (int aLayers[], int &aCount) const
 Function SortLayers() Changes the order of given layer ids, so after sorting the order corresponds to layers rendering order (descending, ie. More...
 
void ReorderLayerData (std::unordered_map< int, int > aReorderMap)
 Remaps the data between layer ids without invalidating that data. More...
 
void UpdateLayerColor (int aLayer)
 Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it has changed. More...
 
void UpdateAllLayersColor ()
 Function UpdateAllLayersColor() Applies the new coloring scheme to all layers. More...
 
virtual void SetTopLayer (int aLayer, bool aEnabled=true)
 Function SetTopLayer() Sets given layer to be displayed on the top or sets back the default order of layers. More...
 
virtual void EnableTopLayer (bool aEnable)
 Function EnableTopLayer() Enables or disables display of the top layer. More...
 
virtual int GetTopLayer () const
 
void ClearTopLayers ()
 Function ClearTopLayers() Removes all layers from the on-the-top set (they are no longer displayed over the rest of layers). More...
 
void UpdateAllLayersOrder ()
 Function UpdateLayerOrder() Does everything that is needed to apply the rendering order of layers. More...
 
void ClearTargets ()
 Function ClearTargets() Clears targets that are marked as dirty. More...
 
virtual void Redraw ()
 Function Redraw() Immediately redraws the whole view. More...
 
void RecacheAllItems ()
 Function RecacheAllItems() Rebuilds GAL display lists. More...
 
bool IsDynamic () const
 Function IsDynamic() Tells if the VIEW is dynamic (ie. More...
 
bool IsDirty () const
 Function IsDirty() Returns true if any of the VIEW layers needs to be refreshened. More...
 
bool IsTargetDirty (int aTarget) const
 Function IsTargetDirty() Returns true if any of layers belonging to the target or the target itself should be redrawn. More...
 
void MarkTargetDirty (int aTarget)
 Function MarkTargetDirty() Sets or clears target 'dirty' flag. More...
 
bool IsCached (int aLayer) const
 Returns true if the layer is cached. More...
 
void MarkDirty ()
 Function MarkDirty() Forces redraw of view on the next rendering. More...
 
void MarkForUpdate (VIEW_ITEM *aItem)
 Function MarkForUpdate() Adds an item to a list of items that are going to be refreshed upon the next frame rendering. More...
 
void UpdateItems ()
 Function UpdateItems() Iterates through the list of items that asked for updating and updates them. More...
 
void UpdateAllItems (int aUpdateFlags)
 Updates all items in the view according to the given flags. More...
 
void UpdateAllItemsConditionally (int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
 Updates items in the view according to the given flags and condition. More...
 
bool IsUsingDrawPriority () const
 Function IsUsingDrawPriority() More...
 
void UseDrawPriority (bool aFlag)
 Function UseDrawPriority() More...
 
bool IsDrawOrderReversed () const
 Function IsDrawOrderReversed() More...
 
void ReverseDrawOrder (bool aFlag)
 Function ReverseDrawOrder() Only takes effect if UseDrawPriority is true. More...
 
std::shared_ptr< VIEW_OVERLAYMakeOverlay ()
 
std::unique_ptr< VIEWDataReference () const
 Returns a new VIEW object that shares the same set of VIEW_ITEMs and LAYERs. More...
 
int GetPrintMode ()
 
void SetPrintMode (int aPrintMode)
 Set the printing mode. More...
 

Static Public Member Functions

static void OnDestroy (VIEW_ITEM *aItem)
 

Static Public Attributes

static constexpr int VIEW_MAX_LAYERS = 512
 maximum number of layers that may be shown More...
 

Protected Types

typedef std::unordered_map< int, VIEW_LAYERLAYER_MAP
 
typedef LAYER_MAP::iterator LAYER_MAP_ITER
 
typedef std::vector< VIEW_LAYER * > LAYER_ORDER
 
typedef std::vector< VIEW_LAYER * >::iterator LAYER_ORDER_ITER
 

Protected Member Functions

void redrawRect (const BOX2I &aRect)
 
void markTargetClean (int aTarget)
 
void draw (VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
 Function draw() Draws an item, but on a specified layers. More...
 
void draw (VIEW_ITEM *aItem, bool aImmediate=false)
 Function draw() Draws an item on all layers that the item uses. More...
 
void draw (VIEW_GROUP *aGroup, bool aImmediate=false)
 Function draw() Draws a group of items on all layers that those items use. More...
 
void sortLayers ()
 
void clearGroupCache ()
 
void invalidateItem (VIEW_ITEM *aItem, int aUpdateFlags)
 Function invalidateItem() Manages dirty flags & redraw queueing when updating an item. More...
 
void updateItemColor (VIEW_ITEM *aItem, int aLayer)
 Updates colors that are used for an item to be drawn. More...
 
void updateItemGeometry (VIEW_ITEM *aItem, int aLayer)
 Updates all informations needed to draw an item. More...
 
void updateBbox (VIEW_ITEM *aItem)
 Updates bounding box of an item. More...
 
void updateLayers (VIEW_ITEM *aItem)
 Updates set of layers that an item occupies. More...
 
bool areRequiredLayersEnabled (int aLayerId) const
 Checks if every layer required by the aLayerId layer is enabled. More...
 

Static Protected Member Functions

static bool compareRenderingOrder (VIEW_LAYER *aI, VIEW_LAYER *aJ)
 Determines rendering order of layers. Used in display order sorting function. More...
 

Protected Attributes

bool m_enableOrderModifier
 
LAYER_MAP m_layers
 Contains set of possible displayed layers and its properties. More...
 
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
 Flat list of all items. More...
 
LAYER_ORDER m_orderedLayers
 Sorted list of pointers to members of m_layers. More...
 
std::set< unsigned int > m_topLayers
 Stores set of layers that are displayed on the top. More...
 
VECTOR2D m_center
 Center point of the VIEW (the point at which we are looking at) More...
 
double m_scale
 Scale of displayed VIEW_ITEMs. More...
 
BOX2D m_boundary
 View boundaries. More...
 
double m_minScale
 Scale lower limit. More...
 
double m_maxScale
 Scale upper limit. More...
 
bool m_mirrorX
 

Horizontal flip flag

More...
 
bool m_mirrorY
 

Vertical flip flag

More...
 
PAINTERm_painter
 PAINTER contains information how do draw items. More...
 
GALm_gal
 Gives interface to PAINTER, that is used to draw items. More...
 
bool m_dynamic
 Dynamic VIEW (eg. More...
 
bool m_dirtyTargets [TARGETS_NUMBER]
 Flags to mark targets as dirty, so they have to be redrawn on the next refresh event. More...
 
bool m_useDrawPriority
 Flat list of all items Flag to respect draw priority when drawing items. More...
 
int m_nextDrawPriority
 The next sequential drawing priority. More...
 
bool m_reverseDrawOrder
 Flag to reverse the draw order when using draw priority. More...
 
int m_printMode
 A control for printing: m_printMode <= 0 means no printing mode (normal draw mode m_printMode > 0 is a printing mode (currently means "we are in printing mode") More...
 

Static Protected Attributes

static const int TOP_LAYER_MODIFIER = -VIEW_MAX_LAYERS
 Rendering order modifier for layers that are marked as top layers. More...
 

Private Attributes

SCH_BASE_FRAMEm_frame
 
std::unique_ptr< WS_PROXY_VIEW_ITEMm_worksheet
 
std::unique_ptr< KIGFX::PREVIEW::SELECTION_AREAm_selectionArea
 
std::unique_ptr< KIGFX::VIEW_GROUPm_preview
 
std::vector< EDA_ITEM * > m_ownedItems
 

Detailed Description

Definition at line 72 of file sch_view.h.

Member Typedef Documentation

◆ LAYER_ITEM_PAIR

typedef std::pair<VIEW_ITEM*, int> KIGFX::VIEW::LAYER_ITEM_PAIR
inherited

Definition at line 66 of file view.h.

◆ LAYER_MAP

typedef std::unordered_map<int, VIEW_LAYER> KIGFX::VIEW::LAYER_MAP
protectedinherited

Definition at line 716 of file view.h.

◆ LAYER_MAP_ITER

typedef LAYER_MAP::iterator KIGFX::VIEW::LAYER_MAP_ITER
protectedinherited

Definition at line 717 of file view.h.

◆ LAYER_ORDER

typedef std::vector<VIEW_LAYER*> KIGFX::VIEW::LAYER_ORDER
protectedinherited

Definition at line 718 of file view.h.

◆ LAYER_ORDER_ITER

typedef std::vector<VIEW_LAYER*>::iterator KIGFX::VIEW::LAYER_ORDER_ITER
protectedinherited

Definition at line 719 of file view.h.

Constructor & Destructor Documentation

◆ SCH_VIEW()

KIGFX::SCH_VIEW::SCH_VIEW ( bool  aIsDynamic,
SCH_BASE_FRAME aFrame 
)

Definition at line 47 of file sch_view.cpp.

47  :
48  VIEW( aIsDynamic )
49 {
50  m_frame = aFrame;
51  // Set m_boundary to define the max working area size. The default value
52  // is acceptable for Pcbnew and Gerbview, but too large for Eeschema due to
53  // very different internal units.
54  // So we have to use a smaller value.
55  // A full size = 3 * MAX_PAGE_SIZE_MILS size allows a wide margin
56  // around the worksheet.
57  double max_size = MAX_PAGE_SIZE_MILS * IU_PER_MILS * 3.0;
58  m_boundary.SetOrigin( -max_size/4, -max_size/4 );
59  m_boundary.SetSize( max_size, max_size );
60 
62  m_preview.reset( new KIGFX::VIEW_GROUP() );
63 }
void SetSize(const Vec &size)
Definition: box2.h:210
std::unique_ptr< KIGFX::PREVIEW::SELECTION_AREA > m_selectionArea
Definition: sch_view.h:108
BOX2D m_boundary
View boundaries.
Definition: view.h:830
void SetOrigin(const Vec &pos)
Definition: box2.h:208
#define IU_PER_MILS
Definition: plotter.cpp:134
SCH_BASE_FRAME * m_frame
Definition: sch_view.h:104
Class SELECTION_AREA.
#define MAX_PAGE_SIZE_MILS
Definition: page_info.h:41
VIEW(bool aIsDynamic=true)
Constructor.
Definition: view.cpp:286
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: sch_view.h:109

References IU_PER_MILS, KIGFX::VIEW::m_boundary, m_frame, m_preview, m_selectionArea, MAX_PAGE_SIZE_MILS, BOX2< Vec >::SetOrigin(), and BOX2< Vec >::SetSize().

◆ ~SCH_VIEW()

KIGFX::SCH_VIEW::~SCH_VIEW ( )

Definition at line 66 of file sch_view.cpp.

67 {
68 }

Member Function Documentation

◆ Add()

void KIGFX::VIEW::Add ( VIEW_ITEM aItem,
int  aDrawPriority = -1 
)
virtualinherited

Function Add() Adds a VIEW_ITEM to the view.

Set aDrawPriority to -1 to assign sequential priorities.

Parameters
aItemitem to be added. No ownership is given
aDrawPrioritypriority to draw this item on its layer, lowest first.

Reimplemented in KIGFX::PCB_VIEW.

Definition at line 346 of file view.cpp.

347 {
348  int layers[VIEW_MAX_LAYERS], layers_count;
349 
350  if( aDrawPriority < 0 )
351  aDrawPriority = m_nextDrawPriority++;
352 
353  if( !aItem->m_viewPrivData )
354  aItem->m_viewPrivData = new VIEW_ITEM_DATA;
355 
356  aItem->m_viewPrivData->m_view = this;
357  aItem->m_viewPrivData->m_drawPriority = aDrawPriority;
358 
359  aItem->ViewGetLayers( layers, layers_count );
360  aItem->viewPrivData()->saveLayers( layers, layers_count );
361 
362  m_allItems->push_back( aItem );
363 
364  for( int i = 0; i < layers_count; ++i )
365  {
366  VIEW_LAYER& l = m_layers[layers[i]];
367  l.items->Insert( aItem );
368  MarkTargetDirty( l.target );
369  }
370 
371  SetVisible( aItem, true );
372  Update( aItem, KIGFX::INITIAL_ADD );
373 }
Layers have changed.
Definition: view_item.h:59
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:701
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:815
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
int m_nextDrawPriority
The next sequential drawing priority.
Definition: view.h:865
size_t i
Definition: json11.cpp:597
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1486
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References i, KIGFX::INITIAL_ADD, KIGFX::VIEW::VIEW_LAYER::items, KIGFX::VIEW::m_allItems, KIGFX::VIEW_ITEM_DATA::m_drawPriority, KIGFX::VIEW::m_layers, KIGFX::VIEW::m_nextDrawPriority, KIGFX::VIEW_ITEM_DATA::m_view, KIGFX::VIEW_ITEM::m_viewPrivData, KIGFX::VIEW::MarkTargetDirty(), KIGFX::VIEW_ITEM_DATA::saveLayers(), KIGFX::VIEW::SetVisible(), KIGFX::VIEW::VIEW_LAYER::target, KIGFX::VIEW::Update(), KIGFX::VIEW::VIEW_MAX_LAYERS, KIGFX::VIEW_ITEM::ViewGetLayers(), and KIGFX::VIEW_ITEM::viewPrivData().

Referenced by KIGFX::PCB_VIEW::Add(), SCH_BASE_FRAME::AddToScreen(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PCB_DRAW_PANEL_GAL::DisplayBoard(), DisplayComponent(), SYMBOL_PREVIEW_WIDGET::DisplayPart(), DisplaySheet(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), PL_DRAW_PANEL_GAL::DisplayWorksheet(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), LIB_EDIT_TOOL::Duplicate(), GRID_HELPER::GRID_HELPER(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), KIGFX::VIEW::MakeOverlay(), LIB_EDIT_TOOL::Paste(), DRAWING_TOOL::PlaceImportedGraphics(), DIALOG_PAD_PROPERTIES::prepareCanvas(), BOARD_COMMIT::Push(), GERBVIEW_FRAME::Read_EXCELLON_File(), GERBVIEW_FRAME::Read_GERBER_File(), DIALOG_PAD_PROPERTIES::redraw(), PCB_EDITOR_CONTROL::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), BOARD_COMMIT::Revert(), GERBVIEW_SELECTION_TOOL::select(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), PNS_KICAD_IFACE::SetView(), PNS_PCBNEW_DEBUG_DECORATOR::SetView(), PCB_DRAW_PANEL_GAL::SetWorksheet(), GERBVIEW_DRAW_PANEL_GAL::SetWorksheet(), GERBVIEW_DRAW_PANEL_GAL::SwitchBackend(), WS_DATA_ITEM::SyncDrawItems(), WS_DATA_ITEM_POLYGONS::SyncDrawItems(), WS_DATA_ITEM_TEXT::SyncDrawItems(), WS_DATA_ITEM_BITMAP::SyncDrawItems(), DIALOG_ERC::TestErc(), EE_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), LIB_VIEW_FRAME::updatePreviewSymbol(), and ZONE_CREATE_HELPER::ZONE_CREATE_HELPER().

◆ AddLayer()

void KIGFX::VIEW::AddLayer ( int  aLayer,
bool  aDisplayOnly = false 
)
inherited

Function AddLayer() Adds a new layer to the view.

Parameters
aLayerunique ID of the layer to be added.
aDisplayOnlylayer is display-only (example: selection boxes, floating hints/menus). Objects belonging to this layer are not taken into account by Query() method.

Definition at line 331 of file view.cpp.

332 {
333  if( m_layers.find( aLayer ) == m_layers.end() )
334  {
335  m_layers[aLayer] = VIEW_LAYER();
336  m_layers[aLayer].items.reset( new VIEW_RTREE() );
337  m_layers[aLayer].id = aLayer;
338  m_layers[aLayer].renderingOrder = aLayer;
339  m_layers[aLayer].visible = true;
340  m_layers[aLayer].displayOnly = aDisplayOnly;
341  m_layers[aLayer].target = TARGET_CACHED;
342  }
343 }
Main rendering target (cached)
Definition: definitions.h:48
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::m_layers, and KIGFX::TARGET_CACHED.

Referenced by KIGFX::VIEW::VIEW().

◆ AddToPreview()

void KIGFX::SCH_VIEW::AddToPreview ( EDA_ITEM aItem,
bool  aTakeOwnership = true 
)

Definition at line 155 of file sch_view.cpp.

156 {
157  Hide( aItem, false );
158  m_preview->Add( aItem );
159 
160  if( aTakeOwnership )
161  m_ownedItems.push_back( aItem );
162 
163  SetVisible( m_preview.get(), true );
164  Hide( m_preview.get(), false );
165  Update( m_preview.get() );
166 }
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hides the item in the view (e.g.
Definition: view.cpp:1507
std::vector< EDA_ITEM * > m_ownedItems
Definition: sch_view.h:110
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1486
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: sch_view.h:109

References KIGFX::VIEW::Hide(), m_ownedItems, m_preview, KIGFX::VIEW::SetVisible(), and KIGFX::VIEW::Update().

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ areRequiredLayersEnabled()

bool KIGFX::VIEW::areRequiredLayersEnabled ( int  aLayerId) const
protectedinherited

Checks if every layer required by the aLayerId layer is enabled.

Definition at line 1384 of file view.cpp.

1385 {
1386  wxCHECK( (unsigned) aLayerId < m_layers.size(), false );
1387 
1388  std::set<int>::const_iterator it, it_end;
1389 
1390  for( it = m_layers.at( aLayerId ).requiredLayers.begin(),
1391  it_end = m_layers.at( aLayerId ).requiredLayers.end(); it != it_end; ++it )
1392  {
1393  // That is enough if just one layer is not enabled
1394  if( !m_layers.at( *it ).visible || !areRequiredLayersEnabled( *it ) )
1395  return false;
1396  }
1397 
1398  return true;
1399 }
bool areRequiredLayersEnabled(int aLayerId) const
Checks if every layer required by the aLayerId layer is enabled.
Definition: view.cpp:1384
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::m_layers.

Referenced by KIGFX::VIEW::redrawRect().

◆ Clear()

void KIGFX::VIEW::Clear ( )
inherited

Function Clear() Removes all items from the view.

Definition at line 1111 of file view.cpp.

1112 {
1113  BOX2I r;
1114  r.SetMaximum();
1115  m_allItems->clear();
1116 
1117  for( LAYER_MAP_ITER i = m_layers.begin(); i != m_layers.end(); ++i )
1118  i->second.items->RemoveAll();
1119 
1120  m_nextDrawPriority = 0;
1121 
1122  m_gal->ClearCache();
1123 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:815
void SetMaximum()
Definition: box2.h:71
int m_nextDrawPriority
The next sequential drawing priority.
Definition: view.h:865
LAYER_MAP::iterator LAYER_MAP_ITER
Definition: view.h:717
size_t i
Definition: json11.cpp:597
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812
virtual void ClearCache()
Delete all data created during caching of graphic items.

References KIGFX::GAL::ClearCache(), i, KIGFX::VIEW::m_allItems, KIGFX::VIEW::m_gal, KIGFX::VIEW::m_layers, KIGFX::VIEW::m_nextDrawPriority, and BOX2< Vec >::SetMaximum().

Referenced by GERBVIEW_FRAME::Clear_DrawLayers(), PCB_DRAW_PANEL_GAL::DisplayBoard(), SCH_DRAW_PANEL::DisplayComponent(), DisplayComponent(), SCH_DRAW_PANEL::DisplaySheet(), PL_DRAW_PANEL_GAL::DisplayWorksheet(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), GERBVIEW_FRAME::OnCloseWindow(), FOOTPRINT_PREVIEW_PANEL::renderFootprint(), WS_PROXY_UNDO_ITEM::Restore(), PCB_BASE_EDIT_FRAME::SetBoard(), PL_DRAW_PANEL_GAL::SwitchBackend(), GERBVIEW_DRAW_PANEL_GAL::SwitchBackend(), DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME(), FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME(), and GERBVIEW_FRAME::~GERBVIEW_FRAME().

◆ clearGroupCache()

void KIGFX::VIEW::clearGroupCache ( )
protectedinherited

Definition at line 1201 of file view.cpp.

1202 {
1203  BOX2I r;
1204 
1205  r.SetMaximum();
1206  clearLayerCache visitor( this );
1207 
1208  for( LAYER_MAP_ITER i = m_layers.begin(); i != m_layers.end(); ++i )
1209  {
1210  VIEW_LAYER* l = &( ( *i ).second );
1211  l->items->Query( r, visitor );
1212  }
1213 }
void SetMaximum()
Definition: box2.h:71
LAYER_MAP::iterator LAYER_MAP_ITER
Definition: view.h:717
size_t i
Definition: json11.cpp:597
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References i, KIGFX::VIEW::VIEW_LAYER::items, KIGFX::VIEW::m_layers, and BOX2< Vec >::SetMaximum().

Referenced by KIGFX::VIEW::SetGAL().

◆ ClearHiddenFlags()

void KIGFX::SCH_VIEW::ClearHiddenFlags ( )

Clear the hide flag of all items in the view.

Definition at line 175 of file sch_view.cpp.

176 {
177  for( auto item : *m_allItems )
178  Hide( item, false );
179 }
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hides the item in the view (e.g.
Definition: view.cpp:1507
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:815

References KIGFX::VIEW::Hide(), and KIGFX::VIEW::m_allItems.

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState(), and LIB_EDIT_FRAME::RebuildView().

◆ ClearLayer()

void KIGFX::VIEW::ClearLayer ( int  aLayer)
inherited

Function ClearLayer() Removes all items from a given layer.

Parameters
aLayerID of the layer to be cleared

◆ ClearPreview()

void KIGFX::SCH_VIEW::ClearPreview ( )

Definition at line 143 of file sch_view.cpp.

144 {
145  m_preview->Clear();
146 
147  for( auto item : m_ownedItems )
148  delete item;
149 
150  m_ownedItems.clear();
151  Update( m_preview.get() );
152 }
std::vector< EDA_ITEM * > m_ownedItems
Definition: sch_view.h:110
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: sch_view.h:109

References m_ownedItems, m_preview, and KIGFX::VIEW::Update().

Referenced by SCH_EDIT_FRAME::AddJunction(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearTargets()

void KIGFX::VIEW::ClearTargets ( )
inherited

Function ClearTargets() Clears targets that are marked as dirty.

Definition at line 1126 of file view.cpp.

1127 {
1129  {
1130  // TARGET_CACHED and TARGET_NONCACHED have to be redrawn together, as they contain
1131  // layers that rely on each other (eg. netnames are noncached, but tracks - are cached)
1134 
1135  MarkDirty();
1136  }
1137 
1138  if( IsTargetDirty( TARGET_OVERLAY ) )
1139  {
1141  }
1142 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
Auxiliary rendering target (noncached)
Definition: definitions.h:49
bool IsTargetDirty(int aTarget) const
Function IsTargetDirty() Returns true if any of layers belonging to the target or the target itself s...
Definition: view.h:574
virtual void ClearTarget(RENDER_TARGET aTarget)
Clears the target for rendering.
Items that may change while the view stays the same (noncached)
Definition: definitions.h:50
Main rendering target (cached)
Definition: definitions.h:48
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:610

References KIGFX::GAL::ClearTarget(), KIGFX::VIEW::IsTargetDirty(), KIGFX::VIEW::m_gal, KIGFX::VIEW::MarkDirty(), KIGFX::TARGET_CACHED, KIGFX::TARGET_NONCACHED, and KIGFX::TARGET_OVERLAY.

Referenced by EDA_DRAW_PANEL_GAL::onPaint().

◆ ClearTopLayers()

void KIGFX::VIEW::ClearTopLayers ( )
inherited

Function ClearTopLayers() Removes all layers from the on-the-top set (they are no longer displayed over the rest of layers).

Definition at line 912 of file view.cpp.

913 {
914  std::set<unsigned int>::iterator it;
915 
917  {
918  // Restore the previous rendering order for layers that were marked as top
919  for( it = m_topLayers.begin(); it != m_topLayers.end(); ++it )
920  m_layers[*it].renderingOrder -= TOP_LAYER_MODIFIER;
921  }
922 
923  m_topLayers.clear();
924 }
static const int TOP_LAYER_MODIFIER
Rendering order modifier for layers that are marked as top layers.
Definition: view.h:858
std::set< unsigned int > m_topLayers
Stores set of layers that are displayed on the top.
Definition: view.h:821
bool m_enableOrderModifier
Definition: view.h:809
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::m_enableOrderModifier, KIGFX::VIEW::m_layers, KIGFX::VIEW::m_topLayers, and KIGFX::VIEW::TOP_LAYER_MODIFIER.

Referenced by PL_DRAW_PANEL_GAL::SetTopLayer(), GERBVIEW_DRAW_PANEL_GAL::SetTopLayer(), PCB_DRAW_PANEL_GAL::SetTopLayer(), and EDA_DRAW_PANEL_GAL::SetTopLayer().

◆ compareRenderingOrder()

static bool KIGFX::VIEW::compareRenderingOrder ( VIEW_LAYER aI,
VIEW_LAYER aJ 
)
inlinestaticprotectedinherited

Determines rendering order of layers. Used in display order sorting function.

Definition at line 800 of file view.h.

801  {
802  return aI->renderingOrder > aJ->renderingOrder;
803  }

References KIGFX::VIEW::VIEW_LAYER::renderingOrder.

Referenced by KIGFX::VIEW::sortLayers().

◆ CopySettings()

void KIGFX::VIEW::CopySettings ( const VIEW aOtherView)
inherited

Function CopySettings() Copies layers and visibility settings from another view.

Parameters
aOtherViewview from which settings will be copied.

Definition at line 513 of file view.cpp.

514 {
515  wxASSERT_MSG( false, wxT( "This is not implemented" ) );
516 }

◆ DataReference()

std::unique_ptr< VIEW > KIGFX::VIEW::DataReference ( ) const
inherited

Returns a new VIEW object that shares the same set of VIEW_ITEMs and LAYERs.

GAL, PAINTER and other properties are left uninitialized.

Definition at line 1476 of file view.cpp.

1477 {
1478  auto ret = std::make_unique<VIEW>();
1479  ret->m_allItems = m_allItems;
1480  ret->m_layers = m_layers;
1481  ret->sortLayers();
1482  return ret;
1483 }
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:815
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::m_allItems, and KIGFX::VIEW::m_layers.

Referenced by BOARD_PRINTOUT::DrawPage().

◆ DisplayComponent()

void KIGFX::SCH_VIEW::DisplayComponent ( LIB_PART aPart)

Definition at line 126 of file sch_view.cpp.

127 {
128  Clear();
129 
130  if( !aPart )
131  return;
132 
133  for( auto& item : aPart->GetDrawItems() )
134  Add( &item );
135 
137  m_preview.reset( new KIGFX::VIEW_GROUP() );
138  Add( m_selectionArea.get() );
139  Add( m_preview.get() );
140 }
std::unique_ptr< KIGFX::PREVIEW::SELECTION_AREA > m_selectionArea
Definition: sch_view.h:108
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1111
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Class SELECTION_AREA.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: sch_view.h:109

References KIGFX::VIEW::Add(), KIGFX::VIEW::Clear(), LIB_PART::GetDrawItems(), m_preview, and m_selectionArea.

Referenced by SCH_DRAW_PANEL::DisplayComponent().

◆ DisplaySheet() [1/2]

void KIGFX::SCH_VIEW::DisplaySheet ( SCH_SHEET aSheet)

Definition at line 120 of file sch_view.cpp.

121 {
122  DisplaySheet( aSheet->GetScreen() );
123 }
void DisplaySheet(SCH_SHEET *aSheet)
Definition: sch_view.cpp:120
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:271

References SCH_SHEET::GetScreen().

Referenced by SCH_DRAW_PANEL::DisplaySheet().

◆ DisplaySheet() [2/2]

void KIGFX::SCH_VIEW::DisplaySheet ( SCH_SCREEN aScreen)

Definition at line 93 of file sch_view.cpp.

94 {
95  for( auto item = aScreen->GetDrawItems(); item; item = item->Next() )
96  Add( item );
97 
98  m_worksheet.reset( new KIGFX::WS_PROXY_VIEW_ITEM( 1, &aScreen->GetPageSettings(),
99  &aScreen->GetTitleBlock() ) );
100  m_worksheet->SetSheetNumber( aScreen->m_ScreenNumber );
101  m_worksheet->SetSheetCount( aScreen->m_NumberOfScreens );
102  m_worksheet->SetFileName( TO_UTF8( aScreen->GetFileName() ) );
103 
104  if( m_frame && m_frame->IsType( FRAME_SCH ) )
105  m_worksheet->SetSheetName( TO_UTF8( m_frame->GetScreenDesc() ) );
106  else
107  m_worksheet->SetSheetName( "" );
108 
109  ResizeSheetWorkingArea( aScreen );
110 
112  m_preview.reset( new KIGFX::VIEW_GROUP() );
113 
114  Add( m_worksheet.get() );
115  Add( m_selectionArea.get() );
116  Add( m_preview.get() );
117 }
const wxString & GetFileName() const
Definition: sch_screen.h:118
int m_ScreenNumber
Definition: base_screen.h:135
SCH_ITEM * Next() const
Definition: sch_item.h:153
void ResizeSheetWorkingArea(SCH_SCREEN *aScreen)
Definition: sch_view.cpp:81
const TITLE_BLOCK & GetTitleBlock() const
Definition: sch_screen.h:123
std::unique_ptr< KIGFX::PREVIEW::SELECTION_AREA > m_selectionArea
Definition: sch_view.h:108
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:113
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:48
std::unique_ptr< WS_PROXY_VIEW_ITEM > m_worksheet
Definition: sch_view.h:107
bool IsType(FRAME_T aType) const
SCH_BASE_FRAME * m_frame
Definition: sch_view.h:104
int m_NumberOfScreens
Definition: base_screen.h:136
Class SELECTION_AREA.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: sch_view.h:109
virtual wxString GetScreenDesc() const
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:147

References KIGFX::VIEW::Add(), FRAME_SCH, SCH_SCREEN::GetDrawItems(), SCH_SCREEN::GetFileName(), SCH_SCREEN::GetPageSettings(), EDA_DRAW_FRAME::GetScreenDesc(), SCH_SCREEN::GetTitleBlock(), EDA_BASE_FRAME::IsType(), m_frame, BASE_SCREEN::m_NumberOfScreens, m_preview, BASE_SCREEN::m_ScreenNumber, m_selectionArea, m_worksheet, SCH_ITEM::Next(), ResizeSheetWorkingArea(), and TO_UTF8.

◆ draw() [1/3]

void KIGFX::VIEW::draw ( VIEW_ITEM aItem,
int  aLayer,
bool  aImmediate = false 
)
protectedinherited

Function draw() Draws an item, but on a specified layers.

It has to be marked that some of drawing settings are based on the layer on which an item is drawn.

Parameters
aItemis the item to be drawn.
aLayeris the layer which should be drawn.
aImmediatedictates the way of drawing - it allows one to force immediate drawing mode for cached items.

Definition at line 1029 of file view.cpp.

1030 {
1031  auto viewData = aItem->viewPrivData();
1032 
1033  if( !viewData )
1034  return;
1035 
1036  if( IsCached( aLayer ) && !aImmediate )
1037  {
1038  // Draw using cached information or create one
1039  int group = viewData->getGroup( aLayer );
1040 
1041  if( group >= 0 )
1042  m_gal->DrawGroup( group );
1043  else
1044  Update( aItem );
1045  }
1046  else
1047  {
1048  // Immediate mode
1049  if( !m_painter->Draw( aItem, aLayer ) )
1050  aItem->ViewDraw( aLayer, this ); // Alternative drawing method
1051  }
1052 }
virtual void DrawGroup(int aGroupNumber)
Draw the stored group.
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
PAINTER * m_painter
PAINTER contains information how do draw items.
Definition: view.h:845
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
virtual bool Draw(const VIEW_ITEM *aItem, int aLayer)=0
Function Draw Takes an instance of VIEW_ITEM and passes it to a function that know how to draw the it...
bool IsCached(int aLayer) const
Returns true if the layer is cached.
Definition: view.h:592

References KIGFX::PAINTER::Draw(), KIGFX::GAL::DrawGroup(), KIGFX::VIEW_ITEM_DATA::getGroup(), KIGFX::VIEW::IsCached(), KIGFX::VIEW::m_gal, KIGFX::VIEW::m_painter, KIGFX::VIEW::Update(), KIGFX::VIEW_ITEM::ViewDraw(), and KIGFX::VIEW_ITEM::viewPrivData().

Referenced by KIGFX::VIEW::drawItem::deferredDraw(), KIGFX::VIEW::draw(), and KIGFX::VIEW::drawItem::operator()().

◆ draw() [2/3]

void KIGFX::VIEW::draw ( VIEW_ITEM aItem,
bool  aImmediate = false 
)
protectedinherited

Function draw() Draws an item on all layers that the item uses.

Parameters
aItemis the item to be drawn.
aImmediatedictates the way of drawing - it allows one to force immediate drawing mode for cached items.

Definition at line 1055 of file view.cpp.

1056 {
1057  int layers[VIEW_MAX_LAYERS], layers_count;
1058 
1059  aItem->ViewGetLayers( layers, layers_count );
1060 
1061  // Sorting is needed for drawing order dependent GALs (like Cairo)
1062  SortLayers( layers, layers_count );
1063 
1064  for( int i = 0; i < layers_count; ++i )
1065  {
1066  m_gal->SetLayerDepth( m_layers.at( layers[i] ).renderingOrder );
1067  draw( aItem, layers[i], aImmediate );
1068  }
1069 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
virtual void SetLayerDepth(double aLayerDepth)
Set the depth of the layer (position on the z-axis)
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:701
void SortLayers(int aLayers[], int &aCount) const
Function SortLayers() Changes the order of given layer ids, so after sorting the order corresponds to...
Definition: view.cpp:678
size_t i
Definition: json11.cpp:597
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:1029
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::draw(), i, KIGFX::VIEW::m_gal, KIGFX::VIEW::m_layers, KIGFX::GAL::SetLayerDepth(), KIGFX::VIEW::SortLayers(), KIGFX::VIEW::VIEW_MAX_LAYERS, and KIGFX::VIEW_ITEM::ViewGetLayers().

◆ draw() [3/3]

void KIGFX::VIEW::draw ( VIEW_GROUP aGroup,
bool  aImmediate = false 
)
protectedinherited

Function draw() Draws a group of items on all layers that those items use.

Parameters
aGroupis the group to be drawn.
aImmediatedictates the way of drawing - it allows one to force immediate drawing mode for cached items.

Definition at line 1072 of file view.cpp.

1073 {
1074  for( unsigned int i = 0; i < aGroup->GetSize(); i++)
1075  draw( aGroup->GetItem(i), aImmediate );
1076 }
size_t i
Definition: json11.cpp:597
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:1029

References KIGFX::VIEW::draw(), KIGFX::VIEW_GROUP::GetItem(), KIGFX::VIEW_GROUP::GetSize(), and i.

◆ EnableTopLayer()

void KIGFX::VIEW::EnableTopLayer ( bool  aEnable)
virtualinherited

Function EnableTopLayer() Enables or disables display of the top layer.

When disabled - layers are rendered as usual with no influence from SetTopLayer function. Otherwise on the top there is displayed the layer set previously with SetTopLayer function.

Parameters
aEnablewhether to enable or disable display of the top layer.

Definition at line 887 of file view.cpp.

888 {
889  if( aEnable == m_enableOrderModifier )
890  return;
891 
892  m_enableOrderModifier = aEnable;
893 
894  std::set<unsigned int>::iterator it;
895 
896  if( aEnable )
897  {
898  for( it = m_topLayers.begin(); it != m_topLayers.end(); ++it )
899  m_layers[*it].renderingOrder += TOP_LAYER_MODIFIER;
900  }
901  else
902  {
903  for( it = m_topLayers.begin(); it != m_topLayers.end(); ++it )
904  m_layers[*it].renderingOrder -= TOP_LAYER_MODIFIER;
905  }
906 
909 }
static const int TOP_LAYER_MODIFIER
Rendering order modifier for layers that are marked as top layers.
Definition: view.h:858
std::set< unsigned int > m_topLayers
Stores set of layers that are displayed on the top.
Definition: view.h:821
void UpdateAllLayersOrder()
Function UpdateLayerOrder() Does everything that is needed to apply the rendering order of layers.
Definition: view.cpp:927
bool m_enableOrderModifier
Definition: view.h:809
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812
void UpdateAllLayersColor()
Function UpdateAllLayersColor() Applies the new coloring scheme to all layers.
Definition: view.cpp:798

References KIGFX::VIEW::m_enableOrderModifier, KIGFX::VIEW::m_layers, KIGFX::VIEW::m_topLayers, KIGFX::VIEW::TOP_LAYER_MODIFIER, KIGFX::VIEW::UpdateAllLayersColor(), and KIGFX::VIEW::UpdateAllLayersOrder().

Referenced by PCB_DRAW_PANEL_GAL::SetTopLayer().

◆ GetBoundary()

const BOX2D& KIGFX::VIEW::GetBoundary ( ) const
inlineinherited

Function GetBoundary()

Returns
Current view area boundary.

Definition at line 287 of file view.h.

288  {
289  return m_boundary;
290  }
BOX2D m_boundary
View boundaries.
Definition: view.h:830

References KIGFX::VIEW::m_boundary.

Referenced by KIGFX::WX_VIEW_CONTROLS::onScroll(), and KIGFX::WX_VIEW_CONTROLS::UpdateScrollbars().

◆ GetCenter()

const VECTOR2D& KIGFX::VIEW::GetCenter ( ) const
inlineinherited

Function GetCenter() Returns the center point of this VIEW (in world space coordinates)

Returns
center point of the view

Definition at line 328 of file view.h.

329  {
330  return m_center;
331  }
VECTOR2D m_center
Center point of the VIEW (the point at which we are looking at)
Definition: view.h:824

References KIGFX::VIEW::m_center.

Referenced by KIGFX::WX_VIEW_CONTROLS::onButton(), EDA_DRAW_PANEL_GAL::onPaint(), KIGFX::WX_VIEW_CONTROLS::onScroll(), KIGFX::WX_VIEW_CONTROLS::onTimer(), KIGFX::WX_VIEW_CONTROLS::onWheel(), LIB_DRAWING_TOOLS::PlaceAnchor(), and COMMON_TOOLS::ZoomFitScreen().

◆ GetGAL()

GAL* KIGFX::VIEW::GetGAL ( ) const
inlineinherited

Function GetGAL() Returns the GAL this view is using to draw graphical primitives.

Returns
Pointer to the currently used GAL instance.

Definition at line 180 of file view.h.

181  {
182  return m_gal;
183  }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848

References KIGFX::VIEW::m_gal.

Referenced by KIGFX::WX_VIEW_CONTROLS::CenterOnCursor(), PCBNEW_CONTROL::DoSetGridOrigin(), KIGFX::PREVIEW::CENTRELINE_RECT_ITEM::drawPreviewShape(), KIGFX::PREVIEW::POLYGON_ITEM::drawPreviewShape(), KIGFX::PREVIEW::DrawTextNextToCursor(), drawTicksAlongLine(), KIGFX::VIEW_OVERLAY::COMMAND_LINE::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_RECTANGLE::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_CIRCLE::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_ARC::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_POLYLINE::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_POLY_POLYLINE::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_POINT_POLYLINE::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_POLYGON::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_POLY_POLYGON::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_POINT_POLYGON::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_SET_STROKE::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_SET_FILL::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_SET_COLOR::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_SET_WIDTH::Execute(), KIGFX::WX_VIEW_CONTROLS::GetRawCursorPosition(), COMMON_TOOLS::GridPreset(), DIALOG_PAD_PROPERTIES::prepareCanvas(), KIGFX::WX_VIEW_CONTROLS::SetCrossHairCursorPosition(), KIGFX::VIEW_CONTROLS::ShowCursor(), PCBNEW_CONTROL::updateGrid(), PCB_BRIGHT_BOX::ViewDraw(), KIGFX::PREVIEW::ARC_ASSISTANT::ViewDraw(), KIGFX::RATSNEST_VIEWITEM::ViewDraw(), KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), BRIGHT_BOX::ViewDraw(), KIGFX::ORIGIN_VIEWITEM::ViewDraw(), KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM::ViewDraw(), KIGFX::PREVIEW::SELECTION_AREA::ViewDraw(), KIGFX::VIEW_GROUP::ViewDraw(), ROUTER_PREVIEW_ITEM::ViewDraw(), KIGFX::WS_PROXY_VIEW_ITEM::ViewDraw(), EDIT_POINTS::ViewDraw(), and KIGFX::WX_VIEW_CONTROLS::WarpCursor().

◆ GetLayerOrder()

int KIGFX::VIEW::GetLayerOrder ( int  aLayer) const
inherited

Function GetLayerOrder() Returns rendering order of a particular layer.

Lower values are rendered first.

Parameters
aLayerthe layer
Returns
Rendering order of a particular layer.

Definition at line 672 of file view.cpp.

673 {
674  return m_layers.at( aLayer ).renderingOrder;
675 }
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::m_layers.

Referenced by PCB_DRAW_PANEL_GAL::SetTopLayer(), and KIGFX::VIEW::SortLayers().

◆ GetPainter()

PAINTER* KIGFX::VIEW::GetPainter ( ) const
inlineinherited

Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.

Returns
Pointer to the currently used Painter instance.

Definition at line 199 of file view.h.

200  {
201  return m_painter;
202  }
PAINTER * m_painter
PAINTER contains information how do draw items.
Definition: view.h:845

References KIGFX::VIEW::m_painter.

Referenced by PCB_BASE_FRAME::ActivateGalCanvas(), PCB_INSPECTION_TOOL::ClearHighlight(), SYMBOL_PREVIEW_WIDGET::DisplayPart(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), PL_DRAW_PANEL_GAL::DisplayWorksheet(), BOARD_PRINTOUT::DrawPage(), KIGFX::PREVIEW::POLYGON_ITEM::drawPreviewShape(), KIGFX::PREVIEW::DrawTextNextToCursor(), drawTicksAlongLine(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), GERBVIEW_DRAW_PANEL_GAL::GERBVIEW_DRAW_PANEL_GAL(), ROUTER_PREVIEW_ITEM::getLayerColor(), SCH_BASE_FRAME::GetRenderSettings(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), FOOTPRINT_PREVIEW_PANEL::New(), DIALOG_PAD_PROPERTIES::onChangePadMode(), ZONE_CREATE_HELPER::OnFirstPoint(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), GERBVIEW_DRAW_PANEL_GAL::OnShow(), PCB_DRAW_PANEL_GAL::OnShow(), DIALOG_PAD_PROPERTIES::prepareCanvas(), GRID_HELPER::queryVisible(), DIALOG_PAD_PROPERTIES::redraw(), GERBVIEW_SELECTION_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), SELECTION_TOOL::Reset(), SELECTION_TOOL::Selectable(), GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer(), PCB_DRAW_PANEL_GAL::SetHighContrastLayer(), EDA_DRAW_PANEL_GAL::SetHighContrastLayer(), SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET(), PCB_LAYER_WIDGET::SyncLayerAlphaIndicators(), PL_EDITOR_CONTROL::ToggleBackgroundColor(), PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_PCBNEW_SETTINGS::TransferDataFromWindow(), KIGFX::PCB_VIEW::UpdateDisplayOptions(), GERBVIEW_DRAW_PANEL_GAL::UseColorScheme(), PCB_DRAW_PANEL_GAL::UseColorScheme(), KIGFX::RATSNEST_VIEWITEM::ViewDraw(), KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), KIGFX::PREVIEW::SELECTION_AREA::ViewDraw(), KIGFX::VIEW_GROUP::ViewDraw(), and KIGFX::WS_PROXY_VIEW_ITEM::ViewDraw().

◆ GetPrintMode()

int KIGFX::VIEW::GetPrintMode ( )
inlineinherited
Returns
the printing mode. if return <= 0, the current mode is not a printing mode, just the draw mode

Definition at line 692 of file view.h.

692 { return m_printMode; }
int m_printMode
A control for printing: m_printMode <= 0 means no printing mode (normal draw mode m_printMode > 0 is ...
Definition: view.h:872

References KIGFX::VIEW::m_printMode.

Referenced by D_PAD::ViewGetLOD().

◆ GetScale()

double KIGFX::VIEW::GetScale ( ) const
inlineinherited

Function GetScale()

Returns
Current scale factor of this VIEW.

Definition at line 257 of file view.h.

258  {
259  return m_scale;
260  }
double m_scale
Scale of displayed VIEW_ITEMs.
Definition: view.h:827

References KIGFX::VIEW::m_scale.

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), KIGFX::WX_VIEW_CONTROLS::onWheel(), DIALOG_PAD_PROPERTIES::redraw(), ZOOM_TOOL::selectRegion(), KIGFX::VIEW::SetViewport(), COMMON_TOOLS::ZoomFitScreen(), and SELECTION_TOOL::zoomFitSelection().

◆ GetScreenPixelSize()

const VECTOR2I & KIGFX::VIEW::GetScreenPixelSize ( ) const
inherited

Function GetScreenPixelSize() Returns the size of the our rendering area, in pixels.

Returns
viewport screen size

Definition at line 1177 of file view.cpp.

1178 {
1179  return m_gal->GetScreenPixelSize();
1180 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
const VECTOR2I & GetScreenPixelSize() const
Returns GAL canvas size in pixels.

References KIGFX::GAL::GetScreenPixelSize(), and KIGFX::VIEW::m_gal.

Referenced by KIGFX::WX_VIEW_CONTROLS::handleAutoPanning(), KIGFX::WX_VIEW_CONTROLS::onScroll(), KIGFX::WX_VIEW_CONTROLS::onTimer(), and KIGFX::WX_VIEW_CONTROLS::onWheel().

◆ GetTopLayer()

int KIGFX::VIEW::GetTopLayer ( ) const
virtualinherited

Definition at line 851 of file view.cpp.

852 {
853  if( m_topLayers.size() == 0 )
854  return 0;
855 
856  return *m_topLayers.begin();
857 }
std::set< unsigned int > m_topLayers
Stores set of layers that are displayed on the top.
Definition: view.h:821

References KIGFX::VIEW::m_topLayers.

Referenced by ROUTER_TOOL::getStartLayer(), SELECTION_TOOL::GuessSelectionCandidates(), PNS::TOOL_BASE::pickSingleItem(), and PNS::TOOL_BASE::updateStartItem().

◆ GetViewport()

BOX2D KIGFX::VIEW::GetViewport ( ) const
inherited

Function GetViewport() Returns the current viewport visible area rectangle.

Returns
Current viewport rectangle

Definition at line 538 of file view.cpp.

539 {
540  BOX2D rect;
541  VECTOR2D screenSize = m_gal->GetScreenPixelSize();
542 
543  rect.SetOrigin( ToWorld( VECTOR2D( 0, 0 ) ) );
544  rect.SetEnd( ToWorld( screenSize ) );
545 
546  return rect.Normalize();
547 }
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:475
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
const VECTOR2I & GetScreenPixelSize() const
Returns GAL canvas size in pixels.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
BOX2< Vec > & Normalize()
Function Normalize ensures that the height ant width are positive.
Definition: box2.h:127
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:223
void SetOrigin(const Vec &pos)
Definition: box2.h:208

References KIGFX::GAL::GetScreenPixelSize(), KIGFX::VIEW::m_gal, BOX2< Vec >::Normalize(), BOX2< Vec >::SetEnd(), BOX2< Vec >::SetOrigin(), and KIGFX::VIEW::ToWorld().

Referenced by SELECTION_TOOL::GuessSelectionCandidates(), and KIGFX::WX_VIEW_CONTROLS::UpdateScrollbars().

◆ Hide()

void KIGFX::VIEW::Hide ( VIEW_ITEM aItem,
bool  aHide = true 
)
inherited

Temporarily hides the item in the view (e.g.

for overlaying)

Parameters
aItemthe item to modify.
aHidewhether the item is hidden (on all layers), or not.

Definition at line 1507 of file view.cpp.

1508 {
1509  auto viewData = aItem->viewPrivData();
1510 
1511  if( !viewData )
1512  return;
1513 
1514  if( !( viewData->m_flags & VISIBLE ) )
1515  return;
1516 
1517  if( aHide )
1518  viewData->m_flags |= HIDDEN;
1519  else
1520  viewData->m_flags &= ~HIDDEN;
1521 
1522  Update( aItem, APPEARANCE );
1523 }
Item is visible (in general)
Definition: view_item.h:70
No updates are required.
Definition: view_item.h:55
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540

References KIGFX::APPEARANCE, KIGFX::HIDDEN, KIGFX::VIEW_ITEM_DATA::m_flags, KIGFX::VIEW::Update(), KIGFX::VIEW_ITEM::viewPrivData(), and KIGFX::VISIBLE.

Referenced by AddToPreview(), ClearHiddenFlags(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::highlight(), GERBVIEW_SELECTION_TOOL::selectVisually(), SELECTION_TOOL::unhighlight(), and GERBVIEW_SELECTION_TOOL::unselectVisually().

◆ HideWorksheet()

void KIGFX::SCH_VIEW::HideWorksheet ( )

Definition at line 182 of file sch_view.cpp.

183 {
184  // SetVisible( m_worksheet.get(), false );
185 }

Referenced by LIB_EDIT_FRAME::RebuildView().

◆ HighlightItem()

void KIGFX::SCH_VIEW::HighlightItem ( EDA_ITEM aItem,
LIB_PIN aPin = nullptr 
)

Definition at line 187 of file sch_view.cpp.

188 {
189  if( aItem && aItem->Type() == SCH_COMPONENT_T && aPin )
190  {
191  static_cast<SCH_COMPONENT*>( aItem )->HighlightPin( aPin );
192  }
193  else if( aItem )
194  {
195  aItem->SetFlags( HIGHLIGHTED );
196  }
197  else
198  {
199  for( auto item : *m_allItems )
200  {
201  // Not all view items can be highlighted, only EDA_ITEMs
202  // So clear flag of only EDA_ITEMs.
203  EDA_ITEM* eitem = dynamic_cast<EDA_ITEM*>( item );
204 
205  if( eitem )
206  {
207  eitem->ClearFlags( HIGHLIGHTED );
208 
209  if( eitem->Type() == SCH_COMPONENT_T )
210  {
211  // Items inside a component (pins, fields can be highlighted.
212  static_cast<SCH_COMPONENT*>( eitem )->ClearAllHighlightFlags();
213  }
214  }
215  }
216  }
217 
218  // ugly but I guess OK for the moment...
219  UpdateAllItems( ALL );
220 }
void UpdateAllItems(int aUpdateFlags)
Updates all items in the view according to the given flags.
Definition: view.cpp:1444
Item needs to be redrawn.
Definition: view_item.h:61
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:815
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:265
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:266
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

References KIGFX::ALL, EDA_ITEM::ClearFlags(), HIGHLIGHTED, KIGFX::VIEW::m_allItems, SCH_COMPONENT_T, EDA_ITEM::SetFlags(), EDA_ITEM::Type(), and KIGFX::VIEW::UpdateAllItems().

Referenced by SCH_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDITOR_CONTROL::FindComponentAndItem(), DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick(), and DIALOG_FIELDS_EDITOR_GLOBAL::~DIALOG_FIELDS_EDITOR_GLOBAL().

◆ invalidateItem()

void KIGFX::VIEW::invalidateItem ( VIEW_ITEM aItem,
int  aUpdateFlags 
)
protectedinherited

Function invalidateItem() Manages dirty flags & redraw queueing when updating an item.

Parameters
aItemis the item to be updated.
aUpdateFlagsdetermines the way an item is refreshed.

Definition at line 1216 of file view.cpp.

1217 {
1218  if( aUpdateFlags & INITIAL_ADD )
1219  {
1220  // Don't update layers or bbox, since it was done in VIEW::Add()
1221  // Now that we have initialized, set flags to ALL for the code below
1222  aUpdateFlags = ALL;
1223  }
1224  else
1225  {
1226  // updateLayers updates geometry too, so we do not have to update both of them at the same time
1227  if( aUpdateFlags & LAYERS )
1228  {
1229  updateLayers( aItem );
1230  }
1231  else if( aUpdateFlags & GEOMETRY )
1232  {
1233  updateBbox( aItem );
1234  }
1235  }
1236 
1237  int layers[VIEW_MAX_LAYERS], layers_count;
1238  aItem->ViewGetLayers( layers, layers_count );
1239 
1240  // Iterate through layers used by the item and recache it immediately
1241  for( int i = 0; i < layers_count; ++i )
1242  {
1243  int layerId = layers[i];
1244 
1245  if( IsCached( layerId ) )
1246  {
1247  if( aUpdateFlags & ( GEOMETRY | LAYERS | REPAINT ) )
1248  updateItemGeometry( aItem, layerId );
1249  else if( aUpdateFlags & COLOR )
1250  updateItemColor( aItem, layerId );
1251  }
1252 
1253  // Mark those layers as dirty, so the VIEW will be refreshed
1254  MarkTargetDirty( m_layers[layerId].target );
1255  }
1256 
1257  aItem->viewPrivData()->clearUpdateFlags();
1258 }
Layers have changed.
Definition: view_item.h:59
void updateLayers(VIEW_ITEM *aItem)
Updates set of layers that an item occupies.
Definition: view.cpp:1341
void updateItemColor(VIEW_ITEM *aItem, int aLayer)
Updates colors that are used for an item to be drawn.
Definition: view.cpp:1276
Visibility flag has changed.
Definition: view_item.h:56
Item needs to be redrawn.
Definition: view_item.h:61
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:701
Item is being added to the view.
Definition: view_item.h:60
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
void updateBbox(VIEW_ITEM *aItem)
Updates bounding box of an item.
Definition: view.cpp:1325
void updateItemGeometry(VIEW_ITEM *aItem, int aLayer)
Updates all informations needed to draw an item.
Definition: view.cpp:1295
size_t i
Definition: json11.cpp:597
bool IsCached(int aLayer) const
Returns true if the layer is cached.
Definition: view.h:592
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812
Position or shape has changed.
Definition: view_item.h:58
Color has changed.
Definition: view_item.h:57

References KIGFX::ALL, KIGFX::VIEW_ITEM_DATA::clearUpdateFlags(), KIGFX::COLOR, KIGFX::GEOMETRY, i, KIGFX::INITIAL_ADD, KIGFX::VIEW::IsCached(), KIGFX::LAYERS, KIGFX::VIEW::m_layers, KIGFX::VIEW::MarkTargetDirty(), KIGFX::REPAINT, KIGFX::VIEW::updateBbox(), KIGFX::VIEW::updateItemColor(), KIGFX::VIEW::updateItemGeometry(), KIGFX::VIEW::updateLayers(), KIGFX::VIEW::VIEW_MAX_LAYERS, KIGFX::VIEW_ITEM::ViewGetLayers(), and KIGFX::VIEW_ITEM::viewPrivData().

Referenced by KIGFX::VIEW::UpdateItems().

◆ IsCached()

bool KIGFX::VIEW::IsCached ( int  aLayer) const
inlineinherited

Returns true if the layer is cached.

Definition at line 592 of file view.h.

593  {
594  wxCHECK( aLayer < (int) m_layers.size(), false );
595 
596  try
597  {
598  return m_layers.at( aLayer ).target == TARGET_CACHED;
599  }
600  catch( const std::out_of_range& )
601  {
602  return false;
603  }
604  }
Main rendering target (cached)
Definition: definitions.h:48
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::m_layers, and KIGFX::TARGET_CACHED.

Referenced by KIGFX::VIEW::draw(), KIGFX::VIEW::invalidateItem(), KIGFX::VIEW::RecacheAllItems(), KIGFX::VIEW::updateItemColor(), KIGFX::VIEW::updateItemGeometry(), KIGFX::VIEW::UpdateLayerColor(), and KIGFX::VIEW::updateLayers().

◆ IsDirty()

bool KIGFX::VIEW::IsDirty ( ) const
inlineinherited

Function IsDirty() Returns true if any of the VIEW layers needs to be refreshened.

Returns
True in case if any of layers is marked as dirty.

Definition at line 557 of file view.h.

558  {
559  for( int i = 0; i < TARGETS_NUMBER; ++i )
560  {
561  if( IsTargetDirty( i ) )
562  return true;
563  }
564 
565  return false;
566  }
Number of available rendering targets.
Definition: definitions.h:51
bool IsTargetDirty(int aTarget) const
Function IsTargetDirty() Returns true if any of layers belonging to the target or the target itself s...
Definition: view.h:574
size_t i
Definition: json11.cpp:597

References i, KIGFX::VIEW::IsTargetDirty(), and KIGFX::TARGETS_NUMBER.

Referenced by EDA_DRAW_PANEL_GAL::onPaint(), and TOOL_MANAGER::ProcessEvent().

◆ IsDrawOrderReversed()

bool KIGFX::VIEW::IsDrawOrderReversed ( ) const
inlineinherited

Function IsDrawOrderReversed()

Returns
true if draw order is reversed

Definition at line 665 of file view.h.

666  {
667  return m_reverseDrawOrder;
668  }
bool m_reverseDrawOrder
Flag to reverse the draw order when using draw priority.
Definition: view.h:868

References KIGFX::VIEW::m_reverseDrawOrder.

◆ IsDynamic()

bool KIGFX::VIEW::IsDynamic ( ) const
inlineinherited

Function IsDynamic() Tells if the VIEW is dynamic (ie.

can be changed, for example displaying PCBs in a window) or static (that cannot be modified, eg. displaying image/PDF).

Definition at line 547 of file view.h.

548  {
549  return m_dynamic;
550  }
bool m_dynamic
Dynamic VIEW (eg.
Definition: view.h:852

References KIGFX::VIEW::m_dynamic.

◆ IsLayerVisible()

bool KIGFX::VIEW::IsLayerVisible ( int  aLayer) const
inlineinherited

Function IsLayerVisible() Returns information about visibility of a particular layer.

Parameters
aLayertrue if the layer is visible, false otherwise

Definition at line 416 of file view.h.

417  {
418  wxCHECK( aLayer < (int) m_layers.size(), false );
419  return m_layers.at( aLayer ).visible;
420  }
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::m_layers.

Referenced by GERBVIEW_DRAW_PANEL_GAL::GetDefaultViewBBox(), PCB_DRAW_PANEL_GAL::GetDefaultViewBBox(), GERBVIEW_FRAME::GetVisibleLayers(), PNS_KICAD_IFACE::IsAnyLayerVisible(), GERBER_LAYER_WIDGET::ReFill(), KIGFX::VIEW_GROUP::ViewDraw(), EDGE_MODULE::ViewGetLOD(), TEXTE_MODULE::ViewGetLOD(), TRACK::ViewGetLOD(), MODULE::ViewGetLOD(), and D_PAD::ViewGetLOD().

◆ IsMirroredX()

bool KIGFX::VIEW::IsMirroredX ( ) const
inlineinherited

◆ IsMirroredY()

bool KIGFX::VIEW::IsMirroredY ( ) const
inlineinherited

Function IsMirroredX() Returns true if view is flipped across the Y axis.

Definition at line 239 of file view.h.

240  {
241  return m_mirrorY;
242  }
bool m_mirrorY
Vertical flip flag
Definition: view.h:842

References KIGFX::VIEW::m_mirrorY.

◆ IsTargetDirty()

bool KIGFX::VIEW::IsTargetDirty ( int  aTarget) const
inlineinherited

Function IsTargetDirty() Returns true if any of layers belonging to the target or the target itself should be redrawn.

Returns
True if the above condition is fulfilled.

Definition at line 574 of file view.h.

575  {
576  wxCHECK( aTarget < TARGETS_NUMBER, false );
577  return m_dirtyTargets[aTarget];
578  }
Number of available rendering targets.
Definition: definitions.h:51
bool m_dirtyTargets[TARGETS_NUMBER]
Flags to mark targets as dirty, so they have to be redrawn on the next refresh event.
Definition: view.h:855

References KIGFX::VIEW::m_dirtyTargets, and KIGFX::TARGETS_NUMBER.

Referenced by KIGFX::VIEW::ClearTargets(), KIGFX::VIEW::IsDirty(), EDA_DRAW_PANEL_GAL::onPaint(), and KIGFX::VIEW::redrawRect().

◆ IsUsingDrawPriority()

bool KIGFX::VIEW::IsUsingDrawPriority ( ) const
inlineinherited

Function IsUsingDrawPriority()

Returns
true if draw priority is being respected while redrawing.

Definition at line 647 of file view.h.

648  {
649  return m_useDrawPriority;
650  }
bool m_useDrawPriority
Flat list of all items Flag to respect draw priority when drawing items.
Definition: view.h:862

References KIGFX::VIEW::m_useDrawPriority.

◆ IsVisible()

bool KIGFX::VIEW::IsVisible ( const VIEW_ITEM aItem) const
inherited

Returns information if the item is visible (or not).

Parameters
aItemthe item to test.
Returns
when true, the item is visible (i.e. to be displayed, not visible in the current viewport)

Definition at line 1526 of file view.cpp.

1527 {
1528  const auto viewData = aItem->viewPrivData();
1529 
1530  return viewData->m_flags & VISIBLE;
1531 }

References KIGFX::VIEW_ITEM_DATA::m_flags, KIGFX::VIEW_ITEM::viewPrivData(), and KIGFX::VISIBLE.

Referenced by GRID_HELPER::BestSnapAnchor(), PNS_KICAD_IFACE::HideItem(), and SELECTION_TOOL::Selectable().

◆ MakeOverlay()

std::shared_ptr< VIEW_OVERLAY > KIGFX::VIEW::MakeOverlay ( )
inherited

Definition at line 1554 of file view.cpp.

1555 {
1556  std::shared_ptr<VIEW_OVERLAY> overlay( new VIEW_OVERLAY );
1557 
1558  Add( overlay.get() );
1559  return overlay;
1560 }
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346

References KIGFX::VIEW::Add().

Referenced by AUTOPLACE_TOOL::autoplace().

◆ MarkDirty()

void KIGFX::VIEW::MarkDirty ( )
inlineinherited

Function MarkDirty() Forces redraw of view on the next rendering.

Definition at line 610 of file view.h.

611  {
612  for( int i = 0; i < TARGETS_NUMBER; ++i )
613  m_dirtyTargets[i] = true;
614  }
Number of available rendering targets.
Definition: definitions.h:51
bool m_dirtyTargets[TARGETS_NUMBER]
Flags to mark targets as dirty, so they have to be redrawn on the next refresh event.
Definition: view.h:855
size_t i
Definition: json11.cpp:597

References i, KIGFX::VIEW::m_dirtyTargets, and KIGFX::TARGETS_NUMBER.

Referenced by KIGFX::VIEW::ClearTargets(), PCB_EDITOR_CONTROL::DoSetDrillOrigin(), PCBNEW_CONTROL::DoSetGridOrigin(), refreshCallback(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW::SetGAL(), KIGFX::VIEW::SetMirror(), KIGFX::VIEW::SetScale(), KIGFX::VIEW::sortLayers(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow(), KIGFX::VIEW::UpdateAllLayersColor(), KIGFX::VIEW::UpdateAllLayersOrder(), and KIGFX::VIEW::VIEW().

◆ MarkForUpdate()

void KIGFX::VIEW::MarkForUpdate ( VIEW_ITEM aItem)
inherited

Function MarkForUpdate() Adds an item to a list of items that are going to be refreshed upon the next frame rendering.

Parameters
aItemis the item to be refreshed.

◆ markTargetClean()

void KIGFX::VIEW::markTargetClean ( int  aTarget)
inlineprotectedinherited

Definition at line 734 of file view.h.

735  {
736  wxCHECK( aTarget < TARGETS_NUMBER, /* void */ );
737  m_dirtyTargets[aTarget] = false;
738  }
Number of available rendering targets.
Definition: definitions.h:51
bool m_dirtyTargets[TARGETS_NUMBER]
Flags to mark targets as dirty, so they have to be redrawn on the next refresh event.
Definition: view.h:855

References KIGFX::VIEW::m_dirtyTargets, and KIGFX::TARGETS_NUMBER.

Referenced by KIGFX::VIEW::Redraw().

◆ MarkTargetDirty()

void KIGFX::VIEW::MarkTargetDirty ( int  aTarget)
inlineinherited

◆ OnDestroy()

void KIGFX::VIEW::OnDestroy ( VIEW_ITEM aItem)
staticinherited

Definition at line 271 of file view.cpp.

272 {
273  auto data = aItem->viewPrivData();
274 
275  if( !data )
276  return;
277 
278  if( data->m_view )
279  data->m_view->VIEW::Remove( aItem );
280 
281  delete data;
282  aItem->ClearViewPrivData();
283 }

References KIGFX::VIEW_ITEM::ClearViewPrivData(), KIGFX::VIEW_ITEM_DATA::m_view, and KIGFX::VIEW_ITEM::viewPrivData().

Referenced by KIGFX::VIEW_ITEM::~VIEW_ITEM().

◆ Query()

int KIGFX::VIEW::Query ( const BOX2I aRect,
std::vector< LAYER_ITEM_PAIR > &  aResult 
) const
virtualinherited

Function Query() Finds all visible items that touch or are within the rectangle aRect.

Parameters
aRectarea to search for items
aResultresult of the search, containing VIEW_ITEMs associated with their layers. Sorted according to the rendering order (items that are on top of the rendering stack as first).
Returns
Number of found items.

Definition at line 452 of file view.cpp.

453 {
454  if( m_orderedLayers.empty() )
455  return 0;
456 
457  std::vector<VIEW_LAYER*>::const_reverse_iterator i;
458 
459  // execute queries in reverse direction, so that items that are on the top of
460  // the rendering stack are returned first.
461  for( i = m_orderedLayers.rbegin(); i != m_orderedLayers.rend(); ++i )
462  {
463  // ignore layers that do not contain actual items (i.e. the selection box, menus, floats)
464  if( ( *i )->displayOnly || !( *i )->visible )
465  continue;
466 
467  queryVisitor<std::vector<LAYER_ITEM_PAIR> > visitor( aResult, ( *i )->id );
468  ( *i )->items->Query( aRect, visitor );
469  }
470 
471  return aResult.size();
472 }
LAYER_ORDER m_orderedLayers
Sorted list of pointers to members of m_layers.
Definition: view.h:818
size_t i
Definition: json11.cpp:597

References i, and KIGFX::VIEW::m_orderedLayers.

Referenced by DRAWING_TOOL::DrawVia(), EE_SELECTION_TOOL::selectMultiple(), and SELECTION_TOOL::selectMultiple().

◆ RecacheAllItems()

void KIGFX::VIEW::RecacheAllItems ( )
inherited

Function RecacheAllItems() Rebuilds GAL display lists.

Definition at line 1402 of file view.cpp.

1403 {
1404  BOX2I r;
1405 
1406  r.SetMaximum();
1407 
1408  for( LAYER_MAP_ITER i = m_layers.begin(); i != m_layers.end(); ++i )
1409  {
1410  VIEW_LAYER* l = &( ( *i ).second );
1411 
1412  if( IsCached( l->id ) )
1413  {
1414  recacheItem visitor( this, m_gal, l->id );
1415  l->items->Query( r, visitor );
1416  }
1417  }
1418 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
void SetMaximum()
Definition: box2.h:71
LAYER_MAP::iterator LAYER_MAP_ITER
Definition: view.h:717
size_t i
Definition: json11.cpp:597
bool IsCached(int aLayer) const
Returns true if the layer is cached.
Definition: view.h:592
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References i, KIGFX::VIEW::VIEW_LAYER::id, KIGFX::VIEW::IsCached(), KIGFX::VIEW::VIEW_LAYER::items, KIGFX::VIEW::m_gal, KIGFX::VIEW::m_layers, and BOX2< Vec >::SetMaximum().

Referenced by PCB_BASE_FRAME::ActivateGalCanvas(), GERBVIEW_FRAME::ActivateGalCanvas(), PCB_EDITOR_CONTROL::FlipPcbView(), SCH_EDIT_TOOL::Mirror(), GERBVIEW_DRAW_PANEL_GAL::OnShow(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceImage(), SCH_EDIT_TOOL::Properties(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_TOOL::Rotate(), PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_LIBEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), and PANEL_PCBNEW_SETTINGS::TransferDataFromWindow().

◆ Redraw()

void KIGFX::VIEW::Redraw ( )
virtualinherited

Function Redraw() Immediately redraws the whole view.

Definition at line 1145 of file view.cpp.

1146 {
1147 #ifdef __WXDEBUG__
1148  PROF_COUNTER totalRealTime;
1149 #endif /* __WXDEBUG__ */
1150 
1151  VECTOR2D screenSize = m_gal->GetScreenPixelSize();
1152  BOX2D rect( ToWorld( VECTOR2D( 0, 0 ) ),
1153  ToWorld( screenSize ) - ToWorld( VECTOR2D( 0, 0 ) ) );
1154 
1155  rect.Normalize();
1156  BOX2I recti( rect.GetPosition(), rect.GetSize() );
1157 
1158  // The view rtree uses integer positions. Large screens can overflow
1159  // this size so in this case, simply set the rectangle to the full rtree
1160  if( rect.GetWidth() > std::numeric_limits<int>::max() ||
1161  rect.GetHeight() > std::numeric_limits<int>::max() )
1162  recti.SetMaximum();
1163 
1164  redrawRect( recti );
1165  // All targets were redrawn, so nothing is dirty
1169 
1170 #ifdef __WXDEBUG__
1171  totalRealTime.Stop();
1172  wxLogTrace( "GAL_PROFILE", "VIEW::Redraw(): %.1f ms", totalRealTime.msecs() );
1173 #endif /* __WXDEBUG__ */
1174 }
void Stop()
save the time when this function was called, and set the counter stane to stop
Definition: profile.h:82
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:475
double msecs(bool aSinceLast=false)
Definition: profile.h:143
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
The class PROF_COUNTER is a small class to help profiling.
Definition: profile.h:44
Auxiliary rendering target (noncached)
Definition: definitions.h:49
const VECTOR2I & GetScreenPixelSize() const
Returns GAL canvas size in pixels.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
void SetMaximum()
Definition: box2.h:71
Items that may change while the view stays the same (noncached)
Definition: definitions.h:50
void markTargetClean(int aTarget)
Definition: view.h:734
void redrawRect(const BOX2I &aRect)
Definition: view.cpp:1010
Main rendering target (cached)
Definition: definitions.h:48
#define max(a, b)
Definition: auxiliary.h:86

References BOX2< Vec >::GetHeight(), BOX2< Vec >::GetPosition(), KIGFX::GAL::GetScreenPixelSize(), BOX2< Vec >::GetSize(), BOX2< Vec >::GetWidth(), KIGFX::VIEW::m_gal, KIGFX::VIEW::markTargetClean(), max, PROF_COUNTER::msecs(), BOX2< Vec >::Normalize(), KIGFX::VIEW::redrawRect(), BOX2< Vec >::SetMaximum(), PROF_COUNTER::Stop(), KIGFX::TARGET_CACHED, KIGFX::TARGET_NONCACHED, KIGFX::TARGET_OVERLAY, and KIGFX::VIEW::ToWorld().

Referenced by EDA_DRAW_PANEL_GAL::onPaint().

◆ redrawRect()

void KIGFX::VIEW::redrawRect ( const BOX2I aRect)
protectedinherited
  • Redraws contents within rect aRect

Definition at line 1010 of file view.cpp.

1011 {
1012  for( VIEW_LAYER* l : m_orderedLayers )
1013  {
1014  if( l->visible && IsTargetDirty( l->target ) && areRequiredLayersEnabled( l->id ) )
1015  {
1016  drawItem drawFunc( this, l->id, m_useDrawPriority, m_reverseDrawOrder );
1017 
1018  m_gal->SetTarget( l->target );
1019  m_gal->SetLayerDepth( l->renderingOrder );
1020  l->items->Query( aRect, drawFunc );
1021 
1022  if( m_useDrawPriority )
1023  drawFunc.deferredDraw();
1024  }
1025  }
1026 }
bool m_useDrawPriority
Flat list of all items Flag to respect draw priority when drawing items.
Definition: view.h:862
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
bool areRequiredLayersEnabled(int aLayerId) const
Checks if every layer required by the aLayerId layer is enabled.
Definition: view.cpp:1384
virtual void SetLayerDepth(double aLayerDepth)
Set the depth of the layer (position on the z-axis)
bool IsTargetDirty(int aTarget) const
Function IsTargetDirty() Returns true if any of layers belonging to the target or the target itself s...
Definition: view.h:574
LAYER_ORDER m_orderedLayers
Sorted list of pointers to members of m_layers.
Definition: view.h:818
bool m_reverseDrawOrder
Flag to reverse the draw order when using draw priority.
Definition: view.h:868
virtual void SetTarget(RENDER_TARGET aTarget)
Sets the target for rendering.

References KIGFX::VIEW::areRequiredLayersEnabled(), KIGFX::VIEW::drawItem::deferredDraw(), KIGFX::VIEW::IsTargetDirty(), KIGFX::VIEW::m_gal, KIGFX::VIEW::m_orderedLayers, KIGFX::VIEW::m_reverseDrawOrder, KIGFX::VIEW::m_useDrawPriority, KIGFX::GAL::SetLayerDepth(), and KIGFX::GAL::SetTarget().

Referenced by KIGFX::VIEW::Redraw().

◆ Remove()

void KIGFX::VIEW::Remove ( VIEW_ITEM aItem)
virtualinherited

Function Remove() Removes a VIEW_ITEM from the view.

Parameters
aItemitem to be removed. Caller must dispose the removed item if necessary

Reimplemented in KIGFX::PCB_VIEW.

Definition at line 376 of file view.cpp.

377 {
378  if( !aItem )
379  return;
380 
381  auto viewData = aItem->viewPrivData();
382 
383  if( !viewData )
384  return;
385 
386  wxCHECK( viewData->m_view == this, /*void*/ );
387  auto item = std::find( m_allItems->begin(), m_allItems->end(), aItem );
388 
389  if( item != m_allItems->end() )
390  {
391  m_allItems->erase( item );
392  viewData->clearUpdateFlags();
393  }
394 
395  int layers[VIEW::VIEW_MAX_LAYERS], layers_count;
396  viewData->getLayers( layers, layers_count );
397 
398  for( int i = 0; i < layers_count; ++i )
399  {
400  VIEW_LAYER& l = m_layers[layers[i]];
401  l.items->Remove( aItem );
402  MarkTargetDirty( l.target );
403 
404  // Clear the GAL cache
405  int prevGroup = viewData->getGroup( layers[i] );
406 
407  if( prevGroup >= 0 )
408  m_gal->DeleteGroup( prevGroup );
409  }
410 
411  viewData->deleteGroups();
412  viewData->m_view = nullptr;
413 }
virtual void DeleteGroup(int aGroupNumber)
Delete the group from the memory.
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:701
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:815
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
size_t i
Definition: json11.cpp:597
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::GAL::DeleteGroup(), i, KIGFX::VIEW::VIEW_LAYER::items, KIGFX::VIEW::m_allItems, KIGFX::VIEW::m_gal, KIGFX::VIEW::m_layers, KIGFX::VIEW::MarkTargetDirty(), KIGFX::VIEW::VIEW_LAYER::target, KIGFX::VIEW::VIEW_MAX_LAYERS, and KIGFX::VIEW_ITEM::viewPrivData().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SYMBOL_PREVIEW_WIDGET::DisplayPart(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), PL_EDIT_TOOL::DoDelete(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), DRAWING_TOOL::PlaceImportedGraphics(), BOARD_COMMIT::Push(), KIGFX::PCB_VIEW::Remove(), EDIT_TOOL::Remove(), SCH_BASE_FRAME::RemoveFromScreen(), PCB_EDITOR_CONTROL::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), BOARD_COMMIT::Revert(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), WS_DATA_ITEM::SyncDrawItems(), WS_DATA_ITEM_POLYGONS::SyncDrawItems(), WS_DATA_ITEM_TEXT::SyncDrawItems(), WS_DATA_ITEM_BITMAP::SyncDrawItems(), GERBVIEW_SELECTION_TOOL::unselect(), EE_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), LIB_VIEW_FRAME::updatePreviewSymbol(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), LIB_VIEW_FRAME::~LIB_VIEW_FRAME(), SELECTION_TOOL::~SELECTION_TOOL(), SYMBOL_PREVIEW_WIDGET::~SYMBOL_PREVIEW_WIDGET(), and ZONE_CREATE_HELPER::~ZONE_CREATE_HELPER().

◆ ReorderLayerData()

void KIGFX::VIEW::ReorderLayerData ( std::unordered_map< int, int >  aReorderMap)
inherited

Remaps the data between layer ids without invalidating that data.

Used by GerbView for the "Sort by X2" functionality

Parameters
aReorderMapis a mapping of old to new layer ids

Definition at line 706 of file view.cpp.

707 {
708  LAYER_MAP new_map;
709 
710  for( const auto& it : m_layers )
711  {
712  int orig_idx = it.first;
713  VIEW_LAYER layer = it.second;
714  int new_idx;
715 
716  try
717  {
718  new_idx = aReorderMap.at( orig_idx );
719  }
720  catch( const std::out_of_range& )
721  {
722  new_idx = orig_idx;
723  }
724 
725  layer.id = new_idx;
726  new_map[new_idx] = layer;
727  }
728 
729  m_layers = new_map;
730 
731  for( VIEW_ITEM* item : *m_allItems )
732  {
733  auto viewData = item->viewPrivData();
734 
735  if( !viewData )
736  continue;
737 
738  int layers[VIEW::VIEW_MAX_LAYERS], layers_count;
739 
740  item->ViewGetLayers( layers, layers_count );
741  viewData->saveLayers( layers, layers_count );
742 
743  viewData->reorderGroups( aReorderMap );
744 
745  viewData->m_requiredUpdate |= COLOR;
746  }
747 
748  UpdateItems();
749 }
friend class VIEW_ITEM
Definition: view.h:64
Visibility flag has changed.
Definition: view_item.h:56
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:701
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:815
std::unordered_map< int, VIEW_LAYER > LAYER_MAP
Definition: view.h:716
void UpdateItems()
Function UpdateItems() Iterates through the list of items that asked for updating and updates them.
Definition: view.cpp:1421
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::COLOR, KIGFX::VIEW::VIEW_LAYER::id, KIGFX::VIEW::m_allItems, KIGFX::VIEW::m_layers, KIGFX::VIEW::UpdateItems(), and KIGFX::VIEW::VIEW_MAX_LAYERS.

Referenced by GERBVIEW_FRAME::SortLayersByX2Attributes().

◆ ResizeSheetWorkingArea()

void KIGFX::SCH_VIEW::ResizeSheetWorkingArea ( SCH_SCREEN aScreen)

Definition at line 81 of file sch_view.cpp.

82 {
83  const PAGE_INFO& page_info = aScreen->GetPageSettings();
84  // A full size = 3 * page size allows a wide margin around the worksheet.
85  // This is useful to have a large working area.
86  double max_size_x = page_info.GetWidthMils() * IU_PER_MILS * 2.0;
87  double max_size_y = page_info.GetHeightMils() * IU_PER_MILS * 2.0;
88  m_boundary.SetOrigin( -max_size_x /4, -max_size_y/4 );
89  m_boundary.SetSize( max_size_x, max_size_y );
90 }
int GetHeightMils() const
Definition: page_info.h:140
void SetSize(const Vec &size)
Definition: box2.h:210
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:113
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
BOX2D m_boundary
View boundaries.
Definition: view.h:830
void SetOrigin(const Vec &pos)
Definition: box2.h:208
#define IU_PER_MILS
Definition: plotter.cpp:134
int GetWidthMils() const
Definition: page_info.h:137

References PAGE_INFO::GetHeightMils(), SCH_SCREEN::GetPageSettings(), PAGE_INFO::GetWidthMils(), IU_PER_MILS, KIGFX::VIEW::m_boundary, BOX2< Vec >::SetOrigin(), and BOX2< Vec >::SetSize().

Referenced by DisplaySheet().

◆ ReverseDrawOrder()

void KIGFX::VIEW::ReverseDrawOrder ( bool  aFlag)
inlineinherited

Function ReverseDrawOrder() Only takes effect if UseDrawPriority is true.

Parameters
aFlagis true if draw order should be reversed

Definition at line 675 of file view.h.

676  {
677  m_reverseDrawOrder = aFlag;
678  }
bool m_reverseDrawOrder
Flag to reverse the draw order when using draw priority.
Definition: view.h:868

References KIGFX::VIEW::m_reverseDrawOrder.

Referenced by EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ SetBoundary() [1/2]

void KIGFX::VIEW::SetBoundary ( const BOX2D aBoundary)
inlineinherited

Function SetBoundary() Sets limits for view area.

Parameters
aBoundaryis the box that limits view area.

Definition at line 267 of file view.h.

268  {
269  m_boundary = aBoundary;
270  }
BOX2D m_boundary
View boundaries.
Definition: view.h:830

References KIGFX::VIEW::m_boundary.

Referenced by PL_DRAW_PANEL_GAL::DisplayWorksheet(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), and DIALOG_PAD_PROPERTIES::redraw().

◆ SetBoundary() [2/2]

void KIGFX::VIEW::SetBoundary ( const BOX2I aBoundary)
inlineinherited

Function SetBoundary() Sets limits for view area.

Parameters
aBoundaryis the box that limits view area.

Definition at line 277 of file view.h.

278  {
279  m_boundary.SetOrigin( aBoundary.GetOrigin() );
280  m_boundary.SetEnd( aBoundary.GetEnd() );
281  }
const Vec GetEnd() const
Definition: box2.h:193
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:223
BOX2D m_boundary
View boundaries.
Definition: view.h:830
void SetOrigin(const Vec &pos)
Definition: box2.h:208
const Vec & GetOrigin() const
Definition: box2.h:191

References BOX2< Vec >::GetEnd(), BOX2< Vec >::GetOrigin(), KIGFX::VIEW::m_boundary, BOX2< Vec >::SetEnd(), and BOX2< Vec >::SetOrigin().

◆ SetCenter() [1/2]

void KIGFX::VIEW::SetCenter ( const VECTOR2D aCenter)
inherited

Function SetCenter() Sets the center point of the VIEW (i.e.

the point in world space that will be drawn in the middle of the screen).

Parameters
aCenterthe new center point, in world space coordinates.

Definition at line 604 of file view.cpp.

605 {
606  m_center = aCenter;
607 
608  if( !m_boundary.Contains( aCenter ) )
609  {
610  if( m_center.x < m_boundary.GetLeft() )
612  else if( aCenter.x > m_boundary.GetRight() )
614 
615  if( m_center.y < m_boundary.GetTop() )
617  else if( m_center.y > m_boundary.GetBottom() )
619  }
620 
623 
624  // Redraw everything after the viewport has changed
625  MarkDirty();
626 }
coord_type GetTop() const
Definition: box2.h:202
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
coord_type GetRight() const
Definition: box2.h:197
coord_type GetBottom() const
Definition: box2.h:198
virtual void ComputeWorldScreenMatrix()
Compute the world <-> screen transformation matrix.
VECTOR2D m_center
Center point of the VIEW (the point at which we are looking at)
Definition: view.h:824
bool Contains(const Vec &aPoint) const
Function Contains.
Definition: box2.h:149
BOX2D m_boundary
View boundaries.
Definition: view.h:830
void SetLookAtPoint(const VECTOR2D &aPoint)
Set the Point in world space to look at.
coord_type GetLeft() const
Definition: box2.h:201
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:610

References KIGFX::GAL::ComputeWorldScreenMatrix(), BOX2< Vec >::Contains(), BOX2< Vec >::GetBottom(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetTop(), KIGFX::VIEW::m_boundary, KIGFX::VIEW::m_center, KIGFX::VIEW::m_gal, KIGFX::VIEW::MarkDirty(), KIGFX::GAL::SetLookAtPoint(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by LIB_VIEW_FRAME::BestZoom(), LIB_EDIT_FRAME::BestZoom(), COMMON_TOOLS::CenterContents(), KIGFX::WX_VIEW_CONTROLS::CenterOnCursor(), SCH_BASE_FRAME::CenterScreen(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SYMBOL_PREVIEW_WIDGET::fitOnDrawArea(), EDA_DRAW_FRAME::FocusOnLocation(), KIGFX::WX_VIEW_CONTROLS::onMotion(), KIGFX::WX_VIEW_CONTROLS::onScroll(), KIGFX::WX_VIEW_CONTROLS::onTimer(), KIGFX::WX_VIEW_CONTROLS::onWheel(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_BASE_FRAME::RedrawScreen(), ZOOM_TOOL::selectRegion(), KIGFX::VIEW::SetCenter(), KIGFX::WX_VIEW_CONTROLS::SetCrossHairCursorPosition(), KIGFX::VIEW::SetGAL(), KIGFX::VIEW::SetScale(), KIGFX::VIEW::SetViewport(), KIGFX::WX_VIEW_CONTROLS::WarpCursor(), COMMON_TOOLS::ZoomFitScreen(), and SELECTION_TOOL::zoomFitSelection().

◆ SetCenter() [2/2]

void KIGFX::VIEW::SetCenter ( VECTOR2D  aCenter,
const BOX2D occultingScreenRect 
)
inherited

Function SetCenter() Sets the center point of the VIEW, attempting to avoid occultingScreenRect (for instance, the screen rect of a modeless dialog in front of the VIEW).

Parameters
aCenterthe new center point, in world space coordinates.
occultingScreenRectthe occulting rect, in screen space coordinates.

Definition at line 629 of file view.cpp.

630 {
631  BOX2D screenRect( VECTOR2D( 0, 0 ), m_gal->GetScreenPixelSize() );
632 
633  if( !screenRect.Intersects( occultingScreenRect ) )
634  {
635  SetCenter( aCenter );
636  return;
637  }
638 
639  BOX2D occultedRect = screenRect.Intersect( occultingScreenRect );
640  double topExposed = occultedRect.GetTop() - screenRect.GetTop();
641  double bottomExposed = screenRect.GetBottom() - occultedRect.GetBottom();
642  double leftExposed = occultedRect.GetLeft() - screenRect.GetLeft();
643  double rightExposed = screenRect.GetRight() - occultedRect.GetRight();
644 
645  if( std::max( topExposed, bottomExposed ) > std::max( leftExposed, rightExposed ) )
646  {
647  if( topExposed > bottomExposed )
648  aCenter.y += ToWorld( screenRect.GetHeight() / 2 - topExposed / 2 );
649  else
650  aCenter.y -= ToWorld( screenRect.GetHeight() / 2 - bottomExposed / 2 );
651  }
652  else
653  {
654  if( leftExposed > rightExposed )
655  aCenter.x += ToWorld( screenRect.GetWidth() / 2 - leftExposed / 2 );
656  else
657  aCenter.x -= ToWorld( screenRect.GetWidth() / 2 - rightExposed / 2 );
658  }
659 
660  SetCenter( aCenter );
661 }
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:475
coord_type GetTop() const
Definition: box2.h:202
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
coord_type GetRight() const
Definition: box2.h:197
coord_type GetBottom() const
Definition: box2.h:198
const VECTOR2I & GetScreenPixelSize() const
Returns GAL canvas size in pixels.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:604
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
#define max(a, b)
Definition: auxiliary.h:86
coord_type GetLeft() const
Definition: box2.h:201
BOX2< Vec > Intersect(const BOX2< Vec > &aRect)
Function Intersect Returns the intersection of this with another rectangle.
Definition: box2.h:266

References BOX2< Vec >::GetBottom(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), KIGFX::GAL::GetScreenPixelSize(), BOX2< Vec >::GetTop(), BOX2< Vec >::Intersect(), KIGFX::VIEW::m_gal, max, KIGFX::VIEW::SetCenter(), KIGFX::VIEW::ToWorld(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ SetGAL()

void KIGFX::VIEW::SetGAL ( GAL aGal)
inherited

Function SetGAL() Assigns a rendering device for the VIEW.

Parameters
aGalpointer to the GAL output device

Definition at line 519 of file view.cpp.

520 {
521  bool recacheGroups = ( m_gal != nullptr ); // recache groups only if GAL is reassigned
522  m_gal = aGal;
523 
524  // clear group numbers, so everything is going to be recached
525  if( recacheGroups )
526  clearGroupCache();
527 
528  // every target has to be refreshed
529  MarkDirty();
530 
531  // force the new GAL to display the current viewport.
532  SetCenter( m_center );
533  SetScale( m_scale );
535 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
void SetMirror(bool aMirrorX, bool aMirrorY)
Function SetMirror() Controls the mirroring of the VIEW.
Definition: view.cpp:565
VECTOR2D m_center
Center point of the VIEW (the point at which we are looking at)
Definition: view.h:824
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:604
bool m_mirrorX
Horizontal flip flag
Definition: view.h:839
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Function SetScale() Sets the scaling factor, zooming around a given anchor point.
Definition: view.cpp:578
void clearGroupCache()
Definition: view.cpp:1201
bool m_mirrorY
Vertical flip flag
Definition: view.h:842
double m_scale
Scale of displayed VIEW_ITEMs.
Definition: view.h:827
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:610

References KIGFX::VIEW::clearGroupCache(), KIGFX::VIEW::m_center, KIGFX::VIEW::m_gal, KIGFX::VIEW::m_mirrorX, KIGFX::VIEW::m_mirrorY, KIGFX::VIEW::m_scale, KIGFX::VIEW::MarkDirty(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW::SetMirror(), and KIGFX::VIEW::SetScale().

Referenced by GERBVIEW_DRAW_PANEL_GAL::GERBVIEW_DRAW_PANEL_GAL(), PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL(), PL_DRAW_PANEL_GAL::PL_DRAW_PANEL_GAL(), SCH_DRAW_PANEL::SCH_DRAW_PANEL(), SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), and EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ SetLayerDisplayOnly()

void KIGFX::VIEW::SetLayerDisplayOnly ( int  aLayer,
bool  aDisplayOnly = true 
)
inlineinherited

Definition at line 422 of file view.h.

423  {
424  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
425  m_layers[aLayer].displayOnly = aDisplayOnly;
426  }
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::m_layers.

Referenced by PL_DRAW_PANEL_GAL::setDefaultLayerDeps(), SCH_DRAW_PANEL::setDefaultLayerDeps(), GERBVIEW_DRAW_PANEL_GAL::setDefaultLayerDeps(), SCH_PREVIEW_PANEL::setDefaultLayerDeps(), and PCB_DRAW_PANEL_GAL::setDefaultLayerDeps().

◆ SetLayerOrder()

void KIGFX::VIEW::SetLayerOrder ( int  aLayer,
int  aRenderingOrder 
)
inherited

Function SetLayerOrder() Sets rendering order of a particular layer.

Lower values are rendered first.

Parameters
aLayerthe layer
aRenderingOrderarbitrary number denoting the rendering order.

Definition at line 664 of file view.cpp.

665 {
666  m_layers[aLayer].renderingOrder = aRenderingOrder;
667 
668  sortLayers();
669 }
void sortLayers()
Definition: view.cpp:1261
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::m_layers, and KIGFX::VIEW::sortLayers().

Referenced by SCH_DRAW_PANEL::setDefaultLayerOrder(), SCH_PREVIEW_PANEL::setDefaultLayerOrder(), PCB_DRAW_PANEL_GAL::setDefaultLayerOrder(), GERBVIEW_DRAW_PANEL_GAL::SetTopLayer(), and PCB_DRAW_PANEL_GAL::SetTopLayer().

◆ SetLayerTarget()

void KIGFX::VIEW::SetLayerTarget ( int  aLayer,
RENDER_TARGET  aTarget 
)
inlineinherited

Function SetLayerTarget() Changes the rendering target for a particular layer.

Parameters
aLayeris the layer.
aTargetis the rendering target.

Definition at line 434 of file view.h.

435  {
436  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
437  m_layers[aLayer].target = aTarget;
438  }
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::m_layers.

Referenced by PL_DRAW_PANEL_GAL::setDefaultLayerDeps(), SCH_DRAW_PANEL::setDefaultLayerDeps(), GERBVIEW_DRAW_PANEL_GAL::setDefaultLayerDeps(), SCH_PREVIEW_PANEL::setDefaultLayerDeps(), and PCB_DRAW_PANEL_GAL::setDefaultLayerDeps().

◆ SetLayerVisible()

void KIGFX::VIEW::SetLayerVisible ( int  aLayer,
bool  aVisible = true 
)
inlineinherited

Function SetLayerVisible() Controls the visibility of a particular layer.

Parameters
aLayerthe layer to show/hide.
aVisiblethe obvious.

Definition at line 399 of file view.h.

400  {
401  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
402 
403  if( m_layers[aLayer].visible != aVisible )
404  {
405  // Target has to be redrawn after changing its visibility
406  MarkTargetDirty( m_layers[aLayer].target );
407  m_layers[aLayer].visible = aVisible;
408  }
409  }
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::m_layers, and KIGFX::VIEW::MarkTargetDirty().

Referenced by PCB_LAYER_WIDGET::OnLayerVisible(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), PL_EDITOR_FRAME::OnSelectPage(), PL_DRAW_PANEL_GAL::PL_DRAW_PANEL_GAL(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), GERBVIEW_FRAME::SetElementVisibility(), GERBVIEW_FRAME::SetVisibleLayers(), and PCB_DRAW_PANEL_GAL::SyncLayersVisibility().

◆ SetMirror()

void KIGFX::VIEW::SetMirror ( bool  aMirrorX,
bool  aMirrorY 
)
inherited

Function SetMirror() Controls the mirroring of the VIEW.

Parameters
aMirrorXwhen true, the X axis is mirrored
aMirrorYwhen true, the Y axis is mirrored.

Definition at line 565 of file view.cpp.

566 {
567  wxASSERT_MSG( !aMirrorY, _( "Mirroring for Y axis is not supported yet" ) );
568 
569  m_mirrorX = aMirrorX;
570  m_mirrorY = aMirrorY;
571  m_gal->SetFlip( aMirrorX, aMirrorY );
572 
573  // Redraw everything
574  MarkDirty();
575 }
void SetFlip(bool xAxis, bool yAxis)
Sets flipping of the screen.
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
bool m_mirrorX
Horizontal flip flag
Definition: view.h:839
#define _(s)
bool m_mirrorY
Vertical flip flag
Definition: view.h:842
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:610

References _, KIGFX::VIEW::m_gal, KIGFX::VIEW::m_mirrorX, KIGFX::VIEW::m_mirrorY, KIGFX::VIEW::MarkDirty(), and KIGFX::GAL::SetFlip().

Referenced by PCB_EDITOR_CONTROL::FlipPcbView(), SCH_DRAW_PANEL::SCH_DRAW_PANEL(), SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), and KIGFX::VIEW::SetGAL().

◆ SetPainter()

void KIGFX::VIEW::SetPainter ( PAINTER aPainter)
inlineinherited

Function SetPainter() Sets the painter object used by the view for drawing VIEW_ITEMS.

Definition at line 189 of file view.h.

190  {
191  m_painter = aPainter;
192  }
PAINTER * m_painter
PAINTER contains information how do draw items.
Definition: view.h:845

References KIGFX::VIEW::m_painter.

Referenced by GERBVIEW_DRAW_PANEL_GAL::GERBVIEW_DRAW_PANEL_GAL(), PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL(), PL_DRAW_PANEL_GAL::PL_DRAW_PANEL_GAL(), SCH_DRAW_PANEL::SCH_DRAW_PANEL(), and SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL().

◆ SetPrintMode()

void KIGFX::VIEW::SetPrintMode ( int  aPrintMode)
inlineinherited

Set the printing mode.

Parameters
aPrintModeis the printing mode. If 0, the current mode is not a printing mode, just the draw mode

Definition at line 699 of file view.h.

699 { m_printMode = aPrintMode; }
int m_printMode
A control for printing: m_printMode <= 0 means no printing mode (normal draw mode m_printMode > 0 is ...
Definition: view.h:872

References KIGFX::VIEW::m_printMode.

Referenced by KIGFX::VIEW::VIEW().

◆ SetRequired()

void KIGFX::VIEW::SetRequired ( int  aLayerId,
int  aRequiredId,
bool  aRequired = true 
)
inherited

Function SetRequired() Marks the aRequiredId layer as required for the aLayerId layer.

In order to display the layer, all of its required layers have to be enabled.

Parameters
aLayerIdis the id of the layer for which we enable/disable the required layer.
aRequiredIdis the id of the required layer.
aRequiredtells if the required layer should be added or removed from the list.

Definition at line 416 of file view.cpp.

417 {
418  wxCHECK( (unsigned) aLayerId < m_layers.size(), /*void*/ );
419  wxCHECK( (unsigned) aRequiredId < m_layers.size(), /*void*/ );
420 
421  if( aRequired )
422  m_layers[aLayerId].requiredLayers.insert( aRequiredId );
423  else
424  m_layers[aLayerId].requiredLayers.erase( aRequired );
425 }
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::m_layers.

Referenced by PCB_DRAW_PANEL_GAL::setDefaultLayerDeps().

◆ SetScale()

void KIGFX::SCH_VIEW::SetScale ( double  aScale,
VECTOR2D  aAnchor = { 0, 0 } 
)
overridevirtual

Function SetScale() Sets the scaling factor, zooming around a given anchor point.

(depending on correct GAL unit length & DPI settings).

Parameters
aAnchorthe zooming anchor point
aScalethe scale factor

Reimplemented from KIGFX::VIEW.

Definition at line 71 of file sch_view.cpp.

72 {
73  VIEW::SetScale( aScale, aAnchor );
74 
75  //Redraw selection halos since their width is dependant on zoom
76  if( m_frame )
78 }
void RefreshSelection()
Mark selected items for refresh.
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Function SetScale() Sets the scaling factor, zooming around a given anchor point.
Definition: view.cpp:578
SCH_BASE_FRAME * m_frame
Definition: sch_view.h:104

References m_frame, SCH_BASE_FRAME::RefreshSelection(), and KIGFX::VIEW::SetScale().

Referenced by SCH_BASE_FRAME::RedrawScreen().

◆ SetScaleLimits()

void KIGFX::VIEW::SetScaleLimits ( double  aMaximum,
double  aMinimum 
)
inlineinherited

Function SetScaleLimits() Sets minimum and maximum values for scale.

Parameters
aMaximumis the maximum value for scale.
aMinimumis the minimum value for scale.

Definition at line 298 of file view.h.

299  {
300  wxASSERT_MSG( aMaximum > aMinimum, wxT( "I guess you passed parameters in wrong order" ) );
301 
302  m_minScale = aMinimum;
303  m_maxScale = aMaximum;
304  }
double m_minScale
Scale lower limit.
Definition: view.h:833
double m_maxScale
Scale upper limit.
Definition: view.h:836

References KIGFX::VIEW::m_maxScale, and KIGFX::VIEW::m_minScale.

Referenced by PL_DRAW_PANEL_GAL::PL_DRAW_PANEL_GAL(), SCH_DRAW_PANEL::SCH_DRAW_PANEL(), and SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL().

◆ SetTopLayer()

void KIGFX::VIEW::SetTopLayer ( int  aLayer,
bool  aEnabled = true 
)
virtualinherited

Function SetTopLayer() Sets given layer to be displayed on the top or sets back the default order of layers.

Parameters
aEnabled= true to display aLayer on the top.
aLayerthe layer or -1 in case when no particular layer should be displayed on the top.

Definition at line 860 of file view.cpp.

861 {
862  if( aEnabled )
863  {
864  if( m_topLayers.count( aLayer ) == 1 )
865  return;
866 
867  m_topLayers.insert( aLayer );
868 
869  // Move the layer closer to front
871  m_layers[aLayer].renderingOrder += TOP_LAYER_MODIFIER;
872  }
873  else
874  {
875  if( m_topLayers.count( aLayer ) == 0 )
876  return;
877 
878  m_topLayers.erase( aLayer );
879 
880  // Restore the previous rendering order
882  m_layers[aLayer].renderingOrder -= TOP_LAYER_MODIFIER;
883  }
884 }
static const int TOP_LAYER_MODIFIER
Rendering order modifier for layers that are marked as top layers.
Definition: view.h:858
std::set< unsigned int > m_topLayers
Stores set of layers that are displayed on the top.
Definition: view.h:821
bool m_enableOrderModifier
Definition: view.h:809
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::m_enableOrderModifier, KIGFX::VIEW::m_layers, KIGFX::VIEW::m_topLayers, and KIGFX::VIEW::TOP_LAYER_MODIFIER.

Referenced by DIALOG_PAD_PROPERTIES::redraw(), PL_DRAW_PANEL_GAL::SetTopLayer(), GERBVIEW_DRAW_PANEL_GAL::SetTopLayer(), PCB_DRAW_PANEL_GAL::SetTopLayer(), and EDA_DRAW_PANEL_GAL::SetTopLayer().

◆ SetViewport()

void KIGFX::VIEW::SetViewport ( const BOX2D aViewport)
inherited

Function SetViewport() Sets the visible area of the VIEW.

Parameters
aViewportdesired visible area, in world space coordinates.

Definition at line 550 of file view.cpp.

551 {
552  VECTOR2D ssize = ToWorld( m_gal->GetScreenPixelSize(), false );
553 
554  wxCHECK( ssize.x > 0 && ssize.y > 0, /*void*/ );
555 
556  VECTOR2D centre = aViewport.Centre();
557  VECTOR2D vsize = aViewport.GetSize();
558  double zoom = 1.0 / std::max( fabs( vsize.x / ssize.x ), fabs( vsize.y / ssize.y ) );
559 
560  SetCenter( centre );
561  SetScale( GetScale() * zoom );
562 }
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:475
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
const VECTOR2I & GetScreenPixelSize() const
Returns GAL canvas size in pixels.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:604
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Function SetScale() Sets the scaling factor, zooming around a given anchor point.
Definition: view.cpp:578
Vec Centre() const
Definition: box2.h:77
#define max(a, b)
Definition: auxiliary.h:86
const Vec & GetSize() const
Definition: box2.h:187
double GetScale() const
Function GetScale()
Definition: view.h:257

References BOX2< Vec >::Centre(), KIGFX::VIEW::GetScale(), KIGFX::GAL::GetScreenPixelSize(), BOX2< Vec >::GetSize(), KIGFX::VIEW::m_gal, max, KIGFX::VIEW::SetCenter(), KIGFX::VIEW::SetScale(), KIGFX::VIEW::ToWorld(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by DIALOG_PAD_PROPERTIES::redraw(), and FOOTPRINT_PREVIEW_PANEL::renderFootprint().

◆ SetVisible()

void KIGFX::VIEW::SetVisible ( VIEW_ITEM aItem,
bool  aIsVisible = true 
)
inherited

Sets the item visibility.

Parameters
aItemthe item to modify.
aIsVisiblewhether the item is visible (on all layers), or not.

Definition at line 1486 of file view.cpp.

1487 {
1488  auto viewData = aItem->viewPrivData();
1489 
1490  if( !viewData )
1491  return;
1492 
1493  bool cur_visible = viewData->m_flags & VISIBLE;
1494 
1495  if( cur_visible != aIsVisible )
1496  {
1497  if( aIsVisible )
1498  viewData->m_flags |= VISIBLE;
1499  else
1500  viewData->m_flags &= ~VISIBLE;
1501 
1502  Update( aItem, APPEARANCE | COLOR );
1503  }
1504 }
No updates are required.
Definition: view_item.h:55
Visibility flag has changed.
Definition: view_item.h:56
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540

References KIGFX::APPEARANCE, KIGFX::COLOR, KIGFX::VIEW_ITEM_DATA::m_flags, KIGFX::VIEW::Update(), KIGFX::VIEW_ITEM::viewPrivData(), and KIGFX::VISIBLE.

Referenced by KIGFX::VIEW::Add(), AddToPreview(), GRID_HELPER::BestSnapAnchor(), MICROWAVE_TOOL::drawMicrowaveInductor(), PNS_KICAD_IFACE::EraseView(), GRID_HELPER::GRID_HELPER(), PNS_KICAD_IFACE::HideItem(), EDIT_TOOL::MeasureTool(), ZONE_CREATE_HELPER::OnComplete(), ZONE_CREATE_HELPER::OnFirstPoint(), FOOTPRINT_PREVIEW_PANEL::renderFootprint(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), GRID_HELPER::SetAuxAxes(), ShowPreview(), and ZONE_CREATE_HELPER::~ZONE_CREATE_HELPER().

◆ ShowPreview()

void KIGFX::SCH_VIEW::ShowPreview ( bool  aShow = true)

Definition at line 169 of file sch_view.cpp.

170 {
171  SetVisible( m_preview.get(), aShow );
172 }
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1486
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: sch_view.h:109

References m_preview, and KIGFX::VIEW::SetVisible().

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), and SCH_LINE_WIRE_BUS_TOOL::finishSegments().

◆ SortLayers()

void KIGFX::VIEW::SortLayers ( int  aLayers[],
int &  aCount 
) const
inherited

Function SortLayers() Changes the order of given layer ids, so after sorting the order corresponds to layers rendering order (descending, ie.

order in which layers should be drawn - from the bottom to the top).

Parameters
aLayersstores id of layers to be sorted.
aCountstores the number of layers.

Definition at line 678 of file view.cpp.

679 {
680  int maxLay, maxOrd, maxIdx;
681 
682  for( int i = 0; i < aCount; ++i )
683  {
684  maxLay = aLayers[i];
685  maxOrd = GetLayerOrder( maxLay );
686  maxIdx = i;
687 
688  // Look for the max element in the range (j..aCount)
689  for( int j = i; j < aCount; ++j )
690  {
691  if( maxOrd < GetLayerOrder( aLayers[j] ) )
692  {
693  maxLay = aLayers[j];
694  maxOrd = GetLayerOrder( maxLay );
695  maxIdx = j;
696  }
697  }
698 
699  // Swap elements
700  aLayers[maxIdx] = aLayers[i];
701  aLayers[i] = maxLay;
702  }
703 }
int GetLayerOrder(int aLayer) const
Function GetLayerOrder() Returns rendering order of a particular layer.
Definition: view.cpp:672
size_t i
Definition: json11.cpp:597

References KIGFX::VIEW::GetLayerOrder(), and i.

Referenced by KIGFX::VIEW::draw(), and KIGFX::VIEW_GROUP::ViewDraw().

◆ sortLayers()

void KIGFX::VIEW::sortLayers ( )
protectedinherited
  • Sorts m_orderedLayers when layer rendering order has changed

Definition at line 1261 of file view.cpp.

1262 {
1263  int n = 0;
1264 
1265  m_orderedLayers.resize( m_layers.size() );
1266 
1267  for( LAYER_MAP_ITER i = m_layers.begin(); i != m_layers.end(); ++i )
1268  m_orderedLayers[n++] = &i->second;
1269 
1270  sort( m_orderedLayers.begin(), m_orderedLayers.end(), compareRenderingOrder );
1271 
1272  MarkDirty();
1273 }
LAYER_ORDER m_orderedLayers
Sorted list of pointers to members of m_layers.
Definition: view.h:818
LAYER_MAP::iterator LAYER_MAP_ITER
Definition: view.h:717
size_t i
Definition: json11.cpp:597
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812
static bool compareRenderingOrder(VIEW_LAYER *aI, VIEW_LAYER *aJ)
Determines rendering order of layers. Used in display order sorting function.
Definition: view.h:800
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:610

References KIGFX::VIEW::compareRenderingOrder(), i, KIGFX::VIEW::m_layers, KIGFX::VIEW::m_orderedLayers, and KIGFX::VIEW::MarkDirty().

Referenced by KIGFX::VIEW::SetLayerOrder(), KIGFX::VIEW::UpdateAllLayersOrder(), and KIGFX::VIEW::VIEW().

◆ ToScreen() [1/2]

VECTOR2D KIGFX::VIEW::ToScreen ( const VECTOR2D aCoord,
bool  aAbsolute = true 
) const
inherited

Function ToScreen() Converts a world space point/vector to a point/vector in screen space coordinates.

Parameters
aCoordthe point/vector to be converted
aAbsolutewhen true, aCoord is treated as a point, otherwise - as a direction (vector)

Definition at line 494 of file view.cpp.

495 {
496  const MATRIX3x3D& matrix = m_gal->GetWorldScreenMatrix();
497 
498  if( aAbsolute )
499  return VECTOR2D( matrix * aCoord );
500  else
501  return VECTOR2D( matrix.GetScale().x * aCoord.x, matrix.GetScale().y * aCoord.y );
502 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
Definition: matrix3x3.h:269
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
const MATRIX3x3D & GetWorldScreenMatrix() const
Get the world <-> screen transformation matrix.

References MATRIX3x3< T >::GetScale(), KIGFX::GAL::GetWorldScreenMatrix(), KIGFX::VIEW::m_gal, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by KIGFX::WX_VIEW_CONTROLS::handleAutoPanning(), TOOL_DISPATCHER::handleMouseButton(), KIGFX::WX_VIEW_CONTROLS::SetCrossHairCursorPosition(), KIGFX::VIEW::SetScale(), and KIGFX::WX_VIEW_CONTROLS::WarpCursor().

◆ ToScreen() [2/2]

double KIGFX::VIEW::ToScreen ( double  aSize) const
inherited

Function ToScreen() Converts a world space one dimensionsal size to a one dimensional size in screen space.

Parameters
aSizethe size to be transformed.

Definition at line 505 of file view.cpp.

506 {
507  const MATRIX3x3D& matrix = m_gal->GetWorldScreenMatrix();
508 
509  return matrix.GetScale().x * aSize;
510 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
Definition: matrix3x3.h:269
const MATRIX3x3D & GetWorldScreenMatrix() const
Get the world <-> screen transformation matrix.

References MATRIX3x3< T >::GetScale(), KIGFX::GAL::GetWorldScreenMatrix(), KIGFX::VIEW::m_gal, and VECTOR2< T >::x.

◆ ToWorld() [1/2]

VECTOR2D KIGFX::VIEW::ToWorld ( const VECTOR2D aCoord,
bool  aAbsolute = true 
) const
inherited

Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates.

Parameters
aCoordthe point/vector to be converted
aAbsolutewhen true, aCoord is treated as a point, otherwise - as a direction (vector)

Definition at line 475 of file view.cpp.

476 {
477  const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix();
478 
479  if( aAbsolute )
480  return VECTOR2D( matrix * aCoord );
481  else
482  return VECTOR2D( matrix.GetScale().x * aCoord.x, matrix.GetScale().y * aCoord.y );
483 }
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
Definition: matrix3x3.h:269
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586

References MATRIX3x3< T >::GetScale(), KIGFX::GAL::GetScreenWorldMatrix(), KIGFX::VIEW::m_gal, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by EE_POINT_EDITOR::addCornerCondition(), COMMON_TOOLS::CenterContents(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), EDIT_POINTS::FindPoint(), SYMBOL_PREVIEW_WIDGET::fitOnDrawArea(), GENERAL_COLLECTORS_GUIDE::GENERAL_COLLECTORS_GUIDE(), KIGFX::WX_VIEW_CONTROLS::GetMousePosition(), KIGFX::VIEW::GetViewport(), KIGFX::WX_VIEW_CONTROLS::onMotion(), KIGFX::WX_VIEW_CONTROLS::onScroll(), KIGFX::WX_VIEW_CONTROLS::onTimer(), KIGFX::WX_VIEW_CONTROLS::onWheel(), KIGFX::VIEW::Redraw(), KIGFX::WX_VIEW_CONTROLS::refreshMouse(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), ZOOM_TOOL::selectRegion(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW::SetScale(), KIGFX::VIEW::SetViewport(), KIGFX::ORIGIN_VIEWITEM::ViewDraw(), EDIT_POINTS::ViewDraw(), COMMON_TOOLS::ZoomFitScreen(), and SELECTION_TOOL::zoomFitSelection().

◆ ToWorld() [2/2]

double KIGFX::VIEW::ToWorld ( double  aSize) const
inherited

Function ToWorld() Converts a screen space one dimensional size to a one dimensional size in world space coordinates.

Parameters
aSize: the size to be converted

Definition at line 486 of file view.cpp.

487 {
488  const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix();
489 
490  return fabs( matrix.GetScale().x * aSize );
491 }
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
Definition: matrix3x3.h:269

References MATRIX3x3< T >::GetScale(), KIGFX::GAL::GetScreenWorldMatrix(), KIGFX::VIEW::m_gal, and VECTOR2< T >::x.

◆ Update() [1/2]

void KIGFX::VIEW::Update ( VIEW_ITEM aItem,
int  aUpdateFlags 
)
virtualinherited

For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has changed.

For static views calling has no effect.

Parameters
aItemthe item to update.
aUpdateFlagshow much the object has changed.

Reimplemented in KIGFX::PCB_VIEW.

Definition at line 1540 of file view.cpp.

1541 {
1542  auto viewData = aItem->viewPrivData();
1543 
1544  if( !viewData )
1545  return;
1546 
1547  assert( aUpdateFlags != NONE );
1548 
1549  viewData->m_requiredUpdate |= aUpdateFlags;
1550 
1551 }

References KIGFX::NONE, and KIGFX::VIEW_ITEM::viewPrivData().

Referenced by KIGFX::VIEW::Add(), PNS_PCBNEW_DEBUG_DECORATOR::AddLine(), AddToPreview(), PNS_PCBNEW_DEBUG_DECORATOR::Clear(), ClearPreview(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), PNS_KICAD_IFACE::DisplayItem(), KIGFX::VIEW::draw(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), PL_DRAWING_TOOLS::DrawShape(), SCH_EDIT_FRAME::EditSheet(), PAD_TOOL::EnumeratePads(), PNS_KICAD_IFACE::EraseView(), KIGFX::VIEW::Hide(), PNS_KICAD_IFACE::HideItem(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), PL_EDIT_TOOL::moveItem(), PROPERTIES_FRAME::OnAcceptPrms(), ZONE_CREATE_HELPER::OnGeometryChange(), KIGFX::VIEW::recacheItem::operator()(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), BOARD_COMMIT::Push(), DIALOG_PAD_PROPERTIES::redraw(), PCB_DRAW_PANEL_GAL::RedrawRatsnest(), SCH_BASE_FRAME::RefreshItem(), SCH_BASE_FRAME::RefreshSelection(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), KIGFX::VIEW::SetVisible(), SCH_EDIT_FRAME::TestDanglingEnds(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselectVisually(), KIGFX::PCB_VIEW::Update(), KIGFX::VIEW::Update(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), and EE_TOOL_BASE< SCH_BASE_FRAME >::updateView().

◆ Update() [2/2]

void KIGFX::VIEW::Update ( VIEW_ITEM aItem)
virtualinherited

Reimplemented in KIGFX::PCB_VIEW.

Definition at line 1534 of file view.cpp.

1535 {
1536  Update( aItem, ALL );
1537 }
Item needs to be redrawn.
Definition: view_item.h:61
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540

References KIGFX::ALL, and KIGFX::VIEW::Update().

◆ UpdateAllItems()

void KIGFX::VIEW::UpdateAllItems ( int  aUpdateFlags)
inherited

Updates all items in the view according to the given flags.

Parameters
aUpdateFlagsis is according to KIGFX::VIEW_UPDATE_FLAGS

Definition at line 1444 of file view.cpp.

1445 {
1446  for( VIEW_ITEM* item : *m_allItems )
1447  {
1448  auto viewData = item->viewPrivData();
1449 
1450  if( !viewData )
1451  continue;
1452 
1453  viewData->m_requiredUpdate |= aUpdateFlags;
1454  }
1455 }
friend class VIEW_ITEM
Definition: view.h:64
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:815

References KIGFX::VIEW::m_allItems.

Referenced by FOOTPRINT_VIEWER_FRAME::ApplyDisplaySettingsToGAL(), DISPLAY_FOOTPRINTS_FRAME::ApplyDisplaySettingsToGAL(), SCH_BASE_FRAME::HardRedraw(), GERBVIEW_CONTROL::HighlightControl(), HighlightItem(), SCH_EDIT_FRAME::KiwayMailIn(), GERBVIEW_FRAME::OnSelectHighlightChoice(), LIB_CONTROL::ShowElectricalTypes(), SCH_BASE_FRAME::SyncView(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), and PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow().

◆ UpdateAllItemsConditionally()

void KIGFX::VIEW::UpdateAllItemsConditionally ( int  aUpdateFlags,
std::function< bool(VIEW_ITEM *)>  aCondition 
)
inherited

Updates items in the view according to the given flags and condition.

Parameters
aUpdateFlagsis is according to KIGFX::VIEW_UPDATE_FLAGS
aConditionis a function returning true if the item should be updated

Definition at line 1458 of file view.cpp.

1460 {
1461  for( VIEW_ITEM* item : *m_allItems )
1462  {
1463  if( aCondition( item ) )
1464  {
1465  auto viewData = item->viewPrivData();
1466 
1467  if( !viewData )
1468  continue;
1469 
1470  viewData->m_requiredUpdate |= aUpdateFlags;
1471  }
1472  }
1473 }
friend class VIEW_ITEM
Definition: view.h:64
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:815

References KIGFX::VIEW::m_allItems.

Referenced by GERBVIEW_FRAME::SetElementVisibility(), and GERBVIEW_FRAME::UpdateDisplayOptions().

◆ UpdateAllLayersColor()

void KIGFX::VIEW::UpdateAllLayersColor ( )
inherited

Function UpdateAllLayersColor() Applies the new coloring scheme to all layers.

The used scheme is held by RENDER_SETTINGS.

See also
RENDER_SETTINGS

Definition at line 798 of file view.cpp.

799 {
800  if( m_gal->IsVisible() )
801  {
802  GAL_UPDATE_CONTEXT ctx( m_gal );
803 
804  for( VIEW_ITEM* item : *m_allItems )
805  {
806  auto viewData = item->viewPrivData();
807 
808  if( !viewData )
809  continue;
810 
811  int layers[VIEW::VIEW_MAX_LAYERS], layers_count;
812  viewData->getLayers( layers, layers_count );
813 
814  for( int i = 0; i < layers_count; ++i )
815  {
816  const COLOR4D color = m_painter->GetSettings()->GetColor( item, layers[i] );
817  int group = viewData->getGroup( layers[i] );
818 
819  if( group >= 0 )
820  m_gal->ChangeGroupColor( group, color );
821  }
822  }
823  }
824 
825  MarkDirty();
826 }
friend class VIEW_ITEM
Definition: view.h:64
int color
Definition: DXF_plotter.cpp:62
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:701
virtual const COLOR4D & GetColor(const VIEW_ITEM *aItem, int aLayer) const =0
Function GetColor Returns the color that should be used to draw the specific VIEW_ITEM on the specifi...
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:815
virtual void ChangeGroupColor(int aGroupNumber, const COLOR4D &aNewColor)
Changes the color used to draw the group.
PAINTER * m_painter
PAINTER contains information how do draw items.
Definition: view.h:845
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
size_t i
Definition: json11.cpp:597
virtual bool IsVisible() const
Returns true if the GAL canvas is visible on the screen.
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:610
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References KIGFX::GAL::ChangeGroupColor(), color, KIGFX::RENDER_SETTINGS::GetColor(), KIGFX::PAINTER::GetSettings(), i, KIGFX::GAL::IsVisible(), KIGFX::VIEW::m_allItems, KIGFX::VIEW::m_gal, KIGFX::VIEW::m_painter, KIGFX::VIEW::MarkDirty(), and KIGFX::VIEW::VIEW_MAX_LAYERS.

Referenced by PCB_INSPECTION_TOOL::ClearHighlight(), KIGFX::VIEW::EnableTopLayer(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer(), PCB_DRAW_PANEL_GAL::SetHighContrastLayer(), EDA_DRAW_PANEL_GAL::SetHighContrastLayer(), and PL_EDITOR_CONTROL::ToggleBackgroundColor().

◆ UpdateAllLayersOrder()

void KIGFX::VIEW::UpdateAllLayersOrder ( )
inherited

Function UpdateLayerOrder() Does everything that is needed to apply the rendering order of layers.

It has to be called after modification of renderingOrder field of LAYER.

Definition at line 927 of file view.cpp.

928 {
929  sortLayers();
930 
931  if( m_gal->IsVisible() )
932  {
933  GAL_UPDATE_CONTEXT ctx( m_gal );
934 
935  for( VIEW_ITEM* item : *m_allItems )
936  {
937  auto viewData = item->viewPrivData();
938 
939  if( !viewData )
940  continue;
941 
942  int layers[VIEW::VIEW_MAX_LAYERS], layers_count;
943  viewData->getLayers( layers, layers_count );
944 
945  for( int i = 0; i < layers_count; ++i )
946  {
947  int group = viewData->getGroup( layers[i] );
948 
949  if( group >= 0 )
950  m_gal->ChangeGroupDepth( group, m_layers[layers[i]].renderingOrder );
951  }
952  }
953  }
954 
955  MarkDirty();
956 }
void sortLayers()
Definition: view.cpp:1261
friend class VIEW_ITEM
Definition: view.h:64
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:701
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:815
size_t i
Definition: json11.cpp:597
virtual bool IsVisible() const
Returns true if the GAL canvas is visible on the screen.
virtual void ChangeGroupDepth(int aGroupNumber, int aDepth)
Changes the depth (Z-axis position) of the group.
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:610

References KIGFX::GAL::ChangeGroupDepth(), i, KIGFX::GAL::IsVisible(), KIGFX::VIEW::m_allItems, KIGFX::VIEW::m_gal, KIGFX::VIEW::m_layers, KIGFX::VIEW::MarkDirty(), KIGFX::VIEW::sortLayers(), and KIGFX::VIEW::VIEW_MAX_LAYERS.

Referenced by KIGFX::VIEW::EnableTopLayer(), SCH_DRAW_PANEL::SCH_DRAW_PANEL(), SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), PL_DRAW_PANEL_GAL::SetTopLayer(), GERBVIEW_DRAW_PANEL_GAL::SetTopLayer(), PCB_DRAW_PANEL_GAL::SetTopLayer(), and EDA_DRAW_PANEL_GAL::SetTopLayer().

◆ updateBbox()

void KIGFX::VIEW::updateBbox ( VIEW_ITEM aItem)
protectedinherited

Updates bounding box of an item.

Definition at line 1325 of file view.cpp.

1326 {
1327  int layers[VIEW_MAX_LAYERS], layers_count;
1328 
1329  aItem->ViewGetLayers( layers, layers_count );
1330 
1331  for( int i = 0; i < layers_count; ++i )
1332  {
1333  VIEW_LAYER& l = m_layers[layers[i]];
1334  l.items->Remove( aItem );
1335  l.items->Insert( aItem );
1336  MarkTargetDirty( l.target );
1337  }
1338 }
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:701
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
size_t i
Definition: json11.cpp:597
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References i, KIGFX::VIEW::VIEW_LAYER::items, KIGFX::VIEW::m_layers, KIGFX::VIEW::MarkTargetDirty(), KIGFX::VIEW::VIEW_LAYER::target, KIGFX::VIEW::VIEW_MAX_LAYERS, and KIGFX::VIEW_ITEM::ViewGetLayers().

Referenced by KIGFX::VIEW::invalidateItem().

◆ updateItemColor()

void KIGFX::VIEW::updateItemColor ( VIEW_ITEM aItem,
int  aLayer 
)
protectedinherited

Updates colors that are used for an item to be drawn.

Definition at line 1276 of file view.cpp.

1277 {
1278  auto viewData = aItem->viewPrivData();
1279  wxCHECK( (unsigned) aLayer < m_layers.size(), /*void*/ );
1280  wxCHECK( IsCached( aLayer ), /*void*/ );
1281 
1282  if( !viewData )
1283  return;
1284 
1285  // Obtain the color that should be used for coloring the item on the specific layerId
1286  const COLOR4D color = m_painter->GetSettings()->GetColor( aItem, aLayer );
1287  int group = viewData->getGroup( aLayer );
1288 
1289  // Change the color, only if it has group assigned
1290  if( group >= 0 )
1291  m_gal->ChangeGroupColor( group, color );
1292 }
int color
Definition: DXF_plotter.cpp:62
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
virtual const COLOR4D & GetColor(const VIEW_ITEM *aItem, int aLayer) const =0
Function GetColor Returns the color that should be used to draw the specific VIEW_ITEM on the specifi...
virtual void ChangeGroupColor(int aGroupNumber, const COLOR4D &aNewColor)
Changes the color used to draw the group.
PAINTER * m_painter
PAINTER contains information how do draw items.
Definition: view.h:845
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
bool IsCached(int aLayer) const
Returns true if the layer is cached.
Definition: view.h:592
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References KIGFX::GAL::ChangeGroupColor(), color, KIGFX::RENDER_SETTINGS::GetColor(), KIGFX::PAINTER::GetSettings(), KIGFX::VIEW::IsCached(), KIGFX::VIEW::m_gal, KIGFX::VIEW::m_layers, KIGFX::VIEW::m_painter, and KIGFX::VIEW_ITEM::viewPrivData().

Referenced by KIGFX::VIEW::invalidateItem().

◆ updateItemGeometry()

void KIGFX::VIEW::updateItemGeometry ( VIEW_ITEM aItem,
int  aLayer 
)
protectedinherited

Updates all informations needed to draw an item.

Definition at line 1295 of file view.cpp.

1296 {
1297  auto viewData = aItem->viewPrivData();
1298  wxCHECK( (unsigned) aLayer < m_layers.size(), /*void*/ );
1299  wxCHECK( IsCached( aLayer ), /*void*/ );
1300 
1301  if( !viewData )
1302  return;
1303 
1304  VIEW_LAYER& l = m_layers.at( aLayer );
1305 
1306  m_gal->SetTarget( l.target );
1307  m_gal->SetLayerDepth( l.renderingOrder );
1308 
1309  // Redraw the item from scratch
1310  int group = viewData->getGroup( aLayer );
1311 
1312  if( group >= 0 )
1313  m_gal->DeleteGroup( group );
1314 
1315  group = m_gal->BeginGroup();
1316  viewData->setGroup( aLayer, group );
1317 
1318  if( !m_painter->Draw( static_cast<EDA_ITEM*>( aItem ), aLayer ) )
1319  aItem->ViewDraw( aLayer, this ); // Alternative drawing method
1320 
1321  m_gal->EndGroup();
1322 }
virtual void DeleteGroup(int aGroupNumber)
Delete the group from the memory.
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
virtual void SetLayerDepth(double aLayerDepth)
Set the depth of the layer (position on the z-axis)
virtual void EndGroup()
End the group.
virtual int BeginGroup()
Begin a group.
PAINTER * m_painter
PAINTER contains information how do draw items.
Definition: view.h:845
virtual bool Draw(const VIEW_ITEM *aItem, int aLayer)=0
Function Draw Takes an instance of VIEW_ITEM and passes it to a function that know how to draw the it...
bool IsCached(int aLayer) const
Returns true if the layer is cached.
Definition: view.h:592
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812
virtual void SetTarget(RENDER_TARGET aTarget)
Sets the target for rendering.

References KIGFX::GAL::BeginGroup(), KIGFX::GAL::DeleteGroup(), KIGFX::PAINTER::Draw(), KIGFX::GAL::EndGroup(), KIGFX::VIEW::IsCached(), KIGFX::VIEW::m_gal, KIGFX::VIEW::m_layers, KIGFX::VIEW::m_painter, KIGFX::VIEW::VIEW_LAYER::renderingOrder, KIGFX::GAL::SetLayerDepth(), KIGFX::GAL::SetTarget(), KIGFX::VIEW::VIEW_LAYER::target, KIGFX::VIEW_ITEM::ViewDraw(), and KIGFX::VIEW_ITEM::viewPrivData().

Referenced by KIGFX::VIEW::invalidateItem().

◆ UpdateItems()

void KIGFX::VIEW::UpdateItems ( )
inherited

Function UpdateItems() Iterates through the list of items that asked for updating and updates them.

Definition at line 1421 of file view.cpp.

1422 {
1423  if( m_gal->IsVisible() )
1424  {
1425  GAL_UPDATE_CONTEXT ctx( m_gal );
1426 
1427  for( VIEW_ITEM* item : *m_allItems )
1428  {
1429  auto viewData = item->viewPrivData();
1430 
1431  if( !viewData )
1432  continue;
1433 
1434  if( viewData->m_requiredUpdate != NONE )
1435  {
1436  invalidateItem( item, viewData->m_requiredUpdate );
1437  viewData->m_requiredUpdate = NONE;
1438  }
1439  }
1440  }
1441 }
friend class VIEW_ITEM
Definition: view.h:64
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:815
void invalidateItem(VIEW_ITEM *aItem, int aUpdateFlags)
Function invalidateItem() Manages dirty flags & redraw queueing when updating an item.
Definition: view.cpp:1216
virtual bool IsVisible() const
Returns true if the GAL canvas is visible on the screen.

References KIGFX::VIEW::invalidateItem(), KIGFX::GAL::IsVisible(), KIGFX::VIEW::m_allItems, KIGFX::VIEW::m_gal, and KIGFX::NONE.

Referenced by PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), EDA_DRAW_PANEL_GAL::onPaint(), PCB_DRAW_PANEL_GAL::OnShow(), KIGFX::VIEW::ReorderLayerData(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ UpdateLayerColor()

void KIGFX::VIEW::UpdateLayerColor ( int  aLayer)
inherited

Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it has changed.

Parameters
aLayeris a number of the layer to be updated.
See also
RENDER_SETTINGS

Definition at line 777 of file view.cpp.

778 {
779  // There is no point in updating non-cached layers
780  if( !IsCached( aLayer ) )
781  return;
782 
783  BOX2I r;
784 
785  r.SetMaximum();
786 
787  if( m_gal->IsVisible() )
788  {
789  GAL_UPDATE_CONTEXT ctx( m_gal );
790 
791  updateItemsColor visitor( aLayer, m_painter, m_gal );
792  m_layers[aLayer].items->Query( r, visitor );
793  MarkTargetDirty( m_layers[aLayer].target );
794  }
795 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
void SetMaximum()
Definition: box2.h:71
PAINTER * m_painter
PAINTER contains information how do draw items.
Definition: view.h:845
bool IsCached(int aLayer) const
Returns true if the layer is cached.
Definition: view.h:592
virtual bool IsVisible() const
Returns true if the GAL canvas is visible on the screen.
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::VIEW::IsCached(), KIGFX::GAL::IsVisible(), KIGFX::VIEW::m_gal, KIGFX::VIEW::m_layers, KIGFX::VIEW::m_painter, KIGFX::VIEW::MarkTargetDirty(), and BOX2< Vec >::SetMaximum().

Referenced by PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), and PCB_LAYER_WIDGET::OnRenderColorChange().

◆ updateLayers()

void KIGFX::VIEW::updateLayers ( VIEW_ITEM aItem)
protectedinherited

Updates set of layers that an item occupies.

Definition at line 1341 of file view.cpp.

1342 {
1343  auto viewData = aItem->viewPrivData();
1344  int layers[VIEW_MAX_LAYERS], layers_count;
1345 
1346  if( !viewData )
1347  return;
1348 
1349  // Remove the item from previous layer set
1350  viewData->getLayers( layers, layers_count );
1351 
1352  for( int i = 0; i < layers_count; ++i )
1353  {
1354  VIEW_LAYER& l = m_layers[layers[i]];
1355  l.items->Remove( aItem );
1356  MarkTargetDirty( l.target );
1357 
1358  if( IsCached( l.id ) )
1359  {
1360  // Redraw the item from scratch
1361  int prevGroup = viewData->getGroup( layers[i] );
1362 
1363  if( prevGroup >= 0 )
1364  {
1365  m_gal->DeleteGroup( prevGroup );
1366  viewData->setGroup( l.id, -1 );
1367  }
1368  }
1369  }
1370 
1371  // Add the item to new layer set
1372  aItem->ViewGetLayers( layers, layers_count );
1373  viewData->saveLayers( layers, layers_count );
1374 
1375  for( int i = 0; i < layers_count; i++ )
1376  {
1377  VIEW_LAYER& l = m_layers[layers[i]];
1378  l.items->Insert( aItem );
1379  MarkTargetDirty( l.target );
1380  }
1381 }
virtual void DeleteGroup(int aGroupNumber)
Delete the group from the memory.
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:848
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:701
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
size_t i
Definition: json11.cpp:597
bool IsCached(int aLayer) const
Returns true if the layer is cached.
Definition: view.h:592
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:812

References KIGFX::GAL::DeleteGroup(), KIGFX::VIEW_ITEM_DATA::getLayers(), i, KIGFX::VIEW::VIEW_LAYER::id, KIGFX::VIEW::IsCached(), KIGFX::VIEW::VIEW_LAYER::items, KIGFX::VIEW::m_gal, KIGFX::VIEW::m_layers, KIGFX::VIEW::MarkTargetDirty(), KIGFX::VIEW::VIEW_LAYER::target, KIGFX::VIEW::VIEW_MAX_LAYERS, KIGFX::VIEW_ITEM::ViewGetLayers(), and KIGFX::VIEW_ITEM::viewPrivData().

Referenced by KIGFX::VIEW::invalidateItem().

◆ UseDrawPriority()

void KIGFX::VIEW::UseDrawPriority ( bool  aFlag)
inlineinherited

Function UseDrawPriority()

Parameters
aFlagis true if draw priority should be respected while redrawing.

Definition at line 656 of file view.h.

657  {
658  m_useDrawPriority = aFlag;
659  }
bool m_useDrawPriority
Flat list of all items Flag to respect draw priority when drawing items.
Definition: view.h:862

References KIGFX::VIEW::m_useDrawPriority.

Member Data Documentation

◆ m_allItems

◆ m_boundary

BOX2D KIGFX::VIEW::m_boundary
protectedinherited

◆ m_center

VECTOR2D KIGFX::VIEW::m_center
protectedinherited

Center point of the VIEW (the point at which we are looking at)

Definition at line 824 of file view.h.

Referenced by KIGFX::VIEW::GetCenter(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW::SetGAL(), and KIGFX::VIEW::SetScale().

◆ m_dirtyTargets

bool KIGFX::VIEW::m_dirtyTargets[TARGETS_NUMBER]
protectedinherited

Flags to mark targets as dirty, so they have to be redrawn on the next refresh event.

Definition at line 855 of file view.h.

Referenced by KIGFX::VIEW::IsTargetDirty(), KIGFX::VIEW::MarkDirty(), KIGFX::VIEW::markTargetClean(), and KIGFX::VIEW::MarkTargetDirty().

◆ m_dynamic

bool KIGFX::VIEW::m_dynamic
protectedinherited

Dynamic VIEW (eg.

display PCB in window) allows changes once it is built, static (eg. image/PDF) - does not.

Definition at line 852 of file view.h.

Referenced by KIGFX::VIEW::IsDynamic().

◆ m_enableOrderModifier

bool KIGFX::VIEW::m_enableOrderModifier
protectedinherited
  • Whether to use rendering order modifier or not

Definition at line 809 of file view.h.

Referenced by KIGFX::VIEW::ClearTopLayers(), KIGFX::VIEW::EnableTopLayer(), and KIGFX::VIEW::SetTopLayer().

◆ m_frame

SCH_BASE_FRAME* KIGFX::SCH_VIEW::m_frame
private

Definition at line 104 of file sch_view.h.

Referenced by DisplaySheet(), SCH_VIEW(), and SetScale().

◆ m_gal

◆ m_layers

◆ m_maxScale

double KIGFX::VIEW::m_maxScale
protectedinherited

Scale upper limit.

Definition at line 836 of file view.h.

Referenced by KIGFX::VIEW::SetScale(), and KIGFX::VIEW::SetScaleLimits().

◆ m_minScale

double KIGFX::VIEW::m_minScale
protectedinherited

Scale lower limit.

Definition at line 833 of file view.h.

Referenced by KIGFX::VIEW::SetScale(), and KIGFX::VIEW::SetScaleLimits().

◆ m_mirrorX

bool KIGFX::VIEW::m_mirrorX
protectedinherited

Horizontal flip flag

Definition at line 839 of file view.h.

Referenced by KIGFX::VIEW::IsMirroredX(), KIGFX::VIEW::SetGAL(), and KIGFX::VIEW::SetMirror().

◆ m_mirrorY

bool KIGFX::VIEW::m_mirrorY
protectedinherited

Vertical flip flag

Definition at line 842 of file view.h.

Referenced by KIGFX::VIEW::IsMirroredY(), KIGFX::VIEW::SetGAL(), and KIGFX::VIEW::SetMirror().

◆ m_nextDrawPriority

int KIGFX::VIEW::m_nextDrawPriority
protectedinherited

The next sequential drawing priority.

Definition at line 865 of file view.h.

Referenced by KIGFX::VIEW::Add(), and KIGFX::VIEW::Clear().

◆ m_orderedLayers

LAYER_ORDER KIGFX::VIEW::m_orderedLayers
protectedinherited

Sorted list of pointers to members of m_layers.

Definition at line 818 of file view.h.

Referenced by KIGFX::VIEW::Query(), KIGFX::VIEW::redrawRect(), and KIGFX::VIEW::sortLayers().

◆ m_ownedItems

std::vector<EDA_ITEM *> KIGFX::SCH_VIEW::m_ownedItems
private

Definition at line 110 of file sch_view.h.

Referenced by AddToPreview(), and ClearPreview().

◆ m_painter

PAINTER* KIGFX::VIEW::m_painter
protectedinherited

◆ m_preview

std::unique_ptr<KIGFX::VIEW_GROUP> KIGFX::SCH_VIEW::m_preview
private

◆ m_printMode

int KIGFX::VIEW::m_printMode
protectedinherited

A control for printing: m_printMode <= 0 means no printing mode (normal draw mode m_printMode > 0 is a printing mode (currently means "we are in printing mode")

Definition at line 872 of file view.h.

Referenced by KIGFX::VIEW::GetPrintMode(), and KIGFX::VIEW::SetPrintMode().

◆ m_reverseDrawOrder

bool KIGFX::VIEW::m_reverseDrawOrder
protectedinherited

Flag to reverse the draw order when using draw priority.

Definition at line 868 of file view.h.

Referenced by KIGFX::VIEW::IsDrawOrderReversed(), KIGFX::VIEW::redrawRect(), and KIGFX::VIEW::ReverseDrawOrder().

◆ m_scale

double KIGFX::VIEW::m_scale
protectedinherited

Scale of displayed VIEW_ITEMs.

Definition at line 827 of file view.h.

Referenced by KIGFX::VIEW::GetScale(), KIGFX::VIEW::drawItem::operator()(), KIGFX::VIEW::SetGAL(), and KIGFX::VIEW::SetScale().

◆ m_selectionArea

std::unique_ptr<KIGFX::PREVIEW::SELECTION_AREA> KIGFX::SCH_VIEW::m_selectionArea
private

Definition at line 108 of file sch_view.h.

Referenced by DisplayComponent(), DisplaySheet(), and SCH_VIEW().

◆ m_topLayers

std::set<unsigned int> KIGFX::VIEW::m_topLayers
protectedinherited

Stores set of layers that are displayed on the top.

Definition at line 821 of file view.h.

Referenced by KIGFX::VIEW::ClearTopLayers(), KIGFX::VIEW::EnableTopLayer(), KIGFX::VIEW::GetTopLayer(), and KIGFX::VIEW::SetTopLayer().

◆ m_useDrawPriority

bool KIGFX::VIEW::m_useDrawPriority
protectedinherited

Flat list of all items Flag to respect draw priority when drawing items.

Definition at line 862 of file view.h.

Referenced by KIGFX::VIEW::IsUsingDrawPriority(), KIGFX::VIEW::redrawRect(), and KIGFX::VIEW::UseDrawPriority().

◆ m_worksheet

std::unique_ptr<WS_PROXY_VIEW_ITEM> KIGFX::SCH_VIEW::m_worksheet
private

Definition at line 107 of file sch_view.h.

Referenced by DisplaySheet().

◆ TOP_LAYER_MODIFIER

const int KIGFX::VIEW::TOP_LAYER_MODIFIER = -VIEW_MAX_LAYERS
staticprotectedinherited

Rendering order modifier for layers that are marked as top layers.

Definition at line 858 of file view.h.

Referenced by KIGFX::VIEW::ClearTopLayers(), KIGFX::VIEW::EnableTopLayer(), and KIGFX::VIEW::SetTopLayer().

◆ VIEW_MAX_LAYERS


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