| 925 | } |
| 926 | |
| 927 | std::string SubSurface_Impl::defaultSubSurfaceType() const { |
| 928 | std::string result; |
| 929 | |
| 930 | boost::optional<Surface> surface = this->surface(); |
| 931 | if (!surface) { |
| 932 | double degTilt = radToDeg(this->tilt()); |
| 933 | if (degTilt < 60) { |
| 934 | result = "Skylight"; |
| 935 | } else if (degTilt < 179) { |
| 936 | result = "FixedWindow"; |
| 937 | } else { |
| 938 | result = "Skylight"; |
| 939 | } |
| 940 | } else { |
| 941 | std::string surfaceType = surface->surfaceType(); |
| 942 | if (istringEqual("RoofCeiling", surfaceType) || istringEqual("Floor", surfaceType)) { |
| 943 | result = "Skylight"; |
| 944 | } else { |
| 945 | double surfaceMinZ = std::numeric_limits<double>::max(); |
| 946 | for (const Point3d& point : surface->vertices()) { |
| 947 | surfaceMinZ = std::min(surfaceMinZ, point.z()); |
| 948 | } |
| 949 | |
| 950 | double thisMinZ = std::numeric_limits<double>::max(); |
| 951 | for (const Point3d& point : this->vertices()) { |
| 952 | thisMinZ = std::min(thisMinZ, point.z()); |
| 953 | } |
| 954 | |
| 955 | if (thisMinZ <= surfaceMinZ) { |
| 956 | bool isGlassDoor = false; |
| 957 | |
| 958 | // DLM: this surface could have been initialized to FixedWindow and get its construction |
| 959 | // from the default construction set, this was the source of #1924 |
| 960 | boost::optional<ConstructionBase> construction = this->construction(); |
| 961 | if (!this->isConstructionDefaulted() && construction && construction->isFenestration()) { |
| 962 | isGlassDoor = true; |
| 963 | } |
| 964 | |
| 965 | boost::optional<std::string> value = getString(OS_SubSurfaceFields::SubSurfaceType); |
| 966 | if (value && istringEqual("GlassDoor", *value)) { |
| 967 | isGlassDoor = true; |
| 968 | } |
| 969 | |
| 970 | if (isGlassDoor) { |
| 971 | result = "GlassDoor"; |
| 972 | } else { |
| 973 | result = "Door"; |
| 974 | } |
| 975 | } else { |
| 976 | result = "FixedWindow"; |
| 977 | } |
| 978 | } |
| 979 | } |
| 980 | |
| 981 | return result; |
| 982 | } |
| 983 | |
| 984 | void SubSurface_Impl::assignDefaultSubSurfaceType() { |
no test coverage detected