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 Cleanup ()
 
void DisplaySheet (SCH_SHEET *aSheet)
 
void DisplaySheet (SCH_SCREEN *aScreen)
 
void DisplayComponent (LIB_PART *aPart)
 
void ResizeSheetWorkingArea (SCH_SCREEN *aScreen)
 
void SetScale (double aScale, VECTOR2D aAnchor={ 0, 0 }) override
 Function SetScale() Sets the scaling factor, zooming around a given anchor point. More...
 
const BOX2I GetItemsExtents () const override
 Return BBox of all items on screen except page and border. More...
 
void ClearHiddenFlags ()
 Clear the hide flag of all items in the view. More...
 
void HideWorksheet ()
 
WS_PROXY_VIEW_ITEMGetWorksheet () const
 
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 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 ()
 
void InitPreview ()
 
void ClearPreview ()
 
void AddToPreview (EDA_ITEM *aItem, bool aTakeOwnership=true)
 
void ShowPreview (bool aShow=true)
 
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 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

std::unique_ptr< KIGFX::VIEW_GROUPm_preview
 
std::vector< EDA_ITEM * > m_ownedItems
 
bool m_enableOrderModifier
 
std::vector< VIEW_LAYERm_layers
 Contains set of possible displayed layers and its properties. More...
 
std::vector< VIEW_LAYER * > m_orderedLayers
 Sorted list of pointers to members of m_layers. More...
 
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
 Flat list of all items. 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
 

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.

Constructor & Destructor Documentation

◆ SCH_VIEW()

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

Definition at line 46 of file sch_view.cpp.

46  :
47  VIEW( aIsDynamic )
48 {
49  m_frame = aFrame;
50  // Set m_boundary to define the max working area size. The default value
51  // is acceptable for Pcbnew and Gerbview, but too large for Eeschema due to
52  // very different internal units.
53  // So we have to use a smaller value.
54  // A full size = 3 * MAX_PAGE_SIZE_MILS size allows a wide margin
55  // around the worksheet.
56  double max_size = Mils2iu( MAX_PAGE_SIZE_MILS ) * 3.0;
57  m_boundary.SetOrigin( -max_size/4, -max_size/4 );
58  m_boundary.SetSize( max_size, max_size );
59 }
void SetSize(const Vec &size)
Definition: box2.h:212
BOX2D m_boundary
View boundaries.
Definition: view.h:822
void SetOrigin(const Vec &pos)
Definition: box2.h:210
SCH_BASE_FRAME * m_frame
Definition: sch_view.h:107
#define MAX_PAGE_SIZE_MILS
Definition: page_info.h:41
VIEW(bool aIsDynamic=true)
Constructor.
Definition: view.cpp:286

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

◆ ~SCH_VIEW()

KIGFX::SCH_VIEW::~SCH_VIEW ( )

Definition at line 62 of file sch_view.cpp.

63 {
64 }

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

346 {
347  int layers[VIEW_MAX_LAYERS], layers_count;
348 
349  if( aDrawPriority < 0 )
350  aDrawPriority = m_nextDrawPriority++;
351 
352  if( !aItem->m_viewPrivData )
353  aItem->m_viewPrivData = new VIEW_ITEM_DATA;
354 
355  aItem->m_viewPrivData->m_view = this;
356  aItem->m_viewPrivData->m_drawPriority = aDrawPriority;
357 
358  aItem->ViewGetLayers( layers, layers_count );
359  aItem->viewPrivData()->saveLayers( layers, layers_count );
360 
361  m_allItems->push_back( aItem );
362 
363  for( int i = 0; i < layers_count; ++i )
364  {
365  VIEW_LAYER& l = m_layers[layers[i]];
366  l.items->Insert( aItem );
367  MarkTargetDirty( l.target );
368  }
369 
370  SetVisible( aItem, true );
371  Update( aItem, KIGFX::INITIAL_ADD );
372 }
Layers have changed.
Definition: view_item.h:61
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:697
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:810
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:574
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:1531
int m_nextDrawPriority
The next sequential drawing priority.
Definition: view.h:857
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1477

References 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(), PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems(), 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(), EE_GRID_HELPER::EE_GRID_HELPER(), GRID_HELPER::GRID_HELPER(), KIGFX::VIEW::InitPreview(), 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(), KIGFX::VIEW::VIEW(), and ZONE_CREATE_HELPER::ZONE_CREATE_HELPER().

◆ AddToPreview()

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

Definition at line 1572 of file view.cpp.

1573 {
1574  Hide( aItem, false );
1575  m_preview->Add( aItem );
1576 
1577  if( aTakeOwnership )
1578  m_ownedItems.push_back( aItem );
1579 
1580  SetVisible( m_preview.get(), true );
1581  Hide( m_preview.get(), false );
1582  Update( m_preview.get() );
1583 }
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hides the item in the view (e.g.
Definition: view.cpp:1498
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: view.h:718
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:1531
std::vector< EDA_ITEM * > m_ownedItems
Definition: view.h:721
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1477

References KIGFX::VIEW::Hide(), KIGFX::VIEW::m_ownedItems, KIGFX::VIEW::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(), ROUTER_TOOL::InlineDrag(), 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 1377 of file view.cpp.

1378 {
1379  wxCHECK( (unsigned) aLayerId < m_layers.size(), false );
1380 
1381  std::set<int>::const_iterator it, it_end;
1382 
1383  for( it = m_layers.at( aLayerId ).requiredLayers.begin(),
1384  it_end = m_layers.at( aLayerId ).requiredLayers.end(); it != it_end; ++it )
1385  {
1386  // That is enough if just one layer is not enabled
1387  if( !m_layers.at( *it ).visible || !areRequiredLayersEnabled( *it ) )
1388  return false;
1389  }
1390 
1391  return true;
1392 }
bool areRequiredLayersEnabled(int aLayerId) const
Checks if every layer required by the aLayerId layer is enabled.
Definition: view.cpp:1377
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804

References KIGFX::VIEW::m_layers.

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

◆ Cleanup()

void KIGFX::SCH_VIEW::Cleanup ( )

Definition at line 66 of file sch_view.cpp.

67 {
68  Clear();
69  m_worksheet.reset();
70  m_preview.reset();
71 }
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: view.h:718
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1107
std::unique_ptr< WS_PROXY_VIEW_ITEM > m_worksheet
Definition: sch_view.h:110

References KIGFX::VIEW::Clear(), KIGFX::VIEW::m_preview, and m_worksheet.

Referenced by SCH_DRAW_PANEL::DisplaySheet().

◆ Clear()

void KIGFX::VIEW::Clear ( )
inherited

Function Clear() Removes all items from the view.

Definition at line 1107 of file view.cpp.

1108 {
1109  BOX2I r;
1110  r.SetMaximum();
1111  m_allItems->clear();
1112 
1113  for( VIEW_LAYER& layer : m_layers )
1114  layer.items->RemoveAll();
1115 
1116  m_nextDrawPriority = 0;
1117 
1118  m_gal->ClearCache();
1119 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:810
void SetMaximum()
Definition: box2.h:73
int m_nextDrawPriority
The next sequential drawing priority.
Definition: view.h:857
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804
virtual void ClearCache()
Delete all data created during caching of graphic items.

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

Referenced by Cleanup(), GERBVIEW_FRAME::Clear_DrawLayers(), PCB_DRAW_PANEL_GAL::DisplayBoard(), SCH_DRAW_PANEL::DisplayComponent(), DisplayComponent(), SCH_DRAW_PANEL::DisplaySheet(), PL_DRAW_PANEL_GAL::DisplayWorksheet(), GERBVIEW_FRAME::doCloseWindow(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), 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_PREVIEW_PANEL::~FOOTPRINT_PREVIEW_PANEL(), FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME(), GERBVIEW_FRAME::~GERBVIEW_FRAME(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

◆ clearGroupCache()

void KIGFX::VIEW::clearGroupCache ( )
protectedinherited

Definition at line 1197 of file view.cpp.

1198 {
1199  BOX2I r;
1200 
1201  r.SetMaximum();
1202  clearLayerCache visitor( this );
1203 
1204  for( VIEW_LAYER& layer : m_layers )
1205  layer.items->Query( r, visitor );
1206 }
void SetMaximum()
Definition: box2.h:73
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804

References 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 201 of file sch_view.cpp.

202 {
203  for( auto item : *m_allItems )
204  Hide( item, false );
205 }
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hides the item in the view (e.g.
Definition: view.cpp:1498
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:810

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

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

◆ ClearPreview()

void KIGFX::VIEW::ClearPreview ( )
inherited

Definition at line 1553 of file view.cpp.

1554 {
1555  m_preview->Clear();
1556 
1557  for( EDA_ITEM* item : m_ownedItems )
1558  delete item;
1559 
1560  m_ownedItems.clear();
1561  Update( m_preview.get() );
1562 }
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: view.h:718
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:1531
std::vector< EDA_ITEM * > m_ownedItems
Definition: view.h:721
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

References KIGFX::VIEW::m_ownedItems, KIGFX::VIEW::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(), ROUTER_TOOL::InlineDrag(), 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 1122 of file view.cpp.

1123 {
1125  {
1126  // TARGET_CACHED and TARGET_NONCACHED have to be redrawn together, as they contain
1127  // layers that rely on each other (eg. netnames are noncached, but tracks - are cached)
1130 
1131  MarkDirty();
1132  }
1133 
1134  if( IsTargetDirty( TARGET_OVERLAY ) )
1135  {
1137  }
1138 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
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:563
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:599

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::DoRePaint().

◆ 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 908 of file view.cpp.

909 {
910  std::set<unsigned int>::iterator it;
911 
913  {
914  // Restore the previous rendering order for layers that were marked as top
915  for( it = m_topLayers.begin(); it != m_topLayers.end(); ++it )
916  m_layers[*it].renderingOrder -= TOP_LAYER_MODIFIER;
917  }
918 
919  m_topLayers.clear();
920 }
static const int TOP_LAYER_MODIFIER
Rendering order modifier for layers that are marked as top layers.
Definition: view.h:850
std::set< unsigned int > m_topLayers
Stores set of layers that are displayed on the top.
Definition: view.h:813
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804
bool m_enableOrderModifier
Definition: view.h:801

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

793  {
794  return aI->renderingOrder > aJ->renderingOrder;
795  }

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

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

◆ 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 1467 of file view.cpp.

1468 {
1469  auto ret = std::make_unique<VIEW>();
1470  ret->m_allItems = m_allItems;
1471  ret->m_layers = m_layers;
1472  ret->sortLayers();
1473  return ret;
1474 }
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:810
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804

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 151 of file sch_view.cpp.

152 {
153  Clear();
154 
155  if( !aPart )
156  return;
157 
158  std::shared_ptr< LIB_PART > parent;
159  LIB_PART* drawnPart = aPart;
160 
161  // Draw the mandatory fields for aliases and parent symbols.
162  for( auto& item : aPart->GetDrawItems() )
163  {
164  if( item.Type() != LIB_FIELD_T )
165  continue;
166 
167  LIB_FIELD* field = static_cast< LIB_FIELD* >( &item );
168 
169  wxCHECK2( field, continue );
170 
171  if( field->GetText().IsEmpty() )
172  continue;
173 
174  Add( &item );
175  }
176 
177  // Draw the parent items if the symbol is inherited from another symbol.
178  if( aPart->IsAlias() )
179  {
180  parent = aPart->GetParent().lock();
181 
182  wxCHECK( parent, /* void */ );
183 
184  drawnPart = parent.get();
185  }
186 
187  for( auto& item : drawnPart->GetDrawItems() )
188  {
189  // Don't show parent symbol fields. Users may be confused by shown fields that can not
190  // be edited.
191  if( aPart->IsAlias() && item.Type() == LIB_FIELD_T )
192  continue;
193 
194  Add( &item );
195  }
196 
197  InitPreview();
198 }
Field object used in symbol libraries.
Definition: lib_field.h:59
void InitPreview()
Definition: view.cpp:1565
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1107
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
PART_REF & GetParent()
Define a library symbol object.
bool IsAlias() const
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:345
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:127

References KIGFX::VIEW::Add(), KIGFX::VIEW::Clear(), LIB_PART::GetDrawItems(), LIB_PART::GetParent(), EDA_TEXT::GetText(), KIGFX::VIEW::InitPreview(), LIB_PART::IsAlias(), and LIB_FIELD_T.

Referenced by SCH_DRAW_PANEL::DisplayComponent().

◆ DisplaySheet() [1/2]

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

Definition at line 145 of file sch_view.cpp.

146 {
147  DisplaySheet( aSheet->GetScreen() );
148 }
void DisplaySheet(SCH_SHEET *aSheet)
Definition: sch_view.cpp:145
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:282

References SCH_SHEET::GetScreen().

Referenced by SCH_DRAW_PANEL::DisplaySheet().

◆ DisplaySheet() [2/2]

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

Definition at line 117 of file sch_view.cpp.

118 {
119  for( auto item : aScreen->Items() )
120  Add( item );
121 
122  m_worksheet.reset( new KIGFX::WS_PROXY_VIEW_ITEM( static_cast< int >( IU_PER_MILS ),
123  &aScreen->GetPageSettings(),
124  &aScreen->Schematic()->Prj(),
125  &aScreen->GetTitleBlock() ) );
126  m_worksheet->SetSheetNumber( aScreen->m_ScreenNumber );
127  m_worksheet->SetSheetCount( aScreen->m_NumberOfScreens );
128  m_worksheet->SetFileName( TO_UTF8( aScreen->GetFileName() ) );
129  m_worksheet->SetColorLayer( LAYER_SCHEMATIC_WORKSHEET );
130  m_worksheet->SetPageBorderColorLayer( LAYER_SCHEMATIC_GRID );
131 
132  if( m_frame && m_frame->IsType( FRAME_SCH ) )
133  m_worksheet->SetSheetName( TO_UTF8( m_frame->GetScreenDesc() ) );
134  else
135  m_worksheet->SetSheetName( "" );
136 
137  ResizeSheetWorkingArea( aScreen );
138 
139  Add( m_worksheet.get() );
140 
141  InitPreview();
142 }
const wxString & GetFileName() const
Definition: sch_screen.h:185
int m_ScreenNumber
Definition: base_screen.h:79
void ResizeSheetWorkingArea(SCH_SCREEN *aScreen)
Definition: sch_view.cpp:107
void InitPreview()
Definition: view.cpp:1565
const TITLE_BLOCK & GetTitleBlock() const
Definition: sch_screen.h:190
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:180
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:100
std::unique_ptr< WS_PROXY_VIEW_ITEM > m_worksheet
Definition: sch_view.h:110
bool IsType(FRAME_T aType) const
SCHEMATIC * Schematic() const
Definition: sch_screen.cpp:91
EE_RTREE & Items()
Definition: sch_screen.h:158
PROJECT & Prj() const
Return a reference to the project this schematic is part of.
Definition: schematic.h:77
#define IU_PER_MILS
Definition: plotter.cpp:138
SCH_BASE_FRAME * m_frame
Definition: sch_view.h:107
int m_NumberOfScreens
Definition: base_screen.h:80
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:345
virtual wxString GetScreenDesc() const

References KIGFX::VIEW::Add(), FRAME_SCH, SCH_SCREEN::GetFileName(), SCH_SCREEN::GetPageSettings(), EDA_DRAW_FRAME::GetScreenDesc(), SCH_SCREEN::GetTitleBlock(), KIGFX::VIEW::InitPreview(), EDA_BASE_FRAME::IsType(), SCH_SCREEN::Items(), IU_PER_MILS, LAYER_SCHEMATIC_GRID, LAYER_SCHEMATIC_WORKSHEET, m_frame, BASE_SCREEN::m_NumberOfScreens, BASE_SCREEN::m_ScreenNumber, m_worksheet, SCHEMATIC::Prj(), ResizeSheetWorkingArea(), SCH_SCREEN::Schematic(), 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 1025 of file view.cpp.

1026 {
1027  auto viewData = aItem->viewPrivData();
1028 
1029  if( !viewData )
1030  return;
1031 
1032  if( IsCached( aLayer ) && !aImmediate )
1033  {
1034  // Draw using cached information or create one
1035  int group = viewData->getGroup( aLayer );
1036 
1037  if( group >= 0 )
1038  m_gal->DrawGroup( group );
1039  else
1040  Update( aItem );
1041  }
1042  else
1043  {
1044  // Immediate mode
1045  if( !m_painter->Draw( aItem, aLayer ) )
1046  aItem->ViewDraw( aLayer, this ); // Alternative drawing method
1047  }
1048 }
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:840
PAINTER * m_painter
PAINTER contains information how do draw items.
Definition: view.h:837
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:1531
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:581

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

1052 {
1053  int layers[VIEW_MAX_LAYERS], layers_count;
1054 
1055  aItem->ViewGetLayers( layers, layers_count );
1056 
1057  // Sorting is needed for drawing order dependent GALs (like Cairo)
1058  SortLayers( layers, layers_count );
1059 
1060  for( int i = 0; i < layers_count; ++i )
1061  {
1062  m_gal->SetLayerDepth( m_layers.at( layers[i] ).renderingOrder );
1063  draw( aItem, layers[i], aImmediate );
1064  }
1065 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
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:697
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:677
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:1025

References KIGFX::VIEW::draw(), 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 1068 of file view.cpp.

1069 {
1070  for( unsigned int i = 0; i < aGroup->GetSize(); i++)
1071  draw( aGroup->GetItem(i), aImmediate );
1072 }
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:1025

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

◆ 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 883 of file view.cpp.

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

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:822

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

334  {
335  return m_center;
336  }
VECTOR2D m_center
Center point of the VIEW (the point at which we are looking at)
Definition: view.h:816

References KIGFX::VIEW::m_center.

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

◆ 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:840

References KIGFX::VIEW::m_gal.

Referenced by EE_GRID_HELPER::Align(), GRID_HELPER::BestDragOrigin(), EE_GRID_HELPER::BestDragOrigin(), KIGFX::WX_VIEW_CONTROLS::CenterOnCursor(), COMMON_TOOLS::CursorControl(), PCBNEW_CONTROL::DoSetGridOrigin(), COMMON_TOOLS::doZoomInOut(), 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(), EE_GRID_HELPER::GetGrid(), GRID_HELPER::GetGrid(), EE_GRID_HELPER::GetOrigin(), GRID_HELPER::GetOrigin(), KIGFX::WX_VIEW_CONTROLS::GetRawCursorPosition(), COMMON_TOOLS::OnGridChanged(), COMMON_TOOLS::PanControl(), DIALOG_PAD_PROPERTIES::prepareCanvas(), KIGFX::WX_VIEW_CONTROLS::SetCrossHairCursorPosition(), KIGFX::VIEW_CONTROLS::ShowCursor(), PNS::TOOL_BASE::updateEndItem(), PNS::TOOL_BASE::updateStartItem(), 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::TWO_POINT_ASSISTANT::ViewDraw(), KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM::ViewDraw(), MY_DRAWING::ViewDraw(), KIGFX::PREVIEW::SELECTION_AREA::ViewDraw(), KIGFX::VIEW_GROUP::ViewDraw(), KIGFX::WS_PROXY_VIEW_ITEM::ViewDraw(), ROUTER_PREVIEW_ITEM::ViewDraw(), EDIT_POINTS::ViewDraw(), and KIGFX::WX_VIEW_CONTROLS::WarpCursor().

◆ GetItemsExtents()

const BOX2I KIGFX::SCH_VIEW::GetItemsExtents ( ) const
overridevirtual

Return BBox of all items on screen except page and border.

Reimplemented from KIGFX::VIEW.

Definition at line 84 of file sch_view.cpp.

85 {
86  // Calc the bounding box of all items on screen except the page border
87  EDA_RECT bBoxItems;
88 
89  for( EDA_ITEM* item : m_frame->GetScreen()->Items() )
90  {
91  if( item != m_worksheet.get() ) // Ignore the worksheet itself
92  {
93  if( item->Type() == SCH_COMPONENT_T )
94  {
95  // For components we need to get the bounding box without invisible text
96  SCH_COMPONENT* comp = static_cast<SCH_COMPONENT*>( item );
97  bBoxItems.Merge( comp->GetBoundingBox( false ) );
98  }
99  else
100  bBoxItems.Merge( item->GetBoundingBox() );
101  }
102  }
103 
104  return bBoxItems;
105 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
std::unique_ptr< WS_PROXY_VIEW_ITEM > m_worksheet
Definition: sch_view.h:110
EE_RTREE & Items()
Definition: sch_screen.h:158
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Schematic symbol object.
Definition: sch_component.h:80
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
SCH_BASE_FRAME * m_frame
Definition: sch_view.h:107

References SCH_COMPONENT::GetBoundingBox(), SCH_BASE_FRAME::GetScreen(), SCH_SCREEN::Items(), m_frame, m_worksheet, EDA_RECT::Merge(), and SCH_COMPONENT_T.

◆ 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 671 of file view.cpp.

672 {
673  return m_layers.at( aLayer ).renderingOrder;
674 }
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804

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:837

References KIGFX::VIEW::m_painter.

Referenced by PCB_BASE_FRAME::ActivateGalCanvas(), KIGFX::WS_PROXY_VIEW_ITEM::buildDrawList(), PCB_INSPECTION_TOOL::ClearHighlight(), PL_EDITOR_FRAME::CommonSettingsChanged(), PCB_BASE_FRAME::CommonSettingsChanged(), GRID_HELPER::computeAnchors(), SYMBOL_PREVIEW_WIDGET::DisplayPart(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), PL_DRAW_PANEL_GAL::DisplayWorksheet(), PCB_INSPECTION_TOOL::doHideNet(), KIGFX::PREVIEW::POLYGON_ITEM::drawPreviewShape(), KIGFX::PREVIEW::DrawTextNextToCursor(), drawTicksAlongLine(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), GERBVIEW_DRAW_PANEL_GAL::GERBVIEW_DRAW_PANEL_GAL(), FOOTPRINT_PREVIEW_PANEL::GetBackgroundColor(), FOOTPRINT_PREVIEW_PANEL::GetForegroundColor(), ROUTER_PREVIEW_ITEM::getLayerColor(), SCH_BASE_FRAME::GetRenderSettings(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), DIALOG_SELECT_NET_FROM_LIST::highlightNetOnBoard(), PNS_KICAD_IFACE::IsItemVisible(), PCB_BASE_FRAME::LoadSettings(), DIALOG_PAD_PROPERTIES::onChangePadMode(), ZONE_CREATE_HELPER::OnFirstPoint(), APPEARANCE_CONTROLS::OnLayerAlphaChanged(), GERBER_LAYER_WIDGET::OnLayerColorChange(), APPEARANCE_CONTROLS::onNetclassColorChanged(), APPEARANCE_CONTROLS::onNetclassContextMenu(), GERBVIEW_DRAW_PANEL_GAL::OnShow(), PCB_DRAW_PANEL_GAL::OnShow(), DIALOG_PAD_PROPERTIES::prepareCanvas(), GRID_HELPER::queryVisible(), NET_GRID_TABLE::Rebuild(), APPEARANCE_CONTROLS::rebuildNets(), DIALOG_PAD_PROPERTIES::redraw(), FOOTPRINT_PREVIEW_PANEL::renderFootprint(), 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(), PANEL_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_PL_EDITOR_COLOR_SETTINGS::TransferDataFromWindow(), PANEL_EDIT_OPTIONS::TransferDataFromWindow(), PANEL_LIBEDIT_COLOR_SETTINGS::TransferDataFromWindow(), PANEL_EESCHEMA_COLOR_SETTINGS::TransferDataFromWindow(), PCB_DRAW_PANEL_GAL::UpdateColors(), KIGFX::PCB_VIEW::UpdateDisplayOptions(), NET_GRID_TABLE::updateNetColor(), PANEL_PCBNEW_COLOR_SETTINGS::updatePreview(), PANEL_EESCHEMA_COLOR_SETTINGS::updatePreview(), KIGFX::RATSNEST_VIEWITEM::ViewDraw(), KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), KIGFX::PREVIEW::SELECTION_AREA::ViewDraw(), KIGFX::VIEW_GROUP::ViewDraw(), KIGFX::WS_PROXY_VIEW_ITEM::ViewDraw(), and EDIT_POINTS::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 688 of file view.h.

688 { 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:864

References KIGFX::VIEW::m_printMode.

Referenced by D_PAD::ViewGetLOD().

◆ GetScale()

◆ 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 1173 of file view.cpp.

1174 {
1175  return m_gal->GetScreenPixelSize();
1176 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
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 847 of file view.cpp.

848 {
849  if( m_topLayers.size() == 0 )
850  return 0;
851 
852  return *m_topLayers.begin();
853 }
std::set< unsigned int > m_topLayers
Stores set of layers that are displayed on the top.
Definition: view.h:813

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

538 {
539  BOX2D rect;
540  VECTOR2D screenSize = m_gal->GetScreenPixelSize();
541 
542  rect.SetOrigin( ToWorld( VECTOR2D( 0, 0 ) ) );
543  rect.SetEnd( ToWorld( screenSize ) );
544 
545  return rect.Normalize();
546 }
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:474
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
const VECTOR2I & GetScreenPixelSize() const
Returns GAL canvas size in pixels.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
BOX2< Vec > & Normalize()
Function Normalize ensures that the height ant width are positive.
Definition: box2.h:129
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:225
void SetOrigin(const Vec &pos)
Definition: box2.h:210

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

Referenced by SCH_EDITOR_CONTROL::FindComponentAndItem(), EDA_DRAW_FRAME::FocusOnLocation(), SELECTION_TOOL::GuessSelectionCandidates(), and KIGFX::WX_VIEW_CONTROLS::UpdateScrollbars().

◆ GetWorksheet()

WS_PROXY_VIEW_ITEM* KIGFX::SCH_VIEW::GetWorksheet ( ) const
inline

Definition at line 104 of file sch_view.h.

104 { return m_worksheet.get(); }
std::unique_ptr< WS_PROXY_VIEW_ITEM > m_worksheet
Definition: sch_view.h:110

References m_worksheet.

Referenced by SCH_EDIT_TOOL::Properties(), and DIALOG_ERC::testErc().

◆ 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 1498 of file view.cpp.

1499 {
1500  auto viewData = aItem->viewPrivData();
1501 
1502  if( !viewData )
1503  return;
1504 
1505  if( !( viewData->m_flags & VISIBLE ) )
1506  return;
1507 
1508  if( aHide )
1509  viewData->m_flags |= HIDDEN;
1510  else
1511  viewData->m_flags &= ~HIDDEN;
1512 
1513  Update( aItem, APPEARANCE );
1514 }
Item is visible (in general)
Definition: view_item.h:72
No updates are required.
Definition: view_item.h:57
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:1531

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

Referenced by KIGFX::VIEW::AddToPreview(), ClearHiddenFlags(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::highlightInternal(), ROUTER_TOOL::InlineDrag(), SCH_MOVE_TOOL::moveItem(), SCH_EDITOR_CONTROL::Paste(), GERBVIEW_SELECTION_TOOL::selectVisually(), SELECTION_TOOL::unhighlightInternal(), and GERBVIEW_SELECTION_TOOL::unselectVisually().

◆ HideWorksheet()

void KIGFX::SCH_VIEW::HideWorksheet ( )

Definition at line 208 of file sch_view.cpp.

209 {
210  // SetVisible( m_worksheet.get(), false );
211 }

Referenced by LIB_EDIT_FRAME::RebuildView().

◆ InitPreview()

void KIGFX::VIEW::InitPreview ( )
inherited

Definition at line 1565 of file view.cpp.

1566 {
1567  m_preview.reset( new KIGFX::VIEW_GROUP() );
1568  Add( m_preview.get() );
1569 }
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: view.h:718
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:345

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

Referenced by DisplayComponent(), DisplaySheet(), ROUTER_TOOL::InlineDrag(), and PCB_BASE_EDIT_FRAME::SetBoard().

◆ 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 1209 of file view.cpp.

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

References KIGFX::ALL, KIGFX::VIEW_ITEM_DATA::clearUpdateFlags(), KIGFX::COLOR, KIGFX::GEOMETRY, 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 581 of file view.h.

582  {
583  wxCHECK( aLayer < (int) m_layers.size(), false );
584 
585  try
586  {
587  return m_layers.at( aLayer ).target == TARGET_CACHED;
588  }
589  catch( const std::out_of_range& )
590  {
591  return false;
592  }
593  }
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804
Main rendering target (cached)
Definition: definitions.h:48

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

547  {
548  for( int i = 0; i < TARGETS_NUMBER; ++i )
549  {
550  if( IsTargetDirty( i ) )
551  return true;
552  }
553 
554  return false;
555  }
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:563

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

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

◆ IsDrawOrderReversed()

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

Function IsDrawOrderReversed()

Returns
true if draw order is reversed

Definition at line 654 of file view.h.

655  {
656  return m_reverseDrawOrder;
657  }
bool m_reverseDrawOrder
Flag to reverse the draw order when using draw priority.
Definition: view.h:860

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

537  {
538  return m_dynamic;
539  }
bool m_dynamic
Dynamic VIEW (eg.
Definition: view.h:844

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

406  {
407  wxCHECK( aLayer < (int) m_layers.size(), false );
408  return m_layers.at( aLayer ).visible;
409  }
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804

References KIGFX::VIEW::m_layers.

Referenced by GERBVIEW_DRAW_PANEL_GAL::GetDefaultViewBBox(), PCB_DRAW_PANEL_GAL::GetDefaultViewBBox(), GERBVIEW_FRAME::GetVisibleLayers(), PNS_KICAD_IFACE::IsAnyLayerVisible(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), GERBER_LAYER_WIDGET::ReFill(), KIGFX::RATSNEST_VIEWITEM::ViewDraw(), KIGFX::VIEW_GROUP::ViewDraw(), EDGE_MODULE::ViewGetLOD(), PCB_GROUP::ViewGetLOD(), ZONE_CONTAINER::ViewGetLOD(), TRACK::ViewGetLOD(), TEXTE_MODULE::ViewGetLOD(), VIA::ViewGetLOD(), D_PAD::ViewGetLOD(), MODULE::ViewGetLOD(), and MODULE_ZONE_CONTAINER::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:834

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

564  {
565  wxCHECK( aTarget < TARGETS_NUMBER, false );
566  return m_dirtyTargets[aTarget];
567  }
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:847

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

Referenced by KIGFX::VIEW::ClearTargets(), EDA_DRAW_PANEL_GAL::DoRePaint(), KIGFX::VIEW::IsDirty(), 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 636 of file view.h.

637  {
638  return m_useDrawPriority;
639  }
bool m_useDrawPriority
Flat list of all items Flag to respect draw priority when drawing items.
Definition: view.h:854

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

1518 {
1519  const auto viewData = aItem->viewPrivData();
1520 
1521  return viewData && ( viewData->m_flags & VISIBLE );
1522 }

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

Referenced by EE_GRID_HELPER::BestSnapAnchor(), GRID_HELPER::BestSnapAnchor(), GRID_HELPER::computeAnchors(), PNS_KICAD_IFACE::HideItem(), PNS_KICAD_IFACE::IsItemVisible(), EE_GRID_HELPER::queryVisible(), GRID_HELPER::queryVisible(), and SELECTION_TOOL::Selectable().

◆ MakeOverlay()

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

Definition at line 1544 of file view.cpp.

1545 {
1546  std::shared_ptr<VIEW_OVERLAY> overlay( new VIEW_OVERLAY );
1547 
1548  Add( overlay.get() );
1549  return overlay;
1550 }
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:345

References KIGFX::VIEW::Add().

Referenced by AUTOPLACE_TOOL::autoplace().

◆ MarkDirty()

void KIGFX::VIEW::MarkDirty ( )
inlineinherited

◆ 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 726 of file view.h.

727  {
728  wxCHECK( aTarget < TARGETS_NUMBER, /* void */ );
729  m_dirtyTargets[aTarget] = false;
730  }
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:847

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

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

References KIGFX::VIEW::m_orderedLayers.

Referenced by DRAWING_TOOL::DrawVia(), EE_GRID_HELPER::queryVisible(), GRID_HELPER::queryVisible(), SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::selectMultiple(), and SELECTION_TOOL::selectMultiple().

◆ RecacheAllItems()

void KIGFX::VIEW::RecacheAllItems ( )
inherited

Function RecacheAllItems() Rebuilds GAL display lists.

Definition at line 1395 of file view.cpp.

1396 {
1397  BOX2I r;
1398 
1399  r.SetMaximum();
1400 
1401  for( const VIEW_LAYER& l : m_layers )
1402  {
1403  if( IsCached( l.id ) )
1404  {
1405  recacheItem visitor( this, m_gal, l.id );
1406  l.items->Query( r, visitor );
1407  }
1408  }
1409 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
void SetMaximum()
Definition: box2.h:73
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804
bool IsCached(int aLayer) const
Returns true if the layer is cached.
Definition: view.h:581

References KIGFX::VIEW::IsCached(), 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_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_GAL_DISPLAY_OPTIONS::TransferDataFromWindow(), and PANEL_EDIT_OPTIONS::TransferDataFromWindow().

◆ Redraw()

void KIGFX::VIEW::Redraw ( )
virtualinherited

Function Redraw() Immediately redraws the whole view.

Definition at line 1141 of file view.cpp.

1142 {
1143 #ifdef __WXDEBUG__
1144  PROF_COUNTER totalRealTime;
1145 #endif /* __WXDEBUG__ */
1146 
1147  VECTOR2D screenSize = m_gal->GetScreenPixelSize();
1148  BOX2D rect( ToWorld( VECTOR2D( 0, 0 ) ),
1149  ToWorld( screenSize ) - ToWorld( VECTOR2D( 0, 0 ) ) );
1150 
1151  rect.Normalize();
1152  BOX2I recti( rect.GetPosition(), rect.GetSize() );
1153 
1154  // The view rtree uses integer positions. Large screens can overflow
1155  // this size so in this case, simply set the rectangle to the full rtree
1156  if( rect.GetWidth() > std::numeric_limits<int>::max() ||
1157  rect.GetHeight() > std::numeric_limits<int>::max() )
1158  recti.SetMaximum();
1159 
1160  redrawRect( recti );
1161  // All targets were redrawn, so nothing is dirty
1165 
1166 #ifdef __WXDEBUG__
1167  totalRealTime.Stop();
1168  wxLogTrace( "GAL_PROFILE", "VIEW::Redraw(): %.1f ms", totalRealTime.msecs() );
1169 #endif /* __WXDEBUG__ */
1170 }
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:474
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:840
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:593
void SetMaximum()
Definition: box2.h:73
Items that may change while the view stays the same (noncached)
Definition: definitions.h:50
void markTargetClean(int aTarget)
Definition: view.h:726
void redrawRect(const BOX2I &aRect)
Definition: view.cpp:1006
Main rendering target (cached)
Definition: definitions.h:48

References BOX2< Vec >::GetHeight(), BOX2< Vec >::GetPosition(), KIGFX::GAL::GetScreenPixelSize(), BOX2< Vec >::GetSize(), BOX2< Vec >::GetWidth(), KIGFX::VIEW::m_gal, KIGFX::VIEW::markTargetClean(), 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::DoRePaint().

◆ redrawRect()

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

Definition at line 1006 of file view.cpp.

1007 {
1008  for( VIEW_LAYER* l : m_orderedLayers )
1009  {
1010  if( l->visible && IsTargetDirty( l->target ) && areRequiredLayersEnabled( l->id ) )
1011  {
1012  drawItem drawFunc( this, l->id, m_useDrawPriority, m_reverseDrawOrder );
1013 
1014  m_gal->SetTarget( l->target );
1015  m_gal->SetLayerDepth( l->renderingOrder );
1016  l->items->Query( aRect, drawFunc );
1017 
1018  if( m_useDrawPriority )
1019  drawFunc.deferredDraw();
1020  }
1021  }
1022 }
bool m_useDrawPriority
Flat list of all items Flag to respect draw priority when drawing items.
Definition: view.h:854
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
bool areRequiredLayersEnabled(int aLayerId) const
Checks if every layer required by the aLayerId layer is enabled.
Definition: view.cpp:1377
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:563
bool m_reverseDrawOrder
Flag to reverse the draw order when using draw priority.
Definition: view.h:860
std::vector< VIEW_LAYER * > m_orderedLayers
Sorted list of pointers to members of m_layers.
Definition: view.h:807
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 375 of file view.cpp.

376 {
377  if( !aItem )
378  return;
379 
380  auto viewData = aItem->viewPrivData();
381 
382  if( !viewData )
383  return;
384 
385  wxCHECK( viewData->m_view == this, /*void*/ );
386  auto item = std::find( m_allItems->begin(), m_allItems->end(), aItem );
387 
388  if( item != m_allItems->end() )
389  {
390  m_allItems->erase( item );
391  viewData->clearUpdateFlags();
392  }
393 
394  int layers[VIEW::VIEW_MAX_LAYERS], layers_count;
395  viewData->getLayers( layers, layers_count );
396 
397  for( int i = 0; i < layers_count; ++i )
398  {
399  VIEW_LAYER& l = m_layers[layers[i]];
400  l.items->Remove( aItem );
401  MarkTargetDirty( l.target );
402 
403  // Clear the GAL cache
404  int prevGroup = viewData->getGroup( layers[i] );
405 
406  if( prevGroup >= 0 )
407  m_gal->DeleteGroup( prevGroup );
408  }
409 
410  viewData->deleteGroups();
411  viewData->m_view = nullptr;
412 }
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:840
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:697
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:810
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:574
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804

References KIGFX::GAL::DeleteGroup(), 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(), KIGFX::VIEW::~VIEW(), 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 705 of file view.cpp.

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

References KIGFX::COLOR, 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 107 of file sch_view.cpp.

108 {
109  const PAGE_INFO& page_info = aScreen->GetPageSettings();
110  double max_size_x = page_info.GetWidthIU() * 3.0;
111  double max_size_y = page_info.GetHeightIU() * 3.0;
112  m_boundary.SetOrigin( -max_size_x/4, -max_size_y/4 );
113  m_boundary.SetSize( max_size_x, max_size_y );
114 }
void SetSize(const Vec &size)
Definition: box2.h:212
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:180
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
BOX2D m_boundary
View boundaries.
Definition: view.h:822
void SetOrigin(const Vec &pos)
Definition: box2.h:210

References SCH_SCREEN::GetPageSettings(), 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 664 of file view.h.

665  {
666  m_reverseDrawOrder = aFlag;
667  }
bool m_reverseDrawOrder
Flag to reverse the draw order when using draw priority.
Definition: view.h:860

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:822

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:195
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:225
BOX2D m_boundary
View boundaries.
Definition: view.h:822
void SetOrigin(const Vec &pos)
Definition: box2.h:210
const Vec & GetOrigin() const
Definition: box2.h:193

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

604 {
605  m_center = aCenter;
606 
607  if( !m_boundary.Contains( aCenter ) )
608  {
609  if( m_center.x < m_boundary.GetLeft() )
611  else if( aCenter.x > m_boundary.GetRight() )
613 
614  if( m_center.y < m_boundary.GetTop() )
616  else if( m_center.y > m_boundary.GetBottom() )
618  }
619 
622 
623  // Redraw everything after the viewport has changed
624  MarkDirty();
625 }
coord_type GetTop() const
Definition: box2.h:204
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
coord_type GetRight() const
Definition: box2.h:199
coord_type GetBottom() const
Definition: box2.h:200
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:816
bool Contains(const Vec &aPoint) const
Function Contains.
Definition: box2.h:151
BOX2D m_boundary
View boundaries.
Definition: view.h:822
void SetLookAtPoint(const VECTOR2D &aPoint)
Set the Point in world space to look at.
coord_type GetLeft() const
Definition: box2.h:203
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:599

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 COMMON_TOOLS::CenterContents(), KIGFX::WX_VIEW_CONTROLS::CenterOnCursor(), SCH_BASE_FRAME::CenterScreen(), COMMON_TOOLS::doZoomFit(), 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(), PANEL_PCBNEW_COLOR_SETTINGS::zoomFitPreview(), 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 628 of file view.cpp.

629 {
630  BOX2D screenRect( VECTOR2D( 0, 0 ), m_gal->GetScreenPixelSize() );
631 
632  if( !screenRect.Intersects( occultingScreenRect ) )
633  {
634  SetCenter( aCenter );
635  return;
636  }
637 
638  BOX2D occultedRect = screenRect.Intersect( occultingScreenRect );
639  double topExposed = occultedRect.GetTop() - screenRect.GetTop();
640  double bottomExposed = screenRect.GetBottom() - occultedRect.GetBottom();
641  double leftExposed = occultedRect.GetLeft() - screenRect.GetLeft();
642  double rightExposed = screenRect.GetRight() - occultedRect.GetRight();
643 
644  if( std::max( topExposed, bottomExposed ) > std::max( leftExposed, rightExposed ) )
645  {
646  if( topExposed > bottomExposed )
647  aCenter.y += ToWorld( screenRect.GetHeight() / 2 - topExposed / 2 );
648  else
649  aCenter.y -= ToWorld( screenRect.GetHeight() / 2 - bottomExposed / 2 );
650  }
651  else
652  {
653  if( leftExposed > rightExposed )
654  aCenter.x += ToWorld( screenRect.GetWidth() / 2 - leftExposed / 2 );
655  else
656  aCenter.x -= ToWorld( screenRect.GetWidth() / 2 - rightExposed / 2 );
657  }
658 
659  SetCenter( aCenter );
660 }
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:474
coord_type GetTop() const
Definition: box2.h:204
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
coord_type GetRight() const
Definition: box2.h:199
coord_type GetBottom() const
Definition: box2.h:200
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:603
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
coord_type GetLeft() const
Definition: box2.h:203
BOX2< Vec > Intersect(const BOX2< Vec > &aRect)
Function Intersect Returns the intersection of this with another rectangle.
Definition: box2.h:268

References BOX2< Vec >::GetBottom(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), KIGFX::GAL::GetScreenPixelSize(), BOX2< Vec >::GetTop(), BOX2< Vec >::Intersect(), KIGFX::VIEW::m_gal, 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 518 of file view.cpp.

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

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

412  {
413  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
414  m_layers[aLayer].displayOnly = aDisplayOnly;
415  }
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804

References KIGFX::VIEW::m_layers.

Referenced by PL_DRAW_PANEL_GAL::setDefaultLayerDeps(), SCH_DRAW_PANEL::setDefaultLayerDeps(), SCH_PREVIEW_PANEL::setDefaultLayerDeps(), GERBVIEW_DRAW_PANEL_GAL::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 663 of file view.cpp.

664 {
665  m_layers[aLayer].renderingOrder = aRenderingOrder;
666 
667  sortLayers();
668 }
void sortLayers()
Definition: view.cpp:1254
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804

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

424  {
425  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
426  m_layers[aLayer].target = aTarget;
427  }
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804

References KIGFX::VIEW::m_layers.

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

◆ 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 388 of file view.h.

389  {
390  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
391 
392  if( m_layers[aLayer].visible != aVisible )
393  {
394  // Target has to be redrawn after changing its visibility
395  MarkTargetDirty( m_layers[aLayer].target );
396  m_layers[aLayer].visible = aVisible;
397  }
398  }
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:574
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804

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

Referenced by APPEARANCE_CONTROLS::onLayerVisibilityChanged(), PCB_LAYER_WIDGET::OnLayerVisible(), APPEARANCE_CONTROLS::onObjectVisibilityChanged(), GERBER_LAYER_WIDGET::OnRenderEnable(), PCB_LAYER_WIDGET::OnRenderEnable(), PL_EDITOR_FRAME::OnSelectPage(), PL_DRAW_PANEL_GAL::PL_DRAW_PANEL_GAL(), GERBVIEW_FRAME::SetElementVisibility(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), APPEARANCE_CONTROLS::SetLayerVisible(), GERBVIEW_PRINTOUT::setupViewLayers(), PCBNEW_PRINTOUT::setupViewLayers(), BOARD_PRINTOUT::setupViewLayers(), GERBVIEW_FRAME::SetVisibleLayers(), PCB_DRAW_PANEL_GAL::SyncLayersVisibility(), and PCB_EDIT_FRAME::UpdateUserInterface().

◆ 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 564 of file view.cpp.

565 {
566  wxASSERT_MSG( !aMirrorY, _( "Mirroring for Y axis is not supported yet" ) );
567 
568  m_mirrorX = aMirrorX;
569  m_mirrorY = aMirrorY;
570  m_gal->SetFlip( aMirrorX, aMirrorY );
571 
572  // Redraw everything
573  MarkDirty();
574 }
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:840
bool m_mirrorX
Horizontal flip flag
Definition: view.h:831
#define _(s)
Definition: 3d_actions.cpp:33
bool m_mirrorY
Vertical flip flag
Definition: view.h:834
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:599

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

Referenced by GERBVIEW_CONTROL::DisplayControl(), 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:837

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

695 { 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:864

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

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

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 74 of file sch_view.cpp.

75 {
76  VIEW::SetScale( aScale, aAnchor );
77 
78  //Redraw selection halos since their width is dependent on zoom
79  if( m_frame )
81 }
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:577
SCH_BASE_FRAME * m_frame
Definition: sch_view.h:107

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

◆ 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 303 of file view.h.

304  {
305  wxASSERT_MSG( aMaximum > aMinimum, wxT( "I guess you passed parameters in wrong order" ) );
306 
307  m_minScale = aMinimum;
308  m_maxScale = aMaximum;
309  }
double m_minScale
Scale lower limit.
Definition: view.h:825
double m_maxScale
Scale upper limit.
Definition: view.h:828

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

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

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(), EDA_DRAW_PANEL_GAL::SetTopLayer(), PCBNEW_PRINTOUT::setupViewLayers(), and BOARD_PRINTOUT::setupViewLayers().

◆ 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 549 of file view.cpp.

550 {
551  VECTOR2D ssize = ToWorld( m_gal->GetScreenPixelSize(), false );
552 
553  wxCHECK( ssize.x > 0 && ssize.y > 0, /*void*/ );
554 
555  VECTOR2D centre = aViewport.Centre();
556  VECTOR2D vsize = aViewport.GetSize();
557  double zoom = 1.0 / std::max( fabs( vsize.x / ssize.x ), fabs( vsize.y / ssize.y ) );
558 
559  SetCenter( centre );
560  SetScale( GetScale() * zoom );
561 }
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:474
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
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:603
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Function SetScale() Sets the scaling factor, zooming around a given anchor point.
Definition: view.cpp:577
Vec Centre() const
Definition: box2.h:79
const Vec & GetSize() const
Definition: box2.h:189
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, 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 1477 of file view.cpp.

1478 {
1479  auto viewData = aItem->viewPrivData();
1480 
1481  if( !viewData )
1482  return;
1483 
1484  bool cur_visible = viewData->m_flags & VISIBLE;
1485 
1486  if( cur_visible != aIsVisible )
1487  {
1488  if( aIsVisible )
1489  viewData->m_flags |= VISIBLE;
1490  else
1491  viewData->m_flags &= ~VISIBLE;
1492 
1493  Update( aItem, APPEARANCE | COLOR );
1494  }
1495 }
No updates are required.
Definition: view_item.h:57
Visibility flag has changed.
Definition: view_item.h:58
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:1531

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(), KIGFX::VIEW::AddToPreview(), EE_GRID_HELPER::BestSnapAnchor(), GRID_HELPER::BestSnapAnchor(), MICROWAVE_TOOL::drawMicrowaveInductor(), EE_GRID_HELPER::EE_GRID_HELPER(), PNS_KICAD_IFACE::EraseView(), GRID_HELPER::GRID_HELPER(), PNS_KICAD_IFACE::HideItem(), PCB_VIEWER_TOOLS::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(), EE_GRID_HELPER::SetAuxAxes(), KIGFX::VIEW::ShowPreview(), and ZONE_CREATE_HELPER::~ZONE_CREATE_HELPER().

◆ ShowPreview()

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

Definition at line 1586 of file view.cpp.

1587 {
1588  SetVisible( m_preview.get(), aShow );
1589 }
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: view.h:718
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1477

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

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

◆ 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 677 of file view.cpp.

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

References KIGFX::VIEW::GetLayerOrder().

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

1255 {
1256  int n = 0;
1257 
1258  m_orderedLayers.resize( m_layers.size() );
1259 
1260  for( VIEW_LAYER& layer : m_layers )
1261  m_orderedLayers[n++] = &layer;
1262 
1263  sort( m_orderedLayers.begin(), m_orderedLayers.end(), compareRenderingOrder );
1264 
1265  MarkDirty();
1266 }
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804
std::vector< VIEW_LAYER * > m_orderedLayers
Sorted list of pointers to members of m_layers.
Definition: view.h:807
static bool compareRenderingOrder(VIEW_LAYER *aI, VIEW_LAYER *aJ)
Determines rendering order of layers. Used in display order sorting function.
Definition: view.h:792
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:599

References KIGFX::VIEW::compareRenderingOrder(), 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 493 of file view.cpp.

494 {
495  const MATRIX3x3D& matrix = m_gal->GetWorldScreenMatrix();
496 
497  if( aAbsolute )
498  return VECTOR2D( matrix * aCoord );
499  else
500  return VECTOR2D( matrix.GetScale().x * aCoord.x, matrix.GetScale().y * aCoord.y );
501 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
Definition: matrix3x3.h:269
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
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 504 of file view.cpp.

505 {
506  const MATRIX3x3D& matrix = m_gal->GetWorldScreenMatrix();
507 
508  return matrix.GetScale().x * aSize;
509 }
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
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 474 of file view.cpp.

475 {
476  const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix();
477 
478  if( aAbsolute )
479  return VECTOR2D( matrix * aCoord );
480  else
481  return VECTOR2D( matrix.GetScale().x * aCoord.x, matrix.GetScale().y * aCoord.y );
482 }
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:840
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
Definition: matrix3x3.h:269
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593

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(), COMMON_TOOLS::doZoomFit(), KIGFX::PREVIEW::POLYGON_ITEM::drawPreviewShape(), 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::WS_PROXY_VIEW_ITEM::HitTestWorksheetItems(), 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(), PANEL_PCBNEW_COLOR_SETTINGS::zoomFitPreview(), 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 485 of file view.cpp.

486 {
487  const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix();
488 
489  return fabs( matrix.GetScale().x * aSize );
490 }
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:840
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 1531 of file view.cpp.

1532 {
1533  VIEW_ITEM_DATA* viewData = aItem->viewPrivData();
1534 
1535  if( !viewData )
1536  return;
1537 
1538  assert( aUpdateFlags != NONE );
1539 
1540  viewData->m_requiredUpdate |= aUpdateFlags;
1541 }

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

Referenced by KIGFX::VIEW::Add(), PNS_PCBNEW_DEBUG_DECORATOR::AddLine(), KIGFX::VIEW::AddToPreview(), EE_GRID_HELPER::BestSnapAnchor(), GRID_HELPER::BestSnapAnchor(), SCH_EDIT_TOOL::ChangeTextType(), PNS_PCBNEW_DEBUG_DECORATOR::Clear(), KIGFX::VIEW::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(), PAD_TOOL::EnumeratePads(), PNS_KICAD_IFACE::EraseView(), KIGFX::VIEW::Hide(), PNS_KICAD_IFACE::HideItem(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), EDIT_TOOL::MoveExact(), PL_EDIT_TOOL::moveItem(), PROPERTIES_FRAME::OnAcceptPrms(), ZONE_CREATE_HELPER::OnGeometryChange(), POINT_EDITOR::OnSelectionChange(), 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::RefreshSelection(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), KIGFX::VIEW::SetVisible(), SCH_EDIT_FRAME::TestDanglingEnds(), DIALOG_JUNCTION_PROPS::TransferDataFromWindow(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), PCB_BASE_EDIT_FRAME::unitsChangeRefresh(), GERBVIEW_SELECTION_TOOL::unselectVisually(), KIGFX::PCB_VIEW::Update(), KIGFX::VIEW::Update(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), POINT_EDITOR::updateItem(), SCH_BASE_FRAME::UpdateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), SCH_EDIT_FRAME::UpdateSymbolFromEditor(), 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 1525 of file view.cpp.

1526 {
1527  Update( aItem, ALL );
1528 }
Item needs to be redrawn.
Definition: view_item.h:63
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:1531

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

1436 {
1437  for( VIEW_ITEM* item : *m_allItems )
1438  {
1439  auto viewData = item->viewPrivData();
1440 
1441  if( !viewData )
1442  continue;
1443 
1444  viewData->m_requiredUpdate |= aUpdateFlags;
1445  }
1446 }
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:810

References KIGFX::VIEW::m_allItems.

Referenced by PL_EDITOR_FRAME::CommonSettingsChanged(), SCH_EDIT_FRAME::CommonSettingsChanged(), SCH_BASE_FRAME::HardRedraw(), GERBVIEW_CONTROL::HighlightControl(), SCH_EDIT_FRAME::KiwayMailIn(), DIALOG_SELECT_NET_FROM_LIST::onRenameNet(), GERBVIEW_FRAME::OnSelectHighlightChoice(), LIB_CONTROL::ShowElectricalTypes(), SCH_BASE_FRAME::SyncView(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_SETUP_FORMATTING::TransferDataFromWindow(), PANEL_PCBNEW_COLOR_SETTINGS::updatePreview(), and PANEL_EESCHEMA_COLOR_SETTINGS::updatePreview().

◆ 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 1449 of file view.cpp.

1451 {
1452  for( VIEW_ITEM* item : *m_allItems )
1453  {
1454  if( aCondition( item ) )
1455  {
1456  auto viewData = item->viewPrivData();
1457 
1458  if( !viewData )
1459  continue;
1460 
1461  viewData->m_requiredUpdate |= aUpdateFlags;
1462  }
1463  }
1464 }
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:810

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

795 {
796  if( m_gal->IsVisible() )
797  {
798  GAL_UPDATE_CONTEXT ctx( m_gal );
799 
800  for( VIEW_ITEM* item : *m_allItems )
801  {
802  auto viewData = item->viewPrivData();
803 
804  if( !viewData )
805  continue;
806 
807  int layers[VIEW::VIEW_MAX_LAYERS], layers_count;
808  viewData->getLayers( layers, layers_count );
809 
810  for( int i = 0; i < layers_count; ++i )
811  {
812  const COLOR4D color = m_painter->GetSettings()->GetColor( item, layers[i] );
813  int group = viewData->getGroup( layers[i] );
814 
815  if( group >= 0 )
816  m_gal->ChangeGroupColor( group, color );
817  }
818  }
819  }
820 
821  MarkDirty();
822 }
friend class VIEW_ITEM
Definition: view.h:64
int color
Definition: DXF_plotter.cpp:61
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:697
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:810
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:837
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const =0
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
virtual RENDER_SETTINGS * GetSettings()=0
Function GetAdapter Returns pointer to current settings that are going to be used when drawing items.
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:599
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99

References KIGFX::GAL::ChangeGroupColor(), color, KIGFX::RENDER_SETTINGS::GetColor(), KIGFX::PAINTER::GetSettings(), 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(), FOOTPRINT_EDIT_FRAME::CommonSettingsChanged(), KIGFX::VIEW::EnableTopLayer(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), DIALOG_SELECT_NET_FROM_LIST::highlightNetOnBoard(), APPEARANCE_CONTROLS::onNetclassColorChanged(), APPEARANCE_CONTROLS::onNetclassContextMenu(), APPEARANCE_CONTROLS::onNetColorModeChanged(), GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer(), PCB_DRAW_PANEL_GAL::SetHighContrastLayer(), EDA_DRAW_PANEL_GAL::SetHighContrastLayer(), and NET_GRID_TABLE::updateNetColor().

◆ 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 923 of file view.cpp.

924 {
925  sortLayers();
926 
927  if( m_gal->IsVisible() )
928  {
929  GAL_UPDATE_CONTEXT ctx( m_gal );
930 
931  for( VIEW_ITEM* item : *m_allItems )
932  {
933  auto viewData = item->viewPrivData();
934 
935  if( !viewData )
936  continue;
937 
938  int layers[VIEW::VIEW_MAX_LAYERS], layers_count;
939  viewData->getLayers( layers, layers_count );
940 
941  for( int i = 0; i < layers_count; ++i )
942  {
943  int group = viewData->getGroup( layers[i] );
944 
945  if( group >= 0 )
946  m_gal->ChangeGroupDepth( group, m_layers[layers[i]].renderingOrder );
947  }
948  }
949  }
950 
951  MarkDirty();
952 }
void sortLayers()
Definition: view.cpp:1254
friend class VIEW_ITEM
Definition: view.h:64
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:697
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:810
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804
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.
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:599

References KIGFX::GAL::ChangeGroupDepth(), 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 1318 of file view.cpp.

1319 {
1320  int layers[VIEW_MAX_LAYERS], layers_count;
1321 
1322  aItem->ViewGetLayers( layers, layers_count );
1323 
1324  for( int i = 0; i < layers_count; ++i )
1325  {
1326  VIEW_LAYER& l = m_layers[layers[i]];
1327  l.items->Remove( aItem );
1328  l.items->Insert( aItem );
1329  MarkTargetDirty( l.target );
1330  }
1331 }
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:697
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:574
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804

References 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 1269 of file view.cpp.

1270 {
1271  auto viewData = aItem->viewPrivData();
1272  wxCHECK( (unsigned) aLayer < m_layers.size(), /*void*/ );
1273  wxCHECK( IsCached( aLayer ), /*void*/ );
1274 
1275  if( !viewData )
1276  return;
1277 
1278  // Obtain the color that should be used for coloring the item on the specific layerId
1279  const COLOR4D color = m_painter->GetSettings()->GetColor( aItem, aLayer );
1280  int group = viewData->getGroup( aLayer );
1281 
1282  // Change the color, only if it has group assigned
1283  if( group >= 0 )
1284  m_gal->ChangeGroupColor( group, color );
1285 }
int color
Definition: DXF_plotter.cpp:61
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
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:837
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const =0
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
virtual RENDER_SETTINGS * GetSettings()=0
Function GetAdapter 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:581
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99

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

1289 {
1290  auto viewData = aItem->viewPrivData();
1291  wxCHECK( (unsigned) aLayer < m_layers.size(), /*void*/ );
1292  wxCHECK( IsCached( aLayer ), /*void*/ );
1293 
1294  if( !viewData )
1295  return;
1296 
1297  VIEW_LAYER& l = m_layers.at( aLayer );
1298 
1299  m_gal->SetTarget( l.target );
1300  m_gal->SetLayerDepth( l.renderingOrder );
1301 
1302  // Redraw the item from scratch
1303  int group = viewData->getGroup( aLayer );
1304 
1305  if( group >= 0 )
1306  m_gal->DeleteGroup( group );
1307 
1308  group = m_gal->BeginGroup();
1309  viewData->setGroup( aLayer, group );
1310 
1311  if( !m_painter->Draw( static_cast<EDA_ITEM*>( aItem ), aLayer ) )
1312  aItem->ViewDraw( aLayer, this ); // Alternative drawing method
1313 
1314  m_gal->EndGroup();
1315 }
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:840
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:837
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804
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:581
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 1412 of file view.cpp.

1413 {
1414  if( m_gal->IsVisible() )
1415  {
1416  GAL_UPDATE_CONTEXT ctx( m_gal );
1417 
1418  for( VIEW_ITEM* item : *m_allItems )
1419  {
1420  auto viewData = item->viewPrivData();
1421 
1422  if( !viewData )
1423  continue;
1424 
1425  if( viewData->m_requiredUpdate != NONE )
1426  {
1427  invalidateItem( item, viewData->m_requiredUpdate );
1428  viewData->m_requiredUpdate = NONE;
1429  }
1430  }
1431  }
1432 }
friend class VIEW_ITEM
Definition: view.h:64
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:840
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:810
void invalidateItem(VIEW_ITEM *aItem, int aUpdateFlags)
Function invalidateItem() Manages dirty flags & redraw queueing when updating an item.
Definition: view.cpp:1209
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 EDA_DRAW_PANEL_GAL::DoRePaint(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SCH_DRAW_PANEL::OnShow(), 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 773 of file view.cpp.

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

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(), APPEARANCE_CONTROLS::OnColorSwatchChanged(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_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 1334 of file view.cpp.

1335 {
1336  auto viewData = aItem->viewPrivData();
1337  int layers[VIEW_MAX_LAYERS], layers_count;
1338 
1339  if( !viewData )
1340  return;
1341 
1342  // Remove the item from previous layer set
1343  viewData->getLayers( layers, layers_count );
1344 
1345  for( int i = 0; i < layers_count; ++i )
1346  {
1347  VIEW_LAYER& l = m_layers[layers[i]];
1348  l.items->Remove( aItem );
1349  MarkTargetDirty( l.target );
1350 
1351  if( IsCached( l.id ) )
1352  {
1353  // Redraw the item from scratch
1354  int prevGroup = viewData->getGroup( layers[i] );
1355 
1356  if( prevGroup >= 0 )
1357  {
1358  m_gal->DeleteGroup( prevGroup );
1359  viewData->setGroup( l.id, -1 );
1360  }
1361  }
1362  }
1363 
1364  // Add the item to new layer set
1365  aItem->ViewGetLayers( layers, layers_count );
1366  viewData->saveLayers( layers, layers_count );
1367 
1368  for( int i = 0; i < layers_count; i++ )
1369  {
1370  VIEW_LAYER& l = m_layers[layers[i]];
1371  l.items->Insert( aItem );
1372  MarkTargetDirty( l.target );
1373  }
1374 }
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:840
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:697
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:574
std::vector< VIEW_LAYER > m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:804
bool IsCached(int aLayer) const
Returns true if the layer is cached.
Definition: view.h:581

References KIGFX::GAL::DeleteGroup(), KIGFX::VIEW_ITEM_DATA::getLayers(), 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 645 of file view.h.

646  {
647  m_useDrawPriority = aFlag;
648  }
bool m_useDrawPriority
Flat list of all items Flag to respect draw priority when drawing items.
Definition: view.h:854

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 816 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 847 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 844 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 801 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 107 of file sch_view.h.

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

◆ m_gal

◆ m_layers

◆ m_maxScale

double KIGFX::VIEW::m_maxScale
protectedinherited

Scale upper limit.

Definition at line 828 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 825 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 831 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 834 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 857 of file view.h.

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

◆ m_orderedLayers

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

Sorted list of pointers to members of m_layers.

Definition at line 807 of file view.h.

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

◆ m_ownedItems

std::vector<EDA_ITEM *> KIGFX::VIEW::m_ownedItems
protectedinherited

Definition at line 721 of file view.h.

Referenced by KIGFX::VIEW::AddToPreview(), and KIGFX::VIEW::ClearPreview().

◆ m_painter

PAINTER* KIGFX::VIEW::m_painter
protectedinherited

◆ m_preview

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

◆ 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 864 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 860 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 819 of file view.h.

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

◆ m_topLayers

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

Stores set of layers that are displayed on the top.

Definition at line 813 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 854 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 110 of file sch_view.h.

Referenced by Cleanup(), DisplaySheet(), GetItemsExtents(), and GetWorksheet().

◆ 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 850 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: