打开 smwu 类型的地图 工作空间在4-5MB左右
在UI线程打开,会直接卡死
在子线程打开,如果联网的话 可能会一分钟左右 ,不联网的话 也要几秒钟。
在打开过程中 关闭网络连接,就直接打开了,这是什么情况
正常打开地图的时间应该是多长时间
打开工作空间的代码
public void openWorkspace() { Observable.create(new Observable.OnSubscribe<Workspace>() { @Override public void call(Subscriber<? super Workspace> subscriber) { String path = CurUser.getInstance().getMapDataPath() + "/" + Constants.NAME.MAP_DATA_NAME; log("openWorkspace", "time->"+ StringUtil.parseDate(new Date(),"HH:mm:ss.SSS")); Workspace workspace = new Workspace(); WorkspaceConnectionInfo connectionInfo = new WorkspaceConnectionInfo(); connectionInfo.setType(WorkspaceType.SMWU); connectionInfo.setServer(path); connectionInfo.setPassword(Constants.CONF.WORK_SPACE_PASSWORD); boolean open = workspace.open(connectionInfo); log("openWorkspace", "open->"+open); if (open) { subscriber.onNext(workspace); }else{ subscriber.onError(new Exception("地图打开失败")); } } }).subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Subscriber<Workspace>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { e.printStackTrace(); if (null != view) { BMMapView activity = (BMMapView) view; activity.openFailed(); } } @Override public void onNext(Workspace workspace) { if (null != view) { log("openWorkspaceNext", "time->"+StringUtil.parseDate(new Date(),"HH:mm:ss.SSS")); BMMapView activity = (BMMapView) view; activity.openSuccess(workspace); } } }); }
下面是log出的时间
E/openWorkspace: time->16:03:00.742 E/openWorkspace: open->true E/openWorkspaceNext: time->16:03:50.686 E/openSuccess: time-->16:03:51.843