显示在谷歌地图的室内地名 [英] Showing place names on Google indoor map

查看:336
本文介绍了显示在谷歌地图的室内地名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让谷歌室内地图的工作在我的应用程序。当我看到在谷歌地图中的建筑与室内提供的信息也显示了它的地方的名字。

我抬头看了看样品谷歌室内地图项目,把新的纬度和经度的示例项目显示了大楼,但并不是所有的地方的名字。

我如何让它表现出同样的信息,如谷歌地图显示?

下面是$ C $下IndoorDemoActivity

 公共类IndoorDemoActivity扩展FragmentActivity {

  私人GoogleMap的MMAP;

  私人布尔showLevelPicker = TRUE;

  @覆盖
  保护无效的onCreate(包savedInstanceState){
    super.onCreate(savedInstanceState);
    的setContentView(R.layout.indoor_demo);
    MMAP =((SupportMapFragment)getSupportFragmentManager()findFragmentById(R.id.map)。)的GetMap()。
    // SFO机场
// mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(新经纬度(37.614631,-122.385153),18));
    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(新经纬度(19.173036,72.835679),18));
  }

  / **
   *点击切换级别选择器按钮时调用。
   * /
  公共无效onToggleLevelPicker(查看视图){
    showLevelPicker = showLevelPicker!;
    mMap.getUiSettings()setIndoorLevelPickerEnabled(showLevelPicker)。
  }

  / **
   *聚焦建筑信息被点击时调用。
   * /
  公共无效onFocusedBuildingInfo(查看视图){
    IndoorBuilding建筑= mMap.getFocusedBuilding();
    如果(建筑!= NULL){
      字符串s =;
      对于(IndoorLevel级别:(名单< IndoorLevel>)building.getLevels()){
        S = S + level.getName()+;
      }
      如果(building.isUnderground()){
        S + =就是地下;
      }
      的setText(多个);
    } 其他 {
      的setText(无可见的建筑);
    }
  }

  / **
   *聚焦级别的信息被点击时调用。
   * /
  公共无效onVisibleLevelInfo(查看视图){
    IndoorBuilding建筑= mMap.getFocusedBuilding();
    如果(建筑!= NULL){
      。IndoorLevel水平=(IndoorLevel)building.getLevels()得到(building.getActiveLevelIndex());
      如果(水平!= NULL){
        的setText(level.getName());
      } 其他 {
        的setText(无可见级别);
      }
    } 其他 {
      的setText(无可见的建筑);
    }
  }

  / **
   *激活更高层次的被点击时调用。
   * /
  公共无效onHigherLevel(查看视图){
    IndoorBuilding建筑= mMap.getFocusedBuilding();
    如果(建筑!= NULL){
      名单< IndoorLevel>水平= building.getLevels();
      如果(!levels.isEmpty()){
        INT currentLevel = building.getActiveLevelIndex();
        //水平处于显示顺序从上到下,
        //即更高的水平在建筑物被编号较低的阵列中。
        INT newLevel = currentLevel  -  1;
        如果(newLevel == -1){
          newLevel = levels.size() -  1;
        }
        IndoorLevel水平= levels.get(newLevel);
        的setText(Activiating水平+ level.getName());
        level.activate();
      } 其他 {
        的setText(No水平在建设);
      }
    } 其他 {
      的setText(无可见的建筑);
    }
  }

  私人无效的setText(字符串消息){
    TextView的文字=(TextView的)findViewById(R.id.top_text);
    text.setText(消息);
  }
}
 

解决方案

你在谷歌地图应用程序看到的可能被放置通过谷歌的地方谷歌地图应用程序本身的标记。该集你看到在您的应用程序标记的限制很可能烘焙到室内地图本身的平面图标志

据我所知,显示其他地方的信息,你必须与谷歌的地方API集成。然后,您可以用它来查找并添加业务标记自己<一href="https://developer.android.com/reference/com/google/android/gms/maps/GoogleMap.html#addMarker(com.google.android.gms.maps.model.MarkerOptions)"相对=nofollow> addMarker ,可能清理每当水平变化重新添加他们。

I m trying to get Google indoor maps to work inside my app. When I look at a building in Google maps with indoor information available it shows the name of the places in it.

I looked up the sample Google Indoor maps project, putting new latitude and longitude the sample project shows the building but not all the name of places.

How do I make it show the same information as Google maps show ?

Here is the code for IndoorDemoActivity

public class IndoorDemoActivity extends FragmentActivity {

  private GoogleMap mMap;

  private boolean showLevelPicker = true;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.indoor_demo);
    mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
    // SFO airport
//    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(37.614631, -122.385153), 18));
    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(19.173036, 72.835679), 18));
  }

  /**
   * Called when the toggle level picker button is clicked.
   */
  public void onToggleLevelPicker(View view) {
    showLevelPicker = !showLevelPicker;
    mMap.getUiSettings().setIndoorLevelPickerEnabled(showLevelPicker);
  }

  /**
   * 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");
    }
  }

  /**
   * 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");
    }
  }

  /**
   * 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");
    }
  }

  private void setText(String message) {
    TextView text = (TextView) findViewById(R.id.top_text);
    text.setText(message);
  }
}

解决方案

The markers you see in the Google Maps app are likely placed by the Google Maps app itself via Google Places. The limited set of markers you are seeing in your app are likely baked into the indoor map itself as "Floor Plan markers".

As far as I know, to display the other place information you must integrate with the Google Places API. You can then use that to find and add the business markers yourself with addMarker, probably clearing and re-adding them whenever the level is changed.

这篇关于显示在谷歌地图的室内地名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆