国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

three.js 3D可視化地圖

這篇具有很好參考價值的文章主要介紹了three.js 3D可視化地圖。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

threejs地圖文章來源地址http://www.zghlxwxcb.cn/news/detail-828336.html

可視化地圖——three.js實現(xiàn)
this.provinceInfo = document.getElementById('provinceInfo');
// 渲染器
this.renderer = new THREE.WebGLRenderer({
   antialias: true
});
this.renderer.setSize(window.innerWidth, window.innerHeight);
this.container.appendChild(this.renderer.domElement);

this.labelRenderer = new THREE.CSS3DRenderer(); //新建CSS3DRenderer
this.labelRenderer.setSize(window.innerWidth, window.innerHeight);
this.labelRenderer.domElement.style.position = 'absolute';
this.labelRenderer.domElement.style.top = 0;
document.body.appendChild(this.labelRenderer.domElement);

// 場景
this.scene = new THREE.Scene();
// 假設 scene 是一個 Scene 對象
const textureLoader = new THREE.TextureLoader();
this.scene.background = textureLoader.load("img/bg.png");
 
// 相機 透視相機
this.camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);
this.camera.position.set(this.orbitParams.pos.x, this.orbitParams.pos.y, this.orbitParams.pos.z);
this.camera.lookAt(this.orbitParams.target.x, this.orbitParams.target.y, this.orbitParams.target.z);

地圖數(shù)據(jù)的加載渲染

this.map = new THREE.Object3D();
this.map.add(cityPointGroup);
this.map.add(cityGroup);
this.map.add(flyGroup);

let _this = this;
_this.maptext = [];
const projection = d3.geoMercator().center([104.0, 37.5]).scale(80).translate([0, 0]);
let pintArr = [];
const textureLoader = new THREE.TextureLoader();
const material = new THREE.MeshPhongMaterial({
   color: '#03121b',
   transparent: true,
   normalScale: new THREE.Vector2( 0.150, 0.150 ),
   normalMap: textureLoader.load( 'img/OIP-C.jpg' ),
   opacity: 0.9
});

const material1 = new THREE.MeshBasicMaterial({
   color: '#15d0b1',
   transparent: true,
   // normalMap: textureLoader.load( 'img/earth_normal_2048.jpg' ),
   opacity: 0.7
});

chinaJson.features.forEach(elem => {
   // 定一個省份3D對象
   const province = new THREE.Object3D();
   // 每個的 坐標 數(shù)組
   const coordinates = elem.geometry.coordinates;
   // 循環(huán)坐標數(shù)組
   coordinates.forEach(multiPolygon => {

      multiPolygon.forEach(polygon => {
         const shape = new THREE.Shape();
         const lineMaterial = new THREE.LineBasicMaterial({
            color: '#15d0b1',
         });
         const lineGeometry = new THREE.Geometry();

         let boundingBox = {
            max: { x:undefined,y:undefined },
            min: { x:undefined,y:undefined }
         };

         for (let i = 0; i < polygon.length; i++) {
            const [x, y] = projection(polygon[i]);
            if (i === 0) {
               shape.moveTo(x, -y);
            }
            shape.lineTo(x, -y);
            lineGeometry.vertices.push(new THREE.Vector3(x, -y, 4.01));

            if(undefined==boundingBox.max.x) boundingBox.max.x = x;
            if(undefined==boundingBox.max.y) boundingBox.max.y = -y;
            if(undefined==boundingBox.min.x) boundingBox.min.x = x;
            if(undefined==boundingBox.min.y) boundingBox.min.y = -y;
            if(x > boundingBox.max.x) boundingBox.max.x = x;
            if(-y > boundingBox.max.y) boundingBox.max.y = -y;
            if(x < boundingBox.min.x) boundingBox.min.x = x;
            if(-y < boundingBox.min.y) boundingBox.min.y = -y;
         }

         let width = Math.abs( boundingBox.max.x - boundingBox.min.x );
         let height = Math.abs( boundingBox.max.y - boundingBox.min.y );

         const extrudeSettings = {
            depth: 4,
            bevelEnabled: false,
            UVGenerator : {

               generateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) {  },

               generateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) {

               }
            }
         };
     
         const geometry = new THREE.ExtrudeGeometry(shape, extrudeSettings);


         const mesh = new THREE.Mesh(geometry, [material, material1]);
         const line = new THREE.Line(lineGeometry, lineMaterial);
         mesh.userData.oldMaterial = true;
         province.add(mesh);
         province.add(line)
      })

   })

 
   province.properties = elem.properties;
   if (elem.properties.contorid) {
      const [x, y] = projection(elem.properties.contorid);
      province.properties._centroid = [x, y];
   }

   _this.map.add(province);

   if (elem.properties.center) {
      const [x, y] = projection(elem.properties.center);
      const center = new THREE.Vector3(x, -y, 4.01);
  
      _this.maptext.push( {
         pos:center,
         text:elem.properties.name
      } );
   }
   if (elem.properties.name == "北京市") {
      const [x, y] = projection(elem.properties.center);
      const center = new THREE.Vector3(x, -y, 4.01);
      pintArr.push(center.clone())
   }
})

this.scene.add(this.map);
this.loadFont(_this.maptext);
_this.ctrlBarDatas( true,'bar','北京市' );

到了這里,關于three.js 3D可視化地圖的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!

本文來自互聯(lián)網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如若轉載,請注明出處: 如若內容造成侵權/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經查實,立即刪除!

領支付寶紅包贊助服務器費用

相關文章

  • Three.js3D可視化介紹,以及本地搭建three.js官網

    Three.js3D可視化介紹,以及本地搭建three.js官網

    一、什么是Three.js three.js官網 :https://threejs.org/ Three.js 是一個基于 WebGL 的 JavaScript 3D 圖形庫,它可以輕松地在瀏覽器中 創(chuàng)建3D場景和動畫 。同時,它支持外部模型和紋理的導入,讓開發(fā)者可以更加便捷地創(chuàng)建出震撼的 3D場景 。 Three.js 的應用場景非常廣泛,主要包括以下幾個

    2024年02月09日
    瀏覽(299)
  • 【可視化大屏-3d機房監(jiān)控】Vue與three.js搭建可視化機房監(jiān)控

    【可視化大屏-3d機房監(jiān)控】Vue與three.js搭建可視化機房監(jiān)控

    演示網址:http://jstopo.top網站地址 3d機房地址:http://jstopo.top/threeTopo/#/monitor/index

    2024年03月10日
    瀏覽(98)
  • 使用Three.js創(chuàng)建令人驚嘆的WebGL 3D可視化

    WebGL?可視化?3D?繪圖是一項新興技術,具有廣闊的應用前景。它允許開發(fā)人員在?Web?瀏覽器中創(chuàng)建和渲染?3D?圖形,而無需安裝額外的插件或軟件。 本博客將介紹?Three.js,Three.js?是一個功能強大的?WebGL?框架,提供了豐富的?API?用于創(chuàng)建和渲染?3D?圖形,接下來讓我們通

    2024年01月19日
    瀏覽(98)
  • Three.js學習項目--3D抗美援朝數(shù)據(jù)可視化

    Three.js學習項目--3D抗美援朝數(shù)據(jù)可視化

    部分場景 體驗地址 https://kmyc.hongbin.xyz/ 操作說明 視頻 操作說明 我做了哪些(功能) draco解析glb模型 同時處理部分紋理請求 減輕一次加載紋理壓力 手動控制軌道控制器鏡頭動畫 多音頻拼接 控制 封裝動畫播放器 控制進度切換 動畫進度控制器 同步音頻 模擬視頻體驗 useCon

    2024年02月11日
    瀏覽(82)
  • DataGear 制作基于 three.js 的 3D 數(shù)據(jù)可視化看板

    DataGear 制作基于 three.js 的 3D 數(shù)據(jù)可視化看板

    DataGear 支持采用原生的HTML、JavaScript、CSS制作數(shù)據(jù)可視化看板,也支持導入由 npm 、 vite 等前端工具構建的前端程序包。得益于這一特性,可以很容易制作基于three.js的3D數(shù)據(jù)可視化看板。 首先,參考three.js的官方教程 https://threejs.org/docs/index.html#manual/en/introduction/Installation 編寫

    2024年03月09日
    瀏覽(142)
  • THREEJS 地圖可視化案例分享

    個人練習學習案例,代碼放在git了,需要的可以下載 threejs_map: threejs 地圖可視化案例 效果預覽

    2024年02月12日
    瀏覽(64)
  • 除了three.js,還有許多其他前端開發(fā)語言和庫可以用于創(chuàng)建3D可視化大屏

    除了three.js,還有許多其他前端開發(fā)語言和庫可以用于創(chuàng)建3D可視化大屏

    hello老鐵們...本人熟悉html5,vue對bootsrap,uniapp,layui,element,vite,antd,echarts,jq響應式尤其擅長,ui設計等技能,如果ui前端工作中有遇到煩惱可私信關注評論我們共同交流進步!謝謝?? ? ? 隨著前端技術的飛速發(fā)展,3D可視化已經成為許多應用場景中不可或缺的一部分。在

    2024年03月15日
    瀏覽(98)
  • 3D可視化集裝箱貨柜模型開發(fā) --threejs

    3D可視化集裝箱貨柜模型開發(fā) --threejs

    教程效果實現(xiàn)效果 ? ? 集裝箱模型 箱子模型 ? 中文文檔:three.js docs 1.安裝并 引入threejs 創(chuàng)建 安裝threejs依賴包 在需要用的的代碼文件里面引入threejs 2.實現(xiàn)3D模型最基礎的渲染骨架部分 以下例子是在vue的項目里面實現(xiàn)一個簡單的場景渲染,目前場景除了坐標軸并無其他物體

    2024年02月15日
    瀏覽(28)
  • vue基于threejs實現(xiàn)的3D可視化編輯器

    vue基于threejs實現(xiàn)的3D可視化編輯器

    隨著5G網絡的漸漸普及,物聯(lián)網在人們的生活中漸漸廣泛使用,社會向著越來越智能化的方向發(fā)展。當康科技經過不懈努力,研發(fā)屬于自己的一款3D可視化編輯器,助力企業(yè)應用實現(xiàn)3D可視化服務。 編輯器界面如下: 操作視頻演示: 3D可視化編輯器v1.0版本完成 主要功能點如下

    2024年02月13日
    瀏覽(25)
  • 前端前沿web 3d可視化技術 ThreeJS學習全記錄

    前端前沿web 3d可視化技術 ThreeJS學習全記錄

    完整案例與項目代碼: gitee開源項目地址 https://gitee.com/jumping-world-line/01_threeJS_basic 隨著瀏覽器性能和網絡帶寬的提升 使得3D技術不再是桌面的專利 打破傳統(tǒng)平面展示模式 前端方向主要流向的3D圖形庫包括Three.js和WebGL WebGL靈活高性能,但代碼量大,難度大,需要掌握很多底層

    2024年02月01日
    瀏覽(150)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領取紅包,優(yōu)惠每天領

二維碼1

領取紅包

二維碼2

領紅包