下面列出了怎么用com.google.android.gms.maps.model.IndoorBuilding的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Called when the focused building info is clicked.
*/
public void onFocusedBuildingInfo(View view) {
IndoorBuilding building = map.getFocusedBuilding();
if (building != null) {
StringBuilder s = new StringBuilder();
for (IndoorLevel level : building.getLevels()) {
s.append(level.getName()).append(" ");
}
if (building.isUnderground()) {
s.append("is underground");
}
setText(s.toString());
} else {
setText("No visible building");
}
}
/**
* Called when the activate higher level is clicked.
*/
public void onHigherLevel(View view) {
IndoorBuilding building = map.getFocusedBuilding();
if (building != null) {
List<IndoorLevel> levels = building.getLevels();
if (!levels.isEmpty()) {
int currentLevel = building.getActiveLevelIndex();
// The levels are in 'display order' from top to bottom,
// i.e. higher levels in the building are lower numbered in the array.
int newLevel = currentLevel - 1;
if (newLevel == -1) {
newLevel = levels.size() - 1;
}
IndoorLevel level = levels.get(newLevel);
setText("Activating level " + level.getName());
level.activate();
} else {
setText("No levels in building");
}
} else {
setText("No visible building");
}
}
/**
* Called when the focused level info is clicked.
*/
public void onVisibleLevelInfo(View view) {
IndoorBuilding building = map.getFocusedBuilding();
if (building != null) {
IndoorLevel level =
building.getLevels().get(building.getActiveLevelIndex());
if (level != null) {
setText(level.getName());
} else {
setText("No visible level");
}
} else {
setText("No visible building");
}
}
@Override
public void onIndoorLevelActivated(IndoorBuilding indoorBuilding) {
if( indoorBuilding == null )
return;
}