export class Debug { static addSpriteMark ( pos , viewer ) { viewer . entities . add ( { billboard : { image : "./images/riverNormal.jpg" , width : 15 , height : 15 , } , position : pos } ) ; } static activePick ( viewer , type , onPick ? ) { let rayHandler = new Cesium . ScreenSpaceEventHandler ( ) ; rayHandler . setInputAction ( ( event ) => { let ray = viewer . camera . getPickRay ( event . position ) ; let picked = viewer . scene . pickFromRay ( ray , [ ] ) ; if ( picked && picked . object != null ) { switch ( type ) { case "cartesian" : console . warn ( picked . position . toString ( ) ) ; break ; case "cartographic" : console . warn ( Cesium . Cartographic . fromCartesian ( picked . position ) . toString ( ) ) ; break ; case "cartographic_angle" : let car = Cesium . Cartographic . fromCartesian ( picked . position ) ; console . warn ( car . longitude * 180 / Math . PI + "," + car . latitude * 180 / Math . PI + "," + car . height ) ; break ; } if ( onPick ) { let cargo = Cesium . Cartographic . fromCartesian ( picked . position ) ; onPick ( cargo ) ; } } } , Cesium . ScreenSpaceEventType . LEFT_CLICK ) ; return rayHandler ; } static logCameraInfo ( viewer ) { let pos = [ viewer . camera . positionWC . x , viewer . camera . positionWC . y , viewer . camera . positionWC . z ] ; let hpr = [ viewer . camera . heading , viewer . camera . pitch , viewer . camera . roll ] ; let info = JSON . stringify ( { pos , hpr } ) ; console . log ( info ) ; return info ; } static loadCameraInfo ( viewer , info ) { let { pos , hpr } = JSON . parse ( info ) ; viewer . camera . setView ( { destination : new Cesium . Cartesian3 ( pos [ 0 ] , pos [ 1 ] , pos [ 2 ] ) , orientation : { heading : hpr [ 0 ] , pitch : hpr [ 1 ] , roll : hpr [ 2 ] , } } ) ; } static drawPoint ( viewer , point , color = Cesium . Color . RED ) { viewer . entities . add ( { position : point , point : { color : color , pixelSize : 5 , disableDepthTestDistance : Number . POSITIVE_INFINITY } } ) ; } }