"StyleLayers" based on one VectorLayer data.

21 views
Skip to first unread message

Ossi Rönnberg

unread,
Feb 8, 2012, 10:02:36 AM2/8/12
to openscales-dev
What would be the best practice when I have this one VectorLayer that
has the base data for all polygons and then I got these "StyleLayers"
which just can have different coloring styles based on same polygons
on from the main VectorLayer.

My problem now is that when I try to copy polygonfeatures to these
different stylelayers it will remove the features from the source
layer.

Mike C

unread,
Feb 13, 2012, 5:47:04 AM2/13/12
to openscales-dev
I am not really sure I follow you, but here goes nothing!

So you have a base Vector layer, I am assuming it has all the shapes/
lines whatever that you are interested in, then you want to "style"
that layer to render the polygons with a certain "style". i.e. you
want all your polygons to be be green now, or red now, or something?

And in order to achieve this you are trying to copy the
polygonfeatures from one layer to another?

I don't exactly know what your req's are, but have you looked at the
Styling API functionality of OS. The styling functionality of a given
feature layer, is quite powerful, you can use filtering to render
whatever features in your base layer in whatever styles you need.
Without the need for "StyleLayers" ? I mean you could change the
style and redraw the layer?

I am sorry if I am not answering your question.

A more literal answer to your question might be the method.

org.openscales.core.feature.PolygonFeature.clone():Feature

I haven't tested it myself but I would imagine if you used this when
you are copying your "polygonfeatures" you might not have the problem
of features being moved instead of copied between layers.

Good luck!

-Mike
Reply all
Reply to author
Forward
0 new messages