quentinlampin / ngx-openlayers

Angular2+ components for Openlayers 4.x
Mozilla Public License 2.0
137 stars 98 forks source link

Support multiple styles. #177

Open Nols1000 opened 6 years ago

Nols1000 commented 6 years ago

Hi,

While migrating to this project from a self written solution, I discoverd a limitation of the feature-component. It is only able to have one style while Openlayers supports to set an array of styles https://openlayers.org/en/latest/apidoc/ol.Feature.html#setStyle. In the example code below you can see how I expected it to work.

Example Code:

...
<aol-style>
    <aol-style-text
        [text]="First Text">
        <aol-style-fill color="#FFFFFF"></aol-style-fill>
    </aol-style-text>
<aol-style>
<aol-style>
    <aol-style-text
        [text]="ScondText"
        [offsetY]="-25">
        <aol-style-fill color="#FFFFFF"></aol-style-fill>
    </aol-style-text>
<aol-style>
...
aymeric-duchein commented 5 years ago

Hi! I found the guilty here : this.host.instance.setStyle(this.instance); @style.component.ts in ngOnInit. This should check for existing Style before overriding them. Can you make the changes or should we do it?

Nols1000 commented 5 years ago

Could you take a look at my PR #178.

aymeric-duchein commented 5 years ago

@davinkevin @Yakoust can one of you take a look?

HarelM commented 5 years ago

Any updates on this? I'm in need of the ability to set a feature style using a style or a style function. @Nols1000 @kekel87 are you maintaining a fork with your added functionality? I'm having a hard time understanding why a lot a pull requests here are not merged to this repository... I'll be using this library in production and I'd love to help out maintaining and testing but this repository seems abandoned as there was no commit to stable since July...

Nols1000 commented 5 years ago

@HarelM I wont maintain my fork.

HarelM commented 5 years ago

My bad, next version is constantly updated. @davinkevin @Neonox31 any chance to get this feature to the next branch? Or even an @Input for style in VectorLayerComponent to set a custom style function?

HarelM commented 5 years ago

I've sent a pull request that I think can help with this issue as well: #216