首页 / 浏览问题 / 移动GIS / 问题详情
使用imobile9.10,不能打开地图。
5EXP 2019年03月26日

按照帮助文档->开发指南->android studio->开发二维移动GIS程序,编写第一个程序。安装到手机以后,程序打开,地图不显示。
核心代码如下:
 

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        String rootPath = android.os.Environment.getExternalStorageDirectory().getAbsolutePath();
        Environment.setTemporaryPath(rootPath + "/SuperMap/temp");
        Environment.setLicensePath(rootPath + "/SuperMap/license");
        Environment.setWebCacheDirectory(rootPath + "/SuperMap/webCache");
        Environment.setFontsPath(rootPath + "/SuperMap/fonts");
        Environment.initialization(this);

        setContentView(R.layout.activity_main);

        Workspace mWorkspace = new Workspace();
        WorkspaceConnectionInfo info = new WorkspaceConnectionInfo();
        info.setServer(rootPath + "/SuperMap/GeometryInfo/World.smwu");
        info.setType(WorkspaceType.SMWU);
        mWorkspace.open(info);

        MapView mapView = findViewById(R.id.Map_view);
        mapControl = mapView.getMapControl();
        mapControl.getMap().setWorkspace(mWorkspace);

        String mapName = mWorkspace.getMaps().get(1);
        mapControl.getMap().open(mapName);
        ZoomControls mZoom = findViewById(R.id.zoomControl);
        mZoom.setIsZoomInEnabled(true);
        mZoom.setIsZoomOutEnabled(true);

        mZoom.setOnZoomInClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mapControl.getMap().zoom(2);
                mapControl.getMap().refresh();
            }
        });

        mZoom.setOnZoomOutClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mapControl.getMap().zoom(0.5);
                mapControl.getMap().refresh();
            }
        });

        mapControl.getMap().refresh();
        setContentView(R.layout.activity_main);
    }

配置如下:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="net.mlike.survey">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /><!--这条好像有问题,没有权限-->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"
                    android:configChanges="keyboardHidden|orientation|screenSize"/>

                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        tools:ignore="ManifestOrder"/>
</manifest>

日志如下:

2019-03-26 11:43:20|      2| EGf001| 4147057972|   error| 查找Graphics类型为9的UGGraphicsManager失败| jni/Builds/32_arm_android_U/Graphics/../../../Src/Graphics/UGGraphicsManager.cpp(282)
2019-03-26 11:43:20|      1| EAg031| 4147057972|   error| 查找Graphics类型为9的UGGraphicsManager失败| jni/Builds/32_arm_android_U/Graphics/../../../Src/Graphics/UGGraphicsManager.cpp(90)
2019-03-26 11:43:21|    449| EFd063| 4147057972| warning| 调整比例系数失败| jni/Builds/32_arm_android_U/Drawing/../../../Src/Drawing/UGDrawParamaters.cpp(2058)
2019-03-26 11:43:21|      0| EFd063| 4147057972| warning| 调整比例系数失败| jni/Builds/32_arm_android_U/Drawing/../../../Src/Drawing/UGDrawParamaters.cpp(2059)
2019-03-26 11:43:21|      0| EGg018| 4147057972| warning| 已经是全幅显示| jni/Builds/32_arm_android_U/Drawing/../../../Src/Drawing/UGDrawParamaters.cpp(1494)
2019-03-26 11:43:21|      0| EFd063| 4147057972| warning| 调整比例系数失败| jni/Builds/32_arm_android_U/Drawing/../../../Src/Drawing/UGDrawParamaters.cpp(2058)
2019-03-26 11:43:21|      0| EFd063| 4147057972| warning| 调整比例系数失败| jni/Builds/32_arm_android_U/Drawing/../../../Src/Drawing/UGDrawParamaters.cpp(2059)
2019-03-26 11:43:21|      0| EGg018| 4147057972| warning| 已经是全幅显示| 

1个回答

你好,你地图刷新后又多了一句初始化layout??删掉重现运行
9,242EXP 2019年03月26日
谢谢,问题已经解决
...