Hi SS,
I basically came to the same conclusions. I looked into implementing an
XML pull parser version, but never got started. I managed to eventually
hack up a KML Reader that kind of worked (it took me more than 20 hours),
and I wasn't sure how much demand there would be for a better one. I found
ut that it was fantastically easy to break the current GMLReader. Almost
any change I made caused it go into the wrong state and then it was lost.
I have had pretty good luck with pull parsers in other software, but this
is not an easy problem. Personally, I wouldn't waste much time solving it
unless someone can justify a credible use case.
regards,
Larry
On Thu, Nov 20, 2008 at 2:15 PM, Sunburned Surveyor <
[EMAIL PROTECTED]> wrote:
> I couldn't help myself, and I looked at the code over the code for
> GMLReader over my lunch break. Larry is correct, the code is pretty
> gnarly. I believe the use of a state machine is caused by the fact
> that a SAX parser pushes xml events to the class. This problem could
> be avoided if you used something like JDOM or an XML pull parser.
>
> The good news is I can fix the code to read linear rings. The bad news
> is it would take me probably 10 to 20 hours. I'd have to really dig
> into the class so I could understand what was going on. I think the
> code complex enough that if you just tried to add a few lines of code
> you'd dork something up.
>
> Here are the options, in my opinion:
>
> [1] Leave things as they are. The GMLReader class won't read
> LinearRings. Close the bug report.
> [2] Add support for reading linear rings to the exisitng GMLReader
> class. If I did this work I would probably reorganize all the stinking
> if statements and other conditional tests into some private methods so
> the class was easier to read and maintain. I'd also want to document
> the way the class works for the next fool that trys to fix a bug with
> GML import.
> [3] Write a new GMLReader class that uses an XML pull-parser. This
> would greatly simplify the class and make it easier to
> improve/maintain GML import. I think this would take about the same
> amount of time as understanding the existing class would take. I also
> think it would be possible to remove the need for an input template by
> automatically detecting the data type of attribute values. If I went
> this route I could allow the user to override this automatic data type
> detection with a simple properties file. I think removing the need for
> an input template would make GML 2.0 import a lot easier for the user.
>
> I'm looking for advice on the best way to proceed. Which option would
> benefit the community the most? If no one really cares about GML 2.0
> (I don't know how many of us are using it) then I will make my own
> decision and move forward.
>
> The Sunburned Surveyor
>
> On Thu, Nov 20, 2008 at 11:36 AM, Sunburned Surveyor
> <[EMAIL PROTECTED]> wrote:
> > Thanks for the files Larry. There are some comments on the state
> > machine in the Javadoc for the GMLReader class, but no diagram. I'm
> > sure you looked at this when you were attempting to make your KML
> > Reader.
> >
> > I'll take a peek at the code today after work I hope.
> >
> > SS
> >
> > On Thu, Nov 20, 2008 at 10:57 AM, Larry Becker <[EMAIL PROTECTED]>
> wrote:
> >> You can create LinearRings by using the Geometry Converter plugin. OJ
> >> supports writing LinearRings to GML, but not reading them. See the
> attached
> >> files. I have looked at the GMLReader code when morphing it into the
> KML
> >> Reader. It isn't going to be easy to modify, and has so far resisted
> all my
> >> attempts at making a KML Reader that supports Attributes. The code is a
> >> very complex state machine. What would help is the state diagram that
> was
> >> used to create the original code.
> >>
> >> regards,
> >> Larry
> >>
> >> On Thu, Nov 20, 2008 at 12:07 PM, Sunburned Surveyor
> >> <[EMAIL PROTECTED]> wrote:
> >>>
> >>> Martin,
> >>>
> >>> Thanks for your valuable input. I will look at the code, but I suspect
> >>> the best thing to do is to load LinearRings as LineStrings and ecplain
> >>> this behavior in the Javadoc.
> >>>
> >>> I'll report back to the list when I have a patch.
> >>>
> >>> SS
> >>>
> >>> On Thu, Nov 20, 2008 at 10:00 AM, Martin Davis <
> [EMAIL PROTECTED]>
> >>> wrote:
> >>> > Well, it's a valid geometry type in JTS, so it should work in OJ.
> There
> >>> > may be limitations in how it can be manipulated, however - e.g. I
> >>> > suspect that it can't be edited (or at least that if it is it will
> >>> > revert to a plain ol LineString).
> >>> >
> >>> > If this is a concern, another option is to load LinearRings as
> >>> > LineStrings. They should NOT be loaded as Polygons - LinearRings are
> >>> > not areas.
> >>> >
> >>> > Sunburned Surveyor wrote:
> >>> >> Martin,
> >>> >>
> >>> >> Is that a valid feature geometry type in OpenJUMP? I didn't know
> that
> >>> >> it was. If it is, then this probably is a bug that needs to get
> fixed.
> >>> >>
> >>> >> SS
> >>> >>
> >>> >> On Thu, Nov 20, 2008 at 9:06 AM, Martin Davis <
> [EMAIL PROTECTED]>
> >>> >> wrote:
> >>> >>
> >>> >>> Why not read the GML LinearRing into a JTS LinearRing?
> >>> >>>
> >>> >>> Sunburned Surveyor wrote:
> >>> >>>
> >>> >>>> Well, it seems from a "robustness" perspective that it would be
> good
> >>> >>>> to read in linear rings, even if they are always represented
> >>> >>>> internally and exported as polygons.
> >>> >>>>
> >>> >>>> I will wait for other programmers to comment on what they think
> the
> >>> >>>> best course is, then I will implement the needed changes.
> >>> >>>>
> >>> >>>> SS
> >>> >>>>
> >>> >>>> On Thu, Nov 20, 2008 at 8:38 AM, Andreas Schmitz <
> [EMAIL PROTECTED]>
> >>> >>>> wrote:
> >>> >>>>
> >>> >>>>
> >>> >>>>> Sunburned Surveyor wrote:
> >>> >>>>>
> >>> >>>>> Hi,
> >>> >>>>>
> >>> >>>>>
> >>> >>>>>
> >>> >>>>>> I'm working on one of the OJ 1.2 bugs I selected for squishing
> and
> >>> >>>>>> I
> >>> >>>>>> had a quick question.
> >>> >>>>>>
> >>> >>>>>> Is the GML reader in OpenJUMP supposed to read features
> represented
> >>> >>>>>> by
> >>> >>>>>> a LinearRing? I thought a LinearRing was only used as an
> exterior
> >>> >>>>>> or
> >>> >>>>>> interior boundary of a polygon. A user filed a bug report
> because a
> >>> >>>>>> feature geometry wasn't created from a LinearRing using JUMP's
> >>> >>>>>> GMLReader. But I'm thikning that this isn't a bug, but an
> improper
> >>> >>>>>> understanding of how feature geometries are represented in GML.
> A
> >>> >>>>>> feature should be represented by a polygon, not a linear ring.
> >>> >>>>>>
> >>> >>>>>> If GMLReader is supposed to construct a feature goemetry
> (polygon?)
> >>> >>>>>> from a linear ring, then I'll fix the bug. If GMLReader is not
> >>> >>>>>> supposed to do this, because it isn't the proper way to
> represent a
> >>> >>>>>> feature, then I will close the bug.
> >>> >>>>>>
> >>> >>>>>>
> >>> >>>>> I think in GML2 this is allowed:
> >>> >>>>>
> >>> >>>>> http://schemas.opengis.net/gml/2.1.2/geometry.xsd
> >>> >>>>>
> >>> >>>>> One can always wonder why anyone would want it, but some people
> >>> >>>>> apparently have
> >>> >>>>> use cases for everything... The problem that is inherent here is,
> if
> >>> >>>>> you read
> >>> >>>>> the linear ring in as a polygon, what happens when exporting as
> GML
> >>> >>>>> again? Will
> >>> >>>>> it be exported as polygon or as linear ring? Is every linear ring
> >>> >>>>> also a
> >>> >>>>> polygon? I suppose not, as there are almost no restrictions on
> the
> >>> >>>>> form of a
> >>> >>>>> linear ring, but many (such as orientation of the rings, self
> >>> >>>>> intersections
> >>> >>>>> etc.) on polygons.
> >>> >>>>>
> >>> >>>>> I'm unsure on how to solve this problem though, the better you
> want
> >>> >>>>> to solve it,
> >>> >>>>> the more work it is obviously.
> >>> >>>>>
> >>> >>>>> 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
> >>> >>>>>
> >>> >>>>> -----BEGIN PGP SIGNATURE-----
> >>> >>>>> Version: GnuPG v1.4.9 (GNU/Linux)
> >>> >>>>>
> >>> >>>>> iEYEARECAAYFAkklkpUACgkQ737OVr+Ru7pgtACg5bMBBMLlo3wNsiXw7D+BB0tz
> >>> >>>>> OG8AoJc+QpDAnPZ2NTA+K//fxBcsCHI7
> >>> >>>>> =9hXg
> >>> >>>>> -----END PGP SIGNATURE-----
> >>> >>>>>
> >>> >>>>>
> >>> >>>>>
> -------------------------------------------------------------------------
> >>> >>>>> This SF.Net email is sponsored by the Moblin Your Move
> Developer's
> >>> >>>>> challenge
> >>> >>>>> Build the coolest Linux based applications with Moblin SDK & win
> >>> >>>>> great prizes
> >>> >>>>> Grand prize is a trip for two to an Open Source event anywhere in
> >>> >>>>> the world
> >>> >>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >>> >>>>> _______________________________________________
> >>> >>>>> Jump-pilot-devel mailing list
> >>> >>>>> Jump-pilot-devel@lists.sourceforge.net
> >>> >>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>> >>>>>
> >>> >>>>>
> >>> >>>>>
> >>> >>>>>
> >>> >>>>
> >>> >>>>
> -------------------------------------------------------------------------
> >>> >>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
> >>> >>>> challenge
> >>> >>>> Build the coolest Linux based applications with Moblin SDK & win
> >>> >>>> great prizes
> >>> >>>> Grand prize is a trip for two to an Open Source event anywhere in
> the
> >>> >>>> world
> >>> >>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >>> >>>> _______________________________________________
> >>> >>>> Jump-pilot-devel mailing list
> >>> >>>> Jump-pilot-devel@lists.sourceforge.net
> >>> >>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>> >>>>
> >>> >>>>
> >>> >>>>
> >>> >>> --
> >>> >>> Martin Davis
> >>> >>> Senior Technical Architect
> >>> >>> Refractions Research, Inc.
> >>> >>> (250) 383-3022
> >>> >>>
> >>> >>>
> >>> >>>
> >>> >>>
> -------------------------------------------------------------------------
> >>> >>> This SF.Net email is sponsored by the Moblin Your Move Developer's
> >>> >>> challenge
> >>> >>> Build the coolest Linux based applications with Moblin SDK & win
> great
> >>> >>> prizes
> >>> >>> Grand prize is a trip for two to an Open Source event anywhere in
> the
> >>> >>> world
> >>> >>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >>> >>> _______________________________________________
> >>> >>> Jump-pilot-devel mailing list
> >>> >>> Jump-pilot-devel@lists.sourceforge.net
> >>> >>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>> >>>
> >>> >>>
> >>> >>
> >>> >>
> >>> >>
> -------------------------------------------------------------------------
> >>> >> This SF.Net email is sponsored by the Moblin Your Move Developer's
> >>> >> challenge
> >>> >> Build the coolest Linux based applications with Moblin SDK & win
> great
> >>> >> prizes
> >>> >> Grand prize is a trip for two to an Open Source event anywhere in
> the
> >>> >> world
> >>> >> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >>> >> _______________________________________________
> >>> >> Jump-pilot-devel mailing list
> >>> >> Jump-pilot-devel@lists.sourceforge.net
> >>> >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>> >>
> >>> >>
> >>> >
> >>> > --
> >>> > Martin Davis
> >>> > Senior Technical Architect
> >>> > Refractions Research, Inc.
> >>> > (250) 383-3022
> >>> >
> >>> >
> >>> >
> >>> >
> -------------------------------------------------------------------------
> >>> > This SF.Net email is sponsored by the Moblin Your Move Developer's
> >>> > challenge
> >>> > Build the coolest Linux based applications with Moblin SDK & win
> great
> >>> > prizes
> >>> > Grand prize is a trip for two to an Open Source event anywhere in the
> >>> > world
> >>> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >>> > _______________________________________________
> >>> > Jump-pilot-devel mailing list
> >>> > Jump-pilot-devel@lists.sourceforge.net
> >>> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>> >
> >>>
> >>>
> -------------------------------------------------------------------------
> >>> This SF.Net email is sponsored by the Moblin Your Move Developer's
> >>> challenge
> >>> Build the coolest Linux based applications with Moblin SDK & win great
> >>> prizes
> >>> Grand prize is a trip for two to an Open Source event anywhere in the
> >>> world
> >>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >>> _______________________________________________
> >>> Jump-pilot-devel mailing list
> >>> Jump-pilot-devel@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>
> >>
> >>
> >> --
> >> http://amusingprogrammer.blogspot.com/
> >>
> >>
> -------------------------------------------------------------------------
> >> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> >> Build the coolest Linux based applications with Moblin SDK & win great
> >> prizes
> >> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> >> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >> _______________________________________________
> >> Jump-pilot-devel mailing list
> >> Jump-pilot-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>
> >>
> >
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
--
http://amusingprogrammer.blogspot.com/
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel