Java 类com.google.android.gms.maps.model.IndoorLevel 实例源码

项目:PhoneChat    文件:PluginUtil.java   
public static JSONObject convertIndoorBuildingToJson(IndoorBuilding indoorBuilding) {
  if (indoorBuilding == null) {
    return null;
  }
  JSONObject result = new JSONObject();
  try {
    JSONArray levels = new JSONArray();
    for(IndoorLevel level : indoorBuilding.getLevels()){
      JSONObject levelInfo = new JSONObject();
        levelInfo.put("name",level.getName());

        // TODO Auto-generated catch block
      levelInfo.put("shortName",level.getShortName());
      levels.put(levelInfo);
    }
    result.put("activeLevelIndex",indoorBuilding.getActiveLevelIndex());
    result.put("defaultLevelIndex",indoorBuilding.getDefaultLevelIndex());
    result.put("levels",levels);
    result.put("underground",indoorBuilding.isUnderground());
  } catch (JSONException e) {
    e.printStackTrace();
    return null;
  }  
  return result;
}
项目:neo4art    文件:PluginUtil.java   
public static JSONObject convertIndoorBuildingToJson(IndoorBuilding indoorBuilding) {
  if (indoorBuilding == null) {
    return null;
  }
  JSONObject result = new JSONObject();
  try {
    JSONArray levels = new JSONArray();
    for(IndoorLevel level : indoorBuilding.getLevels()){
      JSONObject levelInfo = new JSONObject();
        levelInfo.put("name",level.getName());

        // TODO Auto-generated catch block
      levelInfo.put("shortName",level.getShortName());
      levels.put(levelInfo);
    }
    result.put("activeLevelIndex",indoorBuilding.getActiveLevelIndex());
    result.put("defaultLevelIndex",indoorBuilding.getDefaultLevelIndex());
    result.put("levels",levels);
    result.put("underground",indoorBuilding.isUnderground());
  } catch (JSONException e) {
    e.printStackTrace();
    return null;
  }  
  return result;
}
项目:neo4art    文件:PluginUtil.java   
public static JSONObject convertIndoorBuildingToJson(IndoorBuilding indoorBuilding) {
  if (indoorBuilding == null) {
    return null;
  }
  JSONObject result = new JSONObject();
  try {
    JSONArray levels = new JSONArray();
    for(IndoorLevel level : indoorBuilding.getLevels()){
      JSONObject levelInfo = new JSONObject();
        levelInfo.put("name",level.getName());

        // TODO Auto-generated catch block
      levelInfo.put("shortName",level.getShortName());
      levels.put(levelInfo);
    }
    result.put("activeLevelIndex",indoorBuilding.getActiveLevelIndex());
    result.put("defaultLevelIndex",indoorBuilding.getDefaultLevelIndex());
    result.put("levels",levels);
    result.put("underground",indoorBuilding.isUnderground());
  } catch (JSONException e) {
    e.printStackTrace();
    return null;
  }  
  return result;
}
项目:neo4art    文件:PluginUtil.java   
public static JSONObject convertIndoorBuildingToJson(IndoorBuilding indoorBuilding) {
  if (indoorBuilding == null) {
    return null;
  }
  JSONObject result = new JSONObject();
  try {
    JSONArray levels = new JSONArray();
    for(IndoorLevel level : indoorBuilding.getLevels()){
      JSONObject levelInfo = new JSONObject();
        levelInfo.put("name",level.getName());

        // TODO Auto-generated catch block
      levelInfo.put("shortName",level.getShortName());
      levels.put(levelInfo);
    }
    result.put("activeLevelIndex",indoorBuilding.getActiveLevelIndex());
    result.put("defaultLevelIndex",indoorBuilding.getDefaultLevelIndex());
    result.put("levels",levels);
    result.put("underground",indoorBuilding.isUnderground());
  } catch (JSONException e) {
    e.printStackTrace();
    return null;
  }  
  return result;
}
项目:HereAStory-Android    文件:IndoorDemoActivity.java   
/**
 * Called when the focused building info is clicked.
 */
public void onFocusedBuildingInfo(View view) {
  IndoorBuilding building = mMap.getFocusedBuilding();
  if (building != null) {
    String s = "";
    for (IndoorLevel level : (List<IndoorLevel>) building.getLevels()) {
      s = s + level.getName() + " ";
    }
    if (building.isUnderground()) {
      s += "is underground";
    }
    setText(s);
  } else {
    setText("No visible building");
  }
}
项目:HereAStory-Android    文件:IndoorDemoActivity.java   
/**
 * Called when the activate higher level is clicked.
 */
public void onHigherLevel(View view) {
  IndoorBuilding building = mMap.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("Activiating level " + level.getName());
      level.activate();
    } else {
      setText("No levels in building");
    }
  } else {
    setText("No visible building");
  }
}
项目:HereAStory-Android    文件:IndoorDemoActivity.java   
/**
 * Called when the focused level info is clicked.
 */
public void onVisibleLevelInfo(View view) {
  IndoorBuilding building = mMap.getFocusedBuilding();
  if (building != null) {
    IndoorLevel level = (IndoorLevel) building.getLevels().get(building.getActiveLevelIndex());
    if (level != null) {
      setText(level.getName());
    } else {
      setText("No visible level");
    }
  } else {
    setText("No visible building");
  }
}