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 
408  if( GetPrintMode() > 0 )
409  return true;
410 
411  return m_layers.at( aLayer ).visible;
412  }
413 
414  inline void SetLayerDisplayOnly( int aLayer, bool aDisplayOnly = true )
415  {
416  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
417  m_layers[aLayer].displayOnly = aDisplayOnly;
418  }
419 
426  inline void SetLayerTarget( int aLayer, RENDER_TARGET aTarget )
427  {
428  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
429  m_layers[aLayer].target = aTarget;
430  }
431 
438  void SetLayerOrder( int aLayer, int aRenderingOrder );
439 
446  int GetLayerOrder( int aLayer ) const;
447 
456  void SortLayers( int aLayers[], int& aCount ) const;
457 
465  void ReorderLayerData( std::unordered_map<int, int> aReorderMap );
466 
473  void UpdateLayerColor( int aLayer );
474 
480  void UpdateAllLayersColor();
481 
489  virtual void SetTopLayer( int aLayer, bool aEnabled = true );
490 
500  virtual void EnableTopLayer( bool aEnable );
501 
502  virtual int GetTopLayer() const;
503 
508  void ClearTopLayers();
509 
515  void UpdateAllLayersOrder();
516 
520  void ClearTargets();
521 
525  virtual void Redraw();
526 
530  void RecacheAllItems();
531 
536  bool IsDynamic() const
537  {
538  return m_dynamic;
539  }
540 
546  bool IsDirty() const
547  {
548  for( int i = 0; i < TARGETS_NUMBER; ++i )
549  {
550  if( IsTargetDirty( i ) )
551  return true;
552  }
553 
554  return false;
555  }
556 
563  bool IsTargetDirty( int aTarget ) const
564  {
565  wxCHECK( aTarget < TARGETS_NUMBER, false );
566  return m_dirtyTargets[aTarget];
567  }
568 
574  inline void MarkTargetDirty( int aTarget )
575  {
576  wxCHECK( aTarget < TARGETS_NUMBER, /* void */ );
577  m_dirtyTargets[aTarget] = true;
578  }
579 
581  inline bool IsCached( int aLayer ) const
582  {
583  wxCHECK( aLayer < (int) m_layers.size(), false );
584 
585  try
586  {
587  return m_layers.at( aLayer ).target == TARGET_CACHED;
588  }
589  catch( const std::out_of_range& )
590  {
591  return false;
592  }
593  }
594 
598  void MarkDirty()
599  {
600  for( int i = 0; i < TARGETS_NUMBER; ++i )
601  m_dirtyTargets[i] = true;
602  }
603 
609  void MarkForUpdate( VIEW_ITEM* aItem );
610 
614  void UpdateItems();
615 
621  void UpdateAllItems( int aUpdateFlags );
622 
629  void UpdateAllItemsConditionally( int aUpdateFlags,
630  std::function<bool( VIEW_ITEM* )> aCondition );
631 
635  bool IsUsingDrawPriority() const
636  {
637  return m_useDrawPriority;
638  }
639 
643  void UseDrawPriority( bool aFlag )
644  {
645  m_useDrawPriority = aFlag;
646  }
647 
651  bool IsDrawOrderReversed() const
652  {
653  return m_reverseDrawOrder;
654  }
655 
661  void ReverseDrawOrder( bool aFlag )
662  {
663  m_reverseDrawOrder = aFlag;
664  }
665 
666  std::shared_ptr<VIEW_OVERLAY> MakeOverlay();
667 
668  void InitPreview();
669 
670  void ClearPreview();
671  void AddToPreview( EDA_ITEM* aItem, bool aTakeOwnership = true );
672 
673  void ShowPreview( bool aShow = true );
674 
680  std::unique_ptr<VIEW> DataReference() const;
681 
690  int GetPrintMode() const { return m_printMode; }
691 
698  void SetPrintMode( int aPrintMode ) { m_printMode = aPrintMode; }
699 
700  static constexpr int VIEW_MAX_LAYERS = 512;
701 
702 protected:
703  struct VIEW_LAYER
704  {
705  bool visible;
706  bool displayOnly;
707  std::shared_ptr<VIEW_RTREE> items;
709  int id;
711  std::set<int> requiredLayers;
712  };
714 
715 
716 
717  VIEW( const VIEW& ) = delete;
718 
720  void redrawRect( const BOX2I& aRect );
721 
722  inline void markTargetClean( int aTarget )
723  {
724  wxCHECK( aTarget < TARGETS_NUMBER, /* void */ );
725  m_dirtyTargets[aTarget] = false;
726  }
727 
739  void draw( VIEW_ITEM* aItem, int aLayer, bool aImmediate = false );
740 
748  void draw( VIEW_ITEM* aItem, bool aImmediate = false );
749 
757  void draw( VIEW_GROUP* aGroup, bool aImmediate = false );
758 
760  void sortLayers();
761 
764  void clearGroupCache();
765 
772  void invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags );
773 
775  void updateItemColor( VIEW_ITEM* aItem, int aLayer );
776 
778  void updateItemGeometry( VIEW_ITEM* aItem, int aLayer );
779 
781  void updateBbox( VIEW_ITEM* aItem );
782 
784  void updateLayers( VIEW_ITEM* aItem );
785 
788  {
789  return aI->renderingOrder > aJ->renderingOrder;
790  }
791 
793  bool areRequiredLayersEnabled( int aLayerId ) const;
794 
795  // Function objects that need to access VIEW/VIEW_ITEM private/protected members
796  struct CLEAR_LAYER_CACHE_VISITOR;
797  struct RECACHE_ITEM_VISITOR;
798  struct DRAW_ITEM_VISITOR;
799  struct UPDATE_COLOR_VISITOR;
801 
802  std::unique_ptr<KIGFX::VIEW_GROUP> m_preview;
803  std::vector<EDA_ITEM *> m_ownedItems;
804 
807 
809  std::vector<VIEW_LAYER> m_layers;
810 
812  std::vector<VIEW_LAYER*> m_orderedLayers;
813 
815  std::shared_ptr<std::vector<VIEW_ITEM*>> m_allItems;
816 
818  std::set<unsigned int> m_topLayers;
819 
822 
824  double m_scale;
825 
828 
830  double m_minScale;
831 
833  double m_maxScale;
834 
836  bool m_mirrorX;
837 
839  bool m_mirrorY;
840 
843 
846 
849  bool m_dynamic;
850 
853 
855  static const int TOP_LAYER_MODIFIER;
856 
859 
862 
865 
869 };
870 } // namespace KIGFX
871 
872 #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:651
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:514
void SetViewport(const BOX2D &aViewport)
Set the visible area of the VIEW.
Definition: view.cpp:526
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:661
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:392
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:858
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: view.h:800
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:837
static const int TOP_LAYER_MODIFIER
Flag to respect draw priority when drawing items.
Definition: view.h:855
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: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:451
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:643
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:352
void InitPreview()
Definition: view.cpp:1540
GAL * m_gal
Dynamic VIEW (eg.
Definition: view.h:845
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:818
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:541
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:821
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:700
bool IsUsingDrawPriority() const
Definition: view.h:635
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:815
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:830
void SetLayerTarget(int aLayer, RENDER_TARGET aTarget)
Change the rendering target for a particular layer.
Definition: view.h:426
void SetPrintMode(int aPrintMode)
Set the printing mode.
Definition: view.h:698
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:580
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:574
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:563
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:705
virtual int GetTopLayer() const
Definition: view.cpp:828
void SetLayerDisplayOnly(int aLayer, bool aDisplayOnly=true)
Definition: view.h:414
bool m_mirrorX
Vertical flip flag.
Definition: view.h:836
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:849
Extend VIEW_ITEM by possibility of grouping items into a single object.
Definition: view_group.h:46
int id
Layer ID.
Definition: view.h:709
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:722
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:842
bool IsDynamic() const
Tell if the VIEW is dynamic (ie.
Definition: view.h:536
bool m_reverseDrawOrder
A control for printing: m_printMode <= 0 means no printing mode (normal draw mode m_printMode > 0 is ...
Definition: view.h:864
int m_nextDrawPriority
Flag to reverse the draw order when using draw priority.
Definition: view.h:861
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:470
int GetPrintMode() const
Get the current print mode.
Definition: view.h:690
std::vector< VIEW_LAYER > m_layers
Sorted list of pointers to members of m_layers.
Definition: view.h:809
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:225
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
Definition: view.cpp:554
void clearGroupCache()
Definition: view.cpp:1181
double m_maxScale
Horizontal flip flag.
Definition: view.h:833
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:852
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:803
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:806
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:827
std::vector< VIEW_LAYER * > m_orderedLayers
Flat list of all items.
Definition: view.h:812
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:581
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:150
bool m_mirrorY
PAINTER contains information how do draw items.
Definition: view.h:839
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:489
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:824
int renderingOrder
Rendering order of this layer.
Definition: view.h:708
bool displayOnly
Is the layer display only?
Definition: view.h:706
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:322
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:428
bool IsMirroredY() const
Return true if view is flipped across the Y axis.
Definition: view.h:245
virtual ~VIEW()
Definition: view.cpp:316
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: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:495
int m_printMode
Definition: view.h:868
static bool compareRenderingOrder(VIEW_LAYER *aI, VIEW_LAYER *aJ)
Check if every layer required by the aLayerId layer is enabled.
Definition: view.h:787
void MarkDirty()
Force redraw of view on the next rendering.
Definition: view.h:598
std::set< int > requiredLayers
Layers that have to be enabled to show the layer.
Definition: view.h:711
bool IsDirty() const
Return true if any of the VIEW layers needs to be refreshened.
Definition: view.h:546
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:710
std::shared_ptr< VIEW_RTREE > items
R-tree indexing all items on this layer.
Definition: view.h:707