@@ -138,16 +138,8 @@ export default class CommonFuncManager {
138138 * //res.toPng();
139139 */
140140 outputImageObj ( ) {
141- let isAn = true ;
142- if ( this . viewer . shouldAnimate === false ) {
143- this . viewer . shouldAnimate === true ;
144- isAn = false ;
145- }
146141 this . viewer . render ( ) ;
147- if ( ! isAn ) {
148- this . viewer . shouldAnimate === false ;
149- }
150- return Cesium . ReImg . fromCanvas ( this . viewer . canvas ) ;
142+ return Cesium . reimg . fromCanvas ( this . viewer . canvas ) ;
151143 }
152144
153145 /**
@@ -161,7 +153,7 @@ export default class CommonFuncManager {
161153 */
162154 outputImageFile ( fileName ) {
163155 this . viewer . render ( ) ;
164- Cesium . ReImg . fromCanvas ( this . viewer . canvas ) . downloadPng ( fileName ) ;
156+ Cesium . reimg . fromCanvas ( this . viewer . canvas ) . downloadPng ( fileName ) ;
165157 }
166158
167159 /**
@@ -203,13 +195,6 @@ export default class CommonFuncManager {
203195 * @function module:客户端公共方法.CommonFuncManager.prototype.getSceneRange
204196 * @param {String } 视图元素ID
205197 * @returns {Array[] } 场景范围(单位:经纬度)Array<[lon,lat]>
206- * @example
207- * var viewer = new Cesium.Viewer('GlobeView1', {
208- * terrainExaggeration: 1,
209- * requestRenderMode: true
210- * });
211- * let id = 'GlobeView1';
212- * cfm.getSceneRange(id);
213198 */
214199 getSceneRange ( elementID ) {
215200 const controlDiv = document . getElementById ( elementID ) ;
@@ -457,33 +442,15 @@ export default class CommonFuncManager {
457442 let carCenter = new Cesium . Cartographic ( ) ;
458443 carCenter = Cesium . Cartographic . fromCartesian ( center , this . ellipsoid , carCenter ) ;
459444 carCenter . height = 0 ;
460- const centerUse = Cesium . Cartesian3 . fromRadians (
461- carCenter . longitude ,
462- carCenter . latitude ,
463- carCenter . height ,
464- this . ellipsoid ,
465- new Cesium . Cartesian3 ( )
466- ) ;
467- const centerUseEx = Cesium . Cartesian3 . fromRadians (
468- carCenter . longitude ,
469- carCenter . latitude + 0.1 ,
470- carCenter . height ,
471- this . ellipsoid ,
472- new Cesium . Cartesian3 ( )
473- ) ;
445+ const centerUse = Cesium . Cartesian3 . fromRadians ( carCenter . longitude , carCenter . latitude , carCenter . height , this . ellipsoid , new Cesium . Cartesian3 ( ) ) ;
446+ const centerUseEx = Cesium . Cartesian3 . fromRadians ( carCenter . longitude , carCenter . latitude + 0.1 , carCenter . height , this . ellipsoid , new Cesium . Cartesian3 ( ) ) ;
474447 let tempdir = Cesium . Cartesian3 . subtract ( centerUseEx , centerUse , new Cesium . Cartesian3 ( ) ) ;
475448 tempdir = Cesium . Cartesian3 . normalize ( tempdir , tempdir ) ;
476449
477450 let carTarget = new Cesium . Cartographic ( ) ;
478451 carTarget = Cesium . Cartographic . fromCartesian ( target , this . ellipsoid , carTarget ) ;
479452 carTarget . height = 0 ;
480- const targetUse = Cesium . Cartesian3 . fromRadians (
481- carTarget . longitude ,
482- carTarget . latitude ,
483- carTarget . height ,
484- this . ellipsoid ,
485- new Cesium . Cartesian3 ( )
486- ) ;
453+ const targetUse = Cesium . Cartesian3 . fromRadians ( carTarget . longitude , carTarget . latitude , carTarget . height , this . ellipsoid , new Cesium . Cartesian3 ( ) ) ;
487454
488455 let tarDir = Cesium . Cartesian3 . subtract ( targetUse , centerUse , new Cesium . Cartesian3 ( ) ) ;
489456 tarDir = Cesium . Cartesian3 . normalize ( tarDir , tarDir ) ;
@@ -529,8 +496,8 @@ export default class CommonFuncManager {
529496 * let drawElement = new Cesium.DrawElement(viewer);
530497 * let commfun = new CommonFun({viewer:viewer});
531498 * drawElement.startDrawingPolyline({
532- * callback: function(result ){
533- * let simplify = commfun.simplifyLine(result. positions);
499+ * callback: function(positions ){
500+ * let simplify = commfun.simplifyLine(positions);
534501 * polyline = new Cesium.DrawElement.PolylinePrimitive({
535502 * positions: simplify,
536503 * width: 1,
@@ -553,11 +520,7 @@ export default class CommonFuncManager {
553520 }
554521 for ( let i = 0 ; i <= posCopy . length - 3 ; i += 1 ) {
555522 const isVertice = ! ( ( posCopy [ i ] . z - posCopy [ i + 1 ] . z ) * ( posCopy [ i + 1 ] . z - posCopy [ i + 2 ] . z ) > 0 ) ;
556- const angle = calAngleOf3Pnt (
557- [ posCopy [ i ] . x , posCopy [ i ] . y , posCopy [ i ] . z ] ,
558- [ posCopy [ i + 1 ] . x , posCopy [ i + 1 ] . y , posCopy [ i + 1 ] . z ] ,
559- [ posCopy [ i + 2 ] . x , posCopy [ i + 2 ] . y , posCopy [ i + 2 ] . z ]
560- ) ;
523+ const angle = calAngleOf3Pnt ( [ posCopy [ i ] . x , posCopy [ i ] . y , posCopy [ i ] . z ] , [ posCopy [ i + 1 ] . x , posCopy [ i + 1 ] . y , posCopy [ i + 1 ] . z ] , [ posCopy [ i + 2 ] . x , posCopy [ i + 2 ] . y , posCopy [ i + 2 ] . z ] ) ;
561524
562525 if ( angle > 175 && ! isVertice ) {
563526 posCopy = posCopy . slice ( 0 , i + 1 ) . concat ( posCopy . slice ( i + 2 ) ) ;
@@ -592,10 +555,7 @@ export default class CommonFuncManager {
592555 static calcParabola ( options ) {
593556 // 方程 y=-(4h/L^2)*x^2+h h:顶点高度 L:横纵间距较大者
594557 const h = options . height && options . height > 5000 ? options . height : 5000 ;
595- const L =
596- Math . abs ( options . position1 . lon - options . position2 . lon ) > Math . abs ( options . position1 . lat - options . position2 . lat )
597- ? Math . abs ( options . position1 . lon - options . position2 . lon )
598- : Math . abs ( options . position1 . lat - options . position2 . lat ) ;
558+ const L = Math . abs ( options . position1 . lon - options . position2 . lon ) > Math . abs ( options . position1 . lat - options . position2 . lat ) ? Math . abs ( options . position1 . lon - options . position2 . lon ) : Math . abs ( options . position1 . lat - options . position2 . lat ) ;
599559 const num = options . num && options . num > 50 ? options . num : 50 ;
600560 const result = [ ] ;
601561 let dlt = L / num ;
@@ -753,7 +713,7 @@ export default class CommonFuncManager {
753713 });
754714 */
755715 createNavigationTool ( options ) {
756- this . viewer . extend ( Cesium . NavigationTool , options ) ;
716+ this . viewer . extend ( Cesium . viewerCesiumNavigationMixin , options ) ;
757717 return this . viewer . cesiumNavigation ;
758718 }
759719}
0 commit comments