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 #include <view/view.h>
40 
41 class EDA_ITEM;
42 
43 namespace KIGFX
44 {
45 class PAINTER;
46 class GAL;
47 class VIEW_ITEM;
48 class VIEW_GROUP;
49 class VIEW_RTREE;
50 
68 class VIEW
69 {
70 public:
71  friend class VIEW_ITEM;
72 
73  typedef std::pair<VIEW_ITEM*, int> LAYER_ITEM_PAIR;
74 
78  VIEW( bool aIsDynamic = true );
79 
80  virtual ~VIEW();
81 
89  static void OnDestroy( VIEW_ITEM* aItem );
90 
99  virtual void Add( VIEW_ITEM* aItem, int aDrawPriority = -1 );
100 
106  virtual void Remove( VIEW_ITEM* aItem );
107 
108 
118  virtual int Query( const BOX2I& aRect, std::vector<LAYER_ITEM_PAIR>& aResult ) const;
119 
126  void SetVisible( VIEW_ITEM* aItem, bool aIsVisible = true );
127 
134  void Hide( VIEW_ITEM* aItem, bool aHide = true );
135 
143  bool IsVisible( const VIEW_ITEM* aItem ) const;
144 
152  virtual void Update( const VIEW_ITEM* aItem, int aUpdateFlags ) const;
153  virtual void Update( const VIEW_ITEM* aItem ) const;
154 
163  void SetRequired( int aLayerId, int aRequiredId, bool aRequired = true );
164 
170  void CopySettings( const VIEW* aOtherView );
171 
172  /*
173  * Convenience wrappers for adding multiple items
174  * template <class T> void AddItems( const T& aItems );
175  * template <class T> void RemoveItems( const T& aItems );
176  */
177 
183  void SetGAL( GAL* aGal );
184 
190  inline GAL* GetGAL() const
191  {
192  return m_gal;
193  }
194 
198  inline void SetPainter( PAINTER* aPainter )
199  {
200  m_painter = aPainter;
201  }
202 
208  inline PAINTER* GetPainter() const
209  {
210  return m_painter;
211  }
212 
218  void SetViewport( const BOX2D& aViewport );
219 
225  BOX2D GetViewport() const;
226 
233  void SetMirror( bool aMirrorX, bool aMirrorY );
234 
238  bool IsMirroredX() const
239  {
240  return m_mirrorX;
241  }
242 
246  bool IsMirroredY() const
247  {
248  return m_mirrorY;
249  }
250 
259  virtual void SetScale( double aScale, VECTOR2D aAnchor = { 0, 0 } );
260 
264  inline double GetScale() const
265  {
266  return m_scale;
267  }
268 
274  inline void SetBoundary( const BOX2D& aBoundary )
275  {
276  m_boundary = aBoundary;
277  }
278 
284  inline void SetBoundary( const BOX2I& aBoundary )
285  {
286  m_boundary.SetOrigin( aBoundary.GetOrigin() );
287  m_boundary.SetEnd( aBoundary.GetEnd() );
288  }
289 
293  inline const BOX2D& GetBoundary() const
294  {
295  return m_boundary;
296  }
297 
304  void SetScaleLimits( double aMaximum, double aMinimum )
305  {
306  wxASSERT_MSG( aMaximum > aMinimum, wxT( "I guess you passed parameters in wrong order" ) );
307 
308  m_minScale = aMinimum;
309  m_maxScale = aMaximum;
310  }
311 
318  void SetCenter( const VECTOR2D& aCenter );
319 
327  void SetCenter( const VECTOR2D& aCenter, const std::vector<BOX2D>& obscuringScreenRects );
328 
334  const VECTOR2D& GetCenter() const
335  {
336  return m_center;
337  }
338 
345  VECTOR2D ToWorld( const VECTOR2D& aCoord, bool aAbsolute = true ) const;
346 
353  double ToWorld( double aSize ) const;
354 
361  VECTOR2D ToScreen( const VECTOR2D& aCoord, bool aAbsolute = true ) const;
362 
368  double ToScreen( double aSize ) const;
369 
375  const VECTOR2I& GetScreenPixelSize() const;
376 
380  void Clear();
381 
388  inline void SetLayerVisible( int aLayer, bool aVisible = true )
389  {
390  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
391 
392  if( m_layers[aLayer].visible != aVisible )
393  {
394  // Target has to be redrawn after changing its visibility
395  MarkTargetDirty( m_layers[aLayer].target );
396  m_layers[aLayer].visible = aVisible;
397  }
398  }
399 
405  inline bool IsLayerVisible( int aLayer ) const
406  {
407  wxCHECK( aLayer >= 0, false);
408  wxCHECK( aLayer < (int) m_layers.size(), false );
409 
410  return m_layers.at( aLayer ).visible;
411  }
412 
419  inline void SetLayerDiff( int aLayer, bool aDiff = true )
420  {
421  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
422 
423  if( m_layers[aLayer].diffLayer != aDiff )
424  {
425  // Target has to be redrawn after changing its layers' diff status
426  MarkTargetDirty( m_layers[aLayer].target );
427  m_layers[aLayer].diffLayer = aDiff;
428  }
429  }
430 
437  inline void SetLayerHasNegatives( int aLayer, bool aNegatives = true )
438  {
439  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
440 
441  if( m_layers[aLayer].hasNegatives != aNegatives )
442  {
443  // Target has to be redrawn after changing a layers' negatives
444  MarkTargetDirty( m_layers[aLayer].target );
445  m_layers[aLayer].hasNegatives = aNegatives;
446  }
447  }
448 
449  inline void SetLayerDisplayOnly( int aLayer, bool aDisplayOnly = true )
450  {
451  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
452  m_layers[aLayer].displayOnly = aDisplayOnly;
453  }
454 
461  inline void SetLayerTarget( int aLayer, RENDER_TARGET aTarget )
462  {
463  wxCHECK( aLayer < (int) m_layers.size(), /*void*/ );
464  m_layers[aLayer].target = aTarget;
465  }
466 
473  void SetLayerOrder( int aLayer, int aRenderingOrder );
474 
481  int GetLayerOrder( int aLayer ) const;
482 
491  void SortLayers( int aLayers[], int& aCount ) const;
492 
500  void ReorderLayerData( std::unordered_map<int, int> aReorderMap );
501 
508  void UpdateLayerColor( int aLayer );
509 
515  void UpdateAllLayersColor();
516 
524  virtual void SetTopLayer( int aLayer, bool aEnabled = true );
525 
535  virtual void EnableTopLayer( bool aEnable );
536 
537  virtual int GetTopLayer() const;
538 
543  void ClearTopLayers();
544 
550  void UpdateAllLayersOrder();
551 
555  void ClearTargets();
556 
560  virtual void Redraw();
561 
565  void RecacheAllItems();
566 
571  bool IsDynamic() const
572  {
573  return m_dynamic;
574  }
575 
581  bool IsDirty() const
582  {
583  for( int i = 0; i < TARGETS_NUMBER; ++i )
584  {
585  if( IsTargetDirty( i ) )
586  return true;
587  }
588 
589  return false;
590  }
591 
598  bool IsTargetDirty( int aTarget ) const
599  {
600  wxCHECK( aTarget < TARGETS_NUMBER, false );
601  return m_dirtyTargets[aTarget];
602  }
603 
609  inline void MarkTargetDirty( int aTarget )
610  {
611  wxCHECK( aTarget < TARGETS_NUMBER, /* void */ );
612  m_dirtyTargets[aTarget] = true;
613  }
614 
616  inline bool IsCached( int aLayer ) const
617  {
618  wxCHECK( aLayer < (int) m_layers.size(), false );
619 
620  try
621  {
622  return m_layers.at( aLayer ).target == TARGET_CACHED;
623  }
624  catch( const std::out_of_range& )
625  {
626  return false;
627  }
628  }
629 
633  void MarkDirty()
634  {
635  for( int i = 0; i < TARGETS_NUMBER; ++i )
636  m_dirtyTargets[i] = true;
637  }
638 
642  void MarkClean()
643  {
644  for( int i = 0; i < TARGETS_NUMBER; ++i )
645  m_dirtyTargets[i] = false;
646  }
647 
651  void UpdateItems();
652 
658  void UpdateAllItems( int aUpdateFlags );
659 
666  void UpdateAllItemsConditionally( int aUpdateFlags,
667  std::function<bool( VIEW_ITEM* )> aCondition );
668 
672  bool IsUsingDrawPriority() const
673  {
674  return m_useDrawPriority;
675  }
676 
680  void UseDrawPriority( bool aFlag )
681  {
682  m_useDrawPriority = aFlag;
683  }
684 
690  void ReverseDrawOrder( bool aFlag )
691  {
692  m_reverseDrawOrder = aFlag;
693  }
694 
695  std::shared_ptr<VIEW_OVERLAY> MakeOverlay();
696 
697  void InitPreview();
698 
699  void ClearPreview();
700  void AddToPreview( EDA_ITEM* aItem, bool aTakeOwnership = true );
701 
702  void ShowPreview( bool aShow = true );
703 
709  std::unique_ptr<VIEW> DataReference() const;
710 
711  static constexpr int VIEW_MAX_LAYERS = 512;
712 
713 protected:
714  struct VIEW_LAYER
715  {
716  bool visible;
717  bool displayOnly;
718  bool diffLayer;
720  std::shared_ptr<VIEW_RTREE> items;
722  int id;
724  std::set<int> requiredLayers;
725  };
727 
728 
729 
730  VIEW( const VIEW& ) = delete;
731 
733  void redrawRect( const BOX2I& aRect );
734 
735  inline void markTargetClean( int aTarget )
736  {
737  wxCHECK( aTarget < TARGETS_NUMBER, /* void */ );
738  m_dirtyTargets[aTarget] = false;
739  }
740 
752  void draw( VIEW_ITEM* aItem, int aLayer, bool aImmediate = false );
753 
761  void draw( VIEW_ITEM* aItem, bool aImmediate = false );
762 
770  void draw( VIEW_GROUP* aGroup, bool aImmediate = false );
771 
773  void sortLayers();
774 
777  void clearGroupCache();
778 
785  void invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags );
786 
788  void updateItemColor( VIEW_ITEM* aItem, int aLayer );
789 
791  void updateItemGeometry( VIEW_ITEM* aItem, int aLayer );
792 
794  void updateBbox( VIEW_ITEM* aItem );
795 
797  void updateLayers( VIEW_ITEM* aItem );
798 
801  {
802  return aI->renderingOrder > aJ->renderingOrder;
803  }
804 
806  bool areRequiredLayersEnabled( int aLayerId ) const;
807 
808  // Function objects that need to access VIEW/VIEW_ITEM private/protected members
809  struct CLEAR_LAYER_CACHE_VISITOR;
810  struct RECACHE_ITEM_VISITOR;
811  struct DRAW_ITEM_VISITOR;
812  struct UPDATE_COLOR_VISITOR;
814 
815  std::unique_ptr<KIGFX::VIEW_GROUP> m_preview;
816  std::vector<EDA_ITEM *> m_ownedItems;
817 
820 
822  std::vector<VIEW_LAYER> m_layers;
823 
825  std::vector<VIEW_LAYER*> m_orderedLayers;
826 
828  std::shared_ptr<std::vector<VIEW_ITEM*>> m_allItems;
829 
831  std::set<unsigned int> m_topLayers;
832 
835 
836  double m_scale;
838  double m_minScale;
839  double m_maxScale;
840 
841  bool m_mirrorX;
842  bool m_mirrorY;
843 
846 
849 
852  bool m_dynamic;
853 
856 
858  static const int TOP_LAYER_MODIFIER;
859 
862 
865 
868 };
869 } // namespace KIGFX
870 
871 #endif
void SetScaleLimits(double aMaximum, double aMinimum)
Set minimum and maximum values for scale.
Definition: view.h:304
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hide the item in the view (e.g.
Definition: view.cpp:1479
Number of available rendering targets.
Definition: definitions.h:52
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:510
void SetViewport(const BOX2D &aViewport)
Set the visible area of the VIEW.
Definition: view.cpp:522
void updateLayers(VIEW_ITEM *aItem)
Determine rendering order of layers. Used in display order sorting function.
Definition: view.cpp:1329
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:1434
void ReverseDrawOrder(bool aFlag)
Only takes effect if UseDrawPriority is true.
Definition: view.h:690
void SetLayerOrder(int aLayer, int aRenderingOrder)
Set rendering order of a particular layer.
Definition: view.cpp:633
void SetRequired(int aLayerId, int aRequiredId, bool aRequired=true)
Mark the aRequiredId layer as required for the aLayerId layer.
Definition: view.cpp:388
void updateItemColor(VIEW_ITEM *aItem, int aLayer)
Update all information needed to draw an item.
Definition: view.cpp:1264
bool m_useDrawPriority
The next sequential drawing priority.
Definition: view.h:861
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: view.h:813
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:236
const BOX2D & GetBoundary() const
Definition: view.h:293
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:830
static const int TOP_LAYER_MODIFIER
Flag to respect draw priority when drawing items.
Definition: view.h:858
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:1249
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:447
const VECTOR2D & GetCenter() const
Return the center point of this VIEW (in world space coordinates).
Definition: view.h:334
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: view.cpp:1556
void UseDrawPriority(bool aFlag)
Definition: view.h:680
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1389
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1424
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:348
void InitPreview()
Definition: view.cpp:1549
GAL * m_gal
Dynamic VIEW (eg.
Definition: view.h:848
bool areRequiredLayersEnabled(int aLayerId) const
Definition: view.cpp:1372
bool hasNegatives
Layer should be drawn separately to not delete lower layers.
Definition: view.h:719
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:190
std::set< unsigned int > m_topLayers
Center point of the VIEW (the point at which we are looking at).
Definition: view.h:831
void UpdateAllLayersOrder()
Do everything that is needed to apply the rendering order of layers.
Definition: view.cpp:897
void SetMirror(bool aMirrorX, bool aMirrorY)
Control the mirroring of the VIEW.
Definition: view.cpp:537
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:76
void SetLayerDiff(int aLayer, bool aDiff=true)
Set the whether the layer should drawn differentially.
Definition: view.h:419
std::shared_ptr< VIEW_OVERLAY > MakeOverlay()
Definition: view.cpp:1525
virtual void EnableTopLayer(bool aEnable)
Enable or disable display of the top layer.
Definition: view.cpp:857
VECTOR2D m_center
Definition: view.h:834
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:711
bool IsUsingDrawPriority() const
Definition: view.h:672
void SetBoundary(const BOX2I &aBoundary)
Set limits for view area.
Definition: view.h:284
std::shared_ptr< std::vector< VIEW_ITEM * > > m_allItems
The set of layers that are displayed on the top.
Definition: view.h:828
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:647
void ShowPreview(bool aShow=true)
Definition: view.cpp:1570
double m_minScale
Definition: view.h:838
void SetLayerTarget(int aLayer, RENDER_TARGET aTarget)
Change the rendering target for a particular layer.
Definition: view.h:461
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:576
virtual void Redraw()
Immediately redraws the whole view.
Definition: view.cpp:1138
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:609
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:598
void Clear()
Remove all items from the view.
Definition: view.cpp:1104
bool IsVisible(const VIEW_ITEM *aItem) const
Return information if the item is visible (or not).
Definition: view.cpp:1498
bool visible
Is the layer to be rendered?
Definition: view.h:716
virtual int GetTopLayer() const
Definition: view.cpp:821
void SetLayerDisplayOnly(int aLayer, bool aDisplayOnly=true)
Definition: view.h:449
bool m_mirrorX
Definition: view.h:841
void invalidateItem(VIEW_ITEM *aItem, int aUpdateFlags)
Manage dirty flags & redraw queuing when updating an item.
Definition: view.cpp:1207
void ClearPreview()
Definition: view.cpp:1534
const VECTOR2I & GetScreenPixelSize() const
Return the size of the our rendering area in pixels.
Definition: view.cpp:1171
bool m_dynamic
Flag to mark targets as dirty so they have to be redrawn on the next refresh event.
Definition: view.h:852
Extend VIEW_ITEM by possibility of grouping items into a single object.
Definition: view_group.h:46
int id
Layer ID.
Definition: view.h:722
bool diffLayer
Layer should be drawn differentially over lower layers.
Definition: view.h:718
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:388
void ReorderLayerData(std::unordered_map< int, int > aReorderMap)
Remap the data between layer ids without invalidating that data.
Definition: view.cpp:675
void UpdateItems()
Iterate through the list of items that asked for updating and updates them.
Definition: view.cpp:1406
void markTargetClean(int aTarget)
Definition: view.h:735
void updateBbox(VIEW_ITEM *aItem)
Update set of layers that an item occupies.
Definition: view.cpp:1313
PAINTER * m_painter
Interface to #PAINTER that is used to draw items.
Definition: view.h:845
bool IsDynamic() const
Tell if the VIEW is dynamic (ie.
Definition: view.h:571
bool m_reverseDrawOrder
Definition: view.h:867
int m_nextDrawPriority
Flag to reverse the draw order when using draw priority.
Definition: view.h:864
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:466
std::vector< VIEW_LAYER > m_layers
Sorted list of pointers to members of m_layers.
Definition: view.h:822
void ClearTopLayers()
Remove all layers from the on-the-top set (they are no longer displayed over the rest of layers).
Definition: view.cpp:882
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:238
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:550
void clearGroupCache()
Definition: view.cpp:1195
double m_maxScale
Definition: view.h:839
void UpdateLayerColor(int aLayer)
Apply the new coloring scheme held by RENDER_SETTINGS in case that it has changed.
Definition: view.cpp:745
std::unique_ptr< VIEW > DataReference() const
Return a new VIEW object that shares the same set of VIEW_ITEMs and LAYERs.
Definition: view.cpp:1448
bool m_dirtyTargets[TARGETS_NUMBER]
Rendering order modifier for layers that are marked as top layers.
Definition: view.h:855
void redrawRect(const BOX2I &aRect)
Definition: view.cpp:987
std::vector< EDA_ITEM * > m_ownedItems
Whether to use rendering order modifier or not.
Definition: view.h:816
void updateItemGeometry(VIEW_ITEM *aItem, int aLayer)
Update bounding box of an item.
Definition: view.cpp:1283
Main rendering target (cached)
Definition: definitions.h:48
bool m_enableOrderModifier
The set of possible displayed layers and its properties.
Definition: view.h:819
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:243
BOX2D m_boundary
Definition: view.h:837
std::vector< VIEW_LAYER * > m_orderedLayers
Flat list of all items.
Definition: view.h:825
void MarkClean()
Force redraw of view on the next rendering.
Definition: view.h:642
std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
Definition: view.h:73
int GetLayerOrder(int aLayer) const
Return rendering order of a particular layer.
Definition: view.cpp:641
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Draw an item, but on a specified layers.
Definition: view.cpp:1020
bool IsCached(int aLayer) const
Return true if the layer is cached.
Definition: view.h:616
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:842
void ClearTargets()
Clear targets that are marked as dirty.
Definition: view.cpp:1119
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Definition: view.cpp:1458
void CopySettings(const VIEW *aOtherView)
Copy layers and visibility settings from another view.
Definition: view.cpp:485
void SetPainter(PAINTER *aPainter)
Set the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:198
double m_scale
Definition: view.h:836
int renderingOrder
Rendering order of this layer.
Definition: view.h:721
void SetLayerHasNegatives(int aLayer, bool aNegatives=true)
Set the status of negatives presense in a particular layer.
Definition: view.h:437
bool displayOnly
Is the layer display only?
Definition: view.h:717
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:318
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:424
bool IsMirroredY() const
Return true if view is flipped across the Y axis.
Definition: view.h:246
virtual ~VIEW()
Definition: view.cpp:312
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:258
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
void SetBoundary(const BOX2D &aBoundary)
Set limits for view area.
Definition: view.h:274
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:766
double GetScale() const
Definition: view.h:264
void SetGAL(GAL *aGal)
Assign a rendering device for the VIEW.
Definition: view.cpp:491
static bool compareRenderingOrder(VIEW_LAYER *aI, VIEW_LAYER *aJ)
Check if every layer required by the aLayerId layer is enabled.
Definition: view.h:800
void MarkDirty()
Force redraw of view on the next rendering.
Definition: view.h:633
std::set< int > requiredLayers
Layers that have to be enabled to show the layer.
Definition: view.h:724
bool IsDirty() const
Return true if any of the VIEW layers needs to be refreshened.
Definition: view.h:581
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:1512
Abstract interface for drawing on a 2D-surface.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:405
RENDER_TARGET target
Where the layer should be rendered.
Definition: view.h:723
std::shared_ptr< VIEW_RTREE > items
R-tree indexing all items on this layer.
Definition: view.h:720