Commit 82ef61d5 authored by liyang's avatar liyang

feat:添加工作流程log和核心代码注释

parent b8bac284
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -702,7 +702,7 @@ ...@@ -702,7 +702,7 @@
<input class="export" id='logic-export' value='' type='submit'/> <input class="export" id='logic-export' value='' type='submit'/>
</form> </form>
<div class="content aslist aslistStyle" id='aslist'></div> <!-- <div class="content aslist aslistStyle" id='aslist'></div> -->
<div class="content countrylist countrylistStyle" id='countrylist'></div> <div class="content countrylist countrylistStyle" id='countrylist'></div>
<div class="listContainer" id='listContainer'> <div class="listContainer" id='listContainer'>
<!-- <div class="content adjacentaslist aslistStyle"></div> <!-- <div class="content adjacentaslist aslistStyle"></div>
...@@ -835,4 +835,4 @@ ...@@ -835,4 +835,4 @@
<script type="text/javascript" data-main="/js/q/datav3.q.index.js" src='/js/libs/requirejs/require.js'></script> <script type="text/javascript" data-main="/js/q/datav3.q.index.js" src='/js/libs/requirejs/require.js'></script>
</body> </body>
</html> </html>
\ No newline at end of file
/** /**
* @author Eberhard Graether / http://egraether.com/ * TrackballControls类用于处理相机交互控制,允许用户通过鼠标或触摸屏幕来旋转、缩放和平移相机视角。
* @author Mark Lundin / http://mark-lundin.com * @param {THREE.Camera} object - Three.js相机对象,要控制的相机。
* @param {HTMLElement} domElement - 用于绑定事件监听器的DOM元素。
*/ */
THREE.TrackballControls = function (object, domElement) {
THREE.TrackballControls = function ( object, domElement ) { // 存储this的引用,以便在内部函数中访问外部对象
var _this = this;
var _this = this;
var STATE = { NONE: -1, ROTATE: 0, ZOOM: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_ZOOM_PAN: 4 }; // 定义操作状态常量
var STATE = {
this.object = object; NONE: -1,
this.domElement = ( domElement !== undefined ) ? domElement : document; ROTATE: 0,
ZOOM: 1,
// API PAN: 2,
TOUCH_ROTATE: 3,
this.enabled = true; TOUCH_ZOOM_PAN: 4,
};
this.screen = { left: 0, top: 0, width: 0, height: 0 };
// 初始化属性
this.rotateSpeed = 0.3; this.object = object;
this.zoomSpeed = 0.4; this.domElement = domElement !== undefined ? domElement : document;
this.panSpeed = 0.2;
// API控制选项
this.noRotate = false; this.enabled = true;
this.noZoom = false;
this.noPan = false; this.screen = { left: 0, top: 0, width: 0, height: 0 };
this.noRoll = false;
this.rotateSpeed = 0.3;
this.staticMoving = false; this.zoomSpeed = 0.4;
this.dynamicDampingFactor = 0.4; this.panSpeed = 0.2;
this.minDistance = 0; this.noRotate = false;
this.maxDistance = Infinity; this.noZoom = false;
this.noPan = false;
this.keys = [ 65 /*A*/, 83 /*S*/, 68 /*D*/ ]; this.noRoll = false;
// internals this.staticMoving = false;
this.dynamicDampingFactor = 0.4;
this.target = new THREE.Vector3();
this.minDistance = 0;
var EPS = 0.000001; this.maxDistance = Infinity;
var lastPosition = new THREE.Vector3(); this.keys = [65 /*A*/, 83 /*S*/, 68 /*D*/];
var _state = STATE.NONE, // 相关向量和状态变量
_prevState = STATE.NONE, this.target = new THREE.Vector3();
_eye = new THREE.Vector3(), var EPS = 0.000001;
_rotateStart = new THREE.Vector3(), var lastPosition = new THREE.Vector3();
_rotateEnd = new THREE.Vector3(),
var _state = STATE.NONE,
_zoomStart = new THREE.Vector2(), _prevState = STATE.NONE,
_zoomEnd = new THREE.Vector2(), _eye = new THREE.Vector3(),
_rotateStart = new THREE.Vector3(),
_touchZoomDistanceStart = 0, _rotateEnd = new THREE.Vector3(),
_touchZoomDistanceEnd = 0, _zoomStart = new THREE.Vector2(),
_zoomEnd = new THREE.Vector2(),
_panStart = new THREE.Vector2(), _touchZoomDistanceStart = 0,
_panEnd = new THREE.Vector2(); _touchZoomDistanceEnd = 0,
_panStart = new THREE.Vector2(),
// for reset _panEnd = new THREE.Vector2();
this.target0 = this.target.clone(); // 用于重置的初始状态属性
this.position0 = this.object.position.clone(); this.target0 = this.target.clone();
this.up0 = this.object.up.clone(); this.position0 = this.object.position.clone();
this.up0 = this.object.up.clone();
// events
// 自定义事件
var changeEvent = { type: 'change' }; var changeEvent = { type: "change" };
var startEvent = { type: 'start'}; var startEvent = { type: "start" };
var endEvent = { type: 'end'}; var endEvent = { type: "end" };
// handleResize方法处理窗口大小变化,更新屏幕尺寸参数
// methods this.handleResize = function () {
// 如果domElement是document,使用整个窗口的大小
this.handleResize = function () { if (this.domElement === document) {
this.screen.left = 0;
if ( this.domElement === document ) { this.screen.top = 0;
this.screen.width = window.innerWidth;
this.screen.left = 0; this.screen.height = window.innerHeight;
this.screen.top = 0; } else {
this.screen.width = window.innerWidth; // 否则,获取domElement的尺寸和位置
this.screen.height = window.innerHeight; var box = this.domElement.getBoundingClientRect();
// 使用类似jquery offset()函数的调整来获取相对于页面的位置
} else { var d = this.domElement.ownerDocument.documentElement;
this.screen.left = box.left + window.pageXOffset - d.clientLeft;
var box = this.domElement.getBoundingClientRect(); this.screen.top = box.top + window.pageYOffset - d.clientTop;
// adjustments come from similar code in the jquery offset() function this.screen.width = box.width;
var d = this.domElement.ownerDocument.documentElement; this.screen.height = box.height;
this.screen.left = box.left + window.pageXOffset - d.clientLeft; }
this.screen.top = box.top + window.pageYOffset - d.clientTop; };
this.screen.width = box.width;
this.screen.height = box.height; // handleEvent方法处理事件,根据事件类型调用相应的处理方法
this.handleEvent = function (event) {
} if (typeof this[event.type] == "function") {
this[event.type](event);
}; }
};
this.handleEvent = function ( event ) {
// getMouseOnScreen方法将页面坐标转换为Three.js中的标准化屏幕坐标
if ( typeof this[ event.type ] == 'function' ) { var getMouseOnScreen = (function () {
var vector = new THREE.Vector2();
this[ event.type ]( event ); return function (pageX, pageY) {
vector.set(
} (pageX - _this.screen.left) / _this.screen.width,
(pageY - _this.screen.top) / _this.screen.height
}; );
return vector;
var getMouseOnScreen = ( function () { };
})();
var vector = new THREE.Vector2();
// getMouseProjectionOnBall方法将页面坐标转换为相机球面坐标
return function ( pageX, pageY ) { var getMouseProjectionOnBall = (function () {
var vector = new THREE.Vector3();
vector.set( var objectUp = new THREE.Vector3();
( pageX - _this.screen.left ) / _this.screen.width, var mouseOnBall = new THREE.Vector3();
( pageY - _this.screen.top ) / _this.screen.height return function (pageX, pageY) {
); mouseOnBall.set(
(pageX - _this.screen.width * 0.5 - _this.screen.left) /
return vector; (_this.screen.width * 0.5),
(_this.screen.height * 0.5 + _this.screen.top - pageY) /
}; (_this.screen.height * 0.5),
0.0
}() ); );
var length = mouseOnBall.length();
var getMouseProjectionOnBall = ( function () { // 如果设置不旋转(noRoll),则根据长度计算z分量
if (_this.noRoll) {
var vector = new THREE.Vector3(); if (length < Math.SQRT1_2) {
var objectUp = new THREE.Vector3(); mouseOnBall.z = Math.sqrt(1.0 - length * length);
var mouseOnBall = new THREE.Vector3(); } else {
mouseOnBall.z = 0.5 / length;
return function ( pageX, pageY ) { }
} else if (length > 1.0) {
mouseOnBall.set( mouseOnBall.normalize();
( pageX - _this.screen.width * 0.5 - _this.screen.left ) / (_this.screen.width*.5), } else {
( _this.screen.height * 0.5 + _this.screen.top - pageY ) / (_this.screen.height*.5), mouseOnBall.z = Math.sqrt(1.0 - length * length);
0.0 }
); // 根据相机位置和鼠标球面坐标计算目标点在球面上的位置
_eye.copy(_this.object.position).sub(_this.target);
var length = mouseOnBall.length(); vector.copy(_this.object.up).setLength(mouseOnBall.y);
vector.add(
if ( _this.noRoll ) { objectUp.copy(_this.object.up).cross(_eye).setLength(mouseOnBall.x)
);
if ( length < Math.SQRT1_2 ) { vector.add(_eye.setLength(mouseOnBall.z));
return vector;
mouseOnBall.z = Math.sqrt( 1.0 - length*length ); };
})();
} else {
// rotateCamera方法处理相机的旋转操作
mouseOnBall.z = .5 / length; this.rotateCamera = (function () {
var axis = new THREE.Vector3(),
} quaternion = new THREE.Quaternion();
return function () {
} else if ( length > 1.0 ) { // 计算两向量的夹角
var angle = Math.acos(
mouseOnBall.normalize(); _rotateStart.dot(_rotateEnd) /
_rotateStart.length() /
} else { _rotateEnd.length()
);
mouseOnBall.z = Math.sqrt( 1.0 - length * length ); // 如果有旋转角度
if (angle) {
} // 计算旋转轴
axis.crossVectors(_rotateStart, _rotateEnd).normalize();
_eye.copy( _this.object.position ).sub( _this.target ); // 根据旋转角度和旋转轴创建四元数
angle *= _this.rotateSpeed;
vector.copy( _this.object.up ).setLength( mouseOnBall.y ) quaternion.setFromAxisAngle(axis, -angle);
vector.add( objectUp.copy( _this.object.up ).cross( _eye ).setLength( mouseOnBall.x ) ); // 旋转_eye和相机的up向量
vector.add( _eye.setLength( mouseOnBall.z ) ); _eye.applyQuaternion(quaternion);
_this.object.up.applyQuaternion(quaternion);
return vector; _rotateEnd.applyQuaternion(quaternion);
// 如果使用静态移动(staticMoving),则将起始旋转向量复制为结束旋转向量
}; if (_this.staticMoving) {
_rotateStart.copy(_rotateEnd);
}() ); } else {
// 否则,根据动态阻尼因子进行缓动
this.rotateCamera = (function(){ quaternion.setFromAxisAngle(
axis,
var axis = new THREE.Vector3(), angle * (_this.dynamicDampingFactor - 1.0)
quaternion = new THREE.Quaternion(); );
_rotateStart.applyQuaternion(quaternion);
}
return function () { }
};
var angle = Math.acos( _rotateStart.dot( _rotateEnd ) / _rotateStart.length() / _rotateEnd.length() ); })();
if ( angle ) { // zoomCamera方法处理相机的缩放操作
this.zoomCamera = function () {
axis.crossVectors( _rotateStart, _rotateEnd ).normalize(); if (_state === STATE.TOUCH_ZOOM_PAN) {
// 处理触摸屏幕的缩放操作
angle *= _this.rotateSpeed; var factor = _touchZoomDistanceStart / _touchZoomDistanceEnd;
_touchZoomDistanceStart = _touchZoomDistanceEnd;
quaternion.setFromAxisAngle( axis, -angle ); _eye.multiplyScalar(factor);
} else {
_eye.applyQuaternion( quaternion ); // 处理鼠标滚轮的缩放操作
_this.object.up.applyQuaternion( quaternion ); var factor = 1.0 + (_zoomEnd.y - _zoomStart.y) * _this.zoomSpeed;
if (factor !== 1.0 && factor > 0.0) {
_rotateEnd.applyQuaternion( quaternion ); _eye.multiplyScalar(factor);
if (_this.staticMoving) {
if ( _this.staticMoving ) { _zoomStart.copy(_zoomEnd);
} else {
_rotateStart.copy( _rotateEnd ); _zoomStart.y +=
(_zoomEnd.y - _zoomStart.y) * this.dynamicDampingFactor;
} else { }
}
quaternion.setFromAxisAngle( axis, angle * ( _this.dynamicDampingFactor - 1.0 ) ); }
_rotateStart.applyQuaternion( quaternion ); };
} // panCamera方法处理相机的平移操作
this.panCamera = (function () {
} var mouseChange = new THREE.Vector2(),
} objectUp = new THREE.Vector3(),
pan = new THREE.Vector3();
}()); return function () {
mouseChange.copy(_panEnd).sub(_panStart);
this.zoomCamera = function () { if (mouseChange.lengthSq()) {
mouseChange.multiplyScalar(_eye.length() * _this.panSpeed);
if ( _state === STATE.TOUCH_ZOOM_PAN ) { pan.copy(_eye).cross(_this.object.up).setLength(mouseChange.x);
pan.add(objectUp.copy(_this.object.up).setLength(mouseChange.y));
var factor = _touchZoomDistanceStart / _touchZoomDistanceEnd; _this.object.position.add(pan);
_touchZoomDistanceStart = _touchZoomDistanceEnd; _this.target.add(pan);
_eye.multiplyScalar( factor ); if (_this.staticMoving) {
_panStart.copy(_panEnd);
} else { } else {
_panStart.add(
var factor = 1.0 + ( _zoomEnd.y - _zoomStart.y ) * _this.zoomSpeed; mouseChange
.subVectors(_panEnd, _panStart)
if ( factor !== 1.0 && factor > 0.0 ) { .multiplyScalar(_this.dynamicDampingFactor)
);
_eye.multiplyScalar( factor ); }
}
if ( _this.staticMoving ) { };
})();
_zoomStart.copy( _zoomEnd );
// checkDistances方法检查相机与目标点之间的距离,确保在设置的最小和最大距离范围内。
} else { this.checkDistances = function () {
if (!_this.noZoom || !_this.noPan) {
_zoomStart.y += ( _zoomEnd.y - _zoomStart.y ) * this.dynamicDampingFactor; if (_eye.lengthSq() > _this.maxDistance * _this.maxDistance) {
_this.object.position.addVectors(
} _this.target,
_eye.setLength(_this.maxDistance)
} );
}
} if (_eye.lengthSq() < _this.minDistance * _this.minDistance) {
_this.object.position.addVectors(
}; _this.target,
_eye.setLength(_this.minDistance)
this.panCamera = (function(){ );
}
var mouseChange = new THREE.Vector2(), }
objectUp = new THREE.Vector3(), };
pan = new THREE.Vector3();
// update方法更新相机的位置和朝向,同时调用事件change。
return function () { this.update = function () {
_eye.subVectors(_this.object.position, _this.target);
mouseChange.copy( _panEnd ).sub( _panStart ); if (!_this.noRotate) {
_this.rotateCamera();
if ( mouseChange.lengthSq() ) { }
if (!_this.noZoom) {
mouseChange.multiplyScalar( _eye.length() * _this.panSpeed ); _this.zoomCamera();
}
pan.copy( _eye ).cross( _this.object.up ).setLength( mouseChange.x ); if (!_this.noPan) {
pan.add( objectUp.copy( _this.object.up ).setLength( mouseChange.y ) ); _this.panCamera();
}
_this.object.position.add( pan ); _this.object.position.addVectors(_this.target, _eye);
_this.target.add( pan ); _this.checkDistances();
_this.object.lookAt(_this.target);
if ( _this.staticMoving ) { if (lastPosition.distanceToSquared(_this.object.position) > EPS) {
_this.dispatchEvent(changeEvent);
_panStart.copy( _panEnd ); lastPosition.copy(_this.object.position);
}
} else { };
_panStart.add( mouseChange.subVectors( _panEnd, _panStart ).multiplyScalar( _this.dynamicDampingFactor ) ); // reset方法将相机的位置和朝向重置为初始状态。
this.reset = function () {
} _state = STATE.NONE;
_prevState = STATE.NONE;
} _this.target.copy(_this.target0);
} _this.object.position.copy(_this.position0);
_this.object.up.copy(_this.up0);
}()); _eye.subVectors(_this.object.position, _this.target);
_this.object.lookAt(_this.target);
this.checkDistances = function () { _this.dispatchEvent(changeEvent);
lastPosition.copy(_this.object.position);
if ( !_this.noZoom || !_this.noPan ) { };
if ( _eye.lengthSq() > _this.maxDistance * _this.maxDistance ) { // 监听鼠标右键点击事件,防止上下文菜单弹出
this.domElement.addEventListener(
_this.object.position.addVectors( _this.target, _eye.setLength( _this.maxDistance ) ); "contextmenu",
function (event) {
} event.preventDefault();
},
if ( _eye.lengthSq() < _this.minDistance * _this.minDistance ) { false
);
_this.object.position.addVectors( _this.target, _eye.setLength( _this.minDistance ) );
// 监听鼠标按下事件
} this.domElement.addEventListener("mousedown", mousedown, false);
} // 监听鼠标滚轮事件和触摸屏幕的手势事件
this.domElement.addEventListener("mousewheel", mousewheel, false);
}; this.domElement.addEventListener("DOMMouseScroll", mousewheel, false); // 兼容Firefox
this.update = function () { this.domElement.addEventListener("touchstart", touchstart, false);
this.domElement.addEventListener("touchend", touchend, false);
_eye.subVectors( _this.object.position, _this.target ); this.domElement.addEventListener("touchmove", touchmove, false);
if ( !_this.noRotate ) { // 监听键盘事件
window.addEventListener("keydown", keydown, false);
_this.rotateCamera(); window.addEventListener("keyup", keyup, false);
} // 初始化时强制更新一次
this.handleResize();
if ( !_this.noZoom ) { this.update();
_this.zoomCamera();
}
if ( !_this.noPan ) {
_this.panCamera();
}
_this.object.position.addVectors( _this.target, _eye );
_this.checkDistances();
_this.object.lookAt( _this.target );
if ( lastPosition.distanceToSquared( _this.object.position ) > EPS ) {
_this.dispatchEvent( changeEvent );
lastPosition.copy( _this.object.position );
}
};
this.reset = function () {
_state = STATE.NONE;
_prevState = STATE.NONE;
_this.target.copy( _this.target0 );
_this.object.position.copy( _this.position0 );
_this.object.up.copy( _this.up0 );
_eye.subVectors( _this.object.position, _this.target );
_this.object.lookAt( _this.target );
_this.dispatchEvent( changeEvent );
lastPosition.copy( _this.object.position );
};
// listeners
function keydown( event ) {
if ( _this.enabled === false ) return;
window.removeEventListener( 'keydown', keydown );
_prevState = _state;
if ( _state !== STATE.NONE ) {
return;
} else if ( event.keyCode === _this.keys[ STATE.ROTATE ] && !_this.noRotate ) {
_state = STATE.ROTATE;
} else if ( event.keyCode === _this.keys[ STATE.ZOOM ] && !_this.noZoom ) {
_state = STATE.ZOOM;
} else if ( event.keyCode === _this.keys[ STATE.PAN ] && !_this.noPan ) {
_state = STATE.PAN;
}
}
function keyup( event ) {
if ( _this.enabled === false ) return;
_state = _prevState;
window.addEventListener( 'keydown', keydown, false );
}
function mousedown( event ) {
if ( _this.enabled === false ) return;
$(".info_router").hide()
event.preventDefault();
event.stopPropagation();
if ( _state === STATE.NONE ) {
_state = event.button;
}
if ( _state === STATE.ROTATE && !_this.noRotate ) {
_rotateStart.copy( getMouseProjectionOnBall( event.pageX, event.pageY ) );
_rotateEnd.copy( _rotateStart );
} else if ( _state === STATE.ZOOM && !_this.noZoom ) {
_zoomStart.copy( getMouseOnScreen( event.pageX, event.pageY ) );
_zoomEnd.copy(_zoomStart);
} else if ( _state === STATE.PAN && !_this.noPan ) {
_panStart.copy( getMouseOnScreen( event.pageX, event.pageY ) );
_panEnd.copy(_panStart)
}
document.addEventListener( 'mousemove', mousemove, false );
document.addEventListener( 'mouseup', mouseup, false );
_this.dispatchEvent( startEvent );
}
function mousemove( event ) {
if ( _this.enabled === false ) return;
event.preventDefault();
event.stopPropagation();
if ( _state === STATE.ROTATE && !_this.noRotate ) {
_rotateEnd.copy( getMouseProjectionOnBall( event.pageX, event.pageY ) );
} else if ( _state === STATE.ZOOM && !_this.noZoom ) {
_zoomEnd.copy( getMouseOnScreen( event.pageX, event.pageY ) );
} else if ( _state === STATE.PAN && !_this.noPan ) {
_panEnd.copy( getMouseOnScreen( event.pageX, event.pageY ) );
}
}
function mouseup( event ) {
if ( _this.enabled === false ) return;
event.preventDefault();
event.stopPropagation();
_state = STATE.NONE;
document.removeEventListener( 'mousemove', mousemove );
document.removeEventListener( 'mouseup', mouseup );
_this.dispatchEvent( endEvent );
}
function mousewheel( event ) {
if ( _this.enabled === false ) return;
$(".info_router").hide()
event.preventDefault();
event.stopPropagation();
var delta = 0;
if ( event.wheelDelta ) { // WebKit / Opera / Explorer 9
delta = event.wheelDelta / 40;
} else if ( event.detail ) { // Firefox
delta = - event.detail / 3;
}
_zoomStart.y += delta * 0.01;
_this.dispatchEvent( startEvent );
_this.dispatchEvent( endEvent );
}
function touchstart( event ) {
if ( _this.enabled === false ) return;
$(".info_router").hide()
switch ( event.touches.length ) {
case 1:
_state = STATE.TOUCH_ROTATE;
_rotateStart.copy( getMouseProjectionOnBall( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ) );
_rotateEnd.copy( _rotateStart );
break;
case 2:
_state = STATE.TOUCH_ZOOM_PAN;
var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
_touchZoomDistanceEnd = _touchZoomDistanceStart = Math.sqrt( dx * dx + dy * dy );
var x = ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX ) / 2;
var y = ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY ) / 2;
_panStart.copy( getMouseOnScreen( x, y ) );
_panEnd.copy( _panStart );
break;
default:
_state = STATE.NONE;
}
_this.dispatchEvent( startEvent );
}
function touchmove( event ) {
if ( _this.enabled === false ) return;
event.preventDefault();
event.stopPropagation();
switch ( event.touches.length ) {
case 1:
_rotateEnd.copy( getMouseProjectionOnBall( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ) );
break;
case 2:
var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
_touchZoomDistanceEnd = Math.sqrt( dx * dx + dy * dy );
var x = ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX ) / 2;
var y = ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY ) / 2;
_panEnd.copy( getMouseOnScreen( x, y ) );
break;
default:
_state = STATE.NONE;
}
}
function touchend( event ) {
if ( _this.enabled === false ) return;
switch ( event.touches.length ) {
case 1:
_rotateEnd.copy( getMouseProjectionOnBall( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ) );
_rotateStart.copy( _rotateEnd );
break;
case 2:
_touchZoomDistanceStart = _touchZoomDistanceEnd = 0;
var x = ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX ) / 2;
var y = ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY ) / 2;
_panEnd.copy( getMouseOnScreen( x, y ) );
_panStart.copy( _panEnd );
break;
}
_state = STATE.NONE;
_this.dispatchEvent( endEvent );
}
this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false );
this.domElement.addEventListener( 'mousedown', mousedown, false );
this.domElement.addEventListener( 'mousewheel', mousewheel, false );
this.domElement.addEventListener( 'DOMMouseScroll', mousewheel, false ); // firefox
this.domElement.addEventListener( 'touchstart', touchstart, false );
this.domElement.addEventListener( 'touchend', touchend, false );
this.domElement.addEventListener( 'touchmove', touchmove, false );
window.addEventListener( 'keydown', keydown, false );
window.addEventListener( 'keyup', keyup, false );
this.handleResize();
// force an update at start
this.update();
}; };
THREE.TrackballControls.prototype = Object.create( THREE.EventDispatcher.prototype ); // 将TrackballControls的原型指向THREE.EventDispatcher的实例,从而可以使用自定义事件。
THREE.TrackballControls.prototype = Object.create(
THREE.EventDispatcher.prototype
);
...@@ -16,6 +16,7 @@ var fetchData = (function () { ...@@ -16,6 +16,7 @@ var fetchData = (function () {
var jp_previous = $(".holder .jp-previous"); var jp_previous = $(".holder .jp-previous");
var jp_next = $(".holder .jp-next"); var jp_next = $(".holder .jp-next");
// 给下一页、上一页添加样式
function hasNextFn(hasNext) { function hasNextFn(hasNext) {
if (hasNext == true) { if (hasNext == true) {
$(".holder .jp-next").removeClass("jp-disabled"); $(".holder .jp-next").removeClass("jp-disabled");
...@@ -25,6 +26,8 @@ var fetchData = (function () { ...@@ -25,6 +26,8 @@ var fetchData = (function () {
} }
function paging(param) { function paging(param) {
console.log("分页初始化 paging() run")
// cb 绑定的是函数 getAllCountruInfoOfGlobal2()
jp_next.unbind(); jp_next.unbind();
jp_previous.unbind(); jp_previous.unbind();
...@@ -47,23 +50,20 @@ var fetchData = (function () { ...@@ -47,23 +50,20 @@ var fetchData = (function () {
var currPage = (param && param.currPage) || 1; var currPage = (param && param.currPage) || 1;
var cb = (param && param.cb) || ""; var cb = (param && param.cb) || "";
// 给下一页绑定点击事件
jp_next.bind("click", function () { jp_next.bind("click", function () {
// if(hasNext){ console.log("点击了下一页")
// jp_next.removeClass('jp-disabled');
// }else if(jp_next.hasClass('jp-disabled')){
// jp_next.addClass('jp-disabled');
// }
if (!$(this).hasClass("jp-disabled")) { if (!$(this).hasClass("jp-disabled")) {
currPage = currPage * 1 + 1; currPage = currPage * 1 + 1;
// console.log(currPage)
options.currPage = currPage; options.currPage = currPage;
// cb(currPage,countryCode,lt);
cb(options); cb(options);
jp_previous.removeClass("jp-disabled"); jp_previous.removeClass("jp-disabled");
} }
}); });
// 给上一页绑定点击事件
jp_previous.bind("click", function () { jp_previous.bind("click", function () {
console.log("点击了上一页")
if (!$(this).hasClass("jp-disabled")) { if (!$(this).hasClass("jp-disabled")) {
currPage = currPage * 1 - 1; currPage = currPage * 1 - 1;
options.currPage = currPage; options.currPage = currPage;
...@@ -136,6 +136,7 @@ var fetchData = (function () { ...@@ -136,6 +136,7 @@ var fetchData = (function () {
} }
function showAsError(val) { function showAsError(val) {
console.log("showAsError() running");
var val = val * 1; var val = val * 1;
if (isReservedPrivateAs(val)) { if (isReservedPrivateAs(val)) {
$(".right-btm-error").text("保留私有AS").show(); $(".right-btm-error").text("保留私有AS").show();
...@@ -147,14 +148,17 @@ var fetchData = (function () { ...@@ -147,14 +148,17 @@ var fetchData = (function () {
} }
function hideAllInfo() { function hideAllInfo() {
console.log("hideAllInfo() running");
jQuery(".logic_info_country").hide(); jQuery(".logic_info_country").hide();
jQuery(".logic_info_as").hide(); jQuery(".logic_info_as").hide();
jQuery(".logic_info_global").hide(); jQuery(".logic_info_global").hide();
} }
// 隐藏所有表格数据
function hideAlltableInfo() { function hideAlltableInfo() {
console.log("hideAlltableInfo() running");
$(".right-btm .countrylist").hide(); $(".right-btm .countrylist").hide();
$(".right-btm .aslist").hide(); // $(".right-btm .aslist").hide();
$(".right-btm .adjacentaslist").hide(); $(".right-btm .adjacentaslist").hide();
// $('.right-btm .adjacentcountrylist').hide(); // $('.right-btm .adjacentcountrylist').hide();
$(".right-btm .adjacentcountrylist").hide(); $(".right-btm .adjacentcountrylist").hide();
...@@ -165,9 +169,11 @@ var fetchData = (function () { ...@@ -165,9 +169,11 @@ var fetchData = (function () {
$(".right-btm .routerlist2").hide(); $(".right-btm .routerlist2").hide();
} }
// 显示
function showTablelistContainer() { function showTablelistContainer() {
console.log("showTablelistContainer() running");
$(".right-btm .countrylist").hide(); $(".right-btm .countrylist").hide();
$(".right-btm .aslist").hide(); // $(".right-btm .aslist").hide();
$(".right-btm").show(); $(".right-btm").show();
$(".right-btm .listContainer").show(); $(".right-btm .listContainer").show();
} }
...@@ -178,10 +184,19 @@ var fetchData = (function () { ...@@ -178,10 +184,19 @@ var fetchData = (function () {
// 全球初始化头信息 // 全球初始化头信息
var getASInfoOfGlobal = function () { var getASInfoOfGlobal = function () {
const data = { console.log("getASInfoOfGlobal() running")
checkDesc: "success", // 模拟数据
checkFlag: "false", data = {
productFlag: "false", countryTop5: ["US", "CN", "JP", "DE", "GB"],
content: "4%",
enterpise: "54%",
transitORAccess: "42%",
ipCount: "4294967296",
asCount: "68905",
countryCount: "224",
pp: "122871",
pc: "105129",
ss: "2216",
}; };
hideAllInfo(); hideAllInfo();
createGlobalInfo(data); createGlobalInfo(data);
...@@ -325,7 +340,7 @@ var fetchData = (function () { ...@@ -325,7 +340,7 @@ var fetchData = (function () {
var title_html = createRowsTitle1(); var title_html = createRowsTitle1();
var data_html = createAslist1(data.asInfoList); var data_html = createAslist1(data.asInfoList);
var content_html = title_html + data_html; var content_html = title_html + data_html;
$(".right-btm .aslist").html(content_html); // $(".right-btm .aslist").html(content_html);
hasNextFn(data.hasNext); hasNextFn(data.hasNext);
} }
...@@ -344,8 +359,12 @@ var fetchData = (function () { ...@@ -344,8 +359,12 @@ var fetchData = (function () {
key: key, key: key,
}; };
const data = {"checkDesc":"success","checkFlag":"false","productFlag":"false"} const data = {
createContentAslistinGlobal(data); checkDesc: "success",
checkFlag: "false",
productFlag: "false",
};
createContentAslistinGlobal(data);
// postAjax( // postAjax(
// "visual/control/vs/v3/topology/getASTypeStatisticsOfGlobal", // "visual/control/vs/v3/topology/getASTypeStatisticsOfGlobal",
// options, // options,
...@@ -411,7 +430,8 @@ var fetchData = (function () { ...@@ -411,7 +430,8 @@ var fetchData = (function () {
// 全球初始化国家列表信息 // 全球初始化国家列表信息
function createContentCountrylistInGlobal(data) { function createContentCountrylistInGlobal(data) {
// hideAlltableInfo(); console.log("createContentCountrylistInGlobal running 表格渲染国家数据");
hideAlltableInfo();
// $('.right-btm .title p').text('相邻的国家列表'); // $('.right-btm .title p').text('相邻的国家列表');
var title_arr = ["Country", "CC", "Rank", "ASV", "IPV", "CS", "ASS"]; var title_arr = ["Country", "CC", "Rank", "ASV", "IPV", "CS", "ASS"];
var dname_arr = [ var dname_arr = [
...@@ -424,24 +444,116 @@ var fetchData = (function () { ...@@ -424,24 +444,116 @@ var fetchData = (function () {
"linkedASSize", "linkedASSize",
]; ];
var title_html = createRowTitle(title_arr); var title_html = createRowTitle(title_arr);
// console.log("---- 000 ----")
// console.log(data)
var data_html = createRowInfo(data.countryInfolist, dname_arr); var data_html = createRowInfo(data.countryInfolist, dname_arr);
var content_html = title_html + data_html; var content_html = title_html + data_html;
$("#countrylist").html(content_html);
$(".right-btm .countrylist").html(content_html);
hasNextFn(data.hasNext); hasNextFn(data.hasNext);
} }
// 获取全球所有国家数据 2
var getAllCountruInfoOfGlobal2 = function (param) { var getAllCountruInfoOfGlobal2 = function (param) {
console.log("getAllCountruInfoOfGlobal2() running 获取全球所有国家数据");
var key = (param && param.key) || ""; var key = (param && param.key) || "";
var currPage = (param && param.currPage) || 1; var currPage = (param && param.currPage) || 1;
var pageSize = (param && param.pageSize) || 10; var pageSize = (param && param.pageSize) || 10;
var options = { const data = {
pageSize: pageSize, hasNext: true,
currPage: currPage, countryInfolist: [
key: key, {
countryName: "美国",
countryCode: "US",
countryRank: 1,
asCount: 17248,
ipCount: 1557490245,
linkedCountrySize: 213,
linkedASSize: 12462,
},
{
countryName: "中国",
countryCode: "CN",
countryRank: 2,
asCount: 517,
ipCount: 414788684,
linkedCountrySize: 63,
linkedASSize: 541,
},
{
countryName: "日本",
countryCode: "JP",
countryRank: 3,
asCount: 633,
ipCount: 195881510,
linkedCountrySize: 47,
linkedASSize: 368,
},
{
countryName: "德国",
countryCode: "DE",
countryRank: 4,
asCount: 2034,
ipCount: 132980390,
linkedCountrySize: 140,
linkedASSize: 4209,
},
{
countryName: "英国",
countryCode: "GB",
countryRank: 5,
asCount: 1887,
ipCount: 119040554,
linkedCountrySize: 146,
linkedASSize: 6173,
},
{
countryName: "韩国",
countryCode: "KR",
countryRank: 6,
asCount: 759,
ipCount: 113565020,
linkedCountrySize: 34,
linkedASSize: 219,
},
{
countryName: "巴西",
countryCode: "BR",
countryRank: 7,
asCount: 7954,
ipCount: 88984025,
linkedCountrySize: 119,
linkedASSize: 3130,
},
{
countryName: "法国",
countryCode: "FR",
countryRank: 8,
asCount: 1181,
ipCount: 82681550,
linkedCountrySize: 146,
linkedASSize: 4164,
},
{
countryName: "加拿大",
countryCode: "CA",
countryRank: 9,
asCount: 1315,
ipCount: 70594977,
linkedCountrySize: 52,
linkedASSize: 811,
},
{
countryName: "意大利",
countryCode: "IT",
countryRank: 10,
asCount: 967,
ipCount: 56591866,
linkedCountrySize: 135,
linkedASSize: 4312,
},
],
}; };
const data = staticLogicAsInfo;
createContentCountrylistInGlobal(data); createContentCountrylistInGlobal(data);
// postAjax('visual/control/vs/v3/topology/getAllCountruInfoOfGlobal',options,function(data){ // postAjax('visual/control/vs/v3/topology/getAllCountruInfoOfGlobal',options,function(data){
// // console.log('全球初始化国家列表信息 in2') // // console.log('全球初始化国家列表信息 in2')
...@@ -450,54 +562,145 @@ var fetchData = (function () { ...@@ -450,54 +562,145 @@ var fetchData = (function () {
// }) // })
}; };
// 获取全球所有国家数据
var getAllCountruInfoOfGlobal = function (param) { var getAllCountruInfoOfGlobal = function (param) {
$(".right-btm-error").hide(); console.log('getAllCountruInfoOfGlobal() running 获取全球所有国家数据')
var key = (param && param.key) || ""; var key = (param && param.key) || "";
var currPage = (param && param.currPage) || 1; var currPage = (param && param.currPage) || 1;
var pageSize = (param && param.pageSize) || 10; var pageSize = (param && param.pageSize) || 10;
var options = { // 模拟数据
pageSize: pageSize, const data = {
currPage: currPage, hasNext: true,
key: key, countryInfolist: [
{
countryName: "美国",
countryCode: "US",
countryRank: 1,
asCount: 17248,
ipCount: 1557490245,
linkedCountrySize: 213,
linkedASSize: 12462,
},
{
countryName: "中国",
countryCode: "CN",
countryRank: 2,
asCount: 517,
ipCount: 414788684,
linkedCountrySize: 63,
linkedASSize: 541,
},
{
countryName: "日本",
countryCode: "JP",
countryRank: 3,
asCount: 633,
ipCount: 195881510,
linkedCountrySize: 47,
linkedASSize: 368,
},
{
countryName: "德国",
countryCode: "DE",
countryRank: 4,
asCount: 2034,
ipCount: 132980390,
linkedCountrySize: 140,
linkedASSize: 4209,
},
{
countryName: "英国",
countryCode: "GB",
countryRank: 5,
asCount: 1887,
ipCount: 119040554,
linkedCountrySize: 146,
linkedASSize: 6173,
},
{
countryName: "韩国",
countryCode: "KR",
countryRank: 6,
asCount: 759,
ipCount: 113565020,
linkedCountrySize: 34,
linkedASSize: 219,
},
{
countryName: "巴西",
countryCode: "BR",
countryRank: 7,
asCount: 7954,
ipCount: 88984025,
linkedCountrySize: 119,
linkedASSize: 3130,
},
{
countryName: "法国",
countryCode: "FR",
countryRank: 8,
asCount: 1181,
ipCount: 82681550,
linkedCountrySize: 146,
linkedASSize: 4164,
},
{
countryName: "加拿大",
countryCode: "CA",
countryRank: 9,
asCount: 1315,
ipCount: 70594977,
linkedCountrySize: 52,
linkedASSize: 811,
},
{
countryName: "意大利",
countryCode: "IT",
countryRank: 10,
asCount: 967,
ipCount: 56591866,
linkedCountrySize: 135,
linkedASSize: 4312,
},
],
}; };
if (data && data.countryInfolist && data.countryInfolist.length > 0) {
hideAlltableInfo();
$(".right-btm .listContainer").hide();
$(".right-btm .countrylist").show();
createContentCountrylistInGlobal(data);
// console.log($(".right-btm .aslist"))
// $(".right-btm .aslist").hide();
$(".right-btm .title p").text("国家(地区)列表");
$(".right-btm .countrylist").show();
var other_info_initCountry = {
"CC:": " Country Code(国家或地区简称)",
"ASV:": "AS Volume(拥有的AS数量)",
"IPV:": "IP Volume(IP数量)",
"CS:": "Country Size(直连的国家或地区数量)",
"ASS:": "AS Size(直连的AS数量,节点度数)",
};
showContentOther(other_info_initCountry);
jp_previous.addClass("jp-disabled");
hasNextFn(data.hasNext);
paging({
currPage: currPage,
cb: getAllCountruInfoOfGlobal2,
hasNext: data.hasNext,
});
} else {
// $(".right-btm-error").text("无相关信息").show();
}
postAjax( // postAjax(
"visual/control/vs/v3/topology/getAllCountruInfoOfGlobal", // "visual/control/vs/v3/topology/getAllCountruInfoOfGlobal",
options, // options,
function (data) { // function (data) {
if (data && data.countryInfolist && data.countryInfolist.length > 0) { // }
// console.log('全球初始化国家列表信息') // );
// console.log(data)
hideAlltableInfo();
$(".right-btm .listContainer").hide();
$(".right-btm .countrylist").show();
createContentCountrylistInGlobal(data);
$(".right-btm .aslist").hide();
$(".right-btm .title p").text("国家(地区)列表");
$(".right-btm .countrylist").show();
var other_info_initCountry = {
"CC:": " Country Code(国家或地区简称)",
"ASV:": "AS Volume(拥有的AS数量)",
"IPV:": "IP Volume(IP数量)",
"CS:": "Country Size(直连的国家或地区数量)",
"ASS:": "AS Size(直连的AS数量,节点度数)",
};
showContentOther(other_info_initCountry);
jp_previous.addClass("jp-disabled");
hasNextFn(data.hasNext);
paging({
currPage: currPage,
cb: getAllCountruInfoOfGlobal2,
hasNext: data.hasNext,
});
} else {
$(".right-btm-error").text("无相关信息").show();
}
}
);
}; };
//全球搜国家-相连的其他国家信息 //全球搜国家-相连的其他国家信息
...@@ -790,6 +993,7 @@ var fetchData = (function () { ...@@ -790,6 +993,7 @@ var fetchData = (function () {
// 根据AS编号获取AS头信息 // 根据AS编号获取AS头信息
var getASInfo = function (asNumber) { var getASInfo = function (asNumber) {
console.log("------ 根据AS编号获取AS头信息 debug------");
var options = { var options = {
asNumber: asNumber, asNumber: asNumber,
}; };
...@@ -808,6 +1012,9 @@ var fetchData = (function () { ...@@ -808,6 +1012,9 @@ var fetchData = (function () {
// 国家右上头信息,国家间逻辑拓扑:点击逻辑拓扑中的国家标签返回该国家相关信息 // 国家右上头信息,国家间逻辑拓扑:点击逻辑拓扑中的国家标签返回该国家相关信息
var getCountryInfoBetweenCountry = function (countryCode) { var getCountryInfoBetweenCountry = function (countryCode) {
console.log(
"------ 国家右上头信息,国家间逻辑拓扑:点击逻辑拓扑中的国家标签返回该国家相关信息 ------"
);
// var countryCode = param && param.countryCode && ''; // var countryCode = param && param.countryCode && '';
var options = { var options = {
countryCode: countryCode, countryCode: countryCode,
...@@ -1041,11 +1248,6 @@ var fetchData = (function () { ...@@ -1041,11 +1248,6 @@ var fetchData = (function () {
//根据返回的信息对应在地图中显示出高亮的路由 //根据返回的信息对应在地图中显示出高亮的路由
} }
// if(pageSize == '1'){
// $('.holder .jp-next').addClass('jp-disabled');
// input_record.input_subResult_record.length = 1;
// }else{
if (!flag) { if (!flag) {
input_record.input_subResult_record = data.info.markId; input_record.input_subResult_record = data.info.markId;
...@@ -1833,12 +2035,15 @@ var fetchData = (function () { ...@@ -1833,12 +2035,15 @@ var fetchData = (function () {
} }
function createGlobalInfo(data) { function createGlobalInfo(data) {
console.log("createGlobal() running")
// console.log('全球初始化数据') // console.log('全球初始化数据')
// console.log(data) // console.log(data)
var $global = $(".logic_info_global"); var $global = $(".logic_info_global");
$global.find(".colum2 span").html(data.asCount ? data.asCount : "暂无数据"); $global.find(".colum2 span").html(data.asCount ? data.asCount : "暂无数据");
// console.log(data.asCount) // console.log(data.asCount)
// $global.find('.colum2 div').eq(0).find('span').html(data.asCount? data.asCount : '暂无数据'); // $global.find('.colum2 div').eq(0).find('span').html(data.asCount? data.asCount : '暂无数据');
// ----------- 设置全球的as数据 --------
var $infos = $global.find(".infos div b"); var $infos = $global.find(".infos div b");
var infos_data = [ var infos_data = [
data.content, data.content,
...@@ -1855,27 +2060,24 @@ var fetchData = (function () { ...@@ -1855,27 +2060,24 @@ var fetchData = (function () {
$infos.each(function (i, d) { $infos.each(function (i, d) {
$(this).html(infos_data[i]); $(this).html(infos_data[i]);
}); });
console.log(data.countryTop5); // ----------- 设置全球的as数据 --------
// console.log(data.countryTop5);
// 设置国家图标图片
$global.find(".top5 img").each(function (i, d) { $global.find(".top5 img").each(function (i, d) {
var imgsrc = "./images/qi/" + data.countryTop5[i] + ".png"; var imgsrc = "./images/qi/" + data.countryTop5[i] + ".png";
$(this).attr("src", imgsrc); $(this).attr("src", imgsrc);
$(this).next().html(data.countryTop5[i]); $(this).next().html(data.countryTop5[i]);
}); });
// 设置 提供者-客户端、点-点、兄弟-兄弟 的总量
var $infos = $("#ASlink-cnt .num"); var $infos = $("#ASlink-cnt .num");
var infos_data_2 = [data.pc, data.pp, data.ss]; var infos_data_2 = [data.pc, data.pp, data.ss];
$infos.each(function (i, d) { $infos.each(function (i, d) {
$(this).html(infos_data_2[i]); $(this).html(infos_data_2[i]);
}); });
// var $other = $global.find('.other span i');
// $other.eq(0).html(data.ipCount);
// $other.eq(1).html(data.countryCount);
// if(document.getElementById('textcircleglobal')){
// document.getElementById('textcircleglobal').textContent = 'ALL OVER THE WORLD';
// }else{
if (svgHeader_global) { if (svgHeader_global) {
// svgHeader_global.setContent('ALL OVER THE WORLD'); // svgHeader_global.setContent('ALL OVER THE WORLD');
svgHeader_global.setContent("THE WORLD"); svgHeader_global.setContent("THE WORLD");
...@@ -1885,11 +2087,6 @@ var fetchData = (function () { ...@@ -1885,11 +2087,6 @@ var fetchData = (function () {
// svgHeader_global.setContent('ALL OVER THE WORLD'); // svgHeader_global.setContent('ALL OVER THE WORLD');
svgHeader_global.setContent("THE WORLD"); svgHeader_global.setContent("THE WORLD");
} }
// var textpath = document.getElementById('textpathc_global');
// console.log(textpath)
// textpath.textContent = 'ALL OVER THE WORLD';
// }
} }
function createASCommonDom(data) { function createASCommonDom(data) {
......
...@@ -41,7 +41,7 @@ requirejs( ...@@ -41,7 +41,7 @@ requirejs(
jQuery(function () { jQuery(function () {
// 初始化状态信息 // 初始化状态信息
// 初始化全球逻辑图 // 初始化全球逻辑图
datavjs.log_world_init("neither", true); datavjs.log_world_init("neither", true);
// 选择器变量 // 选择器变量
...@@ -1685,6 +1685,7 @@ requirejs( ...@@ -1685,6 +1685,7 @@ requirejs(
}); });
} }
// 搜索国家
function filterContentInCountry(searchValue) { function filterContentInCountry(searchValue) {
//与国家搜索国家通用 //与国家搜索国家通用
currentHeaderCountrycode = $_currentHeaderCountrycode.text(); currentHeaderCountrycode = $_currentHeaderCountrycode.text();
...@@ -1901,7 +1902,7 @@ requirejs( ...@@ -1901,7 +1902,7 @@ requirejs(
//删除两个按钮状态下all功能,在搜索框右侧添加清除按钮操作 //删除两个按钮状态下all功能,在搜索框右侧添加清除按钮操作
$("#export-form .icon-qingchu").click(function () { $("#export-form .icon-qingchu").click(function () {
handleClickRbbtn2(); // handleClickRbbtn2();
handleClickRbbtn3(); handleClickRbbtn3();
handleClickRbbtn4(); handleClickRbbtn4();
if (type_current == "asinterface") { if (type_current == "asinterface") {
......
...@@ -461,6 +461,7 @@ ...@@ -461,6 +461,7 @@
return dtd.promise(); return dtd.promise();
function _init_light_data() { function _init_light_data() {
console.log("phy_init_data() _init_light_data() running");
// 增加光照,使得地图表面变色 // 增加光照,使得地图表面变色
direction_light = new THREE.DirectionalLight(0x0e4d72, 0.6); direction_light = new THREE.DirectionalLight(0x0e4d72, 0.6);
direction_light.position.set(0, 1, 0); direction_light.position.set(0, 1, 0);
...@@ -470,6 +471,7 @@ ...@@ -470,6 +471,7 @@
} }
function _init_map_data() { function _init_map_data() {
console.log("phy_init_data() _init_map_data() running");
// 国家地理边界数据可能不全,需要每次检查补充。 // 国家地理边界数据可能不全,需要每次检查补充。
var extrudeSettings = { var extrudeSettings = {
amount: map_amount, amount: map_amount,
...@@ -505,6 +507,7 @@ ...@@ -505,6 +507,7 @@
} }
function _init_json2topo() { function _init_json2topo() {
console.log("phy_init_data() _init_json2topo() running");
AS_type_map = {}; AS_type_map = {};
AS_pos_map = {}; AS_pos_map = {};
AS_color_map = {}; AS_color_map = {};
...@@ -528,7 +531,7 @@ ...@@ -528,7 +531,7 @@
country_AScount_list.push(_.size(country_ASes)); country_AScount_list.push(_.size(country_ASes));
} }
var country_AScount_max = _.max(country_AScount_list); var country_AScount_max = _.max(country_AScount_list);
console.log("------------"); // console.log("------------");
// 点处理 // 点处理
var Land_points = new THREE.Geometry(); var Land_points = new THREE.Geometry();
valid_country_names = []; // 实际有效的绘图国家列表 valid_country_names = []; // 实际有效的绘图国家列表
...@@ -967,6 +970,7 @@ ...@@ -967,6 +970,7 @@
} }
function _init_json2topo_2() { function _init_json2topo_2() {
console.log("phy_init_data() _init_json2topo_2() running");
AS_type_map = {}; AS_type_map = {};
AS_pos_map = {}; AS_pos_map = {};
AS_color_map = {}; AS_color_map = {};
...@@ -1122,6 +1126,7 @@ ...@@ -1122,6 +1126,7 @@
} }
function data_processing() { function data_processing() {
console.log("phy_init_data() data_processing() running")
_init_light_data(); _init_light_data();
_init_map_data(); _init_map_data();
_init_json2topo(); _init_json2topo();
...@@ -3276,7 +3281,6 @@ ...@@ -3276,7 +3281,6 @@
} }
// 逻辑图函数定义 // 逻辑图函数定义
// world
function log_init_world_data(init_flag) { function log_init_world_data(init_flag) {
var dtd = $.Deferred(); var dtd = $.Deferred();
// 全球初始化数据完毕,直接使用缓存, // 全球初始化数据完毕,直接使用缓存,
...@@ -3549,7 +3553,7 @@ ...@@ -3549,7 +3553,7 @@
var linkAS_info = world_countryAS_info[linkAS]; var linkAS_info = world_countryAS_info[linkAS];
if (linkAS_info == undefined) { if (linkAS_info == undefined) {
// AS只出现在别的AS边关系中,并没有自己的位置 // AS只出现在别的AS边关系中,并没有自己的位置
console.log(linkAS + " (linkAS) have no as info, need add!"); // console.log(linkAS + " (linkAS) have no as info, need add!");
continue; continue;
} else { } else {
var link_type = var link_type =
...@@ -4263,11 +4267,13 @@ ...@@ -4263,11 +4267,13 @@
} }
} }
// 初始化全球逻辑图
function log_world_init(topo_flag, init_flag) { function log_world_init(topo_flag, init_flag) {
input_record.input_value_plus_type = ""; input_record.input_value_plus_type = "";
input_record.input_value_plus_value = ""; input_record.input_value_plus_value = "";
util_clear_geometry(); util_clear_geometry();
log_scene_reset(); log_scene_reset();
// 在jQuery中,$.when()是一个用于处理异步任务的方法
$.when(log_init_world_data(init_flag)) $.when(log_init_world_data(init_flag))
.done(callback_done) .done(callback_done)
.fail(callback_fail); .fail(callback_fail);
...@@ -6008,6 +6014,7 @@ ...@@ -6008,6 +6014,7 @@
return dtd.promise(); return dtd.promise();
function data_processing(country_code_list) { function data_processing(country_code_list) {
console.log("log_init_countryout_data() data_processing() runing")
// console.log("processing"); // console.log("processing");
countryout_ASpoints = {}; // 存储国家内的位置 countryout_ASpoints = {}; // 存储国家内的位置
countryout_country_centers = {}; countryout_country_centers = {};
...@@ -7780,13 +7787,19 @@ ...@@ -7780,13 +7787,19 @@
} }
} }
// 重置webgl
function log_scene_reset() { function log_scene_reset() {
// 克隆已存在的iCamera对象来创建一个新的camera对象
camera = iCamera.clone(); camera = iCamera.clone();
// 设置camera的位置为(0, 0, 150000),即在3D场景中的坐标为(0, 0, 150000)
camera.position.x = 0; camera.position.x = 0;
camera.position.y = 0; camera.position.y = 0;
camera.position.z = 150000; camera.position.z = 150000;
// 设置camera的"up"向量为(0, 1, 0),使得正Y轴成为"上"方向
camera.up.set(0, 1, 0); camera.up.set(0, 1, 0);
// 使用THREE.TrackballControls构造函数创建一个新的控制器controler,用于在3D场景中操作相机
controler = new THREE.TrackballControls(camera, renderer.domElement); controler = new THREE.TrackballControls(camera, renderer.domElement);
// 设置controler的noRotate为true,这样相机就不会通过控制器进行旋转
controler.noRotate = true; controler.noRotate = true;
} }
......
...@@ -109,7 +109,6 @@ function isTopoinAS(as) { ...@@ -109,7 +109,6 @@ function isTopoinAS(as) {
var util = {}; var util = {};
// util.countries =[{"country_cn":"欧盟","countrycode":"EU"},{"country_cn":"不丹","countrycode":"BT"},{"country_cn":"中国","countrycode":"CN"},{"country_cn":"中非","countrycode":"CF"},{"country_cn":"丹麦","countrycode":"DK"},{"country_cn":"乌克兰","countrycode":"UA"},{"country_cn":"乌兹别克斯坦","countrycode":"UZ"},{"country_cn":"乌干达","countrycode":"UG"},{"country_cn":"乌拉圭","countrycode":"UY"},{"country_cn":"乍得","countrycode":"TD"},{"country_cn":"也门","countrycode":"YE"},{"country_cn":"亚美尼亚","countrycode":"AM"},{"country_cn":"以色列","countrycode":"IL"},{"country_cn":"伊拉克","countrycode":"IQ"},{"country_cn":"伊朗","countrycode":"IR"},{"country_cn":"伯里兹","countrycode":"BZ"},{"country_cn":"佛得角","countrycode":"CV"},{"country_cn":"俄罗斯","countrycode":"RU"},{"country_cn":"保加利亚","countrycode":"BG"},{"country_cn":"克罗地亚","countrycode":"HR"},{"country_cn":"关岛","countrycode":"GU"},{"country_cn":"冈比亚","countrycode":"GM"},{"country_cn":"冰岛","countrycode":"IS"},{"country_cn":"几内亚","countrycode":"GN"},{"country_cn":"几内亚比绍","countrycode":"GW"},{"country_cn":"列支顿士登","countrycode":"LI"},{"country_cn":"刚果(布)","countrycode":"CG"},{"country_cn":"刚果(金)","countrycode":"CD"},{"country_cn":"利比亚","countrycode":"LY"},{"country_cn":"利比里亚","countrycode":"LR"},{"country_cn":"加拿大","countrycode":"CA"},{"country_cn":"加纳","countrycode":"GH"},{"country_cn":"加蓬","countrycode":"GA"},{"country_cn":"匈牙利","countrycode":"HU"},{"country_cn":"南苏丹","countrycode":"SS"},{"country_cn":"南非","countrycode":"ZA"},{"country_cn":"博茨瓦纳","countrycode":"BW"},{"country_cn":"卡塔尔","countrycode":"QA"},{"country_cn":"卢旺达","countrycode":"RW"},{"country_cn":"卢森堡","countrycode":"LU"},{"country_cn":"印度","countrycode":"IN"},{"country_cn":"印度尼西亚","countrycode":"ID"},{"country_cn":"危地马拉","countrycode":"GT"},{"country_cn":"厄瓜多尔","countrycode":"EC"},{"country_cn":"厄立特里亚","countrycode":"ER"},{"country_cn":"叙利亚","countrycode":"SY"},{"country_cn":"古巴","countrycode":"CU"},{"country_cn":"吉尔吉斯斯坦","countrycode":"KG"},{"country_cn":"吉布提","countrycode":"DJ"},{"country_cn":"哈萨克斯坦","countrycode":"KZ"},{"country_cn":"哥伦比亚","countrycode":"CO"},{"country_cn":"哥斯达黎加","countrycode":"CR"},{"country_cn":"喀麦隆","countrycode":"CM"},{"country_cn":"图瓦卢","countrycode":"TV"},{"country_cn":"土尔其","countrycode":"TR"},{"country_cn":"土库曼斯坦","countrycode":"TM"},{"country_cn":"圣基茨和尼维斯","countrycode":"KN"},{"country_cn":"圣多美和普林西比","countrycode":"ST"},{"country_cn":"圣巴泰勒米岛","countrycode":"BL"},{"country_cn":"圣文森特和格陵纳丁斯","countrycode":"VC"},{"country_cn":"圣皮埃尔和密克隆","countrycode":"PM"},{"country_cn":"圣马力诺","countrycode":"SM"},{"country_cn":"圭亚那","countrycode":"GY"},{"country_cn":"坦桑尼亚","countrycode":"TZ"},{"country_cn":"埃及","countrycode":"EG"},{"country_cn":"埃塞俄比亚","countrycode":"ET"},{"country_cn":"基里巴斯","countrycode":"KI"},{"country_cn":"塔吉克斯坦","countrycode":"TJ"},{"country_cn":"塞内加尔","countrycode":"SN"},{"country_cn":"塞尔维亚","countrycode":"RS"},{"country_cn":"塞拉利昂","countrycode":"SL"},{"country_cn":"塞普路斯","countrycode":"CY"},{"country_cn":"塞舌尔","countrycode":"SC"},{"country_cn":"墨西哥","countrycode":"MX"},{"country_cn":"多哥","countrycode":"TG"},{"country_cn":"多米尼加共和国","countrycode":"DM"},{"country_cn":"多米尼加联邦","countrycode":"DO"},{"country_cn":"奥兰群岛","countrycode":"AX"},{"country_cn":"奥地利","countrycode":"AT"},{"country_cn":"委内瑞拉","countrycode":"VE"},{"country_cn":"孟加拉","countrycode":"BD"},{"country_cn":"安哥拉","countrycode":"AO"},{"country_cn":"安圭拉","countrycode":"AI"},{"country_cn":"安提瓜和巴布达","countrycode":"AG"},{"country_cn":"安道尔","countrycode":"AD"},{"country_cn":"尼加拉瓜","countrycode":"NI"},{"country_cn":"尼日利亚","countrycode":"NG"},{"country_cn":"尼日尔","countrycode":"NE"},{"country_cn":"尼泊尔","countrycode":"NP"},{"country_cn":"巴勒斯坦","countrycode":"PS"},{"country_cn":"巴哈马","countrycode":"BS"},{"country_cn":"巴基斯坦","countrycode":"PK"},{"country_cn":"巴巴多斯","countrycode":"BB"},{"country_cn":"巴布亚新几内亚","countrycode":"PG"},{"country_cn":"巴拉圭","countrycode":"PY"},{"country_cn":"巴拿马","countrycode":"PA"},{"country_cn":"巴林","countrycode":"BH"},{"country_cn":"巴西","countrycode":"BR"},{"country_cn":"布基纳法索","countrycode":"BF"},{"country_cn":"布隆迪","countrycode":"BI"},{"country_cn":"希腊","countrycode":"GR"},{"country_cn":"帕劳","countrycode":"PW"},{"country_cn":"库克群岛","countrycode":"CK"},{"country_cn":"库拉索","countrycode":"CW"},{"country_cn":"开曼群岛","countrycode":"KY"},{"country_cn":"德国","countrycode":"DE"},{"country_cn":"意大利","countrycode":"IT"},{"country_cn":"所罗门群岛","countrycode":"SB"},{"country_cn":"拉托维亚","countrycode":"LV"},{"country_cn":"挪威","countrycode":"NO"},{"country_cn":"捷克","countrycode":"CZ"},{"country_cn":"摩尔多瓦","countrycode":"MD"},{"country_cn":"摩洛哥","countrycode":"MA"},{"country_cn":"摩纳哥","countrycode":"MC"},{"country_cn":"文莱布鲁萨兰","countrycode":"BN"},{"country_cn":"斐济","countrycode":"FJ"},{"country_cn":"斯威士兰","countrycode":"SZ"},{"country_cn":"斯洛伐克","countrycode":"SK"},{"country_cn":"斯罗文尼亚","countrycode":"SI"},{"country_cn":"斯里兰卡","countrycode":"LK"},{"country_cn":"新加坡","countrycode":"SG"},{"country_cn":"新卡里多尼亚","countrycode":"NC"},{"country_cn":"新西兰","countrycode":"NZ"},{"country_cn":"日本","countrycode":"JP"},{"country_cn":"智利","countrycode":"CL"},{"country_cn":"朝鲜","countrycode":"KP"},{"country_cn":"柬埔寨","countrycode":"KH"},{"country_cn":"根西岛","countrycode":"GG"},{"country_cn":"格林纳达","countrycode":"GD"},{"country_cn":"格陵兰岛","countrycode":"GL"},{"country_cn":"格鲁吉亚","countrycode":"GE"},{"country_cn":"梵蒂岗","countrycode":"VA"},{"country_cn":"比利时","countrycode":"BE"},{"country_cn":"毛里塔尼亚","countrycode":"MR"},{"country_cn":"毛里求斯","countrycode":"MU"},{"country_cn":"汤加","countrycode":"TO"},{"country_cn":"沙特阿拉伯","countrycode":"SA"},{"country_cn":"法国","countrycode":"FR"},{"country_cn":"法属圣马丁","countrycode":"MF"},{"country_cn":"法属圭亚那","countrycode":"GF"},{"country_cn":"法属尼留旺岛","countrycode":"RE"},{"country_cn":"中国香港","countrycode":"HK"},{"country_cn":"法属玻里尼西亚","countrycode":"PF"},{"country_cn":"法罗群岛","countrycode":"FO"},{"country_cn":"波兰","countrycode":"PL"},{"country_cn":"波多黎各","countrycode":"PR"},{"country_cn":"波黑","countrycode":"BA"},{"country_cn":"泰国","countrycode":"TH"},{"country_cn":"泽西岛","countrycode":"JE"},{"country_cn":"津巴布韦","countrycode":"ZW"},{"country_cn":"洪都拉斯","countrycode":"HN"},{"country_cn":"海地","countrycode":"HT"},{"country_cn":"澳大利亚","countrycode":"AU"},{"country_cn":"中国台湾","countrycode":"TW"},{"country_cn":"爱尔兰","countrycode":"IE"},{"country_cn":"爱沙尼亚","countrycode":"EE"},{"country_cn":"牙买加","countrycode":"JM"},{"country_cn":"特克斯和凯科斯群岛","countrycode":"TC"},{"country_cn":"特立尼达和多巴哥","countrycode":"TT"},{"country_cn":"玻利维亚","countrycode":"BO"},{"country_cn":"瑙鲁","countrycode":"NR"},{"country_cn":"瑞典","countrycode":"SE"},{"country_cn":"瑞士","countrycode":"CH"},{"country_cn":"瓦努阿鲁","countrycode":"VU"},{"country_cn":"白俄罗斯","countrycode":"BY"},{"country_cn":"百慕大","countrycode":"BM"},{"country_cn":"直布罗陀","countrycode":"GI"},{"country_cn":"科威特","countrycode":"KW"},{"country_cn":"科摩罗","countrycode":"KM"},{"country_cn":"科特迪瓦","countrycode":"CI"},{"country_cn":"秘鲁","countrycode":"PE"},{"country_cn":"突尼斯","countrycode":"TN"},{"country_cn":"立陶宛","countrycode":"LT"},{"country_cn":"米克罗尼西亚","countrycode":"FM"},{"country_cn":"索马里","countrycode":"SO"},{"country_cn":"约旦","countrycode":"JO"},{"country_cn":"纳米比亚","countrycode":"NA"},{"country_cn":"缅甸","countrycode":"MM"},{"country_cn":"罗马尼亚","countrycode":"RO"},{"country_cn":"美国","countrycode":"US"},{"country_cn":"美属维尔京群岛","countrycode":"VI"},{"country_cn":"老挝","countrycode":"LA"},{"country_cn":"肯尼亚","countrycode":"KE"},{"country_cn":"芬兰","countrycode":"FI"},{"country_cn":"苏丹","countrycode":"SD"},{"country_cn":"苏里南","countrycode":"SR"},{"country_cn":"英国","countrycode":"GB"},{"country_cn":"英属印度洋领地","countrycode":"IO"},{"country_cn":"英属维京群岛","countrycode":"VG"},{"country_cn":"荷兰","countrycode":"NL"},{"country_cn":"荷兰加勒比区","countrycode":"BQ"},{"country_cn":"荷属圣马丁","countrycode":"SX"},{"country_cn":"莫桑比克","countrycode":"MZ"},{"country_cn":"莱索托","countrycode":"LS"},{"country_cn":"菲律宾","countrycode":"PH"},{"country_cn":"萨尔瓦多","countrycode":"SV"},{"country_cn":"萨摩亚","countrycode":"WS"},{"country_cn":"葡萄牙","countrycode":"PT"},{"country_cn":"蒙古","countrycode":"MN"},{"country_cn":"西班牙","countrycode":"ES"},{"country_cn":"诺福克岛","countrycode":"NF"},{"country_cn":"贝宁","countrycode":"BJ"},{"country_cn":"赞比亚","countrycode":"ZM"},{"country_cn":"赤道几内亚","countrycode":"GQ"},{"country_cn":"越南","countrycode":"VN"},{"country_cn":"阿塞拜疆","countrycode":"AZ"},{"country_cn":"阿富汗","countrycode":"AF"},{"country_cn":"阿尔及利亚","countrycode":"DZ"},{"country_cn":"阿尔巴尼亚","countrycode":"AL"},{"country_cn":"阿曼","countrycode":"OM"},{"country_cn":"阿根廷","countrycode":"AR"},{"country_cn":"阿联酋","countrycode":"AE"},{"country_cn":"阿鲁巴","countrycode":"AW"},{"country_cn":"韩国","countrycode":"KR"},{"country_cn":"马其顿","countrycode":"MK"},{"country_cn":"马尔代夫","countrycode":"MV"},{"country_cn":"马恩岛","countrycode":"IM"},{"country_cn":"马拉维","countrycode":"MW"},{"country_cn":"马来西亚","countrycode":"MY"},{"country_cn":"马绍尔群岛","countrycode":"MH"},{"country_cn":"马耳他","countrycode":"MT"},{"country_cn":"马达加斯加","countrycode":"MG"},{"country_cn":"马里","countrycode":"ML"},{"country_cn":"黎巴嫩","countrycode":"LB"},{"country_cn":"黑山","countrycode":"ME"},{"country_cn":"东萨摩亚","countrycode":"AS"}];
util.countries = [ util.countries = [
// { country_cn: '欧盟', countrycode: 'EU' }, // { country_cn: '欧盟', countrycode: 'EU' },
{ country_cn: "不丹", countrycode: "BT" }, { country_cn: "不丹", countrycode: "BT" },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment