KiCad PCB EDA Suite
KIGFX::VIEW Class Reference

Class VIEW. More...

#include <view.h>

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

Classes

struct  changeItemsDepth
 
struct  clearLayerCache
 
struct  drawItem
 
struct  recacheItem
 
struct  updateItemsColor
 
struct  VIEW_LAYER
 

Public Types

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

Public Member Functions

 VIEW (bool aIsDynamic=true)
 Constructor. More...
 
virtual ~VIEW ()
 
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...
 
void SetScale (double aScale)
 Function SetScale() Sets the scaling factor. More...
 
void SetScale (double aScale, const VECTOR2D &aAnchor)
 Function SetScale() Sets the scaling factor, zooming around a given anchor point. More...
 
double GetScale () const
 Function GetScale() More...
 
void SetBoundary (const BOX2D &aBoundary)
 Function SetBoundary() Sets limits for view area. More...
 
void SetBoundary (const BOX2I &aBoundary)
 Function SetBoundary() Sets limits for view area. More...
 
const BOX2DGetBoundary () const
 Function GetBoundary() More...
 
void SetScaleLimits (double aMaximum, double aMinimum)
 Function SetScaleLimits() Sets minimum and maximum values for scale. More...
 
void SetCenter (const VECTOR2D &aCenter)
 Function SetCenter() Sets the center point of the VIEW (i.e. More...
 
void SetCenter (VECTOR2D aCenter, const BOX2D &occultingScreenRect)
 Function SetCenter() Sets the center point of the VIEW, attempting to avoid occultingScreenRect (for instance, the screen rect of a modeless dialog in front of the VIEW). More...
 
const VECTOR2DGetCenter () const
 Function GetCenter() Returns the center point of this VIEW (in world space coordinates) More...
 
VECTOR2D ToWorld (const VECTOR2D &aCoord, bool aAbsolute=true) const
 Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates. More...
 
double ToWorld (double aSize) const
 Function ToWorld() Converts a screen space one dimensional size to a one dimensional size in world space coordinates. More...
 
VECTOR2D ToScreen (const VECTOR2D &aCoord, bool aAbsolute=true) const
 Function ToScreen() Converts a world space point/vector to a point/vector in screen space coordinates. More...
 
double ToScreen (double aSize) const
 Function ToScreen() Converts a world space one dimensionsal size to a one dimensional size in screen space. More...
 
const VECTOR2IGetScreenPixelSize () const
 Function GetScreenPixelSize() Returns the size of the our rendering area, in pixels. More...
 
void AddLayer (int aLayer, bool aDisplayOnly=false)
 Function AddLayer() Adds a new layer to the view. More...
 
void ClearLayer (int aLayer)
 Function ClearLayer() Removes all items from a given layer. More...
 
void Clear ()
 Function Clear() Removes all items from the view. More...
 
void SetLayerVisible (int aLayer, bool aVisible=true)
 Function SetLayerVisible() Controls the visibility of a particular layer. More...
 
bool IsLayerVisible (int aLayer) const
 Function IsLayerVisible() Returns information about visibility of a particular layer. More...
 
void SetLayerDisplayOnly (int aLayer, bool aDisplayOnly=true)
 
void SetLayerTarget (int aLayer, RENDER_TARGET aTarget)
 Function SetLayerTarget() Changes the rendering target for a particular layer. More...
 
void SetLayerOrder (int aLayer, int aRenderingOrder)
 Function SetLayerOrder() Sets rendering order of a particular layer. More...
 
int GetLayerOrder (int aLayer) const
 Function GetLayerOrder() Returns rendering order of a particular layer. More...
 
void SortLayers (int aLayers[], int &aCount) const
 Function SortLayers() Changes the order of given layer ids, so after sorting the order corresponds to layers rendering order (descending, ie. More...
 
void ReorderLayerData (std::unordered_map< int, int > aReorderMap)
 Remaps the data between layer ids without invalidating that data. More...
 
void UpdateLayerColor (int aLayer)
 Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it has changed. More...
 
void UpdateAllLayersColor ()
 Function UpdateAllLayersColor() Applies the new coloring scheme to all layers. More...
 
virtual void SetTopLayer (int aLayer, bool aEnabled=true)
 Function SetTopLayer() Sets given layer to be displayed on the top or sets back the default order of layers. More...
 
virtual void EnableTopLayer (bool aEnable)
 Function EnableTopLayer() Enables or disables display of the top layer. More...
 
virtual int GetTopLayer () const
 
void ClearTopLayers ()
 Function ClearTopLayers() Removes all layers from the on-the-top set (they are no longer displayed over the rest of layers). More...
 
void UpdateAllLayersOrder ()
 Function UpdateLayerOrder() Does everything that is needed to apply the rendering order of layers. More...
 
void ClearTargets ()
 Function ClearTargets() Clears targets that are marked as dirty. More...
 
virtual void Redraw ()
 Function Redraw() Immediately redraws the whole view. More...
 
void RecacheAllItems ()
 Function RecacheAllItems() Rebuilds GAL display lists. More...
 
bool IsDynamic () const
 Function IsDynamic() Tells if the VIEW is dynamic (ie. More...
 
bool IsDirty () const
 Function IsDirty() Returns true if any of the VIEW layers needs to be refreshened. More...
 
bool IsTargetDirty (int aTarget) const
 Function IsTargetDirty() Returns true if any of layers belonging to the target or the target itself should be redrawn. More...
 
void MarkTargetDirty (int aTarget)
 Function MarkTargetDirty() Sets or clears target 'dirty' flag. More...
 
bool IsCached (int aLayer) const
 Returns true if the layer is cached. More...
 
void MarkDirty ()
 Function MarkDirty() Forces redraw of view on the next rendering. More...
 
void MarkForUpdate (VIEW_ITEM *aItem)
 Function MarkForUpdate() Adds an item to a list of items that are going to be refreshed upon the next frame rendering. More...
 
void UpdateItems ()
 Function UpdateItems() Iterates through the list of items that asked for updating and updates them. More...
 
void UpdateAllItems (int aUpdateFlags)
 Updates all items in the view according to the given flags. More...
 
void UpdateAllItemsConditionally (int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
 Updates items in the view according to the given flags and condition. More...
 
bool IsUsingDrawPriority () const
 Function IsUsingDrawPriority() More...
 
void UseDrawPriority (bool aFlag)
 Function UseDrawPriority() More...
 
bool IsDrawOrderReversed () const
 Function IsDrawOrderReversed() More...
 
void ReverseDrawOrder (bool aFlag)
 Function ReverseDrawOrder() Only takes effect if UseDrawPriority is true. More...
 
std::shared_ptr< VIEW_OVERLAYMakeOverlay ()
 
std::unique_ptr< VIEWDataReference () const
 Returns a new VIEW object that shares the same set of VIEW_ITEMs and LAYERs. More...
 
int GetPrintMode ()
 
void SetPrintMode (int aPrintMode)
 Set the printing mode. More...
 

Static Public Member Functions

static void OnDestroy (VIEW_ITEM *aItem)
 

Static Public Attributes

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

Protected Types

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

Protected Member Functions

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

Static Protected Member Functions

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

Protected Attributes

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

Horizontal flip flag

More...
 
bool m_mirrorY
 

Vertical flip flag

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

Static Protected Attributes

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

Friends

class VIEW_ITEM
 

Detailed Description

Class VIEW.

Holds a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the GAL. VIEWs can exist in two flavors:

  • dynamic - where items can be added, removed or changed anytime, intended for the main editing panel. Each VIEW_ITEM can be added to a single dynamic view.
  • static - where items are added once at the startup and are not linked with the VIEW. Foreseen for preview windows and printing. Items in a view are grouped in layers (not to be confused with Kicad's PCB layers). Each layer is identified by an integer number. Visibility and rendering order can be set individually for each of the layers. Future versions of the VIEW will also allows one to assign different layers to different rendering targets, which will be composited at the final stage by the GAL. The VIEW class also provides fast methods for finding all visible objects that are within a given rectangular area, useful for object selection/hit testing.

Definition at line 61 of file view.h.

Member Typedef Documentation

◆ LAYER_ITEM_PAIR

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

Definition at line 66 of file view.h.

◆ LAYER_MAP

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

Definition at line 727 of file view.h.

◆ LAYER_MAP_ITER

typedef LAYER_MAP::iterator KIGFX::VIEW::LAYER_MAP_ITER
protected

Definition at line 728 of file view.h.

◆ LAYER_ORDER

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

Definition at line 729 of file view.h.

◆ LAYER_ORDER_ITER

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

Definition at line 730 of file view.h.

Constructor & Destructor Documentation

◆ VIEW() [1/2]

KIGFX::VIEW::VIEW ( bool  aIsDynamic = true)

Constructor.

Parameters
aIsDynamicdecides whether we are creating a static or a dynamic VIEW.

Definition at line 286 of file view.cpp.

286  :
287  m_enableOrderModifier( true ),
288  m_scale( 4.0 ),
289  m_minScale( 0.2 ), m_maxScale( 25000.0 ),
290  m_mirrorX( false ), m_mirrorY( false ),
291  m_painter( NULL ),
292  m_gal( NULL ),
293  m_dynamic( aIsDynamic ),
294  m_useDrawPriority( false ),
295  m_nextDrawPriority( 0 ),
296  m_reverseDrawOrder( false )
297 {
298  // Set m_boundary to define the max area size. The default area size
299  // is defined here as the max value of a int.
300  // this is a default value acceptable for Pcbnew and Gerbview, but too large for Eeschema.
301  // So in eeschema a call to SetBoundary() with a smaller value will be needed.
302  typedef std::numeric_limits<int> coord_limits;
303  double pos = coord_limits::lowest() / 2 + coord_limits::epsilon();
304  double size = coord_limits::max() - coord_limits::epsilon();
305  m_boundary.SetOrigin( pos, pos );
306  m_boundary.SetSize( size, size );
307  SetPrintMode( 0 );
308 
309  m_allItems.reset( new std::vector<VIEW_ITEM*> );
310  m_allItems->reserve( 32768 );
311 
312  // Redraw everything at the beginning
313  MarkDirty();
314 
315  // View uses layers to display EDA_ITEMs (item may be displayed on several layers, for example
316  // pad may be shown on pad, pad hole and solder paste layers). There are usual copper layers
317  // (eg. F.Cu, B.Cu, internal and so on) and layers for displaying objects such as texts,
318  // silkscreen, pads, vias, etc.
319  for( int i = 0; i < VIEW_MAX_LAYERS; i++ )
320  AddLayer( i );
321 
322  sortLayers();
323 }
void AddLayer(int aLayer, bool aDisplayOnly=false)
Function AddLayer() Adds a new layer to the view.
Definition: view.cpp:331
bool m_useDrawPriority
Flat list of all items Flag to respect draw priority when drawing items.
Definition: view.h:873
void sortLayers()
Definition: view.cpp:1260
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:859
void SetSize(const Vec &size)
Definition: box2.h:210
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:712
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
Flat list of all items.
Definition: view.h:826
double m_minScale
Scale lower limit.
Definition: view.h:844
void SetPrintMode(int aPrintMode)
Set the printing mode.
Definition: view.h:710
bool m_mirrorX
Horizontal flip flag
Definition: view.h:850
bool m_dynamic
Dynamic VIEW (eg.
Definition: view.h:863
PAINTER * m_painter
PAINTER contains information how do draw items.
Definition: view.h:856
bool m_reverseDrawOrder
Flag to reverse the draw order when using draw priority.
Definition: view.h:879
int m_nextDrawPriority
The next sequential drawing priority.
Definition: view.h:876
double m_maxScale
Scale upper limit.
Definition: view.h:847
bool m_enableOrderModifier
Definition: view.h:820
#define max(a, b)
Definition: auxiliary.h:86
BOX2D m_boundary
View boundaries.
Definition: view.h:841
size_t i
Definition: json11.cpp:597
void SetOrigin(const Vec &pos)
Definition: box2.h:208
bool m_mirrorY
Vertical flip flag
Definition: view.h:853
double m_scale
Scale of displayed VIEW_ITEMs.
Definition: view.h:838
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:621

References AddLayer(), i, m_allItems, m_boundary, MarkDirty(), max, BOX2< Vec >::SetOrigin(), SetPrintMode(), BOX2< Vec >::SetSize(), sortLayers(), and VIEW_MAX_LAYERS.

◆ ~VIEW()

KIGFX::VIEW::~VIEW ( )
virtual

Definition at line 326 of file view.cpp.

327 {
328 }

◆ VIEW() [2/2]

KIGFX::VIEW::VIEW ( const VIEW )
protecteddelete

Member Function Documentation

◆ Add()

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

Function Add() Adds a VIEW_ITEM to the view.

Set aDrawPriority to -1 to assign sequential priorities.

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

Reimplemented in KIGFX::PCB_VIEW.

Definition at line 346 of file view.cpp.

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

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

Referenced by KIGFX::PCB_VIEW::Add(), SCH_BASE_FRAME::AddToScreen(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PCB_DRAW_PANEL_GAL::DisplayBoard(), KIGFX::SCH_VIEW::DisplayComponent(), SYMBOL_PREVIEW_WIDGET::DisplayPart(), KIGFX::SCH_VIEW::DisplaySheet(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), LIB_EDIT_TOOL::Duplicate(), GRID_HELPER::GRID_HELPER(), EE_POINT_EDITOR::Main(), MakeOverlay(), LIB_EDIT_TOOL::Paste(), DRAWING_TOOL::PlaceImportedGraphics(), DIALOG_PAD_PROPERTIES::prepareCanvas(), BOARD_COMMIT::Push(), GERBVIEW_FRAME::Read_EXCELLON_File(), DIALOG_PAD_PROPERTIES::redraw(), FOOTPRINT_PREVIEW_PANEL::renderFootprint(), PCB_EDITOR_CONTROL::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), BOARD_COMMIT::Revert(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PNS_KICAD_IFACE::SetView(), PNS_PCBNEW_DEBUG_DECORATOR::SetView(), PCB_DRAW_PANEL_GAL::SetWorksheet(), GERBVIEW_DRAW_PANEL_GAL::SetWorksheet(), GERBVIEW_DRAW_PANEL_GAL::SwitchBackend(), DIALOG_ERC::TestErc(), EE_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), LIB_VIEW_FRAME::updatePreviewSymbol(), and ZONE_CREATE_HELPER::ZONE_CREATE_HELPER().

◆ AddLayer()

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

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

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

Definition at line 331 of file view.cpp.

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

References m_layers, and KIGFX::TARGET_CACHED.

Referenced by VIEW().

◆ areRequiredLayersEnabled()

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

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

Definition at line 1383 of file view.cpp.

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

References m_layers.

Referenced by redrawRect().

◆ Clear()

void KIGFX::VIEW::Clear ( )

Function Clear() Removes all items from the view.

Definition at line 1110 of file view.cpp.

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

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

Referenced by PCB_DRAW_PANEL_GAL::DisplayBoard(), KIGFX::SCH_VIEW::DisplayComponent(), GERBVIEW_FRAME::OnCloseWindow(), FOOTPRINT_PREVIEW_PANEL::renderFootprint(), PCB_BASE_EDIT_FRAME::SetBoard(), GERBVIEW_DRAW_PANEL_GAL::SwitchBackend(), DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME(), FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME(), and GERBVIEW_FRAME::~GERBVIEW_FRAME().

◆ clearGroupCache()

void KIGFX::VIEW::clearGroupCache ( )
protected

Definition at line 1200 of file view.cpp.

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

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

Referenced by SetGAL().

◆ ClearLayer()

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

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

Parameters
aLayerID of the layer to be cleared

◆ ClearTargets()

void KIGFX::VIEW::ClearTargets ( )

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

Definition at line 1125 of file view.cpp.

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

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

Referenced by EDA_DRAW_PANEL_GAL::onPaint().

◆ ClearTopLayers()

void KIGFX::VIEW::ClearTopLayers ( )

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

Definition at line 911 of file view.cpp.

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

References m_enableOrderModifier, m_layers, m_topLayers, and TOP_LAYER_MODIFIER.

Referenced by 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 
)
inlinestaticprotected

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

Definition at line 811 of file view.h.

812  {
813  return aI->renderingOrder > aJ->renderingOrder;
814  }

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

Referenced by sortLayers().

◆ CopySettings()

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

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

Parameters
aOtherViewview from which settings will be copied.

Definition at line 513 of file view.cpp.

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

◆ DataReference()

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

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

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

References m_allItems, and m_layers.

Referenced by BOARD_PRINTOUT::DrawPage().

◆ draw() [1/3]

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

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

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

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

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

◆ draw() [2/3]

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

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

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

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

◆ draw() [3/3]

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

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

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

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

◆ EnableTopLayer()

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

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

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

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

Referenced by PCB_DRAW_PANEL_GAL::SetTopLayer().

◆ GetBoundary()

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

Function GetBoundary()

Returns
Current view area boundary.

Definition at line 298 of file view.h.

299  {
300  return m_boundary;
301  }
BOX2D m_boundary
View boundaries.
Definition: view.h:841

References m_boundary.

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

◆ GetCenter()

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

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

Returns
center point of the view

Definition at line 339 of file view.h.

340  {
341  return m_center;
342  }
VECTOR2D m_center
Center point of the VIEW (the point at which we are looking at)
Definition: view.h:835

References m_center.

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

◆ GetGAL()

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

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

References m_gal.

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

◆ GetLayerOrder()

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

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 }
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:823

References m_layers.

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

◆ GetPainter()

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

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

References m_painter.

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

◆ GetPrintMode()

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

Definition at line 703 of file view.h.

703 { 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:883

References m_printMode.

Referenced by D_PAD::ViewGetLOD().

◆ GetScale()

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

Function GetScale()

Returns
Current scale factor of this VIEW.

Definition at line 268 of file view.h.

269  {
270  return m_scale;
271  }
double m_scale
Scale of displayed VIEW_ITEMs.
Definition: view.h:838

References m_scale.

Referenced by KIGFX::WX_VIEW_CONTROLS::onWheel(), DIALOG_PAD_PROPERTIES::redraw(), SetViewport(), SCH_BASE_FRAME::Window_Zoom(), SCH_BASE_FRAME::Zoom_Automatique(), COMMON_TOOLS::ZoomFitScreen(), and SELECTION_TOOL::zoomFitSelection().

◆ GetScreenPixelSize()

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

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

Returns
viewport screen size

Definition at line 1176 of file view.cpp.

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

References KIGFX::GAL::GetScreenPixelSize(), and 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
virtual

Definition at line 850 of file view.cpp.

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

References 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

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

Returns
Current viewport rectangle

Definition at line 538 of file view.cpp.

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

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

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

◆ Hide()

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

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

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

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

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

◆ invalidateItem()

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

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

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

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

Referenced by UpdateItems().

◆ IsCached()

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

Returns true if the layer is cached.

Definition at line 603 of file view.h.

604  {
605  wxCHECK( aLayer < (int) m_layers.size(), false );
606 
607  try
608  {
609  return m_layers.at( aLayer ).target == TARGET_CACHED;
610  }
611  catch( const std::out_of_range& )
612  {
613  return false;
614  }
615  }
Main rendering target (cached)
Definition: definitions.h:48
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:823

References m_layers, and KIGFX::TARGET_CACHED.

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

◆ IsDirty()

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

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

569  {
570  for( int i = 0; i < TARGETS_NUMBER; ++i )
571  {
572  if( IsTargetDirty( i ) )
573  return true;
574  }
575 
576  return false;
577  }
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:585
size_t i
Definition: json11.cpp:597

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

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

◆ IsDrawOrderReversed()

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

Function IsDrawOrderReversed()

Returns
true if draw order is reversed

Definition at line 676 of file view.h.

677  {
678  return m_reverseDrawOrder;
679  }
bool m_reverseDrawOrder
Flag to reverse the draw order when using draw priority.
Definition: view.h:879

References m_reverseDrawOrder.

◆ IsDynamic()

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

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

559  {
560  return m_dynamic;
561  }
bool m_dynamic
Dynamic VIEW (eg.
Definition: view.h:863

References m_dynamic.

◆ IsLayerVisible()

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

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

Parameters
aLayertrue if the layer is visible, false otherwise

Definition at line 427 of file view.h.

428  {
429  wxCHECK( aLayer < (int) m_layers.size(), false );
430  return m_layers.at( aLayer ).visible;
431  }
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:823

References m_layers.

Referenced by KIGFX::VIEW_GROUP::ViewDraw(), EDGE_MODULE::ViewGetLOD(), TEXTE_MODULE::ViewGetLOD(), TRACK::ViewGetLOD(), MODULE::ViewGetLOD(), and D_PAD::ViewGetLOD().

◆ IsMirroredX()

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

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

Definition at line 230 of file view.h.

231  {
232  return m_mirrorX;
233  }
bool m_mirrorX
Horizontal flip flag
Definition: view.h:850

References m_mirrorX.

Referenced by COMMON_TOOLS::CursorControl(), KIGFX::WX_VIEW_CONTROLS::onScroll(), PCB_EDIT_FRAME::ReCreateMenuBar(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), KIGFX::WX_VIEW_CONTROLS::UpdateScrollbars(), and KIGFX::PREVIEW::SELECTION_AREA::ViewDraw().

◆ IsMirroredY()

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

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

References m_mirrorY.

◆ IsTargetDirty()

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

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

586  {
587  wxCHECK( aTarget < TARGETS_NUMBER, false );
588  return m_dirtyTargets[aTarget];
589  }
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:866

References m_dirtyTargets, and KIGFX::TARGETS_NUMBER.

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

◆ IsUsingDrawPriority()

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

Function IsUsingDrawPriority()

Returns
true if draw priority is being respected while redrawing.

Definition at line 658 of file view.h.

659  {
660  return m_useDrawPriority;
661  }
bool m_useDrawPriority
Flat list of all items Flag to respect draw priority when drawing items.
Definition: view.h:873

References m_useDrawPriority.

◆ IsVisible()

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

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

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

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

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

◆ MakeOverlay()

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

Definition at line 1553 of file view.cpp.

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

References Add().

Referenced by AUTOPLACE_TOOL::autoplace().

◆ MarkDirty()

void KIGFX::VIEW::MarkDirty ( )
inline

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

Definition at line 621 of file view.h.

622  {
623  for( int i = 0; i < TARGETS_NUMBER; ++i )
624  m_dirtyTargets[i] = true;
625  }
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:866
size_t i
Definition: json11.cpp:597

References i, m_dirtyTargets, and KIGFX::TARGETS_NUMBER.

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

◆ MarkForUpdate()

void KIGFX::VIEW::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.

Parameters
aItemis the item to be refreshed.

◆ markTargetClean()

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

Definition at line 745 of file view.h.

746  {
747  wxCHECK( aTarget < TARGETS_NUMBER, /* void */ );
748  m_dirtyTargets[aTarget] = false;
749  }
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:866

References m_dirtyTargets, and KIGFX::TARGETS_NUMBER.

Referenced by Redraw().

◆ MarkTargetDirty()

◆ OnDestroy()

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

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
virtual

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

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

Definition at line 452 of file view.cpp.

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

References i, and m_orderedLayers.

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

◆ RecacheAllItems()

void KIGFX::VIEW::RecacheAllItems ( )

Function RecacheAllItems() Rebuilds GAL display lists.

Definition at line 1401 of file view.cpp.

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

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

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

◆ Redraw()

void KIGFX::VIEW::Redraw ( )
virtual

Function Redraw() Immediately redraws the whole view.

Definition at line 1144 of file view.cpp.

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

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

Referenced by EE_POINT_EDITOR::Main(), and EDA_DRAW_PANEL_GAL::onPaint().

◆ redrawRect()

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

Definition at line 1009 of file view.cpp.

1010 {
1011  for( VIEW_LAYER* l : m_orderedLayers )
1012  {
1013  if( l->visible && IsTargetDirty( l->target ) && areRequiredLayersEnabled( l->id ) )
1014  {
1015  drawItem drawFunc( this, l->id, m_useDrawPriority, m_reverseDrawOrder );
1016 
1017  m_gal->SetTarget( l->target );
1018  m_gal->SetLayerDepth( l->renderingOrder );
1019  l->items->Query( aRect, drawFunc );
1020 
1021  if( m_useDrawPriority )
1022  drawFunc.deferredDraw();
1023  }
1024  }
1025 }
bool m_useDrawPriority
Flat list of all items Flag to respect draw priority when drawing items.
Definition: view.h:873
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:859
bool areRequiredLayersEnabled(int aLayerId) const
Checks if every layer required by the aLayerId layer is enabled.
Definition: view.cpp:1383
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:585
LAYER_ORDER m_orderedLayers
Sorted list of pointers to members of m_layers.
Definition: view.h:829
bool m_reverseDrawOrder
Flag to reverse the draw order when using draw priority.
Definition: view.h:879
virtual void SetTarget(RENDER_TARGET aTarget)
Sets the target for rendering.

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

Referenced by Redraw().

◆ Remove()

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

Function Remove() Removes a VIEW_ITEM from the view.

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

Reimplemented in KIGFX::PCB_VIEW.

Definition at line 376 of file view.cpp.

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

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SYMBOL_PREVIEW_WIDGET::DisplayPart(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), EE_POINT_EDITOR::Main(), DRAWING_TOOL::PlaceImportedGraphics(), BOARD_COMMIT::Push(), KIGFX::PCB_VIEW::Remove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), SCH_BASE_FRAME::RemoveFromScreen(), PCB_EDITOR_CONTROL::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), BOARD_COMMIT::Revert(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::unselect(), EE_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), LIB_VIEW_FRAME::updatePreviewSymbol(), CVPCB_SELECTION_TOOL::~CVPCB_SELECTION_TOOL(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), LIB_VIEW_FRAME::~LIB_VIEW_FRAME(), SELECTION_TOOL::~SELECTION_TOOL(), SYMBOL_PREVIEW_WIDGET::~SYMBOL_PREVIEW_WIDGET(), and ZONE_CREATE_HELPER::~ZONE_CREATE_HELPER().

◆ ReorderLayerData()

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

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

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

Referenced by GERBVIEW_FRAME::SortLayersByX2Attributes().

◆ ReverseDrawOrder()

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

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

Parameters
aFlagis true if draw order should be reversed

Definition at line 686 of file view.h.

687  {
688  m_reverseDrawOrder = aFlag;
689  }
bool m_reverseDrawOrder
Flag to reverse the draw order when using draw priority.
Definition: view.h:879

References m_reverseDrawOrder.

Referenced by EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ SetBoundary() [1/2]

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

Function SetBoundary() Sets limits for view area.

Parameters
aBoundaryis the box that limits view area.

Definition at line 278 of file view.h.

279  {
280  m_boundary = aBoundary;
281  }
BOX2D m_boundary
View boundaries.
Definition: view.h:841

References m_boundary.

Referenced by DIALOG_PAD_PROPERTIES::redraw().

◆ SetBoundary() [2/2]

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

Function SetBoundary() Sets limits for view area.

Parameters
aBoundaryis the box that limits view area.

Definition at line 288 of file view.h.

289  {
290  m_boundary.SetOrigin( aBoundary.GetOrigin() );
291  m_boundary.SetEnd( aBoundary.GetEnd() );
292  }
const Vec GetEnd() const
Definition: box2.h:193
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:223
BOX2D m_boundary
View boundaries.
Definition: view.h:841
void SetOrigin(const Vec &pos)
Definition: box2.h:208
const Vec & GetOrigin() const
Definition: box2.h:191

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

◆ SetCenter() [1/2]

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

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

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

References KIGFX::GAL::ComputeWorldScreenMatrix(), BOX2< Vec >::Contains(), BOX2< Vec >::GetBottom(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetTop(), m_boundary, m_center, m_gal, 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(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), DIALOG_DRC_CONTROL::doSelectionMenu(), SELECTION_TOOL::findCallback(), 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(), SetCenter(), KIGFX::WX_VIEW_CONTROLS::SetCrossHairCursorPosition(), SetGAL(), SetScale(), SetViewport(), EDA_DRAW_FRAME::UseGalCanvas(), KIGFX::WX_VIEW_CONTROLS::WarpCursor(), SCH_BASE_FRAME::Window_Zoom(), SCH_BASE_FRAME::Zoom_Automatique(), COMMON_TOOLS::ZoomFitScreen(), and SELECTION_TOOL::zoomFitSelection().

◆ SetCenter() [2/2]

void KIGFX::VIEW::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).

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

Definition at line 626 of file view.cpp.

627 {
628  BOX2D screenRect( VECTOR2D( 0, 0 ), m_gal->GetScreenPixelSize() );
629 
630  if( !screenRect.Intersects( occultingScreenRect ) )
631  {
632  SetCenter( aCenter );
633  return;
634  }
635 
636  BOX2D occultedRect = screenRect.Intersect( occultingScreenRect );
637  VECTOR2D offset( occultedRect.GetWidth() / 2, occultedRect.GetHeight() / 2 );
638 
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( occultedRect.GetHeight() / 2 );
648  else
649  aCenter.y -= ToWorld( occultedRect.GetHeight() / 2 );
650  }
651  else
652  {
653  if( leftExposed > rightExposed )
654  aCenter.x += ToWorld( occultedRect.GetWidth() / 2 );
655  else
656  aCenter.x -= ToWorld( occultedRect.GetWidth() / 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:475
coord_type GetTop() const
Definition: box2.h:202
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:859
coord_type GetRight() const
Definition: box2.h:197
coord_type GetBottom() const
Definition: box2.h:198
const VECTOR2I & GetScreenPixelSize() const
Returns GAL canvas size in pixels.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:601
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
coord_type GetWidth() const
Definition: box2.h:195
#define max(a, b)
Definition: auxiliary.h:86
coord_type GetHeight() const
Definition: box2.h:196
coord_type GetLeft() const
Definition: box2.h:201
BOX2< Vec > Intersect(const BOX2< Vec > &aRect)
Function Intersect Returns the intersection of this with another rectangle.
Definition: box2.h:266

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

◆ SetGAL()

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

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

Parameters
aGalpointer to the GAL output device

Definition at line 519 of file view.cpp.

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

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

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

◆ SetLayerDisplayOnly()

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

Definition at line 433 of file view.h.

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

References m_layers.

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

◆ SetLayerOrder()

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

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:1260
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:823

References m_layers, and sortLayers().

Referenced by 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 
)
inline

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

Parameters
aLayeris the layer.
aTargetis the rendering target.

Definition at line 445 of file view.h.

446  {
447  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
448  m_layers[aLayer].target = aTarget;
449  }
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:823

References m_layers.

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

◆ SetLayerVisible()

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

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

Parameters
aLayerthe layer to show/hide.
aVisiblethe obvious.

Definition at line 410 of file view.h.

411  {
412  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
413 
414  if( m_layers[aLayer].visible != aVisible )
415  {
416  // Target has to be redrawn after changing its visibility
417  MarkTargetDirty( m_layers[aLayer].target );
418  m_layers[aLayer].visible = aVisible;
419  }
420  }
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:596
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:823

References m_layers, and MarkTargetDirty().

Referenced by PCB_LAYER_WIDGET::OnLayerVisible(), PCB_LAYER_WIDGET::OnRenderEnable(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), and PCB_DRAW_PANEL_GAL::SyncLayersVisibility().

◆ SetMirror()

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

Function SetMirror() Controls the mirroring of the VIEW.

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

Definition at line 565 of file view.cpp.

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

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

Referenced by SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), and SetGAL().

◆ SetPainter()

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

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

References m_painter.

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

◆ SetPrintMode()

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

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

710 { 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:883

References m_printMode.

Referenced by VIEW().

◆ SetRequired()

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

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

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

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

Definition at line 416 of file view.cpp.

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

References m_layers.

Referenced by PCB_DRAW_PANEL_GAL::setDefaultLayerDeps().

◆ SetScale() [1/2]

void KIGFX::VIEW::SetScale ( double  aScale)
inline

Function SetScale() Sets the scaling factor.

Scale = 1 corresponds to the real world size of the objects (depending on correct GAL unit length & DPI settings).

Parameters
aScalethe scalefactor

Definition at line 250 of file view.h.

251  {
252  SetScale( aScale, m_center );
253  }
void SetScale(double aScale)
Function SetScale() Sets the scaling factor.
Definition: view.h:250
VECTOR2D m_center
Center point of the VIEW (the point at which we are looking at)
Definition: view.h:835

References m_center.

Referenced by COMMON_TOOLS::doZoomToPreset(), SYMBOL_PREVIEW_WIDGET::fitOnDrawArea(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), KIGFX::WX_VIEW_CONTROLS::onWheel(), DIALOG_PAD_PROPERTIES::redraw(), SCH_BASE_FRAME::RedrawScreen(), SCH_BASE_FRAME::RedrawScreen2(), FOOTPRINT_PREVIEW_PANEL::renderFootprint(), SetGAL(), SetViewport(), EDA_DRAW_FRAME::UseGalCanvas(), SCH_BASE_FRAME::Window_Zoom(), SCH_BASE_FRAME::Zoom_Automatique(), COMMON_TOOLS::ZoomFitScreen(), and SELECTION_TOOL::zoomFitSelection().

◆ SetScale() [2/2]

void KIGFX::VIEW::SetScale ( double  aScale,
const VECTOR2D aAnchor 
)

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

Definition at line 578 of file view.cpp.

579 {
580  VECTOR2D a = ToScreen( aAnchor );
581 
582  if( aScale < m_minScale )
584  else if( aScale > m_maxScale )
586  else
587  m_scale = aScale;
588 
591 
592  VECTOR2D delta = ToWorld( a ) - aAnchor;
593 
594  SetCenter( m_center - delta );
595 
596  // Redraw everything after the viewport has changed
597  MarkDirty();
598 }
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:475
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:859
virtual void ComputeWorldScreenMatrix()
Compute the world <-> screen transformation matrix.
static const int delta[8][2]
Definition: solve.cpp:112
VECTOR2D m_center
Center point of the VIEW (the point at which we are looking at)
Definition: view.h:835
double m_minScale
Scale lower limit.
Definition: view.h:844
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:601
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...
Definition: view.cpp:494
double m_maxScale
Scale upper limit.
Definition: view.h:847
void SetZoomFactor(double aZoomFactor)
Set the zoom factor of the scene.
double m_scale
Scale of displayed VIEW_ITEMs.
Definition: view.h:838
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:621

References KIGFX::GAL::ComputeWorldScreenMatrix(), delta, m_center, m_gal, m_maxScale, m_minScale, m_scale, MarkDirty(), SetCenter(), KIGFX::GAL::SetZoomFactor(), ToScreen(), and ToWorld().

◆ SetScaleLimits()

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

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

310  {
311  wxASSERT_MSG( aMaximum > aMinimum, wxT( "I guess you passed parameters in wrong order" ) );
312 
313  m_minScale = aMinimum;
314  m_maxScale = aMaximum;
315  }
double m_minScale
Scale lower limit.
Definition: view.h:844
double m_maxScale
Scale upper limit.
Definition: view.h:847

References m_maxScale, and m_minScale.

Referenced by SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL().

◆ SetTopLayer()

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

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

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

References m_enableOrderModifier, m_layers, m_topLayers, and TOP_LAYER_MODIFIER.

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

◆ SetViewport()

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

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

Parameters
aViewportdesired visible area, in world space coordinates.

Definition at line 550 of file view.cpp.

551 {
552  VECTOR2D ssize = ToWorld( m_gal->GetScreenPixelSize(), false );
553 
554  wxCHECK( ssize.x > 0 && ssize.y > 0, /*void*/ );
555 
556  VECTOR2D centre = aViewport.Centre();
557  VECTOR2D vsize = aViewport.GetSize();
558  double zoom = 1.0 / std::max( fabs( vsize.x / ssize.x ), fabs( vsize.y / ssize.y ) );
559 
560  SetCenter( centre );
561  SetScale( GetScale() * zoom );
562 }
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:475
GAL * m_gal
Gives interface to PAINTER, that is used to draw items.
Definition: view.h:859
void SetScale(double aScale)
Function SetScale() Sets the scaling factor.
Definition: view.h:250
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:601
Vec Centre() const
Definition: box2.h:77
#define max(a, b)
Definition: auxiliary.h:86
const Vec & GetSize() const
Definition: box2.h:187
double GetScale() const
Function GetScale()
Definition: view.h:268

References BOX2< Vec >::Centre(), GetScale(), KIGFX::GAL::GetScreenPixelSize(), BOX2< Vec >::GetSize(), m_gal, max, SetCenter(), SetScale(), 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 
)

Sets the item visibility.

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

Definition at line 1485 of file view.cpp.

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

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

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

◆ SortLayers()

void KIGFX::VIEW::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.

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
size_t i
Definition: json11.cpp:597

References GetLayerOrder(), and i.

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

◆ sortLayers()

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

Definition at line 1260 of file view.cpp.

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

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

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

◆ ToScreen() [1/2]

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

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

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

Definition at line 494 of file view.cpp.

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

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

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

◆ ToScreen() [2/2]

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

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

Parameters
aSizethe size to be transformed.

Definition at line 505 of file view.cpp.

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

◆ ToWorld() [1/2]

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

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

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

Definition at line 475 of file view.cpp.

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

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

Referenced by EE_POINT_EDITOR::addCornerCondition(), COMMON_TOOLS::CenterContents(), EDIT_POINTS::FindPoint(), SYMBOL_PREVIEW_WIDGET::fitOnDrawArea(), GENERAL_COLLECTORS_GUIDE::GENERAL_COLLECTORS_GUIDE(), KIGFX::WX_VIEW_CONTROLS::GetMousePosition(), GetViewport(), KIGFX::WX_VIEW_CONTROLS::onMotion(), KIGFX::WX_VIEW_CONTROLS::onScroll(), KIGFX::WX_VIEW_CONTROLS::onTimer(), KIGFX::WX_VIEW_CONTROLS::onWheel(), Redraw(), KIGFX::WX_VIEW_CONTROLS::refreshMouse(), GERBVIEW_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), SetCenter(), SetScale(), SetViewport(), KIGFX::ORIGIN_VIEWITEM::ViewDraw(), EDIT_POINTS::ViewDraw(), SCH_BASE_FRAME::Window_Zoom(), SCH_BASE_FRAME::Zoom_Automatique(), COMMON_TOOLS::ZoomFitScreen(), and SELECTION_TOOL::zoomFitSelection().

◆ ToWorld() [2/2]

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

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

Parameters
aSize: the size to be converted

Definition at line 486 of file view.cpp.

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

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

◆ Update() [1/2]

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

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

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

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

Referenced by Add(), PNS_PCBNEW_DEBUG_DECORATOR::AddLine(), KIGFX::SCH_VIEW::AddToPreview(), GRID_HELPER::BestSnapAnchor(), PNS_PCBNEW_DEBUG_DECORATOR::Clear(), KIGFX::SCH_VIEW::ClearPreview(), EE_SELECTION_TOOL::clearSelection(), PNS_KICAD_IFACE::DisplayItem(), draw(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), PCB_EDIT_FRAME::Edit_Zone_Params(), SCH_EDIT_FRAME::EditSheet(), MODULE_EDITOR_TOOLS::EnumeratePads(), PNS_KICAD_IFACE::EraseView(), Hide(), PNS_KICAD_IFACE::HideItem(), EE_SELECTION_TOOL::highlight(), EDIT_TOOL::MoveExact(), SCH_EDIT_FRAME::OnFindReplace(), ZONE_CREATE_HELPER::OnGeometryChange(), KIGFX::VIEW::recacheItem::operator()(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), processBoardItem(), BOARD_COMMIT::Push(), DIALOG_PAD_PROPERTIES::redraw(), PCB_DRAW_PANEL_GAL::RedrawRatsnest(), refreshCallback(), SCH_BASE_FRAME::RefreshItem(), FOOTPRINT_PREVIEW_PANEL::renderFootprint(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectVisually(), SetVisible(), PCB_EDIT_FRAME::Swap_Layers(), SCH_EDIT_FRAME::TestDanglingEnds(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow(), EE_SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselectVisually(), KIGFX::PCB_VIEW::Update(), Update(), EE_POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), and EE_TOOL_BASE< SCH_BASE_FRAME >::updateView().

◆ Update() [2/2]

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

Reimplemented in KIGFX::PCB_VIEW.

Definition at line 1533 of file view.cpp.

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

References KIGFX::ALL, and Update().

◆ UpdateAllItems()

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

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

Parameters
aUpdateFlagsis is according to KIGFX::VIEW_UPDATE_FLAGS

Definition at line 1443 of file view.cpp.

1444 {
1445  for( VIEW_ITEM* item : *m_allItems )
1446  {
1447  auto viewData = item->viewPrivData();
1448 
1449  if( !viewData )
1450  continue;
1451 
1452  viewData->m_requiredUpdate |= aUpdateFlags;
1453  }
1454 }
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:826

References m_allItems.

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

◆ UpdateAllItemsConditionally()

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

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

1459 {
1460  for( VIEW_ITEM* item : *m_allItems )
1461  {
1462  if( aCondition( item ) )
1463  {
1464  auto viewData = item->viewPrivData();
1465 
1466  if( !viewData )
1467  continue;
1468 
1469  viewData->m_requiredUpdate |= aUpdateFlags;
1470  }
1471  }
1472 }
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:826

References m_allItems.

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

◆ UpdateAllLayersColor()

void KIGFX::VIEW::UpdateAllLayersColor ( )

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

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

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

Referenced by PCB_EDITOR_CONTROL::ClearHighlight(), EnableTopLayer(), PNS::TOOL_BASE::highlightNet(), PCB_EDITOR_CONTROL::HighlightNet(), highlightNet(), GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer(), PCB_DRAW_PANEL_GAL::SetHighContrastLayer(), and EDA_DRAW_PANEL_GAL::SetHighContrastLayer().

◆ UpdateAllLayersOrder()

void KIGFX::VIEW::UpdateAllLayersOrder ( )

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

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

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

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

◆ updateBbox()

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

Updates bounding box of an item.

Definition at line 1324 of file view.cpp.

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

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

Referenced by invalidateItem().

◆ updateItemColor()

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

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

Definition at line 1275 of file view.cpp.

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

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

Referenced by invalidateItem().

◆ updateItemGeometry()

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

Updates all informations needed to draw an item.

Definition at line 1294 of file view.cpp.

1295 {
1296  auto viewData = aItem->viewPrivData();
1297  wxCHECK( (unsigned) aLayer < m_layers.size(), /*void*/ );
1298  wxCHECK( IsCached( aLayer ), /*void*/ );
1299 
1300  if( !viewData )
1301  return;
1302 
1303  VIEW_LAYER& l = m_layers.at( aLayer );
1304 
1305  m_gal->SetTarget( l.target );
1306  m_gal->SetLayerDepth( l.renderingOrder );
1307 
1308  // Redraw the item from scratch
1309  int group = viewData->getGroup( aLayer );
1310 
1311  if( group >= 0 )
1312  m_gal->DeleteGroup( group );
1313 
1314  group = m_gal->BeginGroup();
1315  viewData->setGroup( aLayer, group );
1316 
1317  if( !m_painter->Draw( static_cast<EDA_ITEM*>( aItem ), aLayer ) )
1318  aItem->ViewDraw( aLayer, this ); // Alternative drawing method
1319 
1320  m_gal->EndGroup();
1321 }
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:859
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:856
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:603
LAYER_MAP m_layers
Contains set of possible displayed layers and its properties.
Definition: view.h:823
virtual void SetTarget(RENDER_TARGET aTarget)
Sets the target for rendering.

References KIGFX::GAL::BeginGroup(), KIGFX::GAL::DeleteGroup(), KIGFX::PAINTER::Draw(), KIGFX::GAL::EndGroup(), IsCached(), m_gal, m_layers, 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 invalidateItem().

◆ UpdateItems()

void KIGFX::VIEW::UpdateItems ( )

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

Definition at line 1420 of file view.cpp.

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

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

Referenced by EE_SELECTION_TOOL::doSelectionMenu(), EDA_DRAW_PANEL_GAL::onPaint(), PCB_DRAW_PANEL_GAL::OnShow(), and ReorderLayerData().

◆ UpdateLayerColor()

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

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

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

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

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

◆ updateLayers()

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

Updates set of layers that an item occupies.

Definition at line 1340 of file view.cpp.

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

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

Referenced by invalidateItem().

◆ UseDrawPriority()

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

Function UseDrawPriority()

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

Definition at line 667 of file view.h.

668  {
669  m_useDrawPriority = aFlag;
670  }
bool m_useDrawPriority
Flat list of all items Flag to respect draw priority when drawing items.
Definition: view.h:873

References m_useDrawPriority.

Referenced by GERBVIEW_FRAME::GERBVIEW_FRAME().

Friends And Related Function Documentation

◆ VIEW_ITEM

friend class VIEW_ITEM
friend

Definition at line 64 of file view.h.

Member Data Documentation

◆ m_allItems

std::shared_ptr<std::vector<VIEW_ITEM*> > KIGFX::VIEW::m_allItems
protected

◆ m_boundary

BOX2D KIGFX::VIEW::m_boundary
protected

◆ m_center

VECTOR2D KIGFX::VIEW::m_center
protected

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

Definition at line 835 of file view.h.

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

◆ m_dirtyTargets

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

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

Definition at line 866 of file view.h.

Referenced by IsTargetDirty(), MarkDirty(), markTargetClean(), and MarkTargetDirty().

◆ m_dynamic

bool KIGFX::VIEW::m_dynamic
protected

Dynamic VIEW (eg.

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

Definition at line 863 of file view.h.

Referenced by IsDynamic().

◆ m_enableOrderModifier

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

Definition at line 820 of file view.h.

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

◆ m_gal

◆ m_layers

◆ m_maxScale

double KIGFX::VIEW::m_maxScale
protected

Scale upper limit.

Definition at line 847 of file view.h.

Referenced by SetScale(), and SetScaleLimits().

◆ m_minScale

double KIGFX::VIEW::m_minScale
protected

Scale lower limit.

Definition at line 844 of file view.h.

Referenced by SetScale(), and SetScaleLimits().

◆ m_mirrorX

bool KIGFX::VIEW::m_mirrorX
protected

Horizontal flip flag

Definition at line 850 of file view.h.

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

◆ m_mirrorY

bool KIGFX::VIEW::m_mirrorY
protected

Vertical flip flag

Definition at line 853 of file view.h.

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

◆ m_nextDrawPriority

int KIGFX::VIEW::m_nextDrawPriority
protected

The next sequential drawing priority.

Definition at line 876 of file view.h.

Referenced by Add(), and Clear().

◆ m_orderedLayers

LAYER_ORDER KIGFX::VIEW::m_orderedLayers
protected

Sorted list of pointers to members of m_layers.

Definition at line 829 of file view.h.

Referenced by Query(), redrawRect(), and sortLayers().

◆ m_painter

PAINTER* KIGFX::VIEW::m_painter
protected

PAINTER contains information how do draw items.

Definition at line 856 of file view.h.

Referenced by draw(), GetPainter(), SetPainter(), UpdateAllLayersColor(), updateItemColor(), updateItemGeometry(), and UpdateLayerColor().

◆ m_printMode

int KIGFX::VIEW::m_printMode
protected

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

Referenced by GetPrintMode(), and SetPrintMode().

◆ m_reverseDrawOrder

bool KIGFX::VIEW::m_reverseDrawOrder
protected

Flag to reverse the draw order when using draw priority.

Definition at line 879 of file view.h.

Referenced by IsDrawOrderReversed(), redrawRect(), and ReverseDrawOrder().

◆ m_scale

double KIGFX::VIEW::m_scale
protected

Scale of displayed VIEW_ITEMs.

Definition at line 838 of file view.h.

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

◆ m_topLayers

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

Stores set of layers that are displayed on the top.

Definition at line 832 of file view.h.

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

◆ m_useDrawPriority

bool KIGFX::VIEW::m_useDrawPriority
protected

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

Definition at line 873 of file view.h.

Referenced by IsUsingDrawPriority(), redrawRect(), and UseDrawPriority().

◆ TOP_LAYER_MODIFIER

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

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

Definition at line 869 of file view.h.

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

◆ VIEW_MAX_LAYERS


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