@@ -5,7 +5,7 @@ require('../../../src/common/util/FetchRequest');
55url = "http://supermapiserver:8090/iserver/services/map-china400/rest/maps/China_4326" ;
66describe ( 'openlayers_GraphicLayer' , function ( ) {
77 var originalTimeout ;
8- var testDiv , map , graphicLayer , graphicSource ;
8+ var testDiv , map , graphicLayer ;
99 var FetchRequest = SuperMap . FetchRequest ;
1010 var coors = [
1111 [ - 35.16 , 38.05 ] ,
@@ -66,11 +66,11 @@ describe('openlayers_GraphicLayer', function () {
6666 graphics [ j ] = new ol . Graphic ( new ol . geom . Point ( coors [ j ] ) ) ;
6767 graphics [ j ] . setStyle ( randomCircleStyles ) ;
6868 }
69- var clone = graphics [ 0 ] . clone ( ) ;
69+ var clone = graphics [ 0 ] . clone ( ) ;
7070 expect ( clone . getId ( ) ) . toEqual ( graphics [ 0 ] . getId ( ) ) ;
7171 expect ( clone . getGeometry ( ) ) . toEqual ( graphics [ 0 ] . getGeometry ( ) ) ;
7272 expect ( clone . getStyle ( ) ) . toEqual ( graphics [ 0 ] . getStyle ( ) ) ;
73- clone . destory ( ) ;
73+ clone . destroy ( ) ;
7474 graphicLayer = new ol . layer . Image ( {
7575 source : new ol . source . Graphic ( {
7676 graphics : graphics ,
@@ -212,28 +212,27 @@ describe('openlayers_GraphicLayer', function () {
212212 } )
213213 expect ( hitCloverShape . getSAngle ( ) ) . toEqual ( 30 ) ;
214214 expect ( hitCloverShape . getEAngle ( ) ) . toEqual ( 60 ) ;
215- graphicSource = new ol . source . Graphic ( {
216- graphics : graphics ,
217- map : map ,
218- onclick : function ( result ) {
219- console . log ( result ) ;
220- } ,
221- highLightStyle : hitCloverShape
222- } )
223215 graphicLayer = new ol . layer . Image ( {
224- source : graphicSource
216+ source : new ol . source . Graphic ( {
217+ graphics : graphics ,
218+ map : map ,
219+ onclick : function ( result ) {
220+ console . log ( result ) ;
221+ } ,
222+ highLightStyle : hitCloverShape
223+ } )
225224 } ) ;
226225 map . addLayer ( graphicLayer ) ;
227226 } ) ;
228227 setTimeout ( function ( ) {
229228 expect ( 1 ) . not . toBeNull ( ) ;
230- graphicSource . forEachFeatureAtCoordinate ( coors [ 2 ] , 1 , function ( result ) {
229+ graphicLayer . getSource ( ) . forEachFeatureAtCoordinate ( coors [ 2 ] , 1 , function ( result ) {
231230 console . log ( result ) ;
232231 } ) ;
233- graphicSource . forEachFeatureAtCoordinate ( coors [ 1 ] , 1 , function ( result ) {
232+ graphicLayer . getSource ( ) . forEachFeatureAtCoordinate ( coors [ 1 ] , 1 , function ( result ) {
234233 console . log ( result ) ;
235234 } ) ;
236- graphicSource . forEachFeatureAtCoordinate ( [ - 126.16 , 39.05 ] , 1 , function ( result ) {
235+ graphicLayer . getSource ( ) . forEachFeatureAtCoordinate ( [ - 126.16 , 39.05 ] , 1 , function ( result ) {
237236 console . log ( result ) ;
238237 } ) ;
239238 map . removeLayer ( graphicLayer ) ;
0 commit comments