Parent Directory
|
Revision Log
Sticky Revision: |
made a copy
* Thuban/UI/renderer.py: Added module variable verbose and added verbose output before doing a raster projection. Minor: Added (c) year 2006. * test/test_baserenderer.py: Added new function test_projected_raster_decimalcommalocale() Added new author Bernhard Reiter and new copyright year 2006. * libraries/thuban/gdalwarp.cpp(ProjectRasterFile): Adding switching to LC_NUMERIC "C" and back before calling GDAL functions - only #if python >=2.4 .
2006-09-18 Didrik Pinte <dpinte@itae.be> * wxPython 2.6 update : wx 2.4 syntax has been updated to 2.6
(ScreenRenderer.draw_selection_incrementally): Call the right method for the default size.
(ScreenRenderer.draw_selection_incrementally): untabify.
(ScreenRenderer.draw_selection_incrementally): Use the default size for rendering selected items of default type. Fixes part 2 of https://intevation.de/rt/webrt?serial_num=3149
(MapRenderer.draw_raster_data): Fixed signature to match that in BaseRenderer. Use the new opacity argument in place of calling layer.Opacity(). In the case where the format is not 'RAW', alpha_data is None and the loaded image has alpha information, use the file's alpha information. This is still subject to the layer's opacity setting.
Added a description according to the CVS log message
Added a missing import
Add support for adjusting the opacity of a raster layer.
Refactored baserenderer.py and renderer.py to remove baserenderer.py's dependencies on wxPython. Added a new method projected_raster_layer() that returns a raster layer image in projected space. This must be implemented in classes derived from BaseRenderer. This also eliminates the dependency on gdal in baserenderer.py.
Further wxPython 2.5 changes using patches from Daniel Calvelo Aros so that that wxproj doesn't crash. Added GUI support for selecting alpha channel (opacity can't be selected yet).
Make layer's use_mask flag default to true. Support a bit array describing the mask to use. Improve error handling in ProjectRasterFile (also addresses RT #2947).
Add a new dialog box for raster layers. The dialog box allows the user to toggle a mask that is generated by ProjectRasterFile and is used to only draw the real parts of the projected image.
Improved rendering raster layers by changing the return format of the ProjectRasterFile function.
Thuban/UI/renderer.py (ScreenRendererdraw_selection_incrementally): BugFix 2883: Former implementation only worked on classified point layers: KeyError was raised, now use the default size if field is None.
* Thuban/UI/view.py (MapPrintout.draw_on_dc): The region for the renderer has to be at the same position as the mapregion * Thuban/UI/renderer.py (ExportRenderer.RenderMap): self.region has to be moved by (self.shiftx, self.shifty) too.
Added PNG, TIFF and GIF as supported bitmap image formats (helpful for the WMS extension)
(ScreenRenderer.draw_selection_incrementally): Added consideration of the specific size of point symbols. The property for each point symbol is retrieved and the size applied for the rendering method. Added doc-string.
Avoid warnings when run under Python 2.3 (MapRenderer.make_point): Turn this into a real method so that we can convert to int. (MapRenderer.label_font): The font size mist be an int.
(raster_format_map): New. Mapping form the strings of the format parameter of draw_raster_data method to wx constants (MapRenderer.draw_raster_data): Add the format parameter and use raster_format_map to map it to the right wxwindows constant for wxImageFromStream
Several rendering changes: - Render the selection into a separate bitmap so that only that bitmap needs to be redrawn when the selection changes - Render incrementally showing previews and allowing interaction before rendering is complete - Update the renderer interface a bit. Most parameters of RenderMap are now parameters of the constructor * Thuban/UI/baserenderer.py (BaseRenderer.__init__): Add the map and the update region as parameters. Update the doc-string (BaseRenderer.render_map_incrementally): New. Generator function to renders the map incrementally (BaseRenderer.render_map): Remove the map argument (it's now in the constructor) and simply iterate over the render_map_incrementally generator to draw the map. (BaseRenderer.draw_shape_layer_incrementally) (BaseRenderer.draw_shape_layer): Renamed to draw_shape_layer_incrementally and changed into a generator that yields True every 500 shapes. Used by render_map_incrementally to render shape layers incrementally * Thuban/UI/renderer.py (ScreenRenderer.RenderMap): Removed the map and region parameters which are now in the constructor (ScreenRenderer.RenderMapIncrementally): New. Public frontend for the inherited render_map_incrementally. (BaseRenderer.draw_shape_layer): Removed. (ScreenRenderer.draw_selection_incrementally): New. The selection drawing part of the removed draw_shape_layer as a generator (ScreenRenderer.layer_shapes): Update because of the region parameter change (ExportRenderer.__init__): New. Extend the inherited constructor with the destination region for the drawing (ExportRenderer.RenderMap): Removed the map and region parameters which are now in the constructor * Thuban/UI/view.py (MapCanvas.PreviewBitmap): New. Return a bitmap suitable for a preview in a tool (CanvasPanTool.MouseMove): Use the PreviewBitmap method to get the bitmap (MapPrintout.draw_on_dc): Adapt to new renderer interface (MapCanvas.OnPaint): Handle drawing the selection bitmap if it exists (MapCanvas.OnIdle): Update the logic to deal with incremental rendering and the selection bitmap (MapCanvas._do_redraw): Handle the instantiation of the render iterator and the redraws during rendering (MapCanvas._render_iterator): New. Generator to incrementally redraw both bitmaps (MapCanvas.Export): Adapt to new renderer interface. (MapCanvas.full_redraw): Reset the selection bitmap and the renderer iterator too (MapCanvas.redraw_selection): New. Force a redraw of the selection bitmap (MapCanvas.shape_selected): Only redraw the selection bitmap
(ExportRenderer.render_legend): Do not modify the list returned by map.Layers() in place since it is the actual list of layers used by the map.
Change the way shapes are returned by a shape store. The ShapesInRegion method returns an iterator over actual shape objects instead of a list of shape ids. * Thuban/Model/data.py (ShapefileShape.ShapeID): New. Return shape id. (ShapefileStore.ShapesInRegion): Return an iterator over the shapes which yields shape objects instead of returning a list of shape ids (ShapefileStore.AllShapes): New. Return an iterator over all shapes in the shape store (DerivedShapeStore.AllShapes): New. Like in ShapefileStore * Thuban/Model/layer.py (Layer.ShapesInRegion): Update doc-string. * Thuban/UI/baserenderer.py (BaseRenderer.layer_ids, BaseRenderer.layer_shapes): Rename to layer_shapes and make it return an iterator containg shapes instead of a list of ids. (BaseRenderer.draw_shape_layer): Update doc-string; Adapt to layer_shapes() change * Thuban/UI/renderer.py (ScreenRenderer.layer_ids) (ScreenRenderer.layer_shapes): Rename as in BaseRenderer * Thuban/UI/viewport.py (ViewPort._find_shape_in_layer): Adapt to changes in the ShapesInRegion return value. (ViewPort._get_hit_tester): Remove commented out code * test/mockgeo.py (SimpleShapeStore.ShapesInRegion): Adapt to the new return value. (SimpleShapeStore.AllShapes): New. Implement this method too. * test/test_layer.py (TestLayer.test_arc_layer) (TestLayer.test_polygon_layer, TestLayer.test_point_layer) (TestLayer.test_point_layer_with_projection) (TestLayer.test_derived_store): Adapt to changes in the ShapesInRegion return value. * test/test_shapefilestore.py (TestShapefileStoreArc.test_shapes_in_region) (TestShapefileStorePolygon.test_shapes_in_region) (TestShapefileStorePoint.test_shapes_in_region): Adapt to changes in the ShapesInRegion return value. (TestShapefileStorePoint.test_all_shapes) (TestShapefileStoreArc.test_shape_shapeid): New tests for the new methods * test/test_derivedshapestore.py (TestDerivedShapeStore.test_shapes_in_region): Adapt to changes in the ShapesInRegion return value. (TestDerivedShapeStore.test_all_shapes) (TestDerivedShapeStore.test_shape_shapeid): New tests for the new methods
Make the renderers deal correctly with raw vs. python level representation of shape geometries * Thuban/UI/baserenderer.py (BaseRenderer.low_level_renderer): Return a flag useraw in addition to the callable and the parameter to indicate whether the callable can deal with the raw shape data or uses the higher level python lists of coordinates. The callable now should accept either the raw data or the return value of the shape's Points() method. (BaseRenderer.draw_shape_layer): Adapt to the low_level_renderer change (BaseRenderer.projected_points): Instead of the shape id use the points list as parameter. (BaseRenderer.draw_polygon_shape, BaseRenderer.draw_arc_shape) (BaseRenderer.draw_point_shape): Adapt to projected_points() change and accept the points list as parameter instead of the shape id. * Thuban/UI/renderer.py (MapRenderer.low_level_renderer): Return the useraw flag as required by the BaseRenderer (ScreenRenderer.draw_shape_layer): Adapt to low-level renderer changes. * test/test_baserenderer.py (TestBaseRenderer.test_point_with_classification): New test for rendering a map with classifications.
(MapRenderer.low_level_renderer): Check the raw data format and only use an optimized version of its a shapefile.
* Thuban/UI/renderer.py (MapRenderer): Most of the code/methods in this class is now in BaseRenderer. This class is now practically only a specialization of BaseRenderer for rendering to an actual wx DC. (ScreenRenderer.draw_shape_layer): Use self.low_level_renderer() to get the shapetype specific rendering functions. * test/test_baserenderer.py: New. Test cases for BaseRenderer * Thuban/UI/view.py (MapCanvas.__init__): New instance variable error_on_redraw to guard agains endless loops and stack overflows when there's a bug in the rendering code that raises exceptions. (MapCanvas.OnIdle, MapCanvas._do_redraw): Split the actual rendering into a separate method _do_redraw so that error handling is a bit easier. When an exception occurs, set error_on_redraw to true. When it's true on entry to OnIdle do nothing and return immediately.
Import the SHAPETYPE_* constants from data instead of layer.
(ScreenRenderer.draw_shape_layer): Remove superfluous code to set brush and pen for point shapes
(MapRenderer.render_map): Wrap method with Begin/EndDrawing() calls to ensure we aren't doing to many updates to the dc during rendering. (ScreenRenderer.draw_shape_layer): self.draw_point_shape takes a pen and brush argument so they need to be passed to the function.
* Thuban/Model/layer.py (Layer.__init__): Rename classificationField to classificatin_column and init it here so that it can be used in SetClassificationColumn (Layer.GetClassificationColumn, Layer.GetClassificationField): Rename to GetClassificationColumn. (Layer.SetClassificationColumn, Layer.SetClassificationField): Rename to SetClassificationColumn and issue a LAYER_CHANGED message if the column changes. (Layer._classification_changed, Layer.ClassChanged): Rename to _classification_changed. Update the callers. (Layer.SetShapeStore): Further field->column renames. * Thuban/Model/load.py (SessionLoader.start_classification) (SessionLoader.start_clpoint): Updates because of field->column method name changes in the Layer class * Thuban/Model/save.py (SessionSaver.write_classification): Updates because of field->column method name changes in the Layer class * Thuban/UI/classifier.py (Classifier.__init__) (Classifier._OnTry, Classifier._OnRevert): Updates because of field->column method name changes in the Layer class * Thuban/UI/renderer.py (MapRenderer.draw_shape_layer): Updates because of field->column method name changes in the Layer class * Thuban/UI/viewport.py (ViewPort.find_shape_at): Updates because of field->column method name changes in the Layer class * test/test_save.py (SaveSessionTest.testClassifiedLayer) (SaveSessionTest.testClassifiedLayer): Update because of field->column method name changes in the Layer class * test/test_layer.py (SetShapeStoreTests.setUp) (SetShapeStoreTests.test_sanity): Update because of field->column method name changes in the Layer class (TestLayerModification.setUp): Subscribe to LAYER_CHANGED as well (TestLayerModification.test_sanity) (TestLayerModification.test_initial_settings): remove unsued code and rename to test_sanity. (TestLayerModification.test_set_classification): New test for SetClassification and SetClassificationField.
(MapRenderer.draw_shape_layer): Get the classification field from layer.
(MapRenderer.draw_shape_layer): Rework the draw_func handling a bit to remove one layer of indirection. This makes the renderer about 10% faster in the non-classifying case and the code a bit cleaner (MapRenderer.draw_point_shape): Add the pen and brush parameters and set them in the dc. Now the draw_point_shape method and wxproj's draw_polygon_shape function have basically the same signature so that both can be directly used as draw_func
Fixes RTbug #1971.
Reverse List of layers to render in same order as in desktop legend.
(ExportRenderer.render_legend): Check that a layer has a classification before trying to get it. Raster layers don't have classifications.
Check for gdal support before importing gdalwarp. (MapRenderer.render_map): Only try to optimize if we have gdal support otherwise nothing will get drawn. (MapCanvas.FitMapToWindow): This may be called during startup before a map has been created. Check if map is None before using it and do nothing if it is.
Update to the layer interface: Direct access to the table, shapetable, shapefile and filename attributes is now actively deprecated by issuing deprecation warnings for all places where this happens. * Thuban/Model/layer.py (Layer.__getattr__): New. Implement access to the instance variables table, shapetable, shapefile and filename via __getattr__ so that we can issue a deprecation warning. (Layer.SetShapeStore): Don't set the deprecated instance variables any more (Layer.SetShapeStore): Don't use deprecated layer instance variables (Layer.Destroy): No need to explicitly remove the instance variables any more (Layer.GetFieldType, Layer.Shape): Don't use deprecated layer instance variables * Thuban/UI/classgen.py (ClassGenDialog.__init__) (GenUniformPanel._OnRetrieve, GenUniquePanel._OnRetrieve) (GenQuantilesPanel.GetList, GenQuantilesPanel.OnRetrieve): Don't use deprecated layer instance variables * Thuban/UI/classifier.py (Classifier.__init__): Don't use deprecated layer instance variables * Thuban/UI/identifyview.py (IdentifyListCtrl.selected_shape) (IdentifyGridCtrl.selected_shape): Don't set the deprecated layer instance variables * Thuban/UI/tableview.py (LayerTableGrid.select_shapes): Don't use deprecated layer instance variables * Thuban/UI/mainwindow.py (MainWindow.LayerShowTable): Don't use deprecated layer instance variables * Thuban/Model/save.py (SessionSaver.write_layer): Don't use deprecated layer instance variables * Thuban/UI/renderer.py (MapRenderer.draw_shape_layer) (MapRenderer.polygon_render_param): Don't use deprecated layer instance variables * test/runtests.py (main): Turn Thuban's deprecation warnings into errors so that they're cought by the tests * test/test_load.py (TestSingleLayer.test): Don't use deprecated layer instance variables
(MapRenderer.render_map): Only try to optimize if a raster layer is visible. Fixes RTbug #1931. Only draw the raster layer if the gdal library is available. Addresses RTbug #1877.
(MapRenderer.draw_raster_layer): Call ProjectRasterFile with tuple arguments instead of strings.
(MapRenderer.render_map): Check if scale has gone to 0 which is a serious problem. abort. (MapRenderer.draw_raster_layer): Catch IOError seperately and print the error from GDAL.
(MapRenderer.render_map): Add support for rendering RasterLayer layers. (MapRenderer.draw_raster_layer): Actually method that calls the GDALWarp python wrapper and constructs an image from the data returned.
ExportRenderer): New, derived from ScreenRenderer. Renders Map, Legend and Scalebar for export. (PrinterRenderer): New, derived from ExportRenderer. Replaces the old PrintRender.
Explicit imports.
(MapRenderer.draw_shape_layer): Adapt to new table interface
(MapRenderer.draw_shape_layer): Optimize the rendering loop by reducing the number of if's, removing the unnecessary try/except block, and checking if the old group is the same as the new one (which happens a lot if there is no classification, or lots of shapes are in the same group).
Safer implementation of the performance enhancements of the low-level renderer: * extensions/thuban/wxproj.cpp (extract_projection) (extract_pointer): Rename extract_projection to extract_pointer and redefine its purpose to return the pointer stored in a CObject returned by the object's cobject method. Update all callers. (s_draw_info, free_draw_info, draw_polygon_init): Implement the handling of these low-level parameters so that each s_draw_info instance is handled as a CObject at python level that also contains real references to the actual python objects which contain the values in the struct. Add free_draw_info as the destructor. (draw_polygon_shape): Add the py_draw_info parameter which must a cobject containing an s_draw_info pointer. * Thuban/UI/renderer.py (MapRenderer.polygon_render_param): New method to instantiat the low-level render parameter (MapRenderer.draw_shape_layer): Use the new method. Remove some commented out code. (MapRenderer.draw_polygon_shape): Make the first parameter not the layer but the low-level render parameter (ScreenRenderer.draw_shape_layer): Use the low-level render parameter.
(MapRenderer.draw_shape_layer): Make drawing initialization call to draw_polygon_init() (MapRenderer.draw_polygon_shape): Use new signature of draw_polygon_shape.
fixed bug where if there was no classification and the default was hidden, the default was still being drawn.
(MapRenderer.draw_shape_layer): Only draw visible groups.
Rename Color.None to Color.Transparent.
Fix assert calls.
(MapRenderer.draw_point_shape): Check that there actually are points in the returned list of points before trying to index into the list. The list may be empty if the shape is a Null Shape.
(MapRenderer.__init__): Added assert to check if scale > 0. Trying to track down a divide by zero.
Implement multiple selected shapes * Thuban/UI/selection.py: New module with a class to represent the selection. * Thuban/UI/messages.py (SELECTED_TABLE, SELECTED_MAP): Remove these unused messages * Thuban/UI/application.py (ThubanApplication.OnInit) (ThubanApplication.OnExit, ThubanApplication.SetSession): The interactor is gone now. (ThubanApplication.CreateMainWindow): There is no interactor anymore so we pass None as the interactor argument for now for compatibility. * Thuban/UI/view.py (MapCanvas.delegated_messages) (MapCanvas.Subscribe, MapCanvas.Unsubscribe): In Subscribe and Unsubscribe, delegate messages according to the delegated_messages class variable. (MapCanvas.__getattr__, MapCanvas.delegated_methods): Get some attributes from instance variables as described with the delegated_methods class variable. (MapCanvas.__init__): New instance variable selection holding the current selection (MapCanvas.do_redraw): Deal with multiple selected shapes. Simply pass them on to the renderer (MapCanvas.SetMap): Clear the selection when a different map is selected. (MapCanvas.shape_selected): Simple force a complete redraw. The selection class now takes care of only issueing SHAPES_SELECTED messages when the set of selected shapes actually does change. (MapCanvas.SelectShapeAt): The selection is now managed in self.selection * Thuban/UI/mainwindow.py (MainWindow.delegated_messages) (MainWindow.Subscribe, MainWindow.Unsubscribe): In Subscribe and Unsubscribe, delegate messages according to the delegated_messages class variable. (MainWindow.delegated_methods, MainWindow.__getattr__): Get some attributes from instance variables as described with the delegated_methods class variable. (MainWindow.__init__): The interactor as ivar is gone. The parameter is still there for compatibility. The selection messages now come from the canvas. (MainWindow.current_layer, MainWindow.has_selected_layer): Delegate to the the canvas. (MainWindow.LayerShowTable, MainWindow.Classify) (MainWindow.identify_view_on_demand): The dialogs don't need the interactor parameter anymore. * Thuban/UI/tableview.py (TableFrame.__init__) (LayerTableFrame.__init__, LayerTableFrame.OnClose) (LayerTableFrame.row_selected): The interactor is gone. It's job from the dialog's point of view is now done by the mainwindow, i.e. the parent. Subscribe to SHAPES_SELECTED instead of SELECTED_SHAPE * Thuban/UI/dialogs.py (NonModalDialog.__init__): The interactor is gone. It's job from the dialog's point of view is now done by the mainwindow, i.e. the parent. * Thuban/UI/classifier.py (Classifier.__init__): The interactor is gone. It's job from the dialog's point of view is now done by the mainwindow, i.e. the parent. * Thuban/UI/tree.py (SessionTreeView.__init__): The interactor is gone. It's job from the dialog's point of view is now done by the mainwindow, i.e. the parent. (SessionTreeCtrl.__init__): New parameter mainwindow which is stored as self.mainwindow. The mainwindow is need so that the tree can still subscribe to the selection messages. (SessionTreeCtrl.__init__, SessionTreeCtrl.unsubscribe_all) (SessionTreeCtrl.update_tree, SessionTreeCtrl.OnSelChanged): The selection is now accessible through the mainwindow. Subscribe to SHAPES_SELECTED instead of SELECTED_SHAPE * Thuban/UI/identifyview.py (IdentifyView.__init__): Use the SHAPES_SELECTED message now. (IdentifyView.selected_shape): Now subscribed to SHAPES_SELECTED, so deal with multiple shapes (IdentifyView.__init__, IdentifyView.OnClose): The interactor is gone. It's job from the dialog's point of view is now done by the mainwindow, i.e. the parent. * Thuban/UI/renderer.py (ScreenRenderer.RenderMap): Rename the selected_shape parameter and ivar to selected_shapes. It's now a list of shape ids. (MapRenderer.draw_label_layer): Deal with multiple selected shapes. Rearrange the code a bit so that the setup and shape type distinctions are only executed once.
(MapRenderer.draw_shape_layer): Only get the layer classification once. Don't try to classify values when the field is None: just use the default properties.
Use new Classification and Group functions. Use common.py functions.
(MapRenderer.draw_shape_layer): Change Classification method name from GetProperties to GetClassData.
(MapRenderer.draw_shape_layer): Remove unneeded Shape() call. Rendering is substantially faster without it and it avoids some problems with broken shape files.
Use new Color and Classification methods.
* Thuban/UI/renderer.py (MapRenderer): Use the Get*() methods of the ClassData class.
Replace user string by _() for i18n.
added support for drawing classifications
(ScreenRenderer.draw_shape_layer): Handle arcs with multiple parts.
* Thuban/UI/renderer.py (ScreenRenderer.layer_ids, ScreenRenderer.draw_shape_layer): The update box is now directly a tuple, not a wxRect anymore.
* Thuban/UI/renderer.py (MapRenderer.layer_ids): New method to return the shape ids to be rendered in a given layer. (MapRenderer.draw_shape_layer): Call layer_ids to get the list of ids. (ScreenRenderer.RenderMap): New parameter for the rectangle that has to be updated (ScreenRenderer.layer_ids): Make use of the layer's quadtree by calling it's ShapesInRegion method.
* Thuban/UI/renderer.py (MapRenderer.draw_shape_layer): Honour the stroke_width attribute
import all the source files
This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.
[email protected] | ViewVC Help |
Powered by ViewVC 1.1.26 |