10#include <QGuiApplication> 
   15SceneGraph::SceneGraph() = 
default;
 
   17SceneGraph::~SceneGraph() = 
default;
 
   23    m_previousItems.clear();
 
   24    m_layerOffsets.clear();
 
 
   32    m_items.push_back(std::move(item));
 
   35void SceneGraph::zSort()
 
   37    std::stable_sort(m_items.begin(), m_items.end(), SceneGraph::zOrderCompare);
 
   38    recomputeLayerIndex();
 
   43    return (uint64_t)item.
element.boundingBox().width() * (uint64_t)item.
element.boundingBox().height();
 
   54    if (lhs.level == rhs.level) {
 
   55        if (lhs.layer == rhs.layer) {
 
   56            if (lhs.payload->z == rhs.payload->z) {
 
   57                return area(lhs) > area(rhs);
 
   59            return lhs.payload->z < rhs.payload->z;
 
   61        return lhs.layer < rhs.layer;
 
   63    return lhs.level < rhs.level;
 
   66void SceneGraph::beginSwap()
 
   68    std::swap(m_items, m_previousItems);
 
   70    std::sort(m_previousItems.begin(), m_previousItems.end(), SceneGraph::itemPoolCompare);
 
   71    m_layerOffsets.clear();
 
   74void SceneGraph::endSwap()
 
   76    m_previousItems.clear();
 
   79int SceneGraph::zoomLevel()
 const 
   84void SceneGraph::setZoomLevel(
int zoom)
 
   89int SceneGraph::currentFloorLevel()
 const 
   94void SceneGraph::setCurrentFloorLevel(
int level)
 
  104void SceneGraph::setBackgroundColor(
const QColor &bg)
 
  109void SceneGraph::recomputeLayerIndex()
 
  111    m_layerOffsets.clear();
 
  112    if (m_items.empty()) {
 
  117    for (
auto it = m_items.begin(); it != m_items.end();) {
 
  118        it = std::upper_bound(it, m_items.end(), *it, [](
const auto &lhs, 
const auto &rhs) {
 
  119            if (lhs.level == rhs.level) {
 
  120                return lhs.layer < rhs.layer;
 
  122            return lhs.level < rhs.level;
 
  124        const auto nextIndex = std::distance(m_items.begin(), it);
 
  125        m_layerOffsets.push_back(std::make_pair(prevIndex, nextIndex));
 
  126        prevIndex = nextIndex;
 
  130const std::vector<SceneGraph::LayerOffset>& SceneGraph::layerOffsets()
 const 
  132    return m_layerOffsets;
 
  135SceneGraph::SceneGraphItemIter SceneGraph::itemsBegin(SceneGraph::LayerOffset layer)
 const 
  137    return m_items.begin() + layer.first;
 
  140SceneGraph::SceneGraphItemIter SceneGraph::itemsEnd(SceneGraph::LayerOffset layer)
 const 
  142    return m_items.begin() + layer.second;
 
  145const std::vector<SceneGraphItem>& SceneGraph::items()
 const 
  154            if (lhs.layerSelector == rhs.layerSelector) {
 
  155                return lhs.level < rhs.level;
 
  157            return lhs.layerSelector < rhs.layerSelector;
 
Scene graph item description and handle for its content.
 
OSM::Element element
The OSM::Element this item refers to.
 
Scene graph of the currently displayed level.
 
void clear()
Clears all data from the scene graph.
 
QColor backgroundColor() const
Canvas background color.
 
OSM-based multi-floor indoor maps for buildings.
 
QStringView level(QStringView ifopt)
 
QAction * zoom(const QObject *recvr, const char *slot, QObject *parent)