KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIGFX::VIEW Class Reference

Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the GAL. More...

#include <view.h>

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

Classes

struct  CLEAR_LAYER_CACHE_VISITOR
 
struct  DRAW_ITEM_VISITOR
 
struct  RECACHE_ITEM_VISITOR
 
struct  SCALE_USE
 How the content of a kept target depends on the scale it was emitted at. More...
 
struct  VIEW_LAYER
 

Public Types

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

Public Member Functions

 VIEW ()
 
virtual ~VIEW ()
 
 VIEW (const VIEW &)=delete
 
VIEW & operator= (const VIEW &)=delete
 
virtual void Add (VIEW_ITEM *aItem, int aDrawPriority=-1)
 Add a VIEW_ITEM to the view.
 
void AddBatch (const std::vector< VIEW_ITEM * > &aItems)
 Add a batch of items to the view, using bulk-loaded R-trees for initial population.
 
virtual void Remove (VIEW_ITEM *aItem)
 Remove a VIEW_ITEM from the view.
 
int Query (const BOX2I &aRect, std::vector< LAYER_ITEM_PAIR > &aResult) const
 Find all visible items that touch or are within the rectangle aRect.
 
void Query (const BOX2I &aRect, const std::function< bool(VIEW_ITEM *)> &aFunc) const
 Run a function on all visible items that touch or are within the rectangle aRect.
 
void SetVisible (VIEW_ITEM *aItem, bool aIsVisible=true)
 Set the item visibility.
 
void Hide (VIEW_ITEM *aItem, bool aHide=true, bool aHideOverlay=false)
 Temporarily hide the item in the view (e.g.
 
bool IsVisible (const VIEW_ITEM *aItem) const
 Return information if the item is visible (or not).
 
bool IsHiddenOnOverlay (const VIEW_ITEM *aItem) const
 
bool HasItem (const VIEW_ITEM *aItem) const
 Indicates whether or not the given item has been added to the view.
 
void RepaintLayers (const BOX2I &aRect, const std::function< bool(int)> &aLayerFilter, const std::function< bool(VIEW_ITEM *, int)> &aItemFilter)
 Re-cache only some layers of the items in aRect.
 
virtual void Update (const VIEW_ITEM *aItem, int aUpdateFlags) const
 For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has changed.
 
virtual void Update (const VIEW_ITEM *aItem) const
 
void SetRequired (int aLayerId, int aRequiredId, bool aRequired=true)
 Mark the aRequiredId layer as required for the aLayerId layer.
 
void CopySettings (const VIEW *aOtherView)
 Copy layers and visibility settings from another view.
 
void SetGAL (GAL *aGal)
 Assign a rendering device for the VIEW.
 
GAL * GetGAL () const
 Return the GAL this view is using to draw graphical primitives.
 
void SetPainter (PAINTER *aPainter)
 Set the painter object used by the view for drawing VIEW_ITEM objects.
 
PAINTER * GetPainter () const
 Return the painter object used by the view for drawing VIEW_ITEM objects.
 
void SetViewport (const BOX2D &aViewport)
 Set the visible area of the VIEW.
 
BOX2D GetViewport () const
 Return the current viewport visible area rectangle.
 
void SetMirror (bool aMirrorX, bool aMirrorY)
 Control the mirroring of the VIEW.
 
bool IsMirroredX () const
 Return true if view is flipped across the X axis.
 
bool IsMirroredY () const
 Return true if view is flipped across the Y axis.
 
virtual void SetScale (double aScale, VECTOR2D aAnchor={ 0, 0 })
 Set the scaling factor, zooming around a given anchor point.
 
double GetScale () const
 
bool IsShownAtScale (double aLod) const
 Return true if something with level of detail aLod is drawn at the current scale.
 
void SetBoundary (const BOX2D &aBoundary)
 Set limits for view area.
 
void SetBoundary (const BOX2I &aBoundary)
 Set limits for view area.
 
const BOX2D & GetBoundary () const
 
void SetScaleLimits (double aMaximum, double aMinimum)
 Set minimum and maximum values for scale.
 
void SetCenter (const VECTOR2D &aCenter)
 Set the center point of the VIEW (i.e.
 
void SetCenter (const VECTOR2D &aCenter, const std::vector< BOX2D > &obscuringScreenRects)
 Set the center point of the VIEW, attempting to avoid obscuringScreenRects (for instance, the screen rect of a modeless dialog in front of the VIEW).
 
const VECTOR2D & GetCenter () const
 Return the center point of this VIEW (in world space coordinates).
 
VECTOR2D ToWorld (const VECTOR2D &aCoord, bool aAbsolute=true) const
 Converts a screen space point/vector to a point/vector in world space coordinates.
 
double ToWorld (double aSize) const
 Converts a screen space one dimensional size to a one dimensional size in world space coordinates.
 
VECTOR2D ToScreen (const VECTOR2D &aCoord, bool aAbsolute=true) const
 Convert a world space point/vector to a point/vector in screen space coordinates.
 
double ToScreen (double aSize) const
 Convert a world space one dimensional size to a one dimensional size in screen space.
 
const VECTOR2I & GetScreenPixelSize () const
 Return the size of the our rendering area in pixels.
 
void Clear ()
 Remove all items from the view.
 
void SetLayerVisible (int aLayer, bool aVisible=true)
 Control the visibility of a particular layer.
 
bool IsLayerVisible (int aLayer) const
 Return information about visibility of a particular layer.
 
void SyncLayerVisibilityCache ()
 
bool IsLayerVisibleCached (int aLayer) const
 
void SetLayerDiff (int aLayer, bool aDiff=true)
 Set the whether the layer should drawn differentially.
 
void SetLayerHasNegatives (int aLayer, bool aNegatives=true)
 Set the status of negatives presense in a particular layer.
 
void SetLayerDisplayOnly (int aLayer, bool aDisplayOnly=true)
 Set a layer display-only (ie: to be rendered but not returned by hit test queries).
 
void SetLayerTarget (int aLayer, RENDER_TARGET aTarget)
 Change the rendering target for a particular layer.
 
void SetLayerOrder (int aLayer, int aRenderingOrder, bool aAutoSort=true)
 Set rendering order of a particular layer.
 
int GetLayerOrder (int aLayer) const
 Return rendering order of a particular layer.
 
void SortOrderedLayers ()
 Sorts m_orderedLayers after layer rendering order has changed.
 
void SortLayers (std::vector< int > &aLayers) const
 Change the order of given layer ids, so after sorting the order corresponds to layers rendering order (descending, ie.
 
void ReorderLayerData (std::unordered_map< int, int > aReorderMap)
 Remap the data between layer ids without invalidating that data.
 
void UpdateLayerColor (int aLayer)
 Apply the new coloring scheme held by RENDER_SETTINGS in case that it has changed.
 
void UpdateAllLayersColor ()
 Apply the new coloring scheme to all layers.
 
void UpdateAllLayersColorAndVisibility ()
 Apply the new coloring scheme to all layers after a render settings change that can also hide items, such as high contrast.
 
void UpdateLayersColor (bool aVisibility, const std::function< bool(int)> &aLayers)
 Recolor only the layers aLayers accepts, along with the fade the canvas may apply to them.
 
virtual void SetTopLayer (int aLayer, bool aEnabled=true)
 Set given layer to be displayed on the top or sets back the default order of layers.
 
virtual void EnableTopLayer (bool aEnable)
 Enable or disable display of the top layer.
 
virtual int GetTopLayer () const
 
void ClearTopLayers ()
 Remove all layers from the on-the-top set (they are no longer displayed over the rest of layers).
 
void UpdateAllLayersOrder ()
 Do everything that is needed to apply the rendering order of layers.
 
void ClearTargets ()
 Clear targets that are marked as dirty.
 
virtual void Redraw ()
 Immediately redraws the whole view.
 
void RecacheAllItems ()
 Rebuild GAL display lists.
 
bool IsDirty () const
 Return true if any of the VIEW layers needs to be refreshened.
 
bool IsTargetDirty (int aTarget) const
 Return true if any of layers belonging to the target or the target itself should be redrawn.
 
void MarkTargetDirty (int aTarget)
 Set or clear target 'dirty' flag.
 
void MarkGeometryDirty ()
 Signal a change to cached geometry so the next paint leaves the camera-reuse path and rebuilds the static scene.
 
void markSceneEdited ()
 Note that items of the cached scene were added, removed or re-cached.
 
void MarkStaticDirty ()
 Flag the GAL's static geometry pool as dirty so the next full redraw rebuilds it.
 
void SyncRetainedScene ()
 Bring a retained scene up to date with the view scale and layer state, and place again the items whose level of detail reads a layer that was shown or hidden.
 
bool IsCached (int aLayer) const
 Return true if the layer is cached.
 
void MarkDirty ()
 Force redraw of view on the next rendering.
 
void MarkViewportDirty ()
 Force a redraw for a camera change alone, which lets the paint reuse the cached scene.
 
void MarkClean ()
 Force redraw of view on the next rendering.
 
bool IsCameraDirtyOnly () const
 
void UpdateItems ()
 Iterate through the list of items that asked for updating and updates them.
 
bool HasPendingItemUpdates () const
 
void UpdateAllItems (int aUpdateFlags)
 Update all items in the view according to the given flags.
 
void UpdateAllItemsConditionally (int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
 Update items in the view according to the given flags and condition.
 
void UpdateAllItemsConditionally (std::function< int(VIEW_ITEM *)> aItemFlagsProvider)
 Update items in the view according to the flags returned by the callback.
 
bool IsUsingDrawPriority () const
 
void UseDrawPriority (bool aFlag)
 
void ReverseDrawOrder (bool aFlag)
 Only takes effect if UseDrawPriority is true.
 
std::shared_ptr< VIEW_OVERLAY > MakeOverlay ()
 
void InitPreview ()
 
void ClearPreview ()
 
void AddToPreview (VIEW_ITEM *aItem, bool aTakeOwnership=true)
 
void ShowPreview (bool aShow=true)
 
std::unique_ptr< VIEW > DataReference () const
 Return a new VIEW object that shares the same set of VIEW_ITEMs and LAYERs.
 

Static Public Member Functions

static void OnDestroy (VIEW_ITEM *aItem)
 Nasty hack, invoked by the destructor of VIEW_ITEM to auto-remove the item from the owning VIEW if there is any.
 

Static Public Attributes

static constexpr int VIEW_MAX_LAYERS = MAX_LAYERS_FOR_VIEW
 Maximum number of layers that may be shown.
 
static constexpr int TOP_LAYER_MODIFIER = -MAX_LAYERS_FOR_VIEW
 Rendering order modifier for layers that are marked as top layers.
 

Protected Member Functions

void unlinkItem (VIEW_ITEM *aItem)
 Detach a single VIEW_ITEM from this view.
 
void redrawRect (const BOX2I &aRect)
 Redraw contents within rectangle aRect.
 
void placeCachedGroup (VIEW_ITEM *aItem, int aLayer, const RETAINED_GROUP_ORDER *aOrder=nullptr)
 Tell a retained scene whether the cached group of aItem on aLayer belongs in it, caching the group first if needed.
 
double cachedGroupLOD (VIEW_ITEM *aItem, int aLayer)
 
void placeRetainedInOrder (const std::vector< LAYER_ITEM_PAIR > &aItems, bool aReplacing)
 Cache the missing groups of these items, then place them all in retained draw order.
 
void layerStateChanged (int aLayer)
 React to a change of a layer's visibility, order, required layers or negatives.
 
void noteLodRead (int aLayer) const
 Record that the item being placed asked whether aLayer is visible.
 
void markTargetClean (int aTarget)
 
void draw (VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
 Draw an item, but on a specified layers.
 
void draw (VIEW_ITEM *aItem, bool aImmediate=false)
 Draw an item on all layers that the item uses.
 
void draw (VIEW_GROUP *aGroup, bool aImmediate=false)
 Draw a group of items on all layers that those items use.
 
void clearGroupCache ()
 Clear cached GAL group numbers (ONLY numbers stored in VIEW_ITEMs, not group objects used by GAL).
 
void invalidateItem (VIEW_ITEM *aItem, int aUpdateFlags)
 Manage dirty flags & redraw queuing when updating an item.
 
void recolorAllLayers (bool aReplace, const std::function< bool(int)> &aLayers={})
 Recolor every cached group on the layers aLayers accepts, or all when empty, and place it again in a retained scene if aReplace.
 
void markDimExemption (const VIEW_ITEM *aItem, int aGroup)
 Keep a group of a retained scene out of its layer's fade if the painter exempts its item.
 
void updateItemColor (VIEW_ITEM *aItem, int aLayer)
 Update colors that are used for an item to be drawn.
 
void recolorGroup (VIEW_ITEM *aItem, int aLayer, int aGroup)
 
void releaseReplacedGroup (VIEW_ITEM *aItem, int aLayer)
 Delete the group a deferred placement of an item on a layer replaces, if it is still kept.
 
void releaseReplacedGroups ()
 Delete every group still kept for a deferred placement that did not happen.
 
void updateItemGeometry (VIEW_ITEM *aItem, int aLayer, bool aPlace=true)
 Update all information needed to draw an item.
 
void updateBbox (VIEW_ITEM *aItem)
 Update bounding box of an item.
 
void updateLayers (VIEW_ITEM *aItem)
 Update set of layers that an item occupies.
 
bool areRequiredLayersEnabled (int aLayerId) const
 Check if every layer required by the aLayerId layer is enabled.
 
void noteKeptLod (double aLod) const
 
void rescaleKeptTargets ()
 Mark the kept targets whose content the new scale changes, so they are emitted again.
 
void clearPendingItems ()
 Empty m_pendingItems and forget each listed item's place in it.
 

Static Protected Member Functions

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

Protected Attributes

std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
 
std::vector< VIEW_ITEM * > m_ownedItems
 
bool m_enableOrderModifier
 Whether to use rendering order modifier or not.
 
std::map< int, VIEW_LAYER > m_layers
 The set of possible displayed layers and its properties.
 
std::vector< VIEW_LAYER * > m_orderedLayers
 Sorted list of pointers to members of m_layers.
 
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
 Flat list of all items.
 
std::set< unsigned int > m_topLayers
 The set of layers that are displayed on the top.
 
VECTOR2D m_center
 Center point of the VIEW (the point at which we are looking at).
 
double m_scale
 
BOX2D m_boundary
 
double m_minScale
 
double m_maxScale
 
bool m_mirrorX
 
bool m_mirrorY
 
BASE_SET m_layerVisibilityCache
 
BASE_SET m_layerCachedFlagCache
 
bool m_layerCachesStale = true
 A layer's visibility or target changed since SyncLayerVisibilityCache() last copied them.
 
PAINTER * m_painter
 PAINTER contains information how do draw items.
 
GAL * m_gal
 Interface to PAINTER that is used to draw items.
 
bool m_dirtyTargets [TARGETS_NUMBER]
 Flag to mark targets as dirty so they have to be redrawn on the next refresh event.
 
bool m_targetEdited [TARGETS_NUMBER] = {}
 The target's content changed, not just the camera.
 
bool m_useDrawPriority
 Flag to respect draw priority when drawing items.
 
int m_nextDrawPriority
 The next sequential drawing priority.
 
bool m_reverseDrawOrder
 Flag to reverse the draw order when using draw priority.
 
bool m_hasPendingItemUpdates
 True when at least one item has deferred update flags that still need processing.
 
std::vector< VIEW_ITEM * > m_pendingItems
 Items flagged through Update() since the last UpdateItems(), so a frame that changed a few items need not visit all of them.
 
bool m_deferRetainedPlacement = false
 
std::vector< std::pair< VIEW_ITEM *, int > > m_deferredRetainedPlacements
 
std::map< std::pair< VIEW_ITEM *, int >, int > m_replacedRetainedGroups
 Groups replaced by items redrawn during a deferred placement.
 
bool m_pendingListIncomplete = false
 Items were flagged without being listed, so UpdateItems() has to scan them all.
 
bool m_sceneLayersStale = true
 A layer's order, visibility, required layers or negatives changed since the last sync.
 
SCALE_USE m_scaleUse [TARGETS_NUMBER]
 
bool m_scaleRead = false
 GetScale() was called, see SCALE_USE::read.
 
SCALE_USE * m_keptScaleUse = nullptr
 The SCALE_USE of the kept target being drawn, updated by each level of detail drawn.
 
std::vector< int > m_lodRefreshLayers
 Layers shown or hidden since the last sync, whose readers have to be placed again.
 
int m_lodProbeLayer = -1
 Cached layer being placed while an item is asked for its level of detail, else -1.
 
std::unordered_map< int, std::vector< bool > > m_lodReads
 For each layer whose visibility an item asked about, the cached layers those items were placed on.
 
bool m_cameraDirtyOnly
 The current dirty state is due only to camera changes.
 

Friends

class VIEW_ITEM
 

Detailed Description

Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the GAL.

VIEWs can exist in two flavors:

  • dynamic - where items can be added, removed or changed anytime, intended for the main editing panel. Each VIEW_ITEM can be added to a single dynamic view.
  • static - where items are added once at the startup and are not linked with the VIEW. Foreseen for preview windows and printing.

Items in a view are grouped in layers (not to be confused with Kicad's PCB layers). Each layer is identified by an integer number. Visibility and rendering order can be set individually for each of the layers. Future versions of the VIEW will also allows one to assign different layers to different rendering targets, which will be composited at the final stage by the GAL. The VIEW class also provides fast methods for finding all visible objects that are within a given rectangular area, useful for object selection/hit testing.

Definition at line 67 of file view.h.

Member Typedef Documentation

◆ LAYER_ITEM_PAIR

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

Definition at line 72 of file view.h.

Constructor & Destructor Documentation

◆ VIEW() [1/2]

◆ ~VIEW()

KIGFX::VIEW::~VIEW ( )
virtual

Definition at line 359 of file view.cpp.

References m_preview, and Remove().

◆ VIEW() [2/2]

KIGFX::VIEW::VIEW ( const VIEW & )
delete

References VIEW().

Member Function Documentation

◆ Add()

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

Add 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 365 of file view.cpp.

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

Referenced by KIGFX::PCB_VIEW::Add(), SCH_BASE_FRAME::AddToScreen(), BOOST_AUTO_TEST_CASE(), DIALOG_VIA_STITCH_PROPERTIES::buildGuardPreview(), PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems(), PCB_DESIGN_BLOCK_PREVIEW_WIDGET::DisplayDesignBlock(), SCH_DESIGN_BLOCK_PREVIEW_WIDGET::DisplayDesignBlock(), SYMBOL_DIFF_WIDGET::DisplayDiff(), SYMBOL_PREVIEW_WIDGET::DisplayPart(), KIGFX::SCH_VIEW::DisplaySheet(), KIGFX::SCH_VIEW::DisplaySymbol(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), SELECTION_TOOL::doSelectionMenu(), EE_GRID_HELPER::EE_GRID_HELPER(), GRID_HELPER::enableAndGetAnchorDebug(), API_HANDLER_SYMBOL::handleCreateUpdateItemsInternal(), InitPreview(), PL_POINT_EDITOR::Main(), SCH_POINT_EDITOR::Main(), MakeOverlay(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), operator=(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PCB_GRID_HELPER::PCB_GRID_HELPER(), PL_DRAWING_TOOLS::PlaceItem(), DIALOG_BARCODE_PROPERTIES::prepareCanvas(), DIALOG_PAD_PROPERTIES::prepareCanvas(), DIALOG_VIA_STITCH_PROPERTIES::prepareCanvas(), SCH_COMMIT::pushSchEdit(), GERBVIEW_FRAME::Read_EXCELLON_File(), GERBVIEW_FRAME::Read_GERBER_File(), DIALOG_VIA_STITCH_PROPERTIES::redrawPreview(), SCH_EDIT_FRAME::RefreshErcMarkers(), BOARD_EDITOR_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), PCB_CONTROL::Reset(), SCH_SELECTION_TOOL::Reset(), BOARD_COMMIT::RevertToCheckpoint(), SCH_COMMIT::RevertToCheckpoint(), GERBVIEW_SELECTION_TOOL::select(), SCH_SELECTION_TOOL::selectLasso(), PL_SELECTION_TOOL::selectMultiple(), SCH_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::SelectPolyArea(), ZOOM_TOOL::selectRegion(), DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DS_DATA_ITEM_POLYGONS::SyncDrawItems(), DS_DATA_ITEM_TEXT::SyncDrawItems(), PCB_POINT_EDITOR::updatePoints(), SYMBOL_VIEWER_FRAME::updatePreviewSymbol(), and VIEW().

◆ AddBatch()

void KIGFX::VIEW::AddBatch ( const std::vector< VIEW_ITEM * > & aItems)

Add a batch of items to the view, using bulk-loaded R-trees for initial population.

Much faster than calling Add() in a loop when adding many items at once (e.g. during board load) because it avoids R*-tree forced-reinsertion cascades.

Definition at line 414 of file view.cpp.

References KIGFX::INITIAL_ADD, KIGFX::VIEW::VIEW_LAYER::items, m_allItems, m_layers, m_nextDrawPriority, KIGFX::VIEW_ITEM_DATA::m_view, markSceneEdited(), MarkTargetDirty(), registered, SetVisible(), KIGFX::VIEW::VIEW_LAYER::target, Update(), VIEW(), VIEW_ITEM, and VIEW_MAX_LAYERS.

Referenced by DIALOG_FP_EDIT_PAD_TABLE::OnImportButtonClick(), and operator=().

◆ AddToPreview()

void KIGFX::VIEW::AddToPreview ( VIEW_ITEM * aItem,
bool aTakeOwnership = true )

◆ areRequiredLayersEnabled()

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

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

Definition at line 2198 of file view.cpp.

References areRequiredLayersEnabled(), and m_layers.

Referenced by areRequiredLayersEnabled(), redrawRect(), and SyncRetainedScene().

◆ cachedGroupLOD()

double KIGFX::VIEW::cachedGroupLOD ( VIEW_ITEM * aItem,
int aLayer )
protected

◆ Clear()

◆ clearGroupCache()

void KIGFX::VIEW::clearGroupCache ( )
protected

Clear cached GAL group numbers (ONLY numbers stored in VIEW_ITEMs, not group objects used by GAL).

Definition at line 1904 of file view.cpp.

References _, m_layers, and BOX2< Vec >::SetMaximum().

Referenced by SetGAL().

◆ clearPendingItems()

void KIGFX::VIEW::clearPendingItems ( )
protected

Empty m_pendingItems and forget each listed item's place in it.

Definition at line 2463 of file view.cpp.

References m_pendingItems, and VIEW_ITEM.

Referenced by Clear(), and UpdateItems().

◆ ClearPreview()

void KIGFX::VIEW::ClearPreview ( )

◆ ClearTargets()

void KIGFX::VIEW::ClearTargets ( )

Clear targets that are marked as dirty.

Definition at line 1801 of file view.cpp.

References IsTargetDirty(), m_dirtyTargets, m_gal, m_targetEdited, MarkDirty(), KIGFX::TARGET_CACHED, KIGFX::TARGET_NONCACHED, and KIGFX::TARGET_OVERLAY.

◆ ClearTopLayers()

void KIGFX::VIEW::ClearTopLayers ( )

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

Definition at line 1300 of file view.cpp.

References m_enableOrderModifier, m_layers, m_topLayers, and TOP_LAYER_MODIFIER.

Referenced by DIALOG_PAD_PROPERTIES::redraw().

◆ compareRenderingOrder()

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

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

Definition at line 1056 of file view.h.

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

Referenced by SortOrderedLayers().

◆ CopySettings()

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

Copy layers and visibility settings from another view.

Parameters
aOtherViewview from which settings will be copied.

Definition at line 829 of file view.cpp.

References VIEW().

Referenced by operator=().

◆ DataReference()

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

Return 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 2539 of file view.cpp.

References m_allItems, m_cameraDirtyOnly, m_hasPendingItemUpdates, and m_layers.

◆ draw() [1/3]

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

Draw 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 1728 of file view.cpp.

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

◆ draw() [2/3]

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

Draw 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 1705 of file view.cpp.

References draw(), m_gal, m_layers, SortLayers(), VIEW_ITEM, and KIGFX::VIEW_ITEM::ViewGetLayers().

◆ draw() [3/3]

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

Draw 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 1649 of file view.cpp.

References KIGFX::VIEW_ITEM_DATA::getGroup(), group, m_gal, m_layerCachedFlagCache, m_painter, KIGFX::REPAINT, traceRhi, Update(), updateItemGeometry(), VIEW_ITEM, KIGFX::VIEW_ITEM::ViewDraw(), and KIGFX::VIEW_ITEM::viewPrivData().

Referenced by draw(), and draw().

◆ EnableTopLayer()

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

Enable or disable 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 1275 of file view.cpp.

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

◆ GetBoundary()

const BOX2D & KIGFX::VIEW::GetBoundary ( ) const
inline
Returns
Current view area boundary.

Definition at line 336 of file view.h.

References m_boundary.

◆ GetCenter()

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

Return the center point of this VIEW (in world space coordinates).

Returns
center point of the view

Definition at line 377 of file view.h.

References m_center.

Referenced by FOOTPRINT_EDIT_FRAME::detachActiveFootprintTab(), EDA_DRAW_PANEL_GAL::DoRePaint(), GIT_FILE_DIFF_AREA::followCanvas(), ZONE_PREVIEW_NOTEBOOK::OnZoneSelectionChanged(), and EDA_DRAW_PANEL_GAL::ZoomToFit().

◆ GetGAL()

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

Return the GAL this view is using to draw graphical primitives.

Returns
Pointer to the currently used GAL instance.

Definition at line 224 of file view.h.

References m_gal.

Referenced by FOOTPRINT_EDIT_FRAME::borrowBoardNonDestructive(), COMMON_TOOLS::CursorControl(), PCB_CONTROL::DoSetGridOrigin(), COMMON_TOOLS::doZoomInOut(), drawBacksideTicks(), KIGFX::PREVIEW::ANGLE_ITEM::drawPreviewShape(), KIGFX::PREVIEW::CENTRELINE_RECT_ITEM::drawPreviewShape(), KIGFX::PREVIEW::POLYGON_ITEM::drawPreviewShape(), KIGFX::PREVIEW::DrawTextNextToCursor(), drawTicksAlongLine(), KIGFX::VIEW_OVERLAY::COMMAND_ARC::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_BITMAP_TEXT::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_CIRCLE::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_GLYPH_SIZE::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_LINE::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_POINT_POLYGON::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_POLY_POLYGON::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_POLYGON::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_RECTANGLE::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_SET_COLOR::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_SET_FILL::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_SET_STROKE::Execute(), KIGFX::VIEW_OVERLAY::COMMAND_SET_WIDTH::Execute(), DIALOG_VIA_STITCH_PROPERTIES::fitPreview(), ROUTER_TOOL::handleCommonEvents(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), COMMON_TOOLS::OnGridChanged(), COMMON_TOOLS::PanControl(), DIALOG_BARCODE_PROPERTIES::prepareCanvas(), DIALOG_PAD_PROPERTIES::prepareCanvas(), DIALOG_VIA_STITCH_PROPERTIES::prepareCanvas(), PCB_EDIT_FRAME::redrawNetnames(), SCH_BASE_FRAME::RefreshZoomDependentItems(), APPEARANCE_CONTROLS::setVisibleLayers(), SCH_DRAWING_TOOLS::sizeSheet(), KIGFX::sortRetainedOrder(), ViaSnapRange(), CONSTRAINT_BADGE_ITEM::ViewDraw(), DS_PROXY_VIEW_ITEM::ViewDraw(), EDIT_POINTS::ViewDraw(), KIGFX::ANCHOR_DEBUG::ViewDraw(), KIGFX::CONSTRUCTION_GEOM::ViewDraw(), KIGFX::ORIGIN_VIEWITEM::ViewDraw(), KIGFX::PREVIEW::ARC_ASSISTANT::ViewDraw(), KIGFX::PREVIEW::BEZIER_ASSISTANT::ViewDraw(), KIGFX::PREVIEW::ELLIPSE_ASSISTANT::ViewDraw(), KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), KIGFX::PREVIEW::SELECTION_AREA::ViewDraw(), KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM::ViewDraw(), KIGFX::PREVIEW::TWO_POINT_ASSISTANT::ViewDraw(), KIGFX::SNAP_INDICATOR::ViewDraw(), KIGFX::VIEW_GROUP::ViewDraw(), KIGFX::VIEW_OVERLAY::ViewDraw(), MY_DRAWING::ViewDraw(), PCB_VIA_STITCH::ViewDraw(), RATSNEST_VIEW_ITEM::ViewDraw(), ROUTER_PREVIEW_ITEM::ViewDraw(), ROUTER_STATUS_VIEW_ITEM::ViewDraw(), and TUNING_STATUS_VIEW_ITEM::ViewDraw().

◆ GetLayerOrder()

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

Return rendering order of a particular layer.

Lower values are rendered first.

Parameters
aLayeris the layer.
Returns
Rendering order of a particular layer.

Definition at line 1040 of file view.cpp.

References m_layers.

Referenced by ApplyPcbGalLayerOrder(), and ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM().

◆ GetPainter()

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

Return the painter object used by the view for drawing VIEW_ITEM objects.

Returns
Pointer to the currently used Painter instance.

Definition at line 242 of file view.h.

References m_painter.

Referenced by PCB_BASE_FRAME::ActivateGalCanvas(), GERBVIEW_FRAME::ApplyDisplaySettingsToGAL(), EDITOR_CONDITIONS::bboxesFunc(), RATSNEST_VIEW_ITEM::BoardInputsChanged(), DS_PROXY_VIEW_ITEM::buildDrawList(), GERBVIEW_CONTROL::ClearAllLayers(), PCB_BASE_FRAME::CommonSettingsChanged(), PL_EDITOR_FRAME::CommonSettingsChanged(), SCH_BASE_FRAME::CommonSettingsChanged(), PCB_GRID_HELPER::computeAnchors(), SYMBOL_DIFF_WIDGET::DisplayDiff(), KIGFX::PREVIEW::ANGLE_ITEM::drawPreviewShape(), KIGFX::PREVIEW::POLYGON_ITEM::drawPreviewShape(), KIGFX::PREVIEW::DrawTextNextToCursor(), PAD_TOOL::EditPad(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PAD_TOOL::ExitPadEditMode(), PCB_SELECTION_TOOL::FilterCollectorForFootprints(), FOOTPRINT_PREVIEW_PANEL::GetBackgroundColor(), FOOTPRINT_PREVIEW_PANEL::GetForegroundColor(), GRID_HELPER::GRID_HELPER(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), PCB_EDIT_FRAME::HandleRemoteNetHighlight(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::highlightNet(), PNS::TOOL_BASE::highlightNets(), PCB_EDIT_FRAME::LoadProjectSettings(), PCB_BASE_FRAME::LoadSettings(), KIGFX::VIEW_ITEM::lodScaleForThreshold(), DIALOG_PAD_PROPERTIES::onChangePadDrawMode(), GERBER_LAYER_WIDGET::OnLayerColorChange(), APPEARANCE_CONTROLS::onNetclassContextMenu(), GERBVIEW_FRAME::OnSelectActiveDCode(), GERBVIEW_FRAME::OnSelectActiveLayer(), PAD_TOOL::OnUndoRedo(), PCB_DESIGN_BLOCK_PREVIEW_WIDGET::PCB_DESIGN_BLOCK_PREVIEW_WIDGET(), PCB_GRID_HELPER::PCB_GRID_HELPER(), CONSTRAINT_EDIT_TOOL::pcbRenderSettings(), DIALOG_PAD_PROPERTIES::prepareCanvas(), DIALOG_VIA_STITCH_PROPERTIES::prepareCanvas(), PCB_SELECTION_TOOL::pruneObscuredSelectionCandidates(), PCB_GRID_HELPER::queryVisible(), DIALOG_PAD_PROPERTIES::redraw(), FOOTPRINT_PREVIEW_PANEL::renderFootprint(), GERBVIEW_SELECTION_TOOL::Reset(), PCB_SELECTION_TOOL::Reset(), SCH_SELECTION_TOOL::Reset(), GRAPHIC_EDIT_TOOL::runInteractive(), PCB_EDIT_FRAME::SaveProjectLocalSettings(), PCB_EDIT_FRAME::saveProjectSettings(), SCH_DESIGN_BLOCK_PREVIEW_WIDGET::SCH_DESIGN_BLOCK_PREVIEW_WIDGET(), SCH_EDIT_FRAME::SCH_EDIT_FRAME(), PCB_SELECTION_TOOL::Selectable(), PCB_BASE_FRAME::SetBoard(), SCH_EDIT_FRAME::SetSchematic(), PCBNEW_PRINTOUT::setupViewLayers(), SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET(), COMMON_TOOLS::ToggleBoundingBoxes(), KIGFX::PCB_VIEW::UpdateDisplayOptions(), PANEL_EESCHEMA_COLOR_SETTINGS::updatePreview(), PANEL_PCBNEW_COLOR_SETTINGS::updatePreview(), DS_PROXY_VIEW_ITEM::ViewDraw(), EDIT_POINTS::ViewDraw(), KIGFX::ANCHOR_DEBUG::ViewDraw(), KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), KIGFX::PREVIEW::SELECTION_AREA::ViewDraw(), KIGFX::VIEW_GROUP::ViewDraw(), PCB_VIA_STITCH::ViewDraw(), RATSNEST_VIEW_ITEM::ViewDraw(), PAD::ViewGetLOD(), PCB_DIMENSION_BASE::ViewGetLOD(), PCB_FIELD::ViewGetLOD(), PCB_REFERENCE_IMAGE::ViewGetLOD(), PCB_SHAPE::ViewGetLOD(), PCB_TEXT::ViewGetLOD(), PCB_TEXTBOX::ViewGetLOD(), PCB_TRACK::ViewGetLOD(), and PCB_VIA::ViewGetLOD().

◆ GetScale()

◆ GetScreenPixelSize()

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

Return the size of the our rendering area in pixels.

Returns
viewport screen size.

Definition at line 1880 of file view.cpp.

References m_gal.

◆ GetTopLayer()

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

Definition at line 1239 of file view.cpp.

References m_topLayers.

Referenced by ROUTER_TOOL::getStartLayer(), and BOARD_INSPECTION_TOOL::highlightNet().

◆ GetViewport()

◆ HasItem()

bool KIGFX::VIEW::HasItem ( const VIEW_ITEM * aItem) const

Indicates whether or not the given item has been added to the view.

Definition at line 2617 of file view.cpp.

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

Referenced by PCB_BASE_FRAME::HideSolderMask(), operator=(), BOARD_COMMIT::Push(), and PCB_BASE_FRAME::ShowSolderMask().

◆ HasPendingItemUpdates()

bool KIGFX::VIEW::HasPendingItemUpdates ( ) const
inline
Returns
true when at least one item has queued update flags that still need processing.

Definition at line 828 of file view.h.

References m_hasPendingItemUpdates.

◆ Hide()

◆ InitPreview()

◆ invalidateItem()

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

◆ IsCached()

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

Return true if the layer is cached.

Definition at line 766 of file view.h.

References m_layers, and KIGFX::TARGET_CACHED.

Referenced by invalidateItem(), layerStateChanged(), placeRetainedInOrder(), RecacheAllItems(), SetLayerDiff(), updateItemColor(), UpdateLayerColor(), and updateLayers().

◆ IsCameraDirtyOnly()

bool KIGFX::VIEW::IsCameraDirtyOnly ( ) const
inline

Definition at line 815 of file view.h.

References IsDirty(), and m_cameraDirtyOnly.

◆ IsDirty()

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

Return 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 701 of file view.h.

References IsTargetDirty(), and KIGFX::TARGETS_NUMBER.

Referenced by IsCameraDirtyOnly(), MarkViewportDirty(), and RepaintLayers().

◆ IsHiddenOnOverlay()

bool KIGFX::VIEW::IsHiddenOnOverlay ( const VIEW_ITEM * aItem) const

◆ IsLayerVisible()

◆ IsLayerVisibleCached()

◆ IsMirroredX()

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

Return true if view is flipped across the X axis.

Definition at line 272 of file view.h.

References m_mirrorX.

Referenced by COMMON_TOOLS::CursorControl(), drawBacksideTicks(), drawTicksAlongLine(), and SCH_SELECTION_TOOL::selectMultiple().

◆ IsMirroredY()

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

Return true if view is flipped across the Y axis.

Definition at line 280 of file view.h.

References m_mirrorY.

Referenced by PCB_BASE_FRAME::SetDisplayOptions().

◆ IsShownAtScale()

bool KIGFX::VIEW::IsShownAtScale ( double aLod) const

Return true if something with level of detail aLod is drawn at the current scale.

Items that draw others, such as VIEW_GROUP, use this instead of GetScale() so a kept target is emitted again only when the scale crosses aLod rather than on every zoom.

Definition at line 931 of file view.cpp.

References m_scale, and noteKeptLod().

Referenced by KIGFX::VIEW_GROUP::ViewDraw().

◆ IsTargetDirty()

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

Return 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 718 of file view.h.

References m_dirtyTargets, and KIGFX::TARGETS_NUMBER.

Referenced by ClearTargets(), IsDirty(), and redrawRect().

◆ IsUsingDrawPriority()

bool KIGFX::VIEW::IsUsingDrawPriority ( ) const
inline
Returns
true if draw priority is being respected while redrawing.

Definition at line 859 of file view.h.

References m_useDrawPriority.

◆ IsVisible()

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

Return 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 2601 of file view.cpp.

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

Referenced by BOOST_FIXTURE_TEST_CASE(), PCB_GRID_HELPER::computeAnchors(), EE_GRID_HELPER::GetGrid(), operator=(), EE_GRID_HELPER::queryVisible(), and PCB_GRID_HELPER::queryVisible().

◆ layerStateChanged()

void KIGFX::VIEW::layerStateChanged ( int aLayer)
protected

React to a change of a layer's visibility, order, required layers or negatives.

A retained scene places again only the items whose level of detail reads that layer's visibility, while other backends rebuild a cached layer.

Definition at line 588 of file view.cpp.

References IsCached(), m_gal, m_lodRefreshLayers, m_sceneLayersStale, MarkGeometryDirty(), markSceneEdited(), MarkStaticDirty(), MarkTargetDirty(), KIGFX::TARGET_CACHED, KIGFX::TARGET_NONCACHED, and KIGFX::TARGET_OVERLAY.

Referenced by SetLayerHasNegatives(), SetLayerVisible(), and SetRequired().

◆ MakeOverlay()

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

Definition at line 2710 of file view.cpp.

References Add(), and overlay.

Referenced by AUTOPLACE_TOOL::autoplace().

◆ MarkClean()

void KIGFX::VIEW::MarkClean ( )
inline

Force redraw of view on the next rendering.

Definition at line 804 of file view.h.

References m_cameraDirtyOnly, m_dirtyTargets, m_targetEdited, and KIGFX::TARGETS_NUMBER.

Referenced by Redraw().

◆ markDimExemption()

void KIGFX::VIEW::markDimExemption ( const VIEW_ITEM * aItem,
int aGroup )
protected

Keep a group of a retained scene out of its layer's fade if the painter exempts its item.

Definition at line 2011 of file view.cpp.

References m_gal, m_painter, and VIEW_ITEM.

Referenced by recolorGroup(), and updateItemGeometry().

◆ MarkDirty()

◆ MarkGeometryDirty()

void KIGFX::VIEW::MarkGeometryDirty ( )
inline

Signal a change to cached geometry so the next paint leaves the camera-reuse path and rebuilds the static scene.

MarkTargetDirty() keeps that path because routine updates that leave cached geometry alone call it on nearly every mouse move.

Definition at line 741 of file view.h.

References m_cameraDirtyOnly, and MarkStaticDirty().

Referenced by invalidateItem(), layerStateChanged(), markSceneEdited(), SetLayerDiff(), SetLayerTarget(), and UpdateLayerColor().

◆ markSceneEdited()

void KIGFX::VIEW::markSceneEdited ( )

Note that items of the cached scene were added, removed or re-cached.

A retained scene already knows where each affected group belongs, so the frame only leaves the camera-reuse path. Other backends, and views drawn by item priority, rebuild the cached scene.

Definition at line 731 of file view.cpp.

References m_cameraDirtyOnly, m_gal, m_useDrawPriority, and MarkGeometryDirty().

Referenced by Add(), AddBatch(), invalidateItem(), layerStateChanged(), recolorAllLayers(), RepaintLayers(), unlinkItem(), updateBbox(), UpdateItems(), and updateLayers().

◆ MarkStaticDirty()

void KIGFX::VIEW::MarkStaticDirty ( )

Flag the GAL's static geometry pool as dirty so the next full redraw rebuilds it.

Definition at line 713 of file view.cpp.

References m_gal, m_sceneLayersStale, MarkTargetDirty(), KIGFX::TARGET_NONCACHED, and KIGFX::TARGET_OVERLAY.

Referenced by layerStateChanged(), MarkGeometryDirty(), ReorderLayerData(), SetLayerDiff(), SetLayerTarget(), and UpdateLayerColor().

◆ markTargetClean()

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

Definition at line 970 of file view.h.

References m_dirtyTargets, m_targetEdited, and KIGFX::TARGETS_NUMBER.

◆ MarkTargetDirty()

◆ MarkViewportDirty()

void KIGFX::VIEW::MarkViewportDirty ( )
inline

Force a redraw for a camera change alone, which lets the paint reuse the cached scene.

Definition at line 793 of file view.h.

References IsDirty(), m_cameraDirtyOnly, m_dirtyTargets, and KIGFX::TARGETS_NUMBER.

Referenced by SetCenter(), and SetScale().

◆ noteKeptLod()

void KIGFX::VIEW::noteKeptLod ( double aLod) const
protected

Definition at line 939 of file view.cpp.

References KIGFX::VIEW_ITEM::LOD_HIDE, KIGFX::VIEW_ITEM::LOD_SHOW, m_keptScaleUse, and m_scale.

Referenced by IsShownAtScale().

◆ noteLodRead()

void KIGFX::VIEW::noteLodRead ( int aLayer) const
protected

Record that the item being placed asked whether aLayer is visible.

Definition at line 612 of file view.cpp.

References m_lodProbeLayer, m_lodReads, and VIEW_MAX_LAYERS.

Referenced by IsLayerVisible(), and IsLayerVisibleCached().

◆ OnDestroy()

void KIGFX::VIEW::OnDestroy ( VIEW_ITEM * aItem)
static

Nasty hack, invoked by the destructor of VIEW_ITEM to auto-remove the item from the owning VIEW if there is any.

KiCad relies too much on this mechanism. This is the only linking dependency now between EDA_ITEM and VIEW class. In near future I'll replace it with observers.

Definition at line 289 of file view.cpp.

References KIGFX::VIEW_ITEM_DATA::m_view, KIGFX::VIEW_ITEM::m_viewPrivData, unlinkItem(), and VIEW_ITEM.

Referenced by operator=(), and KIGFX::VIEW_ITEM::~VIEW_ITEM().

◆ operator=()

◆ placeCachedGroup()

◆ placeRetainedInOrder()

void KIGFX::VIEW::placeRetainedInOrder ( const std::vector< LAYER_ITEM_PAIR > & aItems,
bool aReplacing )
protected

Cache the missing groups of these items, then place them all in retained draw order.

Parameters
aReplacingreleases the groups the placed ones replace.

Definition at line 1451 of file view.cpp.

References cachedGroupLOD(), KIGFX::VIEW_ITEM_DATA::getGroup(), IsCached(), KIGFX::VIEW_ITEM_DATA::m_bbox, KIGFX::VIEW_ITEM_DATA::m_drawPriority, m_reverseDrawOrder, m_useDrawPriority, placeCachedGroup(), releaseReplacedGroup(), releaseReplacedGroups(), KIGFX::retainedOrderKey(), KIGFX::sortRetainedOrder(), and updateItemGeometry().

Referenced by UpdateItems().

◆ Query() [1/2]

void KIGFX::VIEW::Query ( const BOX2I & aRect,
const std::function< bool(VIEW_ITEM *)> & aFunc ) const

Run a function on all visible items that touch or are within the rectangle aRect.

Parameters
aRectis the area to query.
aFuncthe function to be executed; return true to continue, false to end query.

Definition at line 775 of file view.cpp.

References m_orderedLayers, and VIEW_ITEM.

◆ Query() [2/2]

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

Find all visible items that touch or are within the rectangle aRect.

Parameters
[in]aRectis the area to query.
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 744 of file view.cpp.

References m_orderedLayers, UNDEFINED_LAYER, and VIEW_ITEM.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), CheckItemDRCViolation(), FindSnapGraphic(), FindSnapPad(), FindSnapTrack(), operator=(), EE_GRID_HELPER::queryVisible(), PCB_GRID_HELPER::queryVisible(), GRAPHIC_EDIT_TOOL::runInteractive(), PCB_SELECTION_TOOL::SelectAll(), SCH_SELECTION_TOOL::SelectAll(), SCH_SELECTION_TOOL::SelectMultiple(), PCB_SELECTION_TOOL::UnselectAll(), SCH_SELECTION_TOOL::UnselectAll(), and SCH_EDIT_FRAME::UpdateHopOveredWires().

◆ RecacheAllItems()

◆ recolorAllLayers()

void KIGFX::VIEW::recolorAllLayers ( bool aReplace,
const std::function< bool(int)> & aLayers = {} )
protected

Recolor every cached group on the layers aLayers accepts, or all when empty, and place it again in a retained scene if aReplace.

Definition at line 1190 of file view.cpp.

References KIGFX::VIEW_ITEM_DATA::getGroup(), group, KIGFX::GAL_UPDATE_CONTEXT::IsUpdating(), m_allItems, m_gal, KIGFX::VIEW_ITEM_DATA::m_layers, m_scale, m_sceneLayersStale, MarkDirty(), markSceneEdited(), placeCachedGroup(), recolorGroup(), SyncLayerVisibilityCache(), and VIEW_ITEM.

Referenced by UpdateAllLayersColor(), UpdateAllLayersColorAndVisibility(), and UpdateLayersColor().

◆ recolorGroup()

void KIGFX::VIEW::recolorGroup ( VIEW_ITEM * aItem,
int aLayer,
int aGroup )
protected

◆ Redraw()

void KIGFX::VIEW::Redraw ( )
virtual

◆ redrawRect()

◆ releaseReplacedGroup()

void KIGFX::VIEW::releaseReplacedGroup ( VIEW_ITEM * aItem,
int aLayer )
protected

Delete the group a deferred placement of an item on a layer replaces, if it is still kept.

Definition at line 2081 of file view.cpp.

References m_gal, m_replacedRetainedGroups, and VIEW_ITEM.

Referenced by placeRetainedInOrder().

◆ releaseReplacedGroups()

void KIGFX::VIEW::releaseReplacedGroups ( )
protected

Delete every group still kept for a deferred placement that did not happen.

Definition at line 2093 of file view.cpp.

References group, m_gal, and m_replacedRetainedGroups.

Referenced by placeRetainedInOrder(), and UpdateItems().

◆ Remove()

void KIGFX::VIEW::Remove ( VIEW_ITEM * aItem)
virtual

Remove 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 488 of file view.cpp.

References unlinkItem(), and VIEW_ITEM.

Referenced by BOOST_AUTO_TEST_CASE(), API_HANDLER_SYMBOL::deleteItemsInternal(), SYMBOL_DIFF_WIDGET::DisplayDiff(), SYMBOL_PREVIEW_WIDGET::DisplayPart(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), PL_EDIT_TOOL::DoDelete(), SELECTION_TOOL::doSelectionMenu(), PL_POINT_EDITOR::Main(), SCH_POINT_EDITOR::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), operator=(), PL_DRAWING_TOOLS::PlaceItem(), SCH_COMMIT::pushSchEdit(), DIALOG_VIA_STITCH_PROPERTIES::redrawPreview(), SCH_EDIT_FRAME::RefreshErcMarkers(), KIGFX::PCB_VIEW::Remove(), SCH_BASE_FRAME::RemoveFromScreen(), BOARD_EDITOR_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), PCB_CONTROL::Reset(), SCH_SELECTION_TOOL::Reset(), BOARD_COMMIT::RevertToCheckpoint(), SCH_COMMIT::RevertToCheckpoint(), SCH_SELECTION_TOOL::selectLasso(), PL_SELECTION_TOOL::selectMultiple(), SCH_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::SelectPolyArea(), ZOOM_TOOL::selectRegion(), DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DS_DATA_ITEM_POLYGONS::SyncDrawItems(), DS_DATA_ITEM_TEXT::SyncDrawItems(), GERBVIEW_SELECTION_TOOL::unselect(), PCB_POINT_EDITOR::updatePoints(), SCH_POINT_EDITOR::updatePoints(), SYMBOL_VIEWER_FRAME::updatePreviewSymbol(), DIALOG_VIA_STITCH_PROPERTIES::~DIALOG_VIA_STITCH_PROPERTIES(), EE_GRID_HELPER::~EE_GRID_HELPER(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), PCB_GRID_HELPER::~PCB_GRID_HELPER(), PCB_SELECTION_TOOL::~PCB_SELECTION_TOOL(), SCH_SELECTION_TOOL::~SCH_SELECTION_TOOL(), SYMBOL_VIEWER_FRAME::~SYMBOL_VIEWER_FRAME(), and ~VIEW().

◆ ReorderLayerData()

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

Remap 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 1056 of file view.cpp.

References _, KIGFX::COLOR, m_allItems, m_gal, m_hasPendingItemUpdates, m_layerCachesStale, m_layers, m_pendingListIncomplete, KIGFX::VIEW_ITEM_DATA::m_requiredUpdate, MarkStaticDirty(), moved, KIGFX::VIEW_ITEM_DATA::reorderGroups(), KIGFX::VIEW_ITEM_DATA::saveLayers(), SortOrderedLayers(), source, UpdateItems(), and VIEW_ITEM.

Referenced by BOOST_AUTO_TEST_CASE(), and GERBVIEW_FRAME::RemapLayers().

◆ RepaintLayers()

void KIGFX::VIEW::RepaintLayers ( const BOX2I & aRect,
const std::function< bool(int)> & aLayerFilter,
const std::function< bool(VIEW_ITEM *, int)> & aItemFilter )

Re-cache only some layers of the items in aRect.

Update() with REPAINT re-caches every layer of an item, which is wasted when only one layer depends on the state that changed.

Parameters
aLayerFilterreturns true for the cached layers to search and repaint.
aItemFilterreturns true for the items on such a layer that need it.

Definition at line 2656 of file view.cpp.

References IsDirty(), KIGFX::GAL_UPDATE_CONTEXT::IsUpdating(), m_cameraDirtyOnly, m_gal, m_orderedLayers, m_scale, m_useDrawPriority, markSceneEdited(), MarkTargetDirty(), KIGFX::TARGET_CACHED, updateItemGeometry(), and VIEW_ITEM.

Referenced by operator=(), and PCB_EDIT_FRAME::redrawNetnames().

◆ rescaleKeptTargets()

void KIGFX::VIEW::rescaleKeptTargets ( )
protected

Mark the kept targets whose content the new scale changes, so they are emitted again.

Definition at line 952 of file view.cpp.

References KIGFX::VIEW::SCALE_USE::lodAbove, m_cameraDirtyOnly, m_gal, m_scale, m_scaleUse, MarkTargetDirty(), KIGFX::VIEW::SCALE_USE::read, KIGFX::TARGET_NONCACHED, and KIGFX::TARGET_OVERLAY.

Referenced by SetScale().

◆ ReverseDrawOrder()

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

Only takes effect if UseDrawPriority is true.

Parameters
aFlagis true if draw order should be reversed

Definition at line 877 of file view.h.

References m_reverseDrawOrder.

◆ SetBoundary() [1/2]

void KIGFX::VIEW::SetBoundary ( const BOX2D & aBoundary)
inline

Set limits for view area.

Parameters
aBoundaryis the box that limits view area.

Definition at line 317 of file view.h.

References m_boundary.

Referenced by DIALOG_PAD_PROPERTIES::redraw().

◆ SetBoundary() [2/2]

void KIGFX::VIEW::SetBoundary ( const BOX2I & aBoundary)
inline

Set limits for view area.

Parameters
aBoundaryis the box that limits view area.

Definition at line 327 of file view.h.

References BOX2< Vec >::GetEnd(), BOX2< Vec >::GetOrigin(), and m_boundary.

◆ SetCenter() [1/2]

◆ SetCenter() [2/2]

void KIGFX::VIEW::SetCenter ( const VECTOR2D & aCenter,
const std::vector< BOX2D > & obscuringScreenRects )

Set the center point of the VIEW, attempting to avoid obscuringScreenRects (for instance, the screen rect of a modeless dialog in front of the VIEW).

Parameters
aCenterthe new center point, in world space coordinates.
obscuringScreenRectsthe obscuring rects, in screen space coordinates.

Definition at line 996 of file view.cpp.

References ALLOW_ACUTE_CORNERS, ARC_LOW_DEF, SHAPE_POLY_SET::BBox(), SHAPE_POLY_SET::BooleanSubtract(), BOX2< Vec >::Centre(), SHAPE_POLY_SET::Deflate(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), SHAPE_POLY_SET::IsEmpty(), m_gal, SetCenter(), and ToWorld().

◆ SetGAL()

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

Assign a rendering device for the VIEW.

Parameters
aGalpointer to the GAL output device.

Definition at line 835 of file view.cpp.

References clearGroupCache(), m_center, m_gal, m_mirrorX, m_mirrorY, m_scale, m_sceneLayersStale, MarkDirty(), KIGFX::REPAINT, SetCenter(), SetMirror(), and UpdateAllItems().

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and operator=().

◆ SetLayerDiff()

void KIGFX::VIEW::SetLayerDiff ( int aLayer,
bool aDiff = true )
inline

Set the whether the layer should drawn differentially.

Parameters
aLayeris the layer to set to be draw differentially
aDiffis the layer diff'ing state.

Definition at line 486 of file view.h.

References KIGFX::VIEW::VIEW_LAYER::diffLayer, IsCached(), m_layers, MarkGeometryDirty(), MarkStaticDirty(), MarkTargetDirty(), and KIGFX::VIEW::VIEW_LAYER::target.

Referenced by GERBVIEW_FRAME::UpdateXORLayers().

◆ SetLayerDisplayOnly()

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

Set a layer display-only (ie: to be rendered but not returned by hit test queries).

Definition at line 539 of file view.h.

References m_layers.

◆ SetLayerHasNegatives()

void KIGFX::VIEW::SetLayerHasNegatives ( int aLayer,
bool aNegatives = true )
inline

Set the status of negatives presense in a particular layer.

Parameters
aLayeris the layer to set as containing negatives (or not).
aNegativesis the layer negatives state.

Definition at line 516 of file view.h.

References KIGFX::VIEW::VIEW_LAYER::hasNegatives, layerStateChanged(), m_layers, MarkTargetDirty(), and KIGFX::VIEW::VIEW_LAYER::target.

Referenced by GERBVIEW_FRAME::unarchiveFiles().

◆ SetLayerOrder()

void KIGFX::VIEW::SetLayerOrder ( int aLayer,
int aRenderingOrder,
bool aAutoSort = true )

Set rendering order of a particular layer.

Lower values are rendered first.

Parameters
aLayeris the layer.
aRenderingOrderis an arbitrary number denoting the rendering order.
aAutoSortset to false to avoid sorting. In that case, call SortOrderedLayers() after setting all layer orders.

Definition at line 1031 of file view.cpp.

References m_layers, and SortOrderedLayers().

Referenced by ApplyPcbGalLayerOrder().

◆ SetLayerTarget()

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

Change the rendering target for a particular layer.

Parameters
aLayeris the layer.
aTargetis the rendering target.

Definition at line 555 of file view.h.

References m_layerCachesStale, m_layers, MarkGeometryDirty(), MarkStaticDirty(), MarkTargetDirty(), and KIGFX::VIEW::VIEW_LAYER::target.

Referenced by BOARD_PRINTOUT::setupViewLayers(), and GERBVIEW_FRAME::UpdateXORLayers().

◆ SetLayerVisible()

◆ SetMirror()

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

Control the mirroring of the VIEW.

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

Definition at line 888 of file view.cpp.

References _, m_gal, m_mirrorX, m_mirrorY, and MarkDirty().

Referenced by GERBVIEW_CONTROL::DisplayControl(), PCB_BASE_FRAME::SetDisplayOptions(), and SetGAL().

◆ SetPainter()

void KIGFX::VIEW::SetPainter ( PAINTER * aPainter)
inline

Set the painter object used by the view for drawing VIEW_ITEM objects.

Definition at line 232 of file view.h.

References m_painter.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ SetRequired()

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

Mark 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 573 of file view.cpp.

References layerStateChanged(), and m_layers.

Referenced by operator=().

◆ SetScale()

◆ SetScaleLimits()

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

Set minimum and maximum values for scale.

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

Definition at line 347 of file view.h.

References m_maxScale, and m_minScale.

◆ SetTopLayer()

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

Set 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.
aLayeris the layer or -1 in case when no particular layer should be displayed on the top.

Definition at line 1248 of file view.cpp.

References m_enableOrderModifier, m_layers, m_topLayers, and TOP_LAYER_MODIFIER.

Referenced by DIALOG_PAD_PROPERTIES::redraw(), BOARD_PRINTOUT::setupViewLayers(), and PCBNEW_PRINTOUT::setupViewLayers().

◆ SetViewport()

◆ SetVisible()

◆ ShowPreview()

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

Definition at line 2755 of file view.cpp.

References m_preview, and SetVisible().

Referenced by ROUTER_TOOL::InlineDrag(), and ROUTER_TOOL::performDragging().

◆ SortLayers()

void KIGFX::VIEW::SortLayers ( std::vector< int > & aLayers) const

Change 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.

Definition at line 1046 of file view.cpp.

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

◆ SortOrderedLayers()

void KIGFX::VIEW::SortOrderedLayers ( )

Sorts m_orderedLayers after layer rendering order has changed.

Must be called after calling SetLayerOrder with aAutoSort = false

Definition at line 1979 of file view.cpp.

References compareRenderingOrder(), m_layers, m_orderedLayers, m_sceneLayersStale, and MarkDirty().

Referenced by ApplyPcbGalLayerOrder(), ReorderLayerData(), SetLayerOrder(), UpdateAllLayersOrder(), and VIEW().

◆ SyncLayerVisibilityCache()

◆ SyncRetainedScene()

void KIGFX::VIEW::SyncRetainedScene ( )

Bring a retained scene up to date with the view scale and layer state, and place again the items whose level of detail reads a layer that was shown or hidden.

Called before every paint.

Definition at line 626 of file view.cpp.

References areRequiredLayersEnabled(), KIGFX::COLOR4D::BLACK, KIGFX::GAL_UPDATE_CONTEXT::IsUpdating(), m_gal, m_layers, m_lodReads, m_lodRefreshLayers, m_painter, m_scale, m_sceneLayersStale, m_useDrawPriority, placeCachedGroup(), BOX2< Vec >::SetMaximum(), SyncLayerVisibilityCache(), KIGFX::TARGET_CACHED, VIEW_ITEM, and VIEW_MAX_LAYERS.

Referenced by redrawRect().

◆ ToScreen() [1/2]

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

Convert a world space point/vector to a point/vector in screen space coordinates.

Parameters
aCoordis the point/vector to be converted.
aAbsolutewhen true aCoord is treated as a point, otherwise as a direction (vector).

Definition at line 810 of file view.cpp.

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

Referenced by SetScale().

◆ ToScreen() [2/2]

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

Convert a world space one dimensional size to a one dimensional size in screen space.

Parameters
aSizethe size to be transformed.

Definition at line 821 of file view.cpp.

References MATRIX3x3< T >::GetScale(), m_gal, and VECTOR2< T >::x.

◆ ToWorld() [1/2]

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

◆ ToWorld() [2/2]

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

Converts a screen space one dimensional size to a one dimensional size in world space coordinates.

Parameters
aSizeis the size to be converted.

Definition at line 802 of file view.cpp.

References MATRIX3x3< T >::GetScale(), m_gal, and VECTOR2< T >::x.

◆ unlinkItem()

void KIGFX::VIEW::unlinkItem ( VIEW_ITEM * aItem)
protected

Detach a single VIEW_ITEM from this view.

Child items are left alone. Composite-aware traversal belongs to the Add() and Remove() overrides that know about the item hierarchy, so callers that have already handled the children use this instead of Remove().

Parameters
aItemis the item to detach. It is ignored if it belongs to a different view.

Definition at line 494 of file view.cpp.

References KIGFX::VIEW_ITEM_DATA::clearUpdateFlags(), KIGFX::VIEW_ITEM_DATA::deleteGroups(), KIGFX::VIEW_ITEM_DATA::getGroup(), KIGFX::VIEW::VIEW_LAYER::items, m_allItems, KIGFX::VIEW_ITEM_DATA::m_bbox, KIGFX::VIEW_ITEM_DATA::m_cachedIndex, m_gal, m_layers, KIGFX::VIEW_ITEM_DATA::m_layers, KIGFX::VIEW_ITEM_DATA::m_pendingIndex, m_pendingItems, KIGFX::VIEW_ITEM_DATA::m_view, KIGFX::VIEW_ITEM::m_viewPrivData, markSceneEdited(), MarkTargetDirty(), KIGFX::VIEW::VIEW_LAYER::target, and VIEW_ITEM.

Referenced by OnDestroy(), and Remove().

◆ Update() [1/2]

void KIGFX::VIEW::Update ( const VIEW_ITEM * aItem) const
virtual

Reimplemented in KIGFX::PCB_VIEW, and KIGFX::SCH_VIEW.

Definition at line 2625 of file view.cpp.

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

◆ Update() [2/2]

void KIGFX::VIEW::Update ( const VIEW_ITEM * aItem,
int aUpdateFlags ) const
virtual

For dynamic VIEWs, inform 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, and KIGFX::SCH_VIEW.

Definition at line 2631 of file view.cpp.

References m_hasPendingItemUpdates, KIGFX::VIEW_ITEM_DATA::m_pendingIndex, m_pendingItems, m_pendingListIncomplete, KIGFX::VIEW_ITEM_DATA::m_requiredUpdate, KIGFX::VIEW_ITEM_DATA::m_view, KIGFX::NONE, VIEW_ITEM, and KIGFX::VIEW_ITEM::viewPrivData().

Referenced by Add(), AddBatch(), AddToPreview(), DRC_INTERACTIVE_COURTYARD_CLEARANCE::ClearConflicts(), ClearPreview(), PL_SELECTION_TOOL::ClearSelection(), SCH_SELECTION_TOOL::ClearSelection(), draw(), PL_DRAWING_TOOLS::DrawShape(), SCH_SELECTION_TOOL::EnterGroup(), PAD_TOOL::EnumeratePads(), SCH_SELECTION_TOOL::ExitGroup(), EE_GRID_HELPER::GetGrid(), Hide(), PL_SELECTION_TOOL::highlight(), SCH_SELECTION_TOOL::highlight(), DIALOG_CREATE_NET_CHAIN::highlightChainNets(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PL_EDIT_TOOL::moveItem(), PCB_EDIT_FRAME::OnBoardLoaded(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_DIFF_WIDGET::onSlider(), operator=(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), DIALOG_PAD_PROPERTIES::redraw(), PCB_EDIT_FRAME::redrawNetnames(), RefreshDrillMapOutlines(), PCB_EDIT_FRAME::RefreshDrillSymbols(), DIALOG_BARCODE_PROPERTIES::refreshPreview(), PCB_CONTROL::rehatchBoardItem(), CONSTRAINT_EDIT_TOOL::repaintShadowItems(), SCH_SELECTION_TOOL::SelectConnection(), SCH_SELECTION_TOOL::selectLasso(), SCH_SELECTION_TOOL::SelectMultiple(), PL_SELECTION_TOOL::selectMultiple(), SCH_SELECTION_TOOL::selectMultiple(), SCH_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::SelectPolyArea(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), PCB_EDIT_FRAME::SetPageSettings(), SetVisible(), PL_SELECTION_TOOL::unhighlight(), SCH_SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselectVisually(), KIGFX::PCB_VIEW::Update(), KIGFX::SCH_VIEW::Update(), Update(), DRC_INTERACTIVE_COURTYARD_CLEARANCE::UpdateConflicts(), PCB_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), PCB_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), SCH_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), SCH_SELECTION_TOOL::updateSelection(), and BOARD::UpdateUserUnits().

◆ UpdateAllItems()

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

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

Parameters
aUpdateFlagsis is according to KIGFX::VIEW_UPDATE_FLAGS

Definition at line 2475 of file view.cpp.

References m_allItems, m_hasPendingItemUpdates, m_pendingListIncomplete, KIGFX::NONE, and VIEW_ITEM.

Referenced by GERBVIEW_FRAME::CommonSettingsChanged(), PCB_BASE_FRAME::CommonSettingsChanged(), PL_EDITOR_FRAME::CommonSettingsChanged(), SCH_BASE_FRAME::CommonSettingsChanged(), SYMBOL_EDIT_FRAME::CommonSettingsChanged(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), GERBVIEW_CONTROL::DisplayControl(), SCH_BASE_FRAME::HardRedraw(), SCH_EDIT_FRAME::HardRedraw(), GERBVIEW_CONTROL::HighlightControl(), PCB_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::KiwayMailIn(), SYMBOL_VIEWER_FRAME::KiwayMailIn(), SYMBOL_EDIT_FRAME::LoadOneLibrarySymbol(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), GERBVIEW_FRAME::OnSelectActiveDCode(), GERBVIEW_FRAME::OnSelectActiveLayer(), SYMBOL_EDIT_FRAME::RebuildView(), FOOTPRINT_PREVIEW_PANEL::RefreshAll(), GERBVIEW_CONTROL::ReloadAllLayers(), GERBVIEW_FRAME::RemapLayers(), SetGAL(), GERBVIEW_FRAME::SetLayerDrawPrms(), SYMBOL_EDIT_FRAME::ShowChangedLanguage(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SCH_BASE_FRAME::SyncView(), COMMON_TOOLS::ToggleBoundingBoxes(), SCH_EDITOR_CONTROL::ToggleDirectiveLabels(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SYMBOL_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SYMBOL_EDITOR_CONTROL::ToggleHiddenPins(), SCH_EDITOR_CONTROL::TogglePinAltIcons(), SYMBOL_EDITOR_CONTROL::TogglePinAltIcons(), PANEL_EESCHEMA_COLOR_SETTINGS::updatePreview(), PANEL_PCBNEW_COLOR_SETTINGS::updatePreview(), and GERBVIEW_FRAME::UpdateXORLayers().

◆ UpdateAllItemsConditionally() [1/2]

◆ UpdateAllItemsConditionally() [2/2]

void KIGFX::VIEW::UpdateAllItemsConditionally ( std::function< int(VIEW_ITEM *)> aItemFlagsProvider)

Update items in the view according to the flags returned by the callback.

Parameters
aItemFlagsProvideris a function returning any KIGFX::VIEW_UPDATE_FLAGS that should be set on the VIEW_ITEM.

Definition at line 2516 of file view.cpp.

References m_allItems, m_hasPendingItemUpdates, m_pendingListIncomplete, KIGFX::NONE, and VIEW_ITEM.

◆ UpdateAllLayersColor()

◆ UpdateAllLayersColorAndVisibility()

void KIGFX::VIEW::UpdateAllLayersColorAndVisibility ( )

Apply the new coloring scheme to all layers after a render settings change that can also hide items, such as high contrast.

A retained scene does not ask items for their level of detail each frame, so this also places every cached group again.

Definition at line 1178 of file view.cpp.

References m_gal, and recolorAllLayers().

◆ UpdateAllLayersOrder()

void KIGFX::VIEW::UpdateAllLayersOrder ( )

Do 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 1315 of file view.cpp.

References KIGFX::VIEW_ITEM_DATA::getGroup(), group, KIGFX::GAL_UPDATE_CONTEXT::IsUpdating(), m_allItems, m_gal, m_layers, KIGFX::VIEW_ITEM_DATA::m_layers, MarkDirty(), SortOrderedLayers(), and VIEW_ITEM.

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

◆ updateBbox()

◆ updateItemColor()

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

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

Definition at line 2018 of file view.cpp.

References KIGFX::VIEW_ITEM_DATA::getGroup(), group, IsCached(), recolorGroup(), VIEW_ITEM, and KIGFX::VIEW_ITEM::viewPrivData().

Referenced by invalidateItem().

◆ updateItemGeometry()

◆ UpdateItems()

◆ UpdateLayerColor()

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

Apply 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 1127 of file view.cpp.

References group, IsCached(), KIGFX::GAL_UPDATE_CONTEXT::IsUpdating(), m_gal, m_layers, m_sceneLayersStale, MarkGeometryDirty(), MarkStaticDirty(), MarkTargetDirty(), recolorGroup(), BOX2< Vec >::SetMaximum(), and VIEW_ITEM.

Referenced by APPEARANCE_CONTROLS::OnColorSwatchChanged(), and GERBER_LAYER_WIDGET::OnLayerColorChange().

◆ updateLayers()

◆ UpdateLayersColor()

void KIGFX::VIEW::UpdateLayersColor ( bool aVisibility,
const std::function< bool(int)> & aLayers )

Recolor only the layers aLayers accepts, along with the fade the canvas may apply to them.

Parameters
aVisibilityalso places groups again, as UpdateAllLayersColorAndVisibility() does.

Definition at line 1184 of file view.cpp.

References m_gal, and recolorAllLayers().

◆ UseDrawPriority()

void KIGFX::VIEW::UseDrawPriority ( bool aFlag)
inline
Parameters
aFlagis true if draw priority should be respected while redrawing.

Definition at line 867 of file view.h.

References m_useDrawPriority.

Friends And Related Symbol Documentation

◆ VIEW_ITEM

Member Data Documentation

◆ m_allItems

◆ m_boundary

BOX2D KIGFX::VIEW::m_boundary
protected

◆ m_cameraDirtyOnly

bool KIGFX::VIEW::m_cameraDirtyOnly
protected

The current dirty state is due only to camera changes.

Definition at line 1205 of file view.h.

Referenced by DataReference(), IsCameraDirtyOnly(), MarkClean(), MarkDirty(), MarkGeometryDirty(), markSceneEdited(), MarkViewportDirty(), RepaintLayers(), rescaleKeptTargets(), and VIEW().

◆ m_center

VECTOR2D KIGFX::VIEW::m_center
protected

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

Definition at line 1088 of file view.h.

Referenced by GetCenter(), SetCenter(), SetGAL(), and SetScale().

◆ m_deferredRetainedPlacements

std::vector<std::pair<VIEW_ITEM*, int> > KIGFX::VIEW::m_deferredRetainedPlacements
protected

Definition at line 1138 of file view.h.

Referenced by placeCachedGroup(), and UpdateItems().

◆ m_deferRetainedPlacement

bool KIGFX::VIEW::m_deferRetainedPlacement = false
protected

Definition at line 1137 of file view.h.

Referenced by placeCachedGroup(), updateItemGeometry(), and UpdateItems().

◆ m_dirtyTargets

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

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

Definition at line 1112 of file view.h.

Referenced by ClearTargets(), IsTargetDirty(), MarkClean(), MarkDirty(), markTargetClean(), MarkTargetDirty(), and MarkViewportDirty().

◆ m_enableOrderModifier

bool KIGFX::VIEW::m_enableOrderModifier
protected

Whether to use rendering order modifier or not.

Definition at line 1073 of file view.h.

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

◆ m_gal

◆ m_hasPendingItemUpdates

bool KIGFX::VIEW::m_hasPendingItemUpdates
mutableprotected

True when at least one item has deferred update flags that still need processing.

Definition at line 1130 of file view.h.

Referenced by DataReference(), HasPendingItemUpdates(), ReorderLayerData(), Update(), UpdateAllItems(), UpdateAllItemsConditionally(), UpdateAllItemsConditionally(), UpdateItems(), and VIEW().

◆ m_keptScaleUse

SCALE_USE* KIGFX::VIEW::m_keptScaleUse = nullptr
protected

The SCALE_USE of the kept target being drawn, updated by each level of detail drawn.

Definition at line 1172 of file view.h.

Referenced by noteKeptLod(), and redrawRect().

◆ m_layerCachedFlagCache

BASE_SET KIGFX::VIEW::m_layerCachedFlagCache
protected

Definition at line 1098 of file view.h.

Referenced by draw(), SyncLayerVisibilityCache(), and VIEW().

◆ m_layerCachesStale

bool KIGFX::VIEW::m_layerCachesStale = true
protected

A layer's visibility or target changed since SyncLayerVisibilityCache() last copied them.

Definition at line 1103 of file view.h.

Referenced by ReorderLayerData(), SetLayerTarget(), SetLayerVisible(), and SyncLayerVisibilityCache().

◆ m_layers

◆ m_layerVisibilityCache

BASE_SET KIGFX::VIEW::m_layerVisibilityCache
protected

Definition at line 1097 of file view.h.

Referenced by IsLayerVisibleCached(), SyncLayerVisibilityCache(), and VIEW().

◆ m_lodProbeLayer

int KIGFX::VIEW::m_lodProbeLayer = -1
mutableprotected

Cached layer being placed while an item is asked for its level of detail, else -1.

Definition at line 1189 of file view.h.

Referenced by cachedGroupLOD(), IsLayerVisible(), IsLayerVisibleCached(), and noteLodRead().

◆ m_lodReads

std::unordered_map<int, std::vector<bool> > KIGFX::VIEW::m_lodReads
mutableprotected

For each layer whose visibility an item asked about, the cached layers those items were placed on.

Recorded on every placement so item types that first appear later extend it.

Definition at line 1195 of file view.h.

Referenced by noteLodRead(), and SyncRetainedScene().

◆ m_lodRefreshLayers

std::vector<int> KIGFX::VIEW::m_lodRefreshLayers
protected

Layers shown or hidden since the last sync, whose readers have to be placed again.

Definition at line 1184 of file view.h.

Referenced by layerStateChanged(), and SyncRetainedScene().

◆ m_maxScale

double KIGFX::VIEW::m_maxScale
protected

Definition at line 1093 of file view.h.

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

◆ m_minScale

double KIGFX::VIEW::m_minScale
protected

Definition at line 1092 of file view.h.

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

◆ m_mirrorX

bool KIGFX::VIEW::m_mirrorX
protected

Definition at line 1095 of file view.h.

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

◆ m_mirrorY

bool KIGFX::VIEW::m_mirrorY
protected

Definition at line 1096 of file view.h.

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

◆ m_nextDrawPriority

int KIGFX::VIEW::m_nextDrawPriority
protected

The next sequential drawing priority.

Definition at line 1124 of file view.h.

Referenced by Add(), AddBatch(), Clear(), and VIEW().

◆ m_orderedLayers

std::vector<VIEW_LAYER*> KIGFX::VIEW::m_orderedLayers
protected

Sorted list of pointers to members of m_layers.

Definition at line 1079 of file view.h.

Referenced by Query(), Query(), redrawRect(), RepaintLayers(), and SortOrderedLayers().

◆ m_ownedItems

std::vector<VIEW_ITEM*> KIGFX::VIEW::m_ownedItems
protected

Definition at line 1070 of file view.h.

Referenced by AddToPreview(), and ClearPreview().

◆ m_painter

PAINTER* KIGFX::VIEW::m_painter
protected

PAINTER contains information how do draw items.

Definition at line 1106 of file view.h.

Referenced by draw(), GetPainter(), markDimExemption(), recolorGroup(), SetPainter(), SyncRetainedScene(), updateItemGeometry(), and VIEW().

◆ m_pendingItems

std::vector<VIEW_ITEM*> KIGFX::VIEW::m_pendingItems
mutableprotected

Items flagged through Update() since the last UpdateItems(), so a frame that changed a few items need not visit all of them.

Entries of unlinked items are null.

Definition at line 1136 of file view.h.

Referenced by clearPendingItems(), unlinkItem(), Update(), and UpdateItems().

◆ m_pendingListIncomplete

bool KIGFX::VIEW::m_pendingListIncomplete = false
mutableprotected

Items were flagged without being listed, so UpdateItems() has to scan them all.

Definition at line 1149 of file view.h.

Referenced by ReorderLayerData(), Update(), UpdateAllItems(), UpdateAllItemsConditionally(), UpdateAllItemsConditionally(), and UpdateItems().

◆ m_preview

std::unique_ptr<KIGFX::VIEW_GROUP> KIGFX::VIEW::m_preview
protected

◆ m_replacedRetainedGroups

std::map<std::pair<VIEW_ITEM*, int>, int> KIGFX::VIEW::m_replacedRetainedGroups
protected

Groups replaced by items redrawn during a deferred placement.

Each stays in the scene until its item is placed so the new group takes the old slot and the scene keeps its draw order.

Definition at line 1144 of file view.h.

Referenced by releaseReplacedGroup(), releaseReplacedGroups(), and updateItemGeometry().

◆ m_reverseDrawOrder

bool KIGFX::VIEW::m_reverseDrawOrder
protected

Flag to reverse the draw order when using draw priority.

Definition at line 1127 of file view.h.

Referenced by placeCachedGroup(), placeRetainedInOrder(), redrawRect(), ReverseDrawOrder(), UpdateItems(), and VIEW().

◆ m_scale

◆ m_scaleRead

bool KIGFX::VIEW::m_scaleRead = false
mutableprotected

GetScale() was called, see SCALE_USE::read.

Definition at line 1167 of file view.h.

Referenced by GetScale(), and redrawRect().

◆ m_scaleUse

SCALE_USE KIGFX::VIEW::m_scaleUse[TARGETS_NUMBER]
protected

Definition at line 1166 of file view.h.

Referenced by redrawRect(), and rescaleKeptTargets().

◆ m_sceneLayersStale

bool KIGFX::VIEW::m_sceneLayersStale = true
protected

A layer's order, visibility, required layers or negatives changed since the last sync.

Definition at line 1154 of file view.h.

Referenced by layerStateChanged(), MarkStaticDirty(), recolorAllLayers(), SetGAL(), SortOrderedLayers(), SyncRetainedScene(), and UpdateLayerColor().

◆ m_targetEdited

bool KIGFX::VIEW::m_targetEdited[TARGETS_NUMBER] = {}
protected

The target's content changed, not just the camera.

A backend that keeps a target between frames emits it again only then.

Definition at line 1118 of file view.h.

Referenced by ClearTargets(), MarkClean(), MarkDirty(), markTargetClean(), and MarkTargetDirty().

◆ m_topLayers

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

The set of layers that are displayed on the top.

Definition at line 1085 of file view.h.

Referenced by ClearTopLayers(), EnableTopLayer(), GetTopLayer(), and SetTopLayer().

◆ m_useDrawPriority

bool KIGFX::VIEW::m_useDrawPriority
protected

◆ TOP_LAYER_MODIFIER

int KIGFX::VIEW::TOP_LAYER_MODIFIER = -MAX_LAYERS_FOR_VIEW
staticconstexpr

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

Definition at line 902 of file view.h.

Referenced by ApplyPcbGalLayerOrder(), ClearTopLayers(), EnableTopLayer(), and SetTopLayer().

◆ VIEW_MAX_LAYERS


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