Dmitrii,

So we are finally ready to write some code for your first OpenJUMP plug-in!

There are a couple of different ways to approach the design of a
simple plug-in. In the first approach you cram all of your code in a
single class that extends the AbstractPlugInClass. In the second
approach (the approach that I like to take) you put the code that does
the heavy lifting for your plug-in in a supporting class or classes,
and you just use the extension of the AbstractPlugIn handle the
housekeeping and GUI.

So in your case I think we can likely get buy with two classes to start:

LineStringSimplifierPlugIn (Does the housekeeping.)
LineStringSimplifier (Does the heavy lifting.)

Actually, I think we should make LineStringSimplifier an interface so
we can swap out different implementations of a simplification
algorithm without too much trouble. For our first attempt at the
plug-in I'm going to place the following restrictions on our design so
we can keep things simple:

- We will obtain the LineStrings that will be simplified from the
SelectionManager. This will allow us to work with OpenJUMP's existing
code. There are other ways to let the user choose the LineStrings to
be simplified, but this will be the easiest way. With this method the
user will create the selection of LineStrings using the existing
slection tool, and we will work with the LineStrings in that
selection.

- We won't allow the user to control the simplification process with
any parameters. We are going to use some "default" parameters in our
algorithm. This restriction will eliminate the need for a GUI where
the user enters the parameter values. However, we will code our
LineStringSimplifier interface to accept parameters so we can add
support for them and a GUI entry form later if you want. We can use a
SimplificationParams class to pass the parameters to our algorithim.

If these restrictions don't make sense now, they will as we work
through this example. Be patient with me, and don't hesitate to ask a
lot of questions.

I put together a crude video where I create the first couple of
classes for the plug-in using Eclipse. See if you can follow my basic
steps. I need to do some editing of the video and I need to add some
voice-over. But it should help you to get started. You can download a
zip file of the video here:

http://www.redefinedhorizons.com/shared_files/create_first_plug-in_classes.zip

You also need to figure out the steps for our simplification
algorithim. If you want do things the correct way, do some research on
existing simplification algorithims. Stefan or Martin would be good
programmers to ask about this. If you want to do things the way I
typically operate whip up the steps to a home grown algorithim and we
will tweak it until it works. :]

The Sunburned Surveyor

P.S. - If we really get cooking on this I'll commit our code to the
SurveyOS or JPP SVN so we can work on it together and share it with
the other programmers. Have you ever worked with Subclipse? That might
be another tutorial video...

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to