On Wed, May 29, 2013 at 3:31 PM, Justin Deoliveira <jdeol...@opengeo.org>wrote:
> Do you see a chance to consolidate? It would be nice to use a single set
> of curve classes located in api or main and have the gml encoding work off
> of them.
>
Right, I'm going to look into it, but can make no promises.
The Circle class in GML is imho particularly convoluted, what you really
need is its Arc subclass, and yet to linearize it you
have to go through some static methods in Circle that inside do create a
full Circle to just then linearize a portion of it,
or create an instance of Circle to then linearize a portion of arc:
Circle circle = new Circle(c1, c2, c3);
double tolerance =
arcParameters.getLinearizationTolerance().getTolerance(circle);
Coordinate[] resultCoordinates = circle.linearizeArc(c1, c2, c3,
tolerance);
The new code will need to create a CircularString, which is a list of "arc
by 3 points", always made of an odd number
of points, the first three are the first arc, the last point of which is
also the first point of the second arc, and so on:
CIRCULARSTRING(a1p1, a1p2, a1p3, a2p2, a2p3, a3p2, a3p3, ...)
As suggested by Jody, the linearization algorithm needs adjustments, the
way it's done now will create topologically
invalid polygons when linearizing a CURVEPOLYGON under some circumstances.
Even with Jody's suggestion a polygon made of a mix of linear and curved
arcs will still be at risk of breaking topological
validity during linearization: that becomes a hard problem, I believe that
for starters we can let it rest and see
if another round of funding comes in to address that (btw, this discussion
is here to do an evaluation, so it's not
like there is funding secured to do the work I'm talking about yet).
> It isn't clear to me if the GML model is compatible with the one you are
> proposing.
>
Let's see.
The SQLServer model (which is to my understanding the same as postgis) is
made of:
* CIRCULARSTRING: list of "circular arc by 3 points"
* COMPOUNDCURVE: a multilinstring whose elements are both normal
linestrings and circularstrings
* CURVEPOLYGON: a polygon whose inner rings can be either normal linear
rings, closed circular strings,
or closed compound curves (hmm... we might need to have a CircularRing
class and ClosedCompoundCurve classes
to support this...)
Some references:
http://postgis.refractions.net/documentation/manual-1.4/ch04.html#id2758657
http://technet.microsoft.com/en-us/library/bb933790.aspx (see menu with the
various geom types)
As you can see there is no explicit support for circles, a circle is
represented by a circularstring made
with two arcs of the same circle that close on each other.
The GML2 model does not have any curved arc notion, so that's easy.
The GML3 model has a number instead:
* CircleByCenterPoint: this one we cannot represent as is with the work I'm
going to do, but it could be turned into
an equivalent circle
* Circle, which is represented by its 3 points, and which would have to be
represented by two arcs in spatial databases
* ArcString, whose interpolation attribute is fixed to circularArc3Points
* MultiCurve, which is made of either straight of curved elements
* Polygon, whose internal structure can be made of either LinearRing or
Ring objects, the latter allowing for curved elements
So, trying to do a logical mapping:
1) a circularstring made of just one arc is mapped to one ArcString
2) a circularstring made of more elements is mapped to a MultiCurve made
solely of ArcString, or a Ring made solely of ArcString
if it's closed, or a Circle if the elements are actually only two and
representing a string
4) a compoundcurve should map into a MultiCurve automatically (as an
instance of LineString)
5) a polygon should automatically split into its elements, same as 4)
I believe 1) and 2) are problematic with the design of the GML3 encoder? If
it was a TranslatorBase kind it would
trivial to implement that logic, but with the way bindings are processed in
gt-xsd I would honestly don't know
how to proceed, apparently it pretends a 1-1 matching between java class
and xml element?
It seems to me that given a general CircularString with more than one
element, we need to map it to a MultiLineString,
whose elements are Arc objects (a subclass of LineString) which is an arc
by 3 points, and then modify ArcBinding
to bind to those objects?
And for polygons I guess a Ring class would be needed, subclass of
LinearRing, that also linearizes automatically,
that would be used in RingBinding?
The above is annoying, as the GML encoder limitations would percolate down
into the geometry representation, limiting it.
Cheers
Andrea
--
==
GeoServer training in Milan, 6th & 7th June 2013! Visit
http://geoserver.geo-solutions.it for more information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel