Andreas,

I spent about an hour this morning reading through some more of the
Javadoc, source code, and information that Stefan put on the wiki. I
think I have a possible solution to your problem.

Don't extend the StandardReaderWriterFileDataSource class. This class
was used to adapt the old JUMPReader/JUMPWriter interfaces to the new
DataSource framework that was introduced into OpenJUMP.

I think you should do this instead:

[1] Implement the Connection interface and extend the DataSource class
to use this Connection implementation.
[2] Create a PlugIn implementation that allows the user to activate
input and output to and from your file type via the GUI. For example,
the execute method of your plug-in might do the following:

- Display a dialog that allows the user to browse for a MapInfo file.
- Create an instance of your DataSource extension from which it
obtains an instance of your Connection implementation.
- Obtain a FeatureCollection from your Connection implementation.
- Create a Layer that wraps the newly created FeatureCollection.
- Style this Layer using information in the MapInfo file.
- Add this new Layer to the current Task.

If you use a plug-in to do the two (2) steps outlined above you will
have access to the PlugInContext and the rest of the application.

In summary, if we use a PlugIn class and the new DataSource and
Connection interfaces I don't think we need to make any modifications
to the core. No additional hooks are needed.

Do NOT implement JUMPReader and JUMPWriter, as this is deprecated
code. Try to use DataSource and Connection instead.

You might also look into the AbstractLoadDatasetPlugIn and
AbstractSaveDatasetPlugIn classes. I didn't get to review them in
detail, but I believe the automatically install support for a new
DataSource/Connection implementation. (Stefan mentioned
LoadDatasetFromFilePlugIn and SaveDatasetAsFilePlugIn classes in his
tutorial, but I didn't see them listed in the OpenJUMP Javadoc.)

I put some notes here:

http://openjump.org/wiki/show/File+DataSource+Notes

Please let me know what solution you end up using. I hope to add
support for GPX files this summer, so I am very interested in how this
will work out. (Chris and I will also need to add support for some
type of TIN file.)

After I get a better handle on how new file formats should be
implemented I will try to extend or add material to Stefan's tutorial.

The Sunburned Surveyor

P.S. - You can read Stefan's tutorial on adding input and output
support for new file formats to JUMP here: LoadDatasetFromFilePlugIn
and SaveDatasetAsFilePlugIn.




On Wed, Jun 4, 2008 at 12:45 AM, Andreas Schmitz <[EMAIL PROTECTED]> wrote:
> Sunburned Surveyor wrote:
>
> Hi,
>
>> I did a little reading in the old JUMP Developer Guide and the
>> OpenJUMP Javadoc. I was wondering if you could indicate to me which
>> method is used to obtain the FeatureCollection from the DataSource. Is
>> it the installCoordinateSystem method? I see that it returns a
>> FeatureCollection, but it seems like an odd name. I was expecting to
>> find a getFeatureCollection method or something similar.
>
> I'm currently using the following mechanism. I extend the class
>
> com.vividsolutions.jump.io.datasource.StandardReaderWriterFileDataSource
>
> as follows:
>
>    public static class DeeMapInfoFile extends 
> StandardReaderWriterFileDataSource {
>
>        public DeeMapInfoFile() {
>            super( new DeegreeMapInfoReader(), null, new String[] { "mid", 
> "mif" } );
>        }
>
>    }
>
> with the DeegreeMapInfoReader implementing the
> com.vividsolutions.jump.io.JUMPReader interface with the method
>
> public FeatureCollection read( DriverProperties dp )
>                            throws Exception;
>
> A solution would be to add an ExtendedJUMPReader with an additional method 
> that
> gets called with the layer or something later on. That would enable old 
> plugins
> to continue to work, and a simple instanceof tells us with which reader we're
> dealing.
>
> Best regards, Andreas
> --
> l a t / l o n  GmbH
> Aennchenstrasse 19           53177 Bonn, Germany
> phone ++49 +228 18496-12     fax ++49 +228 1849629
> http://www.lat-lon.de        http://www.deegree.org
>
> -------------------------------------------------------
> On June 17 is deegree day - Am 17. Juni ist deegree day
>              http://deegree.org/deegreeday
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFIRkf8737OVr+Ru7oRAgzsAJ4y6rf0j1WdMzKXRzT4/Km9heD/jgCfS/T0
> Did4MkyyfwjXwgjYIImdLpw=
> =Bpnx
> -----END PGP SIGNATURE-----
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to