@@ -142,8 +142,8 @@ describe('openlayers_Label', function () {
142142
143143 //创建专题要素
144144 it ( 'createThematicFeature' , function ( done ) {
145+ addFeatures ( ) ;
145146 setTimeout ( function ( ) {
146- addFeatures ( ) ;
147147 var feature = themeSource . labelFeatures [ 0 ] ;
148148 var thematicFeature = themeSource . createThematicFeature ( feature ) ;
149149 expect ( themeSource . features . length ) . toBeGreaterThan ( 0 ) ;
@@ -158,8 +158,8 @@ describe('openlayers_Label', function () {
158158
159159 //重绘所有专题要素
160160 it ( 'redrawThematicFeatures' , function ( done ) {
161+ addFeatures ( ) ;
161162 setTimeout ( function ( ) {
162- addFeatures ( ) ;
163163 var bounds = [ - 180 , - 90 , 90 , 180 ] ;
164164 themeSource . redrawThematicFeatures ( bounds ) ;
165165 expect ( themeSource ) . not . toBeNull ( ) ;
@@ -174,31 +174,31 @@ describe('openlayers_Label', function () {
174174
175175 //获取经(压盖)处理后将要绘制在图层上的标签要素
176176 it ( 'getDrawnLabels' , function ( done ) {
177+ addFeatures ( ) ;
177178 setTimeout ( function ( ) {
178- addFeatures ( ) ;
179- var labelFeatures = themeSource . labelFeatures ;
180- labelFeatures [ 0 ] . style . minZoomLevel = 4 ;
181- var feas = themeSource . getDrawnLabels ( labelFeatures ) ;
182- expect ( feas ) . not . toBeNull ( ) ;
183- expect ( feas . length ) . toBeGreaterThan ( 0 ) ;
184- for ( var i = 0 ; i < feas . length ; i ++ ) {
185- expect ( feas [ i ] . CLASS_NAME ) . toEqual ( "SuperMap.Feature.Vector" ) ;
186- expect ( feas [ i ] . attributes ) . not . toBeNull ( ) ;
187- expect ( feas [ i ] . geometry ) . not . toBeNull ( ) ;
188- expect ( feas [ i ] . geometry . CLASS_NAME ) . toEqual ( "SuperMap.Geometry.GeoText" ) ;
189- expect ( feas [ i ] . geometry . bounds ) . not . toBeNull ( ) ;
190- expect ( feas [ i ] . geometry . id ) . not . toBeNull ( ) ;
191- expect ( feas [ i ] . style ) . not . toBeNull ( ) ;
192- expect ( feas [ i ] . id ) . toContain ( "SuperMap.Feature_" ) ;
193- done ( ) ;
194- }
195- } , 1500 )
179+ var labelFeatures = themeSource . labelFeatures ;
180+ labelFeatures [ 0 ] . style . minZoomLevel = 4 ;
181+ var feas = themeSource . getDrawnLabels ( labelFeatures ) ;
182+ expect ( feas ) . not . toBeNull ( ) ;
183+ expect ( feas . length ) . toBeGreaterThan ( 0 ) ;
184+ for ( var i = 0 ; i < feas . length ; i ++ ) {
185+ expect ( feas [ i ] . CLASS_NAME ) . toEqual ( "SuperMap.Feature.Vector" ) ;
186+ expect ( feas [ i ] . attributes ) . not . toBeNull ( ) ;
187+ expect ( feas [ i ] . geometry ) . not . toBeNull ( ) ;
188+ expect ( feas [ i ] . geometry . CLASS_NAME ) . toEqual ( "SuperMap.Geometry.GeoText" ) ;
189+ expect ( feas [ i ] . geometry . bounds ) . not . toBeNull ( ) ;
190+ expect ( feas [ i ] . geometry . id ) . not . toBeNull ( ) ;
191+ expect ( feas [ i ] . style ) . not . toBeNull ( ) ;
192+ expect ( feas [ i ] . id ) . toContain ( "SuperMap.Feature_" ) ;
193+ done ( ) ;
194+ }
195+ } , 2000 )
196196 } ) ;
197197
198198 //根据用户数据(feature)设置专题要素的 Style
199199 it ( 'getStyleByData' , function ( done ) {
200+ addFeatures ( ) ;
200201 setTimeout ( function ( ) {
201- addFeatures ( ) ;
202202 var feat = themeSource . labelFeatures [ 0 ] ;
203203 var featStyle = themeSource . getStyleByData ( feat ) ;
204204 expect ( featStyle ) . not . toBeNull ( ) ;
@@ -212,8 +212,8 @@ describe('openlayers_Label', function () {
212212
213213 //设置标签要素的Style
214214 it ( 'setLabelsStyle' , function ( done ) {
215+ addFeatures ( ) ;
215216 setTimeout ( function ( ) {
216- addFeatures ( ) ;
217217 var labelFeatures = themeSource . labelFeatures ;
218218 var labelFeas = themeSource . setLabelsStyle ( labelFeatures ) ;
219219 expect ( labelFeas ) . not . toBeNull ( ) ;
@@ -233,8 +233,8 @@ describe('openlayers_Label', function () {
233233
234234 //设置标签要素的Style
235235 it ( 'setStyle' , function ( done ) {
236+ addFeatures ( ) ;
236237 setTimeout ( function ( ) {
237- addFeatures ( ) ;
238238 var feat = themeSource . labelFeatures [ 0 ] ;
239239 var feature = themeSource . setStyle ( feat ) ;
240240 expect ( feature ) . not . toBeNull ( ) ;
@@ -251,8 +251,8 @@ describe('openlayers_Label', function () {
251251
252252 //获取标签要素的像素坐标
253253 it ( 'getLabelPxLocation' , function ( done ) {
254+ addFeatures ( ) ;
254255 setTimeout ( function ( ) {
255- addFeatures ( ) ;
256256 var feature = themeSource . labelFeatures [ 0 ] ;
257257 feature . style . labelXOffset = 1 ;
258258 feature . style . labelYOffset = 1 ;
@@ -266,8 +266,8 @@ describe('openlayers_Label', function () {
266266
267267 //获得标签要素的最终范围 默认getPxBoundsMode = 0
268268 it ( 'calculateLabelBounds_getPxBoundsMode = 0' , function ( done ) {
269+ addFeatures ( ) ;
269270 setTimeout ( function ( ) {
270- addFeatures ( ) ;
271271 var feature = themeSource . labelFeatures [ 0 ] ;
272272 var location = themeSource . getLabelPxLocation ( feature ) ;
273273 var boundsQuad = themeSource . calculateLabelBounds ( feature , location ) ;
@@ -284,8 +284,8 @@ describe('openlayers_Label', function () {
284284
285285 //获得标签要素的最终范围 getPxBoundsMode = 1
286286 it ( 'calculateLabelBounds_getPxBoundsMode = 1' , function ( done ) {
287+ addFeatures ( ) ;
287288 setTimeout ( function ( ) {
288- addFeatures ( ) ;
289289 themeSource . getPxBoundsMode = 1 ;
290290 var feature = themeSource . labelFeatures [ 0 ] ;
291291 feature . style . labelXOffset = 1 ;
@@ -304,8 +304,8 @@ describe('openlayers_Label', function () {
304304
305305 //获得标签要素的最终范围的另一种算法
306306 it ( 'calculateLabelBounds2' , function ( done ) {
307+ addFeatures ( ) ;
307308 setTimeout ( function ( ) {
308- addFeatures ( ) ;
309309 var feature = themeSource . labelFeatures [ 0 ] ;
310310 var location = themeSource . getLabelPxLocation ( feature ) ;
311311 feature . style . fontStyle = "italic" ;
@@ -379,8 +379,8 @@ describe('openlayers_Label', function () {
379379
380380 //根据当前位置获取绘制后的标签信息,包括标签的宽,高和行数等
381381 it ( 'getLabelInfo' , function ( done ) {
382+ addFeatures ( ) ;
382383 setTimeout ( function ( ) {
383- addFeatures ( ) ;
384384 var feature = themeSource . labelFeatures [ 0 ] ;
385385 var location = feature . geometry . getCentroid ( ) ;
386386 var style = feature . style ;
@@ -396,8 +396,8 @@ describe('openlayers_Label', function () {
396396
397397 //旋转bounds
398398 it ( 'rotationBounds' , function ( done ) {
399+ addFeatures ( ) ;
399400 setTimeout ( function ( ) {
400- addFeatures ( ) ;
401401 var feature = themeSource . labelFeatures [ 0 ] ;
402402 var bounds = new SuperMap . Bounds ( 50 , 30 , 30 , 50 ) ;
403403 var rotationCenterPoi = themeSource . getLabelPxLocation ( feature ) ;
0 commit comments