基于three.js 和ArcGIS JS API meshline流动线
简介
ArcGIS API for JavaScript 是ESRI 推出面向 WEB 端 GIS API,可构建引人注目的web 地图应用程序,通过交互式用户体验和令人惊叹的2D和3D可视化来释放地理时空大数据的潜力。同时提供了一个轻量级接口来访问SceneView的WebGL上下文,因此可以创建与内置层相同的方式与场景交互的自定义可视化。开发人员可以直接编写WebGL代码,也可以与第三方WebGL库集成
基于three.js 和ArcGIS JS API meshline流动线扩展类
efine ( [
'dojo/_base/declare' ,
'esri/geometry/Point' ,
'esri/geometry/SpatialReference' ,
'esri/views/3d/externalRenderers' ,
'esri/geometry/support/webMercatorUtils' ,
] , function ( declare, Point, SpatialReference, externalRenderers, webMercatorUtils) {
'use strict' ;
var THREE = window. THREE ;
var RADIUS = 6378137 ;
var OFFSET = 5000 ;
var COLOR = 0xef6c00 ;
var REST = 75 ;
const RandomColors = [
'#00FFFF' ,
'#00FF00' ,
] ;
var colorindex = 0 ;
function getColor ( ) {
if ( colorindex === 0 ) {
colorindex = 1 ;
} else {
colorindex = 0 ;
}
return RandomColors[ colorindex] . replace ( '#' , '0x' ) ;
}
function getColornew ( color) {
return color. replace ( '#' , '0x' ) ;
}
return declare ( [ ] , {
constructor: function ( view, tracks, width, color, opacity, dashArray, rest, linesegment, linesegmentfade) {
this . view = view;
this . tracks = tracks;
this . index = 0 ;
this . max = 0 ;
this . linesegment = linesegment === undefined ? 60 : linesegment;
this . linesegmentfade = linesegmentfade === undefined ? 10 : linesegmentfade;
this . REST = rest === undefined ? 75 : rest;
this . width = width === undefined ? 15 : width;
this . color = color === undefined ? '#00FF00' : color;
this . opacity = opacity === undefined ? 0 : opacity;
this . dashArray = dashArray === undefined ? 0 : dashArray;
this . meshLines = [ ] ;
this . refresh = Date. now ( ) ;
} ,
setup: function ( context) {
this . renderer = new THREE. WebGLRenderer ( {
context: context. gl,
premultipliedAlpha: false ,
}