Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Features and Options #285

Merged
merged 5 commits into from
Feb 15, 2014
Merged

New Features and Options #285

merged 5 commits into from
Feb 15, 2014

Conversation

elesdoar
Copy link
Contributor

Hi,

This commit have:

  • Support for esri-leaflet DynamicMapLayer
  • Support for ESRI Legend Service.
  • Support for custom layers control.
  • New options for layer controller:
controlLayersPosition  //removed

// New options
controlLayers: {
    position:'topright',
    control: L.control.layers,
    collapsed: true
}

With these new options, the control layer can be any plugin that extends L.Control.Layer.

Hope you like it 👍

@tombatossals
Copy link
Owner

Wow, fantastic addition!

Thanks so much for sharing @elesdoar!

tombatossals added a commit that referenced this pull request Feb 15, 2014
@tombatossals tombatossals merged commit 5d7e4c0 into tombatossals:master Feb 15, 2014
@tombatossals
Copy link
Owner

Hi, I have modified a little the layers control, let me explain about this.

First of all, I have created a new configuration section controls where we could put every new control that we want to support on the directive. You can take a look here: https://github.com/tombatossals/angular-leaflet-directive/blob/master/src/services/leafletMapDefaults.js#L13

            controls: {
                layers: {
                    visible: true,
                    position:'topright',
                    collapsed: true
                }
            },

Furthermore, I have made all the parameteres declarative, I think its better not to relay on Leaflet object on the controller layer, so we must avoid any declaration similar to this:

controls: {
    overlay: L.Control();

It's better to wrap the syntax, make it more declarative, and create the Leaflet objects inside the leaflet-library.

I haven't been able to automatically remove the layerControl of the map when there is only one layer left. I have to take a closer look at this. I have disabled the removeControlLayer funcionality, as you can see there: https://github.com/tombatossals/angular-leaflet-directive/blob/master/src/services/leafletControlHelpers.js#L20

That said, your patch is fantastic, thanks so much.

I'm thinking about making a controls attribute where we could add more plugin-controls like autodiscover, zoom, etc. What do you think about it? Something like:

angular.extend($scope, {
    controls: {
        autodiscover: {
            active: true,
            position: bottomright
        },
        layers: {
            active: false
        }
}
<leaflet controls="controls" layers="layers"></leafet>

@elesdoar
Copy link
Contributor Author

I think it's a good idea. By the way, I thought of doing something similar. Although I've been busy these days, I'll work on it soon.

tombatossals added a commit that referenced this pull request Feb 23, 2014
@tombatossals
Copy link
Owner

I finally managed to get working the add/remove of the layersControl if baselayers+overlays <= 1. I have created a demo to:

http://tombatossals.github.io/angular-leaflet-directive/examples/layers-add-remove.html

Thanks for your work @elesdoar

@JaumeFigueras
Copy link
Contributor

Hello,
that's great!! I'm still lrearning how many awesome additions all of you have created. I also think it will be very interesting to add to the layer a 'visibleInControl':true|false parameter in order to add it to the layer control or not. So if the paramter is not present the layer is added to the control and if present added or removed accordingly.
Also add support for the other controls.
If you don't mind I'm auto assigning this task.

@elesdoar
Copy link
Contributor Author

Great Idea!!! Thanks

@JohnLindahlTech
Copy link
Contributor

This is all great and stuff! The only thing is, whats the final way of actually moving the Layers-controller to the bottomright-position?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants