Revision 614
org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/lib/geom.py | ||
---|---|---|
299 | 299 |
:return: envelope |
300 | 300 |
:rtype Geometry |
301 | 301 |
""" |
302 |
geometryManager = GeometryLocator.getGeometryManager() |
|
303 |
if pointMin==None and pointMax==None: |
|
304 |
envelope = geometryManager.createEnvelope() |
|
305 |
return envelope |
|
306 |
|
|
302 | 307 |
# Coord min point |
303 | 308 |
get=getattr(pointMin,"__getitem__",None) |
304 | 309 |
if get != None: |
305 | 310 |
xmin = get(0) |
306 | 311 |
ymin = get(1) |
307 |
else:
|
|
312 |
elif isinstance(pointMin, Point):
|
|
308 | 313 |
xmin = pointMin.getX() |
309 | 314 |
ymin = pointMin.getY() |
315 |
else: |
|
316 |
return None |
|
310 | 317 |
|
311 | 318 |
# Coord max point |
312 | 319 |
get=getattr(pointMax,"__getitem__",None) |
313 | 320 |
if get != None: |
314 | 321 |
xmax = get(0) |
315 | 322 |
ymax = get(1) |
316 |
else:
|
|
323 |
elif isinstance(pointMax, Point):
|
|
317 | 324 |
xmax = pointMax.getX() |
318 | 325 |
ymax = pointMax.getY() |
326 |
else: |
|
327 |
return None |
|
319 | 328 |
|
320 |
geometryManager = GeometryLocator.getGeometryManager() |
|
321 |
if pointMax!=None and pointMin!=None: |
|
329 |
try: |
|
322 | 330 |
envelope = geometryManager.createEnvelope(xmin, ymin, xmax, ymax, dimension) |
323 |
else:
|
|
324 |
envelope = geometryManager.createEnvelope()
|
|
325 |
|
|
331 |
except:
|
|
332 |
return None
|
|
333 |
|
|
326 | 334 |
return envelope |
327 | 335 |
|
328 | 336 |
|
Also available in: Unified diff