[geGIS] [Majas-dev] Majas Circle Drawing Tool
Pieter De Graef
pieter op dfc.be
Wo Apr 30 09:08:07 CEST 2008
Hi Chris,
If you want user interaction, you'll have to implement the MouseListener
(often called controllers) interface, and perhaps create a ToolbarTool to
activate your MouseListener.
You also have to register your new tool on client and server side. Server
side this happens in your applications xml files. (see
applications/samples/tools.xml and applications/samples/toolbar.xml). On the
client side, this happens in the gegis.config.factories.ToolbarFactory
class.
In your ToolbarTool, you can simply activate a MouseListener on the map
(like many of the tools do).
In your MouseListener, you have to implement the actual code for user
interaction, in your case drawing circles. You can look at the
editing-controllers to guide you in different aspects (such as the use of a
rightmouse menu). The drawing of a Circle itself is not to difficult. There
is a circle object (under majas.gfx.paintables), and there is a
CirclePainter which is automatically registered on each Map. So all you have
to do, is create a Circle object, and publish it on the rendering topic.
Like Dirk said, you can see how this is done in the
majas.controller.MeasureDistanceController
Small abstract:
var circle = new Circle ("measureDistance.Circle");
circle.setStyle(new ShapeStyle("#FFFFFF", "0", "#333333", "0.5", "1",
null, null));
circle.setPosition(lastCoordinate);
circle.setR(r);
dojo.publish (this.mapWidget.getRenderTopic(), [this.circle, "all"]);
Now one important choice you can make here, is whether to draw in screen
space of world space. The above code will render your circle in world space.
This means that is uses the coordinate system as specified in the Map's
configuration (see applications/samples/maps.xml).
If you want to draw, using screen coordinates (like the scalebar), you have
to give your Circle an id that starts with "view.", like this:
var circle = new Circle ("view.measureDistance.Circle");
Hope this helps.
Greets,
Pieter De Graef
DFC Software Engineering
Brugsesteenweg 587
B-9030 Gent
Belgium
T: +32 9 236 61 96
F: +32 9 236 54 12
E: <mailto:pieter.degraef op dfc.be> pieter.degraef op dfc.be
W: www.dfc.be <http://www.dfc.be/>
_____
From: majas-dev-bounces op majas.dfc.be [mailto:majas-dev-bounces op majas.dfc.be]
On Behalf Of Dirk Frigne
Sent: dinsdag 29 april 2008 21:42
To: 'Chris Exline'; list op gegis.org
Cc: majas-dev op majas.dfc.be
Subject: Re: [Majas-dev] [geGIS] Majas Circle Drawing Tool
Hi Chris,
There is an example of it in the 'more complex example' example.
(http://majas.dfc.be/majas-1.2/applications/samples/html/7.html)
If you select the measure tool and press the control button while measuring,
then a circle is drawn on the screen.
The code should be adapted a little bit to create the circle as a complex
feature, but I think you can look at this part to have an idea to start
implementing it.
For the moment we are focusing on the basic architecture of MAJAS, but new
features are more than welcome!
f.y.i. there are also specific mailing lists for majas developers. I
forewarded your mail to that mailing list.
sincerly,
Dirk Frigne
E: <mailto:dirk.frigne op dfc.be> dirk.frigne op dfc.be
http://majas.dfc.be
Van: list-bounces op gegis.org [mailto:list-bounces op gegis.org] Namens Chris
Exline
Verzonden: vrijdag 25 april 2008 17:04
Aan: list op gegis.org
Onderwerp: [geGIS] Majas Circle Drawing Tool
I'm investigating using Majas for a project and one of the requirements that
I have is to allow the user to draw an Circle on the screen. This would work
much like the current ability for the user to create polygons on the map.
I've searched the mailing lists, the javadoc and the examples, but I don't
see a reference to this capability. Does it exist? If not, is there any
examples of how I would implement it?
Thanks,
Chris Exline
------------- volgend deel ------------
Een HTML-bijlage is verwijderd...
URL: http://www.gegis.org/pipermail/list/attachments/20080430/0590f7ae/attachment.htm
Meer informatie over de List
maillijst