• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • graphicsview
MarbleGraphicsItem_p.h
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2009-2010 Bastian Holst <bastianholst@gmx.de>
9 //
10 
11 #ifndef MARBLE_MARBLEGRAPHICSITEMPRIVATE_H
12 #define MARBLE_MARBLEGRAPHICSITEMPRIVATE_H
13 
14 // Marble
15 #include "AbstractMarbleGraphicsLayout.h"
16 #include "MarbleGraphicsItem.h"
17 
18 // Qt
19 #include<QDebug>
20 #include<QList>
21 #include<QSet>
22 #include<QSize>
23 #include<QSizeF>
24 #include<QRect>
25 #include<QPixmap>
26 
27 namespace Marble
28 {
29 
30 class MarbleGraphicsItemPrivate
31 {
32  public:
33  explicit MarbleGraphicsItemPrivate( MarbleGraphicsItem *marbleGraphicsItem,
34  MarbleGraphicsItem *parent = 0 )
35  : m_repaintNeeded( true ),
36  m_cacheMode( MarbleGraphicsItem::NoCache ),
37  m_visibility( true ),
38  m_parent( parent ),
39  m_children(),
40  m_layout( 0 ),
41  m_marbleGraphicsItem( marbleGraphicsItem )
42  {
43  if ( m_parent ) {
44  m_parent->p()->addChild( m_marbleGraphicsItem );
45  }
46  }
47 
48  virtual ~MarbleGraphicsItemPrivate()
49  {
50  // Remove from parent
51  if ( m_parent ) {
52  m_parent->p()->removeChild( m_marbleGraphicsItem );
53  }
54 
55  // Delete all children
56  qDeleteAll( m_children.toList() ); // delete using a copy, since children may invalidate m_children's iterator
57 
58  // Delete Layout
59  delete m_layout;
60  }
61 
62  void addChild( MarbleGraphicsItem *child )
63  {
64  m_children.insert( child );
65  }
66 
67  void removeChild( MarbleGraphicsItem *child )
68  {
69  m_children.remove( child );
70  }
71 
72  virtual QList<QPointF> positions() const = 0;
73 
74  virtual QList<QPointF> absolutePositions() const = 0;
75 
79  QList<QRectF> boundingRects() const;
80 
81  virtual void setProjection( const ViewportParams *viewport ) = 0;
82 
83  void updateChildPositions()
84  {
85  // This has to be done recursively because we need a correct size from all children.
86  foreach ( MarbleGraphicsItem *item, m_children ) {
87  item->p()->updateChildPositions();
88  }
89 
90  // Adjust positions
91  if ( m_layout ) {
92  m_layout->updatePositions( m_marbleGraphicsItem );
93  }
94  }
95 
96  QSizeF m_size;
97 
98  bool m_repaintNeeded;
99 
100  MarbleGraphicsItem::CacheMode m_cacheMode;
101 
102  QPixmap m_pixmap;
103 
104  bool m_visibility;
105 
106  // The parent of the item
107  MarbleGraphicsItem *const m_parent;
108  // The set of children.
109  QSet<MarbleGraphicsItem *> m_children;
110 
111  // The layout handling the positions of the children
112  AbstractMarbleGraphicsLayout *m_layout;
113 
114  MarbleGraphicsItem *const m_marbleGraphicsItem;
115 };
116 
117 }
118 
119 #endif
Marble::MarbleGraphicsItemPrivate::setProjection
virtual void setProjection(const ViewportParams *viewport)=0
Marble::AbstractMarbleGraphicsLayout::updatePositions
virtual void updatePositions(MarbleGraphicsItem *parent)=0
This updates the positions of all items in the layout.
Marble::MarbleGraphicsItemPrivate::m_children
QSet< MarbleGraphicsItem * > m_children
Definition: MarbleGraphicsItem_p.h:109
Marble::MarbleGraphicsItemPrivate::m_parent
MarbleGraphicsItem *const m_parent
Definition: MarbleGraphicsItem_p.h:107
Marble::MarbleGraphicsItemPrivate::absolutePositions
virtual QList< QPointF > absolutePositions() const =0
Marble::MarbleGraphicsItemPrivate::m_visibility
bool m_visibility
Definition: MarbleGraphicsItem_p.h:104
MarbleGraphicsItem.h
Marble::MarbleGraphicsItemPrivate::m_pixmap
QPixmap m_pixmap
Definition: MarbleGraphicsItem_p.h:102
Marble::MarbleGraphicsItemPrivate::removeChild
void removeChild(MarbleGraphicsItem *child)
Definition: MarbleGraphicsItem_p.h:67
Marble::MarbleGraphicsItem
Definition: MarbleGraphicsItem.h:34
QSet
QList< QPointF >
Marble::ViewportParams
A public class that controls what is visible in the viewport of a Marble map.
Definition: ViewportParams.h:44
Marble::MarbleGraphicsItemPrivate::MarbleGraphicsItemPrivate
MarbleGraphicsItemPrivate(MarbleGraphicsItem *marbleGraphicsItem, MarbleGraphicsItem *parent=0)
Definition: MarbleGraphicsItem_p.h:33
QPixmap
Marble::MarbleGraphicsItemPrivate::boundingRects
QList< QRectF > boundingRects() const
Used to get the set of screen bounding rects.
Definition: MarbleGraphicsItem.cpp:119
Marble::MarbleGraphicsItemPrivate::m_cacheMode
MarbleGraphicsItem::CacheMode m_cacheMode
Definition: MarbleGraphicsItem_p.h:100
Marble::MarbleGraphicsItemPrivate::positions
virtual QList< QPointF > positions() const =0
Marble::MarbleGraphicsItemPrivate::~MarbleGraphicsItemPrivate
virtual ~MarbleGraphicsItemPrivate()
Definition: MarbleGraphicsItem_p.h:48
QSizeF
Marble::MarbleGraphicsItemPrivate::updateChildPositions
void updateChildPositions()
Definition: MarbleGraphicsItem_p.h:83
Marble::MarbleGraphicsItemPrivate::addChild
void addChild(MarbleGraphicsItem *child)
Definition: MarbleGraphicsItem_p.h:62
Marble::MarbleGraphicsItemPrivate::m_size
QSizeF m_size
Definition: MarbleGraphicsItem_p.h:96
Marble::MarbleGraphicsItemPrivate::m_layout
AbstractMarbleGraphicsLayout * m_layout
Definition: MarbleGraphicsItem_p.h:112
Marble::MarbleGraphicsItemPrivate::m_marbleGraphicsItem
MarbleGraphicsItem *const m_marbleGraphicsItem
Definition: MarbleGraphicsItem_p.h:114
Marble::MarbleGraphicsItemPrivate
Definition: MarbleGraphicsItem_p.h:30
Marble::MarbleGraphicsItem::CacheMode
CacheMode
Definition: MarbleGraphicsItem.h:39
Marble::MarbleGraphicsItemPrivate::m_repaintNeeded
bool m_repaintNeeded
Definition: MarbleGraphicsItem_p.h:98
AbstractMarbleGraphicsLayout.h
Marble::AbstractMarbleGraphicsLayout
Definition: AbstractMarbleGraphicsLayout.h:22
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:40 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal