mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +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
|
## Item attributes
|
||||||
|
|
||||||
<BuildingAttribute> ::=
|
<BuildingAttribute> ::=
|
||||||
|
(address|addresslines <String>)|
|
||||||
|
(city|locality <String>)|
|
||||||
|
(country|regioncode <String>)|
|
||||||
(description <String>)|
|
(description <String>)|
|
||||||
(floors <FloorNameList>)|
|
(floors <FloorNameList>)|
|
||||||
(id <String>)|
|
(id <String>)|
|
||||||
|
(language|languageCode <Language>)|
|
||||||
(latitude <Float>)|
|
(latitude <Float>)|
|
||||||
(longitude <Float>)|
|
(longitude <Float>)|
|
||||||
(name <String>)
|
(name <String>)
|
||||||
|
(state|administrativearea <String>)|
|
||||||
|
(sublocality <String>)|
|
||||||
|
(zipcode|postalcode <String>)
|
||||||
|
|
||||||
<CalendarAttribute> ::=
|
<CalendarAttribute> ::=
|
||||||
(selected <Boolean>)|(hidden <Boolean>)|(summary <String>)|(colorindex|colorid <CalendarColorIndex>)|(backgroundcolor <ColorValue>)|(foregroundcolor <ColorValue>)|
|
(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)
|
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={}):
|
def _getBuildingAttributes(args, body={}):
|
||||||
i = 0
|
i = 0
|
||||||
while i < len(args):
|
while i < len(args):
|
||||||
@@ -253,6 +269,16 @@ def _getBuildingAttributes(args, body={}):
|
|||||||
elif myarg == 'floors':
|
elif myarg == 'floors':
|
||||||
body['floorNames'] = args[i + 1].split(',')
|
body['floorNames'] = args[i + 1].split(',')
|
||||||
i += 2
|
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:
|
else:
|
||||||
controlflow.invalid_argument_exit(myarg,
|
controlflow.invalid_argument_exit(myarg,
|
||||||
'gam create|update building')
|
'gam create|update building')
|
||||||
|
|||||||
Reference in New Issue
Block a user