iMobile provides the function of creating various geometric objects on the map, including: point object, line object, face object, and graffiti. The collection of various geometric objects is carried out in the state that the layer can be edited. iMobile does not support multiple layers to edit. If multiple layers can be edited at the same time, when collecting points, lines, surfaces or graffiti objects, only the objects are collected for the last set layer.
Hand-painted collection
The jar packages required for hand-painted collection are com.supermap.data.jar, com.supermap.mapping.jar, and the required so libraries are libimb2d.so, libgnustl_shared.so, libQt5Core.so, libQt5Gui.so, libQt5Svg.so, libQt5Widgets.so.
The key categories and methods are as follows:
Class | Method |
---|---|
MapControl | setAction()、redo()、undo()、submit() |
Layer | setVisible()、setEditable() |
Action | CREATEPOINT、CREATEPOLYLINE、DRAWLINE、CREATEPOLYGON、DRAWPLOYGON、FREEDRAW |
Point object collection
In GIS applications, common point objects describe some point-like objects, such as elevation control points, mines, caves, etc.
Action "CREATEPOINT" of point objects supports drawing point objects in the currently editable point layer or CAD layer.
Figure: Point object collection |
Implementation steps:
Step 1: Set up before drawing
// Set that the layer can be displayed, true, mean that the layer can be displayed, false, mean that the layer is not displayed.
layer. setVisible (true);
// Set the layer editable, true, indicating that the vector layer is editable, andfalse, indicating that the vector layer is not editable.
layer.setEditable(true);
// Set the object operation type to the click-based drawing point object
mapControl.setAction(Action.CREATEPOINT);
Step 2: Interactive drawing points on the device
Click the drawing point object with a single finger on the mobile device.
Step 3: Submit the drawing
mapControl.submit();
Line object collection
In GIS applications, common line objects describe some strips, such as roads, railways, pipelines, wires, etc.
(1) Click-to-click drawing
Action "CREATEPOLYLINE" supports drawing line objects in the current editable line layer or CAD layer.
Figure: Click-to-click drawing line |
Implementation steps:
Step 1: Settings before drawing
// Set the layer to be displayed, true, which means that the layer can be displayed, false, indicating that the layer is not displayed.
Layer. setVisible (true);
// Set the layer to be editable, true, means that the vector layer is editable, false, indicating that the vector layer is not editable.
layer.setEditable(true);
// Set the object operation type as a click-based drawing line object
mapControl.setAction(Action.CREATEPOLYLINE);
Step 2: Interactive drawing lines on the device
Click your finger on the mobile device to draw the line node.
Step 3: Submit Drawing
mapControl.submit();
(2) Freestyle drawing
Action "DRAWLINE" of free-drawing lines supports the drawing of free-line objects in the current editable line layer or CAD layer.
Figure: Freestyle drawing |
Implementation steps:
Step 1: Settings before drawing
// Set the layer to display, true, means that the layer can be displayed, false, means that the layer is not displayed.
Layer. setVisible (true);
// Set the layer to be editable, true, indicating that the vector layer is editable, false, indicating that the vector layer is not editable.
layer.setEditable(true);
//Set the object operation type as a free drawing line object
mapControl.setAction(Action.DRAWLINE)
Step 2: Interactively draw free lines on the device
Touch the screen with your finger, move your finger to draw the free line, and lift your finger to complete the drawing of the free line.
Step 3: Submit Drawing
mapControl.submit();
Face object collection
GIS application, commonly used surface objects describe some blocks, such as administrative regions, soil, vegetation, lakes, etc., and can also represent some special types of surface objects geographically, such as islands, rings, enclaves, etc.
(1) Click-to-drawing
Click Action "CREATEPOLYGON" on the painted face to support the drawing of face objects in the current editable surface layer or CAD layer.
Figure: Click-to-click drawing surface |
Implementation steps:
Step 1: Set up before drawing
//set that the layer can be displayed, true, which means that the layer can be displayed, and false means that the layer is not displayed.
Layer. setVisible (true);
// Set the layer to edit, true, to indicate that the vector layer is editable, false, to indicate that the vector layer is not editable.
layer.setEditable(true);
// Set the object operation type to click-drawing polygon objects
mapControl.setAction(Action.CREATEPOLYGON);
Step 2: Interactive drawing on the device
Finger click on the mobile device in turn to draw the surface node.
Step 3: Submit Drawing
mapControl.submit();
(2) Freestyle drawing
Action "DRAWPLOYGON" of free-painted face supports the drawing of free-face objects in the current editable surface layer or CAD layer.
Figure: Freestyle drawing surface |
Implementation steps:
Step 1: Set up before drawing
//Set the layer to display, true, indicating that the layer can be displayed, andfalse, indicating that the layer is not displayed.
Layer. setVisible (true);
//Set the layer editable, true, indicating that the vector layer is editable, andfalse, indicating that the vector layer is not editable.
layer.setEditable(true);
//Set the object operation type to freely draw surface objects
mapControl.setAction(Action.DRAWPLOYGON)
Step 2: Interactively draw a free surface on the device
Touch the screen with your finger, move your finger to draw the free surface, and lift your finger to complete the drawing of the free surface.
Step 3: Submit drawings
mapControl.submit();
Graffiti
Action "FREEDRAW" for gritry supports graffiry operations in the currently editable CAD layer to create a graffili object.
Figure: Graffiti |
Implementation steps:
Step 1: Settings before drawing
// Set the layer to display, true, means that the layer can be displayed, false, means that the layer is not displayed.
Layer. setVisible (true);
// Set the layer to be editable, true, indicating that the vector layer is editable, false, indicating that the vector layer is not editable.
layer.setEditable(true);
// Set the object operation type as a graffiti object
mapControl.setAction(Action.FREEDRAW)
Step 2: Interactive graffiti on the device
Touch the screen with your finger and move your finger to draw. Graffiti does not limit the position and number of graffiti. Before submission and drawing, it is regarded as a graffiti object.
Step 3: Submit Drawing
mapControl.submit();
For the above hand-painted collection operation, please refer to the sample code MapEdit.
GPS acquisition
iMobile supports GPS collection and realizes attribute collection. The required class libraries include com.supermap.data.jar, com.supermap.mapping.jar, and so libraries include libimb2d.so, libgnustl_shared.so, libQt5Core.so, libQt5Gui.so, libQt5Svg.so, libQt5Widgets.so.
The key categories and methods are as follows:
Class | Method |
---|---|
Collector | setDataset()、openGPS()、createElement()、setStyle()、setSingleTapEnable()、routeAnalyst()、startGuide()、addNaviInfoListene()、cleanPath() |
//Fetch Data Capture Module
Collector = mMapControl.getCollector();
// Store the data set of the collected object, which can be the point-line CAD type.
Dataset dataset = mMapControl.getMap().getLayers().get(0).getDataset();
collector.setDataset(dataset); // Set the data set for storing captured data
collector.openGPS(); // Turn on GPS
collector.createElement(GPSElementType.LINE);//Create a specified type of collection object
// Style
GeoStyle geoStyle = new GeoStyle();
com.supermap.data.Color color = new com.supermap.data.Color(110, 208, 254);
// Line color
geoStyle.setLineColor(color);
// Set the drawing style
collector.setStyle(geoStyle);
// Open the single-finger dot
collector.setSingleTapEnable(true);
For the above GPS collection, please refer to the sample code Collector.
Trajectory capture
iMobile provides trajectory collection capabilities, automatically removes abnormal position coordinates, and supports background operation. The necessary class libraries for trajectory acquisition include com.supermap.data.jar, com.supermap.mapping.jar, com.supermap.navigation.jar, com.supermap.track.jar, and the so library includes libimb2d.so. If you want to use Tencent location, you also need to add TencentLocationSdk_v7.1.7.jar and libtencentloc.so.
The key categories and methods are as follows:
Class | Method |
---|---|
Track | createDataset()、setDataset()、setMatchDatasets()、setDistanceInternal()、setTimeInternal()、startTrack()、stopTrack() |
Step 1: Set trajectory capture parameters
Track m_Track = new Track(this);
m_Track.setCustomLocation(true); // Set the user's incoming GPS data
m_Track.setDistanceInterval(3); // Set the distance interval to 3 meters
m_Track.setTimeInterval(25); // Set the time interval to 25s
m_Track.setMatchDatasets(m_Map.getWorkspace().getDatasources().get("road").getDatasets()); // Set the dataset where the matching path is located
DatasetVector dataset = m_Track.createDataset(m_Datasource, datasetName); //Create a dataset
m_Track.setDataset(dataset); // Set the point data set to record the trajectory
Step 2: Start logging the trajectory and set the location data
m_Track.startTrack(); //Start record the trajectory
if(m_Track! = null){ // Set GPS data for trajectory recording
mPoint = new Point2D(gpsData.dLongitude, gpsData.dLatitude);
gpsData.dLongitude = mPoint.getX();
gpsData.dLatitude = mPoint.getY();
m_Track.setGPSData(gpsData); // Set GPS data. When settingCustomLocation(true), the data set is valid.
Count++;
}
If(50 == count){
m_Map.refresh();
Count = 0;
}
Step 3: Results Logging Trajectory
m_Track.stopTrack(); // Stop logging the trajectory
For the above trajectory collection, please refer to the sample code Track.