diff --git a/src/lib/marble/geodata/CMakeLists.txt b/src/lib/marble/geodata/CMakeLists.txt --- a/src/lib/marble/geodata/CMakeLists.txt +++ b/src/lib/marble/geodata/CMakeLists.txt @@ -76,6 +76,7 @@ geodata/data/GeoDataDelete.cpp geodata/data/GeoDataSchemaData.cpp geodata/data/GeoDataSimpleData.cpp + geodata/data/GeoDataBuilding.cpp ) SET ( geodata_scene_SRCS diff --git a/src/lib/marble/geodata/data/GeoDataBuilding.h b/src/lib/marble/geodata/data/GeoDataBuilding.h new file mode 100644 --- /dev/null +++ b/src/lib/marble/geodata/data/GeoDataBuilding.h @@ -0,0 +1,108 @@ +// +// This file is part of the Marble Virtual Globe. +// +// This program is free software licensed under the GNU LGPL. You can +// find a copy of this license in LICENSE.txt in the top directory of +// the source code. +// +// Copyright 2017 Mohammed Nafees +// + +#ifndef MARBLE_GEODATABUILDING_H +#define MARBLE_GEODATABUILDING_H + +#include + +#include "GeoDataGeometry.h" + +#include "geodata_export.h" + +namespace Marble { +class GeoDataBuildingPrivate; + +/*! + \class GeoDataBuilding + \brief Contains important information about a building and its floors (levels) + + GeoDataBuilding holds information such as minimum floor, maximum floor, + floor data and their respective MultiGeometry and other possible metadata such + as the total height of the building, type etc. + */ + +class GEODATA_EXPORT GeoDataBuilding : public GeoDataGeometry { + public: + explicit GeoDataBuilding(const GeoDataGeometry &other); + explicit GeoDataBuilding(const GeoDataBuilding &other); + + GeoDataBuilding& operator=(const GeoDataBuilding &other); + + /*! + Destroys the GeoDataBuilding +*/ + ~GeoDataBuilding() override; + + +/*! + @return the height of the building +*/ + double height() const; + + +/*! + Sets the height of the building + @param height + */ + void setHeight(double height); + + +/*! + @return the minimum level + */ + int minLevel() const; + + +/*! + Sets the minimum level of the building + @param minLevel + */ + void setMinLevel(int minLevel); + + +/*! + @return the maximum level of the building + */ + int maxLevel() const; + + +/*! + Sets the maximum level of the building + @param maxLevel + */ + void setMaxLevel(int maxLevel); + + +/*! + @return the non existent levels in the building + */ + QVector nonExistentLevels() const; + + +/*! + Sets the non existent levels of the building + @param nonExistentLevels + */ + void setNonExistentLevels(const QVector& nonExistentLevels); + + +/*! + * @return the multigeometry associated with the building + */ + GeoDataMultiGeometry* multiGeometry() const; + +private: + GeoDataBuildingPrivate* const d; +}; + +} + +#endif diff --git a/src/lib/marble/geodata/data/GeoDataBuilding.cpp b/src/lib/marble/geodata/data/GeoDataBuilding.cpp new file mode 100644 --- /dev/null +++ b/src/lib/marble/geodata/data/GeoDataBuilding.cpp @@ -0,0 +1,85 @@ +// +// This file is part of the Marble Virtual Globe. +// +// This program is free software licensed under the GNU LGPL. You can +// find a copy of this license in LICENSE.txt in the top directory of +// the source code. +// +// Copyright 2017 Mohammed Nafees +// + +#include "GeoDataBuilding.h" +#include "GeoDataBuilding_p.h" + +namespace Marble { + +GeoDataBuilding::GeoDataBuilding(const GeoDataGeometry &other) + : GeoDataGeometry(other), + d(new GeoDataBuildingPrivate) +{ +} + +GeoDataBuilding::GeoDataBuilding(const GeoDataBuilding &other) + : GeoDataGeometry(other), + d(new GeoDataBuildingPrivate(*other.d)) +{ +} + +GeoDataBuilding::~GeoDataBuilding() +{ + delete d; +} + +GeoDataBuilding& GeoDataBuilding::operator=(const GeoDataBuilding& other) +{ + GeoDataGeometry::operator=(other); + *d = *other.d; + return *this; +} + +double GeoDataBuilding::height() const +{ + return d->m_height; +} + +void GeoDataBuilding::setHeight(double height) +{ + d->m_height = height; +} + +int GeoDataBuilding::minLevel() const +{ + return d->m_minLevel; +} + +void GeoDataBuilding::setMinLevel(int minLevel) +{ + d->m_minLevel = minLevel; +} + +int GeoDataBuilding::maxLevel() const +{ + return d->m_maxLevel; +} + +void GeoDataBuilding::setMaxLevel(int maxLevel) +{ + d->m_maxLevel = maxLevel; +} + +QVector GeoDataBuilding::nonExistentLevels() const +{ + return d->m_nonExistentLevels; +} + +void GeoDataBuilding::setNonExistentLevels(const QVector &nonExistentLevels) +{ + d->m_nonExistentLevels = nonExistentLevels; +} + +GeoDataMultiGeometry* GeoDataBuilding::multiGeometry() const +{ + return &d->m_multiGeometry; +} + +} diff --git a/src/lib/marble/geodata/data/GeoDataBuilding_p.h b/src/lib/marble/geodata/data/GeoDataBuilding_p.h new file mode 100644 --- /dev/null +++ b/src/lib/marble/geodata/data/GeoDataBuilding_p.h @@ -0,0 +1,37 @@ +// +// This file is part of the Marble Virtual Globe. +// +// This program is free software licensed under the GNU LGPL. You can +// find a copy of this license in LICENSE.txt in the top directory of +// the source code. +// +// Copyright 2017 Mohammed Nafees +// + +#ifndef MARBLE_GEODATABUILDING_P_H +#define MARBLE_GEODATABUILDING_P_H + +#include "GeoDataMultiGeometry.h" + +namespace Marble { + +class GeoDataBuildingPrivate +{ + public: + GeoDataBuildingPrivate() + : m_height(0.0), + m_minLevel(0), + m_maxLevel(0) + { + } + + double m_height; + int m_minLevel; + int m_maxLevel; + QVector m_nonExistentLevels; + GeoDataMultiGeometry m_multiGeometry; +}; + +} + +#endif