KiCad PCB EDA Suite
view.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2013-2016 CERN
5  * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
27 #ifndef __VIEW_H
28 #define __VIEW_H
29 
30 #include <vector>
31 #include <set>
32 #include <unordered_map>
33 #include <memory>
34 
35 #include <math/box2.h>
36 #include <gal/definitions.h>
37 
38 #include <view/view_overlay.h>
39 
40 class EDA_ITEM;
41 
42 namespace KIGFX
43 {
44 class PAINTER;
45 class GAL;
46 class VIEW_ITEM;
47 class VIEW_GROUP;
48 class VIEW_RTREE;
49 
67 class VIEW
68 {
69 public:
70  friend class VIEW_ITEM;
71 
72  typedef std::pair<VIEW_ITEM*, int> LAYER_ITEM_PAIR;
73 
77  VIEW( bool aIsDynamic = true );
78 
79  virtual ~VIEW();
80 
88  static void OnDestroy( VIEW_ITEM* aItem );
89 
98  virtual void Add( VIEW_ITEM* aItem, int aDrawPriority = -1 );
99 
105  virtual void Remove( VIEW_ITEM* aItem );
106 
107 
117  virtual int Query( const BOX2I& aRect, std::vector<LAYER_ITEM_PAIR>& aResult ) const;
118 
125  void SetVisible( VIEW_ITEM* aItem, bool aIsVisible = true );
126 
133  void Hide( VIEW_ITEM* aItem, bool aHide = true );
134 
142  bool IsVisible( const VIEW_ITEM* aItem ) const;
143 
151  virtual void Update( const VIEW_ITEM* aItem, int aUpdateFlags ) const;
152  virtual void Update( const VIEW_ITEM* aItem ) const;
153 
162  void SetRequired( int aLayerId, int aRequiredId, bool aRequired = true );
163 
169  void CopySettings( const VIEW* aOtherView );
170 
171  /*
172  * Convenience wrappers for adding multiple items
173  * template <class T> void AddItems( const T& aItems );
174  * template <class T> void RemoveItems( const T& aItems );
175  */
176 
182  void SetGAL( GAL* aGal );
183 
189  inline GAL* GetGAL() const
190  {
191  return m_gal;
192  }
193 
197  inline void SetPainter( PAINTER* aPainter )
198  {
199  m_painter = aPainter;
200  }
201 
207  inline PAINTER* GetPainter() const
208  {
209  return m_painter;
210  }
211 
217  void SetViewport( const BOX2D& aViewport );
218 
224  BOX2D GetViewport() const;
225 
232  void SetMirror( bool aMirrorX, bool aMirrorY );
233 
237  bool IsMirroredX() const
238  {
239  return m_mirrorX;
240  }
241 
245  bool IsMirroredY() const
246  {
247  return m_mirrorY;
248  }
249 
258  virtual void SetScale( double aScale, VECTOR2D aAnchor = { 0, 0 } );
259 
263  inline double GetScale() const
264  {
265  return m_scale;
266  }
267 
273  inline void SetBoundary( const BOX2D& aBoundary )
274  {
275  m_boundary = aBoundary;
276  }
277 
283  inline void SetBoundary( const BOX2I& aBoundary )
284  {
285  m_boundary.SetOrigin( aBoundary.GetOrigin() );
286  m_boundary.SetEnd( aBoundary.GetEnd() );
287  }
288 
292  inline const BOX2D& GetBoundary() const
293  {
294  return m_boundary;
295  }
296 
303  void SetScaleLimits( double aMaximum, double aMinimum )
304  {
305  wxASSERT_MSG( aMaximum > aMinimum, wxT( "I guess you passed parameters in wrong order" ) );
306 
307  m_minScale = aMinimum;
308  m_maxScale = aMaximum;
309  }
310 
317  void SetCenter( const VECTOR2D& aCenter );
318 
326  void SetCenter( const VECTOR2D& aCenter, const BOX2D& occultingScreenRect );
327 
333  const VECTOR2D& GetCenter() const
334  {
335  return m_center;
336  }
337 
344  VECTOR2D ToWorld( const VECTOR2D& aCoord, bool aAbsolute = true ) const;
345 
352  double ToWorld( double aSize ) const;
353 
360  VECTOR2D ToScreen( const VECTOR2D& aCoord, bool aAbsolute = true ) const;
361 
367  double ToScreen( double aSize ) const;
368 
374  const VECTOR2I& GetScreenPixelSize() const;
375 
379  void Clear();
380 
387  inline void SetLayerVisible( int aLayer, bool aVisible = true )
388  {
389  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
390 
391  if( m_layers[aLayer].visible != aVisible )
392  {
393  // Target has to be redrawn after changing its visibility
394  MarkTargetDirty( m_layers[aLayer].target );
395  m_layers[aLayer].visible = aVisible;
396  }
397  }
398 
404  inline bool IsLayerVisible( int aLayer ) const
405  {
406  wxCHECK( aLayer >= 0, false);
407  wxCHECK( aLayer < (int) m_layers.size(), false );
408 
409  return m_layers.at( aLayer ).visible;
410  }
411 
412  inline void SetLayerDisplayOnly( int aLayer, bool aDisplayOnly = true )
413  {
414  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
415  m_layers[aLayer].displayOnly = aDisplayOnly;
416  }
417 
424  inline void SetLayerTarget( int aLayer, RENDER_TARGET aTarget )
425  {
426  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
427  m_layers[aLayer].target = aTarget;
428  }
429 
436  void SetLayerOrder( int aLayer, int aRenderingOrder );
437 
444  int GetLayerOrder( int aLayer ) const;
445 
454  void SortLayers( int aLayers[], int& aCount ) const;
455 
463  void ReorderLayerData( std::unordered_map<int, int> aReorderMap );
464 
471  void UpdateLayerColor( int aLayer );
472 
478  void UpdateAllLayersColor();
479 
487  virtual void SetTopLayer( int aLayer, bool aEnabled = true );
488 
498  virtual void EnableTopLayer( bool aEnable );
499 
500  virtual int GetTopLayer() const;
501 
506  void ClearTopLayers();
507 
513  void UpdateAllLayersOrder();
514 
518  void ClearTargets();
519 
523  virtual void Redraw();
524 
528  void RecacheAllItems();
529 
534  bool IsDynamic() const
535  {
536  return m_dynamic;
537  }
538 
544  bool IsDirty() const
545  {
546  for( int i = 0; i < TARGETS_NUMBER; ++i )
547  {
548  if( IsTargetDirty( i ) )
549  return true;
550  }
551 
552  return false;
553  }
554 
561  bool IsTargetDirty( int aTarget ) const
562  {
563  wxCHECK( aTarget < TARGETS_NUMBER, false );
564  return m_dirtyTargets[aTarget];
565  }
566 
572  inline void MarkTargetDirty( int aTarget )
573  {
574  wxCHECK( aTarget < TARGETS_NUMBER, /* void */ );
575  m_dirtyTargets[aTarget] = true;
576  }
577 
579  inline bool IsCached( int aLayer ) const
580  {
581  wxCHECK( aLayer < (int) m_layers.size(), false );
582 
583  try
584  {
585  return m_layers.at( aLayer ).target == TARGET_CACHED;
586  }
587  catch( const std::out_of_range& )
588  {
589  return false;
590  }
591  }
592 
596  void MarkDirty()
597  {
598  for( int i = 0; i < TARGETS_NUMBER; ++i )
599  m_dirtyTargets[i] = true;
600  }
601 
607  void MarkForUpdate( VIEW_ITEM* aItem );
608 
612  void UpdateItems();
613 
619  void UpdateAllItems( int aUpdateFlags );
620 
627  void UpdateAllItemsConditionally( int aUpdateFlags,
628  std::function<bool( VIEW_ITEM* )> aCondition );
629 
633  bool IsUsingDrawPriority() const
634  {
635  return m_useDrawPriority;
636  }
637 
641  void UseDrawPriority( bool aFlag )
642  {
643  m_useDrawPriority = aFlag;
644  }
645 
649  bool IsDrawOrderReversed() const
650  {
651  return m_reverseDrawOrder;
652  }
653 
659  void ReverseDrawOrder( bool aFlag )
660  {
661  m_reverseDrawOrder = aFlag;
662  }
663 
664  std::shared_ptr<VIEW_OVERLAY> MakeOverlay();
665 
666  void InitPreview();
667 
668  void ClearPreview();
669  void AddToPreview( EDA_ITEM* aItem, bool aTakeOwnership = true );
670 
671  void ShowPreview( bool aShow = true );
672 
678  std::unique_ptr<VIEW> DataReference() const;
679 
680  static constexpr int VIEW_MAX_LAYERS = 512;
681 
682 protected:
683  struct VIEW_LAYER
684  {
685  bool visible;
686  bool displayOnly;
687  std::shared_ptr<VIEW_RTREE> items;
689  int id;
691  std::set<int> requiredLayers;
692  };
694 
695 
696 
697  VIEW( const VIEW& ) = delete;
698 
700  void redrawRect( const BOX2I& aRect );
701 
702  inline void markTargetClean( int aTarget )
703  {
704  wxCHECK( aTarget < TARGETS_NUMBER, /* void */ );
705  m_dirtyTargets[aTarget] = false;
706  }
707 
719  void draw( VIEW_ITEM* aItem, int aLayer, bool aImmediate = false );
720 
728  void draw( VIEW_ITEM* aItem, bool aImmediate = false );
729 
737  void draw( VIEW_GROUP* aGroup, bool aImmediate = false );
738 
740  void sortLayers();
741 
744  void clearGroupCache();
745 
752  void invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags );
753 
755  void updateItemColor( VIEW_ITEM* aItem, int aLayer );
756 
758  void updateItemGeometry( VIEW_ITEM* aItem, int aLayer );
759 
761  void updateBbox( VIEW_ITEM* aItem );
762 
764  void updateLayers( VIEW_ITEM* aItem );
765 
768  {
769  return aI->renderingOrder > aJ->renderingOrder;
770  }
771 
773  bool areRequiredLayersEnabled( int aLayerId ) const;
774 
775  // Function objects that need to access VIEW/VIEW_ITEM private/protected members
776  struct CLEAR_LAYER_CACHE_VISITOR;
777  struct RECACHE_ITEM_VISITOR;
778  struct DRAW_ITEM_VISITOR;
779  struct UPDATE_COLOR_VISITOR;
781 
782  std::unique_ptr<KIGFX::VIEW_GROUP> m_preview;
783  std::vector<EDA_ITEM *> m_ownedItems;
784 
787 
789  std::vector<VIEW_LAYER> m_layers;
790 
792  std::vector<VIEW_LAYER*> m_orderedLayers;
793 
795  std::shared_ptr<std::vector<VIEW_ITEM*>> m_allItems;
796 
798  std::set<unsigned int> m_topLayers;
799 
802 
804  double m_scale;
805 
808 
810  double m_minScale;
811 
813  double m_maxScale;
814 
816  bool m_mirrorX;
817 
819  bool m_mirrorY;
820 
823 
826 
829  bool m_dynamic;
830 
833 
835  static const int TOP_LAYER_MODIFIER;
836 
839 
842 
845 };
846 } // namespace KIGFX
847 
848 #endif
void MarkForUpdate(VIEW_ITEM *aItem)
Add an item to a list of items that are going to be refreshed upon the next frame rendering.
void SetScaleLimits(double aMaximum, double aMinimum)
Set minimum and maximum values for scale.
Definition: view.h:303
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hide the item in the view (e.g.
Definition: view.cpp:1470
Number of available rendering targets.
Definition: definitions.h:51
bool IsDrawOrderReversed() const
Definition: view.h:649
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:513
void SetViewport(const BOX2D &aViewport)
Set the visible area of the VIEW.
Definition: view.cpp:525
void updateLayers(VIEW_ITEM *aItem)
Determine rendering order of layers. Used in display order sorting function.
Definition: view.cpp:1319
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
Definition: view.cpp:1425
void ReverseDrawOrder(bool aFlag)
Only takes effect if UseDrawPriority is true.
Definition: view.h:659
void SetLayerOrder(int aLayer, int aRenderingOrder)
Set rendering order of a particular layer.
Definition: view.cpp:640
void SetRequired(int aLayerId, int aRequiredId, bool aRequired=true)
Mark the aRequiredId layer as required for the aLayerId layer.
Definition: view.cpp:391
void updateItemColor(VIEW_ITEM *aItem, int aLayer)
Update all information needed to draw an item.
Definition: view.cpp:1254
bool m_useDrawPriority
The next sequential drawing priority.
Definition: view.h:838
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: view.h:780
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:191
const BOX2D & GetBoundary() const
Definition: view.h:292
virtual void SetTopLayer(int aLayer, bool aEnabled=true)
Set given layer to be displayed on the top or sets back the default order of layers.
Definition: view.cpp:837
static const int TOP_LAYER_MODIFIER
Flag to respect draw priority when drawing items.
Definition: view.h:835
const Vec GetEnd() const
Definition: box2.h:178
void sortLayers()
Clear cached GAL group numbers (ONLY numbers stored in VIEW_ITEMs, not group objects used by GAL)
Definition: view.cpp:1239
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:450
const VECTOR2D & GetCenter() const
Return the center point of this VIEW (in world space coordinates).
Definition: view.h:333
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: view.cpp:1547
void UseDrawPriority(bool aFlag)
Definition: view.h:641
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1380
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1415
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:351
void InitPreview()
Definition: view.cpp:1540
GAL * m_gal
Dynamic VIEW (eg.
Definition: view.h:825
bool areRequiredLayersEnabled(int aLayerId) const
Definition: view.cpp:1362
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:189
std::set< unsigned int > m_topLayers
Center point of the VIEW (the point at which we are looking at).
Definition: view.h:798
void UpdateAllLayersOrder()
Do everything that is needed to apply the rendering order of layers.
Definition: view.cpp:904
void SetMirror(bool aMirrorX, bool aMirrorY)
Control the mirroring of the VIEW.
Definition: view.cpp:540
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:81
std::shared_ptr< VIEW_OVERLAY > MakeOverlay()
Definition: view.cpp:1516
virtual void EnableTopLayer(bool aEnable)
Enable or disable display of the top layer.
Definition: view.cpp:864
VECTOR2D m_center
Scale of displayed VIEW_ITEMs.
Definition: view.h:801
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:207
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:680
bool IsUsingDrawPriority() const
Definition: view.h:633
void SetBoundary(const BOX2I &aBoundary)
Set limits for view area.
Definition: view.h:283
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
The set of layers that are displayed on the top.
Definition: view.h:795
void SortLayers(int aLayers[], int &aCount) const
Change the order of given layer ids, so after sorting the order corresponds to layers rendering order...
Definition: view.cpp:654
void ShowPreview(bool aShow=true)
Definition: view.cpp:1561
double m_minScale
Scale upper limit.
Definition: view.h:810
void SetLayerTarget(int aLayer, RENDER_TARGET aTarget)
Change the rendering target for a particular layer.
Definition: view.h:424
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition: painter.h:57
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:579
virtual void Redraw()
Immediately redraws the whole view.
Definition: view.cpp:1125
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:572
bool IsTargetDirty(int aTarget) const
Return true if any of layers belonging to the target or the target itself should be redrawn.
Definition: view.h:561
void Clear()
Remove all items from the view.
Definition: view.cpp:1091
bool IsVisible(const VIEW_ITEM *aItem) const
Return information if the item is visible (or not).
Definition: view.cpp:1489
bool visible
Is the layer to be rendered?
Definition: view.h:685
virtual int GetTopLayer() const
Definition: view.cpp:828
void SetLayerDisplayOnly(int aLayer, bool aDisplayOnly=true)
Definition: view.h:412
bool m_mirrorX
Vertical flip flag.
Definition: view.h:816
void invalidateItem(VIEW_ITEM *aItem, int aUpdateFlags)
Manage dirty flags & redraw queuing when updating an item.
Definition: view.cpp:1193
void ClearPreview()
Definition: view.cpp:1525
const VECTOR2I & GetScreenPixelSize() const
Return the size of the our rendering area in pixels.
Definition: view.cpp:1157
bool m_dynamic
Flag to mark targets as dirty so they have to be redrawn on the next refresh event.
Definition: view.h:829
Extend VIEW_ITEM by possibility of grouping items into a single object.
Definition: view_group.h:46
int id
Layer ID.
Definition: view.h:689
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:387
void ReorderLayerData(std::unordered_map< int, int > aReorderMap)
Remap the data between layer ids without invalidating that data.
Definition: view.cpp:682
void UpdateItems()
Iterate through the list of items that asked for updating and updates them.
Definition: view.cpp:1397
void markTargetClean(int aTarget)
Definition: view.h:702
void updateBbox(VIEW_ITEM *aItem)
Update set of layers that an item occupies.
Definition: view.cpp:1303
PAINTER * m_painter
Interface to #PAINTER that is used to draw items.
Definition: view.h:822
bool IsDynamic() const
Tell if the VIEW is dynamic (ie.
Definition: view.h:534
bool m_reverseDrawOrder
Definition: view.h:844
int m_nextDrawPriority
Flag to reverse the draw order when using draw priority.
Definition: view.h:841
VECTOR2D ToScreen(const VECTOR2D &aCoord, bool aAbsolute=true) const
Convert a world space point/vector to a point/vector in screen space coordinates.
Definition: view.cpp:469
std::vector< VIEW_LAYER > m_layers
Sorted list of pointers to members of m_layers.
Definition: view.h:789
void ClearTopLayers()
Remove all layers from the on-the-top set (they are no longer displayed over the rest of layers).
Definition: view.cpp:889
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:237
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:207
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
Definition: view.cpp:553
void clearGroupCache()
Definition: view.cpp:1181
double m_maxScale
Horizontal flip flag.
Definition: view.h:813
void UpdateLayerColor(int aLayer)
Apply the new coloring scheme held by RENDER_SETTINGS in case that it has changed.
Definition: view.cpp:752
std::unique_ptr< VIEW > DataReference() const
Return a new VIEW object that shares the same set of VIEW_ITEMs and LAYERs.
Definition: view.cpp:1439
bool m_dirtyTargets[TARGETS_NUMBER]
Rendering order modifier for layers that are marked as top layers.
Definition: view.h:832
void redrawRect(const BOX2I &aRect)
Definition: view.cpp:988
std::vector< EDA_ITEM * > m_ownedItems
Whether to use rendering order modifier or not.
Definition: view.h:783
void updateItemGeometry(VIEW_ITEM *aItem, int aLayer)
Update bounding box of an item.
Definition: view.cpp:1273
Main rendering target (cached)
Definition: definitions.h:48
bool m_enableOrderModifier
The set of possible displayed layers and its properties.
Definition: view.h:786
static void OnDestroy(VIEW_ITEM *aItem)
Nasty hack, invoked by the destructor of VIEW_ITEM to auto-remove the item from the owning VIEW if th...
Definition: view.cpp:248
BOX2D m_boundary
Scale lower limit.
Definition: view.h:807
std::vector< VIEW_LAYER * > m_orderedLayers
Flat list of all items.
Definition: view.h:792
std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
Definition: view.h:72
int GetLayerOrder(int aLayer) const
Return rendering order of a particular layer.
Definition: view.cpp:648
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Draw an item, but on a specified layers.
Definition: view.cpp:1007
bool IsCached(int aLayer) const
Return true if the layer is cached.
Definition: view.h:579
void SetOrigin(const Vec &pos)
Definition: box2.h:193
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
bool m_mirrorY
PAINTER contains information how do draw items.
Definition: view.h:819
void ClearTargets()
Clear targets that are marked as dirty.
Definition: view.cpp:1106
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Definition: view.cpp:1449
void CopySettings(const VIEW *aOtherView)
Copy layers and visibility settings from another view.
Definition: view.cpp:488
void SetPainter(PAINTER *aPainter)
Set the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:197
double m_scale
View boundaries.
Definition: view.h:804
int renderingOrder
Rendering order of this layer.
Definition: view.h:688
bool displayOnly
Is the layer display only?
Definition: view.h:686
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:321
virtual int Query(const BOX2I &aRect, std::vector< LAYER_ITEM_PAIR > &aResult) const
Find all visible items that touch or are within the rectangle aRect.
Definition: view.cpp:427
bool IsMirroredY() const
Return true if view is flipped across the Y axis.
Definition: view.h:245
virtual ~VIEW()
Definition: view.cpp:315
const Vec & GetOrigin() const
Definition: box2.h:176
RENDER_TARGET
RENDER_TARGET: Possible rendering targets.
Definition: definitions.h:46
VIEW(bool aIsDynamic=true)
Definition: view.cpp:263
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
void SetBoundary(const BOX2D &aBoundary)
Set limits for view area.
Definition: view.h:273
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:773
double GetScale() const
Definition: view.h:263
void SetGAL(GAL *aGal)
Assign a rendering device for the VIEW.
Definition: view.cpp:494
static bool compareRenderingOrder(VIEW_LAYER *aI, VIEW_LAYER *aJ)
Check if every layer required by the aLayerId layer is enabled.
Definition: view.h:767
void MarkDirty()
Force redraw of view on the next rendering.
Definition: view.h:596
std::set< int > requiredLayers
Layers that have to be enabled to show the layer.
Definition: view.h:691
bool IsDirty() const
Return true if any of the VIEW layers needs to be refreshened.
Definition: view.h:544
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1503
Abstract interface for drawing on a 2D-surface.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:404
RENDER_TARGET target
Where the layer should be rendered.
Definition: view.h:690
std::shared_ptr< VIEW_RTREE > items
R-tree indexing all items on this layer.
Definition: view.h:687