cesium中使用svg方法封裝

2021-10-22 14:55:47 字數 1804 閱讀 4101

import svglayer from "./components/svglayer.js";

let svglayer = new svglayer(viewer);

let entities = ;

let coord = [103.858867 31.068476];

svglayer.addrotetiontype("placename");//新增跟隨視角旋轉型別集合

let promise = svglayer.createrectangle(

"placename", //型別集合

name, //實體名稱

conid, //實體conid

, //svg引數

text, //text顯示文字

);promise.then((en) => );

export default class svglayer );

}} //計算svg偏移量

getcoordinateoffset(width, height, pos) ;

} //svg貼圖載入

createrectangle(name, conid, attr, text, pos) "

height

="$"

viewbox

=" 0 0 $ $"

xmlns

="">

>

"f1" x=

"0" y

="0"

>

"sourcegraphic"

stddeviation

="0"

/>

filter

>

defs

>

width

="$"

height

="$"

stroke

="$"

stroke-width

="$"

fill

="$"

filter

="url(#f1)"

/>

"$" y

="$"

text-anchor

="middle"

style

="fill:$

;font-size:$

;font-weight

:bold;

">

$text

>

svg>

`; const textimage = new image();

textimage.src =

"data:image/svg+xml;base64," +

window.btoa(unescape(encodeuricomponent(svgstr)));

textimage.onload = function() ,

});$this.entitys.push(en);

resolve(en);

};});

} //地圖旋轉監聽

startrotetion()

);this.entitys[i].rectangle.strotation = new cesium.callbackproperty(

function() );}

}});

} //圖層顯示隱藏

show(isshow)

//銷毀

destroy()

if (this.clockontickcallback)

}}

svg 配合cesium使用

恢復內容開始 1 svg簡介 在 2003 年一月,svg 1.1 被確立為 w3c 標準。參與定義 svg 的組織有 太陽微系統 adobe 蘋果公司 ibm 以及柯達。與其他影象格式相比,使用 svg 的優勢在於 svg 的主要競爭者是 flash。與 flash 相比,svg 最大的優勢是與其...

在HTML中使用SVG

如何在html中顯示 svg?有四種方式能夠在html 中顯示svg 第一種 embed 標籤這種標籤被所有主流的瀏覽器支援,而且優點是支援指令碼使用。這種標籤是adobe svg viewer 所倡導的使用方法,但是它不是 xhtml 的規範。語法為 例項 svg檔名稱為a.svg,如下 html...

QT中使用SVG的一種方法(SVG轉TTF)

今天跟大家分享乙個關於qt中使用svg的一種方法 並不全部適用,請大家閱讀後,在決定是否使用此方法 話不多說,上栗子 比如 如圖1 svg路勁圖,當我們在網頁上或者其他方法知道了乙個svg的path路勁,我們可以將這個路徑複製出來。圖1 svg路勁圖 接下來我們開啟你的svg檔案記得用notepad...