SuperMap iMobile 2D and 3D navigation integration - 3D indoor navigation

1 Scene production

The indoor navigation model effectively organizes data from different buildings and floors. Connections between different floors need to be established by building stair relationships; SuperMap iDeskstop provides a visual and interactive tool for building stair relationships. By loading the indoor navigation model, a two- and three-dimensional integrated navigation scene is generated. Users can use the scene to conveniently, quickly and accurately Specify the ascending and descending directions of the stairs to achieve interconnection of paths on adjacent floors.

1.1 Load indoor navigation model

Before building the staircase relationship, you need to load the indoor navigation model first. The program will automatically add the indoor network data set, floor bottom data set, outdoor bottom data set and outdoor road network data of each floor to the scene according to the floor relationship attribute table and map it. , generate a two- and three-dimensional integrated navigation scene.

How to operate:

Click the Traffic Analysis->Indoor Navigation->Build Stair Relationship button to pop up the Load Indoor Navigation Model dialog box. In the dialog box, you will set the following information:
Insert image description here
Road network : Set the data source where the built navigation model is located and the generated floor relationship attributes. table data set.
Stair relation data set : It is a three-dimensional line data set, which serves as a connecting bridge between different floors. You can load the existing stair relationship data set and perform management operations such as modification, deletion, and addition. You can also create a new data set and build the stair relationship from the beginning.
2. Complete the above settings and click the "OK" button. The program will automatically load the data set in the navigation model, generate a two- and three-dimensional integrated navigation scene model, and pop up the stair relationship management dialog box.
Insert image description here

1.2 2D and 3D integrated navigation scenario

The 2D and 3D integrated navigation scene is a program that loads indoor navigation model data and is automatically generated after different style settings and thematic map processing. It is used to display the distribution of different buildings and floors. Key facilities such as stair points and entrances and exits can be visually viewed in the scene. distribution of points.

The data is organized by floor in the layer manager. The data for each floor includes: indoor road network bottom data set; indoor network data set; labeled thematic map based on the name field of the road network data set to display key facilities name; and a single-value thematic map made according to the type field of key facilities, which is displayed in different colors according to the type to distinguish different facilities; if outdoor road network data is added when building the model, the bottom surface of the outdoor road network is also loaded in the scene Data set and outdoor network data set.

Note: When loading a large amount of navigation model data, scene loading takes a long time, so please be patient.

Insert image description here

1.3 Stair relationship management

In the floor relationship management dialog box, stair point management operations such as viewing, modification, and construction can be performed. Stair types can be divided into straight ladders, walking stairs, and escalators; among them, straight ladders and walking stairs have two relationships: ascending and descending; escalators, It can be upstream or downstream, and the user can specify it according to the data situation. Detailed parameter descriptions are as follows:

Floor : The drop-down menu displays the participating floors in the current navigation model. You can specify the floor to view and manage stair relationships.
Type : The drop-down menu displays the stair type of the current floor. You can select a type from straight stairs, walking stairs, or escalators to view. By default, all types are displayed.
Relationship : The drop-down menu is divided into two types of stair relationships: connected and unconnected. The display can be switched, and all are displayed by default.
Insert image description here
Stair list area : After selecting a floor, all stair point data information of the current floor is arranged accordingly in the list area, including floor ID, stair name (type), direction, arrival ID and arrival floor. Double-click a specific stair point and the stair point will be highlighted in the scene window.

Each stair point has a fixed ID value. The stair point has two directions, up and down, depending on the floor. Therefore, one stair point will generate two records. For example: the stair point ID is 70004010188 and the floor is 1. Floor, there are two records with directions of uplink and downlink at the same time: the first uplink record, the arrival floor is the 2nd floor, and the 2nd floor arrival ID needs to be specified; the second downlink record, because the building does not have -1 floor, the default arrival ID It will be a stair relationship that cannot go down, that is, there is no need to set the stair relationship, "cannot go up" or "cannot go down". The default arrival ID and arrival floor are displayed as "-".

Note: If the (X, Y) coordinates of two stair points between adjacent floors are completely consistent, the program will automatically create a relationship between the two stair points when loading the indoor navigation model.

Build stair relationship

Provides two ways to build stair relationships: "mouse picking" and "specifying stair ID":

Method 1: Mouse picking , select the stair point record that sets the stair relationship in the stair point list area, click the "Mouse Pick" button, move the mouse to the scene, the mouse state changes to the picking state, and select the stair point to be reached. , you can connect two stair points to generate a three-dimensional line. At the same time, the program automatically adds the stair point information to the attributes of arrival ID and arrival floor.
Method 2: Specify the stair ID , select the stair point record that sets the stair relationship in the stair point list area, double-click the arrival ID content box of the current stair point, the arrival ID list box will pop up, and check the radio button of the arrival ID in the list box. frame.
You can use any of the above methods to construct stair relationships for stair points in sequence. The following figure shows a comparison before and after constructing stair relationships.
Insert image description here

1.4 Cache data production

In order to make the 3D scene have higher operating performance on the mobile terminal, it is applied in the form of cache.

Step 1: Create a 3D cache

In [Workspace Manager] - right-click [Current Scene] - select [Generate Scene Cache] in the right-click menu

During the process, you may be prompted with "Turn on the scene generation cache, which may cause problems such as excessive memory. Do you want to turn it off?" and a prompt whether to save the current scene. Select "Yes" for both.

In the "Generate Scene Cache" dialog box, select all data sets and select "Texture Compression Format" (webp on mobile devices).
Insert image description here
Step 2: Readjust the data structure

Close the current workspace;

After the scene cache is generated, a new workspace will be generated and the workspace will be opened;

Copy the data source where the original navigation data is located to the folder where the new workspace is located;

Open the data source through [Workspace Manager]-[Data Source] right-click-[Open File Data Source...].

Save the workspace through [Start]-[Workspace-Save].

At this point, the three-dimensional indoor navigation data is completed.
Insert image description here

2 3D indoor navigation data loading application

The indoor navigation function is implemented through code. The reference code is as follows:

2.1 Open the workspace and initialize the navigation module

//打开工作空间
m_workspace = new Workspace();
WorkspaceConnectionInfo info = new WorkspaceConnectionInfo();
info.setServer(sdcard+"/SampleData/室内导航0526/室内导航.sxwu");
info.setType(WorkspaceType.SXWU);
boolean result = m_workspace.open(info);  
if (!result) {
    
    
	System.out.println("工作空间打开失败");
	return;
}  
m_sceneView= (SceneView)findViewById(R.id.scene_control);
m_sceneControl= m_sceneView.getSceneControl();
m_sceneControl.sceneControlInitedComplete(new SceneControlInitedCallBackListenner() {
    
    //场景控件初始化回调监听
	@Override
	public void onSuccess(String arg0) {
    
    
		// TODO Auto-generated method stub
		//打开场景
		m_scene = m_sceneControl.getScene();
		m_scene.setWorkspace(m_workspace); 
		String mapName = m_workspace.getScenes().get(0);
		m_scene.open(mapName);
		m_navigation3D = m_sceneView.getNavigation();		//获取导航模块
		m_navigation3D.setUpdateDataMode(true);
		m_navigation3D.setDatasource(m_workspace.getDatasources().get("kaide_mall"));
		m_sceneControl.setNavigationControlVisible(true);	//设置导航条可见
		//初始化FloorList
		m_floorListView3D = (FloorListView3D)findViewById(R.id.floor_list_view_3d);
		m_floorListView3D.setVisibility(View.VISIBLE);
		m_floorListView3D.setNavigation3D(m_navigation3D);
		m_floorListView3D.linkScenepControl(m_sceneControl, m_workspace);
		//设置三场景控件
		m_navigation3D.setSceneControl(m_sceneControl);
		//设置用户手势识别器(用于通过手势添加导航点)
		m_sceneControl.setGestureDetector(new GestureDetector(m_sceneControl.getContext(), mSceneGestrueListener));
		//添加导航引导信息更新监听器
		m_navigation3D.addNaviInfoListener(new NaviListener() {
    
    
			@Override
			public void onStopNavi() {
    
    
				//结束导航后,关闭导航状态
				m_naviState = NAVI_STATE.STATE_NULL;
				m_navigation3D.cleanPath();
				System.out.println("导航停止");
			}
			@Override
			public void onStartNavi() {
    
    
			}
			@Override
			public void onPlayNaviMessage(String message) {
    
    
			}
			@Override
			public void onNaviInfoUpdate(NaviInfo naviInfo) {
    
    
			}
			@Override
			public void onAdjustFailure() {
    
    
			}
			@Override
			public void onAarrivedDestination() {
    
    
				//到达目的地,关闭导航状态
				m_naviState = NAVI_STATE.STATE_NULL;
				m_navigation3D.cleanPath();
				System.out.println("导航到达目的地");
			}
		});
	}
});

2.2 Add navigation points

//设置起点:可以连续设置,保留最后一次设置的值
m_navigation3D.setStartPoint(pt3d.getX(), pt3d.getY(), pt3d.getZ());

//设置终点:可以连续设置,保留最后一次设置的值
m_navigation3D.setDestinationPoint(pt3d.getX(), pt3d.getY(), pt3d.getZ());

//设置途径点:可以连续设置,途径点个数不限制 注意:没有起点和终点时不能添加途径点
m_navigation3D.addWayPoint(pt3d.getX(), pt3d.getY(), pt3d.getZ());

2.3 Path analysis

//路径分析
boolean bResult = m_navigation3D.routeAnalyst();
if(bResult){
    
    
	Toast.makeText(m_sceneControl.getContext(), "路径分析成功", Toast.LENGTH_SHORT).show();
}
else{
    
    
	Toast.makeText(m_sceneControl.getContext(), "路径分析失败", Toast.LENGTH_SHORT).show();
	return;
}


2.4 Navigation

//开始导航  0:真实导航, 1:模拟导航 ,2:巡航 ,3:步行导航
if(!m_navigation3D.startGuide(1)){
    
    
	Toast.makeText(m_sceneControl.getContext(), "导航启动失败", Toast.LENGTH_SHORT).show();
	return;
}


The above is the entire process of 3D indoor navigation data production and code writing.

Guess you like

Origin blog.csdn.net/supermapsupport/article/details/135266310