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

Standard OpenLayers controls #95

Open
10 tasks
ghettovoice opened this issue Oct 29, 2018 · 12 comments
Open
10 tasks

Standard OpenLayers controls #95

ghettovoice opened this issue Oct 29, 2018 · 12 comments
Assignees

Comments

@ghettovoice
Copy link
Owner

ghettovoice commented Oct 29, 2018

Currently VueLayers doesn't has any components for OpenLayers standard controls. And the only way
to work with them is through underlying ol.Map instance of the vl-map component.
The main goal is to implement an all standard controls to easily work with them as Vue components:

Also an basic control mixin as a base type for all controls should be implemented to allow easy extending.

Usage example:

// by default nothing is enabled
<vl-map ...></vl-map>

// map with default set  of controls
<vl-map ...>
  <vl-control-default-set ...></vl-control-default-set>
</vl-map>

// map with custom controls markup
<vl-map ...>
  <vl-control-zoom ...></vl-control-zoom>
  <vl-control-scale-line ...></vl-control-scale-line>
  ...
</vl-map>
@ghettovoice ghettovoice self-assigned this Oct 29, 2018
@ghettovoice ghettovoice added this to the v0.12.0 milestone Oct 29, 2018
@PeterC66
Copy link

I have just noticed with v0.11.0-rc.5 that the attribution control is not collapsed and not collapsible. I think that in previous versions it was both collapsed and collapsible. This may be because of something I have done.

It is not much of an issue for me as I know how to change it, so no action needed from you. In any case I see that in this issue you are intending to make it easier to specify, so I can wait for v0.12,

@ghettovoice
Copy link
Owner Author

Thanks @PeterC66 ! I'll take this into account

@stale
Copy link

stale bot commented May 5, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@Swizz
Copy link

Swizz commented Sep 26, 2019

Before you work on the implementaiton of this one.
Can you please allow to provide a Controls Collection to the vl-map controls property ? (same for an Interactions Collection) src/component/map/map.vue#L349-L351

To at least be able to use the following as controls :

import {defaults as defaultControls, ScaleLine} from 'ol/control.js';

...
  data() {
    return {
      controls: defaultControls().extend([
        scaleLineControl
      ]),
    }
  }

@ghettovoice
Copy link
Owner Author

Ok, I'll make this, for a while this is a suitable solution

@Swizz
Copy link

Swizz commented Oct 2, 2019

Possible release ? 😃

ghettovoice added a commit that referenced this issue Oct 3, 2019
- resolved #132 #224 #225 #226, #230
- simplified initial interaction/controls setup #95
- added `id` property for all ol components for easy identification
- mixins, ol-ext and rx-ext now are build to single file package,
  imports from those packages are not changed
- UMD version (dev/demo version) now includes all used stuff from `ol`
  package
ghettovoice added a commit that referenced this issue Oct 3, 2019
- resolved #173, #174, #201, #135, #216, #132 #224 #225 #226, #230
- merged of pull requests #160, #175, #180, #185, #188, #191, #206, #208,
  #212, #213, #215, #221, #227, #231
  Thanks to @baspeeters, @sjmallon, @janlazo, @categulario,
  @skymaze, @jemasfox, @owen-thurston, @agmt5989, @RemiDesgrange
- improved property watchers
- optional debug messages
- fixed broken UMD version
- simplified initial interaction/controls setup #95
- added `id` property for all ol components for easy identification
- mixins, ol-ext and rx-ext now are build to single file package,
  imports from those packages are not changed
- UMD version (dev/demo version) now includes all used stuff from `ol`
  package
- updated documentation and README
ghettovoice added a commit that referenced this issue Oct 3, 2019
- resolved #173, #174, #201, #135, #216, #132 #224 #225 #226, #230
- merged of pull requests #160, #175, #180, #185, #188, #191, #206, #208,
  #212, #213, #215, #221, #227, #231
  Thanks to @baspeeters, @sjmallon, @janlazo, @categulario,
  @skymaze, @jemasfox, @owen-thurston, @agmt5989, @RemiDesgrange
- improved property watchers
- optional debug messages
- fixed broken UMD version
- simplified initial interaction/controls setup #95
- added `id` property for all ol components for easy identification
- mixins, ol-ext and rx-ext now are build to single file package,
  imports from those packages are not changed
- UMD version (dev/demo version) now includes all used stuff from `ol`
  package
- updated documentation and README
@ghettovoice
Copy link
Owner Author

Release as v0.11.5, please upgrade

@Swizz
Copy link

Swizz commented Oct 4, 2019

Works like a charm, big thanks

@ghettovoice ghettovoice removed this from the Next milestone Oct 5, 2019
@iboates
Copy link

iboates commented Dec 6, 2022

@ghettovoice I have version 0.12.6 and adding adding <vl-control-scale-line></vl-control-scale-line> just results in an unknown component. Has this changed since 0.11.5?

@ghettovoice
Copy link
Owner Author

Hello @iboates ,

No, vuelayers still hasn't separate control components like vl-control-.... . But you still can append any OpenLayers controls in created event handler.

<vl-map @created="mapCreated">...</vl-map>

mapCreated (mapVm) {
  mapVm.addControls(
    new ScaleLine(...),
    new ....,
  )
}

@iboates
Copy link

iboates commented Dec 7, 2022

Thank you. How do you import it? I have imported it as

import { ScaleLine } from 'ol/control';

But then I get

AssertionError: value is an instance of Control

...

// in methods
mapCreated (mapVm) {
      mapVm.addControls(
        new ScaleLine({
          units: "metric",
          minWidth: 140,
        })
      )

@ghettovoice
Copy link
Owner Author

ghettovoice commented Dec 8, 2022

sorry, I found an error in my example. You should pass array to addControls method:

mapVm.addControls([
    new ScaleLine(...),
    new ....,
  ])

To add single control you can use: mapVm.addControl(new ScaleLine())

UPD:
your import of control is correct

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

No branches or pull requests

4 participants