mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-28 09:51:36 +00:00
Add address fields to buildings (#1529)
This commit is contained in:
@@ -682,12 +682,19 @@ Specify a collection of Users by directly specifying them or by specifying items
|
||||
## Item attributes
|
||||
|
||||
<BuildingAttribute> ::=
|
||||
(address|addresslines <String>)|
|
||||
(city|locality <String>)|
|
||||
(country|regioncode <String>)|
|
||||
(description <String>)|
|
||||
(floors <FloorNameList>)|
|
||||
(id <String>)|
|
||||
(language|languageCode <Language>)|
|
||||
(latitude <Float>)|
|
||||
(longitude <Float>)|
|
||||
(name <String>)
|
||||
(state|administrativearea <String>)|
|
||||
(sublocality <String>)|
|
||||
(zipcode|postalcode <String>)
|
||||
|
||||
<CalendarAttribute> ::=
|
||||
(selected <Boolean>)|(hidden <Boolean>)|(summary <String>)|(colorindex|colorid <CalendarColorIndex>)|(backgroundcolor <ColorValue>)|(foregroundcolor <ColorValue>)|
|
||||
|
||||
@@ -227,6 +227,22 @@ def printFeatures():
|
||||
display.write_csv_file(csvRows, titles, 'Features', to_drive)
|
||||
|
||||
|
||||
BUILDING_ADDRESS_FIELD_MAP = {
|
||||
'address': 'addressLines',
|
||||
'addresslines': 'addressLines',
|
||||
'administrativearea': 'administrativeArea',
|
||||
'city': 'locality',
|
||||
'country': 'regionCode',
|
||||
'language': 'languageCode',
|
||||
'languagecode': 'languageCode',
|
||||
'locality': 'locality',
|
||||
'postalcode': 'postalCode',
|
||||
'regioncode': 'regionCode',
|
||||
'state': 'administrativeArea',
|
||||
'sublocality': 'sublocality',
|
||||
'zipcode': 'postalCode',
|
||||
}
|
||||
|
||||
def _getBuildingAttributes(args, body={}):
|
||||
i = 0
|
||||
while i < len(args):
|
||||
@@ -253,6 +269,16 @@ def _getBuildingAttributes(args, body={}):
|
||||
elif myarg == 'floors':
|
||||
body['floorNames'] = args[i + 1].split(',')
|
||||
i += 2
|
||||
elif myarg in BUILDING_ADDRESS_FIELD_MAP:
|
||||
myarg = BUILDING_ADDRESS_FIELD_MAP[myarg]
|
||||
body.setdefault('address', {})
|
||||
if myarg == 'addressLines':
|
||||
body['address'][myarg] = args[i + 1].split('\n')
|
||||
elif myarg == 'languageCode':
|
||||
body['address'][myarg] = LANGUAGE_CODES_MAP.get(args[i + 1].lower(), args[i + 1])
|
||||
else:
|
||||
body['address'][myarg] = args[i + 1]
|
||||
i += 2
|
||||
else:
|
||||
controlflow.invalid_argument_exit(myarg,
|
||||
'gam create|update building')
|
||||
|
||||
Reference in New Issue
Block a user