2003-07-25 Frank Koormann Backport from HEAD: More comfortable table view: * Thuban/UI/tableview.py: Use Thuban[Begin|End]BusyCursor() instead of a direct call to wx[Begin|End]CusyCursor(). (QueryTableFrame.__init__): Create a status bar. Fixes RTbug #1942. Explicitly set which items are selected in the operator choice and action choice so there is always a valid selection. Fixes RTbug #1941. Subscribe to grid cell selection events so we can update the status bar. Add an Export Selection button and move the export buttons underneath the table. Use the panel as the parent window for all the controls. Reparent the grid so that the panel is the parent. Call UpdateStatusText() to correctly initialize the status bar. (QueryTableFrame.UpdateStatusText): Update the status bar with how many rows are in the grid, how many columns, and how many rows are selected. Added event argument so that it can respond to grid selection events. The status text is now updated even when the table is not associated with a layer as was previously assumed. (QueryTableFrame.OnSaveAs): Renamed to doExport. (QueryTableFrame.doExport): Helper function that saves the entire table, or selected rows, to a file. (QueryTableFrame.OnExport, QueryTableFrame.OnExportSel): New. Respond to export button events and call doExport. (QueryTableFrame.OnQuery): Use the string value in the value combo if either the selected item index is 0 or if the string cannot be found in the predefined list (this happens if the user changes the text). Fixes RTbug #1940. Only turn off the grid event listeners if there a query comes back with a none empty list of ids. in the case that the list is empty this causes a grid.ClearSelection() call to actually clear the grid selection which causes the selected items in the map to be deselected. Fixes RTbug #1939. (LayerTableGrid.select_shapes): Don't use deprecated layer instance variables (TableFrame): Inherit from ThubanFrame so we can have a status bar and control buttons. (TableFrame.__init__): Add a panel object that can be used by derived classes to place any controls (including the grid) onto. (TableGrid.__init__): Create an instance variable to keep track of how many rows are selected. Subscribe once to the the events we are interested in. (ThubanGrid.OnRangeSelect): Only handle event if event handling hasn't been turned off. (ThubanGrid.OnSelectCell): Only handle event if event handling hasn't been turned off. (ThubanGrid.ToggleEventListeners): Rather than subscribe None as an event listener (which changes the event handler stack) simply set an instance variable to False. This is checked in the event handlers. (ThubanGrid.GetNumberSelected): Return the number of currently selected rows. * Thuban/UI/common.py (ThubanBeginBusyCursor, ThubanEndBusyCursor): New. Wrappers around the wxWindows functions that allow us to make additional calls such as wxYield which gives the native system a chance to update the cursor correctly. (ThubanBeginBusyCursor): Call wxSafeYield to make sure that we don't create reentrant possibilities with wxYield. * Thuban/Model/table.py (table_to_dbf, table_to_csv): Added 'rows' parameter which is a list of records that restricts which records are saved. Fixes RTbug #1997. (_find_dbf_column_names): New. Helper function for table_to_dbf (table_to_dbf): Deal with names longer than the 10 character limit 2003-07-24 Frank Koormann * Thuban/UI/join.py: Set CHOICE_WIDTH to 300. 2003-07-16 Bernhard Herzog * Thuban/UI/messages.py (MAP_REPLACED): New message. * Thuban/UI/view.py (MapCanvas.SetMap): Issue MAP_REPLACED after the new map has been assigned * Thuban/UI/mainwindow.py (MainWindow.delegated_messages): Delegate MAP_REPLACED to the canvas too * Thuban/UI/classifier.py (Classifier.__init__): Subscribe to MAP_REPLACED so that we can close the dialog if a new map is set. (Classifier.unsubscribe_messages): Unsubscribe from MAP_REPLACED (Classifier.map_replaced): Handle MAP_REPLACED by closing the dialog 2003-07-14 Frank Koormann Backport from HEAD * Thuban/Model/load.py (SessionLoader.start_map): Encode map title to latin1. Fixes https://intevation.de/rt/webrt?serial_num=2013 * test/test_load.py (TestUnicodeStrings): New, test load of unicode strings from session file: session title, map title, layer title and projection name. 2003-07-08 Bernhard Herzog Backport from HEAD * Thuban/Model/transientdb.py (TransientTableBase.Width): The type constants in the column objects are the standard ones defined in the table module. * test/test_transientdb.py (TestTransientTable.test_transienttable_to_dbf): New. Test whether exporting transient tables as DBF works. This should catch the bug just fixed in TransientTableBase.Width. 2003-07-04 Bernhard Herzog Backport from HEAD * Thuban/Model/table.py (_find_dbf_column_names): New. Helper function for table_to_dbf (table_to_dbf): Deal with names longer than the 10 character limit * test/test_dbf_table.py (TestTableToDBF.test_table_to_dbf): Add doc-string (TestTableToDBF.test_table_to_dbf_long_col_names): New test for long column names 2003-07-03 Bernhard Herzog Backport from HEAD * Thuban/Model/transientdb.py (TransientJoinedTable.__init__): Update doc-string (TransientJoinedTable.create): Do not modify the column objects of the input tables in place and copy all columns of the input tables into the joined table after all. * test/test_transientdb.py (TestTransientTable.test_transient_joined_table_same_column_name): Update to reflect the new behavior (TestTransientTable.test_transient_joined_table_with_equal_column_names): Update to reflect the new behavior (TestTransientTable.test_transient_joined_table_name_collisions_dont_modify_in_place): New test case for a bug which modified the column objects in place 2003-07-01 Frank Koormann Partly backport from HEAD * test/test_transientdb.py (TestTransientTable.test_transient_joined_table_same_column_name): New. Test whether joining on columns with the same names in both tables works. (TestTransientTable.test_transient_joined_table_with_equal_column_names): New. Test join of two tables with partly equal column names. * Thuban/Model/transientdb.py (TransientJoinedTable.create): Make sure to use the right internal names even when joining on field with the same names in both tables. Also, detect duplicate names in the joined table correctly. If duplicates are found, append '_' (underscores) to the name until it is unique. Create always new internal names for the resulting table and reference columns in the join statement with . 2003-07-01 Frank Koormann Backport from HEAD * Thuban/UI/renderer.py (ExportRenderer.render_legend): Reverse List of layers to render in same order as in desktop legend. 2003-06-25 Jonathan Coles * Thuban/UI/classifier.py (Classifier.EditSymbol): The parent of the SelectPropertiesDialog should be self so the window appears on top. (ClassGroupPropertiesCtrl.DoEdit): The parent of the SelectPropertiesDialog should be self so the window appears on top. 2003-06-18 Frank Koormann * Thuban/UI/scalebar.py (ScaleBar.DrawScaleBar): Apply conversion to scale if projection is latlong to get better estimate. 2003-06-17 Jonathan Coles Backport from HEAD. The view should respond to layer projection changed events to update the display. Changes to a projection should not cause the map to be set to full extent. * Thuban/UI/view.py (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. 2003-06-16 Frank Koormann Fix problem of hidden properties dialog under windows after double click on layer tree: The tree control always gets an Expanded / Collapsed event after the ItemActivated on double click, which raises the main window again. We add a second ItemActivated event to the queue, which simply raises the already displayed window. * Thuban/UI/legend.py (LegendTree.__init__): Instance variable raiseProperties initialized to prevent endless loops (LegendTree._OnItemActivated): Depending on self.raiseProperties simply raise the properties or open the dialog and issue a second event. 2003-06-16 Frank Koormann * Thuban/UI/view.py (MapCanvas.set_view_transform): Set max_scale to 2147483648.0 / max_len (which is sufficient for GREAT-ER). For HEAD in the future a more flexible concept has to be developed determining the rendering of "large" objects. 2003-06-16 Jonathan Coles Backport from HEAD. Fix a problem under Windows whereby if the user double-clicks on a layer in the legend that tree item will expand or collapse as well as open the layer properties dialog. The state of the tree item should not be affected. * Thuban/UI/legend.py (LegendTree.__init__): Add instance variable preventExpandCollapse and subscribe to expanding and collapsing events. (LegendTree.OnItemExpandCollapse): New. Responds to expanding and collapsing events and will veto the event if it has been triggered by the user double clicking on a layer. (LegendTree._OnItemActivated): Set preventExpandCollapse to indicate that an expanding/collapsing event should be vetoed. 2003-06-13 Bernhard Herzog Backport from HEAD. * Thuban/UI/classifier.py (Classifier.map_layers_removed) (Classifier.layer_shapestore_replaced, Classifier.OnClose): Unsubscribe the messages in OnClose and not in map_layers_removed or layer_shapestore_replaced to make sure it always happens when the dialog is closed. 2003-06-13 Jonathan Coles [NOTE: This is a back-port from the current CVS head] This puts back a fix for Windows where a panel is needed so that the background of the table view appears correctly. * Thuban/UI/tableview.py (TableFrame.__init__): Add a panel object that can be used by derived classes to place any controls (including the grid) onto. (QueryTableFrame.__init__): Use the panel as the parent window for all the controls. Reparent the grid so that the panel is the parent. Call UpdateStatusText() to correctly initialize the status bar. * Thuban/UI/dialogs.py (ThubanFrame): New: a class that inherits from wxFrame (as opposed to wxDialog like the other classes) but otherwise behaves like the other classes. This is needed for the TableView which isn't really a dialog and needs to have a status bar and control buttons. [NOTE: This is a back-port from the current CVS head] * Thuban/UI/tableview.py (TableGrid.__init__): Create an instance variable to keep track of how many rows are selected. Subscribe once to the the events we are interested in. (ThubanGrid.OnRangeSelect): Only handle event if event handling hasn't been turned off. (ThubanGrid.OnSelectCell): Only handle event if event handling hasn't been turned off. (ThubanGrid.ToggleEventListeners): Rather than subscribe None as an event listener (which changes the event handler stack) simply set an instance variable to False. This is checked in the event handlers. (ThubanGrid.GetNumberSelected): Return the number of currently selected rows. (TableFrame): Inherit from ThubanFrame so we can have a status bar and control buttons. (QueryTableFrame.__init__): Create a status bar. Fixes RTbug #1942. Explicitly set which items are selected in the operator choice and action choice so there is always a valid selection. Fixes RTbug #1941. Subscribe to grid cell selection events so we can update the status bar. (QueryTableFrame.UpdateStatusText): Update the status bar with how many rows are in the grid, how many columns, and how many rows are selected. (QueryTableFrame.OnGridSelectRange, QueryTableFrame.OnGridSelectCell): Call UpdateStatusText when cells are (de)selected. (QueryTableFrame.OnQuery): Use the string value in the value combo if either the selected item index is 0 or if the string cannot be found in the predefined list (this happens if the user changes the text). Fixes RTbug #1940. Only turn off the grid event listeners if there a query comes back with a none empty list of ids. in the case that the list is empty this causes a grid.ClearSelection() call to actually clear the grid selection which causes the selected items in the map to be deselected. Fixes RTbug #1939. 2003-06-13 Bernhard Herzog * Thuban/UI/identifyview.py (IdentifyView.__init__): Call self.selected_shape with the current selection to make sure the contents of the dialog are up to date when it's shown for the first time. The dialog used to work without this by luck. The recent fix to the connector module 'broke' a 'feature' the identify view was relying on, i.e that subscribing to a message in response to receiving a message of that type would mean that the new subscriber would also be called for the same message. 2003-06-12 Jonathan Coles * Thuban/UI/legend.py (ScaleBarBitmap.__SetScale): Don't draw the scalebar if the current map has no projection set. * Thuban/UI/projdialog.py (ProjFrame.__DoOnProjAvail): Set the projfilepath label to just the basename of the projection file rather than include the entire path. 2003-06-11 Frank Koormann * Thuban/Lib/fileutil.py (get_application_dir): Minor stability update. 2003-06-11 Frank Koormann * Thuban/Lib/fileutil.py (get_application_dir): New function to determine the absolute .thuban/thuban directory under "posix" (os.expanduser) and "nt" (read AppData registry key). * Thuban/Model/resource.py: Use get_application_dir * Thuban/UI/application.py (ThubanApplication.read_startup_files): Use get_application_dir. 2003-06-10 Bernhard Herzog * Thuban/UI/tableview.py (LayerTableFrame.__init__): Subscribe to the messages MAP_LAYERS_REMOVED messages (LayerTableFrame.OnClose): Unsubscribe from it. (LayerTableFrame.map_layers_removed): New. Receiver for MAP_LAYERS_REMOVED. Close the dialog when the layer whose the dialog is showing is removed. 2003-06-10 Bernhard Herzog * Thuban/Lib/connector.py (Connector.Issue): Iterate over a copy of the receivers list so that unsubscribing in a receiver doesn't modify it while iterating over it. * test/test_connector.py (ConnectorTest.test_disconnect_in_receiver): New. Test whether unsubscribing in a receiver works correctly. See docstring for details 2003-06-10 Bernhard Herzog * Thuban/Model/messages.py (LAYER_SHAPESTORE_REPLACED): New message. * Thuban/Model/layer.py (Layer.SetShapeStore): Send LAYER_SHAPESTORE_REPLACED when the shapestore changes. A LAYER_CHANGED will still be sent if the classification changes. * Thuban/UI/classifier.py (Classifier.__init__): Add the map as parameter so we can subscribe to some of its messages (Classifier.__init__): Subscribe to the map's MAP_LAYERS_REMOVED and the layer's LAYER_SHAPESTORE_REPLACED (Classifier.unsubscribe_messages): New. Unsubscribe from message subscribed to in __init__ (Classifier.map_layers_removed) (Classifier.layer_shapestore_replaced): receivers for the messages subscribed to in __init__. Unsubscribe and close the dialog * Thuban/UI/mainwindow.py (MainWindow.OpenLayerProperties): Pass the map to the Classifier dialog * test/test_layer.py (SetShapeStoreTests): Derive from SubscriberMixin as well so we can test messages (SetShapeStoreTests.setUp): Subscribe to some of the layer's messages (SetShapeStoreTests.tearDown): Clear the messages again (SetShapeStoreTests.test_sanity): Expand the doc-string and check for the modified flag too (SetShapeStoreTests.test_set_shape_store_modified_flag): New test to check whether SetShapeStore sets the modified flag (SetShapeStoreTests.test_set_shape_store_different_field_name) (SetShapeStoreTests.test_set_shape_store_same_field) (SetShapeStoreTests.test_set_shape_store_same_field_different_type): Add tests for the messages. This checks both the new LAYER_SHAPESTORE_REPLACED and the older LAYER_CHANGED 2003-06-06 Jan-Oliver Wagner * Thuban/UI/mainwindow.py: Improved and partly added help texts for the menu items. 2003-06-05 Frank Koormann * Thuban/UI/identifyview.py (IdentifyView.__init__): Layout reimplemented without panel. Make life easier to fit the list in the dialog. 2003-06-05 Frank Koormann * Thuban/UI/projdialog.py (ProjFrame.__init__): Fill the projchoice once on initialisation (Former implementation resulted in multiple entries for each projection). (ProjFrame.__FillAvailList): selectProj as second optional parameter, if set, select the projection found under the specified name. This overwrites any other selection estimate. Removed projchoice filling from this method. (ProjFrame._OnSave, ProjFrame._OnAddToList): Updated call of ProjFrame.__FillAvailList (LCCPanel._DoLayout): Moved parameter controls in more common order. * Resources/Projections/defaults.proj: Extended defaults representing various common European projections. 2003-06-05 Frank Koormann * Thuban/UI/identifyview.py (IdentifyView.__init__): Use ListCtrl instead of GridCtrl * Thuban/Model/resource.py: Guess location of .thuban directory from tempdir parent directory. * Thuban/UI/application.py (ThubanApplication.read_startup_files): Guess location of .thuban directory from tempdir parent directory. 2003-06-04 Bernhard Herzog Do not cache the values returned by the tree widget's GetFirstChild and GetNextChild methods because it led to lots of segfaults. The new way requires more brute force but is more reliable. * Thuban/UI/legend.py (LegendTree.__init__): Remove instance variable layer2id (LegendTree.find_layer): New method to do with brute force what layer2id tried to accomplish (LegendTree._OnMsgLayerChanged) (LegendTree._OnMsgLayerTitleChanged, LegendTree.__ShowHideLayer): Use find_layer instead of layer2id (LegendTree.__RemoveLayer, LegendTree.__AddLayer): No need to update layer2id anymore (LegendTree._OnMsgMapLayersRemoved) (LegendTree._OnMsgMapLayersAdded): Get by without layer2id. 2003-06-03 Thomas Koester * Thuban/Model/classgen.py (GenQuantiles0): New function. 2003-06-02 Bernhard Herzog * Thuban/UI/mainwindow.py (layer_rename command, table_rename command): New commands. (main_menu): Add the new commands. (MainWindow.TableRename): New. Implementation of the table_rename command. (MainWindow.RenameLayer): New. Implementation of the layer_rename command. * Thuban/Model/session.py (Session.AddTable): call self.changed to set the modified flag * test/test_session.py (TestSessionSimple.test_add_table): Test whether the modified flag is set properly * Thuban/Model/base.py (TitledObject.SetTitle): Call changed instead of issue so that the modified flags get updated. * test/test_base.py (SomeTitledObject): Derive from Modifiable instead of Publisher to reflect reality better and to accomodate the fact that SetTitle now calls changed instead of issue 2003-06-02 Bernhard Herzog * Thuban/UI/classgen.py (GenQuantilesPanel.GetList): Resource acquisition has to happen before the try in a try-finally. 2003-06-02 Bernhard Herzog * Thuban/UI/legend.py (LegendTree._OnMsgMapLayersRemoved): It's possible that a layer is removed that is not currently selected in the legend so don't check for this. 2003-05-30 Bernhard Herzog * Thuban/Model/layer.py (Layer.Destroy): Set all instance variables to None that have direct or indirect references to shapefiles or dbf files to make sure that they do go away and the files are closed. 2003-05-30 Bernhard Herzog * Thuban/UI/legend.py (LegendTree.GetRootItem): Reset availImgListIndices when a new image list is created 2003-05-30 Bernhard Herzog * Thuban/UI/legend.py (LegendTree.__init__): New instance variable changing_selection to indicate whether the LegendTree code itself is currently changing the selection (LegendTree.normalize_selection): New method to normalize the selection by selecting the layer item even if the user clicked on the classification. (LegendTree._OnSelChanged): normalize the selection. This works around a bug in wx which doesn't keep track of the selection properly when subtrees are deleted. 2003-05-30 Bernhard Herzog * Thuban/UI/view.py (MapCanvas.set_view_transform): Limit the maximum and minimum scale factors. * test/test_classgen.py (ClassGenTest.test): Update to reflect the changes in classgen.py 2003-05-30 Jonathan Coles * Thuban/Model/classgen.py: Remove ClassGenerator class but make all the methods functions. Fixes RTBug #1903. * Thuban/Model/map.py (Map.TopLayer, Map.BottomLayer): Renamed to MoveLayerToTop and MoveLayerToBottom respectively. Fixes RTBug #1907. * Thuban/UI/classgen.py: Use classgen functions that were part of the ClassGenerator class. Put try/finally blocks around code that uses wxBeginBusyCursor()/wxEndBusyCursor(). Fixes RTBug #1904. * Thuban/UI/classifier.py: Remove unused import of ClassGenerator. * Thuban/UI/legend.py: The legend was cleared and repopulated any time something changed which caused some state to be lost such as which children were expanded or collapsed. Fixes RTBug #1901. (LegendTree._OnMsgMapLayersAdded): Add only new layers. (LegendTree.__OnMsgMapLayersRemoved): Remove layers that exist in the legend but not in the map. (LegendTree.__FillTree): Move main functionality out into smaller methods that can be used by other methods. (LegendTree.__FillTreeLayer): Reuse old slots in the image list if they are available. (LegendTree.DeleteAllItems): Renamed from __DeleteAllItems so that we override the wxTreeCtrl method. Iterate over children and call __RemoveLayer. (LegendTree.__AddLayer): New. Add a new layer to the legend. (LegendTree.__RemoveLayer): Remove a layer from the legend. (LegendTree.DeleteChildren): New, overrides wxTreeCtrl method. Should only be called with the id of a layer branch. (LegendTree.GetRootItem): New, overrides wxTreeCtrl method. Returns the root item or creates one if necessary. * Thuban/UI/renderer.py (MapRenderer.draw_raster_layer): Call ProjectRasterFile with tuple arguments instead of strings. * Thuban/UI/tableview.py (QueryTableFrame.OnQuery): Wrap code with try/finally. Fixes RTBug #1904. * Thuban/UI/view.py (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. * extensions/thuban/gdalwarp.cpp: Removed code that allowed gdalwarp to be compiled as a standalone app. Now the code can only be called from Python which simplifies the parameter passing. (ProjectRasterFile): Handle Python arguments. Remove code that checks for a destination dataset. Add more clean up code. * test/test_map.py (TestMapWithContents.test_raise_layer_top, TestMapWithContents.test_lower_layer_bottom): Test Map.MoveLayerToTop() and Map.MoveLayerToBottom() respectively. Fixes RTBug #1907. * Thuban/UI/mainwindow.py (MainWindow.ToggleLegend): Apply a full extent to the map when the legend is toggled. Fixes RTBug #1881. 2003-05-29 Jan-Oliver Wagner * Thuban/UI/tableview.py (LayerTableFrame.OnClose): Bug-fix: Now unsubscribes all that is subcribed in __init__. 2003-05-28 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.DuplicateLayer) (MainWindow.CanDuplicateLayer): New methods to implement the Layer/Duplicate command. (layer_duplicate command): New. (main_menu): Add layer_duplicate to the Layer menu. 2003-05-28 Bernhard Herzog * Thuban/UI/tableview.py (NullRenderer.Draw): New. Our own renderer so that NULL/None values get displayed differently (by a gray rectangle). (TableGrid.__init__): Override the default renderers 2003-05-28 Bernhard Herzog * Thuban/Model/layer.py (Layer.SetShapeStore): Set the classification to "None" if the type of the field has changed. * test/test_layer.py (SetShapeStoreTests): New. Class with a few test for the Layer.SetShapeStore method 2003-05-28 Jan-Oliver Wagner * Thuban/Model/layer.py (Layer.TreeInfo): Fixed a bug (a layer does not necessarily have a filename). 2003-05-28 Jan-Oliver Wagner * Thuban/UI/mainwindow.py (MainWindow.TableClose, MainWindow.TableShow): sort the selection list for the dialog. 2003-05-28 Frank Koormann * extensions/thuban/wxproj.cpp (project_point): Removed cast to int for projected point coordinates. (shape_centroid): Return last point if all polygon vertices fall to one point. 2003-05-28 Bernhard Herzog * Thuban/UI/mainwindow.py (_can_unjoin): Add doc-string and cope with layers that don't have shapestores, i.e. raster layers. 2003-05-28 Bernhard Herzog * Thuban/Model/table.py (DBFTable.__init__): Omit the extension when determining the title from the filename. * test/test_dbf_table.py (TestDBFTable.test_title): Update to reflect changes in the way the title is derived from the filename 2003-05-28 Frank Koormann * Thuban/UI/mainwindow.py (MainWindow.TableShow): Added wxDEFAULT_DIALOG_STYLE to show table dialog styles. 2003-05-27 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.delegated_messages): Also delegate SelectedLayer. (MainWindow.LayerUnjoinTable): Implement. (_can_unjoin): New. Helper function for the sensitivity of the layer/unjoin command. * Thuban/Model/data.py (ShapefileStore.OrigShapeStore) (DerivedShapeStore.OrigShapeStore): New. Return the original shapestore. Used to figure out how to unjoin. (DerivedShapeStore.Shapefile): Fix a typo. 2003-05-27 Bernhard Herzog * Thuban/UI/join.py (JoinDialog): Extend to handle layer joins as well (JoinDialog.__init__): Use the layer parameter and only build the left choice when a layer is given (JoinDialog.OnJoin): Handle layer joins as well (JoinDialog.OnLeftTable, JoinDialog.OnRightTable): Handle the case that the user selects the "Select..." item. The sensitivitly updating is now in update_sensitivity (JoinDialog.y): New method to refactor the sensitivity update of the join button into its own method. * Thuban/UI/mainwindow.py (MainWindow.LayerJoinTable): Implement. 2003-05-27 Bernhard Herzog * Thuban/UI/mainwindow.py (table_close command): Make it sensitive iff there are unreferenced tables in the session 2003-05-27 Bernhard Herzog * Thuban/Model/messages.py (TABLE_REMOVED): New message. * Thuban/Model/session.py (Session.UnreferencedTables): New method to return tables that are not referenced by other tables or shape stores and can be removed. (Session.RemoveTable): Issue a TABLE_REMOVED message after removing the table * Thuban/UI/mainwindow.py: Remove unused imports (MainWindow.TableClose): Implement. * Thuban/UI/tableview.py (TableFrame.__init__): Subscribe to some messages so that the frame will be automatically closed when a new session is opened or the table is removed. (TableFrame.OnClose): Unsubscribe the Subscriptions made in __init__ (TableFrame.close_on_session_replaced) (TableFrame.close_on_table_removed): New. Subscribers that close the window * test/test_session.py (TestSessionMessages.test_remove_table) (TestSessionSimple.test_remove_table): Move the test to TestSessionSimple and add test for the TABLE_REMOVED message (TestSessionBase.setUp): Also subscribe to TABLE_REMOVED (TestSessionSimple.test_unreferenced_tables) New. Test for the UnreferencedTables method. (UnreferencedTablesTests): New. Class with some more sophisticated tests for UnreferencedTables. 2003-05-27 Frank Koormann * Thuban/UI/tableview.py (QueryTableFrame.__init__): The "_S_election" display has some unwanted side effects. Removed again. 2003-05-27 Frank Koormann * Resources/Bitmaps/legend_icon_layer.xpm: New, icon for legend. * Thuban/UI/legend.py (LegendTree.__FillTree): Use "legend_icon_layer" 2003-05-27 Jan-Oliver Wagner * test/test_menu.py (MenuTest.test): Added test for Menu.RemoveItem(). * Thuban/UI/menu.py (Menu.RemoveItem): New. Remove an item from the menu. 2003-05-27 Frank Koormann Nonmodal dialogs without parent (i.e. they can fall behind the main window) * Thuban/UI/mainwindow.py (MainWindow.OnClose): Explicitly destroy all dialogs in the dialogs dictionary and the canvas. * Thuban/UI/dialogs.py (NonModalNonParentDialog): New class, without parent, i.e. can fall behind other windows. (NonModalDialog.OnClose): Check is dialog is in mainwindow.dialog dictionary before removing it. * Thuban/UI/classifier.py: Dialog derived from NonModalNonParentDialog * Thuban/UI/projdialog.py: Dialog derived from NonModalNonParentDialog * Thuban/UI/tableview.py: Dialog derived from NonModalNonParentDialog * Thuban/UI/tree.py: Dialog derived from NonModalNonParentDialog 2003-05-27 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.ShowTableView): New. Open a tableview dialog (MainWindow.TableShow): Use ShowTableView to open the dialogs. Also, don't use the table's titles as the dialog names. The titles aren't guaranteed to be unique. (MainWindow.TableOpen): Open a table view dialog after opening the table 2003-05-27 Bernhard Herzog * Thuban/UI/mainwindow.py: Remove the Table/Hide menu item. Its effect can be achieved by simply closing the window showing the table. (MainWindow.TableHide): Removed. (main_menu): Removed "table_hide" 2003-05-27 Frank Koormann Fix legend tree display problems under Win32 * Thuban/UI/legend.py: BMP_SIZE_W = 15 (LegendTree.__FillTree): Display "legend_icon_map.xpm" with layer title. (LegendTree.__FillTreeLayer): Explicitely set SelectedImage. * Resources/Bitmaps/legend_icon_map.xpm: New icon for legend. 2003-05-27 Jan-Oliver Wagner * Thuban/UI/menu.py (Menu.InsertSeparator): Additional optional parameter 'after' now allows to insert separators almost anywhere in the menu. 2003-05-27 Frank Koormann * Thuban/UI/tableview.py (QueryTableFrame.__init__): Underline the "S" of selection box label to hint on hot key (Alt-S). Works under Win32 but is ignored under GTK. 2003-05-26 Frank Koormann * Thuban/UI/projdialog.py (ProjFrame.__do_layout, ProjPanel._DoLayout): Center Choices. 2003-05-26 Bernhard Herzog Remove the Precision methods again. They're too DBF specific to be part of the table interface and they're only used in table_to_dbf anyway. * Thuban/Model/transientdb.py (TransientTableBase.Width):Use a fixed precision of 12 for doubles. (TransientTableBase.Precision): Removed (AutoTransientTable.Width): Delegate to self.table. * Thuban/Model/table.py (DBFTable.Precision) (MemoryTable.Precision): Removed. (MemoryTable.Width): Use a fixed precision of 12 for doubles. (table_to_dbf): Use a fixed precision of 12 for floats unless the column object specifies something else. * test/test_dbf_table.py (TestTableToDBF.test_table_to_dbf): New. test for table_to_dbf 2003-05-26 Bernhard Herzog * test/test_transientdb.py (TestTransientTable.run_iceland_political_tests): Fix a comment. 2003-05-26 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.TableOpen): Real implementation. Mark parts of the file format strings for localization. * Thuban/Model/session.py (Session.OpenTableFile): New. Open a dbf file and add the table to the tables managed by the session * test/test_session.py (TestSessionSimple.test_open_table_file): New. test case for OpenTableFile 2003-05-26 Jan-Oliver Wagner * Thuban/UI/controls.py, Thuban/UI/identifyview.py, Thuban/UI/join.py, Thuban/UI/labeldialog.py, Thuban/UI/mainwindow.py, Thuban/UI/proj4dialog.py, Thuban/UI/tableview.py, Thuban/UI/view.py: Replace the true/false of wxWindows by True/False of Python 2.2.1. 2003-05-26 Jan-Oliver Wagner * Thuban/UI/tableview.py (LayerTableFrame.__init__): If there is already a selection present, update the grid accordingly. * Thuban/UI/mainwindow.py (MainWindow.TableShow): Make the dialog resizeable and increase its initial size. 2003-05-26 Frank Koormann Table export functionality * Thuban/Model/table.py (DBFTable.Width, MemoryTable.Width): Return width (in characters) for a column. (DBFTable.Precision, MemoryTable.Precision): Return decimal precision. (table_to_dbf): Write table to dbf file. (table_to_csv): Write table to csv file. * Thuban/Model/transientdb.py (TransientTableBase.Width, TransientTableBase.Precision): Return column width and precision. * Thuban/UI/tableview.py (QueryTableFrame.OnSaveAs): Call table_to_dbf or table_to_csv depending on file selection. * test/test_dbf_table.py: Test table_to_dbf (extension of former part of test). * test/test_csv_table.py: Test table_to_csv. 2003-05-23 Jan-Oliver Wagner * Thuban/UI/join.py (JoinDialog.OnJoin): Use _() for strings. Use QueryTableFrame instead of TableFrame. * Thuban/UI/mainwindow.py (MainWindow.LayerShowTable): Prefix the table window with 'Layer Table:' instead of 'Table:'. 2003-05-23 Jan-Oliver Wagner Give all tables a title via mix-in TitledObject.LayerShowTable * Thuban/Model/base.py (TitledObject.SetTitle): Call method 'issue' only if it exists. * Thuban/Model/table.py (DBFTable, MemoryTable): mix-in TitledObject and call its init-method with a default title. Remove Title() method. * Thuban/Model/transientdb.py (TransientTable, TransientJoinedTable, AutoTransientTable): mix-in TitledObject and call its init-method with a default title. Remove Title() method. 2003-05-23 Bernhard Herzog * Thuban/Model/session.py (Session.AddShapeStore): Define AddShapeStore analogously to AddTable. * test/test_session.py (TestSessionSimple.test_add_shapestore): New. Test for AddShapeStore 2003-05-23 Jan-Oliver Wagner Introducing QueryTableFrame and a very coarse ShowTable implementation. * Thuban/UI/tableview.py (LayerTableFrame, QueryTableFrame): Split the class LayerTableFrame into two classes, LayerTableFrame and QueryTableFrame. The latter implements the selection GUI without dependency on a layer. LayerTableFrame now is derived from QueryTableFrame and connects to a layer. * Thuban/UI/mainwindow.py (MainWindow.TableShow): A very coarse implementation that still needs work. * Thuban/Model/layer.py (Layer.TreeInfo): Added filename. 2003-05-22 Frank Koormann * Thuban/Model/transientdb.py (TransientJoinedTable.__init__): Added "outer_join = False" as optional parameter. (TransientJoinedTable.create): If outer join is true, perform a "LEFT OUTER JOIN" instead of "JOIN", which preserves all records of the left table. Records not matching are filled with 0 / None. * Thuban/UI/join.py (JoinDialog.__init__): Checkbox for outer join. (JoinDialog.OnJoin): Consider outer join check box. 2003-05-22 Bernhard Herzog * Thuban/UI/join.py (JoinDialog.OnJoin): Use exc_info in a somewhat safer way. Storing the traceback in a local variable can lead to memory leaks 2003-05-22 Bernhard Herzog * Thuban/UI/join.py (JoinDialog.OnJoin): Make sure to really call the wxMessageDialog's Destroy() method. 2003-05-22 Frank Koormann * Thuban/UI/join.py (JoinDialog.__init__): Make use of TransientTable.Title() 2003-05-22 Frank Koormann Join Dialog, initial version. * Thuban/UI/mainwindow.py (MainWindow.TableJoin): Removed print. * Thuban/UI/join.py (JoinDialog): Functional implementation of former framework. Renamed Table1/Table2 to LeftTable/RightTable in all occurences. * Thuban/Model/transientdb.py (TransientJoinedTable.__doc__): Typo fixed. 2003-05-22 Bernhard Herzog Give the tables titles so that the GUI can display more meaningful names. For now the titles are fixed but depend on e.g. filenames or the titles of the joined tables. * Thuban/Model/transientdb.py (TransientTable.Title) (TransientJoinedTable.Title, AutoTransientTable.Title): New. * Thuban/Model/table.py (DBFTable.Title, MemoryTable.Title): New. * test/test_transientdb.py (TestTransientTable.test_auto_transient_table_title): New. Test for the Title method (TestTransientTable.test_transient_joined_table) (TestTransientTable.test_transient_table): Add test for the Title methods * test/test_memory_table.py (TestMemoryTable.test_title): New. Test for the Title method * test/test_dbf_table.py (TestDBFTable.test_title): New. Test for the Title method 2003-05-22 Bernhard Herzog * test/test_layer.py (TestLayer.setUp, TestLayer.tearDown): Provide a better way to destroy the layers (TestLayer.test_base_layer, TestLayer.test_arc_layer) (TestLayer.test_point_layer, TestLayer.test_empty_layer) (TestLayer.test_polygon_layer, TestLayer.test_get_field_type): Use the new way to destroy the layers. (TestLayer.test_derived_store): New. Test for using a layer with a DerivedShapeStore * Thuban/Model/layer.py (Layer.SetShapeStore): Only set the filename if the shape store actually has one. 2003-05-22 Bernhard Herzog * Thuban/Model/table.py (DBFTable.FileName): New. Accessor method for the filename * test/test_dbf_table.py (TestDBFTable.test_filename): New. Test for the FileName method (TestDBFTableWriting.test_write): Fix spelling of filename 2003-05-22 Thomas Koester * Thuban/Model/range.py, test/test_range.py: Brought over new Range from SciParam that now really is immutable. 2003-05-22 Frank Koormann Layer Top/Bottom placement added to legend. * Thuban/UI/legend.py (LegendPanel._OnMoveTop(), LayerPanel._OnMoveBottom): New, methods bound to tool events. (LegendTree.MoveCurrentItemTop(), LegendTree.MoveCurrentItemBottom): New, methods binding the event methods with the map methods. * Thuban/Model/map.py (Map.TopLayer(), Map.BottomLayer()): New, place layer at top/bottom of layer stack. * Resources/Bitmaps/top_layer.xpm: New button icon. * Resources/Bitmaps/bottom_layer.xpm: New button icon. 2003-05-22 Bernhard Herzog * Thuban/Model/session.py (Session.RemoveTable): New method to remove tables * test/test_session.py (TestSessionSimple.test_remove_table): New. Test for RemoveTable 2003-05-22 Thomas Koester * Thuban/Model/classgen.py: Added short module doc string and CVS id. (ClassGenerator.GenUniformDistribution): Use new Range __init__, too. 2003-05-22 Bernhard Herzog Implement a way to discover dependencies between tables and shapestores. * Thuban/Model/transientdb.py (TransientTableBase.Dependencies) (TransientJoinedTable.Dependencies) (AutoTransientTable.SimpleQuery): New. Implement the dependencies interface (TransientJoinedTable.__init__): Keep tack of the original table objects in addition to the corresponding transient tables. * Thuban/Model/table.py (DBFTable.Dependencies) (MemoryTable.Dependencies): New. Implement the dependencies interface * Thuban/Model/data.py (ShapeTable): New. Helper class for ShapefileStore (ShapefileStore.__init__): Use ShapeTable instead of AutoTransientTable (ShapefileStore.Table, ShapefileStore.Shapefile): Add doc-strings (ShapefileStore.FileName, ShapefileStore.FileType): New. Accessor methods for filename and type (ShapefileStore.Dependencies): New. Implement the dependencies interface (DerivedShapeStore): New class to replace SimpleStore. The main difference to SimpleStore is that it depends not on a shapefile but another shapestore which expresses the dependencies a bit better (SimpleStore.__init__): Add deprecation warning. * test/test_dbf_table.py (TestDBFTable.test_dependencies): New. Test for the Dependencies method. * test/test_memory_table.py (TestMemoryTable.test_dependencies): New. Test for the Dependencies method. * test/test_transientdb.py (TestTransientTable.test_auto_transient_table_dependencies): New. Test for the Dependencies method. (TestTransientTable.test_transient_joined_table): Add test for the Dependencies method. * test/test_session.py (TestSessionSimple.setUp) (TestSessionSimple.tearDown): New. Implement a better way to destroy the sessions. (TestSessionSimple.test_initial_state) (TestSessionSimple.test_add_table): Bind session to self.session so that it's destroyed by tearDown (TestSessionSimple.test_open_shapefile): New. Test for OpenShapefile and the object it returns 2003-05-22 Bernhard Herzog * Thuban/Model/session.py (Session.AddTable): New method to register tables with the session. (Session.Tables): Return the tables registered with AddTable too. * test/test_session.py (TestSessionSimple.test_add_table): New. Test case for the AddTable method 2003-05-22 Frank Koormann UI polishing updates: Place main buttons (OK, Cancel, etc) in the lower right corner, center labels for selections, initialize controls in reasonable order for keyboard navigation. * Thuban/UI/projdialog.py (ProjFrame.__init__, ProjFrame.__doLayout) (ProjFrame.__DoOnProjAvail): Determine position of current projection using the wxListBox.FindString() method. Still a problem (#1886) * Thuban/UI/classifier.py (Classifier.__init__, SelectPropertiesDialog.__init__) * Thuban/UI/classgen.py (ClassGenDialog.__init__, (ClassGenDialog.__DoOnGenTypeSelect): Moved initialization of the different classification types from here to __init__. (GenUniquePanel.__init__): Set the column width of the first field in the Field ListCtrl to the full width. * Thuban/UI/tableview.py (LayerTableFrame.__init__): Rename 'Save As' Button to 'Export'. Center Buttons in Selection Box, set Focus to Grid. (LayerTableFrame.OnKeyDown()): New, bound to the grid with EVT_KEY_DOWN, changes focus to the Selection when pressing "Alt-S". * Thuban/UI/legend.py (LegendTree.__SetVisibilityStyle): Only gray out the text if not visible. The italic font sometimes exceeds the rendering area. 2003-05-21 Jonathan Coles * Thuban/UI/dock.py (DockFrame): Rename references to _OnClose to OnClose so that Thuban closes correctly. * Thuban/UI/mainwindow.py (MainWindow.OnClose): Call DockFrame.OnClose, not DockFrame._OnClose. 2003-05-21 Jonathan Coles * Thuban/Model/classgen.py (ClassGenerator.GenQuantiles): Remove references to 'inf' and use new Range __init__ to pass floats directly rather than converting them to strings first. Fixes RTBug #1876. * Thuban/Model/classification.py (ClassGroupRange.SetRange): Use new Range ___init__ to pass floats. * Thuban/Model/layer.py (RasterLayer.__init__): Test if the filename is a valid image file. Throw IOError otherwise. * Thuban/Model/range.py: Brought over new Range from SciParam that is immutable and has an __init__ which can accept floats. * Thuban/UI/mainwindow.py (MainWindow.AddLayer): Move OpenShapefile into try block. AddLayer doesn't throw any exceptions anymore. (MainWindow.AddRasterLayer): Move constructor of RasterLayer into try block. * Thuban/UI/projdialog.py (GeoPanel.__init__): Put Degrees as the first item in choices. Fixes RTBug #1882. * Thuban/UI/renderer.py (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. * Thuban/UI/tableview.py (TableGrid.__init__): Call ToggleEventListeners to turn on listening. (TableGrid.ToggleEventListeners): New. Turns event listening on and off so as to prevent excessive messages. (LayerTableFrame.OnQuery): Use TableGrid.ToggleEventListeners to suppress excessive messages when selecting many rows. Fixes RTBug #1880. * Thuban/UI/view.py: 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. * extensions/thuban/cpl_mfile.cpp (MFILEClose): Make sure to set the MFILEReceiver attributes even if the data is NULL. * extensions/thuban/gdalwarp.cpp: Improved the error handling and passed GDAL messages back up to the Python layer. Also tried to fix some memory leaks that were present in the original utility but didn't matter because the program aborted. * test/test_range.py: Copied over tests from SciParam. Removed tests against importing. Fixes RTBug #1867. 2003-05-21 Bernhard Herzog * test/test_load.py: Remove unused imports and restructure the test code (LoadSessionTest): Split into one class for each test and turn LoadSessionTest itself into the base class for all such session tests. (ClassificationTest): New base class for load tests that test classifications (TestSingleLayer, TestLayerVisibility, TestClassification) (TestLabels, TestLayerProjection, TestRasterLayer): New classes for the individual tests * test/support.py (FileLoadTestCase.filename): New base class for file loading tests 2003-05-21 Jan-Oliver Wagner * Resources/Projections/defaults.proj: Renamed 'Universal Transverse Mercator' to 'UTM Zone 32' as a more convenient example. Added 'Gauss Krueger Zone 6'. * Data/iceland_sample_raster.thuban: political polygon now filled transparent to have the raster image visible at once. 2003-05-21 Frank Koormann * Thuban/UI/mainwindow.py (MainWindow): Renamed _OnClose() back to OnClose() to keep in sync with extensions. Internally Thuban still uses "underscored" names. 2003-05-20 Jonathan Coles This puts back Raster layer support. These layers support projections through the GDAL library. Currently, the CVS version is being used. There are no Debian packages available although this may change soon. A GDAL driver was extended to support writing to memory rather to files. There is still some work that needs to be done, such as some error handling when loading invalid images or when there is a problem projecting the image. This putback simply checks in the majority of the work. * setup.py: Add gdalwarp library extension. * Thuban/Model/layer.py (BaseLayer.HasClassification): New. Defaults to False, but can be overridden by subclasses if they support classification. (RasterLayer): New. Defines a new layer that represents an image. * Thuban/Model/load.py (SessionLoader.__init__): Add rasterlayer tag handler. (SessionLoader.start_layer): Encode the filename. (SessionLoader.start_rasterlayer, SessionLoader.end_rasterlayer): New. Supports reading a rasterlayer tag. * Thuban/Model/map.py (Map.BoundingBox): Fix typo in comment. * Thuban/Model/save.py (XMLWriter.encode): Don't assume that we get a string in Latin1. If we get such as string convert it to unicode first, otherwise leave if alone before encoding. (SessionSaver.write_layer): Add support for writing both Layers and RasterLayers. * Thuban/Model/transientdb.py (AutoTransientTable.SimpleQuery): The right argument may not be a string, it could also be a Column. * Thuban/UI/application.py (ThubanApplication.CreateMainWindow): Make initial window size 600x400. Fixes RTBug #1872. * Thuban/UI/classifier.py (Classifier.__init__): Rearrange how the dialog is constructed so that we can support layers that do not have classifications. (Classifier._OnTry): Only build a classification if the layer supports one. * Thuban/UI/legend.py: Change all checks that a layer is an instance of Layer into checks against BaseLayer. (LegendTree.__FillTreeLayer): Only add children to a branch if the layer supports classification. * Thuban/UI/mainwindow.py (MainWindow.NewSession, MainWindow.OpenSession): Don't proceed with an action if the user chooses Cancel when they are asked to save changes. (MainWindow.AddRasterLayer): New. Open a dialog to allow the user to select an image file. Create a new RasterLayer and add it to the map. * Thuban/UI/renderer.py (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. * Thuban/UI/tableview.py (LayerTableFrame.__init__): Change the Choices symbols to match those used in the table query method. Replace deprecated method calls on table with new method names. * Thuban/UI/view.py (MapCanvas.set_view_transform): Try to limit how small the scale can get. This still needs more testing. * extensions/thuban/bmpdataset.cpp: New, but copied from GDAL. Provides a driver to output in .bmp format. * extensions/thuban/cpl_mfile.cpp, extensions/thuban/cpl_mfile.h: New. Provides IO routines which write to memory, rather than a file. * extensions/thuban/gdalwarp.cpp: New, but basically a direct copy of the gdalwarp utility provided in GDAL. Added function calls that can be accessed from python. * Data/iceland_sample_raster.thuban: New. Sample file that uses a raster layer. * Data/iceland/island.tfw, Data/iceland/island.tif: New. Raster layer image data. * Doc/thuban.dtd: Added rasterlayer attribute definition. * test/test_layer.py, test/test_load.py, test/test_save.py: Added tests associated with the raster layer code. * test/test_transientdb.py (TestTransientTable.test_auto_transient_table_query): Added a test for using a Column object as the "right" parameter to a query. 2003-05-19 Frank Koormann * Thuban/version.py (get_changelog_date): Catch exceptions if ChangeLog does not exist. * Thuban/UI/view.py (MapCanvas.Export): Bugfix 2003-05-19 Frank Koormann Extended version information for Thuban * Thuban/version.py: New, version information for Thuban: Last modification date and last ChangeLog entry date. * Thuban/UI/mainwindow.py (MainWindow.About()): Extended version information: Display Thuban, wxPython and Python version. 2003-05-16 Bernhard Herzog * Thuban/Model/save.py: Remove some unused imports including the __future__ import for nested_scopes as Thuban relies on Python 2.2 now. (XMLWriter.encode): Remove the special case for a None argument. In the saver encode is always called with a string argument. 2003-05-16 Bernhard Herzog * Thuban/UI/__init__.py: Remove the work-around for the locale bug in wxPython (at least when usinvg wxGTK) prior to 2.4. The symptom of the bug was that e.g. float("1.2") would fail. Thuban now requires 2.4.x. 2003-05-16 Frank Koormann Printing enhancement and WMF export (under Win32) * Thuban/UI/renderer.py (ExportRenderer): New, derived from ScreenRenderer. Renders Map, Legend and Scalebar for export. (PrinterRenderer): New, derived from ExportRenderer. Replaces the old PrintRender. * Thuban/UI/view.py (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. * Thuban/UI/mainwindow.py (MainWindow.ExportMap()): New. Added also new method_command to call ExportMap, with platform dependency (only __WXMSW__) * Thuban/UI/scalebar.py (ScaleBar.DrawScaleBar): Position and Size of scalebar drawing area as new parameters. * Thuban/Model/scalebar.py (roundInterval): round long instead of int * Thuban/UI/legend.py (ScalebarBitmap.__SetScale): Update to extended scalebar.DrawScalebar header. * test/test_export.py: New, test Thuban.UI.view.OutputTransform() * test/test_scalebar.py: Made test executable as standalone. 2003-05-16 Bernhard Herzog * Thuban/Model/table.py (Table): Remove this compatibility alias for DBFTable. * test/test_table.py: Import DBFTable as Table because that alias doesn't exist anymore. * Thuban/UI/classgen.py: Remove some unused imports 2003-05-14 Jonathan Coles * Thuban/Model/classgen.py (ClassGenerator.GenSingletonsFromList): Fix docstring. (ClassGenerator.GenUniformDistribution): Fix spelling of method name. (ClassGenerator.GenQuantiles): Use the left/right brackets and min/max values of the supplied range to determine the beginning and end bounds of the generated classes. * Thuban/Model/range.py (Range.number_re): Now accepts floats that do not have a leading 0 (.5 is now accepted as well as 0.5). * Thuban/UI/classgen.py (ClassGenDialog.OnOK): Fix name of method call to ClassGenerator.GenUniformDistribution. * Thuban/UI/projdialog.py (ProjFrame.__do_layout): Fix Windows layout bug with the 'Projection' label. * test/support.py (FloatTestCase): New. Needed for the Range tests. * test/test_range.py: New. Imported from SciParam. 2003-05-12 Jonathan Coles * Thuban/UI/classgen.py (GenQuantilesPanel.GetList): Replace call to table.UniqueValues() with calls that retrieve all the values from the table. This will need to be replaced by a method on table which can simply return the list (perhaps more efficiently). 2003-05-12 Jonathan Coles The return value of ClassGenerator.CalculateQuantiles has changed. Refer to the documentation for details. * test/test_classgen.py: Modified Quantile tests to use the new return values. * Thuban/Model/classgen.py (ClassGenerator.GenQuantiles): Add comments describing the parameters, use new return values from CalculateQuantiles to produce the correct range bounds in the Classification. (ClassGenerator.CalculateQuantiles): Add more comments describing the return values and parameters. Make minor adjustments to improve the legibility of the code. Fix problem with adjusted not being set in most cases. 2003-05-12 Frank Koormann * Thuban/Model/save.py (XMLWriter.encode()): Explicite call to unicode and latin1. Fixes #1851 finally. 2003-05-09 Jonathan Coles * test/test_classgen.py: New. Tests the Quantile algorithm. * Thuban/Model/classgen.py (ClassGenerator.CalculateQuantiles): Clean up debugging statement, add comments, fix a small bug in the returned adjusted percentiles. 2003-05-09 Jonathan Coles Introduces Range class from SciParam into the ClassGroupRange class, and such ranges can now be saved and loaded from disk. Quantiles are now available in the Classification Generator. Initial support for building Queries on a table. Doesn't do anything but run some tests. * Thuban/Model/classification.py: Explicit imports. (ClassGroupRange): Use the Range class to store the underlying range information. The interface remains the same, except for GetRange(), and you can also supply a Range object as the min parameter to SetRange or __init__. * Thuban/Model/load.py (XMLReader.encode): New. Encodes the given string appropriately for use in Thuban. Fixes RTbug #1851. (SessionLoader.end_projection): Handle the context of the projection tag a bit better by looking at what objects are not None. There was an assumption that a projection tag for a map could occur before any layers. (SessionLoader.start_clrange): Provide backward compatibility for reading min/max values as well as the new range parameter. * Thuban/Model/map.py: Explicit imports. * Thuban/Model/resource.py: Import _. (ProjFileSaver.write): write header using projfile.dtd. * Thuban/Model/save.py: Explicit imports. (XMLWriter.encode): New. Encode the given string from a format used by Thuban into UTF-8. Fixes RTbug #1851. * Thuban/UI/classgen.py: Explicit imports. (ClassGenDialog.__init__): Clean up the code and add support for Quantiles. (ClassGenDialog.OnOK): Add support for Quantiles. (GenQuantilesPanel): New. Input panel for Quantiles. (ClassGenerator, CustomRamp, MonochromaticRamp, GreyRamp, RedRamp, GreenRamp, BlueRamp, HotToColdRamp): Move to Thuban/Model/classgen.py * Thuban/Model/classgen.py: New. Contains all the classes named above. * Thuban/UI/classifier.py: Explicit imports. (ClassTable.GetValueAsCust, ClassTable.__ParseInput, ClassTable.SetValueAsCustom): Reworked to use new Range class. * Thuban/UI/legend.py: Explicit imports. * Thuban/UI/mainwindow.py: Add support for the Join Dialog. Added a Table menu and associated method calls. (MainWindow.choose_color): Removed. No longer needed. * Thuban/UI/projdialog.py (ProjFrame.__VerifyButtons): Save button should be disabled if no projection is selected in the available list. * Thuban/UI/renderer.py: Explicit imports. * Thuban/UI/tableview.py (TableGrid.OnRangeSelect): Fix some issues with correctly selecting the rows and issuing the right events. Be sure to call Skip() to allow the grid to do some of its own handling which allows the rows to actually be selected. (LayerTableGrid.select_shapes): Rename from select_shape. Supports selecting multiple shapes. (LayerTableFrame): Support for building Queries. (LayerTableFrame.select_shapes): Allow multiple shapes to be selected. * Thuban/UI/tree.py: Explicit imports. * Thuban/UI/view.py (MapCanvas): Delegate "SelectedShapes" so the table view can call it. * test/test_classification.py: Explicit imports. (TestClassification.test_ClassGroupRange): Fix test for new Range class. * Doc/thuban.dtd: Add range parameter for clrange. * Thuban/Model/range.py: Taken from SciParam. Used as the underlying object in ClassGroupRange, and also uesd for inputting ranges in the classifer table and elsewhere. * Thuban/UI/join.py: New. Initial Join dialog. No real functionality yet. 2003-05-09 Frank Koormann * Thuban/UI/scalebar.py (DrawScaleBar): Draw only if interval > 0.0. 2003-05-08 Frank Koormann Coding style updates * test/test_scalebar.py: Replaced tab indentation by spaces. * Thuban/UI/scalebar.py: Explicit imports. 2003-05-08 Frank Koormann * Thuban/UI/scalebar.py (ScaleBar.DrawScalebar): Format string bug fixed. 2003-05-08 Frank Koormann Reorganization of scalebar component (no wx in Thuban/Model) * Thuban/Model/scalebar.py: Rendering moved to Thuban/UI/scalebar.py (deriveInterval): Calculate scalebar interval and unit which fits in width for scale. (roundInterval): Round float. * Thuban/UI/scalebar.py (ScaleBar): Scalebar rendering * test/test_scalebar.py: Test for Thuban/Model/scalebar.py methods. * Thuban/UI/legend.py: Import Thuban.UI.scalebar 2003-05-08 Frank Koormann * Thuban/UI/legend.py (ScalebarBitmap.SetCanvas): Initialize ScaleBar with canvas.map * Thuban/Model/scalebar.py (ScaleBar.roundInterval()): New, round intervals to display smarter lengths (ScaleBar.DrawScalebar): Draw Scalebar only if the map contains a layer. If the maps has no projection applied grey the scalebar. 2003-05-07 Frank Koormann Basic Scalebar features added. * Thuban/Model/scalebar.py (ScaleBar): New, scalebar rendering. * Thuban/UI/legend.py (LegendPanel): Added scalebar bitmap (ScaleBarBitmap): New, links the scalebar bitmap with view messages and the renderer. * Thuban/UI/view.py (MapCanvas.set_view_transform): Issue SCALE_CHANGED. * Thuban/UI/messages.py: SCALE_CHANGED added. 2003-05-07 Bernhard Herzog * Thuban/Model/session.py (Session.__init__): New instance variable shapestores to hold a list of all open shapestore objects (Session.ShapeStores): New. Accessor method for the shapestores list. (Session._add_shapestore, Session._clean_weak_store_refs): New. Internal methods to maintain the shapestores list. (Session.Tables): New. Return all tables open in the session. (Session.OpenShapefile): Insert the new ShapeStore into the shapestores list. * test/test_session.py (TestSessionSimple.test_initial_state): Add tests for ShapeStores and Tables (TestSessionWithContent.test_shape_stores) (TestSessionWithContent.test_tables): New. Test cases for ShapeStores and Tables 2003-05-07 Bernhard Herzog * Thuban/Model/transientdb.py (TransientTableBase.ReadRowAsDict): Add comments about the optimizations used. (AutoTransientTable.ReadValue, TransientTableBase.ReadValue): New. Implement the ReadValue table interface method. * test/test_transientdb.py (TestTransientTable.run_iceland_political_tests) (TestTransientTable.test_transient_joined_table): Add tests for ReadValue 2003-05-07 Frank Koormann * Resources/Bitmaps/fulllayerextent.xpm, Resources/Bitmaps/fullselextent.xpm: Replaced the place holders with new icons. 2003-05-06 Bernhard Herzog * Thuban/Model/transientdb.py (AutoTransientTable.SimpleQuery): New. Simply delegate to the transient table's version. * test/test_transientdb.py (TestTransientTable.test_auto_transient_table_query): New. Test case for AutoTransientTable's SimpleQuery 2003-05-06 Bernhard Herzog * Thuban/Model/transientdb.py (TransientTableBase.SimpleQuery): Implement a simple query method for the query dialog (TransientTableBase.create): Add an INTEGER PRIMARY KEY that holds the row index or shapeid. (TransientTable.create): Insert the right value of the row index (TransientJoinedTable.create): Copy the row index of the left table to the joined result table * test/test_transientdb.py (TestTransientTable.test_transient_table_read_twice): Fix doc-string (TestTransientTable.test_transient_table_query): New. Test for the SimpleQuery method 2003-05-06 Bernhard Herzog Convert all table users to use the new table interface. This only covers Thuban itself, not GREAT-ER or other applications built on Thuban yet, so the compatibility interface stays in place for the time being but it now issues DeprecationWarnings. Finally, the new Table interface has a new method, HasColumn. * Thuban/Model/table.py (OldTableInterfaceMixin): All methods issue deprecation warnings when they're. The warnings refer to the caller of the method. (OldTableInterfaceMixin.__deprecation_warning): New. Helper method for the deprecation warnings * test/test_table.py: Ignore the deprecation warnings for the old table in the tests in this module. The purpose of the tests is to test the old interface, after all. * test/test_transientdb.py (TestTransientTable.run_iceland_political_tests): Use the constants for the types. Add a test for HasColumn (TestTransientTable.test_transient_joined_table): Adapt to new table interface. Add a test for HasColumn (TestTransientTable.test_transient_table_read_twice): Adapt to new table interface * Thuban/UI/tableview.py (DataTable.SetTable, DataTable.GetValue): Adapt to new table interface * Thuban/UI/renderer.py (MapRenderer.draw_shape_layer): Adapt to new table interface * Thuban/UI/controls.py (RecordListCtrl.fill_list) (RecordTable.SetTable): Adapt to new table interface * Thuban/UI/classifier.py (Classifier.__init__) (Classifier.__init__): Adapt to new table interface * Thuban/UI/classgen.py (ClassGenDialog.__init__) (GenUniformPanel._OnRetrieve, GenUniquePanel._OnRetrieve): Adapt to new table interface * Thuban/Model/transientdb.py (TransientTableBase.HasColumn) (AutoTransientTable.HasColumn): Implement the new table interface method (AutoTransientTable.ReadRowAsDict, AutoTransientTable.ValueRange) (AutoTransientTable.UniqueValues): Adapt to new table interface * Thuban/Model/layer.py (Layer.SetShapeStore, Layer.GetFieldType): Adapt to new table interface * test/test_layer.py (TestLayer.open_shapefile): Helper method to simplify opening shapefiles a bit easier. (TestLayer.test_arc_layer, TestLayer.test_polygon_layer) (TestLayer.test_point_layer): Use the new helper method (TestLayer.test_get_field_type): New. Test for the GetFieldType method * test/test_dbf_table.py (TestDBFTable.test_has_column): Test for the new table method * test/test_memory_table.py (TestMemoryTable.test_has_column): Test for the new table method HasColumn 2003-05-06 Jonathan Coles Addresses the "Selection Extent" wish of RTbug #1787. * Resources/Bitmaps/fulllayerextent.xpm, Resources/Bitmaps/fullselextent.xpm: Bitmaps for layer and selection extent. These are just place holders for the real bitmaps. * Thuban/Model/layer.py (Shape): Since a Shape is immutable only calculate the bounding box once (the first time compute_bbox() is called). (Layer.ShapesBoundingBox): New. Given a list of shape ids, return the bounding box for the shapes in lat/long coordinates. * Thuban/UI/mainwindow.py: Added new "Full selection extent" menu option. (MainWindow.has_selected_shapes): New. Returns true if there are any selected shapes. (MainWindow.FullSelectionExtent): New. Calls MapCanvas.FitSelectedToWindow() when the user selects the menu option. (_has_selected_shapes): New. Returns true if there are any selected shapes. * Thuban/UI/selection.py (Selection.HasSelectedShapes): New. Returns true if there are any selected shapes. * Thuban/UI/view.py (MapCanvas): Added delegated method HasSelectedShapes. (MapCanvas.FitSelectedToWindow): New. Centers and scales any selected shapes on the canvas using the map projection (if any). * test/test_layer.py (TestLayer.test_arc_layer): Add some tests for Layer.ShapesBoundingBox(). 2003-05-06 Bernhard Herzog * Resources/Projections/defaults.proj: Fix spelling of Mercator 2003-05-05 Jonathan Coles Addresses the "Full Layer Extent" wish of RTbug #1787. * Resources/Projections/defaults.proj: Added UK National Grid. * Thuban/UI/mainwindow.py: Added new "Full layer extent" menu option. (MainWindow.FullLayerExtent): New. Calls MapCanvas.FitLayerToWindow() when the user selects the menu option. * Thuban/UI/view.py (MapCanvas.FitLayerToWindow): New. Centers and scales the given layer on the canvas using the map projection. 2003-05-05 Bernhard Herzog Convert the table implementations to a new table interface. All tables use a common mixin class to provide backwards compatibility until all table users have been updated. * Thuban/Model/table.py (OldTableInterfaceMixin): Mixin class to provide backwards compatibility for table classes implementing the new interface (DBFTable, MemoryTable): Implement the new table interface. Use OldTableInterfaceMixin as base for compatibility (DBFColumn, MemoryColumn): New. Column description for DBFTable and MemoryTable resp. * test/test_dbf_table.py: New. Test cases for the DBFTable with the new table interface. * test/test_memory_table.py: New. Test cases for the MemoryTable with the new table interface. * test/test_table.py: Document the all tests in this file as only for backwards compatibility. The equivalent tests for the new interface are in test_memory_table.py and test_dbf_table.py (MemoryTableTest.test_read): field_info should be returning tuples with four items (MemoryTableTest.test_write): Make doc-string a more precise. * Thuban/Model/transientdb.py (TransientTableBase): Convert to new table interface. Derive from from OldTableInterfaceMixin for compatibility. (TransientTableBase.create): New intance variable column_map to map from names and indices to column objects (TransientTable.create): Use the new table interface of the input table (AutoTransientTable): Convert to new table interface. Derive from from OldTableInterfaceMixin for compatibility. (AutoTransientTable.write_record): Removed. It's not implemented yet and we still have to decide how to handle writing with the new table and data framework. * test/test_transientdb.py (TestTransientTable.run_iceland_political_tests) (TestTransientTable.test_transient_joined_table): Use the new table interface 2003-05-05 Jonathan Coles This is namely a collection of UI updates to improve user interactivity. Tabbing between controls now exists and you can use ESC to close dialog boxes; ENTER will active the default button. * Thuban/UI/classgen.py (ClassGenDialog.__init__): Rearrange the order that the controls are created so that tabbing works correctly. (ClassGenDialog.OnOK): Renamed from _OnGenerate() so that the wxDialog can handle the default button correctly. (ClassGenDialog.OnCancel): Renamed from _OnCloseBtn() for the same reasons as for OnOK. (GenUniformPanel._OnRetrieve): Call wxBeginBusyCursor/wxEndBusyCursor when we ask the table for the maximum/minimum values of a field which could take a very long time. * Thuban/UI/classifier.py (Classifier.__init__): Rearrange the order that the controls are created so that tabbing works correctly. (SelectPropertiesDialog.__init__): Rearrange the order that the controls are created so that tabbing works correctly. * Thuban/UI/dialogs.py: Copied NonModalDialog box and changed it to derive from a wxDialog but behave like the original implementation which was derived from a wxFrame. wxDialog provides useful key handling functionality like ESC calling OnCancel and ENTER calling OnOK which is lost with wxFrame. * Thuban/UI/mainwindow.py: Add "..." to menu items that will open new dialogs. * Thuban/UI/projdialog.py (ProjFrame.__init__): Rearrange the order that the controls are created so that tabbing works correctly. (ProjFrame.OnApply): Renamed from _OnTry() to use wxDialog behaviour. (ProjFrame.OnOK): Renamed from _OnOK() to use wxDialog behaviour. (ProjFrame.OnCancel): Renamed from _OnClose() to use wxDialog behaviour. (ProjPanel.__init__): Add "Airy" to the list of ellipsoids so we can provide the "UK National Grid" as a default projection. (UTMPanel.__init__): Rearrange the order that the controls are created so that tabbing works correctly. 2003-05-05 Bernhard Herzog * extensions/thuban/wxproj.cpp: Fix some of the comments. (project_point): If a map projection but no layer projection is given, convert degrees to radians before applying the map projection. * Thuban/UI/tableview.py (TableGrid.disallow_messages) (TableGrid.allow_messages): New methods to make it possible to inhibit message sending. (TableGrid.issue): Only send the message if not inhibited. (LayerTableGrid.select_shape): Use the new methods to make sure that no ROW_SELECTED message is sent while we're updating the selected rows to match the selected shapes. 2003-05-02 Jan-Oliver Wagner Implementation of MemoryTable. * Thuban/Model/table.py (MemoryTable): New. Quite simple table implementation that operates on a list of tuples. All of the data are kept in the memory. * test/test_table.py (MemoryTableTest): New. * test/test_transientdb.py (SimpleTable): Removed. (TestTransientTable.test_transient_joined_table, (TestTransientTable.test_transient_table_read_twice): Replaced SimpleTable by MemoryTable. 2003-04-30 Jonathan Coles * Data/iceland_sample.thuban: Now contains correct projections for each of the layers. * Resources/Projections/defaults.proj: Geographic projection contains unit conversion parameter. 2003-04-30 Jonathan Coles The most important part of this putback is the projection changes. It should now be possible to specify the projection that a layer is in and then specify a different projection for the map. The projection dialog has an extra parameter for a geographic projection which lets the user select if the input is in degrees or radians. * Thuban/Model/layer.py (Layer.ShapesInRegion): Fix docstring to say that the parameter is a tuple of unprojected points (which is what the callers to this method were assuming). Also, since the points are unprojected we need to projected them. * Thuban/UI/legend.py (LegendTree.MoveCurrentItemUp, LegendTree.MoveCurrentItemDown): If the layer or any of the layer's groups are selected, move the layer up/down. Fixes RTbug #1833. * Thuban/UI/mainwindow.py: Move menu item map_rename up. * Thuban/UI/projdialog.py (ProjFrame._OnSave): Add missing parameter in call to SetClientData. (GeoPanel): Add support for selecting the units that the source data is in (Radians or Degrees). * Thuban/UI/renderer.py (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). * Thuban/UI/view.py (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. * extensions/thuban/wxproj.cpp (project_point): First invert the supplied point (which should be in projected coordinates) using the layer's projection and then project the point using the map's projection. (project_points): Use project_point() to project each point. 2003-04-30 Jan-Oliver Wagner * Thuban/Model/layer.py (Layer.SetShapeStore): Fixed a bug: don't set the Classification to None if the classfication field is None (ie only a DEFAULT). 2003-04-30 Bernhard Herzog * Thuban/UI/view.py: Fix some typos. * Thuban/UI/mainwindow.py (MainWindow.identify_view_on_demand): Do not pop up the dialog if the selection becomes empty (this could happen if e.g. a new selection is opened while the identify tool is active and dialog had been closed) 2003-04-30 Bernhard Herzog * Thuban/Model/transientdb.py (TransientTableBase.__init__): New instance variable read_record_last_result (TransientTableBase.read_record): Make sure reading the same record twice works. The implementation uses the new instance variable read_record_last_result * test/test_transientdb.py (TestTransientTable.test_transient_table_read_twice): New test case for the above bug-fix. 2003-04-29 Jonathan Coles * Thuban/common.py: Removed. No longer needed Str2Num. RTbug #1832. * Thuban/UI/classgen.py: Remove all uses of Str2Num. * Thuban/UI/classifier.py: Remove all uses of Str2Num. (ClassTable.SetValueAsCustom): Rename keyword argument in ClassGroup* constructors to match argument name. 2003-04-29 Bernhard Herzog * Thuban/Model/session.py (Session.Destroy): Explicitly close the transient DB if it exists to make sure it doesn't leave a journal file in the temp directory. * Thuban/Model/transientdb.py (TransientDatabase.close): Set self.conn to None after closing the connection to make sure it's not closed twice 2003-04-29 Jonathan Coles Add a visible parameter in the layer XML tag. The default value is "true". If anything other than "false" is specified we also assume "true". Addresses RTbug #1025. * Doc/thuban.dtd: Add visible parameter to a layer. * Thuban/Model/layer.py (BaseLayer.__init__): Change default value of visible from 1 to True. (Layer.__init__): Change default value of visible from 1 to True. * Thuban/Model/load.py (SessionLoader.start_layer): Read visible parameter. * Thuban/Model/save.py (SessionSaver.write_layer): Save visible parameter. * test/test_load.py: Add new test data contents_test_visible. (LoadSessionTest.setUp): save test data. (LoadSessionTest.testLayerVisibility): Test if the visible flag is loaded correctly. * test/test_save.py (SaveSessionTest.testSingleLayer): Add test for saving an invisible layer. 2003-04-29 Jonathan Coles * Thuban/UI/mainwindow.py (MainWindow.SetMap): Look up the legend dialog box and tell it to change its map to the one supplied to SetMap(). Fixes RTbug #1770. 2003-04-29 Bernhard Herzog Next step of table implementation. Introduce a transient database using SQLite that some of the data is copied to on demand. This allows us to do joins and other operations that require an index for good performance with reasonable efficiency. Thuban now needs SQLite 2.8.0 and pysqlite 0.4.1. Older versions may work but I haven't tested that. * Thuban/Model/transientdb.py: New. Transient database implementation. * test/test_transientdb.py: New. Tests for the transient DB classes. * Thuban/Model/session.py (AutoRemoveFile, AutoRemoveDir): New classes to help automatically remove temporary files and directories. (Session.__init__): New instance variables temp_dir for the temporary directory and transient_db for the SQLite database (Session.temp_directory): New. Create a temporary directory if not yet done and return its name. Use AutoRemoveDir to have it automatically deleted (Session.TransientDB): Instantiate the transient database if not done yet and return it. * Thuban/Model/data.py (ShapefileStore.__init__): Use an AutoTransientTable so that data is copied to the transient DB on demand. (SimpleStore): New class that simply combines a table and a shapefile * Thuban/Model/table.py (Table, DBFTable): Rename Table into DBFTable and update its doc-string to reflect the fact that this is only the table interface to a DBF file. Table is now an alias for DBFTable for temporary backwards compatibility. * Thuban/UI/application.py (ThubanApplication.OnExit): Make sure the last reference to the session goes away so that the temporary files are removed properly. * test/test_load.py (LoadSessionTest.tearDown): Remove the reference to the session to make sure the temporary files are removed. 2003-04-29 Bernhard Herzog * Thuban/Model/load.py (XMLReader.__init__, XMLReader.read): Turn the __parser instance variable into a normal local variable in read. It's only used there and read will never be called more than once. Plus it introduces a reference cycle that keeps can keep the session object alive for a long time. 2003-04-29 Jonathan Coles * Thuban/Model/proj.py (Projection): Removed Set*() methods to make Projection an immutable item. Fixes RTbug #1825. (Projection.__init__): Initialize instance variables here. (ProjFile.Replace): New. Replace the given projection object with the new projection object. This solves the problem of needing the mutator Projection.SetProjection() in the ProjFrame class and allows a projection to change parameters without changing its location in the file. * Thuban/UI/mainwindow.py (MainWindow.SaveSessionAs): Dialog should be of type wxSAVE and should verify overwriting a file. * Thuban/UI/projdialog.py (ProjFrame._OnSave): Use the new ProjFile.Replace() method instead of the mutator Projection.SetProjection(). Also requires that we reassign the client data to the new projection. * test/test_proj.py (TestProjection.test): Test GetName() and GetAllParameters() (TestProjFile.test): Remove tests for Set*() methods. Add tests for Replace(). 2003-04-25 Jonathan Coles * Thuban/Model/save.py (SessionSaver.write_projection): Make sure to save the name of the projection. * test/test_save.py (SaveSessionTest.testLayerProjection): New test to verify layer projections are saved correctly. 2003-04-25 Jonathan Coles * Thuban/Model/proj.py (Projection.SetName): Set the name to "Unknown" if name is None. (Projection.SetAllParameters): New. Set the projection's parameter list to the one supplied. (Projection.SetProjection): New. Set the projection's properties to those of the supplied Projection. * Thuban/UI/mainwindow.py (MainWindow.MapProjection): Set the dialog title to include the map's title. (MainWindow.LayerProjection): Set the dialog title to include the layer's title. * Thuban/UI/projdialog.py (ProjFrame.__ShowError): Consolidate error dialogs into a single method call. (ProjFrame.__VerifyButtons): Add more states to check. (ProjFrame.__GetProjection): Return the current state of an edited projection or None. (ProjFrame.__FillAvailList): Remove checks for states that shouldn't exist. (ProjFrame._OnNew): Clear all selected items and supply a projection panel if necessary. * test/test_proj.py (TestProjFile.test): Add tests for ProjFile.SetAllParameters, ProjFile.SetProjection, ProjFile.SetName. 2003-04-25 Jonathan Coles * Thuban/UI/projdialog.py (ProjFrame.__FillAvailList): Now takes an optional argument to select the current projection. This does not guarantee that the item is visible due to limited wxWindows functionality. Fixes RTBug #1821. 2003-04-25 Jonathan Coles * Thuban/Model/load.py (SessionLoader.start_projection): Remember the projection name and use it when constructing the Projection object. * Thuban/Model/proj.py (Projection.__init__): Change the default value for 'name' to None and then test if name is equal to None in the body of the constructor. This way the caller doesn't have to know what the default value should be. Namely, useful in load.py where we have to pick a default value if the 'name' parameter doesn't exist in the XML file. * test/test_load.py (LoadSessionTest.testLayerProjection): New. Tests a file where a layer has a projection. 2003-04-25 Jonathan Coles * Thuban/Model/layer.py (Layer.TreeInfo): Add an item to the tree for projection information. * Thuban/Model/load.py (XMLReader.GetFilename): Renamed from XMLReader.GetFileName. (SessionLoader): Added support for loading projection tags that appear inside a layer. * Thuban/Model/proj.py (ProjFile): Document the class. Move back to using a list because the order of the projections in the file is important to maintain. Fixes RTbug #1817. * Thuban/Model/resource.py: Rename calls to ProjFile.GetFileName to ProjFile.GetFilename. * Thuban/Model/save.py (SessionSaver.write_layer): Save projection information. * Thuban/UI/projdialog.py (ProjFrame._OnAddToList): Renamed from ProjFrame._OnSaveAs. Removed old dead code from previous implementation. (ProjFrame._OnExport): Add support for exporting more than one projection to a single file. (ProjFrame.__FillAvailList): use string formatting (% operator) to build strings that are (partly) translated. Fixes RTbug #1818. * test/test_proj.py (TestProjFile.test): New. Tests the base ProjFile class. 2003-04-24 Bernhard Herzog * po/es.po: Updated Spanish translation by Daniel Calvelo Aros * po/fr.po: New. French translation by Daniel Calvelo Aros * Thuban/UI/projdialog.py (ProjFrame._OnSaveAs): Don't translate empty strings. 2003-04-24 Jonathan Coles * Thuban/Model/layer.py (Layer.GetProjection): New. Needed to implement the interface that the ProjFrame dialog expects. * Thuban/Model/proj.py (Projection.SetName): New. Allows the name of the projection to be changed. (ProjFile): Use a dictionary instead of a list so that removing projections is easier and we are sure about uniqueness. (ProjFile.Remove): Remove the given projection object. * Thuban/Model/resource.py (GetSystemProjFiles, GetUserProjFiles): Return a list with only one projection file instead of searching for any projection file. This simplifies many things if the user can only have one system file and one user file. * Thuban/UI/classgen.py: Change all references to genCombo to genChoice. * Thuban/UI/mainwindow.py: Add a Projection option under the layer menu. (MainWindow.LayerProjection): New. Open up a projection window for a layer. * Thuban/UI/projdialog.py: Large changes to how the dialog is laid out. Use three panels instead of one. One for the list of projections, one for the edit controls, and one for the buttons. Fixed resizing problems so that the dialog resizes correctly when the projection panel changes. Added import/export, save, and new buttons/functionality. 2003-04-24 Bernhard Herzog First step towards table management. Introduce a simple data abstraction so that we replace the data a layer uses more easily in the next step. * Thuban/Model/data.py: New file with a simple data abstraction that bundles shapefile and dbffile into one object. * Thuban/Model/session.py (Session.OpenShapefile): New method to open shapefiles and return a shape store object * Thuban/Model/layer.py (Layer.__init__): Pass the data as a store object instead of a shapefile filename. This introduces a new instance variable store holding the datastore. For intermediate backwards compatibility keep the old instance variables. (open_shapefile): Removed. No longer needed with the shape store. (Layer.SetShapeStore, Layer.ShapeStore): New methods to set and get the shape store used by a layer. (Layer.Destroy): No need to explicitly destroy the shapefile or table anymore. * Thuban/UI/mainwindow.py (MainWindow.AddLayer) (MainWindow.AddLayer): Use the session's OpenShapefile method to open shapefiles * Thuban/Model/load.py (ProcessSession.start_layer): Use the session's OpenShapefile method to open shapefiles * test/test_classification.py (TestClassification.test_classification): Use the session's OpenShapefile method to open shapefiles and build the filename in a more platform independed way * test/test_layer.py (TestLayer.setUp, TestLayer.tearDown): Implement to have a session to use in the tests (TestLayer.test_arc_layer, TestLayer.test_polygon_layer) (TestLayer.test_point_layer, TestLayer.test_empty_layer): Use the session's OpenShapefile method to open shapefiles (TestLayerLegend.setUp): Instantiate a session so that we can use it to open shapefiles. (TestLayerLegend.tearDown): Make sure that all references to layers and session are removed otherwise we may get a resource leak * test/test_map.py (TestMapAddLayer.test_add_layer) (TestMapWithContents.setUp): Instantiate a session so that we can use it to open shapefiles. (TestMapWithContents.tearDown): Make sure that all references to layers, maps and sessions are removed otherwise we may get a resource leak ("__main__"): use support.run_tests() so that more info about uncollected garbage is printed * test/test_save.py (SaveSessionTest.testSingleLayer): Use the session's OpenShapefile method to open shapefiles ("__main__"): use support.run_tests() so that more info about uncollected garbage is printed * test/test_selection.py (TestSelection.tearDown): Make sure that all references to the session and the selection are removed otherwise we may get a resource leak (TestSelection.get_layer): Instantiate a session so that we can use it to open shapefiles. ("__main__"): use support.run_tests() so that more info about uncollected garbage is printed * test/test_session.py (TestSessionBase.tearDown) (TestSessionWithContent.tearDown): Make sure that all references to the session and layers are removed otherwise we may get a resource leak (TestSessionWithContent.setUp): Use the session's OpenShapefile method to open shapefiles 2003-04-24 Jonathan Coles * Thuban/Model/load.py (XMLReader.read): Should have been checking if the file_or_filename object had the 'read' attribute. 2003-04-23 Jonathan Coles * Thuban/Model/resource.py: Fixes RTbug #1813. (ReadProjFile): Add documentation about which exceptions are raised. Always pass the exceptions up to the caller. (GetProjFiles): If the directory can't be read return an empty list. If any of the proj files can't be read skip that file and go on to the next one. * test/test_proj.py: Added test cases to handle nonexistent files, unreadable files, and files that don't parse correctly. 2003-04-23 Jonathan Coles Projection dialog. Allows the user to select from a list of projection templates and optionally edit them and save new ones. * Thuban/UI/projdialog.py (ProjFrame): New. Main dialog. (ProjPanel): Base class for projection specific panels. (TMPanel): Projection panel for Transverse Mercartor. (UTMPanel): Projection panel for Universal Transverse Mercartor. (LCCPanel): Projection panel for Lambert Conic Conformal. (GeoPanel): Projetion panel for Geographic Projection. 2003-04-23 Jonathan Coles * Thuban/Model/load.py (XMLReader): Renamed from XMLProcessor to promote symmetry. There now exists XMLReader and XMLWriter. (XMLReader.read): New. Call to read the given file descriptor or filename. (XMLReader.close): New. Make sure the file is closed. (XMLReader.GetFileName): New. Return just the file name that is being read from. (XMLReader.GetDirectory): New. Return just the directory of the file that is being read. (XMLReader.AddDispatchers): New. Take a dictionary which contains the names of functions to call as the XML tree is parsed. (XMLReader.startElementNS): Updated to use new dispatcher dictionary. (XMLReader.endElementNS): Updated to use new dispatcher dictionary. (SessionLoader): Removed class variables start_dispatcher and end_dispatcher since this functionality is now part of a class instance. Fixes RTbug #1808. (SessionLoader.__init__): Add dispatcher functions. (load_xmlfile): Code was moved into the XMLReader.read(). (load_session): Use modified SessionLoader. * Thuban/Model/map.py (Map.GetProjection): New. Returns the map's projection. * Thuban/Model/proj.py (Projection.GetParameters): Renamed to GetAllParameters. (Projection.GetParameter): Returns the value for the given parameter. * Thuban/Model/resource.py: Use XMLReader and XMLWriter. (GetProjFiles): Renamed from GetProjections. Now returns a list of ProjFile objects. (GetSystemProjFiles): Renamed from GetSuppliedProjections. Returns a list of ProjFile objects whose files are not user defined. (GetUserProjFiles): Renamed from GetUserProjections. Returns a list of ProjFile objects whose files are user defined. (ProjFileReader): Extend new XMLReader. * Thuban/Model/save.py (XMLWriter): Renamed from XMLSaver to promote symmetry. * Thuban/UI/classgen.py (ClassGenDialog.__init__): Use a wxChoice control instead of a wxComboBox. wxChoice controls do not generate events as the uses highlights possible choices which fixes problems with resizing the dialog when the use selects an option. * Thuban/UI/classifier.py (Classifier.__init__): Use a wxChoice control instead of a wxComboBox. * Thuban/UI/mainwindow.py (MainWindow.Projection): Use new projection dialog. * test/test_proj.py (TestProjection.test): New tests for GetParameter method. 2003-04-22 Bernhard Herzog * Thuban/UI/mainwindow.py: Remove some unused imports and global constants * Thuban/UI/identifyview.py (IdentifyListCtrl.selected_shape) (IdentifyGridCtrl.selected_shape): Use table, not shapetable. 2003-04-17 Bernhard Herzog * Thuban/Model/layer.py: Don't import LAYER_LEGEND_CHANGED. (Layer): Update doc-string since LAYER_LEGEND_CHANGED is not used anymore. (Layer.BoundingBox, Layer.GetFieldType, Layer.NumShapes) (Layer.ShapeType, Layer.Shape): No need to call self.open_shapefile since it's always called in __init__ * Thuban/UI/application.py (ThubanApplication.MainLoop): Removed. In wxPython 2.4 there's no need to extend MainLoop anymore since wxPython itself makes sure OnExit is called. 2003-04-16 Jonathan Coles Initial putback of projection management code. Includes new classes to read and write projection files. The current load and save classes were abstracted a bit so they could be reused. The Projection class was extended to provide new methods and have a name. * Thuban/Model/load.py (XMLProcessor): New. Contains all the general XML reading methods that were part of ProcessSession. * Thuban/Model/proj.py (Projection.__init__): Accepts an optional name. (ProjFile): New. Represents a file that contains projection information. * Thuban/Model/resource.py: New. Contains general utilities for read and writing projection files. * Thuban/Model/save.py (XMLSaver): New. Contains all the general XML writing methods that were part of SessionSaver. (SessionSaver): Renamed from Saver. * test/test_proj.py: New test cases for the projection file read and write functions. 2003-04-16 Jonathan Coles * Thuban/Model/classification.py: Use repr() around values in the ClassGroup*.__repr__() methods so it is clearer when a value is a string and when it is a number. * test/test_load.py: Rework the classification test to test that we can load old files. (testLabels): Test a file where the groups have labels. 2003-04-16 Bernhard Herzog 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. 2003-04-15 Jonathan Coles * Thuban/Model/classification.py: Implemented __repr__ for the ClassGroup* classes to make debugging a bit easier. (ClassGroup.SetLabel): Check that the string is an instance of StringTypes not StringType. Accounts for Unicode strings. * Thuban/Model/color.py: Implemented __repr__ to make debugging a bit easier. * Thuban/Model/save.py (Saver.write_classification): Need to save the group label. * test/test_load.py (testClassification): New. Loads the iceland_sample_test.thuban file and checks if it was loaded correctly. 2003-04-15 Jonathan Coles * extensions/thuban/wxproj.cpp (draw_polygon_init): New. Used to improve rendering performance by initializing the variables that are not change each time draw_polygon_shape() is called. The values are stored in a global struct draw_info. (draw_polygon_shape): Removed initialization code that is now in draw_polygon_init(). * Thuban/UI/renderer.py (MapRenderer.draw_shape_layer): Make drawing initialization call to draw_polygon_init() (MapRenderer.draw_polygon_shape): Use new signature of draw_polygon_shape. * Thuban/UI/classgen.py (GenUniformPanel): Fix spin control weirdness by setting the range to (1, maxint). * Thuban/Model/classification.py (ClassGroupProperties): Make instance variables private and optimize comparison operator by first checking if the color references are the same. (ClassGroupSingleton): Make instance variables private. (ClassGroupRange): Make instance variables private. * HOWTO-Release: Filled in missing steps for releasing packages. 2003-04-15 Bernhard Herzog First stab at internationalized messages: * Thuban/__init__.py (_): Implement the translation function for real using the python gettext module. * Thuban/UI/classifier.py (ClassTable.GetRowLabelValue): Don't translate empty strings. * Thuban/UI/application.py (ThubanApplication.read_startup_files): Add a missing space to a warning message * po/README: New. Notes about the management of the translation files. * po/Makefile: New. Makefile to help manage the translation files. * po/es.po: New. Spanish translation by Daniel Calvelo Aros * MANIFEST.in: Include the *.mo files in Resources/Locale and the translations and support files in po/ * setup.py (data_files): Add the *.mo files to the data_files too * README: Add note about the translations when building from CVS 2003-04-14 Jonathan Coles * Thuban/UI/dock.py: Fixes some window resizing problems most noticable under windows. Always assume the button bitmaps will be there. Code clean up. (DockabelWindow.Dock, DockableWindow.UnDock): Force all the images for the dock/undock button to the same images. Work around for RTbug #1801. * Thuban/UI/legend.py (LegendPanel.__init__): The toolbar should be allowed to grow within the sizer. Fixes a bug under Windows where the toolbar wasn't being drawn. 2003-04-14 Frank Koormann * Resources/Bitmaps/dock_12.xpm, Resources/Bitmaps/undock_12.xpm: Updated design to try to make the button functionality more transparent. 2003-04-14 Jonathan Coles * Thuban/UI/legend.py (LegendPanel.__init__): Call Create() to finalize the intialization of the panel. * Thuban/UI/dock.py (DockPanel.Create): New. Finalizes the creation of the panel. Should be the last thing called in the initializer of a subclass. * Thuban/UI/classgen.py (ClassGenDialog.__init__): Actively set the current selections in the combo boxes. This is needed under Windows. * Thuban/UI/classifier.py (Classifier.__init__): Add a top level panel to the dialog so that the background colors are consistent under Windows. 2003-04-11 Jonathan Coles * Thuban/UI/classgen.py: Change color ramps to start at white not black. * Thuban/UI/legend.py: Enable/disable the legend buttons when the legend changes. Fixes RTbug #1793. * test/test_classification.py: Added test for copying of classifications. 2003-04-11 Jonathan Coles * Thuban/UI/resource.py: New. Centralize the loading of resources such as bitmaps. * Thuban/UI/classgen.py (GenUniquePanel.__init__): Reordered buttons, added images to the move buttons, added 'reverse' button. (CustomRampPanel.__init__): Added images to the move buttons. (GreyRamp): New. Generates a ramp from white to black. (HotToColdRamp): New. Generates a ramp from cold to hot colors. * Thuban/UI/classifier.py: Refactored ID's from ID_CLASSIFY_* to ID_PROPERTY_*. (Classifier.__init__): Minor changes to the layout. (Classifier._OnTitleChanged): Listen for when the user edits the title and update the dialog's title and the layer's title. * Thuban/UI/dock.py: Use new bitmaps for the control buttons. * Thuban/UI/legend.py: Use new bitmaps for the control buttons. (LegendTree._OnMsgLayerTitleChanged): Change the displayed title if the layer's title changes. * Thuban/UI/mainwindow.py: Added new menu item and associated code to open a dialog to rename the map. (MainWindow): Use new resource class to import bitmaps. 2003-04-11 Jonathan Coles * Resources/Bitmaps/close_12.xpm, Resources/Bitmaps/dock_12.xpm, Resources/Bitmaps/group_use.xpm, Resources/Bitmaps/group_use_all.xpm, Resources/Bitmaps/group_use_none.xpm, Resources/Bitmaps/group_use_not.xpm, Resources/Bitmaps/hide_layer.xpm, Resources/Bitmaps/layer_properties.xpm, Resources/Bitmaps/lower_layer.xpm, Resources/Bitmaps/raise_layer.xpm, Resources/Bitmaps/show_layer.xpm, Resources/Bitmaps/undock_12.xpm: New. 2003-04-10 Jonathan Coles * Thuban/Model/classification.py: (ClassGroupRange.__init__): Should pass group to ClassGroup constructor. 2003-04-10 Jonathan Coles * Thuban/Model/classification.py: (ClassGroup): Move all the common methods of the derived classes ([Set|Get]Properties(), __eq__, __ne__) here. Implement SetVisible(), IsVisible(). (ClassGroup.__init__): Add group parameter which acts as a copy constructor. * Thuban/UI/classifier.py (ClassTable): Add a new column for the "Visible" check boxes. (Classifier): Rename the buttons and refactor the code to match the new labels. * Thuban/UI/legend.py: Classify button is now called "Properties". Refactored the code to change variable names. (LegendTree.__FillTreeLayer): Only list a group if it is visible. * Thuban/UI/mainwindow.py: MainWindow.OpenClassifier renamed to MainWindow.OpenLayerProperties. MainWindow.LayerEditProperties renamed to MainWindow.LayerEditProperties. (MainWindow.ToggleLegend): Don't include map name in legend title. (MainWindow.SetMap): Added the map name to the window title. (MainWindow.LayerFillColor, MainWindow.LayerTransparentFill, MainWindow.LayerOutlineColor, MainWindow.LayerNoOutline): Removed. Functionality is found in the layer properties dialog. * Thuban/UI/renderer.py (MapRenderer.draw_shape_layer): Only draw visible groups. 2003-04-09 Jonathan Coles * Thuban/UI/classgen.py: Modifications to allow simple addition and selection of new color schemes. (MonochromaticRamp): New. Generates a ramp between two colors. (RedRamp): New. Generates a ramp of all red. (GreenRamp): New. Generates a ramp of all green. (BlueRamp): New. Generates a ramp of all blue. 2003-04-09 Jonathan Coles * Thuban/Model/classification.py (Classification.__deepcopy__): Need to copy over field and fieldType attributes. * Thuban/Model/table.py (Table.field_range): New. Retrive the maximum and minimum values over the entire table for a given field. (Table.GetUniqueValues): New. Retrieve all the unique values in the table for a given field. * Thuban/UI/classgen.py: Renamed GenRangePanel to GenUniformPanel. (GenUniquePanel): New. Controls to allow the user to select which unique field values they would like in the classification. (CustomRampPanel): Code that was in ClassGenDialog that allows the user to select the properties for a custom ramp. (ClassGenerator.GenUniformDistribution): Was called GenerateRanges. * Thuban/UI/classifier.py: Removed a lot of debugging code. (Classifier._SetClassification): Callback method so that the class generator can set the classification in the grid. (ClassGroupPropertiesCtrl): New. Encapsulates the drawing and editing of a group properties class into a wxWindows control. * Thuban/UI/dock.py: It was decided that if the user closes a dockable window the window should simply hide itself. That way if the user wants to show the dock again it appears in the same place as it was when it was closed. (DockableWindow.Destroy): Call renamed method OnDockDestroy(). (DockableWindow._OnButtonClose): Hide the window instead of destroying it. (DockableWindow._OnClose): Hide the window instead of destroying it. * Thuban/UI/legend.py (LegendTree): Use a private method to consistently set the font and style of the text. Fixes RTbug #1786. * Thuban/UI/mainwindow.py: Import just the Classifier class. 2003-04-07 Bernhard Herzog * Thuban/UI/mainwindow.py (main_menu): Move the toggle_legend item to the map module 2003-04-07 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.ShowSessionTree): Removed in favor of ToggleSessionTree (MainWindow.ToggleSessionTree): New method to toggle visibility of the session tree. (MainWindow.SessionTreeShown): New method to return whether the session tree is currently shown. (MainWindow.ToggleLegend): New method to toggle visibility of the legend (MainWindow.ShowLegend): Implement in terms of ToggleLegend and LegendShown (MainWindow.LegendShown): New method to return whether the legend is currently shown. (_method_command): Add checked parameter so we can define check menu items (_has_tree_window_shown, _has_legend_shown): Use the appropriate mainwindow methods. (show_session_tree, show_legend commands): Removed. (toggle_session_tree, toggle_legend commands): New commands to toggle the visibility of the dialogs 2003-04-07 Jonathan Coles * Thuban/UI/classgen.py: Fix Windows problem. * Thuban/UI/dock.py: Fix Windows problem. * Thuban/UI/mainwindow.py: Use False instead of false. (MainWindow.ShowLegend): Remove unnecessary switch parameter. 2003-04-07 Jonathan Coles Since we now say that the order of the groups in a classification matters, it makes sense to be able to manipulate that order. Most of the changes to Thuban/Model/classification.py are to that end. * Thuban/Model/classification.py (Classification.AppendGroup, Classification.InsertGroup, Classification.ReplaceGroup, Classification.RemoveGroup, Classification.GetGroup): Do as the names imply. (Classification.FindGroup): This was called GetGroup, but GetGroup takes an index, while FindGroup takes a value. (Classification.__deepcopy__): Copy all the groups, BUT NOT THE LAYER REFERENCE. Currently there is a cyclic reference between the layer and its classification. If the classification doesn't need to know its owning layer we can change this, since it may make sense to be able to use the same classification with different layers. * Thuban/Model/load.py: Use Classification.AppendGroup(), not AddGroup() * Thuban/UI/classgen.py: Use Classification.AppendGroup(), not AddGroup() * Thuban/UI/classifier.py: Now that we can depend on the order in a Classification and have methods to manipulate that order we don't need to use our own data structures in the grid. We can simply make the grid/table access the information they need from a copy of the classification object. (Classifier._OnCloseBtn): Event handler for when the user clicks 'Close'. This is needed so if the user applies changes and then continues to change the table the user has the option of discarding the most recent changes and keeping what they applied. * Thuban/UI/mainwindow.py: Put "Show Legend" and "Show Session Tree" into the same group. * extensions/thuban/wxproj.cpp (check_version): If Thuban is compiled with a really old version of proj, PJ_VERSION won't even be defined. If it isn't defined then just compile so that the function always returns Py_False. * test/test_classification.py: Fix tests to use the renamed methods. Still need to write tests for the new methods. 2003-04-04 Jonathan Coles * Thuban/UI/classifier.py (Classifier.__SelectField): Move the call to SetSelection out of the method and before the call to __SelectField in __init__. This prevents a recursion of events when _OnFieldSelect is triggered by the user. 2003-04-04 Jonathan Coles * Thuban/Model/classification.py: Rename Color.None to Color.Transparent. (ClassGroupProperties.SetLineColori, ClassGroupProperties.SetFill): Don't bother copying the color, since Colors are immutable. * Thuban/Model/color.py, Thuban/Model/layer.py, Thuban/Model/load.py, Thuban/UI/classifier.py, Thuban/UI/mainwindow.py, Thuban/UI/renderer.py, Thuban/UI/view.py: Rename Color.None to Color.Transparent. * test/test_classification.py, test/test_load.py: Rename Color.None to Color.Transparent. 2003-04-04 Jonathan Coles * Thuban/Model/classification.py: Fix assert calls. (ClassGroupProperties.SetLineColor, ClassGroupProperties.SetFill): Copy the color parameter rather than hold onto a reference. * Thuban/Model/color.py (Color.__copy__, Color.__deepcopy): Copy the color object. (NoColor.__copy__, NoColor.__deepcopy): Return 'self' so that we are sure there exists only one refernce to Color.None in the system. This allows us to use 'is' rather than the comparision functions. * Thuban/Model/save.py: Fix assert calls. * Thuban/UI/classifier.py: Fix assert calls. (ClassGrid._OnCellDClick): Call up to the classifier to open the dialog to edit the groups properties. (ClassGrid._OnCellResize): Make sure that the scollbars are drawn correctly if a cell is resized. (ClassTable.SetClassification): New. Changes the classification that is in the table. (ClassTable.__SetRow): Allow groups to be prepended. (Classifier): New code for opening the EditProperties and GenerateRanges dialogs. (SelectPropertiesDialog.__GetColor): Only set the color in the color dialog if the current color is not None. * Thuban/UI/dock.py: Fix assert calls. * Thuban/UI/legend.py: Fix assert calls. * Thuban/UI/renderer.py: Fix assert calls. * Thuban/UI/classgen.py (ClassGenDialog): Dialog for generating classifications. (GenRangePanel): Panel specific to range generation. (GenSingletonPanel): Panel specific to singleton generation. (ClassGenerator): Class responsible for actually generating the classification from the data gathered in the dialog box. (PropertyRamp): Generates properties whose values range from a starting property to an ending property. 2003-04-03 Bernhard Herzog * test/support.py (print_garbage_information): New function that prints information about still connected messages and memory leaks. (run_suite): Removed. (run_tests): New function for use as a replacement of unittest.main in the test_* files. This one calls print_garbage_information at the end. * test/runtests.py (main): Use support.print_garbage_information * test/test_layer.py: Use support.run_tests instead of unittest.main so we get memory leak information (TestLayer.test_arc_layer, TestLayer.test_polygon_layer) (TestLayer.test_point_layer, TestLayer.test_empty_layer) (TestLayerLegend.test_visibility): Call the layer's Destroy method to fix a memory leak. * test/test_classification.py: Use support.run_tests instead of unittest.main so we get memory leak information (TestClassification.test_classification): Call the layer's Destroy method to fix a memory leak. 2003-04-02 Bernhard Herzog * extensions/thuban/wxproj.cpp (check_version, check_version_gtk): Handle the reference counts of the return value and errors in PyArg_ParseTuple correctly. * Thuban/UI/application.py (ThubanApplication.OpenSession): Make sure the filename is absolute to avoid problems when saving the session again * Thuban/Model/table.py: Remove unnecessary import. Fix a typo. 2003-04-01 Jonathan Coles * Thuban/UI/renderer.py (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. 2003-04-01 Bernhard Herzog * test/test_map.py: Don't use from import * 2003-04-01 Jonathan Coles * Thuban/Model/session.py: Use LAYER_CHANGED instead of LAYER_LEGEND_CHANGED * Thuban/UI/dock.py (DockableWindow._OnButtonClose): Call self.Destroy() to close the window after yesterday's changes. * test/test_map.py, test/test_session.py: Fix messages that are sent from maps and layers. 2003-03-31 Jonathan Coles * Thuban/UI/classifier.py: Commented out some debugging statements. (ClassDataPreviewer.Draw): Draw rectangles for polygon layers per RTbug #1769. * Thuban/UI/dock.py (DockableWindow.UnDock): Restore size and position (although position doesn't work yet under GTK). (DockableWindow.Destroy): New. Called when the window must be closed. Namely needed when the DockFrame closes and must close its children. (DockFrame): Listen for EVT_CLOSE and destroy all children. * Thuban/UI/legend.py (LegendPanel.Destroy): New. Cleans up when then window is told to close. (LegendTree._OnMsgLayerChanged): Fixes a seg fault bug. See comment in source for more info. * Thuban/UI/main.py: Show the legend by default when Thuban starts. * Thuban/UI/mainwindow.py: Renamed OnClose to _OnClose for symmetry with other such methods. (MainWindow.ShowLegend): Show the legend docked by default. 2003-03-28 Jonathan Coles * Thuban/UI/classifier.py: Support for highlighting a specific group within the grid when the classification dialog is opened. Also contains a lot of debugging printouts which will later be removed. * Thuban/UI/dock.py: Complete rework on the dock code so that that it is fairly removed from the rest of the Thuban application. It is easy to add new docks which the rest of the program having to be aware of them. * Thuban/UI/legend.py: Modifications to support selecting a specific group in the classification dialog. Changed how layers are drawn when the layer is visible/invisible. * Thuban/UI/mainwindow.py: Removed legend specific code and replaced it with calls to the new dock code. * Thuban/UI/renderer.py (MapRenderer.__init__): Added assert to check if scale > 0. Trying to track down a divide by zero. 2003-03-26 Jonathan Coles * Thuban/UI/legend.py: Removed unnecessary LegendDialog class. (LegendPanel): Removed _OnDock()/_OnUnDock() methods which are now part of DockableWindow. (LegendPanel.DoOnSelChanged): Select the current layer in the map. (LegendTree._OnSelChanged): Call LegendPanel.DoOnSelChanged() with the selected layer and/or group. 2003-03-26 Jonathan Coles This putback contains the code for dockable windows. There is no support in wxWindows as of this date for windows that can attach themselves to other windows. The current model contains a DockableWindow which has a parent window for when it is detached and a dock window that it puts its contents in when it is docked. The contents of a DockableWindow must be a DockPanel. DockPanel itself derives from wxPanel. * Thuban/Model/layer.py (Layer.ClassChanged): Send a LAYER_CHANGED message, not a LAYER_LEGEND_CHANGED message. * Thuban/Model/map.py (Map): Forward LAYER_CHANGED messages. * Thuban/UI/classifier.py (Classifier.__init__): Use wxADJUST_MINSIZE as one of the style properties for the fieldTypeText item to be sure that its size is correct when the text changes. * Thuban/UI/dock.py: New. Classes for the DockPanel and DockableWindow. * Thuban/UI/legend.py: Added some more buttons and made the LegendPanel a DockPanel. * Thuban/UI/mainwindow.py: Added sash windows to the main window and supporting functions for manipulating the sashes. (MainWindow.ShowLegend): Create a DockableWindow with the LegendPanel as the contents. * Thuban/UI/messages.py: Added DOCKABLE_* messages * Thuban/UI/view.py (MapCanves.SetMap): Listen for LAYER_CHANGED, not LAYER_LEGEND_CHANGED, messages. 2003-03-25 Jonathan Coles * setup.py: Added custom script bdist_rpm_build_script so that when the rpm is built the path to wx-config is correct. * setup.cfg: Added line saying to use the custom build script 2003-03-20 Jonathan Coles Initial implementation of the Legend. * Thuban/UI/legend.py: New. Creates a window that shows the map's Legend information and allows the user to add/modify classifications and how the layers are drawn on the map. * setup.py: New command 'build_docs' which currently uses happydoc to generate html documentation for Thuban. * Thuban/Model/classification.py (ClassGroup.GetDisplayText): New. Returns a string which is appropriately describes the group. * Thuban/Model/layer.py (Layer.SetClassification): Generate a LAYER_CHANGED event instead of a LAYER_LEGEND_CHANGED event. * Thuban/Model/map.py (Map): Rename messages and use new, more specific, messages. * Thuban/Model/messages.py: New message to indicate that a layer's data has changed (LAYER_CHANGED). New map messages to indicate when layers have been added/removed/changed or if the stacking order of the layers has changed. * Thuban/Model/session.py: Rename and use new messages. * Thuban/UI/classifier.py: Remember if any changes have actually been applied so that if the dialog is cancelled without an application of changes we don't have to set a new classification. (ClassDataPreviewer): Pulled out the window specific code and put it ClassDataPreviewWindow. ClassDataPreviewer can then be used to draw symbols on any DC. * Thuban/UI/mainwindow.py: New code to open the legend. * Thuban/UI/view.py: Use new message names. 2003-03-19 Jonathan Coles * Thuban/UI/main.py (verify_versions): New. Checks the versions of Python, wxPython, and some other libraries. * extensions/thuban/wxproj.cpp (check_version): Checks the given version against what wxproj was compiled with. (check_version_gtk): If wxproj was compiled with gtk then check the given version against the version of the gtk library currently being used. 2003-03-14 Bernhard Herzog * test/test_command.py: Run the tests when the module is run as a script 2003-03-14 Bernhard Herzog Implement selection of multiple selected shapes in the same layer: - Introduce a new class to hold the selection. This basically replaces the interactor which was nothing more than the selection anyway. A major difference is of course that the new selection class supports multiple selected shapes in one layer - Move the object that represents the selection from the application to the canvas. The canvas is a better place than the application because the selection represents which shapes and layer of the map displayed by the canvas are selected and affects how the map is drawn. - Make the selection and its messages publicly available through the mainwindow. - The non-modal dialogs do not get a reference to the interactor anymore as they can simply refer to their parent, the mainwindow, for the what the interactor had to offer. * 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/controls.py (RecordListCtrl.fill_list): The second parameter is now a list of shape ids. (RecordTable.SetTable): The second parameter is now a list of indices. * 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. * test/test_selection.py: Test cases for the selection class 2003-03-11 Jonathan Coles * Thuban/Model/load.py: Temporary fix so that the xml reader doesn't cause Thuban to crash. * Thuban/Model/layer.py: Handle the cyclic references between a layer and its classification better, and be sure to disconnect the classification from the layer when the layer is destroyed so that we don't maintain a cyclic reference that may not be garbage collected. * Thuban/Model/classification.py: See comment for layer.py. 2003-03-12 Jan-Oliver Wagner * HOWTO-Release: New. Information on the steps for releasing a new version of Thuban. 2003-03-11 Jonathan Coles * Thuban/UI/classifier.py: Add normal border to SelectPropertiesDialog. Use True instead of true. (Classifier): Should have a single panel in which all the controls lie. * Thuban/UI/proj4dialog.py: Add normal border. * Thuban/UI/tree.py: Fixed problem with bad item images under Windows. * Thuban/UI/mainwindow.py: Use True instead of true. * setup.py: Update some definitions to use wxWindows2.4 files * Data/iceland_sample_class.thuban: Fixed file so that the field_type information is present. 2003-03-10 Jonathan Coles * Thuban/UI/classifier.py (Classifier.__init__): Make the field type label grow so that when the text changes the size is updated correctly. This may be a wxWindows bug. 2003-03-10 Jonathan Coles * Thuban/UI/application.py: Changed SESSION_CHANGED to SESSION_REPLACED. * Thuban/UI/classifier.py: Wrap text with _(). (ClassGrid.CreateTable): Set dimensions and size hints here, instead of in Reset, so we only set the size once. * Thuban/UI/dialogs.py: Don't need Shutdown(); just use Close()! * Thuban/UI/mainwindow.py (MainWindow.prepare_new_session): Call Close() instead of Shutdown(). * Thuban/UI/messages.py: Changed SESSION_CHANGED to SESSION_REPLACED. * Thuban/UI/tree.py: Changed SESSION_CHANGED to SESSION_REPLACED. Go back to using OnClose() instead of Shutdown(). 2003-03-10 Jonathan Coles * Thuban/UI/classifier.py (Classifier): SelectField() needed to know the old field index as well as the new one. 2003-03-10 Jonathan Coles * Thuban/UI/classifier.py (Classifier): Use __SelectField() to correctly set the table information and call this from __init__ and from _OnFieldSelect so that all the information is up to date when the dialog opens and when a field is changed. 2003-03-10 Jonathan Coles * Thuban/Model/classification.py (Classification): Don't use layer's message function directly, use the ClassChanged() method when then classification changes. SetField/SetFieldType/SetLayer must keep the information about field name and field type in sync when an owning layer is set or removed. * Thuban/Model/layer.py: Added ClassChanged() so that the classification can tell the layer when its data has changed. (Layer.SetClassification): Accepts None as an arguement to remove the current classification and correctly handles adding a new classification. * Thuban/Model/load.py: Comment out print statement * test/test_classification.py, test/test_save.py: New and improved tests. 2003-03-07 Jonathan Coles * Thuban/Model/classification.py: Implemented __copy__ and __deepcopy__ for ClassGroup* and ClassGroupProperites so they can easily be copied by the classifier dialog. (ClassGroupProperites.__init__): The default line color should have been Color.Black. * Thuban/UI/classifier.py: Setting and Getting table values now uses a consistent set of functions. (Classifier): Now non-modal. Has field type label which changes as the field changes. Keep track of buttons in a list so that we can enable/disable the buttons when the None field is selected. (SelectPropertiesDialog): Add buttons to make the colors transparent. * Thuban/UI/dialogs.py (NonModalDialog.Shutdown): New method which does what OnClose did, but can be called by the application to close a window. Needed when a session changes, and we have to close the classifier windows. * Thuban/UI/mainwindow.py (MainWindow.prepare_new_session): Shuts down open dialogs. Used when a new session is created or a session is opened. (MainWindow.SaveSession): Should only call application.SaveSession() if we don't call SaveSessionAs first. (MainWindow.Classify): Allow different classifier dialogs for different layers. * Thuban/UI/tree.py (SessionTreeView): Remove OnClose and let the parent class handle it. Add Shutdown() to unsubscibe from event notification and call the parent Shutdown(). This was necessary so the application can close the tree window. 2003-03-06 Jonathan Coles * Thuban/Model/classification.py: Minor documentation changes, Addition of __eq__ and __ne__ methods. (Classification.SetLayer): prevent recursion between this method and Layer.SetClassification(). * Thuban/Model/color.py: Addition of __eq__ and __ne__ methods. * Thuban/Model/layer.py (SetClassification): prevent recursion between this method and Classification.SetLayer(). * test/test_classification.py, test/test_load.py, test/test_session.py: Fixed and added tests for the classification classes. 2003-03-06 Bernhard Herzog * Thuban/UI/classifier.py (ClassGrid.__init__) (ClassGrid.CreateTable): Move the SetSelectionMode call to CreateTable because otherwise it triggers an assertion in wxPython/wxGTK 2.4. 2003-03-05 Jonathan Coles * Thuban/common.py: Move FIELDTYPE constants back to table.py. * Thuban/Model/load.py: import FIELDTYPE constants from table. * Thuban/UI/classifier.py: import FIELDTYPE constants from table. * Thuban/Model/table.py: Put FIELDTYPE constants back. 2003-03-05 Jonathan Coles * Thuban/UI/classifier.py: Added class documentation. Fixed RTbug #1713, #1714. Added Move[Up|Down] buttons. Store just the groups in the table and generate the other column information when it is requested. Add "None" field to pull-down to select no classification. * Thuban/common.py: Moved FIELDTYPE constants from table.py (Str2Num): Only catch ValueError exceptions. * Thuban/Model/classification.py: Class documentation. Renaming of methods with Stroke to Line. Groups are stored in a single list with the default as the first element. Groups are searched in the order they appear in the list. * Thuban/Model/color.py: Documentation. * Thuban/Model/layer.py (Layer): Add GetFieldType to retreive the kind of data represented by a field. * Thuban/Model/load.py (ProcessSession): Use proper string conversion function; fixes RTbug #1713. * Thuban/Model/save.py (Saver): Store field type information. * Thuban/Model/table.py: Put FIELDTYPE constants in common.py. (Table): Add field_info_by_name() to retrieve field information by specifying the field name, not the number. * Thuban/UI/mainwindow.py: Function name changes. * Thuban/UI/renderer.py (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. * Thuban/UI/view.py: Function name changes. * Doc/thuban.dtd: Add field_type attribute to a classification. 2003-03-04 Bernhard Herzog * Doc/thuban.dtd: Use correct syntax for optional attributes. Make the fill and stroke layer attributes optional with suitable default values. Add the stroke_width layer attribute. Use correct syntax for empty elements. Make the attribute list for labels refer to the label element. 2003-03-04 Bernhard Herzog * setup.py (thuban_build_py.build): Add a comment about distutils in Python 2.3 containing some of the functionality we implement in setup.py ourselves. * Thuban/UI/classifier.py (ClassGrid.__init__): Set the table before the selection mode. Doing it the other way round triggers an assertion in wxWindows. * Thuban/Model/save.py (escape): Fix typo in doc-string * Thuban/Model/classification.py: Remove unnecessary wxPython import 2003-03-04 Jonathan Coles * Thuban/Model/classification.py (ClassGroupRange.GetProperties): Parameter 'value' should default to None. * Thuban/UI/mainwindow.py: Use Layer.GetClassification() since the class attribute __classification is now private. * Thuban/UI/classifier.py (ClassGrid): Moved OnCellDClick() from Classifier to ClassGrid. Added support for removing selected rows, which including code for keeping track of when cells are selected, and deselected. (ClassTable): Support for added/removing rows. Fixed a problem with __ParseInput whereby it would not allow strings (only numbers) to be entered. (Classifier): Added button and supporting code for removing selected rows. 2003-02-27 Jonathan Coles * Thuban/common.py: Moved color conversion functions into Thuban/UI/common.py. (Str2Num): Now converts the float (not the string) to a long/int so that an exception isn't thrown. * Thuban/UI/common.py: Common functions used in several UI modules * Thuban/Model/classification.py: Changed the class hierarchy so that a Classification consists of Groups which return Properties when a value matches a Group. * Thuban/Model/layer.py: Fixed name resolution problem. * Thuban/Model/load.py: Use new Classification and Group functions. * Thuban/Model/save.py (Saver.write_attribs): Fixes a test case failure. (Saver.write_classification): Use new Classification and Group functions. * Thuban/UI/classifier.py: Changes to use new Classification and Group functions. Fix to create a tuple with a single value instead of simply returning the value. * Thuban/UI/renderer.py: Use new Classification and Group functions. Use common.py functions. * Thuban/UI/tree.py: Use common.py functions. * test/test_classification.py: Use new Classification and Group classes. 2003-02-24 Jonathan Coles * Thuban/common.py (Color2wxColour, wxColour2Color): Conversion functions from Thuban color objects to wxWindow colour objects. * Thuban/Model/classification.py (Classification): Renamed GetProperties() to GetClassData(). Used the new iterator in TreeInfo(). (ClassIterator): Iterator implementation to iterate over the ClassData objects in a classification object. * Thuban/Model/save.py (Saver.write_classificaton): Uses the new iterator to save the classification information. * Thuban/UI/classifier.py (SelectPropertiesDialog): Support for changing the stroke and fill colors and previewing the changes. * Thuban/UI/mainwindow.py (MainWindow.OpenSession, MainWindow.SaveSessionAs): Text string changes so the dialogs have more meaningful titles. * Thuban/UI/renderer.py (MapRenderer.draw_shape_layer): Change Classification method name from GetProperties to GetClassData. * Thuban/UI/view.py (MapCanvas.find_shape_at): Use method calls instead of accessing now non-existent class variables. 2003-02-24 Bernhard Herzog * Thuban/UI/renderer.py (MapRenderer.draw_shape_layer): Remove unneeded Shape() call. Rendering is substantially faster without it and it avoids some problems with broken shape files. 2003-02-20 Frank Koormann Force minimal size of identify and label dialogs. The autosizing looked too ugly. * Thuban/UI/controls.py (RecordListCtrl): Set minimal width for columns. * Thuban/UI/labeldialog.py (LabelDialog.dialog_layout): Set size of listctrl. * Thuban/UI/identifyview.py (IdentifyView.__init__): Set size of dialog. 2003-02-19 Jonathan Coles * test/test_classification.py, test/test_layer.py, test/test_load.py, test/test_map.py, test/test_session.py: Updated the tests to use the new functions that are in the respective classes. * Thuban/Model/classification.py (Classification): Uses the new ClassData* classes. Modification messages are passed up to the parent layer (if it exists). (ClassData): New class to encapsulate the common data in each classification property. (ClassDataDefault): Represents the Default class. data. (ClassDataPoint): Represents a single class. data point (ClassDataRange): Represents a class. range (ClassDataMap): Represents a class. map (unused). * Thuban/Model/color.py: Added Color.None to represent something with no color. Color.Black represents the color black. (NoColor): Helper class derived from Color to represent something with no color. * Thuban/Model/layer.py (Layer): Removed references to fill, stroke, stroke_width attributes. Made the 'classification' attribute private. New methods for setting/getting the classification. * Thuban/Model/load.py (ProcessSession): Use new methods on Layer to get the classifcation and use the new ClassData* classes to hold the classification data. Use Str2Num to convert numbers properly. * Thuban/Model/save.py (Saver): Use new Color and Classification methods * Thuban/UI/classifier.py (ClassGrid): New class to represent a custom grid. (ClassTable): Support for editing Values and Labels and for changing what type (point or range) of data is stored in each property based on how the user enters the data. (Classifier): Support for saving the new classifications and launching the dialog to edit a property. (SelectPropertiesDialog): New class for editing the visual properties of a classification (stroke color, width, and fill color) (ClassPreviewer): Took the Draw method from ClassRenderer and made most of it into this new class. Intend to use this class in the SelectPropertiesDialog for previewing changes. * Thuban/UI/renderer.py: Use new Color and Classification methods. * Thuban/UI/tree.py: Formatting changes. * Doc/thuban.dtd: Add 'label' element * Thuban/common.py: New. Contains common routines used throughout the code. (Str2Num): Takes a string and converts it to the "best" type of number. 2003-02-14 Bernhard Herzog * Thuban/UI/view.py (MapCanvas.OnLeftUp): Make sure that the dragging flag is always set to 0 even when the tool implementation raises an exception 2003-02-11 Bernhard Herzog * Thuban/UI/application.py (ThubanApplication.splash_screen): New method to create a splash screen. (ThubanApplication.ShowMainWindow): New. Show the main window. Needed so the splash screen can display the mainwindow (ThubanApplication.OnInit): Call the new splash_screen method to determine whether the application should display a splash screen. If it displays a splash screen do not immediately show the main window. 2003-02-11 Jonathan Coles * Thuban/Model/classification.py: Added import line to fix feature conflicts between running on python2.2 and python2.1. * Thuban/UI/classifier.py (ClassTable): Didn't need to hang onto the clinfo parameter, so removed the deepcopy(). 2003-02-10 Jonathan Coles * Thuban/Model/save.py (Saver.open_element, Saver.close_element): Added element_open variable to track opening and closing of tags so that tags that don't span more than one line are closed with /> instead of . Use the GetDefault*() methods of the Classification class. * Thuban/Model/classification.py (Classificaton): Added set and get methods for the default data. The class also takes a layer reference so that modification messages can be sent. Fixed the methods to use the new ClassData class. (ClassData): New class to encapsulate the classification data * Thuban/Model/layer.py (Layer): Remove the Set[Fill|Stroke|StrokeWidth]() methods. Code should call the SetDefault*() methods on the layer's classification object. (Layer.__init__): Use the new SetDefault*() methods in the Classification class. * Thuban/Model/load.py (ProcessSession): Use the new ClassData object instead of a dictionary. * Thuban/UI/classifier.py (ClassRenderer): New class to draw the classifications in the dialog box's table. (Classifier): Modified to use the ClassRenderer class. * Thuban/UI/mainwindow.py (MainWindow): Use the SetDefault*() methods of the Classification class. * Thuban/UI/renderer.py (MapRenderer): Use the Get*() methods of the ClassData class. * test/test_classification.py, test/test_layer.py, test/test_map.py, test/test_session.py: Fix the tests to work with the above code changes. 2003-02-03 Jonathan Coles * Thuban/Model/classification.py (Classification): Added getNull() to return the NullData reference * Thuban/Model/layer.py (Layer.SetFill, Layer.SetStroke, Layer.SetStrokeWidth): Modified these functions to change the null data in the classification rather than keep these values directly in the Layer class. Menu options to change these values work again. 2003-01-28 Jonathan Coles * Thuban/UI/classifier.py (Classifier): Resolved merging conflicts. Fixed crashing problem on some systems. Dialog box shows classification data. * Thuban/UI/tree.py (SessionTreeCtrl.add_items): Handle drawing Colors in the tree view. * Thuban/Model/layer.py (Layer.TreeInfo): Added a call to build the tree info for classifications. Commented out unnecessary lines. * Thuban/Model/classification.py (Classification.TreeInfo): New function to add information about the classification into the tree view. 2003-01-27 Jan-Oliver Wagner * Thuban/__init__.py (_): New. * Thuban/Model/classification.py, Thuban/Model/extension.py, Thuban/Model/layer.py, Thuban/Model/load.py, Thuban/Model/map.py, Thuban/Model/session.py, Thuban/UI/application.py, Thuban/UI/classifier.py, Thuban/UI/context.py, Thuban/UI/controls.py, Thuban/UI/identifyview.py, Thuban/UI/labeldialog.py, Thuban/UI/mainwindow.py, Thuban/UI/menu.py, Thuban/UI/proj4dialog.py, Thuban/UI/renderer.py, Thuban/UI/tree.py, Thuban/Lib/connector.py, Thuban/Lib/fileutil.py: Replace user string by _() for i18n. 2003-01-27 Jonathan Coles * Thuban/Model/layer.py: Classification initialization calls. * Thuban/Model/classification.py: Created class to encapsulate a layer classification. Supports specific data points and ranges. * Thuban/Model/load.py: Added support for loading classification information. * Thuban/Model/save.py: Added support for saving classification information. * Thuban/UI/classifier.py: Initial class for a dialog box for specifying classification information. * Thuban/UI/mainwindows.py: Support for opening the classifier dialog. * Thuban/UI/renderer.py: Support for drawing a layer with the classification information. * Data/iceland_sample_class.thuban: iceland_sample with classification data. * test/test_classification: Tests for the Classification class. 2002-12-09 Bernhard Herzog * test/test_command.py: New. Tests for the command classes. * Thuban/UI/command.py (ToolCommand): New class for tool commands. (Command.IsTool): New method to distinguish between command switching tools and other commands. * Thuban/UI/view.py (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/mainwindow.py (MainWindow.update_command_ui): If an active tool's command turns insensitive, disable the tool. (_tool_command): Use the new ToolCommand class * Examples/simple_extensions/simple_tool.py (simple_tool): Use the SelectTool method to change the tool (iconfile): Use the ToolCommand class 2002-12-03 Bernhard Herzog * Thuban/UI/tree.py (SessionTreeCtrl.normalize_selection): Handle the case of selected items that are not children of Layers or Maps properly. Previously this bug would trigger an assertion in wxWindows. 2002-11-06 Frank Koormann * Thuban/UI/mainwindow.py: Altered the order of tools in the toolbar: First now are all navigation tools (Zoom In/Out, Pan, Full Extent). 2002-10-23 Bernhard Herzog * setup.py (setup call): version now 0.1.3 * MANIFEST.in: Add the files in test/ * test/README: Add note about tests requiring the iceland data * Thuban/UI/mainwindow.py (MainWindow.About): Add 2002 to copyright notice. 2002-10-18 Bernhard Herzog * test/test_map.py (TestMapWithContents.test_projected_bounding_box): Use an explicit epsilon. * test/support.py (FloatComparisonMixin.assertFloatEqual) (FloatComparisonMixin.assertFloatSeqEqual): give a more useful message if the assertion fails and don't return the return value of self.assert_. In assertFloatSeqEqual the return meant that not all items of the sequence were compared. 2002-09-20 Bernhard Herzog * test/test_fileutil.py: New. Test cases for Thuban.Lib.fileutil * Thuban/Lib/fileutil.py: Fixup some whitespace and typos * test/test_map.py (TestMapWithContents.test_tree_info): Create the string with the bounding box on the fly because of platform differences in the way %g is handled. * test/test_layer.py (TestLayer.test_empty_layer): Create an empty DBFfile too because Thuban layers can't yet cope missing DBF files. 2002-09-20 Bernhard Herzog * test/test_menu.py: Use initthuban instead of add_thuban_dir_to_path to initialize Thuban. * test/support.py (FloatComparisonMixin.assertFloatEqual): New. Mixin class for float comparisons (SubscriberMixin): New. Mixin class to test messages sent through the Connector class * test/README: Fix a typo and add the -v flag to the command for individual tests * test/test_session.py: New. Test cases for Thuban.Model.session * test/test_proj.py: New. Test cases for Thuban.Model.proj * test/test_map.py: New. Test cases for Thuban.Model.map * test/test_layer.py: New. Test cases for Thuban.Model.layer * test/test_label.py: New. Test cases for Thuban.Model.label * test/test_connector.py: New. Test cases for Thuban.Lib.connector * test/test_color.py: New. Test cases for Thuban.Model.color * test/test_base.py: New. Test cases for Thuban.Model.base 2002-09-13 Bernhard Herzog * Thuban/Model/session.py (Session.forwarded_channels): Forward the CHANGED channel too. * Thuban/Model/map.py (Map.forwarded_channels): Forward the CHANGED channel too. (Map.__init__): Call the Modifiable constructor as well. * Thuban/Model/base.py (Modifiable.UnsetModified): Issue a CHANGED event if the modified flag changes. (Modifiable.changed): Tweak the doc-string. * Thuban/UI/mainwindow.py (MainWindow.view_position_changed) (MainWindow.set_position_text): Put the code that puts the text with the mouse position into the status bar into the new method set_position_text so that it can overwritten in derived classes. 2002-09-12 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.RunMessageBox): Center the message box on the main window. 2002-09-11 Bernhard Herzog * Thuban/UI/mainwindow.py: Underline the 'x' in "Exit" instead of the 'E' because it's less likely to interfere with other menu entries. (MainWindow.build_menu): remove an incorrect comment. 2002-09-10 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.Map): New. (_tool_command): Add sensitive parameter (_has_visible_map): Sensitivity callback to tools and other commands that require a visible map. Use it in map_zoom_in_tool, map_zoom_out_tool, map_pan_tool, map_identify_tool, map_label_tool and map_full_extent 2002-09-06 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.OnClose): Unsubscribe VIEW_POSITION 2002-09-04 Frank Koormann * Resources/Bitmaps/fullextent.xpm: Updated Icon (removed "potatoe") 2002-09-02 Bernhard Herzog * 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. * Thuban/UI/view.py (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 2002-08-30 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.CanRemoveLayer): New method for the sensitivity of remove layer. (_can_remove_layer): New. Sensitivity callback for remove layer (Command layer_remove): Use _can_remove_layer * Thuban/Model/map.py (Map.CanRemoveLayer): New method to determine whether a given layer can be deleted. * Thuban/UI/view.py (MapCanvas.__init__, MapCanvas.OnPaint) (MapCanvas.do_redraw): Get rid of the unused update_region instance variable * Thuban/UI/view.py: Add/update some doc-strings. * test/: new subdirectory with a bunch of unit tests. * test/README, test/test_table.py, test/test_save.py, test/test_menu.py, test/test_load.py: Initial set of tests and brief instructions on how to run them 2002-08-29 Bernhard Herzog * Thuban/UI/renderer.py (ScreenRenderer.draw_shape_layer): Handle arcs with multiple parts. * Thuban/UI/view.py (ZoomInTool.MouseUp, ZoomOutTool.MouseUp): Handle degenrate rectangles. * Thuban/Model/table.py: Make writing records work correctly: (Table.__init__): Keep track of whether the DBF is open for writing (Table.write_record): Open the DBF file for writing when necessary 2002-08-27 Bernhard Herzog * Thuban/Model/table.py (Table.write_record, Table.__init__): Open dbf files only for reading by default. Use a new writable dbf object for writing. 2002-08-26 Bernhard Herzog * Thuban/UI/mainwindow.py: Refactor the context creation: (MainWindow.Context): New method to return a context (MainWindow.invoke_command, MainWindow.update_command_ui): Use the new method * Thuban/UI/tableview.py (TableGrid, LayerTableGrid): Split the layer table specific code from TableGrid into LayerTableGrid (TableFrame, LayerTableFrame): Split the layer table specific code from TableFrame into LayerTableFrame (LayerTableGrid.select_shape): Remove a debug print * Thuban/UI/mainwindow.py (MainWindow.LayerShowTable): Use the LayerTableFrame 2002-08-23 Bernhard Herzog * Thuban/Model/layer.py (Layer.__init__): Make sure we have an absolute filename. 2002-08-22 Bernhard Herzog * Thuban/Model/table.py (Table.write_record): New method to write records. (Table.__init__): Open the DBF file for writing too. * Thuban/UI/controls.py (RecordTable.SetValue): Write the value into the underlying table. * extensions/shapelib/shapefil.h (DBFCommit), extensions/shapelib/dbfopen.c (DBFCommit): New API function to commit any changes made to the DBF file. * Thuban/UI/mainwindow.py (make_check_current_tool) (_tool_command): Put the code that generates the "checked" callback into a separate function so that we can reuse it elsewhere * Thuban/Model/save.py (Saver): New class to handle serializing a session into an XML file. The main reason to introduce a class is that applications built on Thuban can derive from it so that they can save additional information in a session file. (save_session): Delegate almost all the work to the Saver class. Rename the filename argument to file because it may be a file like object now. * Thuban/Model/load.py: Get rid of the Python 1.5.2 compatibility code. Remove the little test code which would be executed when the module is run as a script which didn't work anymore since it can't import the other Thuban modules. (ProcessSession, load_session): Refactor the ProcessSession to have one method for each element start and end tag so that derived classes can easily override the processing of individual tags. Also, always parse with namespaces enabled because applications built on top of Thuban will likely use namespaces if they extend the session file format. 2002-08-21 Bernhard Herzog * setup.py (ThubanInstall.run): Don't repr install_lib_orig because thubaninit_contents will do it for us. 2002-08-16 Jan-Oliver Wagner * Thuban/UI/mainwindow.py: menu item 'show session tree' now disable if tree window already open 2002-08-15 Bernhard Herzog * Thuban/Model/layer.py (Layer.Destroy): Call the unboundd method with self. * Thuban/UI/view.py (MapCanvas.OnLeftUp): Only release the mouse when we have actually captured it. * Thuban/Model/layer.py (Layer.Destroy): New. Explicitly close the shapefile and destroy the table. * Thuban/Model/table.py (Table.Destroy): New. Close the DBF file. 2002-08-14 Bernhard Herzog * Thuban/UI/controls.py (RecordTable.__init__): Remove the unused instance variable columns (RecordTable.GetTypeName): row and col may be negative in some cases. * setup.py (InstallLocal.initialize_options) (InstallLocal.finalize_options, InstallLocal.user_options): New option create-init-file to build a thubaninit.py when running install_local (InstallLocal.run): Create the thubaninit.py module when requested (thubaninit_contents): Split the template into several parts and create a new function thubaninit_contents that creates the contents of a thubaninit module. (ThubanInstall.run): Use the new function to create the thubaninit module. 2002-07-30 Bernhard Herzog * Thuban/UI/application.py (ThubanApplication.OnExit): Do some cleanup. (ThubanApplication.MainLoop): Extend to automatically call OnExit. * Thuban/Model/session.py (Session.Destroy): Don't bypass the direct base class' Destroy method. * Thuban/Model/map.py (Map.ClearLayers): New method to delete all layers. (Map.Destroy): Destroy the label_layer as well and call the inherited Desatroymethod first so that no more messages are issued. (Map.RaiseLayer, Map.LowerLayer): Only issue LAYERS_CHANGED message if the stacking order actually has changed. Add doc-strings. (Map.BoundingBox): Correct the doc-string. (Map.AddLayer, Map.RemoveLayer, Map.Layers, Map.HasLayers) (Map.ProjectedBoundingBox, Map.SetProjection): Add doc-strings. * Thuban/Model/label.py (LabelLayer.ClearLabels): New to delete all labels. 2002-07-29 Bernhard Herzog * Thuban/Model/map.py (Map.subscribe_layer_channels) (Map.unsubscribe_layer_channels): Put the code that (un)subscribes to a layer's channels into separate methods. (Map.RemoveLayer, Map.AddLayer): Call the new methods (Map.Destroy): Unsubscribe from a layer's channels before destroying it. * Thuban/UI/view.py (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. * Examples/simple_extensions/simple_tool.py (simple_tool): Fix a typo 2002-07-24 Bernhard Herzog * Thuban/UI/application.py (ThubanApplication.create_session): Extend the doc string. (ThubanApplication.subscribe_session) (ThubanApplication.unsubscribe_session): New methods to subscribe/unsubscribe to/from session channels. (ThubanApplication.SetSession): Call the new methods here. (ThubanApplication.maps_changed, ThubanApplication.set_map): Renamed set_map to maps_changed. Its now a subscriber for MAPS_CHANGED. * Thuban/UI/view.py (ZoomOutTool.MouseUp): Use the correct x-coordinate in case of simple clicks * Thuban/Model/base.py (Modifiable.changed): Apply the args tuple, don't pass it as a parameter * Thuban/Model/session.py (Session.RemoveMap): New * Thuban/UI/mainwindow.py (MainWindow.__init__): Turn the initial window size into a parameter. 2002-07-23 Bernhard Herzog * Thuban/UI/menu.py (Menu.item_index): Also search for menus not just commands. * Thuban/UI/mainwindow.py (MainWindow.__init__): Change the parameter list a bit to allow setting the window title and the initial message in the status bar. Update the callers. * Thuban/UI/application.py (ThubanApplication.OnInit) (ThubanApplication.CreateMainWindow): Put the mainwindow instantiation into a separate method so that it can be overridden by a subclass. 2002-07-19 Bernhard Herzog * Thuban/Model/session.py: Issue a CHANGED message every time another changed message is issued to make it easier to get notified of changes. (Session): Update the doc string (Session.forward): Issue changed-events as CHANGED as well. (Session.changed): Overwrite the inherited version to issue CHANGED events as well. * Thuban/UI/tree.py: We can now simply subscribe to the session's CHANGED channel to be informed of changes. (SessionTreeCtrl.session_channels): Not needed any longer. (SessionTreeCtrl.unsubscribe_all, SessionTreeCtrl.session_changed): Only have to (un)subscribe CHANGED * Thuban/Model/map.py (Map.TreeInfo): Deal better with empty maps. * Thuban/UI/main.py, Thuban/UI/__init__.py: Move the work-around for the wxPython locale bug to __init__.py so that it's automatically executed by anybody using UI code from Thuban. 2002-07-18 Bernhard Herzog * Thuban/UI/main.py (main): app no longer needs to be global * Thuban/UI/mainwindow.py (MainWindow.__init__): Add application as parameter and store it in an instance variable (MainWindow.invoke_command, MainWindow.update_command_ui) (MainWindow.save_modified_session, MainWindow.NewSession) (MainWindow.OpenSession, MainWindow.SaveSession) (MainWindow.SaveSessionAs, MainWindow.ShowSessionTree): Use self's application object. * Thuban/UI/application.py (ThubanApplication.OnInit): Instantiate the main window with self. * Thuban/UI/context.py: New module with the context class * Thuban/UI/command.py (Command): Update doc string. * Thuban/UI/mainwindow.py (MainWindow.invoke_command, MainWindow.update_command_ui): Pass an instance of the context class to the command's methods (check_current_tool, call_method): Handle the new context implementation * Examples/simple_extensions/simple_tool.py (simple_tool, check_simple_tool): Handle the new context implementation * Examples/simple_extensions/simple_command.py (simple_command): Handle the new context implementation. Update the comments about the context. * Thuban/UI/application.py (ThubanApplication.SetSession): Add doc-string (ThubanApplication.Session): New method to return the session object * Thuban/UI/tree.py (SessionTreeCtrl.update_tree): The interactor's selected_layer may not be a layer of the current session when the tree is updated while a new session is being set. 2002-07-17 Bernhard Herzog * Thuban/UI/tree.py (color_string): Removed. No longer used. (SessionTreeCtrl.update_tree, SessionTreeCtrl.add_items): Split update_tree into update_tree and add_items. The tree now uses a more generic way to display the contents of the tree. (SessionTreeCtrl): Add a doc string explaining the TreeInfo method * Thuban/Model/layer.py (Layer.TreeInfo), Thuban/Model/extension.py (Extension.TreeInfo), Thuban/Model/map.py (Map.TreeInfo), Thuban/Model/session.py (Session.TreeInfo): Add TreeInfo methods to implement the new tree view update scheme 2002-07-16 Bernhard Herzog * Thuban/UI/application.py: Don't use "import from" for the MainWindow. It can't always be resolved. (ThubanApplication.OnInit): change reference to MainWindow accordingly. * Thuban/UI/menu.py (Menu.SetItems): New method to replace a menu completely 2002-07-10 Bernhard Herzog * setup.py (create_init_module): New configurable variable whose default depends on the platform we're running on. (ThubanInstall.initialize_options): Initialize self.create_init_module from the global create_init_module (ThubanInstall.user_options): indictate that the options create-init-module and init-module-dir have arguments. * setup.py: In the setup call change the version number to include cvs. * MANIFEST.in: Add the files in Examples 2002-07-09 Bernhard Herzog * setup.py: In the setup call, use the thuban homepage as the value of the url parameter. * Examples: New subdirectory for examples. * Examples/simple_extensions/simple_tool.xpm, Examples/simple_extensions/simple_tool.py, Examples/simple_extensions/simple_command.py, Examples/simple_extensions/README: Simple examples showing how to add new commands and tools. * setup.cfg (bdist_rpm): Add the default value for prefix and tell bdist_rpm that we also have an install script. (bdist_inno): Add 2002 to the copyright notice. * setup.py: Create a file in python's site-packages directory to make installation of Thuban as a library easier. (ThubanInstall.user_options): Add two new options, create-init-module and init-module-dir (ThubanInstall.expand_with_pure_python_dirs): New method to expand filenames for installation in the default directories. (ThubanInstall.select_scheme, ThubanInstall.convert_paths): Extend the inherited methods to capture some filenames before they're transformed too much by distutils. (ThubanInstall.run): Create the init module if requested. (ThubanInstall.thuban_init_filename): New method to return the full name of the init module. (ThubanInstall.get_outputs): Append the filename of the init module. 2002-07-08 Bernhard Herzog * setup.py (thuban_bdist_rpm): Extend this version of bdist_rpm to handle the prefix properly which means that the default for the installation prefix should be /usr for RPMs and /usr/local when doing a normal source install. (bdist_rpm_install_script): Script to override the default install commands in the specfile generated by the bdist_rpm command. (thuban_bdist_rpm.user_options): Add a prefix option (thuban_bdist_rpm.initialize_options): Init the prefix option. Create the script files for the spec files as empty files here (thuban_bdist_rpm._make_spec_file): Override the inherited method to fill the script files with content. * Thuban/Model/save.py (relative_filename): Wrapper around Thuban.Lib.fileutil.relative_filename that accepts an empty dir argument. save_session now automatically uses this version, solving a problem when saving to a relative filename. * setup.py: In the setup call, make sure that the library directories are under $prefix/lib not directly under $prefix. 2002-06-20 Jan-Oliver Wagner * Thuban/Model/extension.py: new module to handle extension objects. * Thuban/Model/messages.py: new messages for extensions. * Thuban/Model/session.py (Session.Extensions, Session.HasExtensions, Session.AddExtension): new for handling extensions. Also some other minor changes to round up extension handling. * Thuban/UI/tree.py (SessionTreeCrtl:update_tree): Added visualization of Extension titles and title and names of its objects. 2002-05-29 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.bind_command_events): Bind the events for a command. (MainWindow.add_toolbar_command, MainWindow.add_menu_command): Call bind_command_events to bind the events. add_toolbar_command can now bind events too so that it's possible to have commands that are only available through the toolbar. (MainWindow.init_ids): New instance variable events_bound to keep track of for which commands events have been bound. 2002-05-28 Bernhard Herzog * Thuban/UI/menu.py: New module to build and manage menus. * Thuban/UI/mainwindow.py: Remove some unused imports. (MainWindow.__init__, main_menu): move the definition of the main menu from __init__ to the Menu instance main_menu. (MainWindow.build_menu_bar, MainWindow.build_menu): New methods to build the menu bar and sub-menus from a menu description. * Thuban/UI/application.py (ThubanApplication.OnInit): Read the startup file (ThubanApplication.read_startup_files): New method to run ~/.thuban/thubanstart.py * Thuban/UI/mainwindow.py (MainWindow.__init__, main_toolbar): Move the toolbar definition to the Menu instance main_toolbar. (MainWindow.build_toolbar): New method to build the toolbar similar to the build_menu methods 2002-05-23 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.__init__): Fix spelling of layer_outline_color. Fix it in the definition of the command too. * Thuban/UI/command.py (Command): Fix typo in doc string 2002-05-22 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.RunMessageBox): Fix a typo in the docstring 2002-05-15 Bernhard Herzog * Thuban/Model/layer.py (Layer.open_shapefile): Set bbox to None when the shapefile is empty. (Layer.BoundingBox, Layer.LatLongBoundingBox): Both methods may now return None for empty shapefiles. Update doc-strings. * Thuban/Model/map.py (Map.BoundingBox): Add doc-string. Deal with the layer's bbox being None. * Thuban/UI/tree.py (SessionTreeCtrl.update_tree): Deal with the layer's bbox being None. * 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/tableview.py (TableGrid.__init__): Do not call AutoSizeColumns because it will cause a traversal of the entire table which for large .dbf files will take a very long time. 2002-05-14 Bernhard Herzog * Thuban/Model/layer.py (Layer.open_shapefile): Choose a better maximum depth for the tree than shapelib does by default. 2002-05-10 Bernhard Herzog * setup.py (py_modules): The shptree modules doesn't have a wrapper, so don't include it in the py_modules 2002-05-08 Bernhard Herzog * extensions/shapelib/shptree.c (compare_ints): Make arguments const void * as in the qsort prototype (SHPTreeFindLikelyShapes): Remove some unused variables. * 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. * setup.py: Increment the version to 0.1.2 * Thuban/UI/tree.py (SessionTreeCtrl.unsubscribe_all): Remove a debug print and set session to None after unsubscribing 2002-05-07 Bernhard Herzog * Data/iceland_sample.session, Data/iceland_sample.thuban: Rename the file to have a .thuban extension. * Thuban/UI/tree.py (session_channels): New class constant with all the session channels to subscribe to to update the tree (SessionTreeCtrl.session_changed): Remember the session so that we can unsubscribe properly. Use the new class constant to unsubscribe from the old session and subscribe to the new one. (SessionTreeCtrl.unsubscribe_all): New method to unsubscribe all subscriptions of the SessionTreeCtrl. (SessionTreeView.OnClose): Call the tree's unsubscribe_all method. * Thuban/UI/mainwindow.py (MainWindow.__init__): Add the "Show Session Tree" command to the file menu. * Thuban/UI/view.py (MapCanvas.do_redraw): Pass the entire bitmap as update_region to the renderer. * Thuban/UI/renderer.py (ScreenRenderer.layer_ids, ScreenRenderer.draw_shape_layer): The update box is now directly a tuple, not a wxRect anymore. * Thuban/Model/layer.py (Layer.ShapesInRegion): Remove some debug prints. 2002-05-07 Bernhard Herzog * setup.py: Add the shptree extension module. See extensions/pyshapelib/ChangeLog for more details. * extensions/shapelib/shpopen.c, extensions/shapelib/shapefil.h, extensions/shapelib/dbfopen.c: Really update to the versions of shapelib 1.2.9. For some reason it wasn't really done on 2002-04-11. * extensions/shapelib/shptree.c: Modified version of shptree.c of shapelib 1.2.9. The only real difference is the use of qsort instead of a bubble sort implementation * Thuban/Model/layer.py (Layer.__init__): New instance variable shapetree to hold the shapelib quadtree for the shapefile (Layer.open_shapefile): Create the quad tree. (Layer.ShapesInRegion): New method to return the ids of shapes in a given region using the quad tree. * extensions/thuban/wxproj.cpp (project_points): Fix some typos in comment (draw_polygon_shape): Accept both arcs and polygons. (initwxproj): Use the new PYSHAPELIB_IMPORT_API macro to import the api. * 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. Use draw_polygon_shape to draw arc shapes as well. (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/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. 2002-05-03 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.SaveSessionAs, MainWindow.OpenSession): Change the file extension of the session files to .thuban * Thuban/Model/session.py (Session.AddMap, forwarded_channels): Move the map channels to be forwarded by the session into the class constant with forwarded_channels. Also add LAYER_PROJECTION_CHANGED and LAYER_VISIBILITY_CHANGED to forwarded_channels * Thuban/Model/base.py (Modifiable.changed): Fix doc-string (a typo and some rewording). 2002-05-02 Bernhard Herzog * 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. 2002-04-29 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.__init__): Subscribe to the canvas' VIEW_POSITION event (MainWindow.view_position_changed): Handler for VIEW_POSITION. Update the text in the status-bar accordingly. * 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/messages.py (VIEW_POSITION): New message for the position in the statusbar 2002-04-26 Frank Koormann * Thuban/UI/mainwindow.py: AddLayer, Dialog title s/session/data 2002-04-24 Frank Koormann * Resources/Bitmaps/identify.xpm: shadow added * Resources/Bitmaps/fullextent.xpm: new 2002-04-22 Jan-Oliver Wagner * Thuban/UI/tree.py (update_tree): added test for None on map bounding box 2002-04-21 Jan-Oliver Wagner * Thuban/UI/proj4dialog.py (UTMProposeZoneDialog): new * Thuban/UI/tree.py (update_tree): added added map extent * Thuban/UI/mainwindow.py (_method_command): extended by parameter icon; added map_full_extend as tool 2002-04-19 Jan-Oliver Wagner * Thuban/UI/mainwindow.py (SaveSession): launch save as dialog for saving _new_ sessions * Thuban/Model/session.py (create_empty_session): new session don't have a filename (set to None) * Thuban/UI/tree.py (update_tree): added filename and modified flag * Thuban/Model/load.py (ProcessSession): convert projection parameters from unicode to regular string * Data/iceland_sample.session: Added UTM Zone 26 projection. 2002-04-11 Bernhard Herzog * extensions/shapelib/shapefil.h, extensions/shapelib/shpopen.c, extensions/shapelib/dbfopen.c: Update to the versions of shapelib 1.2.9 * setup.py (Lib.wxproj extension): Don't link shpopen.c and put the pyshapelib directoy into the list of include dirs, so that pyshapelib_api.h can be found. * extensions/thuban/wxproj.cpp (pyshapelib_api): New variable that holds the pyshapelib C-API (draw_polygon_shape, point_in_polygon_shape, shape_centroid): Use pyshapelib_api to access the shapelib functions. (initwxproj): Import the c_api from the shapelib module and initialize pyshapelib_api. 2002-04-04 Bernhard Herzog * setup.py (thuban_bdist_rpm.initialize_options): Use initialize_options to create the scripts for the rpm. * extensions/pyprojection/setup.py (PROJ4_PREFIX): Just use / 2002-04-03 Bernhard Herzog * setup.py: Increment version to 0.1.1 * Thuban/UI/mainwindow.py (MainWindow.__init__): Move the "Add Layer" and "Remove Layer" commands from the layer menu to the map menu 2002-02-15 Bernhard Herzog * Thuban/Model/layer.py (Layer.Shape): list append only takes one argument (python <= 1.5.2 erroneously accepted multiuple arguments) 2002-02-04 Bernhard Herzog * Thuban/UI/identifyview.py (IdentifyGridCtrl): New class to use a RecordGrid in the identifyview. (IdentifyView.__init__): Use IdentifyGridCtrl instead of IdentifyListCtrl. The grid allows editing of the values. * Thuban/UI/controls.py (RecordTable, RecordGridCtrl): New classes implementing a grid for a single row of a thuban table. * 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. * Thuban/UI/tableview.py (TableGrid.__init__): Fix typo * Thuban/UI/renderer.py (MapRenderer.draw_shape_layer): Honour the stroke_width attribute * Thuban/Model/save.py (save_session): Write the new stroke_width attribute * Thuban/Model/load.py (ProcessSession.startElement): Read the stroke_width attribute * Thuban/Model/layer.py (Layer.__init__): New parameter and instance variable stroke_width (Layer.SetStrokeWidth): Set the stroke_width. 2002-02-01 Bernhard Herzog * extensions/thuban/wxproj.cpp (project_points): Fix two off-by-one errors in the last loop that joins the various parts together. 2002-01-14 Bernhard Herzog * setup.py (data_dist.make_distribution): Fix some typos 2001-09-18 Bernhard Herzog * README: Slight tweaking in preparation for the 0.1 release * setup.cfg: Add section for sdist to create both tgz and zip archives * setup.py: increase version number to 0.1 (data_dist): New command class for data distribution 2001-09-14 Bernhard Herzog * Thuban/UI/identifyview.py (IdentifyListCtrl.selected_shape): Handle the case of no layer (i.e. layer is None) properly. * Thuban/UI/proj4dialog.py (UTMDialog.__init__, Proj4Dialog.__init__): Set the initial selection of the combo boxes to reflect the projection we're starting with in a way that works on windows, too. * Thuban/Lib/connector.py (Connector.print_connections): Print the puiblisher's ids in hex to make it easier to compare them to the standard repr of python methods * Thuban/Model/map.py (Map.Destroy): Unsubscribe the label_layer messages 2001-09-13 Bernhard Herzog * Thuban/UI/tree.py (SessionTreeCtrl.OnSelChanged): Make sure to deselect the layer if no layer is selected * 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.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/Model/session.py (create_empty_session): Unset the modified bit before returning it * Thuban/UI/mainwindow.py (MainWindow.NewSession): Use create_empty_session session to create the new, empty session. * Thuban/UI/mainwindow.py (MainWindow.__init__): Set the size of the tool bitmaps. (MainWindow.OnClose, MainWindow.save_modified_session): Separate the code that asks whether the session should be saved into the new method save_modified_session. (MainWindow.OpenSession, MainWindow.NewSession): Use the new method to save modified session here too. 2001-09-11 Bernhard Herzog * setup.py (InnoIconItem): fix typo (thuban_bdist_inno.run): (bdist_inno.run): Move the decision not to create symlinks on non-nt platforms to thuban_bdist_inno and do it unconditinally since we never want to create the symlinks here 2001-09-10 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.IdentifyTool): Popup the identify view immediately * Thuban/UI/controls.py: New file with two classes RecordListCtrl and SelectableRecordListCtrl that implement the code shared by the identify view and the label dialog * Thuban/UI/identifyview.py (IdentifyListCtrl): Derive from the new class RecordListCtrl * Thuban/UI/labeldialog.py (LabelDialog.OnOK): Check whether the return value of GetValue is None instead of using it as a boolean directly so that Zero numbers are handled properly. (LabelListCtrl): Derive from the new class SelectableRecordListCtrl * Thuban/UI/proj4dialog.py (Proj4Dialog.__init__): (Proj4Dialog.dialogLayout): Make the window resizable and set the size of the text control explicitly to make the sizers work on both Windows and X. 2001-09-07 Bernhard Herzog * 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 (MapCanvas.FitRectToWindow): If the rect has zero with or zero height do nothing (avoids zero division errors) 2001-09-06 Bernhard Herzog * Thuban/UI/tree.py (SessionTreeCtrl, SessionTreeView.__init__): Correct the spelling of SessionTreeCtrl. dabbrev is too damn convenient :-) (SessionTreeCtrl.__init__, SessionTreeCtrl.update_tree): Introduce a new instvar layer_to_item to map layers to tree items (SessionTreeCtrl.layer_selected): Select the appropriate tree item to match the current selection in the interactor * Thuban/UI/interactor.py (Interactor.SelectedLayer): (Interactor.HasSelectedLayer): New methods to query the current selection * Thuban/UI/mainwindow.py (MainWindow.current_layer): (MainWindow.has_selected_layer): Simply call the appropriate interactor method * Thuban/UI/mainwindow.py (MainWindow.__init__): (MainWindow.LayerShowTable): (MainWindow.identify_view_on_demand): Store the interactor in an instvar and use that reference instead of going through main.app * Thuban/UI/mainwindow.py (MainWindow.ShowSessionTree): * Thuban/UI/application.py (ThubanApplication.OnInit): * Thuban/UI/main.py (main): Create the session tree view in main with the new mainwindow method ShowSessionTree and not directly the application's OnInit method * Thuban/UI/tree.py (myTreeCtrlPanel): (SessioinTreeCtrl): Rename to SessioinTreeCtrl and turn it into a TreeCtrl isntead of a panel. This affects most method since we now refer to self instead of self.tree (SessionTreeView): New class implementing a non-modal dialog showing the session tree. * Thuban/UI/mainwindow.py (MainWindow.LayerShowTable): Pass the layer to the tableview dialog. * Thuban/UI/tableview.py: Add some doc-strings (TableGrid): (TableGrid.OnRangeSelect): (TableGrid.OnSelectCell): (TableFrame.__init__): (TableFrame.row_selected): Selecting rows in the grid view now updates the selected shapes through the TableFrame. To achieve this we derive TableGrid from Publisher and introduce the message type ROW_SELECTED which the TableFrame subscribes to and which is issued by OnRangeSelect and OnSelectCell (DataTable.SelectRow): Removed because it's no longer needed in the row/shape selection scheme * Thuban/UI/dialogs.py: New file implementing common classes for dialogs * Thuban/UI/tableview.py (TableGrid.__init__): Don't subscribe to the SELECTED_SHAPE message anymore. This is now handled by the parent. (TableGrid.select_shape): Only update the selection if the shape is not None. (TableFrame): Inherit from the new NonModalDialog class. (TableFrame.__init__, TableFrame.select_shape): Handle the SELECT_SHAPE message. (TableFrame.OnClose): Extend the inherited method to unsubscribe SELECT_SHAPE * Thuban/UI/mainwindow.py (MainWindow.init_dialogs): (MainWindow.add_dialog): (MainWindow.dialog_open): (MainWindow.remove_dialog): (MainWindow.get_open_dialog): New methods to maintain a dictionary of opened non-modal dialogs. (MainWindow.__init__): Initialize the new non-modal dictionary management code (MainWindow.LayerShowTable): maintain separate dialogs for each table using the non-modal dialog management code to only open a view once for each table. (MainWindow.IdentifyTool): (MainWindow.__init__): (MainWindow.identify_view_on_demand): Don't open the identify view in IdentifyTool anymore. This will be done automatically by the new method identify_view_on_demand which handles the SELECTED_SHAPE message so that the identify view will be opened on demand * Thuban/UI/identifyview.py (IdentifyListCtrl.__init__): Remove the interactor argument. The SELECTED_SHAPE message is now handled by the parent. (IdentifyView.__init__): Add the interactor argument so that we can handle the SELECTED_SHAPE message here (IdentifyView.selected_shape): New method to handle the SELECTED_SHAPE messages * Thuban/UI/identifyview.py (IdentifyView): Derive from the new NonModalDialog class (IdentifyView.OnClose): Extend the inherited version to unsubscribe SELECT_SHAPE * Thuban/Model/session.py (Session.UnsetModified): Remove debug prints 2001-09-05 Bernhard Herzog * Thuban/UI/view.py (MapCanvas.__init__): New argument, interactor. * Thuban/UI/mainwindow.py (MainWindow.__init__): New argument interactor to pass through to the MapCanvas * Thuban/UI/application.py (ThubanApplication.OnInit): Use the new argument to the MainWindow constructor to get rid of the ugly hack that made main.app available early just so that the mapcanvas could access the interactor object. 2001-09-04 Bernhard Herzog * Thuban/UI/mainwindow.py (MainWindow.RunMessageBox): New method that runs a modal message box (MainWindow.OnClose): Use the new method (MainWindow.RemoveLayer): Just do nothing in case no layer is selected. The command should be grayed out anyway, so there's no need to pop up a message box. (MainWindow.AddLayer): Pop up a message box with an error message if the shape file can't be opened * Thuban/Model/layer.py (Layer.__init__): Open the shapefile immediately. This will cause an exception in case the file can't be opened and we can display an appropriate message. * MANIFEST.in: Add extensions/pyprojection/LICENSE * setup.py (thuban_bdist_rpm): New class implementing a Thuban specific bdist_rpm command. * Thuban/UI/main.py: Catch ImportError exceptions when importing the locale module because it may not be available on some installations. * extensions/pyprojection/LICENSE: Copy of the license text in Projection.i. Having it in a separate file makes it easier to refer to license text in e.g. RPMs 2001-09-03 Bernhard Herzog * setup.py: use wx-config instead of wxgtk-config because it's more generic * setup.py (ThubanInstall.get_outputs): Add the symlink in /bin to the outputs (ThubanInstall.link_file): New method to link files. We need this because the standard copy_files refuses to link non-existing files. (ThubanInstall.run): Remove the leading install root from the script filename if an install root was specified and use the new link_file method * Thuban/UI/mainwindow.py (MainWindow.AddLayer): Fit the map to the window when the first layer is added to the map. * setup.py (ThubanInstall.run): Honor the build root (self.root) when linking thuban.py to /bin 2001-08-31 Bernhard Herzog * setup.py: In the setup call, the install parameters shouldn't have trailing slashes because distutils on non-posix platforms doesn't like that. The same applies to other directories like "Resources/Bitmaps" In the configuration section for nt, move the wxWindows directory optins into the part clearly marked as editable. (InstallLocal.initialize_options): (InstallLocal.user_options): remove the currently unused debug flag (thuban_build_py.find_all_modules): Add this method so that it works for our case of having packages and modules in one distribution as well. (ThubanInstall.initialize_options): (ThubanInstall.finalize_options): (ThubanInstall.user_options): (ThubanInstall.boolean_options): Add new options, do-symlink and extra files. Since these are the first ThubanInstall specific options, override user_options and boolean_options (ThubanInstall.run): Honor the new do-symlink and extra-files options. (ThubanInstall.get_outputs): Add to override the base-class's version and add the extra-files to the outputs (bdist_inno): New class for windows distributions with Inno Setup (InnoIconItem): Helper class for bdist_inno (thuban_bdist_inno): Thuban specific version of bdist_inno. Added this together with the appropriate parameters, to the setup call. * setup.cfg (bdist_inno): added new section for the inno setup installer * Thuban/UI/tree.py (myTreeCtrlPanel.__init__): New inst var changing_selection to avoid recursive selection events when modifying the selection in response to a selection event. (myTreeCtrlPanel.normalize_selection): Set the new inst var when changing the tree's selection. (myTreeCtrlPanel.OnSelChanged): Only normalize the selection when we're not being called indirectly from normalize_selection. * Thuban/UI/mainwindow.py (MainWindow.update_command_ui): Call event.Check only if the command is actuall checkable. (MainWindow.__init__): Call the toolbar's Realize method to make sure that the items are actually shown 2001-08-28 Bernhard Herzog * setup.py: Fix some doc strings * ChangeLog: started