Sha256: 52005ab32a3dbcf8a2fb49c0ce7fd749ff6a8d2f557fbe7853a5daf071d29f12

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

class L.IndexedGeoJSON extends L.GeoJSON

  constructor: (geojson, options) ->
    @_onEachFeature = options.onEachFeature

    onEachFeature = (geojson, layer) ->
      layer.on 'add', =>
        @indexLayer layer
      layer.on 'remove', =>
        @unindexLayer layer

      if @_onEachFeature
        @_onEachFeature geojson, layer

      return

    options.onEachFeature = L.Util.bind onEachFeature, @

    super geojson, options

L.IndexedGeoJSON.include L.LayerIndexMixin

class L.GhostIcon extends L.DivIcon
  options:
    iconSize: [20, 20]
    className: "plus-ghost-icon"
    html: ""

L.LayerGroup.include
  getLayerUUID: (layer) ->
    layer.feature.properties.uuid

  hasUUIDLayer: (layer) ->
    if !!layer && layerUUID = @getLayerUUID(layer)
      for id, l of @_layers
        if @getLayerUUID(l) == layerUUID
          return true
    return false

  getLayerID: (layer) ->
    layer.feature.properties.id

  hasIDLayer: (layer) ->
    if !!layer && layerID = @getLayerID(layer)
      for id, l of @_layers
        if @getLayerID(l) == layerID
          return true

  bindInit: (event, callback) ->
    unless @initialized && @initialized[event]
      @on event, callback, @
      @initialized[event] = true

  unbind: (event, callback) ->
    @off event, callback, @
    @initialized[event] = false

L.LayerGroup.addInitHook ->
  @initialized = {}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ekylibre-cartography-0.0.1 app/assets/javascripts/cartography/leaflet/layers.coffee