[geos-devel] RE: CoordinateListFactory

Martin Davis mbdavis at VividSolutions.com
Mon Feb 3 13:07:51 EST 2003


Here's the idea for CoordinateListFactory:  (I'm doing it in Java terms since it's a bit simpler

abstract class CoordinateListFactory
{
	public static CoordinateListFactory internalFactory = new BasicCoordinateListFactory();

	CoordinateList createCoordinateList(int size);
}

class BasicCoordinateListFactory
{
	createCoordinateList(int size)	{		return new BasicCoordinateList(size); }
}

... in the code, where it needs to create a new CoordinateList:

	CoordinateList coordList = CoordinateListFactory.internalFactory.createCoordinateList(size);

Library users such as PostGIS can initialize CoordinateListFactory.internalFactory to whatever CoordinateListFactory they want to use, or simply leave it as Basic if they don't care.

I haven't had a chance to try the compile again, but I will today.


Martin Davis, Senior Technical Specialist
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046
EMail: mbdavis at vividsolutions.com  Web: www.vividsolutions.com


> -----Original Message-----
> From: Yury A. Bychkov [mailto:me at yury.ca]
> Sent: Saturday, February 01, 2003 10:38 PM
> To: Martin Davis
> Subject: CoordinateListFactory
> 
> 
> Hi Martin,
> 
> I've finished removing useless methods from CoordinateLists 
> and cleaned up more
> of the code including those "returning address of local 
> variable or temporary"
> errors (I don't know how I've missed them), but I wanted to 
> consult with you on
> something:
> 
> When we talked on friday, you've mentioned a very nice 
> solution on how to switch
> the CoordinateListFactory to making a particular subclass of 
> CoordinateList. I
> am afraid that I didn't quite understood your solution (and 
> only realized it
> later (well, sometimes my brain doesn't work well :-(
> Maybe you can explain it to me again? I came up with other 
> ways to implement the
> CoordinateListFactory, but all of them are much more cumbersome.
> 
> Yury
> P.S. BTW, did the code compile once you removed CoordinateList.cpp?
> 
> 
> 



More information about the geos-devel mailing list