首页 / 浏览问题 / 移动GIS / 问题详情
android SDK加载场景卡住
5EXP 2018年08月13日

这是点击加载场景后的图像,此时屏幕已经卡住。没有反应。。

使用产品:supermap-imobile-9.0.1-103-android-zip-chs 操作系统:小米5Splus android 7
 

另附上代码:

public class EarthActivity extends Activity {
    private SceneControl m_sceneControl;
    private Button opensceneBtn;
    private Button openlayerBtn;

    // 离线三维场景数据名称
    
    String url = "http://192.168.235.118:8090/iserver/services/3D-CBD/rest/realspace";

    // 三维场景名称
    
    String sceneName = "CBD";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //myPermission();
        requestAllPower();
        //获取设备存储根目录
        String rootPath = android.os.Environment.getExternalStorageDirectory().getAbsolutePath();
        //设置许可存放目录
        Environment.setLicensePath(rootPath + "/SuperMap/license");
        Environment.initialization(this);
        setContentView(R.layout.activity_earth);
        initView();
    }

    private void initView(){
        m_sceneControl = (SceneControl)findViewById(R.id.SceneControl);
        opensceneBtn = (Button)findViewById(R.id.btn_open1);
        //openlayerBtn = (Button)findViewById(R.id.btn_open2);

        opensceneBtn.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                openScene();
            }
        });
//      openlayerBtn.setOnClickListener(new View.OnClickListener() {
//
//            @Override
//            public void onClick(View v) {
//                // TODO Auto-generated method stub
//                openLayer();
//            }
//        });
    }

    public void requestAllPower() {
        if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.WRITE_EXTERNAL_STORAGE)
                != PackageManager.PERMISSION_GRANTED) {
            if (ActivityCompat.shouldShowRequestPermissionRationale(this,
                    Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
            } else {
                ActivityCompat.requestPermissions(this,
                        new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,
                                Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.READ_PHONE_STATE}, 1);
            }
        }
    }
    public void openScene(){
        if (m_sceneControl.getScene()!=null) {
            m_sceneControl.getScene().close();
        }
        m_sceneControl.getScene().open(url,sceneName);
         m_sceneControl.getScene();
      //  m_sceneControl.getScene().refresh();
//        SceneServicesList sceneServiceList = new SceneServicesList();
//        Boolean bLoad = sceneServiceList.load(url);
//        // 通过已知的场景名称打开场景
//        if(bLoad)
//        {
//            m_sceneControl.getScene().open(url,sceneName);
//        }
    }
}

1个回答

你好,服务地址写正确了吗?调试一下场景是否打开成功
9,127EXP 2018年08月13日
下边有代码,我觉得地址写对了。还有就是这个地址是iserver自带的,场景是可以打开的。
调试一下代码,看一下open是否为true

你看 是True

这是open true 的意思吗?

...