Parent Directory
|
Revision Log
Sticky Revision: |
2007-04-12 Didrik Pinte <dpinte@itae.be> * Removed workaround for file encoding in the Thuban code
made a copy
2007-01-06 Didrik Pinte <dpinte@itae.be> UTF-8 locales support reading non utf-8 files. This is a workaround and not a real bugfix. See http://wald.intevation.org/tracker/index.php?func=detail&aid=118 for more details * Thuban/UI/ tableview.py, controls.py, baserenderer.py, view.py: decode text from iso-8859-1 encoding.
2006-09-28 Didrik Pinte <dpinte@itae.be> * Thuban/UI/classgen.py: bugfix due to wx2.6 update * Thuban/UI/view.py: removed non needed declaration * Thuban/UI/selection.py : typo correction
2006-09-18 Didrik Pinte <dpinte@itae.be> * wxPython 2.6 update : wx 2.4 syntax has been updated to 2.6
Fixing bug #2921, panning with middle button not working without active tool
The middle button now pans the map view.
* 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.
Fix for RT#2245 * Thuban/UI/application.py (ThubanApplication.OnInit): Initialize instance variables before trying to create any windows. Creating windows can start an event loop if e.g. message boxes are popped up for some reason, and event handlers, especially EVT_UPDATE_UI may want to access things from the application. (ThubanApplication.maps_changed): The mainwindow may not have been created yet, so check whether it has been created before calling its methods * Thuban/UI/view.py (MapCanvas.OnIdle): Only try to redraw if we have a map
(MapCanvas.Export): Remove accidentally added line
(MapCanvas.Export): Avoid UnboundLocalError.
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
(MapCanvas.OnLeftUp): Release the the mouse before calling MouseLeftUp. MouseLeftUp may pop up modal dialogs which leads to an effectively frozen X session because the user can only interact with the dialog but the mouse is still grabbed by the canvas. Also, call the tool's Hide method before MouseLeftUp because MouseLeftUp may change the tool's coordinates.
* 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.
(MapCanvas.OnLeftDown): Capture the mouse.
* Thuban/UI/viewport.py: Remove unused imports * Thuban/UI/view.py: Remove unused imports
* test/test_export.py Remove unused imports. The OutputTransform function is now in viewport.py and is called output_transform (TestScalebar.test_output_transform) (TestScalebar.test_OutputTransform): Renamed to test_output_transform and updated to use output_transform instead of OutputTransform * Thuban/UI/view.py (OutputTransform): Moved to viewport.py and renamed. (MapCanvas.Export, MapPrintout.draw_on_dc): OutputTransform was renamed to output_transform * Thuban/UI/viewport.py (OutputTransform, output_transform): Rename to output_transform
Stripped out all non-wx functionality. Fixes RTTbug #1992.
Fixes RTbug #1974, 1971. (MapCanvas.__init__): Subscribe to the idle time event. Set background color to white. (MapCanvas.OnPaint): Set a flag indicating that we should render the map during idle time. If we already have a bitmap just draw it now. (MapCanvas.OnIdle): New. Render the map only during idle time. This also fixes a problem with the busy cursor under gtk.
(MapCanvas.OnPaint): Call wxBeginBusyCursor() directly to avoid the wxSafeYield() call which generates an OnPaint event causing infinite recursion. Don't try to catch exception anymore. This was for before there were limits on map scaling.
Use Thuban[Begin|End]BusyCursor() instead of a direct call to wx[Begin|End]CusyCursor(). (MapCanvas.find_shape_at): Check if the current search layer support shapes, otherwise go on to the next layer.
(MapCanvas.OnPaint): Call wxYield after turning on the busy cursor to allow the system to change the cursor before we begin painting. This fixes a problem that was occuring only under GTK. Fixes RTbug #1840.
(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.
(MapCanvas.__init__): New instance variable current_map_proj to remember the current map projection so that when the projection changes we know what the previous projection was. (MapCanvas.SetMap): Unsubscribe and subscribe to LAYER_PROJECTION_CHANGED events. (MapCanvas.projection_changed): Split into two methods that respond to map and layer projection changes. (MapCanvas.map_projection_changed): New. Takes the current view and projects it using the new projection. This does not cause the map to be redrawn at full extent. (MapCanvas.layer_projection_changed): New. Cause a redraw which will draw each layer in its new projection.
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
(MapCanvas.set_view_transform): Limit the maximum and minimum scale factors.
(MapCanvas.OnPaint): Wrap code with try/finally. Fixes RTBug #1904. (MapCanvas.FitSelectedToWindow): If a single point is selected simply center it on the display. Fixes RTBug #1849.
Replace the true/false of wxWindows by True/False of Python 2.2.1.
Added checks against if scale == 0. This is a serious problem that can occur when an image without geo data is loading and causes the map projection bounds to go to infinity. Right now, the solution is to simply try to recover.
(MapCanvas.set_view_transform): Try to limit how small the scale can get. This still needs more testing.
Bugfix
(MapPrintout.__init__): Enhanced parameter set to fullfil information needed for PrinterRenderer. (MapCanvas.Export): New. Export Map (currently only to WMF on Win32). (MapCanvas.Print): Adapted to new MapPrintout. (OutputTransform): General calculations to transform from canvas coordinates to export/printing devices.
(MapCanvas): Delegate "SelectedShapes" so the table view can call it.
(MapCanvas.set_view_transform): Issue SCALE_CHANGED.
(MapCanvas): Added delegated method HasSelectedShapes. (MapCanvas.FitSelectedToWindow): New. Centers and scales any selected shapes on the canvas using the map projection (if any).
(MapCanvas.FitLayerToWindow): The bbox rectangle should be fit into the window whether or not the map has a projection.
(MapCanvas.FitLayerToWindow): New. Centers and scales the given layer on the canvas using the map projection.
(MapCanvas.OnPaint): Add a try/except block around the redraw routine to try to catch problems that the user may create by selecting invalid projections for the data set and map. Clears the display if there are any problems and prints the error. (MapCanvas.do_redraw): Use DC.Clear() instead of drawing a filled rectangle.
Fix some typos.
Rename Color.None to Color.Transparent.
(MapCanves.SetMap): Listen for LAYER_CHANGED, not LAYER_LEGEND_CHANGED,messages.
Use new message names.
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.
Function name changes.
(MapCanvas.find_shape_at): Use method calls instead of accessing now non-existent class variables.
(MapCanvas.OnLeftUp): Make sure that the dragging flag is always set to 0 even when the tool implementation raises an exception
(MapCanvas.SelectTool): New method to select the tool to avoid direct assignments to instance variables (MapCanvas.ZoomInTool, MapCanvas.ZoomOutTool, MapCanvas.PanTool) (MapCanvas.IdentifyTool, MapCanvas.LabelTool): Use SelectTool to change the tool
* Thuban/UI/view.py: Get rid of the idle redraw. This is done by wxWindows already and our implementation doesn't work correctly with wxGTK 2.3: (MapCanvas.__init__): Remove the instance variable (MapCanvas.OnPaint): Always call do_redraw when there's a map to be drawin (MapCanvas.OnIdle): Removed.
(MapCanvas.unprojected_rect_around_point): Add a parameter to determine the size of the rectangle. (MapCanvas.find_shape_at): Create the box around the point on a layer by layer basis and make the size depend on the shape type. This solves a problem with the selection of point shapes at the border of the layer's bounding box
* Thuban/UI/view.py (MapCanvas.__init__, MapCanvas.OnPaint) (MapCanvas.do_redraw): Get rid of the unused update_region instance variable
Add some more doc-strings.
Add/update some doc-strings.
(ZoomInTool.MouseUp, ZoomOutTool.MouseUp): Handle degenrate rectangles.
(MapCanvas.OnLeftUp): Only release the mouse when we have actually captured it.
(MapCanvas.find_shape_at): Change the selected_layer parameter to searched_layer which is the layer to search in. (MapCanvas.SelectShapeAt): New parameter layer to restrict the search to that layer. Return the selected layer and shape.
(ZoomOutTool.MouseUp): Use the correct x-coordinate in case of simple clicks
remove some debug prints
* Thuban/UI/view.py (MapCanvas.shape_selected): Only redraw when necessary. (MapCanvas.__init__): New instance variables, last_selected_layer and last_selected_shape to determine how the selection has changed.
* Thuban/UI/view.py (PanTool.MouseMove): Use the bitmap the view maintains to redraw the window during a drag. (MapCanvas.unprojected_rect_around_point): New method to determine a small region around a point for hit-testing. (MapCanvas.find_shape_at): Only test the shapes in a small region around the point.
* Thuban/UI/view.py (MapCanvas.do_redraw): Pass the entire bitmap as update_region to the renderer.
* Thuban/UI/view.py (MapCanvas.__init__): New instance variable update_region for the update region. (MapCanvas.OnPaint): Maintain the update region (MapCanvas.do_redraw): Pass the bounding box of the update_region to the renderer when drawing the bitmap. Reset the update_region.
* Thuban/UI/view.py: Keep the temporary bitmap used during drawing around to speed up most redraws: (MapCanvas.__init__): New instance variable bitmap which holds the bitmap (MapCanvas.do_redraw): Redraw self.bitmap if necessary. Use self.bitmap to draw. (MapCanvas.full_redraw): New method to force a full redraw including the bitmap (MapCanvas.SetMap): Subscribe full_redraw instead of redraw to make sure the bitmap is redrawn. (MapCanvas.projection_changed, MapCanvas.set_view_transform, MapCanvas.shape_selected): Call full_redraw instead of readraw to make sure the bitmap is redrawn. (MapCanvas.OnSize): New method to handle size events so that the bitmap can be redrawn.
* Thuban/UI/view.py (MapCanvas): Derive from Publisher as well (MapCanvas.__del__): Implement because Publisher.__del__ has to be called. (MapCanvas.__init__): Bind EVT_LEAVE_WINDOW too. Initialize current_position (MapCanvas.set_current_position): New method to set current_position. Issue a VIEW_POSITION event (MapCanvas.CurrentPosition): New public method to return the value of current_position. Should be called when the VIEW_POSITION event is processed. (MapCanvas.OnLeftDown, MapCanvas.OnLeftUp, MapCanvas.OnMotion): Update the position. (MapCanvas.OnLeaveWindow): Set the position to None.
* Thuban/UI/view.py (MapCanvas.SelectShapeAt): Search through all layers by default. Easier to use than the previous default of only searching through the select layer which meant that if no layer was selected, you couldn't select a shape.
(MapCanvas.find_shape_at): Iterate backwards (i.e. with decreasing index, i.e. reversed drawing order) so that objects appearing to be in from of others are selected first. This is probably mostly relevant for point shapes where the symbols used may overlap
* Thuban/UI/view.py (MapCanvas.OnPaint): Only delay drawing to idle time when there actually is something to draw. If there's nothing to draw simply clear the window (MapCanvas.do_redraw): Call dc.EndDrawing and add some comments. (MapCanvas.SetMap): force a redraw in all cases because FitMapToWindow doesn't always do it. (MapCanvas.ZoomFactor): Add an optional parameter, center, to specify the point to move into the center of the window (ZoomOutTool.MouseUp, ZoomInTool.MouseUp): If the mouse wasn't dragged, zoon in/out by a factor of 2
(MapCanvas.FitRectToWindow): If the rect has zero with or zero height do nothing (avoids zero division errors)
* Thuban/UI/view.py (MapCanvas.find_shape_at):Add a new parameter that can limit the search to the currently selected layer. (MapCanvas.SelectShapeAt): Make sure that the currently selected layer stays selected even when no shape is found
New argument, interactor.
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 |