[geos-devel] RE: TaggedLineSegment

strk at refractions.net strk at refractions.net
Fri Apr 28 07:30:42 EDT 2006


On Wed, Apr 19, 2006 at 10:53:53AM -0700, Martin Davis wrote:
> I probably did this for simplicity of programming.  I would think you
> can replace the subclass relationship with a uses relationship.

This won't remove the overhead associated with copying coordinates.
I'll leave it as it is for now, but this is a place that really
calls for shared_ptr<> usage...
Using pointers would be ok too, but I'm kind of scared of keeping
pointers to Coordinates returned from CoordinateSequence as 
references, it's hard to ensure memory integrity that way
(adding a point to the source CoordinateSequence could trigger
a complete reallocation of the underlying vector)

--strk;

> > -----Original Message-----
> > From: strk [mailto:strk at keybit.net] 
> > Sent: April 12, 2006 9:19 AM
> > To: Martin Davis
> > Cc: geos-devel at geos.refractions.net
> > Subject: TaggedLineSegment
> > 
> > 
> > Martin, I'm porting the jts.simplify package
> > to GEOS and I have a design question.
> > 
> > Is it a problem if we avoid to have TaggedLineSegment
> > derive from LineSegment ? This is probably not a problem
> > with JTS, but in GEOS LineSegment is composed by 2 real 
> > Coordinates rather then pointers and we probably don't need 
> > the overhead associated with this. Moreover this would 
> > require LineSegment to become a polymorphic class whereas 
> > currently it is not (in head at least, this would be the 
> > first derivate of it). 



More information about the geos-devel mailing list