在Android Studio中实现了findpath功能,但长春的地图只添加了网络,没有底图,尝试加了底图,页面的功能就是实现不了了。
想给该功能加底图,该怎么加
mWorkspace = new Workspace();
MapView m_mapView;
WorkspaceConnectionInfo info1= new WorkspaceConnectionInfo();
info1.setServer(sdcard + "/SuperMap/SampleData/City/Changchun.smwu");
info1.setType(WorkspaceType.SMWU);
mWorkspace.open(info1);
//将地图显示控件和工作空间关联
m_mapView = (MapView)findViewById(R.id.Map_view);
mMapControl = m_mapView.getMapControl();
mMapControl.getMap().setWorkspace(mWorkspace);
String mapName = mWorkspace.getMaps().get(0);
mMapControl.getMap().open(mapName);
//打开数据源,得到点线数据集
DatasourceConnectionInfo info = new DatasourceConnectionInfo();
String dataServer = sdcard+"/SuperMap/SampleData/City/Changchun.udb";
info.setEngineType(EngineType.UDB);
info.setServer(dataServer);
Datasource datasource = mWorkspace.getDatasources().open(info);
mMapControl.getMap().setWorkspace(mWorkspace);
m_datasetLine = (DatasetVector)datasource.getDatasets().get(m_datasetName);
m_trackingLayer = mMapControl.getMap().getTrackingLayer();
//加载线数据集并设置风格
m_layerLine = mMapControl.getMap().getLayers().add(m_datasetLine,
true);
m_layerLine.setSelectable(false);
LayerSettingVector lineSetting = (LayerSettingVector)m_layerLine
.getAdditionalSetting();
GeoStyle lineStyle = new GeoStyle();
lineStyle.setLineColor(new Color(0, 0, 255));
lineStyle.setLineWidth(0.1);
lineSetting.setStyle(lineStyle);
mMapControl.getMap().viewEntire();
mMapControl.getMap().refresh();