app/assets/javascripts/gmaps4rails/gmaps4rails.openlayers.js.coffee in gmaps4rails-1.5.0.pre vs app/assets/javascripts/gmaps4rails/gmaps4rails.openlayers.js.coffee in gmaps4rails-1.5.0.pre2
- old
+ new
@@ -55,16 +55,16 @@
style_mark.fillOpacity = 1
#//creating markers' dedicated layer
if (@markersLayer == null)
@markersLayer = new OpenLayers.Layer.Vector("Markers", null)
- @map.addLayer(@markersLayer)
+ @serviceObject.addLayer(@markersLayer)
#//TODO move?
@markersLayer.events.register("featureselected", @markersLayer, @onFeatureSelect)
@markersLayer.events.register("featureunselected", @markersLayer, @onFeatureUnselect)
@markersControl = new OpenLayers.Control.SelectFeature(@markersLayer)
- @map.addControl(@markersControl)
+ @serviceObject.addControl(@markersControl)
@markersControl.activate()
#//showing default pic if none available
if args.marker_picture == ""
#style_mark.graphicWidth = 24
style_mark.graphicHeight = 30
@@ -105,11 +105,11 @@
@clearMarkersLayerIfExists()
@markersLayer = null
@boundsObject = new OpenLayers.Bounds()
clearMarkersLayerIfExists: ->
- @map.removeLayer(@markersLayer) if @markersLayer != null and @map.getLayer(@markersLayer.id) != null
+ @serviceObject.removeLayer(@markersLayer) if @markersLayer != null and @serviceObject.getLayer(@markersLayer.id) != null
extendBoundsWithMarkers: ->
for marker in @markers
@boundsObject.extend(@createLatLng(marker.lat,marker.lng))
@@ -146,11 +146,11 @@
"select":
fillColor: "#8aeeef"
strokeColor: "#32a8a9"
@clearMarkersLayerIfExists()
- @map.addLayer(clusters)
+ @serviceObject.addLayer(clusters)
clusters.addFeatures(markers_array)
return clusters
clusterize: ->
@@ -162,11 +162,11 @@
for marker in @markers
markers_array.push(marker.serviceObject)
@markerClusterer = @createClusterer markers_array
clearClusterer: ->
- @map.removeLayer @markerClusterer
+ @serviceObject.removeLayer @markerClusterer
#////////////////////////////////////////////////////
#/////////////////// INFO WINDOW ////////////////////
#////////////////////////////////////////////////////
@@ -185,25 +185,25 @@
new OpenLayers.Size(300,200),
feature.infoWindow,
null, true, @onPopupClose)
feature.popup = popup
popup.feature = feature
- @map.addPopup popup
+ @serviceObject.addPopup popup
onFeatureUnselect: (evt) ->
feature = evt.feature
if feature.popup
#//popup.feature = null;
- @map.removePopup feature.popup
+ @serviceObject.removePopup feature.popup
feature.popup.destroy()
feature.popup = null
# #////////////////////////////////////////////////////
# #/////////////////// Other methods //////////////////
# #////////////////////////////////////////////////////
fitBounds: ->
- @map.zoomToExtent(@boundsObject, true)
+ @serviceObject.zoomToExtent(@boundsObject, true)
centerMapOnUser: ->
- @map.setCenter @userLocation
+ @serviceObject.setCenter @userLocation