src/gltf/GltfModelObjectMetaData.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #ifndef GLTF_GLTFMODELOBJECTMETADATA_HPP | ||
| 7 | #define GLTF_GLTFMODELOBJECTMETADATA_HPP | ||
| 8 | |||
| 9 | #include "GltfAPI.hpp" | ||
| 10 | |||
| 11 | #include "../utilities/core/Logger.hpp" | ||
| 12 | |||
| 13 | namespace tinygltf { | ||
| 14 | class Value; | ||
| 15 | } | ||
| 16 | |||
| 17 | namespace openstudio { | ||
| 18 | namespace model { | ||
| 19 | |||
| 20 | class AirLoopHVAC; | ||
| 21 | class BuildingUnit; | ||
| 22 | class SpaceType; | ||
| 23 | class BuildingStory; | ||
| 24 | class ThermalZone; | ||
| 25 | class DefaultConstructionSet; | ||
| 26 | class Space; | ||
| 27 | } // namespace model | ||
| 28 | |||
| 29 | namespace gltf { | ||
| 30 | |||
| 31 | class GltfMetaData; | ||
| 32 | |||
| 33 | /** GltfModelObjectMetaData is an Interface class between select ModelObjects and glTF values | ||
| 34 | * | ||
| 35 | * It is capable of storing attributes such as name, iddObjectType, color, handle from ModelObjects: | ||
| 36 | * ThermalZone, SpaceType, AirLoopHVAC, BuildingStory, BuildingUnit, DefaultConstructionSet | ||
| 37 | **/ | ||
| 38 | class GLTF_API GltfModelObjectMetaData | ||
| 39 | { | ||
| 40 | public: | ||
| 41 | /** Default constructor **/ | ||
| 42 | GltfModelObjectMetaData(); | ||
| 43 | |||
| 44 | /** @name Interface with ModelObjects */ | ||
| 45 | //@{ | ||
| 46 | explicit GltfModelObjectMetaData(const model::AirLoopHVAC& airLoopHVAC); | ||
| 47 | explicit GltfModelObjectMetaData(const model::BuildingUnit& buildingUnit); | ||
| 48 | explicit GltfModelObjectMetaData(const model::SpaceType& spaceType); | ||
| 49 | explicit GltfModelObjectMetaData(const model::BuildingStory& buildingStory); | ||
| 50 | explicit GltfModelObjectMetaData(const model::ThermalZone& thermalZone); | ||
| 51 | explicit GltfModelObjectMetaData(const model::DefaultConstructionSet& defaultConstructionSet); | ||
| 52 | explicit GltfModelObjectMetaData(const model::Space& space); | ||
| 53 | //@} | ||
| 54 | |||
| 55 | /** @name Getters and Setters */ | ||
| 56 | //@{ | ||
| 57 | |||
| 58 | std::string color() const; | ||
| 59 | void setColor(const std::string& color); | ||
| 60 | |||
| 61 | std::string handle() const; | ||
| 62 | void setHandle(const std::string& handle); | ||
| 63 | |||
| 64 | std::string iddObjectType() const; | ||
| 65 | void setIddObjectType(const std::string& iddObjectType); | ||
| 66 | |||
| 67 | std::string name() const; | ||
| 68 | void setName(const std::string& name); | ||
| 69 | |||
| 70 | bool isOpentoBelow() const; | ||
| 71 | void setOpentoBelow(bool opentoBelow); | ||
| 72 | |||
| 73 | double nominalZCoordinate() const; | ||
| 74 | void setNominalZCoordinate(double nominalZCoordinate); | ||
| 75 | |||
| 76 | double nominalFloortoCeilingHeight() const; | ||
| 77 | void setNominalFloortoCeilingHeight(double nominalFloortoCeilingHeight); | ||
| 78 | |||
| 79 | int multiplier() const; | ||
| 80 | void setMultiplier(int multiplier); | ||
| 81 | |||
| 82 | //@} | ||
| 83 | |||
| 84 | protected: | ||
| 85 | /** @name Protected */ | ||
| 86 | //@{ | ||
| 87 | |||
| 88 | /** Interface with an existing GLTF file **/ | ||
| 89 | explicit GltfModelObjectMetaData(const tinygltf::Value& modelObjectMetaDataObj); | ||
| 90 | |||
| 91 | /** Export to tinygltf **/ | ||
| 92 | std::map<std::string, tinygltf::Value> toExtras() const; | ||
| 93 | |||
| 94 | //@} | ||
| 95 | |||
| 96 | friend class GltfMetaData; | ||
| 97 | |||
| 98 | private: | ||
| 99 | − | REGISTER_LOGGER("openstudio.gltf.GltfModelObjectMetaData"); | |
| 100 | |||
| 101 | std::string m_color; | ||
| 102 | std::string m_handle; | ||
| 103 | std::string m_iddObjectType; | ||
| 104 | std::string m_name; | ||
| 105 | bool m_opentoBelow = false; | ||
| 106 | double m_nominalZCoordinate = 0.0; | ||
| 107 | double m_nominalFloortoCeilingHeight = 0.0; | ||
| 108 | int m_multiplier = 0; | ||
| 109 | }; | ||
| 110 | |||
| 111 | using GltfModelObjectMetaDataVector = std::vector<GltfModelObjectMetaData>; | ||
| 112 | |||
| 113 | } // namespace gltf | ||
| 114 | } // namespace openstudio | ||
| 115 | |||
| 116 | #endif // GLTF_GLTFMODELOBJECTMETADATA_HPP | ||
| 117 |