| | |
| | | import com.esri.arcgisruntime.geometry.SpatialReference; |
| | | import com.esri.arcgisruntime.layers.ArcGISMapImageLayer; |
| | | import com.esri.arcgisruntime.layers.ArcGISTiledLayer; |
| | | import com.esri.arcgisruntime.loadable.LoadStatus; |
| | | import com.esri.arcgisruntime.mapping.ArcGISMap; |
| | | import com.esri.arcgisruntime.mapping.MobileMapPackage; |
| | | 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.MapScaleChangedEvent; |
| | | import com.esri.arcgisruntime.mapping.view.MapScaleChangedListener; |
| | | import com.esri.arcgisruntime.mapping.view.MapView; |
| | | import com.esri.arcgisruntime.symbology.SimpleFillSymbol; |
| | | import com.esri.arcgisruntime.symbology.SimpleLineSymbol; |
| | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.io.File; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | ExamStatus examStatus = (ExamStatus)obj; |
| | | if (examStatus.getMap_id()>-1){ |
| | | if (examStatus.getEnter()==ENTER){ |
| | | MyLog.i(TAG,String.format("进入[%d] map",examStatus.getMap_id())); |
| | | double scale = mMapView.getMapScale(); |
| | | mMapView.setViewpointScaleAsync(scale * 0.2*0.2); |
| | | MyLog.i(TAG,String.format("进入[%d] map,scale=%f",examStatus.getMap_id(),scale)); |
| | | mMapView.setViewpointScaleAsync(scale * 0.2); |
| | | |
| | | |
| | | |
| | | }else{ |
| | | MyLog.i(TAG,String.format("退出[%d] map",examStatus.getMap_id())); |
| | | double scale = mMapView.getMapScale(); |
| | | mMapView.setViewpointScaleAsync(scale * 5*5); |
| | | MyLog.i(TAG,String.format("退出[%d] map,scale=%f",examStatus.getMap_id(),scale)); |
| | | |
| | | mMapView.setViewpointScaleAsync(scale * 5); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | View view = inflater.inflate(R.layout.layout_arc_gis,container,false); |
| | | mMapView = view.findViewById(R.id.mapView); |
| | | mMapView.addMapScaleChangedListener(new MapScaleChangedListener() { |
| | | @Override |
| | | public void mapScaleChanged(MapScaleChangedEvent mapScaleChangedEvent) { |
| | | Log.i(TAG,"mapscaleChangelistenre"); |
| | | } |
| | | }); |
| | | view.findViewById(R.id.btn_change_map).setOnClickListener(this); |
| | | mSurfaceView = view.findViewById(R.id.surfaceview_arcgis); |
| | | |
| | |
| | | |
| | | |
| | | addTrailheadsLayer(); |
| | | // url = Environment.getExternalStorageDirectory().getAbsolutePath()+ File.separator+_mActivity.getPackageName()+"/shoufei0220.mmpk"; |
| | | // Log.i(TAG,"url ========="+url); |
| | | // final MobileMapPackage mobileMapPackage = new MobileMapPackage(url); |
| | | // mobileMapPackage.loadAsync(); |
| | | // mobileMapPackage.addDoneLoadingListener(()->{ |
| | | // LoadStatus loadStatus = mobileMapPackage.getLoadStatus(); |
| | | // if (loadStatus==LoadStatus.LOADED){ |
| | | // List<ArcGISMap> mainArcGisMapL = mobileMapPackage.getMaps(); |
| | | // ArcGISMap mainArcGismapMMPK = mainArcGisMapL.get(0); |
| | | // mMapView.setMap(mainArcGismapMMPK); |
| | | // } |
| | | // }); |
| | | return view; |
| | | } |
| | | |
| | |
| | | // create an empty map instance |
| | | ArcGISMap map = new ArcGISMap(); |
| | | Log.i(TAG,String.format("map.getMiniScale=%f",map.getMinScale())); |
| | | map.setMinScale(1000.0); |
| | | map.setMinScale(400.0); |
| | | // add map image layer as operational layer |
| | | map.getOperationalLayers().add(mapImageLayer); |
| | | mMapView.setMap(map); |
| | |
| | | } |
| | | private void readGisCar() { |
| | | |
| | | String carFilePath = Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+_mActivity.getPackageName()+"/lianfang_giscar.json"; |
| | | String carFilePath = Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+_mActivity.getPackageName()+"/gisvehiclemodel.json"; |
| | | if (TextUtils.isEmpty(carFilePath)){ |
| | | Toast.makeText(_mActivity, "车辆模型文件不存在", Toast.LENGTH_SHORT).show(); |
| | | MyLog.i (TAG, "GISCar车辆模型文件不存在"); |
| | | return ; |
| | | } |