我正在尝试让Google室内地图在我的应用中运行.当我在Google地图中查看具有室内信息的建筑物时,它会显示其中的地点名称.
我查找了示例Google室内地图项目,并在示例项目中显示了建筑物(但不是全部地名)中添加了新的纬度和经度.
如何使它显示与Google地图显示的信息相同的信息?
这是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); }}
解决方法:
您在Google Maps应用中看到的标记很可能由Google Maps应用本身通过Google Places放置.您在应用程序中看到的有限标记集很可能会被烘焙到室内地图中,即“Floor Plan markers”.
据我所知,要显示其他地点信息,您必须将其与Google Places API集成在一起.然后,您可以使用它与addMarker
一起查找和添加业务标记,很可能在更改级别时清除并重新添加它们.
以上是内存溢出为你收集整理的android-在Google室内地图上显示地名全部内容,希望文章能够帮你解决android-在Google室内地图上显示地名所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)