view.h 21.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2013 CERN
 * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

#ifndef __VIEW_H
#define __VIEW_H

#include <vector>
29
#include <set>
30 31 32
#include <boost/unordered/unordered_map.hpp>

#include <math/box2.h>
33
#include <gal/definitions.h>
34

35
namespace KIGFX
36 37 38 39
{
class PAINTER;
class GAL;
class VIEW_ITEM;
40
class VIEW_GROUP;
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
class VIEW_RTREE;

/**
 * Class VIEW.
 * Holds a (potentially large) number of VIEW_ITEMs and renders them on a graphics device
 * provided by the GAL. VIEWs can exist in two flavors:
 * - dynamic - where items can be added, removed or changed anytime, intended for the main
 *    editing panel. Each VIEW_ITEM can be added to a single dynamic view.
 * - static - where items are added once at the startup and are not linked with the VIEW.
 *    Foreseen for preview windows and printing.
 * Items in a view are grouped in layers (not to be confused with Kicad's PCB layers). Each layer is
 * identified by an integer number. Visibility and rendering order can be set individually for each
 * of the layers. Future versions of the VIEW will also allow to assign different layers to different
 * rendering targets, which will be composited at the final stage by the GAL.
 * The VIEW class also provides fast methods for finding all visible objects that are within a given
 * rectangular area, useful for object selection/hit testing.
 */
class VIEW
{
public:
    friend class VIEW_ITEM;

Maciej Suminski's avatar
Maciej Suminski committed
63
    typedef std::pair<VIEW_ITEM*, int> LAYER_ITEM_PAIR;
64 65 66

    /**
     * Constructor.
67
     * @param aIsDynamic decides whether we are creating a static or a dynamic VIEW.
68
     */
69
    VIEW( bool aIsDynamic = true );
70 71 72 73 74 75 76 77

    ~VIEW();

    /**
     * Function Add()
     * Adds a VIEW_ITEM to the view.
     * @param aItem: item to be added. No ownership is given
     */
78
    void Add( VIEW_ITEM* aItem );
79 80 81 82 83 84

    /**
     * Function Remove()
     * Removes a VIEW_ITEM from the view.
     * @param aItem: item to be removed. Caller must dispose the removed item if necessary
     */
85
    void Remove( VIEW_ITEM* aItem );
86

87 88
    /**
     * Function Query()
89 90 91
     * Finds all visible items that touch or are within the rectangle aRect.
     * @param aRect area to search for items
     * @param aResult result of the search, containing VIEW_ITEMs associated with their layers.
92 93
     *  Sorted according to the rendering order (items that are on top of the rendering stack as
     *  first).
94 95
     * @return Number of found items.
     */
Maciej Suminski's avatar
Maciej Suminski committed
96
    int Query( const BOX2I& aRect, std::vector<LAYER_ITEM_PAIR>& aResult ) const;
97

98 99 100 101 102 103 104 105
    /**
     * Function SetRequired()
     * Marks the aRequiredId layer as required for the aLayerId layer. In order to display the
     * layer, all of its required layers have to be enabled.
     * @param aLayerId is the id of the layer for which we enable/disable the required layer.
     * @param aRequiredId is the id of the required layer.
     * @param aRequired tells if the required layer should be added or removed from the list.
     */
106
    void SetRequired( int aLayerId, int aRequiredId, bool aRequired = true );
107

108 109 110 111 112
    /**
     * Function CopySettings()
     * Copies layers and visibility settings from another view.
     * @param aOtherView: view from which settings will be copied.
     */
113
    void CopySettings( const VIEW* aOtherView );
114 115 116

    /*
     *  Convenience wrappers for adding multiple items
117 118
     *  template <class T> void AddItems( const T& aItems );
     *  template <class T> void RemoveItems( const T& aItems );
119 120 121 122 123 124 125
     */

    /**
     * Function SetGAL()
     * Assigns a rendering device for the VIEW.
     * @param aGal: pointer to the GAL output device
     */
126
    void SetGAL( GAL* aGal );
127 128 129 130 131 132

    /**
     * Function GetGAL()
     * Returns the GAL this view is using to draw graphical primitives.
     * @return Pointer to the currently used GAL instance.
     */
Maciej Suminski's avatar
Maciej Suminski committed
133 134 135 136
    GAL* GetGAL() const
    {
        return m_gal;
    }
137 138 139 140 141

    /**
     * Function SetPainter()
     * Sets the painter object used by the view for drawing VIEW_ITEMS.
     */
Maciej Suminski's avatar
Maciej Suminski committed
142 143 144 145
    void SetPainter( PAINTER* aPainter )
    {
        m_painter = aPainter;
    }
146 147 148 149 150 151

    /**
     * Function GetPainter()
     * Returns the painter object used by the view for drawing VIEW_ITEMS.
     * @return Pointer to the currently used Painter instance.
     */
Maciej Suminski's avatar
Maciej Suminski committed
152 153 154 155
    PAINTER* GetPainter() const
    {
        return m_painter;
    }
156 157 158 159 160 161

    /**
     * Function SetViewport()
     * Sets the visible area of the VIEW.
     * @param aViewport: desired visible area, in world space coordinates.
     */
162
    void SetViewport( const BOX2D& aViewport );
163 164 165 166 167 168

    /**
     * Function GetViewport()
     * Returns the current viewport visible area rectangle.
     * @return Current viewport rectangle
     */
169
    BOX2D GetViewport() const;
170 171 172 173 174 175 176

    /**
     * Function SetMirror()
     *  Controls the mirroring of the VIEW.
     *  @param aMirrorX: when true, the X axis is mirrored
     *  @param aMirrorY: when true, the Y axis is mirrored.
     */
177
    void SetMirror( bool aMirrorX, bool aMirrorY );
178 179 180 181 182 183 184

    /**
     * Function SetScale()
     * Sets the scaling factor. Scale = 1 corresponds to the real world size of the objects
     * (depending on correct GAL unit length & DPI settings).
     * @param aScale: the scalefactor
     */
Maciej Suminski's avatar
Maciej Suminski committed
185 186 187 188
    void SetScale( double aScale )
    {
        SetScale( aScale, m_center );
    }
189 190 191 192 193

    /**
     * Function SetScale()
     * Sets the scaling factor, zooming around a given anchor point.
     * (depending on correct GAL unit length & DPI settings).
194
     * @param aAnchor: the zooming  anchor point
195 196
     * @param aScale: the scale factor
     */
197
    void SetScale( double aScale, const VECTOR2D& aAnchor );
198 199 200 201 202

    /**
     * Function GetScale()
     * @return Current scalefactor of this VIEW
     */
203
    double GetScale() const
Maciej Suminski's avatar
Maciej Suminski committed
204 205 206
    {
        return m_scale;
    }
207 208 209 210 211 212 213

    /**
     * Function SetCenter()
     * Sets the center point of the VIEW (i.e. the point in world space that will be drawn in the middle
     * of the screen).
     * @param aCenter: the new center point, in world space coordinates.
     */
214
    void SetCenter( const VECTOR2D& aCenter );
215 216 217 218 219 220

    /**
     * Function GetCenter()
     * Returns the center point of this VIEW (in world space coordinates)
     * @return center point of the view
     */
Maciej Suminski's avatar
Maciej Suminski committed
221 222 223 224
    const VECTOR2D& GetCenter() const
    {
        return m_center;
    }
225 226 227 228 229 230 231

    /**
     * Function ToWorld()
     * Converts a screen space point/vector to a point/vector in world space coordinates.
     * @param aCoord: the point/vector to be converted
     * @param aAbsolute: when true, aCoord is treated as a point, otherwise - as a direction (vector)
     */
232
    VECTOR2D ToWorld( const VECTOR2D& aCoord, bool aAbsolute = true ) const;
233

234 235 236 237
    /**
     * Function ToWorld()
     * Converts a screen space one dimensional size to a one dimensional size in world
     * space coordinates.
238
     * @param aSize : the size to be converted
239 240 241
     */
    double ToWorld( double aSize ) const;

242 243 244 245 246 247
    /**
     * Function ToScreen()
     * Converts a world space point/vector to a point/vector in screen space coordinates.
     * @param aCoord: the point/vector to be converted
     * @param aAbsolute: when true, aCoord is treated as a point, otherwise - as a direction (vector)
     */
248
    VECTOR2D ToScreen( const VECTOR2D& aCoord, bool aAbsolute = true ) const;
249 250 251 252 253 254 255

    /**
     * Function ToScreen()
     * Converts a world space coordinate to a coordinate in screen space coordinates.
     * @param aCoord: the coordinate to be transformed.
     * @param aAbsolute: when true, aCoord is treated as a point, otherwise - as a direction (vector)
     */
256
    double ToScreen( double aCoord, bool aAbsolute = true ) const;
257 258 259 260 261 262

    /**
     * Function GetScreenPixelSize()
     * Returns the size of the our rendering area, in pixels.
     * @return viewport screen size
     */
263
    const VECTOR2I& GetScreenPixelSize() const;
264 265 266 267 268 269 270 271

    /**
     * Function AddLayer()
     * Adds a new layer to the view.
     * @param aLayer: unique ID of the layer to be added.
     * @param aDisplayOnly: layer is display-only (example: selection boxes, floating hints/menus).
     * Objects belonging to this layer are not taken into account by Query() method.
     */
272
    void AddLayer( int aLayer, bool aDisplayOnly = false );
273 274 275 276 277 278

    /**
     * Function ClearLayer()
     * Removes all items from a given layer.
     * @param aLayer: ID of the layer to be cleared
     */
279
    void ClearLayer( int aLayer );
280 281 282 283 284

    /**
     * Function Clear()
     * Removes all items from the view.
     */
285
    void Clear();
286 287 288 289

    /**
     * Function SetLayerVisible()
     * Controls the visibility of a particular layer.
290 291
     * @param aLayer: the layer to show/hide.
     * @param aVisible: the obvious.
292
     */
293 294
    inline void SetLayerVisible( int aLayer, bool aVisible = true )
    {
295 296
        wxASSERT( aLayer < (int) m_layers.size() );

Maciej Suminski's avatar
Maciej Suminski committed
297
        if( m_layers[aLayer].visible != aVisible )
298 299 300
        {
            // Target has to be redrawn after changing its visibility
            MarkTargetDirty( m_layers[aLayer].target );
Maciej Suminski's avatar
Maciej Suminski committed
301
            m_layers[aLayer].visible = aVisible;
302
        }
303 304
    }

305 306 307 308 309 310 311
    /**
     * Function IsLayerVisible()
     * Returns information about visibility of a particular layer.
     * @param aLayer: true if the layer is visible, false otherwise
     */
    inline bool IsLayerVisible( int aLayer ) const
    {
312 313
        wxASSERT( aLayer < (int) m_layers.size() );

Maciej Suminski's avatar
Maciej Suminski committed
314
        return m_layers.at( aLayer ).visible;
315 316
    }

317 318 319 320 321 322 323
    inline void SetLayerDisplayOnly( int aLayer, bool aDisplayOnly = true )
    {
        wxASSERT( aLayer < (int) m_layers.size() );

        m_layers[aLayer].displayOnly = aDisplayOnly;
    }

324
    /**
325 326 327 328
     * Function SetLayerTarget()
     * Changes the rendering target for a particular layer.
     * @param aLayer is the layer.
     * @param aTarget is the rendering target.
329
     */
Maciej Suminski's avatar
Maciej Suminski committed
330
    inline void SetLayerTarget( int aLayer, RENDER_TARGET aTarget )
331
    {
332 333
        wxASSERT( aLayer < (int) m_layers.size() );

334
        m_layers[aLayer].target = aTarget;
335
    }
336 337

    /**
338
     * Function SetLayerOrder()
339
     * Sets rendering order of a particular layer. Lower values are rendered first.
340 341 342
     * @param aLayer: the layer
     * @param aRenderingOrder: arbitrary number denoting the rendering order.
     */
343
    void SetLayerOrder( int aLayer, int aRenderingOrder );
344

345 346 347 348 349 350
    /**
     * Function GetLayerOrder()
     * Returns rendering order of a particular layer. Lower values are rendered first.
     * @param aLayer: the layer
     * @return Rendering order of a particular layer.
     */
351
    int GetLayerOrder( int aLayer ) const;
352 353 354 355 356 357 358 359 360

    /**
     * Function SortLayers()
     * Changes the order of given layer ids, so after sorting the order corresponds to layers
     * rendering order (descending, ie. order in which layers should be drawn - from the bottom to
     * the top).
     * @param aLayers stores id of layers to be sorted.
     * @param aCount stores the number of layers.
     */
361
    void SortLayers( int aLayers[], int& aCount ) const;
362

363 364 365 366 367 368
    /**
     * Function UpdateLayerColor()
     * Applies the new coloring scheme held by RENDER_SETTINGS in case that it has changed.
     * @param aLayer is a number of the layer to be updated.
     * @see RENDER_SETTINGS
     */
369
    void UpdateLayerColor( int aLayer );
370 371 372 373 374 375

    /**
     * Function UpdateAllLayersColor()
     * Applies the new coloring scheme to all layers. The used scheme is held by RENDER_SETTINGS.
     * @see RENDER_SETTINGS
     */
376
    void UpdateAllLayersColor();
377

378 379 380 381 382 383
    /**
     * Function ChangeLayerDepth()
     * Changes the depth of items on the given layer.
     * @param aLayer is a number of the layer to be updated.
     * @param aDepth is the new depth.
     */
384
    void ChangeLayerDepth( int aLayer, int aDepth );
385

386 387 388 389 390 391
    /**
     * Function SetTopLayer()
     * Sets given layer to be displayed on the top or sets back the default order of layers.
     * @param aLayer: the layer or -1 in case when no particular layer should
     * be displayed on the top.
     */
392
    void SetTopLayer( int aLayer, bool aEnabled = true );
393 394 395 396 397 398

    /**
     * Function EnableTopLayer()
     * Enables or disables display of the top layer. When disabled - layers are rendered as usual
     * with no influence from SetTopLayer function. Otherwise on the top there is displayed the
     * layer set previously with SetTopLayer function.
399
     * @param aEnable whether to enable or disable display of the top layer.
400
     */
401
    void EnableTopLayer( bool aEnable );
402

403
    int GetTopLayer() const;
404

405 406 407 408 409
    /**
     * Function ClearTopLayers()
     * Removes all layers from the on-the-top set (they are no longer displayed over the rest of
     * layers).
     */
410
    void ClearTopLayers();
411 412 413 414 415 416

    /**
     * Function UpdateLayerOrder()
     * Does everything that is needed to apply the rendering order of layers. It has to be called
     * after modification of renderingOrder field of LAYER.
     */
417
    void UpdateAllLayersOrder();
418

419
    /**
420
     * Function ClearTargets()
421 422
     * Clears targets that are marked as dirty.
     */
423
    void ClearTargets();
424

425 426 427 428
    /**
     * Function Redraw()
     * Immediately redraws the whole view.
     */
429
    void Redraw();
430

431 432 433 434
    /**
     * Function RecacheAllItems()
     * Rebuilds GAL display lists.
     * @param aForceNow decides if every item should be instantly recached. Otherwise items are
Maciej Suminski's avatar
Maciej Suminski committed
435
     * going to be recached when they become visible.
436
     */
437
    void RecacheAllItems( bool aForceNow = false );
438

439 440 441 442 443
    /**
     * Function IsDynamic()
     * Tells if the VIEW is dynamic (ie. can be changed, for example displaying PCBs in a window)
     * or static (that cannot be modified, eg. displaying image/PDF).
     */
Maciej Suminski's avatar
Maciej Suminski committed
444 445 446 447
    bool IsDynamic() const
    {
        return m_dynamic;
    }
448

449 450 451 452 453
    /**
     * Function IsDirty()
     * Returns true if any of the VIEW layers needs to be refreshened.
     * @return True in case if any of layers is marked as dirty.
     */
Maciej Suminski's avatar
Maciej Suminski committed
454 455 456 457 458 459 460 461 462 463
    bool IsDirty() const
    {
        for( int i = 0; i < TARGETS_NUMBER; ++i )
        {
            if( IsTargetDirty( i ) )
                return true;
        }

        return false;
    }
464

465 466 467 468 469 470
    /**
     * Function IsTargetDirty()
     * Returns true if any of layers belonging to the target or the target itself should be
     * redrawn.
     * @return True if the above condition is fulfilled.
     */
Maciej Suminski's avatar
Maciej Suminski committed
471 472 473 474 475 476
    bool IsTargetDirty( int aTarget ) const
    {
        wxASSERT( aTarget < TARGETS_NUMBER );

        return m_dirtyTargets[aTarget];
    }
477

478
    /**
479
     * Function MarkTargetDirty()
480 481 482
     * Sets or clears target 'dirty' flag.
     * @param aTarget is the target to set.
     */
483
    inline void MarkTargetDirty( int aTarget )
484 485 486
    {
        wxASSERT( aTarget < TARGETS_NUMBER );

487
        m_dirtyTargets[aTarget] = true;
488 489
    }

490 491 492
    /// Returns true if the layer is cached
    inline bool IsCached( int aLayer ) const
    {
493 494
        wxASSERT( aLayer < (int) m_layers.size() );

495
        return m_layers.at( aLayer ).target == TARGET_CACHED;
496 497
    }

Maciej Suminski's avatar
Maciej Suminski committed
498 499 500 501 502
    /**
     * Function MarkDirty()
     * Forces redraw of view on the next rendering.
     */
    void MarkDirty()
503
    {
Maciej Suminski's avatar
Maciej Suminski committed
504
        for( int i = 0; i < TARGETS_NUMBER; ++i )
505 506
            m_dirtyTargets[i] = true;
    }
507

Maciej Suminski's avatar
Maciej Suminski committed
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523
    /**
     * Function MarkForUpdate()
     * Adds an item to a list of items that are going to be refreshed upon the next frame rendering.
     * @param aItem is the item to be refreshed.
     */
    void MarkForUpdate( VIEW_ITEM* aItem )
    {
        m_needsUpdate.push_back( aItem );
    }

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

Dick Hollenbeck's avatar
Dick Hollenbeck committed
524
    const BOX2I CalculateExtents() ;
525

526
    static const int VIEW_MAX_LAYERS = 256;      ///< maximum number of layers that may be shown
527 528 529 530

private:
    struct VIEW_LAYER
    {
Maciej Suminski's avatar
Maciej Suminski committed
531 532 533 534 535 536 537
        bool                    visible;         ///< is the layer to be rendered?
        bool                    displayOnly;     ///< is the layer display only?
        VIEW_RTREE*             items;           ///< R-tree indexing all items on this layer.
        int                     renderingOrder;  ///< rendering order of this layer
        int                     id;              ///< layer ID
        RENDER_TARGET           target;          ///< where the layer should be rendered
        std::set<int>           requiredLayers;  ///< layers that have to be enabled to show the layer
538 539 540
    };

    // Convenience typedefs
Maciej Suminski's avatar
Maciej Suminski committed
541 542 543 544
    typedef boost::unordered_map<int, VIEW_LAYER>   LAYER_MAP;
    typedef LAYER_MAP::iterator                     LAYER_MAP_ITER;
    typedef std::vector<VIEW_LAYER*>                LAYER_ORDER;
    typedef std::vector<VIEW_LAYER*>::iterator      LAYER_ORDER_ITER;
545 546

    // Function objects that need to access VIEW/VIEW_ITEM private/protected members
547
    struct clearLayerCache;
548
    struct recacheItem;
549
    struct drawItem;
550
    struct unlinkItem;
551
    struct updateItemsColor;
552
    struct changeItemsDepth;
553 554
    struct extentsVisitor;

555 556

    ///* Redraws contents within rect aRect
557
    void redrawRect( const BOX2I& aRect );
558

Maciej Suminski's avatar
Maciej Suminski committed
559
    inline void markTargetClean( int aTarget )
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575
    {
        wxASSERT( aTarget < TARGETS_NUMBER );

        m_dirtyTargets[aTarget] = false;
    }

    /**
     * Function draw()
     * Draws an item, but on a specified layers. It has to be marked that some of drawing settings
     * are based on the layer on which an item is drawn.
     *
     * @param aItem is the item to be drawn.
     * @param aLayer is the layer which should be drawn.
     * @param aImmediate dictates the way of drawing - it allows to force immediate drawing mode
     * for cached items.
     */
Maciej Suminski's avatar
Maciej Suminski committed
576
    void draw( VIEW_ITEM* aItem, int aLayer, bool aImmediate = false );
577 578 579 580 581 582 583 584 585

    /**
     * Function draw()
     * Draws an item on all layers that the item uses.
     *
     * @param aItem is the item to be drawn.
     * @param aImmediate dictates the way of drawing - it allows to force immediate drawing mode
     * for cached items.
     */
Maciej Suminski's avatar
Maciej Suminski committed
586
    void draw( VIEW_ITEM* aItem, bool aImmediate = false );
587 588 589 590 591

    /**
     * Function draw()
     * Draws a group of items on all layers that those items use.
     *
592
     * @param aGroup is the group to be drawn.
593 594 595
     * @param aImmediate dictates the way of drawing - it allows to force immediate drawing mode
     * for cached items.
     */
Maciej Suminski's avatar
Maciej Suminski committed
596
    void draw( VIEW_GROUP* aGroup, bool aImmediate = false );
597

598
    ///* Sorts m_orderedLayers when layer rendering order has changed
599
    void sortLayers();
600

601 602
    ///* Clears cached GAL group numbers (*ONLY* numbers stored in VIEW_ITEMs, not group objects
    ///* used by GAL)
603
    void clearGroupCache();
604

Maciej Suminski's avatar
Maciej Suminski committed
605
    /**
606
     * Function invalidateItem()
Maciej Suminski's avatar
Maciej Suminski committed
607 608 609 610 611 612
     * Manages dirty flags & redraw queueing when updating an item.
     * @param aItem is the item to be updated.
     * @param aUpdateFlags determines the way an item is refreshed.
     */
    void invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags );

613
    /// Updates colors that are used for an item to be drawn
614
    void updateItemColor( VIEW_ITEM* aItem, int aLayer );
615 616 617 618

    /// Updates all informations needed to draw an item
    void updateItemGeometry( VIEW_ITEM* aItem, int aLayer );

619 620 621
    /// Updates bounding box of an item
    void updateBbox( VIEW_ITEM* aItem );

622 623 624
    /// Updates set of layers that an item occupies
    void updateLayers( VIEW_ITEM* aItem );

625
    /// Determines rendering order of layers. Used in display order sorting function.
Maciej Suminski's avatar
Maciej Suminski committed
626
    static bool compareRenderingOrder( VIEW_LAYER* aI, VIEW_LAYER* aJ )
627
    {
Maciej Suminski's avatar
Maciej Suminski committed
628
        return aI->renderingOrder > aJ->renderingOrder;
629
    }
630

631 632
    /// Checks if every layer required by the aLayerId layer is enabled.
    bool areRequiredLayersEnabled( int aLayerId ) const;
633

634 635 636
    ///* Whether to use rendering order modifier or not
    bool m_enableOrderModifier;

637
    /// Contains set of possible displayed layers and its properties
Maciej Suminski's avatar
Maciej Suminski committed
638
    LAYER_MAP m_layers;
639

640
    /// Sorted list of pointers to members of m_layers
Maciej Suminski's avatar
Maciej Suminski committed
641
    LAYER_ORDER m_orderedLayers;
642

643 644 645
    /// Stores set of layers that are displayed on the top
    std::set<unsigned int> m_topLayers;

646
    /// Center point of the VIEW (the point at which we are looking at)
647
    VECTOR2D m_center;
648 649

    /// Scale of displayed VIEW_ITEMs
650
    double m_scale;
651 652

    /// PAINTER contains information how do draw items
653
    PAINTER* m_painter;
654 655

    /// Gives interface to PAINTER, that is used to draw items
656
    GAL* m_gal;
657 658 659

    /// Dynamic VIEW (eg. display PCB in window) allows changes once it is built,
    /// static (eg. image/PDF) - does not.
660
    bool m_dynamic;
661

662
    /// Flags to mark targets as dirty, so they have to be redrawn on the next refresh event
663
    bool m_dirtyTargets[TARGETS_NUMBER];
664

665 666
    /// Rendering order modifier for layers that are marked as top layers
    static const int TOP_LAYER_MODIFIER = -VIEW_MAX_LAYERS;
667

Maciej Suminski's avatar
Maciej Suminski committed
668 669
    /// Items to be updated
    std::vector<VIEW_ITEM*> m_needsUpdate;
670
};
671
} // namespace KIGFX
672 673

#endif