Custom marker graphics

50 views
Skip to first unread message

Zantagor

unread,
Jun 7, 2010, 10:30:07 AM6/7/10
to openscales-dev
Hi,

Quick question, I've been trying to figure out how to display custom
markers instead of the default one, but I fail to see who to do this.

Right now, the style of the WFS is set by using
Style.getDefaultPointStyle();

anyone has any sample on how I would go to change this to display
something else for the point? This seems to be one area where samples
are lacking.

Bernard Pavkovic

unread,
Jun 30, 2010, 8:32:49 AM6/30/10
to openscales-dev
Take a look at the http://groups.google.com/group/openscales-dev/browse_thread/thread/be2ea0fdbf0bedc9#
There are also some other posts in the archive about this.
Regarding the shape of marker by default is drawn from WellKnownMarker
class and there are 2 more shapes implemented (square and triangle) -
there are consts for other marker types but are not implemented yet
(as far as I see from the source code).
To change the way layer is shown you should change layer style - or
actually it's rules. As far as I understand OS (and that is not
much :D) Style.getDefaultPointStyle() will generate default rule with
point symbolizers and place it on first place of array. You can change
that or you can generate new style or symolizers for that rule. For
example:
var s:Style = Style.getDefaultSurfaceStyle();
s.rules[0].symbolizers = new Array();
s.rules[0].symbolizers.push(new PointSymbolizer(new
WellKnownMarker(...)));

David Hu

unread,
Jul 8, 2010, 2:15:39 PM7/8/10
to openscales-dev
I have a similar question. I've looked through the archives but can't
seem to find any answers.

Is there any way to use images (GIF, JPG, PNG, etc.) as Markers? I've
played around with DisplayObjectMarker but can't seem to get anything
to work. DisplayObjectMarker takes a class as its first argument, but
I'm not sure what this means. I tried the following, but it does not
work:

[Embed(source="graphic.gif")]
private var imgClass:Class;
(style.rules[0] as Rule).symbolizers.push(new PointSymbolizer(new
DisplayObjectMarker(imgClass)));

Nothing shows up. I've also played around with IconUtilityPlus, but I
also didn't get far. Any help?

On Jun 30, 8:32 am, Bernard Pavkovic <bern...@gmail.com> wrote:
> Take a look at thehttp://groups.google.com/group/openscales-dev/browse_thread/thread/be...
Reply all
Reply to author
Forward
0 new messages