日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

基于SuperMap的iMobile 3D总结(二)

發布時間:2024/1/18 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 基于SuperMap的iMobile 3D总结(二) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

關鍵代碼:

一、繞點環視

地圖選擇點:

sceneControl.addTrackingListener(mTracking3dListener); sceneControl.setAction(Action3D.CREATEPOINT3D); //set screen click,get the x/y of the point

?

GeoPoint3D geometry = new GeoPoint3D(x, y, z); sceneControl.getScene().flyCircle(geometry, 10);

?取兩位小數:

double bx = new BigDecimal(x).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();double by = new BigDecimal(y).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();double bz = new BigDecimal(z).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();

設置點樣式:

private String iconPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "icon_compass.png"; Point3D point3d = new Point3D(event.getX(), event.getY(), event.getZ());geoPoint3D = new GeoPoint3D(point3d);GeoStyle3D geoStyle3D = new GeoStyle3D();geoStyle3D.setMarkerScale(2);geoStyle3D.setMarkerFile(iconPath);geoStyle3D.setMarkerColor(new Color(255, 0, 0));geoStyle3D.setAltitudeMode(AltitudeMode.ABSOLUTE);geoPoint3D.setStyle3D(geoStyle3D);sceneControl.getScene().getTrackingLayer().add(geoPoint3D, "point");

?

二、飛行管理

繪制飛行路線:

sceneControl.setAction(Action3D.PANSELECT3D);private Tracking3DListener mTracking3dListener = new Tracking3DListener() {@Overridepublic void tracking(Tracking3DEvent event) {initAnalySis(sceneControl, event);}};private void initAnalySis(SceneControl sceneControl, Tracking3DEvent event) {// 加點Point3D point3d = new Point3D(event.getX(), event.getY(), event.getZ());GeoPoint3D geoPoint3D = new GeoPoint3D(point3d);GeoStyle3D geoStyle3D = new GeoStyle3D();geoStyle3D.setMarkerScale(2);geoStyle3D.setMarkerColor(new Color(255, 0, 0));geoStyle3D.setAltitudeMode(AltitudeMode.ABSOLUTE);geoStyle3D.setMarkerFile(iconPath);geoPoint3D.setStyle3D(geoStyle3D);point3DList.add(point3d); // the list of fly line point add a point3d // sceneControl.getScene().getTrackingLayer().add(geoPoint3D, "point"); // point3dArr[numPoint] = point3d;point3Ds.add(point3d);geoStyle3D.setLineColor(new Color(255, 100, 0));geoStyle3D.setLineWidth(5);geoStyle3D.setLineSymbolID(3);geoLine3D.setStyle3D(geoStyle3D);if (numPoint > 2) {geoLine3D.addPart(point3Ds);sceneControl.getScene().getTrackingLayer().add(geoLine3D, "line");}numPoint = numPoint + 1;}

飛行:

flyManager.getRoutes().clear();Route route = new Route();GeoLine3D geoLine3D = new GeoLine3D();Point3Ds point3Ds = new Point3Ds();for (int x = 0; x < point3DList.size(); x++) {Point3D point3D = new Point3D();point3D.setX(point3DList.get(x).getX());point3D.setY(point3DList.get(x).getY());point3D.setZ(point3DList.get(x).getZ() + 10);point3Ds.add(point3D);}if (point3Ds.getCount() > 2) {geoLine3D.addPart(point3Ds);route.setFlyAlongTheRoute(true);route.setSpeed(8);route.setTiltFixed(false);route.setHeadingFixed(true);route.fromGeoLine3D(geoLine3D);flyManager.getRoutes().add(route);flyManager.play();} else {ToastUtils.showLongToast(getContext(), "請點選多于2個點");}}

場景出圖:

Bitmap bitmap = sceneControl.getScene().outputSceneToBitmap();saveBitmap(bitmap, "image01");/*** 保存方法*/@RequiresApi(api = Build.VERSION_CODES.N)public int saveBitmap(Bitmap bmp, String picName) {//生成路徑String root = Environment.getExternalStorageDirectory().getAbsolutePath() + "/SuperMap/";String dirName = "bitmap";File appDir = new File(root, dirName);if (!appDir.exists()) {appDir.mkdirs();}//文件名為時間long timeStamp = System.currentTimeMillis();SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");String sd = sdf.format(new Date(timeStamp));String fileName = sd + ".jpg";//獲取文件File file = new File(appDir, fileName);FileOutputStream fos = null;try {fos = new FileOutputStream(file);bmp.compress(Bitmap.CompressFormat.JPEG, 100, fos);fos.flush();//通知系統相冊刷新getActivity().sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,Uri.fromFile(new File(file.getPath()))));ToastUtils.showLongToast(getContext(), "出圖成功,請查看" + "/SuperMap/bitmap/" + fileName + "文件");bitmap = bmp;ivBitmap.setVisibility(View.VISIBLE);ivBitmap.setImageBitmap(bmp);return 2;} catch (FileNotFoundException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();} finally {try {if (fos != null) {fos.close();}} catch (IOException e) {e.printStackTrace();}}ToastUtils.showLongToast(getContext(), "出圖成功,請查看" + "/SuperMap/bitmap/" + fileName + "文件");bitmap = bmp;ivBitmap.setVisibility(View.VISIBLE);ivBitmap.setImageBitmap(bmp);return -1;}

?

總結

以上是生活随笔為你收集整理的基于SuperMap的iMobile 3D总结(二)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。