国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁 > news >正文

做代理網(wǎng)站百度指數(shù)搜索榜

做代理網(wǎng)站,百度指數(shù)搜索榜,電子商務(wù)網(wǎng)站建設(shè)實訓(xùn)步驟,河北承德網(wǎng)官網(wǎng)demo地址: https://openlayers.org/en/latest/examples/data-tiles.html 這篇示例講解的是自定義加載DataTile源格式的數(shù)據(jù)。 先來看一下什么是DataTile,這個源是一個數(shù)組,與我們之前XYZ切片源有所不同。DataTile主要適用于需要動態(tài)生成…

官網(wǎng)demo地址:

?

https://openlayers.org/en/latest/examples/data-tiles.html

這篇示例講解的是自定義加載DataTile源格式的數(shù)據(jù)。

先來看一下什么是DataTile,這個源是一個數(shù)組,與我們之前XYZ切片源有所不同。DataTile主要適用于需要動態(tài)生成、處理或渲染瓦片數(shù)據(jù)的復(fù)雜場景。

先新建一個canvas,設(shè)置一下畫布參數(shù)。

   //256x256 像素是瓦片圖層的常見尺寸const size = 256;const canvas = document.createElement("canvas");canvas.width = size;canvas.height = size;const context = canvas.getContext("2d");//設(shè)置描邊顏色為白色。context.strokeStyle = "white";//設(shè)置文本對齊方式為居中context.textAlign = "center";//設(shè)置字體為 24 像素的無襯線字體。context.font = "24px sans-serif";//用于控制文本行高const lineHeight = 30;

?loader 是一個自定義數(shù)據(jù)加載函數(shù),用于在需要時生成或獲取瓦片數(shù)據(jù)。它的設(shè)計目的是為了處理動態(tài)生成的或特定格式的數(shù)據(jù),比如在運行時計算或從非標(biāo)準(zhǔn)源獲取的數(shù)據(jù)。

new TileLayer({source: new DataTile({loader: function (z, x, y) {const half = size / 2;//清除畫布內(nèi)容context.clearRect(0, 0, size, size);context.fillStyle = "rgba(100, 100, 100, 0.5)";//填充整個畫布context.fillRect(0, 0, size, size);context.fillStyle = "red";//繪制文字context.fillText(`z: ${z}`, half, half - lineHeight);context.fillText(`x: ${x}`, half, half);context.fillText(`y: ${y}`, half, half + lineHeight);context.strokeRect(0, 0, size, size);//獲取畫布內(nèi)容的像素數(shù)據(jù)const data = context.getImageData(0, 0, size, size).data;// 轉(zhuǎn)換為Uint8Array以提高瀏覽器兼容性return new Uint8Array(data.buffer);},//禁用不透明度過渡,以避免在tile加載期間重疊標(biāo)簽transition: 0,}),}),

事實上,很多源都提供loader參數(shù)方便我們把獲取的數(shù)據(jù)或地圖路徑經(jīng)過二次處理之后再加載到地圖上。而具體返回什么樣的數(shù)據(jù)格式取決于源本身所接受的數(shù)據(jù)格式。

完整代碼:

<template><div class="box"><h1>Data Tiles自定義繪制DataTile源數(shù)據(jù)</h1><div id="map"></div></div>
</template><script>
import DataTile from "ol/source/DataTile.js";
import Map from "ol/Map.js";
import TileLayer from "ol/layer/WebGLTile.js";
import View from "ol/View.js";
export default {name: "",components: {},data() {return {map: null,};},computed: {},created() {},mounted() {//256x256 像素是瓦片圖層的常見尺寸const size = 256;const canvas = document.createElement("canvas");canvas.width = size;canvas.height = size;const context = canvas.getContext("2d");//設(shè)置描邊顏色為白色。context.strokeStyle = "white";//設(shè)置文本對齊方式為居中context.textAlign = "center";//設(shè)置字體為 24 像素的無襯線字體。context.font = "24px sans-serif";//用于控制文本行高const lineHeight = 30;const map = new Map({target: "map",layers: [new TileLayer({source: new DataTile({loader: function (z, x, y) {const half = size / 2;//清除畫布內(nèi)容context.clearRect(0, 0, size, size);context.fillStyle = "rgba(100, 100, 100, 0.5)";//填充整個畫布context.fillRect(0, 0, size, size);context.fillStyle = "red";//繪制文字context.fillText(`z: ${z}`, half, half - lineHeight);context.fillText(`x: ${x}`, half, half);context.fillText(`y: ${y}`, half, half + lineHeight);context.strokeRect(0, 0, size, size);//獲取畫布內(nèi)容的像素數(shù)據(jù)const data = context.getImageData(0, 0, size, size).data;// 轉(zhuǎn)換為Uint8Array以提高瀏覽器兼容性return new Uint8Array(data.buffer);},//禁用不透明度過渡,以避免在tile加載期間重疊標(biāo)簽transition: 0,}),}),],view: new View({center: [0, 0],zoom: 0,}),});},methods: {},
};
</script><style lang="scss" scoped>
#map {width: 100%;height: 500px;
}
.box {height: 100%;
}#info {width: 100%;height: 24rem;overflow: scroll;display: flex;align-items: baseline;border: 1px solid black;justify-content: flex-start;
}
</style>

http://aloenet.com.cn/news/45692.html

相關(guān)文章:

  • 李寧運動服網(wǎng)站建設(shè)規(guī)劃書b2b網(wǎng)站有哪些平臺
  • 杭州網(wǎng)站建設(shè)工作室網(wǎng)站關(guān)鍵詞優(yōu)化怎么弄
  • 怎么找網(wǎng)站app推廣方式有哪些
  • 怎樣自己做免費網(wǎng)站網(wǎng)絡(luò)推廣運營優(yōu)化
  • 湘潭做網(wǎng)站問下磐石網(wǎng)絡(luò)nba最新交易信息
  • 有什么網(wǎng)站可以做運動阿里指數(shù)官網(wǎng)最新版本
  • 提供邯鄲手機網(wǎng)站建設(shè)蘇州關(guān)鍵詞優(yōu)化seo
  • wordpress照片ppt網(wǎng)絡(luò)優(yōu)化師是什么工作
  • php做企業(yè)網(wǎng)站需要多久技術(shù)培訓(xùn)
  • 怎樣申請個人網(wǎng)站便民信息微信平臺推廣
  • 小游戲網(wǎng)站網(wǎng)址做網(wǎng)絡(luò)銷售如何找客戶
  • 在北京網(wǎng)站建設(shè)的崗位湖北網(wǎng)站建設(shè)制作
  • 門戶導(dǎo)航網(wǎng)頁模板seo網(wǎng)絡(luò)營銷是什么意思
  • html企業(yè)網(wǎng)站實例鄭州網(wǎng)絡(luò)seo公司
  • 做我女朋友好不好手機網(wǎng)站chatgpt網(wǎng)頁
  • 做網(wǎng)站雙12促銷方案百度官方免費下載安裝
  • dede網(wǎng)站百度統(tǒng)計怎么做中國免費網(wǎng)站服務(wù)器下載
  • 行業(yè)網(wǎng)站方案營銷型企業(yè)網(wǎng)站
  • 男生為女生做網(wǎng)站新媒體運營
  • 日本做曖小視頻在線觀看網(wǎng)站百度app下載安裝 官方
  • 遵義市做網(wǎng)站的電話58和百度哪個推廣效果好
  • dw做網(wǎng)站背景圖片設(shè)置關(guān)鍵詞批量調(diào)詞 軟件
  • 做微信公眾號的網(wǎng)站有哪些內(nèi)容外貿(mào)平臺排名
  • 重慶景點排名seo優(yōu)化標(biāo)題 關(guān)鍵詞
  • 常州網(wǎng)站建設(shè)案例長沙優(yōu)化官網(wǎng)服務(wù)
  • 做外貿(mào)網(wǎng)站需要什么條件app拉新推廣怎么做
  • 黃村專業(yè)網(wǎng)站建設(shè)公司百度廣告代理商
  • 天津津坤科技發(fā)展有限公司鄭州seo優(yōu)化外包顧問阿亮
  • 西安手機網(wǎng)站建設(shè)app投放渠道有哪些
  • wordpress 大內(nèi)存網(wǎng)站建設(shè)優(yōu)化推廣系統(tǒng)