lib/urbanopt/geojson/helper.rb in urbanopt-geojson-0.1.0 vs lib/urbanopt/geojson/helper.rb in urbanopt-geojson-0.2.0.pre1

- old
+ new

@@ -1,7 +1,7 @@ # ********************************************************************************* -# URBANopt, Copyright (c) 2019, Alliance for Sustainable Energy, LLC, and other +# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other # contributors. All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # @@ -214,11 +214,11 @@ # Calculate which other buildings are shading the current feature and return as an array of # +OpenStudio::Model::Space+. # # [Parameters] # * +building+ - _Type:URBANopt::GeoJSON::Building_ - The core building that other buildings will be referenced. - # * +other_building_type+ - _Type:String_ - Describes the surrounding buildings. Currently 'ShadingOnly' is the only option that is processed. + # * +other_building_type+ - _Type:String_ - Describes the surrounding buildings. # * +other_buildings+ - _Type:URBANopt::GeoJSON::FeatureCollection_ - List of surrounding buildings to include (self will be ignored if present in list). # * +model+ - _Type:OpenStudio::Model::Model_ - An instance of an OpenStudio Model. # * +origin_lat_lon+ - _Type:Float_ - An instance of +OpenStudio::PointLatLon+ indicating the latitude and longitude of the origin. # * +runner+ - _Type:String_ - An instance of +Openstudio::Measure::OSRunner+ for the measure run. # * +zoning+ - _Type:Boolean_ - Value is +true+ if utilizing detailed zoning, else @@ -253,17 +253,19 @@ end other_height = number_of_stories_above_ground * floor_to_floor_height # find the polygon of the other_building by passing it to the get_multi_polygons method other_building_points = building.other_points(other_building, other_height, origin_lat_lon, runner, zoning) shadowed = URBANopt::GeoJSON::Helper.is_shadowed(feature_points, other_building_points, origin_lat_lon) - next unless shadowed - end + next unless shadowed + new_building = building.create_other_building(:space_per_building, model, origin_lat_lon, runner, zoning, other_building) + if new_building.nil? || new_building.empty? + runner.registerWarning("Failed to create spaces for other building '#{name}'") + end + other_spaces.concat(new_building) - new_building = building.create_other_building(:space_per_building, model, origin_lat_lon, runner, zoning, other_building) - if new_building.nil? || new_building.empty? - runner.registerWarning("Failed to create spaces for other building '#{name}'") + elsif other_building_type == 'None' end - other_spaces.concat(new_building) + end return other_spaces end ##