概述
这次我们用pixi.js 做扩散圆和arcgis js结合
我们先定义一下 传入数据结构
let option = {
renderer: {
type: "simple",
symbol: {
innerCircle: {
color: "#ffec15",
radius: 8,
},
outerCircle: {
color: "#ffec15",
},
}
},
data: [
{
geometry: [12697872.012783196, 2577456.5937789795],
attributes: {
name: "深圳"
}
},
{
geometry: [ 113.83277893066406,
22.73249035750797],
attributes: {
name: "北京"
}
},
{
geometry: [12127804.65583251, 4070118.8821315],
attributes: {
name: "西安"
}
}
]
};
我们使用4个sprite类型来做 其中 实心圆和外部三圈的圆
//存放内部实心圆
this.graphics = [];
//分别存放外部三个空心圆
this.outerGraphic1 = [];
this.outerGraphic2 = [];
this.outerGraphic3 = [];
对于symbol 里面的color转换 我们写一个方法转成pixi的color 范式
function getColor(str: string, alpha = 1){
if (alpha > 1 || alpha < 0) {
return "透明度 Error value!";
}
//如果传入常规的颜色值,去除#
str = str.toString();
if (str.startsWith('#')) {
str = str.replace('#', '');
}
alpha = 255 * alpha;
// @ts-ignore
alpha = alpha.toString(16);
str = alpha + str;
alpha = parseInt(str, 16);
return alpha;
}
对于data 数据 ,
toScreen 方法参考链接提示
app 的构建参考 链接提示
let data = this.options.data;
for(let item of data){
//地理坐标转屏幕坐标
let geo = item.geometry
更多参考 https://xiaozhuanlan.com/topic/7164908235
最后
以上就是知性金毛为你收集整理的arcgis js 4 使用pixi.js 实现扩散圆的全部内容,希望文章能够帮你解决arcgis js 4 使用pixi.js 实现扩散圆所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复