Menu

[r5981]: / trunk / toolkits / basemap / lib / shapelib / shapelib.py  Maximize  Restore  History

Download this file

120 lines (100 with data), 3.6 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# This file was created automatically by SWIG.
import shapelibc
class SHPObject:
def __init__(self,*args):
self.this = apply(shapelibc.new_SHPObject,args)
self.thisown = 1
def __del__(self,shapelibc=shapelibc):
if self.thisown == 1 :
shapelibc.delete_SHPObject(self)
def extents(*args):
val = apply(shapelibc.SHPObject_extents,args)
return val
def vertices(*args):
val = apply(shapelibc.SHPObject_vertices,args)
return val
__setmethods__ = {
}
def __setattr__(self,name,value):
if (name == "this") or (name == "thisown"): self.__dict__[name] = value; return
method = SHPObject.__setmethods__.get(name,None)
if method: return method(self,value)
self.__dict__[name] = value
__getmethods__ = {
"type" : shapelibc.SHPObject_type_get,
"id" : shapelibc.SHPObject_id_get,
}
def __getattr__(self,name):
method = SHPObject.__getmethods__.get(name,None)
if method: return method(self)
raise AttributeError,name
def __repr__(self):
return "<C SHPObject instance at %s>" % (self.this,)
class SHPObjectPtr(SHPObject):
def __init__(self,this):
self.this = this
self.thisown = 0
self.__class__ = SHPObject
class ShapeFile:
def __init__(self,*args):
self.this = apply(shapelibc.new_ShapeFile,args)
self.thisown = 1
def __del__(self,shapelibc=shapelibc):
if self.thisown == 1 :
shapelibc.delete_ShapeFile(self)
def close(*args):
val = apply(shapelibc.ShapeFile_close,args)
return val
def info(*args):
val = apply(shapelibc.ShapeFile_info,args)
return val
def read_object(*args):
val = apply(shapelibc.ShapeFile_read_object,args)
if val: val = SHPObjectPtr(val) ; val.thisown = 1
return val
def write_object(*args):
val = apply(shapelibc.ShapeFile_write_object,args)
return val
def cobject(*args):
val = apply(shapelibc.ShapeFile_cobject,args)
return val
def __repr__(self):
return "<C ShapeFile instance at %s>" % (self.this,)
class ShapeFilePtr(ShapeFile):
def __init__(self,this):
self.this = this
self.thisown = 0
self.__class__ = ShapeFile
#-------------- FUNCTION WRAPPERS ------------------
def open(*args, **kwargs):
val = apply(shapelibc.open,args,kwargs)
if val: val = ShapeFilePtr(val); val.thisown = 1
return val
def create(*args, **kwargs):
val = apply(shapelibc.create,args,kwargs)
if val: val = ShapeFilePtr(val); val.thisown = 1
return val
c_api = shapelibc.c_api
type_name = shapelibc.type_name
part_type_name = shapelibc.part_type_name
#-------------- VARIABLE WRAPPERS ------------------
SHPT_NULL = shapelibc.SHPT_NULL
SHPT_POINT = shapelibc.SHPT_POINT
SHPT_ARC = shapelibc.SHPT_ARC
SHPT_POLYGON = shapelibc.SHPT_POLYGON
SHPT_MULTIPOINT = shapelibc.SHPT_MULTIPOINT
SHPT_POINTZ = shapelibc.SHPT_POINTZ
SHPT_ARCZ = shapelibc.SHPT_ARCZ
SHPT_POLYGONZ = shapelibc.SHPT_POLYGONZ
SHPT_MULTIPOINTZ = shapelibc.SHPT_MULTIPOINTZ
SHPT_POINTM = shapelibc.SHPT_POINTM
SHPT_ARCM = shapelibc.SHPT_ARCM
SHPT_POLYGONM = shapelibc.SHPT_POLYGONM
SHPT_MULTIPOINTM = shapelibc.SHPT_MULTIPOINTM
SHPT_MULTIPATCH = shapelibc.SHPT_MULTIPATCH
SHPP_TRISTRIP = shapelibc.SHPP_TRISTRIP
SHPP_TRIFAN = shapelibc.SHPP_TRIFAN
SHPP_OUTERRING = shapelibc.SHPP_OUTERRING
SHPP_INNERRING = shapelibc.SHPP_INNERRING
SHPP_FIRSTRING = shapelibc.SHPP_FIRSTRING
SHPP_RING = shapelibc.SHPP_RING
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.