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( 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 < (int) m_layers.size(), false );
407  return m_layers.at( aLayer ).visible;
408  }
409 
410  inline void SetLayerDisplayOnly( int aLayer, bool aDisplayOnly = true )
411  {
412  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
413  m_layers[aLayer].displayOnly = aDisplayOnly;
414  }
415 
422  inline void SetLayerTarget( int aLayer, RENDER_TARGET aTarget )
423  {
424  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
425  m_layers[aLayer].target = aTarget;
426  }
427 
434  void SetLayerOrder( int aLayer, int aRenderingOrder );
435 
442  int GetLayerOrder( int aLayer ) const;
443 
452  void SortLayers( int aLayers[], int& aCount ) const;
453 
461  void ReorderLayerData( std::unordered_map<int, int> aReorderMap );
462 
469  void UpdateLayerColor( int aLayer );
470 
476  void UpdateAllLayersColor();
477 
485  virtual void SetTopLayer( int aLayer, bool aEnabled = true );
486 
496  virtual void EnableTopLayer( bool aEnable );
497 
498  virtual int GetTopLayer() const;
499 
504  void ClearTopLayers();
505 
511  void UpdateAllLayersOrder();
512 
516  void ClearTargets();
517 
521  virtual void Redraw();
522 
526  void RecacheAllItems();
527 
532  bool IsDynamic() const
533  {
534  return m_dynamic;
535  }
536 
542  bool IsDirty() const
543  {
544  for( int i = 0; i < TARGETS_NUMBER; ++i )
545  {
546  if( IsTargetDirty( i ) )
547  return true;
548  }
549 
550  return false;
551  }
552 
559  bool IsTargetDirty( int aTarget ) const
560  {
561  wxCHECK( aTarget < TARGETS_NUMBER, false );
562  return m_dirtyTargets[aTarget];
563  }
564 
570  inline void MarkTargetDirty( int aTarget )
571  {
572  wxCHECK( aTarget < TARGETS_NUMBER, /* void */ );
573  m_dirtyTargets[aTarget] = true;
574  }
575 
577  inline bool IsCached( int aLayer ) const
578  {
579  wxCHECK( aLayer < (int) m_layers.size(), false );
580 
581  try
582  {
583  return m_layers.at( aLayer ).target == TARGET_CACHED;
584  }
585  catch( const std::out_of_range& )
586  {
587  return false;
588  }
589  }
590 
594  void MarkDirty()
595  {
596  for( int i = 0; i < TARGETS_NUMBER; ++i )
597  m_dirtyTargets[i] = true;
598  }
599 
605  void MarkForUpdate( VIEW_ITEM* aItem );
606 
610  void UpdateItems();
611 
617  void UpdateAllItems( int aUpdateFlags );
618 
625  void UpdateAllItemsConditionally( int aUpdateFlags,
626  std::function<bool( VIEW_ITEM* )> aCondition );
627 
631  bool IsUsingDrawPriority() const
632  {
633  return m_useDrawPriority;
634  }
635 
639  void UseDrawPriority( bool aFlag )
640  {
641  m_useDrawPriority = aFlag;
642  }
643 
647  bool IsDrawOrderReversed() const
648  {
649  return m_reverseDrawOrder;
650  }
651 
657  void ReverseDrawOrder( bool aFlag )
658  {
659  m_reverseDrawOrder = aFlag;
660  }
661 
662  std::shared_ptr<VIEW_OVERLAY> MakeOverlay();
663 
664  void InitPreview();
665 
666  void ClearPreview();
667  void AddToPreview( EDA_ITEM* aItem, bool aTakeOwnership = true );
668 
669  void ShowPreview( bool aShow = true );
670 
676  std::unique_ptr<VIEW> DataReference() const;
677 
686  int GetPrintMode() { return m_printMode; }
687 
694  void SetPrintMode( int aPrintMode ) { m_printMode = aPrintMode; }
695 
696  static constexpr int VIEW_MAX_LAYERS = 512;
697 
698 protected:
699  struct VIEW_LAYER
700  {
701  bool visible;
702  bool displayOnly;
703  std::shared_ptr<VIEW_RTREE> items;
705  int id;
707  std::set<int> requiredLayers;
708  };
710 
711 
712 
713  VIEW( const VIEW& ) = delete;
714 
716  void redrawRect( const BOX2I& aRect );
717 
718  inline void markTargetClean( int aTarget )
719  {
720  wxCHECK( aTarget < TARGETS_NUMBER, /* void */ );
721  m_dirtyTargets[aTarget] = false;
722  }
723 
735  void draw( VIEW_ITEM* aItem, int aLayer, bool aImmediate = false );
736 
744  void draw( VIEW_ITEM* aItem, bool aImmediate = false );
745 
753  void draw( VIEW_GROUP* aGroup, bool aImmediate = false );
754 
756  void sortLayers();
757 
760  void clearGroupCache();
761 
768  void invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags );
769 
771  void updateItemColor( VIEW_ITEM* aItem, int aLayer );
772 
774  void updateItemGeometry( VIEW_ITEM* aItem, int aLayer );
775 
777  void updateBbox( VIEW_ITEM* aItem );
778 
780  void updateLayers( VIEW_ITEM* aItem );
781 
784  {
785  return aI->renderingOrder > aJ->renderingOrder;
786  }
787 
789  bool areRequiredLayersEnabled( int aLayerId ) const;
790 
791  // Function objects that need to access VIEW/VIEW_ITEM private/protected members
792  struct clearLayerCache;
793  struct recacheItem;
794  struct drawItem;
795  struct unlinkItem;
796  struct updateItemsColor;
797  struct changeItemsDepth;
798  struct extentsVisitor;
799 
800  std::unique_ptr<KIGFX::VIEW_GROUP> m_preview;
801  std::vector<EDA_ITEM *> m_ownedItems;
802 
805 
807  std::vector<VIEW_LAYER> m_layers;
808 
810  std::vector<VIEW_LAYER*> m_orderedLayers;
811 
813  std::shared_ptr<std::vector<VIEW_ITEM*>> m_allItems;
814 
816  std::set<unsigned int> m_topLayers;
817 
820 
822  double m_scale;
823 
826 
828  double m_minScale;
829 
831  double m_maxScale;
832 
834  bool m_mirrorX;
835 
837  bool m_mirrorY;
838 
841 
844 
847  bool m_dynamic;
848 
851 
853  static const int TOP_LAYER_MODIFIER;
854 
857 
860 
863 
867 };
868 } // namespace KIGFX
869 
870 #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:1480
Number of available rendering targets.
Definition: definitions.h:51
bool IsDrawOrderReversed() const
Definition: view.h:647
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:519
void SetViewport(const BOX2D &aViewport)
Set the visible area of the VIEW.
Definition: view.cpp:531
void updateLayers(VIEW_ITEM *aItem)
Determine rendering order of layers. Used in display order sorting function.
Definition: view.cpp:1316
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:1431
void ReverseDrawOrder(bool aFlag)
Only takes effect if UseDrawPriority is true.
Definition: view.h:657
void SetLayerOrder(int aLayer, int aRenderingOrder)
Set rendering order of a particular layer.
Definition: view.cpp:645
void SetRequired(int aLayerId, int aRequiredId, bool aRequired=true)
Mark the aRequiredId layer as required for the aLayerId layer.
Definition: view.cpp:397
void updateItemColor(VIEW_ITEM *aItem, int aLayer)
Update all information needed to draw an item.
Definition: view.cpp:1251
bool m_useDrawPriority
The next sequential drawing priority.
Definition: view.h:856
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: view.h:798
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:175
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:838
static const int TOP_LAYER_MODIFIER
Flag to respect draw priority when drawing items.
Definition: view.h:853
const Vec GetEnd() const
Definition: box2.h:195
void sortLayers()
Clear cached GAL group numbers (ONLY numbers stored in VIEW_ITEMs, not group objects used by GAL)
Definition: view.cpp:1236
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:456
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:1554
void UseDrawPriority(bool aFlag)
Definition: view.h:639
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1377
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1417
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:357
void InitPreview()
Definition: view.cpp:1547
GAL * m_gal
Dynamic VIEW (eg.
Definition: view.h:843
bool areRequiredLayersEnabled(int aLayerId) const
Definition: view.cpp:1359
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:816
void UpdateAllLayersOrder()
Do everything that is needed to apply the rendering order of layers.
Definition: view.cpp:905
void SetMirror(bool aMirrorX, bool aMirrorY)
Control the mirroring of the VIEW.
Definition: view.cpp:546
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:1526
virtual void EnableTopLayer(bool aEnable)
Enable or disable display of the top layer.
Definition: view.cpp:865
VECTOR2D m_center
Scale of displayed VIEW_ITEMs.
Definition: view.h:819
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:696
bool IsUsingDrawPriority() const
Definition: view.h:631
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:813
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:659
void ShowPreview(bool aShow=true)
Definition: view.cpp:1568
double m_minScale
Scale upper limit.
Definition: view.h:828
void SetLayerTarget(int aLayer, RENDER_TARGET aTarget)
Change the rendering target for a particular layer.
Definition: view.h:422
void SetPrintMode(int aPrintMode)
Set the printing mode.
Definition: view.h:694
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:585
virtual void Redraw()
Immediately redraws the whole view.
Definition: view.cpp:1123
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:570
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:559
void Clear()
Remove all items from the view.
Definition: view.cpp:1089
bool IsVisible(const VIEW_ITEM *aItem) const
Return information if the item is visible (or not).
Definition: view.cpp:1499
bool visible
Is the layer to be rendered?
Definition: view.h:701
virtual int GetTopLayer() const
Definition: view.cpp:829
void SetLayerDisplayOnly(int aLayer, bool aDisplayOnly=true)
Definition: view.h:410
bool m_mirrorX
Vertical flip flag.
Definition: view.h:834
void invalidateItem(VIEW_ITEM *aItem, int aUpdateFlags)
Manage dirty flags & redraw queuing when updating an item.
Definition: view.cpp:1191
void ClearPreview()
Definition: view.cpp:1535
const VECTOR2I & GetScreenPixelSize() const
Return the size of the our rendering area in pixels.
Definition: view.cpp:1155
bool m_dynamic
Flag to mark targets as dirty so they have to be redrawn on the next refresh event.
Definition: view.h:847
Extend VIEW_ITEM by possibility of grouping items into a single object.
Definition: view_group.h:46
int id
Layer ID.
Definition: view.h:705
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:687
void UpdateItems()
Iterate through the list of items that asked for updating and updates them.
Definition: view.cpp:1394
void markTargetClean(int aTarget)
Definition: view.h:718
void updateBbox(VIEW_ITEM *aItem)
Update set of layers that an item occupies.
Definition: view.cpp:1300
PAINTER * m_painter
Interface to #PAINTER that is used to draw items.
Definition: view.h:840
bool IsDynamic() const
Tell if the VIEW is dynamic (ie.
Definition: view.h:532
bool m_reverseDrawOrder
A control for printing: m_printMode <= 0 means no printing mode (normal draw mode m_printMode > 0 is ...
Definition: view.h:862
int m_nextDrawPriority
Flag to reverse the draw order when using draw priority.
Definition: view.h:859
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:475
std::vector< VIEW_LAYER > m_layers
Sorted list of pointers to members of m_layers.
Definition: view.h:807
void ClearTopLayers()
Remove all layers from the on-the-top set (they are no longer displayed over the rest of layers).
Definition: view.cpp:890
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:225
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
Definition: view.cpp:559
void clearGroupCache()
Definition: view.cpp:1179
double m_maxScale
Horizontal flip flag.
Definition: view.h:831
void UpdateLayerColor(int aLayer)
Apply the new coloring scheme held by RENDER_SETTINGS in case that it has changed.
Definition: view.cpp:755
std::unique_ptr< VIEW > DataReference() const
Return a new VIEW object that shares the same set of VIEW_ITEMs and LAYERs.
Definition: view.cpp:1449
int GetPrintMode()
Get the current print mode.
Definition: view.h:686
bool m_dirtyTargets[TARGETS_NUMBER]
Rendering order modifier for layers that are marked as top layers.
Definition: view.h:850
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:801
void updateItemGeometry(VIEW_ITEM *aItem, int aLayer)
Update bounding box of an item.
Definition: view.cpp:1270
Main rendering target (cached)
Definition: definitions.h:48
bool m_enableOrderModifier
The set of possible displayed layers and its properties.
Definition: view.h:804
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:253
BOX2D m_boundary
Scale lower limit.
Definition: view.h:825
std::vector< VIEW_LAYER * > m_orderedLayers
Flat list of all items.
Definition: view.h:810
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:653
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:577
void SetOrigin(const Vec &pos)
Definition: box2.h:210
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:148
bool m_mirrorY
PAINTER contains information how do draw items.
Definition: view.h:837
void ClearTargets()
Clear targets that are marked as dirty.
Definition: view.cpp:1104
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Definition: view.cpp:1459
void CopySettings(const VIEW *aOtherView)
Copy layers and visibility settings from another view.
Definition: view.cpp:494
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:822
int renderingOrder
Rendering order of this layer.
Definition: view.h:704
bool displayOnly
Is the layer display only?
Definition: view.h:702
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:327
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:433
bool IsMirroredY() const
Return true if view is flipped across the Y axis.
Definition: view.h:245
virtual ~VIEW()
Definition: view.cpp:321
const Vec & GetOrigin() const
Definition: box2.h:193
RENDER_TARGET
RENDER_TARGET: Possible rendering targets.
Definition: definitions.h:46
VIEW(bool aIsDynamic=true)
Definition: view.cpp:268
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:776
double GetScale() const
Definition: view.h:263
void SetGAL(GAL *aGal)
Assign a rendering device for the VIEW.
Definition: view.cpp:500
int m_printMode
Definition: view.h:866
static bool compareRenderingOrder(VIEW_LAYER *aI, VIEW_LAYER *aJ)
Check if every layer required by the aLayerId layer is enabled.
Definition: view.h:783
void MarkDirty()
Force redraw of view on the next rendering.
Definition: view.h:594
std::set< int > requiredLayers
Layers that have to be enabled to show the layer.
Definition: view.h:707
bool IsDirty() const
Return true if any of the VIEW layers needs to be refreshened.
Definition: view.h:542
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:1513
Class GAL is the 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:706
std::shared_ptr< VIEW_RTREE > items
R-tree indexing all items on this layer.
Definition: view.h:703