@@ -16,6 +16,7 @@ package uiuc
16
16
17
17
import (
18
18
model "application/core/model"
19
+ "slices"
19
20
"strconv"
20
21
)
21
22
@@ -153,9 +154,28 @@ func NewBuilding(bldg CampusBuilding) *model.Building {
153
154
}
154
155
155
156
newBldg .Floors = append (newBldg .Floors , bldg .Floors ... )
157
+ var featuredata = make (map [string ]model.FeatureMapEntry , 0 )
158
+
156
159
for _ , n := range bldg .Features {
157
160
158
- newBldg .Features = append (newBldg .Features , * NewFeature (n ))
161
+ val , ok := featuredata [n .EQIndicator ]
162
+ if ok {
163
+ if ! slices .Contains (val .Floors , n .FoundOnFloor ) {
164
+ val .Floors = append (val .Floors , n .FoundOnFloor )
165
+ featuredata [n .EQIndicator ] = val
166
+ }
167
+
168
+ } else {
169
+ var floors = make ([]string , 1 )
170
+ floors [0 ] = n .FoundOnFloor
171
+ fme := model.FeatureMapEntry {Name : n .Name , Floors : floors }
172
+ featuredata [n .EQIndicator ] = fme
173
+ }
174
+ //newBldg.Features = append(newBldg.Features, *NewFeature(n))
175
+ }
176
+ for key , value := range featuredata {
177
+ var feature = model.BuildingFeatureLocation {Key : key , Value : value }
178
+ newBldg .Features = append (newBldg .Features , feature )
159
179
}
160
180
161
181
return & newBldg
@@ -184,3 +204,5 @@ func NewFeature(f CampusBuildingFeature) *model.BuildingFeature {
184
204
IsADA : f .IsADA , IsExternal : f .IsExternal , Latitude : f .Latitude , Longitude : f .Longitude , Comments : f .Comments }
185
205
return & newFeature
186
206
}
207
+
208
+ // AddToFeatureMap adds the features floor and name
0 commit comments