frank: thuban/Extensions/bboxdump __init__.py, NONE, 1.1 bboxdump.py, NONE, 1.1

Bernhard Herzog bh at intevation.de
Thu Apr 22 19:27:10 CEST 2004


cvs at intevation.de writes:

>         for i in xrange(layer.NumShapes()):
>             row = layer.ShapeStore().Table().ReadRowAsDict(i)

This only works for shapefiles since there the shape ids form a
contiguous sequence from 0 to # of shapes - 1.  It won't work for
postgis layers, for instance.  It's better to iterate over all shapes
with the ShapeStore's AllShapes() method and the get the correct shape
id from the shape's ShapeID() method.

Alternatively you could add row_is_ordinal = True to the ReadRowAsDict
call.  But that will cause problems later:

>     keys = shapelist.keys()
>     keys.sort()
>     for key in keys:
>         bbox = layer.ShapesBoundingBox(shapelist[key])

This will also fail for postgis layers unless shapelist contains the
real shape ids.

> # find the extensions menu (create it anew if not found)
> extensions_menu = main_menu.find_menu('extensions')
> if extensions_menu is None:
>     extensions_menu = main_menu.InsertMenu('extensions', _('E&xtensions'))

We should add a function to Thuban.UI.mainwindow that returns the
extensions menu after creating it if it doesn't exist yet.  This code
has been duplicated in at least 5 extensions.

  Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Skencil                                http://sketch.sourceforge.net/
Thuban                                  http://thuban.intevation.org/




More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)