urbanopt-geojson 0.3.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.github/pull_request_template.md +2 -2
  3. data/CHANGELOG.md +54 -4
  4. data/CONTRIBUTING.md +1 -1
  5. data/LICENSE.md +1 -1
  6. data/RDOC_MAIN.md +26 -22
  7. data/README.md +2 -2
  8. data/Rakefile +1 -1
  9. data/doc_templates/LICENSE.md +1 -1
  10. data/doc_templates/copyright_erb.txt +1 -1
  11. data/doc_templates/copyright_js.txt +1 -1
  12. data/doc_templates/copyright_ruby.txt +1 -1
  13. data/docs/.vuepress/components/InnerJsonSchema.vue +7 -11
  14. data/docs/.vuepress/config.js +11 -1
  15. data/docs/.vuepress/highlight.js +1 -1
  16. data/docs/.vuepress/json-schema-deref-loader.js +22 -0
  17. data/docs/README.md +3 -4
  18. data/docs/package-lock.json +5205 -6885
  19. data/docs/package.json +13 -9
  20. data/lib/measures/.rubocop.yml +1 -1
  21. data/lib/measures/urban_geometry_creation/LICENSE.md +1 -1
  22. data/lib/measures/urban_geometry_creation/README.md +8 -0
  23. data/lib/measures/urban_geometry_creation/measure.rb +21 -4
  24. data/lib/measures/urban_geometry_creation/measure.xml +34 -20
  25. data/lib/measures/urban_geometry_creation_zoning/LICENSE.md +1 -1
  26. data/lib/measures/urban_geometry_creation_zoning/measure.rb +3 -3
  27. data/lib/measures/urban_geometry_creation_zoning/measure.xml +8 -13
  28. data/lib/urbanopt-geojson.rb +1 -1
  29. data/lib/urbanopt/geojson.rb +2 -1
  30. data/lib/urbanopt/geojson/building.rb +61 -10
  31. data/lib/urbanopt/geojson/derived_extension.rb +1 -1
  32. data/lib/urbanopt/geojson/district_system.rb +1 -1
  33. data/lib/urbanopt/geojson/feature.rb +117 -3
  34. data/lib/urbanopt/geojson/geo_file.rb +3 -4
  35. data/lib/urbanopt/geojson/helper.rb +46 -3
  36. data/lib/urbanopt/geojson/logging.rb +1 -1
  37. data/lib/urbanopt/geojson/mapper_classes.rb +1 -1
  38. data/lib/urbanopt/geojson/model.rb +1 -1
  39. data/lib/urbanopt/geojson/region.rb +1 -1
  40. data/lib/urbanopt/geojson/scale_area.rb +95 -0
  41. data/lib/urbanopt/geojson/schema/building_properties.json +57 -7
  42. data/lib/urbanopt/geojson/schema/electrical_connector_properties.json +9 -9
  43. data/lib/urbanopt/geojson/schema/electrical_junction_properties.json +4 -5
  44. data/lib/urbanopt/geojson/schema/thermal_connector_properties.json +1 -1
  45. data/lib/urbanopt/geojson/schema/thermal_junction_properties.json +1 -1
  46. data/lib/urbanopt/geojson/update_areas.rb +1 -1
  47. data/lib/urbanopt/geojson/validate_geojson.rb +1 -1
  48. data/lib/urbanopt/geojson/version.rb +2 -2
  49. data/lib/urbanopt/geojson/zoning.rb +21 -16
  50. data/urbanopt-geojson-gem.gemspec +4 -8
  51. metadata +12 -23
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-04/schema#",
3
- "id": "http://json-schema.org/openstudio-urban-modeling/district_system_properties.json#",
4
- "title": "URBANopt Electrical Line",
5
- "description": "Schema for an URBANopt Electrical Line object",
3
+ "id": "http://json-schema.org/openstudio-urban-modeling/electrical_connector_properties.json#",
4
+ "title": "URBANopt Electrical Connector",
5
+ "description": "Schema for an URBANopt Electrical Connector object",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "id": {
@@ -17,7 +17,7 @@
17
17
  "description": "Type of feature.",
18
18
  "type": "string",
19
19
  "enum": [
20
- "ElectricalLine"
20
+ "ElectricalConnector"
21
21
  ]
22
22
  },
23
23
  "source_name": {
@@ -46,7 +46,7 @@
46
46
  "description": "Total length (ft) of the line, generated on export.",
47
47
  "type": "number"
48
48
  },
49
- "start_junction_id": {
49
+ "startJunctionId": {
50
50
  "description": "Id of the junction that this line starts at.",
51
51
  "type": "string"
52
52
  },
@@ -67,7 +67,7 @@
67
67
  "type": "string"
68
68
  }
69
69
  },
70
- "end_junction_id": {
70
+ "endJunctionId": {
71
71
  "description": "Id of the junction that this line ends at.",
72
72
  "type": "string"
73
73
  },
@@ -79,8 +79,8 @@
79
79
  "type",
80
80
  "id",
81
81
  "connector_type",
82
- "start_junction_id",
83
- "end_junction_id"
82
+ "startJunctionId",
83
+ "endJunctionId"
84
84
  ],
85
85
  "additionalProperties": false,
86
86
  "definitions": {
@@ -88,7 +88,7 @@
88
88
  "description": "Type of electrical line",
89
89
  "type": "string",
90
90
  "enum": [
91
- "Line"
91
+ "Wire"
92
92
  ]
93
93
  },
94
94
  "WireType": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-04/schema#",
3
- "id": "http://json-schema.org/openstudio-urban-modeling/district_system_properties.json#",
3
+ "id": "http://json-schema.org/openstudio-urban-modeling/electrical_junction_properties.json#",
4
4
  "title": "URBANopt Electrical Junction",
5
5
  "description": "Schema for an URBANopt Electrical Junction object",
6
6
  "type": "object",
@@ -35,11 +35,11 @@
35
35
  "connector_type": {
36
36
  "$ref": "#/definitions/ElectricalJunctionType"
37
37
  },
38
- "building_id": {
38
+ "buildingId": {
39
39
  "description": "Id of building if this junction is inside a building.",
40
40
  "type": "string"
41
41
  },
42
- "district_system_id": {
42
+ "DSId": {
43
43
  "description": "Id of district system if this junction is inside a district system.",
44
44
  "type": "string"
45
45
  },
@@ -49,8 +49,7 @@
49
49
  },
50
50
  "required": [
51
51
  "type",
52
- "id",
53
- "connector_type"
52
+ "id"
54
53
  ],
55
54
  "additionalProperties": false,
56
55
  "definitions": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-04/schema#",
3
- "id": "http://json-schema.org/openstudio-urban-modeling/district_system_properties.json#",
3
+ "id": "http://json-schema.org/openstudio-urban-modeling/thermal_connector_properties.json#",
4
4
  "title": "URBANopt Thermal Connector",
5
5
  "description": "Schema for an URBANopt Thermal Connector object",
6
6
  "type": "object",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-04/schema#",
3
- "id": "http://json-schema.org/openstudio-urban-modeling/district_system_properties.json#",
3
+ "id": "http://json-schema.org/openstudio-urban-modeling/thermal_junction_properties.json#",
4
4
  "title": "URBANopt Thermal Junction",
5
5
  "description": "Schema for an URBANopt Thermal Junction object",
6
6
  "type": "object",
@@ -1,5 +1,5 @@
1
1
  # *********************************************************************************
2
- # URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
3
3
  # contributors. All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without modification,
@@ -1,5 +1,5 @@
1
1
  # *********************************************************************************
2
- # URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
3
3
  # contributors. All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without modification,
@@ -1,5 +1,5 @@
1
1
  # *********************************************************************************
2
- # URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
3
3
  # contributors. All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without modification,
@@ -30,6 +30,6 @@
30
30
 
31
31
  module URBANopt
32
32
  module GeoJSON
33
- VERSION = '0.3.0'.freeze
33
+ VERSION = '0.5.2'.freeze
34
34
  end
35
35
  end
@@ -1,5 +1,5 @@
1
1
  # *********************************************************************************
2
- # URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
3
3
  # contributors. All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without modification,
@@ -41,7 +41,8 @@ module URBANopt
41
41
  # * +floor_print+ - _Type:Array_ - An instance of +OpenStudio::Point3dVector.new+ .
42
42
  # * +perimeter_depth+ - _Type:Float_ - Represents perimeter depth.
43
43
  # * +runner+ - _Type:String_ - Measure run's instance of +OpenStudio::Measure::OSRunner+ .
44
- def self.divide_floor_print(floor_print, perimeter_depth, runner)
44
+ # * +scale+ - _Type:Boolean_ - Checks whether floor print is to be scaled. Default is false.
45
+ def self.divide_floor_print(floor_print, perimeter_depth, runner, scale = false)
45
46
  result = []
46
47
  t_inv = OpenStudio::Transformation.alignFace(floor_print)
47
48
  t = t_inv.inverse
@@ -86,21 +87,25 @@ module URBANopt
86
87
  if self_intersects
87
88
  runner.registerWarning('Self intersecting surface result, will not divide')
88
89
  end
89
- result << t_inv * new_vertices
90
- (0...n).each do |i|
91
- perim_vertices = OpenStudio::Point3dVector.new
92
- if i == (n - 1)
93
- perim_vertices << vertices[i]
94
- perim_vertices << vertices[0]
95
- perim_vertices << new_vertices[0]
96
- perim_vertices << new_vertices[i]
97
- else
98
- perim_vertices << vertices[i]
99
- perim_vertices << vertices[i + 1]
100
- perim_vertices << new_vertices[i + 1]
101
- perim_vertices << new_vertices[i]
90
+ if scale == true
91
+ result = t_inv * new_vertices
92
+ else
93
+ result << t_inv * new_vertices
94
+ (0...n).each do |i|
95
+ perim_vertices = OpenStudio::Point3dVector.new
96
+ if i == (n - 1)
97
+ perim_vertices << vertices[i]
98
+ perim_vertices << vertices[0]
99
+ perim_vertices << new_vertices[0]
100
+ perim_vertices << new_vertices[i]
101
+ else
102
+ perim_vertices << vertices[i]
103
+ perim_vertices << vertices[i + 1]
104
+ perim_vertices << new_vertices[i + 1]
105
+ perim_vertices << new_vertices[i]
106
+ end
107
+ result << t_inv * perim_vertices
102
108
  end
103
- result << t_inv * perim_vertices
104
109
  end
105
110
  return result
106
111
  end
@@ -9,9 +9,10 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ['Tanushree Charan', 'Nicholas Long', 'Dan Macumber']
10
10
  spec.email = ['tanushree.charan@nrel.gov', 'nicholas.long@nrel.gov', 'daniel.macumber@nrel.gov']
11
11
 
12
- spec.summary = 'Library and measures to translate URBANopt GeoJSON format to OpenStudio'
12
+ spec.summary = 'Translate URBANopt GeoJSON format to OpenStudio'
13
13
  spec.description = 'Library and measures to translate URBANopt GeoJSON format to OpenStudio'
14
14
  spec.homepage = 'https://github.com/urbanopt/urbanopt-geojson-gem'
15
+ spec.licenses = 'Nonstandard'
15
16
 
16
17
  # Specify which files should be added to the gem when it is released.
17
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -28,11 +29,6 @@ Gem::Specification.new do |spec|
28
29
  spec.add_development_dependency 'rake', '~> 13.0'
29
30
  spec.add_development_dependency 'rspec', '~> 3.7'
30
31
 
31
- # lock the version of these dependencies due to using older version of Ruby.
32
- # spec.add_dependency 'public_suffix', '3.1.1'
33
-
34
- # other dependencies
35
- spec.add_dependency 'json-schema'
36
- spec.add_dependency 'openstudio-extension', '~> 0.2.3'
37
- spec.add_dependency 'urbanopt-core', '~> 0.3.0'
32
+ spec.add_runtime_dependency 'json-schema', '~> 2.8'
33
+ spec.add_runtime_dependency 'urbanopt-core', '~> 0.5.1'
38
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urbanopt-geojson
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanushree Charan
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2020-06-04 00:00:00.000000000 Z
13
+ date: 2021-02-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -56,46 +56,32 @@ dependencies:
56
56
  version: '3.7'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: json-schema
59
- requirement: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: '0'
64
- type: :runtime
65
- prerelease: false
66
- version_requirements: !ruby/object:Gem::Requirement
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: '0'
71
- - !ruby/object:Gem::Dependency
72
- name: openstudio-extension
73
59
  requirement: !ruby/object:Gem::Requirement
74
60
  requirements:
75
61
  - - "~>"
76
62
  - !ruby/object:Gem::Version
77
- version: 0.2.3
63
+ version: '2.8'
78
64
  type: :runtime
79
65
  prerelease: false
80
66
  version_requirements: !ruby/object:Gem::Requirement
81
67
  requirements:
82
68
  - - "~>"
83
69
  - !ruby/object:Gem::Version
84
- version: 0.2.3
70
+ version: '2.8'
85
71
  - !ruby/object:Gem::Dependency
86
72
  name: urbanopt-core
87
73
  requirement: !ruby/object:Gem::Requirement
88
74
  requirements:
89
75
  - - "~>"
90
76
  - !ruby/object:Gem::Version
91
- version: 0.3.0
77
+ version: 0.5.1
92
78
  type: :runtime
93
79
  prerelease: false
94
80
  version_requirements: !ruby/object:Gem::Requirement
95
81
  requirements:
96
82
  - - "~>"
97
83
  - !ruby/object:Gem::Version
98
- version: 0.3.0
84
+ version: 0.5.1
99
85
  description: Library and measures to translate URBANopt GeoJSON format to OpenStudio
100
86
  email:
101
87
  - tanushree.charan@nrel.gov
@@ -141,6 +127,7 @@ files:
141
127
  - docs/.vuepress/components/ThermalJunctionProperties.vue
142
128
  - docs/.vuepress/config.js
143
129
  - docs/.vuepress/highlight.js
130
+ - docs/.vuepress/json-schema-deref-loader.js
144
131
  - docs/.vuepress/public/custom_rdoc_styles.css
145
132
  - docs/.vuepress/utils.js
146
133
  - docs/README.md
@@ -179,6 +166,7 @@ files:
179
166
  - lib/urbanopt/geojson/mapper_classes.rb
180
167
  - lib/urbanopt/geojson/model.rb
181
168
  - lib/urbanopt/geojson/region.rb
169
+ - lib/urbanopt/geojson/scale_area.rb
182
170
  - lib/urbanopt/geojson/schema/building_properties.json
183
171
  - lib/urbanopt/geojson/schema/district_system_properties.json
184
172
  - lib/urbanopt/geojson/schema/electrical_connector_properties.json
@@ -199,7 +187,8 @@ files:
199
187
  - package-lock.json
200
188
  - urbanopt-geojson-gem.gemspec
201
189
  homepage: https://github.com/urbanopt/urbanopt-geojson-gem
202
- licenses: []
190
+ licenses:
191
+ - Nonstandard
203
192
  metadata: {}
204
193
  post_install_message:
205
194
  rdoc_options: []
@@ -216,8 +205,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
205
  - !ruby/object:Gem::Version
217
206
  version: '0'
218
207
  requirements: []
219
- rubygems_version: 3.1.2
208
+ rubygems_version: 3.1.4
220
209
  signing_key:
221
210
  specification_version: 4
222
- summary: Library and measures to translate URBANopt GeoJSON format to OpenStudio
211
+ summary: Translate URBANopt GeoJSON format to OpenStudio
223
212
  test_files: []