GMSIndoorDisplay: how to force a change to a specific floor

I am using the GMSIndoorDisplay class for Google Maps. I can customize the view with the default gender. The user can change the floor by clicking on any floor in the floor list. Is there a way to programmatically force a sex change on an existing loaded ViewController?

+4
source share
3 answers

I found a way to do this. By saving the current building object, we can change the active GMSIndoorDisplay level, and then force the delegate to be called:

- (void) didChangeActiveBuilding:       (GMSIndoorBuilding *)   building    [optional]

Thus, the following delegates will start automatically: - (void) didChangeActiveBuilding: (GMSIndoorBuilding *) building [optional]

- (void) didChangeActiveLevel:      (GMSIndoorLevel *)  level   [optional]
+1

, , . , .

0

well, you will need to have all levels in the building and the current floor selected.

- (void)mapViewDidFinishTileRendering:(GMSMapView *)mapView {
    if(!selectlevel)
        selectlevel = mapView.indoorDisplay.activeBuilding.defaultLevelIndex;
    allLevels = mapView.indoorDisplay.activeBuilding.levels;
}

- (void)down:(id)down {
    if(selectlevel>0){
        selectlevel = selectlevel -1;
        mapView.indoorDisplay.activeLevel = allLevels[selectlevel];
    }
}

- (void)up:(id)up {
    if(selectlevel< [allLevels count] -1){
        selectlevel = selectlevel +1;
        mapView.indoorDisplay.activeLevel = allLevels[selectlevel];
    }
}
0
source

Source: https://habr.com/ru/post/1568197/


All Articles