[Gdal-dev] GetGeometryRef in scripts

Kevin Ruland kruland at ku.edu
Tue Sep 20 14:17:44 EDT 2005


Frank,

Hopefully you know where I'm comming from right now....  memory control
in script land.  I am unfortunately confused a little.  There are some
methods which I'd like to have clarification on.

Feature::GetGeometryRef
Feature::SetGeometry
Feature::SetGeometryDirectly

Geometry::GetGeometryRef
Geometry::AddGeometryDirectly
Geometry::AddGeometry

I roughly understand the difference between SetGeometry and
SetGeometryDirectly in the latter assumes ownership of the Geometry*
argument and the former executes some clone process.

Is this additional complexity required in scripts?  Can we get by with
only SetGeometry?

What is Geometry::GetGeometryRef()?  How would it be used?

Charlie indicates the Geometry object returned by
Feature::GetGeometryRef is owned by the the Feature object.  Would it be
ok to change this from it's current implementation:

return OGR_F_GetGeometryRef(self)

To a method which returns a clone whos memory is managed by the script,

OGRGeometryH g = OGR_F_GetGeometryRef(self)
return OGR_G_Clone( g );

What about the two different versions of AddGeometry?

Thanks a bunch.

kevin



More information about the Gdal-dev mailing list