src/model/RenderingColor.cpp
| 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 | #include "RenderingColor.hpp" | ||
| 7 | #include "RenderingColor_Impl.hpp" | ||
| 8 | |||
| 9 | #include <utilities/idd/OS_Rendering_Color_FieldEnums.hxx> | ||
| 10 | #include <utilities/idd/IddEnums.hxx> | ||
| 11 | |||
| 12 | #include "../utilities/core/Assert.hpp" | ||
| 13 | |||
| 14 | #include <iomanip> | ||
| 15 | #include <random> | ||
| 16 | #include <string> | ||
| 17 | |||
| 18 | namespace openstudio { | ||
| 19 | namespace model { | ||
| 20 | |||
| 21 | namespace detail { | ||
| 22 | |||
| 23 | 4729 | RenderingColor_Impl::RenderingColor_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 24 | 4729 | : ResourceObject_Impl(idfObject, model, keepHandle) { | |
| 25 |
4/6✓ Branch 1 taken 4729 times.
✓ Branch 4 taken 4729 times.
✓ Branch 7 taken 4729 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 4729 times.
✗ Branch 13 not taken.
|
4729 | OS_ASSERT(idfObject.iddObject().type() == RenderingColor::iddObjectType()); |
| 26 | |||
| 27 |
1/1✓ Branch 1 taken 4729 times.
|
4729 | ColorRGB color = RenderingColor::randomColor(); |
| 28 | |||
| 29 | 4729 | [[maybe_unused]] bool test = true; | |
| 30 |
3/3✓ Branch 1 taken 4729 times.
✓ Branch 4 taken 1820 times.
✓ Branch 5 taken 2909 times.
|
4729 | if (!getInt(OS_Rendering_ColorFields::RenderingRedValue, true)) { |
| 31 |
2/2✓ Branch 1 taken 1820 times.
✓ Branch 4 taken 1820 times.
|
1820 | test = setRenderingRedValue(color.red(), false); |
| 32 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1820 times.
✗ Branch 3 not taken.
|
1820 | OS_ASSERT(test); |
| 33 | } | ||
| 34 |
3/3✓ Branch 1 taken 4729 times.
✓ Branch 4 taken 1820 times.
✓ Branch 5 taken 2909 times.
|
4729 | if (!getInt(OS_Rendering_ColorFields::RenderingGreenValue, true)) { |
| 35 |
2/2✓ Branch 1 taken 1820 times.
✓ Branch 4 taken 1820 times.
|
1820 | test = setRenderingGreenValue(color.blue(), false); |
| 36 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1820 times.
✗ Branch 3 not taken.
|
1820 | OS_ASSERT(test); |
| 37 | } | ||
| 38 |
3/3✓ Branch 1 taken 4729 times.
✓ Branch 4 taken 1820 times.
✓ Branch 5 taken 2909 times.
|
4729 | if (!getInt(OS_Rendering_ColorFields::RenderingBlueValue, true)) { |
| 39 |
2/2✓ Branch 1 taken 1820 times.
✓ Branch 4 taken 1820 times.
|
1820 | test = setRenderingBlueValue(color.green(), false); |
| 40 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1820 times.
✗ Branch 3 not taken.
|
1820 | OS_ASSERT(test); |
| 41 | } | ||
| 42 | //getImpl<detail::RenderingColor_Impl>()->emitChangeSignals(); // emit signals here | ||
| 43 | 4729 | } | |
| 44 | |||
| 45 | 2905 | RenderingColor_Impl::RenderingColor_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 46 | 2905 | : ResourceObject_Impl(other, model, keepHandle) { | |
| 47 |
4/6✓ Branch 1 taken 2905 times.
✓ Branch 4 taken 2905 times.
✓ Branch 7 taken 2905 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 2905 times.
✗ Branch 13 not taken.
|
2905 | OS_ASSERT(other.iddObject().type() == RenderingColor::iddObjectType()); |
| 48 | 2905 | } | |
| 49 | |||
| 50 | 1140 | RenderingColor_Impl::RenderingColor_Impl(const RenderingColor_Impl& other, Model_Impl* model, bool keepHandle) | |
| 51 | 1140 | : ResourceObject_Impl(other, model, keepHandle) {} | |
| 52 | |||
| 53 | ✗ | const std::vector<std::string>& RenderingColor_Impl::outputVariableNames() const { | |
| 54 | ✗ | static const std::vector<std::string> result; | |
| 55 | ✗ | return result; | |
| 56 | } | ||
| 57 | |||
| 58 | ✗ | IddObjectType RenderingColor_Impl::iddObjectType() const { | |
| 59 | ✗ | return RenderingColor::iddObjectType(); | |
| 60 | } | ||
| 61 | |||
| 62 | 5449 | int RenderingColor_Impl::renderingRedValue() const { | |
| 63 |
1/1✓ Branch 1 taken 5449 times.
|
5449 | boost::optional<int> value = getInt(OS_Rendering_ColorFields::RenderingRedValue, true); |
| 64 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5449 times.
✗ Branch 4 not taken.
|
5449 | OS_ASSERT(value); |
| 65 |
1/1✓ Branch 1 taken 5449 times.
|
10898 | return value.get(); |
| 66 | } | ||
| 67 | |||
| 68 | 5449 | int RenderingColor_Impl::renderingGreenValue() const { | |
| 69 |
1/1✓ Branch 1 taken 5449 times.
|
5449 | boost::optional<int> value = getInt(OS_Rendering_ColorFields::RenderingGreenValue, true); |
| 70 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5449 times.
✗ Branch 4 not taken.
|
5449 | OS_ASSERT(value); |
| 71 |
1/1✓ Branch 1 taken 5449 times.
|
10898 | return value.get(); |
| 72 | } | ||
| 73 | |||
| 74 | 5449 | int RenderingColor_Impl::renderingBlueValue() const { | |
| 75 |
1/1✓ Branch 1 taken 5449 times.
|
5449 | boost::optional<int> value = getInt(OS_Rendering_ColorFields::RenderingBlueValue, true); |
| 76 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5449 times.
✗ Branch 4 not taken.
|
5449 | OS_ASSERT(value); |
| 77 |
1/1✓ Branch 1 taken 5449 times.
|
10898 | return value.get(); |
| 78 | } | ||
| 79 | |||
| 80 | 2026 | int RenderingColor_Impl::renderingAlphaValue() const { | |
| 81 |
1/1✓ Branch 1 taken 2026 times.
|
2026 | boost::optional<int> value = getInt(OS_Rendering_ColorFields::RenderingAlphaValue, true); |
| 82 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 2026 times.
✗ Branch 4 not taken.
|
2026 | OS_ASSERT(value); |
| 83 |
1/1✓ Branch 1 taken 2026 times.
|
4052 | return value.get(); |
| 84 | } | ||
| 85 | |||
| 86 | 518 | bool RenderingColor_Impl::isRenderingAlphaValueDefaulted() const { | |
| 87 | 518 | return isEmpty(OS_Rendering_ColorFields::RenderingAlphaValue); | |
| 88 | } | ||
| 89 | |||
| 90 | 1437 | bool RenderingColor_Impl::setRenderingRedValue(int renderingRedValue) { | |
| 91 | 1437 | return setRenderingRedValue(renderingRedValue, true); | |
| 92 | } | ||
| 93 | |||
| 94 | 3257 | bool RenderingColor_Impl::setRenderingRedValue(int renderingRedValue, bool driverMethod) { | |
| 95 | 3257 | bool result = setInt(OS_Rendering_ColorFields::RenderingRedValue, renderingRedValue, driverMethod); | |
| 96 | 3257 | return result; | |
| 97 | } | ||
| 98 | |||
| 99 | 1437 | bool RenderingColor_Impl::setRenderingGreenValue(int renderingGreenValue) { | |
| 100 | 1437 | return setRenderingGreenValue(renderingGreenValue, true); | |
| 101 | } | ||
| 102 | |||
| 103 | 3257 | bool RenderingColor_Impl::setRenderingGreenValue(int renderingGreenValue, bool /*driverMethod*/) { | |
| 104 | 3257 | bool result = setInt(OS_Rendering_ColorFields::RenderingGreenValue, renderingGreenValue); | |
| 105 | 3257 | return result; | |
| 106 | } | ||
| 107 | |||
| 108 | 1437 | bool RenderingColor_Impl::setRenderingBlueValue(int renderingBlueValue) { | |
| 109 | 1437 | return setRenderingBlueValue(renderingBlueValue, true); | |
| 110 | } | ||
| 111 | |||
| 112 | 3257 | bool RenderingColor_Impl::setRenderingBlueValue(int renderingBlueValue, bool driverMethod) { | |
| 113 | 3257 | bool result = setInt(OS_Rendering_ColorFields::RenderingBlueValue, renderingBlueValue, driverMethod); | |
| 114 | 3257 | return result; | |
| 115 | } | ||
| 116 | |||
| 117 | 261 | bool RenderingColor_Impl::setRenderingAlphaValue(int renderingAlphaValue) { | |
| 118 | 261 | return setRenderingAlphaValue(renderingAlphaValue, true); | |
| 119 | } | ||
| 120 | |||
| 121 | 261 | bool RenderingColor_Impl::setRenderingAlphaValue(int renderingAlphaValue, bool driverMethod) { | |
| 122 | 261 | bool result = setInt(OS_Rendering_ColorFields::RenderingAlphaValue, renderingAlphaValue, driverMethod); | |
| 123 | 261 | return result; | |
| 124 | } | ||
| 125 | |||
| 126 | ✗ | void RenderingColor_Impl::resetRenderingAlphaValue() { | |
| 127 | ✗ | bool result = setString(OS_Rendering_ColorFields::RenderingAlphaValue, ""); | |
| 128 | ✗ | OS_ASSERT(result); | |
| 129 | ✗ | } | |
| 130 | |||
| 131 | 2293 | std::string RenderingColor_Impl::colorString() const { | |
| 132 |
1/1✓ Branch 1 taken 2293 times.
|
2293 | std::stringstream stream; |
| 133 |
4/4✓ Branch 1 taken 2293 times.
✓ Branch 5 taken 2293 times.
✓ Branch 10 taken 2293 times.
✓ Branch 13 taken 2293 times.
|
2293 | stream << "#" << std::setfill('0') << std::setw(6) << std::uppercase << std::hex |
| 134 |
4/4✓ Branch 1 taken 2293 times.
✓ Branch 4 taken 2293 times.
✓ Branch 7 taken 2293 times.
✓ Branch 10 taken 2293 times.
|
2293 | << renderingRedValue() * 65536 + renderingGreenValue() * 256 + renderingBlueValue(); |
| 135 | |||
| 136 |
1/1✓ Branch 1 taken 2293 times.
|
2293 | std::string result = stream.str(); |
| 137 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 2293 times.
✗ Branch 4 not taken.
|
2293 | OS_ASSERT(result.size() == 7); |
| 138 | 4586 | return result; | |
| 139 | 2293 | } | |
| 140 | |||
| 141 | } // namespace detail | ||
| 142 | |||
| 143 | 12788 | ColorRGB::ColorRGB(int r, int g, int b) : m_red(r), m_green(g), m_blue(b) {} | |
| 144 | |||
| 145 | 1820 | int ColorRGB::red() const { | |
| 146 | 1820 | return m_red; | |
| 147 | } | ||
| 148 | |||
| 149 | 1820 | int ColorRGB::green() const { | |
| 150 | 1820 | return m_green; | |
| 151 | } | ||
| 152 | |||
| 153 | 1820 | int ColorRGB::blue() const { | |
| 154 | 1820 | return m_blue; | |
| 155 | } | ||
| 156 | |||
| 157 | 1818 | RenderingColor::RenderingColor(const Model& model) : ResourceObject(RenderingColor::iddObjectType(), model) { | |
| 158 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 1818 times.
✗ Branch 5 not taken.
|
1818 | OS_ASSERT(getImpl<detail::RenderingColor_Impl>()); |
| 159 | 1818 | } | |
| 160 | |||
| 161 | 1638 | boost::optional<RenderingColor> RenderingColor::fromColorString(const std::string& s, const Model& model) { | |
| 162 |
2/2✓ Branch 1 taken 211 times.
✓ Branch 2 taken 1427 times.
|
1638 | if (s.size() != 7) { |
| 163 | 211 | return boost::none; | |
| 164 | } | ||
| 165 | |||
| 166 |
2/2✓ Branch 1 taken 1427 times.
✓ Branch 4 taken 1427 times.
|
1427 | int r = std::stoi(s.substr(1, 2), 0, 16); |
| 167 |
2/2✓ Branch 1 taken 1427 times.
✓ Branch 4 taken 1427 times.
|
1427 | int g = std::stoi(s.substr(3, 2), 0, 16); |
| 168 |
2/2✓ Branch 1 taken 1427 times.
✓ Branch 4 taken 1427 times.
|
1427 | int b = std::stoi(s.substr(5, 2), 0, 16); |
| 169 | |||
| 170 |
1/1✓ Branch 1 taken 1427 times.
|
1427 | RenderingColor result(model); |
| 171 |
1/1✓ Branch 1 taken 1427 times.
|
1427 | result.setRenderingRedValue(r); |
| 172 |
1/1✓ Branch 1 taken 1427 times.
|
1427 | result.setRenderingGreenValue(g); |
| 173 |
1/1✓ Branch 1 taken 1427 times.
|
1427 | result.setRenderingBlueValue(b); |
| 174 |
1/1✓ Branch 1 taken 1427 times.
|
1427 | return result; |
| 175 | 1427 | } | |
| 176 | |||
| 177 | 17065 | IddObjectType RenderingColor::iddObjectType() { | |
| 178 |
1/1✓ Branch 1 taken 17065 times.
|
17065 | IddObjectType result(IddObjectType::OS_Rendering_Color); |
| 179 | 17065 | return result; | |
| 180 | } | ||
| 181 | |||
| 182 | 3156 | int RenderingColor::renderingRedValue() const { | |
| 183 |
1/1✓ Branch 3 taken 3156 times.
|
3156 | return getImpl<detail::RenderingColor_Impl>()->renderingRedValue(); |
| 184 | } | ||
| 185 | |||
| 186 | 3156 | int RenderingColor::renderingGreenValue() const { | |
| 187 |
1/1✓ Branch 3 taken 3156 times.
|
3156 | return getImpl<detail::RenderingColor_Impl>()->renderingGreenValue(); |
| 188 | } | ||
| 189 | |||
| 190 | 3156 | int RenderingColor::renderingBlueValue() const { | |
| 191 |
1/1✓ Branch 3 taken 3156 times.
|
3156 | return getImpl<detail::RenderingColor_Impl>()->renderingBlueValue(); |
| 192 | } | ||
| 193 | |||
| 194 | 2026 | int RenderingColor::renderingAlphaValue() const { | |
| 195 |
1/1✓ Branch 3 taken 2026 times.
|
2026 | return getImpl<detail::RenderingColor_Impl>()->renderingAlphaValue(); |
| 196 | } | ||
| 197 | |||
| 198 | 518 | bool RenderingColor::isRenderingAlphaValueDefaulted() const { | |
| 199 |
1/1✓ Branch 3 taken 518 times.
|
518 | return getImpl<detail::RenderingColor_Impl>()->isRenderingAlphaValueDefaulted(); |
| 200 | } | ||
| 201 | |||
| 202 | 1437 | bool RenderingColor::setRenderingRedValue(int renderingRedValue) { | |
| 203 |
1/1✓ Branch 3 taken 1437 times.
|
1437 | return getImpl<detail::RenderingColor_Impl>()->setRenderingRedValue(renderingRedValue); |
| 204 | } | ||
| 205 | |||
| 206 | 1437 | bool RenderingColor::setRenderingGreenValue(int renderingGreenValue) { | |
| 207 |
1/1✓ Branch 3 taken 1437 times.
|
1437 | return getImpl<detail::RenderingColor_Impl>()->setRenderingGreenValue(renderingGreenValue); |
| 208 | } | ||
| 209 | |||
| 210 | 1437 | bool RenderingColor::setRenderingBlueValue(int renderingBlueValue) { | |
| 211 |
1/1✓ Branch 3 taken 1437 times.
|
1437 | return getImpl<detail::RenderingColor_Impl>()->setRenderingBlueValue(renderingBlueValue); |
| 212 | } | ||
| 213 | |||
| 214 | 261 | bool RenderingColor::setRenderingAlphaValue(int renderingAlphaValue) { | |
| 215 |
1/1✓ Branch 3 taken 261 times.
|
261 | return getImpl<detail::RenderingColor_Impl>()->setRenderingAlphaValue(renderingAlphaValue); |
| 216 | } | ||
| 217 | |||
| 218 | ✗ | void RenderingColor::resetRenderingAlphaValue() { | |
| 219 | ✗ | getImpl<detail::RenderingColor_Impl>()->resetRenderingAlphaValue(); | |
| 220 | ✗ | } | |
| 221 | |||
| 222 | 2293 | std::string RenderingColor::colorString() const { | |
| 223 |
1/1✓ Branch 3 taken 2293 times.
|
2293 | return getImpl<detail::RenderingColor_Impl>()->colorString(); |
| 224 | } | ||
| 225 | |||
| 226 | /// @cond | ||
| 227 |
1/1✓ Branch 3 taken 8017 times.
|
8017 | RenderingColor::RenderingColor(std::shared_ptr<detail::RenderingColor_Impl> impl) : ResourceObject(std::move(impl)) {} |
| 228 | |||
| 229 | 4729 | ColorRGB RenderingColor::randomColor() { | |
| 230 | static const std::vector<ColorRGB> colors{ | ||
| 231 | ColorRGB(240, 248, 255), // AliceBlue | ||
| 232 | ColorRGB(250, 235, 215), // AntiqueWhite | ||
| 233 | ColorRGB(0, 255, 255), // Aqua | ||
| 234 | ColorRGB(127, 255, 212), // Aquamarine | ||
| 235 | ColorRGB(240, 255, 255), // Azure | ||
| 236 | ColorRGB(245, 245, 220), // Beige | ||
| 237 | ColorRGB(255, 228, 196), // Bisque | ||
| 238 | ColorRGB(0, 0, 0), // Black | ||
| 239 | ColorRGB(255, 235, 205), // BlanchedAlmond | ||
| 240 | ColorRGB(0, 0, 255), // Blue | ||
| 241 | ColorRGB(138, 43, 226), // BlueViolet | ||
| 242 | ColorRGB(165, 42, 42), // Brown | ||
| 243 | ColorRGB(222, 184, 135), // BurlyWood | ||
| 244 | ColorRGB(95, 158, 160), // CadetBlue | ||
| 245 | ColorRGB(127, 255, 0), // Chartreuse | ||
| 246 | ColorRGB(210, 105, 30), // Chocolate | ||
| 247 | ColorRGB(255, 127, 80), // Coral | ||
| 248 | ColorRGB(100, 149, 237), // CornflowerBlue | ||
| 249 | ColorRGB(255, 248, 220), // Cornsilk | ||
| 250 | ColorRGB(220, 20, 60), // Crimson | ||
| 251 | ColorRGB(0, 255, 255), // Cyan | ||
| 252 | ColorRGB(0, 0, 139), // DarkBlue | ||
| 253 | ColorRGB(0, 139, 139), // DarkCyan | ||
| 254 | ColorRGB(184, 134, 11), // DarkGoldenrod | ||
| 255 | ColorRGB(169, 169, 169), // DarkGray | ||
| 256 | ColorRGB(0, 100, 0), // DarkGreen | ||
| 257 | ColorRGB(189, 183, 107), // DarkKhaki | ||
| 258 | ColorRGB(139, 0, 139), // DarkMagenta | ||
| 259 | ColorRGB(85, 107, 47), // DarkOliveGreen | ||
| 260 | ColorRGB(255, 140, 0), // DarkOrange | ||
| 261 | ColorRGB(153, 50, 204), // DarkOrchid | ||
| 262 | ColorRGB(139, 0, 0), // DarkRed | ||
| 263 | ColorRGB(233, 150, 122), // DarkSalmon | ||
| 264 | ColorRGB(143, 188, 143), // DarkSeaGreen | ||
| 265 | ColorRGB(72, 61, 139), // DarkSlateBlue | ||
| 266 | ColorRGB(47, 79, 79), // DarkSlateGray | ||
| 267 | ColorRGB(0, 206, 209), // DarkTurquoise | ||
| 268 | ColorRGB(148, 0, 211), // DarkViolet | ||
| 269 | ColorRGB(255, 20, 147), // DeepPink | ||
| 270 | ColorRGB(0, 191, 255), // DeepSkyBlue | ||
| 271 | ColorRGB(105, 105, 105), // DimGray | ||
| 272 | ColorRGB(30, 144, 255), // DodgerBlue | ||
| 273 | ColorRGB(178, 34, 34), // FireBrick | ||
| 274 | ColorRGB(255, 250, 240), // FloralWhite | ||
| 275 | ColorRGB(34, 139, 34), // ForestGreen | ||
| 276 | ColorRGB(255, 0, 255), // Fuchsia | ||
| 277 | ColorRGB(220, 220, 220), // Gainsboro | ||
| 278 | ColorRGB(248, 248, 255), // GhostWhite | ||
| 279 | ColorRGB(255, 215, 0), // Gold | ||
| 280 | ColorRGB(218, 165, 32), // Goldenrod | ||
| 281 | ColorRGB(128, 128, 128), // Gray | ||
| 282 | ColorRGB(0, 128, 0), // Green | ||
| 283 | ColorRGB(173, 255, 47), // GreenYellow | ||
| 284 | ColorRGB(240, 255, 240), // Honeydew | ||
| 285 | ColorRGB(255, 105, 180), // HotPink | ||
| 286 | ColorRGB(205, 92, 92), // IndianRed | ||
| 287 | ColorRGB(75, 0, 130), // Indigo | ||
| 288 | ColorRGB(255, 255, 240), // Ivory | ||
| 289 | ColorRGB(240, 230, 140), // Khaki | ||
| 290 | ColorRGB(230, 230, 250), // Lavender | ||
| 291 | ColorRGB(255, 240, 245), // LavenderBlush | ||
| 292 | ColorRGB(124, 252, 0), // LawnGreen | ||
| 293 | ColorRGB(255, 250, 205), // LemonChiffon | ||
| 294 | ColorRGB(173, 216, 230), // LightBlue | ||
| 295 | ColorRGB(240, 128, 128), // LightCoral | ||
| 296 | ColorRGB(224, 255, 255), // LightCyan | ||
| 297 | ColorRGB(250, 250, 210), // LightGoldenrodYellow | ||
| 298 | ColorRGB(144, 238, 144), // LightGreen | ||
| 299 | ColorRGB(211, 211, 211), // LightGrey | ||
| 300 | ColorRGB(255, 182, 193), // LightPink | ||
| 301 | ColorRGB(255, 160, 122), // LightSalmon | ||
| 302 | ColorRGB(32, 178, 170), // LightSeaGreen | ||
| 303 | ColorRGB(135, 206, 250), // LightSkyBlue | ||
| 304 | ColorRGB(119, 136, 153), // LightSlateGray | ||
| 305 | ColorRGB(176, 196, 222), // LightSteelBlue | ||
| 306 | ColorRGB(255, 255, 224), // LightYellow | ||
| 307 | ColorRGB(0, 255, 0), // Lime | ||
| 308 | ColorRGB(50, 205, 50), // LimeGreen | ||
| 309 | ColorRGB(250, 240, 230), // Linen | ||
| 310 | ColorRGB(255, 0, 255), // Magenta | ||
| 311 | ColorRGB(128, 0, 0), // Maroon | ||
| 312 | ColorRGB(102, 205, 170), // MediumAquamarine | ||
| 313 | ColorRGB(0, 0, 205), // MediumBlue | ||
| 314 | ColorRGB(186, 85, 211), // MediumOrchid | ||
| 315 | ColorRGB(147, 112, 219), // MediumPurple | ||
| 316 | ColorRGB(60, 179, 113), // MediumSeaGreen | ||
| 317 | ColorRGB(123, 104, 238), // MediumSlateBlue | ||
| 318 | ColorRGB(0, 250, 154), // MediumSpringGreen | ||
| 319 | ColorRGB(72, 209, 204), // MediumTurquoise | ||
| 320 | ColorRGB(199, 21, 133), // MediumVioletRed | ||
| 321 | ColorRGB(25, 25, 112), // MidnightBlue | ||
| 322 | ColorRGB(245, 255, 250), // MintCream | ||
| 323 | ColorRGB(255, 228, 225), // MistyRose | ||
| 324 | ColorRGB(255, 228, 181), // Moccasin | ||
| 325 | ColorRGB(255, 222, 173), // NavajoWhite | ||
| 326 | ColorRGB(0, 0, 128), // Navy | ||
| 327 | ColorRGB(253, 245, 230), // OldLace | ||
| 328 | ColorRGB(128, 128, 0), // Olive | ||
| 329 | ColorRGB(128, 128, 0), // OliveDrab | ||
| 330 | ColorRGB(255, 165, 0), // Orange | ||
| 331 | ColorRGB(255, 69, 0), // OrangeRed | ||
| 332 | ColorRGB(218, 112, 214), // Orchid | ||
| 333 | ColorRGB(238, 232, 170), // PaleGoldenrod | ||
| 334 | ColorRGB(152, 251, 152), // PaleGreen | ||
| 335 | ColorRGB(175, 238, 238), // PaleTurquoise | ||
| 336 | ColorRGB(219, 112, 147), // PaleVioletRed | ||
| 337 | ColorRGB(255, 239, 213), // PapayaWhip | ||
| 338 | ColorRGB(255, 218, 185), // PeachPuff | ||
| 339 | ColorRGB(205, 133, 63), // Peru | ||
| 340 | ColorRGB(255, 192, 203), // Pink | ||
| 341 | ColorRGB(221, 160, 221), // Plum | ||
| 342 | ColorRGB(176, 224, 230), // PowderBlue | ||
| 343 | ColorRGB(128, 0, 128), // Purple | ||
| 344 | ColorRGB(255, 0, 0), // Red | ||
| 345 | ColorRGB(188, 143, 143), // RosyBrown | ||
| 346 | ColorRGB(65, 105, 225), // RoyalBlue | ||
| 347 | ColorRGB(139, 69, 19), // SaddleBrown | ||
| 348 | ColorRGB(250, 128, 114), // Salmon | ||
| 349 | ColorRGB(244, 164, 96), // SandyBrown | ||
| 350 | ColorRGB(46, 139, 87), // SeaGreen | ||
| 351 | ColorRGB(255, 245, 238), // Seashell | ||
| 352 | ColorRGB(160, 82, 45), // Sienna | ||
| 353 | ColorRGB(192, 192, 192), // Silver | ||
| 354 | ColorRGB(135, 206, 235), // SkyBlue | ||
| 355 | ColorRGB(106, 90, 205), // SlateBlue | ||
| 356 | ColorRGB(112, 128, 144), // SlateGray | ||
| 357 | ColorRGB(255, 250, 250), // Snow | ||
| 358 | ColorRGB(0, 255, 127), // SpringGreen | ||
| 359 | ColorRGB(70, 130, 180), // SteelBlue | ||
| 360 | ColorRGB(210, 180, 140), // Tan | ||
| 361 | ColorRGB(210, 180, 140), // Teal | ||
| 362 | ColorRGB(216, 191, 216), // Thistle | ||
| 363 | ColorRGB(255, 99, 71), // Tomato | ||
| 364 | ColorRGB(64, 224, 208), // Turquoise | ||
| 365 | ColorRGB(238, 130, 238), // Violet | ||
| 366 | ColorRGB(245, 222, 179), // Wheat | ||
| 367 | //ColorRGB(255,255,255), // White | ||
| 368 | ColorRGB(245, 245, 245), // WhiteSmoke | ||
| 369 | ColorRGB(255, 255, 0), // Yellow | ||
| 370 | ColorRGB(154, 205, 50) // YellowGreen | ||
| 371 |
143/146✓ Branch 0 taken 92 times.
✓ Branch 1 taken 4637 times.
✓ Branch 3 taken 92 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 92 times.
✓ Branch 9 taken 92 times.
✓ Branch 12 taken 92 times.
✓ Branch 15 taken 92 times.
✓ Branch 18 taken 92 times.
✓ Branch 21 taken 92 times.
✓ Branch 24 taken 92 times.
✓ Branch 27 taken 92 times.
✓ Branch 30 taken 92 times.
✓ Branch 33 taken 92 times.
✓ Branch 36 taken 92 times.
✓ Branch 39 taken 92 times.
✓ Branch 42 taken 92 times.
✓ Branch 45 taken 92 times.
✓ Branch 48 taken 92 times.
✓ Branch 51 taken 92 times.
✓ Branch 54 taken 92 times.
✓ Branch 57 taken 92 times.
✓ Branch 60 taken 92 times.
✓ Branch 63 taken 92 times.
✓ Branch 66 taken 92 times.
✓ Branch 69 taken 92 times.
✓ Branch 72 taken 92 times.
✓ Branch 75 taken 92 times.
✓ Branch 78 taken 92 times.
✓ Branch 81 taken 92 times.
✓ Branch 84 taken 92 times.
✓ Branch 87 taken 92 times.
✓ Branch 90 taken 92 times.
✓ Branch 93 taken 92 times.
✓ Branch 96 taken 92 times.
✓ Branch 99 taken 92 times.
✓ Branch 102 taken 92 times.
✓ Branch 105 taken 92 times.
✓ Branch 108 taken 92 times.
✓ Branch 111 taken 92 times.
✓ Branch 114 taken 92 times.
✓ Branch 117 taken 92 times.
✓ Branch 120 taken 92 times.
✓ Branch 123 taken 92 times.
✓ Branch 126 taken 92 times.
✓ Branch 129 taken 92 times.
✓ Branch 132 taken 92 times.
✓ Branch 135 taken 92 times.
✓ Branch 138 taken 92 times.
✓ Branch 141 taken 92 times.
✓ Branch 144 taken 92 times.
✓ Branch 147 taken 92 times.
✓ Branch 150 taken 92 times.
✓ Branch 153 taken 92 times.
✓ Branch 156 taken 92 times.
✓ Branch 159 taken 92 times.
✓ Branch 162 taken 92 times.
✓ Branch 165 taken 92 times.
✓ Branch 168 taken 92 times.
✓ Branch 171 taken 92 times.
✓ Branch 174 taken 92 times.
✓ Branch 177 taken 92 times.
✓ Branch 180 taken 92 times.
✓ Branch 183 taken 92 times.
✓ Branch 186 taken 92 times.
✓ Branch 189 taken 92 times.
✓ Branch 192 taken 92 times.
✓ Branch 195 taken 92 times.
✓ Branch 198 taken 92 times.
✓ Branch 201 taken 92 times.
✓ Branch 204 taken 92 times.
✓ Branch 207 taken 92 times.
✓ Branch 210 taken 92 times.
✓ Branch 213 taken 92 times.
✓ Branch 216 taken 92 times.
✓ Branch 219 taken 92 times.
✓ Branch 222 taken 92 times.
✓ Branch 225 taken 92 times.
✓ Branch 228 taken 92 times.
✓ Branch 231 taken 92 times.
✓ Branch 234 taken 92 times.
✓ Branch 237 taken 92 times.
✓ Branch 240 taken 92 times.
✓ Branch 243 taken 92 times.
✓ Branch 246 taken 92 times.
✓ Branch 249 taken 92 times.
✓ Branch 252 taken 92 times.
✓ Branch 255 taken 92 times.
✓ Branch 258 taken 92 times.
✓ Branch 261 taken 92 times.
✓ Branch 264 taken 92 times.
✓ Branch 267 taken 92 times.
✓ Branch 270 taken 92 times.
✓ Branch 273 taken 92 times.
✓ Branch 276 taken 92 times.
✓ Branch 279 taken 92 times.
✓ Branch 282 taken 92 times.
✓ Branch 285 taken 92 times.
✓ Branch 288 taken 92 times.
✓ Branch 291 taken 92 times.
✓ Branch 294 taken 92 times.
✓ Branch 297 taken 92 times.
✓ Branch 300 taken 92 times.
✓ Branch 303 taken 92 times.
✓ Branch 306 taken 92 times.
✓ Branch 309 taken 92 times.
✓ Branch 312 taken 92 times.
✓ Branch 315 taken 92 times.
✓ Branch 318 taken 92 times.
✓ Branch 321 taken 92 times.
✓ Branch 324 taken 92 times.
✓ Branch 327 taken 92 times.
✓ Branch 330 taken 92 times.
✓ Branch 333 taken 92 times.
✓ Branch 336 taken 92 times.
✓ Branch 339 taken 92 times.
✓ Branch 342 taken 92 times.
✓ Branch 345 taken 92 times.
✓ Branch 348 taken 92 times.
✓ Branch 351 taken 92 times.
✓ Branch 354 taken 92 times.
✓ Branch 357 taken 92 times.
✓ Branch 360 taken 92 times.
✓ Branch 363 taken 92 times.
✓ Branch 366 taken 92 times.
✓ Branch 369 taken 92 times.
✓ Branch 372 taken 92 times.
✓ Branch 375 taken 92 times.
✓ Branch 378 taken 92 times.
✓ Branch 381 taken 92 times.
✓ Branch 384 taken 92 times.
✓ Branch 387 taken 92 times.
✓ Branch 390 taken 92 times.
✓ Branch 393 taken 92 times.
✓ Branch 396 taken 92 times.
✓ Branch 399 taken 92 times.
✓ Branch 402 taken 92 times.
✓ Branch 405 taken 92 times.
✓ Branch 408 taken 92 times.
✓ Branch 411 taken 92 times.
✓ Branch 414 taken 92 times.
✓ Branch 417 taken 92 times.
✓ Branch 420 taken 92 times.
✓ Branch 423 taken 92 times.
✗ Branch 427 not taken.
✗ Branch 428 not taken.
|
4913 | }; |
| 372 | |||
| 373 |
1/1✓ Branch 1 taken 4729 times.
|
4729 | std::random_device rd; //Will be used to obtain a seed for the random number engine |
| 374 |
2/2✓ Branch 1 taken 4729 times.
✓ Branch 4 taken 4729 times.
|
4729 | std::mt19937 gen(rd()); //Standard mersenne_twister_engine seeded with rd() |
| 375 |
1/1✓ Branch 2 taken 4729 times.
|
4729 | std::uniform_int_distribution<std::mt19937::result_type> distrib(0, colors.size() - 1); // Generates an int in the closed interval [0, n-1] |
| 376 |
1/1✓ Branch 1 taken 4729 times.
|
4729 | int index = distrib(rd); |
| 377 | |||
| 378 | 9458 | return colors[index]; | |
| 379 | 4729 | } | |
| 380 | |||
| 381 | /// @endcond | ||
| 382 | |||
| 383 | } // namespace model | ||
| 384 | } // namespace openstudio | ||
| 385 |