[Liblas-commits] hg: clean up liblas.point.Point creation,
ensure that copy seman...
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Sep 30 12:05:42 EDT 2009
changeset 47aa99c03689 in /home/www/liblas.org/hg
details: http://hg.liblas.org/main/hg?cmd=changeset;node=47aa99c03689
summary: clean up liblas.point.Point creation, ensure that copy semantics are right, and add as LASPoint_Destroy prototype, which not was causing a big problem on snow leopard.
diffstat:
.hgignore | 3 ++-
python/liblas/core.py | 4 ++++
python/liblas/file.py | 4 ++--
python/liblas/point.py | 9 ++++-----
4 files changed, 12 insertions(+), 8 deletions(-)
diffs (70 lines):
diff -r 9cde96b45e48 -r 47aa99c03689 .hgignore
--- a/.hgignore Wed Sep 30 10:50:34 2009 -0500
+++ b/.hgignore Wed Sep 30 11:05:27 2009 -0500
@@ -35,4 +35,5 @@
test/data/*.idx
python/build/*
python/dist/*
-python/libLAS.egg-info/*
\ No newline at end of file
+python/libLAS.egg-info/*
+python/liblas/*.pyc
\ No newline at end of file
diff -r 9cde96b45e48 -r 47aa99c03689 python/liblas/core.py
--- a/python/liblas/core.py Wed Sep 30 10:50:34 2009 -0500
+++ b/python/liblas/core.py Wed Sep 30 11:05:27 2009 -0500
@@ -586,6 +586,10 @@
las.LASPoint_SetColor.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
las.LASPoint_SetColor.errcheck = check_return
+las.LASPoint_Destroy.argtypes = [ctypes.c_void_p]
+las.LASPoint_Destroy.errcheck = check_void_done
+las.LASPoint_Destroy.restype = None
+
las.LASSRS_Create.errcheck = check_void
las.LASSRS_Create.restype = ctypes.c_void_p
diff -r 9cde96b45e48 -r 47aa99c03689 python/liblas/file.py
--- a/python/liblas/file.py Wed Sep 30 10:50:34 2009 -0500
+++ b/python/liblas/file.py Wed Sep 30 11:05:27 2009 -0500
@@ -131,14 +131,14 @@
def read(self, location):
if self.mode == 0:
- return point.Point(handle=core.las.LASReader_GetPointAt(self.handle, location), owned= False, copy=True)
+ return point.Point(handle=core.las.LASReader_GetPointAt(self.handle, location), copy=True)
def __iter__(self):
if self.mode == 0:
self.at_end = False
p = core.las.LASReader_GetNextPoint(self.handle)
while p and not self.at_end:
- yield point.Point(handle=p, owned= False, copy=True)
+ yield point.Point(handle=p, copy=True)
p = core.las.LASReader_GetNextPoint(self.handle)
if not p:
self.at_end = True
diff -r 9cde96b45e48 -r 47aa99c03689 python/liblas/point.py
--- a/python/liblas/point.py Wed Sep 30 10:50:34 2009 -0500
+++ b/python/liblas/point.py Wed Sep 30 11:05:27 2009 -0500
@@ -51,16 +51,15 @@
if handle:
if copy:
self.handle = core.las.LASPoint_Copy(handle)
+ self._owned = True
else:
self.handle = handle
+ self._owned = False
else:
self.handle = core.las.LASPoint_Create()
- if not copy:
- self.owned = owned
- else:
- self.owned = True
+ self._owned = True
def __del__(self):
- if self.owned:
+ if self._owned:
if self.handle and core:
core.las.LASPoint_Destroy(self.handle)
More information about the Liblas-commits
mailing list