@@ -138,8 +138,16 @@ 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+ }
141146 this . viewer . render ( ) ;
142- return Cesium . reimg . fromCanvas ( this . viewer . canvas ) ;
147+ if ( ! isAn ) {
148+ this . viewer . shouldAnimate === false ;
149+ }
150+ return Cesium . ReImg . fromCanvas ( this . viewer . canvas ) ;
143151 }
144152
145153 /**
@@ -153,7 +161,7 @@ export default class CommonFuncManager {
153161 */
154162 outputImageFile ( fileName ) {
155163 this . viewer . render ( ) ;
156- Cesium . reimg . fromCanvas ( this . viewer . canvas ) . downloadPng ( fileName ) ;
164+ Cesium . ReImg . fromCanvas ( this . viewer . canvas ) . downloadPng ( fileName ) ;
157165 }
158166
159167 /**
@@ -195,6 +203,13 @@ export default class CommonFuncManager {
195203 * @function module:客户端公共方法.CommonFuncManager.prototype.getSceneRange
196204 * @param {String } 视图元素ID
197205 * @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);
198213 */
199214 getSceneRange ( elementID ) {
200215 const controlDiv = document . getElementById ( elementID ) ;
@@ -442,15 +457,33 @@ export default class CommonFuncManager {
442457 let carCenter = new Cesium . Cartographic ( ) ;
443458 carCenter = Cesium . Cartographic . fromCartesian ( center , this . ellipsoid , carCenter ) ;
444459 carCenter . height = 0 ;
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 ( ) ) ;
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+ ) ;
447474 let tempdir = Cesium . Cartesian3 . subtract ( centerUseEx , centerUse , new Cesium . Cartesian3 ( ) ) ;
448475 tempdir = Cesium . Cartesian3 . normalize ( tempdir , tempdir ) ;
449476
450477 let carTarget = new Cesium . Cartographic ( ) ;
451478 carTarget = Cesium . Cartographic . fromCartesian ( target , this . ellipsoid , carTarget ) ;
452479 carTarget . height = 0 ;
453- const targetUse = Cesium . Cartesian3 . fromRadians ( carTarget . longitude , carTarget . latitude , carTarget . height , this . ellipsoid , new Cesium . Cartesian3 ( ) ) ;
480+ const targetUse = Cesium . Cartesian3 . fromRadians (
481+ carTarget . longitude ,
482+ carTarget . latitude ,
483+ carTarget . height ,
484+ this . ellipsoid ,
485+ new Cesium . Cartesian3 ( )
486+ ) ;
454487
455488 let tarDir = Cesium . Cartesian3 . subtract ( targetUse , centerUse , new Cesium . Cartesian3 ( ) ) ;
456489 tarDir = Cesium . Cartesian3 . normalize ( tarDir , tarDir ) ;
@@ -496,8 +529,8 @@ export default class CommonFuncManager {
496529 * let drawElement = new Cesium.DrawElement(viewer);
497530 * let commfun = new CommonFun({viewer:viewer});
498531 * drawElement.startDrawingPolyline({
499- * callback: function(positions ){
500- * let simplify = commfun.simplifyLine(positions);
532+ * callback: function(result ){
533+ * let simplify = commfun.simplifyLine(result. positions);
501534 * polyline = new Cesium.DrawElement.PolylinePrimitive({
502535 * positions: simplify,
503536 * width: 1,
@@ -520,7 +553,11 @@ export default class CommonFuncManager {
520553 }
521554 for ( let i = 0 ; i <= posCopy . length - 3 ; i += 1 ) {
522555 const isVertice = ! ( ( posCopy [ i ] . z - posCopy [ i + 1 ] . z ) * ( posCopy [ i + 1 ] . z - posCopy [ i + 2 ] . z ) > 0 ) ;
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 ] ) ;
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+ ) ;
524561
525562 if ( angle > 175 && ! isVertice ) {
526563 posCopy = posCopy . slice ( 0 , i + 1 ) . concat ( posCopy . slice ( i + 2 ) ) ;
@@ -555,7 +592,10 @@ export default class CommonFuncManager {
555592 static calcParabola ( options ) {
556593 // 方程 y=-(4h/L^2)*x^2+h h:顶点高度 L:横纵间距较大者
557594 const h = options . height && options . height > 5000 ? options . height : 5000 ;
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 ) ;
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 ) ;
559599 const num = options . num && options . num > 50 ? options . num : 50 ;
560600 const result = [ ] ;
561601 let dlt = L / num ;
@@ -713,7 +753,7 @@ export default class CommonFuncManager {
713753 });
714754 */
715755 createNavigationTool ( options ) {
716- this . viewer . extend ( Cesium . viewerCesiumNavigationMixin , options ) ;
756+ this . viewer . extend ( Cesium . NavigationTool , options ) ;
717757 return this . viewer . cesiumNavigation ;
718758 }
719759}
0 commit comments