KOSMIndoorMap

scenegraphitem.cpp
1 /*
2  SPDX-FileCopyrightText: 2020 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "scenegraphitem.h"
8 
9 #include <QDebug>
10 
11 using namespace KOSMIndoorMap;
12 
13 SceneGraphItemPayload::~SceneGraphItemPayload() = default;
14 
16 {
17  return renderPhases() & (FillPhase | StrokePhase | CasingPhase);
18 }
19 
21 {
22  return renderPhases() & LabelPhase;
23 }
24 
25 
27 {
28  return (pen.style() != Qt::NoPen ? StrokePhase : NoPhase) | (casingPen.style() != Qt::NoPen ? CasingPhase : NoPhase);
29 }
30 
32 {
33  return path.boundingRect(); // TODO do we need to cache this?
34 }
35 
36 
38 {
39  return (pen.style() == Qt::NoPen ? NoPhase : StrokePhase) | (brush.style() == Qt::NoBrush ? NoPhase : FillPhase);
40 }
41 
43 {
44  return polygon.boundingRect(); // TODO do we need to cache this?
45 }
46 
48 {
49  return path.boundingRect(); // TODO do we need to cache this?
50 }
51 
52 
53 uint8_t LabelItem::renderPhases() const
54 {
55  return LabelPhase;
56 }
57 
59 {
60  QRectF bbox;
61  if (!text.text().isEmpty()) {
62  bbox = QRectF(QPointF(0.0, 0.0), text.size());
63  }
64  if (!icon.isNull()) {
65  bbox.setHeight(bbox.height() + iconSize.height());
66  bbox.setWidth(std::max(bbox.width(), iconSize.width()));
67  }
68 
69  bbox.moveCenter(pos);
70  const auto shieldSize = std::max(frameWidth, haloRadius) + casingWidth;
71  bbox.adjust(-shieldSize, -shieldSize, shieldSize, shieldSize);
72  return bbox;
73 }
OSM-based multi-floor indoor maps for buildings.
virtual uint8_t renderPhases() const =0
Returns in which phase this item needs to be rendered (can be multiple).
QRectF boundingRect() const override
Bounding box of this item in scene coordinates.
bool inSceneSpace() const
Is this item drawn in scene coordinates (as oposed to HUD coordinates)?
QRectF boundingRect() const override
Bounding box of this item in scene coordinates.
void adjust(qreal dx1, qreal dy1, qreal dx2, qreal dy2)
void setHeight(qreal height)
uint8_t renderPhases() const override
Returns in which phase this item needs to be rendered (can be multiple).
bool inHUDSpace() const
Is this item drawn in HUD coordinates (as oposed to scene coordinates)?
void moveCenter(const QPointF &position)
QRectF boundingRect() const override
Bounding box of this item in scene coordinates.
uint8_t renderPhases() const override
Returns in which phase this item needs to be rendered (can be multiple).
uint8_t renderPhases() const override
Returns in which phase this item needs to be rendered (can be multiple).
qreal width() const const
void setWidth(qreal width)
qreal height() const const
QRectF boundingRect() const override
Bounding box of this item in scene coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Sep 27 2021 23:05:52 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.