fctom1215
2020-08-29 7acf3eaf4ce196136328b0a20dfb754b60958cd3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
package safeluck.drive.evaluation.fragment;
 
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
 
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
 
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
 
import com.anyun.basecommonlib.MyLog;
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
import com.esri.arcgisruntime.arcgisservices.ArcGISMapServiceInfo;
import com.esri.arcgisruntime.concurrent.ListenableFuture;
import com.esri.arcgisruntime.data.ServiceFeatureTable;
import com.esri.arcgisruntime.geometry.Point;
import com.esri.arcgisruntime.geometry.PointCollection;
import com.esri.arcgisruntime.geometry.Polygon;
import com.esri.arcgisruntime.geometry.Polyline;
import com.esri.arcgisruntime.geometry.SpatialReference;
import com.esri.arcgisruntime.geometry.SpatialReferences;
import com.esri.arcgisruntime.layers.ArcGISMapImageLayer;
import com.esri.arcgisruntime.layers.ArcGISMapImageSublayer;
import com.esri.arcgisruntime.layers.ArcGISSublayer;
import com.esri.arcgisruntime.layers.ArcGISTiledLayer;
import com.esri.arcgisruntime.layers.ArcGISVectorTiledLayer;
import com.esri.arcgisruntime.layers.FeatureLayer;
import com.esri.arcgisruntime.layers.MobileBasemapLayer;
import com.esri.arcgisruntime.layers.SublayerList;
import com.esri.arcgisruntime.loadable.LoadStatus;
import com.esri.arcgisruntime.loadable.LoadStatusChangedEvent;
import com.esri.arcgisruntime.loadable.LoadStatusChangedListener;
import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.Viewpoint;
import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener;
import com.esri.arcgisruntime.mapping.view.Graphic;
import com.esri.arcgisruntime.mapping.view.GraphicsOverlay;
import com.esri.arcgisruntime.mapping.view.MapView;
import com.esri.arcgisruntime.portal.Portal;
import com.esri.arcgisruntime.portal.PortalItem;
import com.esri.arcgisruntime.symbology.LineSymbol;
import com.esri.arcgisruntime.symbology.SimpleFillSymbol;
import com.esri.arcgisruntime.symbology.SimpleLineSymbol;
import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol;
import com.esri.arcgisruntime.util.ListenableList;
import com.google.gson.Gson;
 
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
 
import me.yokeyword.fragmentation.SupportFragment;
import safeluck.drive.evaluation.Constant;
import safeluck.drive.evaluation.R;
import safeluck.drive.evaluation.app;
import safeluck.drive.evaluation.arcgis.MapSingleTapListener;
import safeluck.drive.evaluation.bean.ExamPlatformData;
import safeluck.drive.evaluation.bean.GisCarModel;
import safeluck.drive.evaluation.bean.RTKInfoBean;
import safeluck.drive.evaluation.cEventCenter.CEventCenter;
import safeluck.drive.evaluation.cEventCenter.ICEventListener;
import safeluck.drive.evaluation.util.CThreadPoolExecutor;
import safeluck.drive.evaluation.util.FileUtil;
import safeluck.drive.evaluation.util.Utils;
 
/**驾校信息UI
 * MyApplication2
 * Created by lzw on 2019/3/20. 11:22:39
 * 邮箱:632393724@qq.com
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */
public class JiaXiaoFragment extends SupportFragment {
 
    private static final String TAG = JiaXiaoFragment.class.getSimpleName();
 
    private LinkedBlockingQueue queue = new LinkedBlockingQueue(100);
    private ExecutorService consumer = Executors.newSingleThreadExecutor();
    private ExecutorService producer = Executors.newSingleThreadExecutor();
 
    private Gson gson = new Gson();
    private ICEventListener icEventListener = new ICEventListener() {
        @Override
        public void onCEvent(String topic, int msgCode, int resultCode, Object obj) {
 
 
 
 
                producer.execute(()->{
                    String json = (String)obj;
                    Log.i(TAG,String.format("当前线程号%d,json=%s",Thread.currentThread().getId(),json));
                    RTKInfoBean rtkInfoBean = gson.fromJson(json,RTKInfoBean.class);
                    queue.offer(rtkInfoBean);
                });
 
//                MyLog.i(TAG,"处理完11.时间="+Utils.formatTimeYYMMDDHHmmSSSSS(System.currentTimeMillis()));
 
 
        }
    };
 
    public static SupportFragment newInstance(){
        return new JiaXiaoFragment();
    }
 
 
    private MapView mMapView ;
    private static final int MSG_CAR = 100;
    double yaw = 0;
 
    GraphicsOverlay mGraphicsOverlay;
    private int count =0;
    private double startX = -8647.003,startY = 14590.7213;
    private Handler mHandler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case MSG_CAR:
                    count++;
                    yaw +=count;
                    addGraphicLayer(yaw,startX+count,startY+count);
                    sendEmptyMessageDelayed(MSG_CAR,1000);
                    break;
            }
        }
    };
 
    PointCollection mPointCollection = new PointCollection(SpatialReference.create(4544));
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 
 
        View view = inflater.inflate(R.layout.layout_arc_gis,container,false);
        mMapView = view.findViewById(R.id.mapView);
        Log.i(TAG,String.format("当前线程号%d,json=%s",Thread.currentThread().getId(),"onCreateView"));
//        setupMap();
//        addTrailheadsLayer();
 
addImageLayer();
//        addtiledLayer();
 
 
//        addGraphicLayer(0,startX,startY);
 
//        mHandler.sendEmptyMessageDelayed(MSG_CAR,1000);
 
//        consumer.execute(new CalRunnable());
        return view;
    }
 
 
 
 
 
    boolean flag = true;
    class CalRunnable implements Runnable{
 
        @Override
        public void run() {
            while (flag){
 
 
                RTKInfoBean rtkInfoBean = (RTKInfoBean) queue.poll();
                if (rtkInfoBean != null){
                    Log.i(TAG,String.format("取出一个,queue.size=%d,rtkinfo=%s",queue.size(),rtkInfoBean.toString()));
                    yaw = rtkInfoBean.getHeading();
                    startX = rtkInfoBean.getCoord_y();
                    startY = rtkInfoBean.getCoord_x();
                    addGraphicLayer(yaw,startX,startY);
                }else{
                    Log.i(TAG,String.format("取出一个为空,queue.size=%d",queue.size()));
                }
 
            }
 
        }
    }
 
 
 
 
 
 
    private SublayerList mSublayersList;
    private void setupMap() {
        if (mMapView != null) {
            ArcGISMap map = new ArcGISMap();
            mMapView.setMap(map);
 
            mGraphicsOverlay= new GraphicsOverlay();
            mMapView.getGraphicsOverlays().add(mGraphicsOverlay);
 
        }
    }
    private void addTrailheadsLayer() {
 
//一定不能少了最后的 /
 
//        String url = "http://192.168.0.47:6080/arcgis/rest/services/%E5%9C%9F%E4%B8%BB%E8%80%83%E5%9C%BA/MapServer/";
//        String url = "http://192.168.0.47:6080/arcgis/rest/services/%E7%A7%91%E4%B8%89%E5%9C%B0%E5%9B%BE/MapServer/";
        String url = "http://192.168.0.47:6080/arcgis/rest/services/%E7%A7%91%E4%BA%8C%E5%9C%B0%E5%9B%BE/MapServer/";
//        String url = "http://192.168.0.47:6080/arcgis/rest/services/test/MapServer/";
//        String url = "http://192.168.0.47:6080/arcgis/rest/services/Testmap_3/MapServer/";
        ArcGISMapImageLayer arcGISMapImageLayer = new ArcGISMapImageLayer(url);
        arcGISMapImageLayer.loadAsync();
        arcGISMapImageLayer.addLoadStatusChangedListener(loadStatusChangedEvent -> {
            if (loadStatusChangedEvent.getNewLoadStatus() == LoadStatus.LOADED){
                SublayerList tables = arcGISMapImageLayer.getSublayers();
 
                Log.i(TAG,"ServiceFeatureTables size = "+tables.size());
                for (int i = tables.size()-1; i >=0; i--) {
//                for (int i =0; i < tables.size(); i++) {
        ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(url+String.valueOf(i));
        FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable);
        ArcGISMap map = mMapView.getMap();
        map.getOperationalLayers().add(featureLayer);
    }
            }
        });
 
 
//旋转90度 逆时针
//        final ListenableFuture<Boolean> viewPointSetFuture = mMapView.setViewpointRotationAsync(90);
//        viewPointSetFuture.addDoneListener(() -> {
//            try{
//                boolean completed = viewPointSetFuture.get();
//                if (completed){
//                    Log.i(TAG,"Rotation completed successfully");
//                }
//            }catch (InterruptedException e){
//                Log.i(TAG,"Rotation Interrupted");
//            }catch (ExecutionException e){
//
//            }
//        });
 
 
        mMapView.setOnTouchListener(new MapSingleTapListener(getContext(),mMapView));
 
 
    }
 
    private void addGraphicLayer(double yaw,double x,double y){
 
        SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.rgb(232,0,0), 0.5f);
        SimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.argb(255,232,0,0), lineSymbol);
        PointCollection points = new PointCollection(SpatialReference.create(4544));
        String carFilePath = Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+_mActivity.getPackageName()+"/giscar.json";
        if (TextUtils.isEmpty(carFilePath)){
            Toast.makeText(_mActivity, "车辆模型文件不存在", Toast.LENGTH_SHORT).show();
            return;
        }
 
                byte[] fileContentBytes=FileUtil.readFile(carFilePath);
                String buffer= new String(fileContentBytes);
//                Log.i(TAG,"giscar="+buffer);
                GisCarModel gisCarModel= new Gson().fromJson(buffer,GisCarModel.class);
                List<safeluck.drive.evaluation.bean.Point> carNew=Utils.getCarPoint(0,yaw,new safeluck.drive.evaluation.bean.Point(x,y));
                List<Integer> bodys =gisCarModel.getBody();
                for (int i = 0; i <bodys.size(); i++) {
//                    Log.i(TAG,String.format("车身点位置:%d",bodys.get(i)));
//                    Log.i(TAG,"新坐标"+carNew.get(bodys.get(i)).getX()+" Y="+carNew.get(bodys.get(i)).getY());
                    points.add(carNew.get(bodys.get(i)).getX(),carNew.get(bodys.get(i)).getY());
                }
 
                CThreadPoolExecutor.runOnMainThread(new Runnable() {
                    @Override
                    public void run() {
                        Polygon polygon = new Polygon(points);
 
                        Graphic graphic = new Graphic(polygon,simpleFillSymbol);
                        mGraphicsOverlay.getGraphics().clear();
                        mGraphicsOverlay.getGraphics().add(graphic);
 
                        drawrightCenterGls(gisCarModel,carNew);
 
                        drawPoint(new Point(x,y));
 
                        if (mMapView != null){
                            mMapView.setViewpointCenterAsync(new Point(x,y));
                        }
                    }
                });
 
 
 
 
 
    }
 
    private void drawPoint(Point point) {
        SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.WHITE, 5);
 
        Graphic graphic = new Graphic(point, simpleMarkerSymbol);
        mGraphicsOverlay.getGraphics().add(graphic);
    }
    SimpleLineSymbol lineSymbolGls = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLACK, 0.5f);
 
    SimpleFillSymbol simpleFillSymbolGls = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.argb(255,0,0,0), lineSymbolGls);
    PointCollection points = new PointCollection(SpatialReference.create(4544));
 
    private void drawrightCenterGls(GisCarModel gisCarModel, List<safeluck.drive.evaluation.bean.Point> carNew) {
 
 
        drawGlses(carNew, simpleFillSymbolGls, points, gisCarModel.getRight_center_glass());
        drawGlses(carNew, simpleFillSymbolGls, points, gisCarModel.getLeft_center_glass());
 
        List<Integer> frontCLs = new ArrayList<>();
        frontCLs.addAll(gisCarModel.getLeft_front_glass());
        frontCLs.addAll(gisCarModel.getRight_front_glass());
        drawGlses(carNew, simpleFillSymbolGls, points, frontCLs);
 
        frontCLs.clear();
        frontCLs.addAll(gisCarModel.getLeft_rear_glass());
        frontCLs.addAll(gisCarModel.getRight_rear_glass());
        drawGlses(carNew, simpleFillSymbolGls, points, frontCLs);
 
 
    }
 
    private void drawGlses(List<safeluck.drive.evaluation.bean.Point> carNew, SimpleFillSymbol simpleFillSymbol, PointCollection points, List<Integer> left_center_glass) {
        List<Integer> leftCenterGls = left_center_glass;
        points.clear();
        for (int i = 0; i < leftCenterGls.size(); i++) {
            int pos = leftCenterGls.get(i);
            points.add(carNew.get(pos).getX(), carNew.get(pos).getY());
 
        }
 
        Polygon polygon1 = new Polygon(points);
        Graphic graphic1 = new Graphic(polygon1, simpleFillSymbol);
        mGraphicsOverlay.getGraphics().add(graphic1);
    }
 
    /**
     * 绘制面
     */
    private void drawPolygon() {
//        List<Point> points = new ArrayList<>();
//        points.add(new Point(21.21,21.32, SpatialReference.create("4544")));
//        PointCollection pointCollection = new PointCollection(points);
 
        mMapView.setOnTouchListener(new DefaultMapViewOnTouchListener(_mActivity, mMapView) {
            @Override
            public boolean onSingleTapConfirmed(MotionEvent e) {
 
                mGraphicsOverlay.getGraphics().clear();
                Point point = mMapView.screenToLocation(new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())));
                mPointCollection.add(point);
 
                Polygon polygon = new Polygon(mPointCollection);
 
                if (mPointCollection.size() == 1) {
                    SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10);
                    Graphic pointGraphic = new Graphic(point, simpleMarkerSymbol);
                    mGraphicsOverlay.getGraphics().add(pointGraphic);
                }
 
                SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.GREEN, 3.0f);
                SimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.parseColor("#33e97676"), lineSymbol);
                Graphic graphic = new Graphic(polygon, simpleFillSymbol);
                mGraphicsOverlay.getGraphics().add(graphic);
 
                return super.onSingleTapConfirmed(e);
            }
        });
    }
 
    /**
     * 绘制点
     */
    private void drawPoint() {
        mMapView.setOnTouchListener(new DefaultMapViewOnTouchListener(_mActivity, mMapView) {
            @Override
            public boolean onSingleTapConfirmed(MotionEvent e) {
                Point clickPoint = mMapView.screenToLocation(new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())));
                SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 20);
                Graphic graphic = new Graphic(clickPoint, simpleMarkerSymbol);
                //清除上一个点
                mGraphicsOverlay.getGraphics().clear();
                mGraphicsOverlay.getGraphics().add(graphic);
 
                //使用渲染器
                //                Graphic graphic1 = new Graphic(clickPoint);
                //                SimpleRenderer simpleRenderer = new SimpleRenderer(simpleMarkerSymbol);
                //                mGraphicsOverlay.setRenderer(simpleRenderer);
                //                mGraphicsOverlay.getGraphics().clear();
                //                mGraphicsOverlay.getGraphics().add(graphic1);
 
                return super.onSingleTapConfirmed(e);
            }
        });
    }
 
    /**
     * 绘制线
     */
    private void drawPolyline() {
        mMapView.setOnTouchListener(new DefaultMapViewOnTouchListener(_mActivity, mMapView) {
            @Override
            public boolean onSingleTapConfirmed(MotionEvent e) {
                Point point = mMapView.screenToLocation(new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY())));
                mPointCollection.add(point);
 
                Polyline polyline = new Polyline(mPointCollection);
 
                //点
                SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10);
                Graphic pointGraphic = new Graphic(point, simpleMarkerSymbol);
                mGraphicsOverlay.getGraphics().add(pointGraphic);
 
                //线
                SimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.parseColor("#FC8145"), 3);
                Graphic graphic = new Graphic(polyline, simpleLineSymbol);
                mGraphicsOverlay.getGraphics().add(graphic);
 
                return super.onSingleTapConfirmed(e);
            }
        });
    }
 
private void addImageLayer(){
            String url = "http://192.168.0.47:6080/arcgis/rest/services/%E5%9C%9F%E4%B8%BB%E8%80%83%E5%9C%BA/MobileServer/";
    // create a MapImageLayer with dynamically generated map images
    final ArcGISMapImageLayer mapImageLayer = new ArcGISMapImageLayer(url);
//    mapImageLayer.loadAsync();
    // Add a listener that is invoked when layer loading has completed.
    mapImageLayer.addDoneLoadingListener(() -> {
        if (mapImageLayer.getLoadStatus() == LoadStatus.LOADED) {
            ArcGISMapServiceInfo mapServiceInfo = mapImageLayer.getMapServiceInfo();
 
            Log.i(TAG, "addImageLayer: 加载完成。。。");
 
            // work with map service info here
        }
    });
    // create an empty map instance
    ArcGISMap map = new ArcGISMap();
    // add map image layer as operational layer
    map.getOperationalLayers().add(mapImageLayer);
    // set the map to be displayed in this view
    mMapView.setMap(map);
}
 
private void addtiledLayer(){
//    String url = "http://192.168.0.47:6080/arcgis/rest/services/%E5%9C%9F%E4%B8%BB%E8%80%83%E5%9C%BA/MapServer";
    String url = "http://192.168.0.47:6080/arcgis/rest/services/%E7%A7%91%E4%BA%8C%E5%9C%B0%E5%9B%BE/MapServer";
    // create a MapImageLayer with dynamically generated map images
    final ArcGISTiledLayer arcGISTiledLayer = new ArcGISTiledLayer(url);
    // Add a listener that is invoked when layer loading has completed.
    arcGISTiledLayer.addDoneLoadingListener(() -> {
        if (arcGISTiledLayer.getLoadStatus() == LoadStatus.LOADED) {
            // work with map service info here
            Log.i(TAG,"ArcGISTiledLayer加载完成");
        }
    });
    Basemap basemap = new Basemap(arcGISTiledLayer);
    // create a map with the basemap
    ArcGISMap arcGISMap = new ArcGISMap(basemap);
    // set the map to be displayed in this view
    mMapView.setMap(arcGISMap);
 
}
private void addVectorTiledLayer(){
    String url = "http://192.168.0.47:6080/arcgis/rest/services/%E5%9C%9F%E4%B8%BB%E8%80%83%E5%9C%BA/MapServer";
    // create a MapImageLayer with dynamically generated map images
    final ArcGISVectorTiledLayer mVectorTiledLayer = new ArcGISVectorTiledLayer(url);
    // Add a listener that is invoked when layer loading has completed.
    mVectorTiledLayer.addDoneLoadingListener(() -> {
        if (mVectorTiledLayer.getLoadStatus() == LoadStatus.LOADED) {
            // work with map service info here
            Log.i(TAG,"ArcGISTiledLayer加载完成");
        }
    });
    Basemap basemap = new Basemap(mVectorTiledLayer);
    // create a map with the basemap
    ArcGISMap arcGISMap = new ArcGISMap(basemap);
 
    Viewpoint vp = new Viewpoint(47.606726, -122.335564, 72223.819286);
    arcGISMap.setInitialViewpoint(vp);
 
    // set the map to be displayed in this view
    mMapView.setMap(arcGISMap);
 
}
 
    @Override
    public void onPause() {
        if (mMapView != null) {
            mMapView.pause();
        }
        super.onPause();
    }
 
    @Override
    public void onResume() {
        super.onResume();
        if (mMapView != null) {
            mMapView.resume();
        }
    }
 
    @Override
    public void onDetach() {
        if (mMapView != null) {
            mMapView.dispose();
        }
//        CEventCenter.onBindEvent(false,icEventListener, Constant.BIND_RTK_INFO_MAP);
        producer.shutdown();
        consumer .shutdown();
        super.onDetach();
    }
 
    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
//        CEventCenter.onBindEvent(true,icEventListener,Constant.BIND_RTK_INFO_MAP);
    }
}