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 }
void moveCenter(const QPointF &position)
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).
bool inSceneSpace() const
Is this item drawn in scene coordinates (as oposed to HUD coordinates)?
qreal height() const const
QSizeF size() const const
QString text() const const
QRectF boundingRect() const const
void setWidth(qreal width)
QRectF boundingRect() const override
Bounding box of this item in scene coordinates.
Qt::BrushStyle style() const const
QRectF boundingRect() const override
Bounding box of this item in scene coordinates.
bool inHUDSpace() const
Is this item drawn in HUD coordinates (as oposed to scene coordinates)?
Qt::PenStyle style() const const
uint8_t renderPhases() const override
Returns in which phase this item needs to be rendered (can be multiple).
QRectF boundingRect() const const
void adjust(qreal dx1, qreal dy1, qreal dx2, qreal dy2)
QRectF boundingRect() const override
Bounding box of this item in scene coordinates.
bool isNull() const const
bool isEmpty() const const
OSM-based multi-floor indoor maps for buildings.
QRectF boundingRect() const override
Bounding box of this item in scene coordinates.
qreal width() const const
virtual uint8_t renderPhases() const =0
Returns in which phase this item needs to be rendered (can be multiple).
void setHeight(qreal height)
qreal width() const const
qreal height() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Sep 26 2022 04:18:50 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.