/[thuban]/trunk/thuban/Thuban/Model/layer.py
ViewVC logotype

Log of /trunk/thuban/Thuban/Model/layer.py

Parent Directory Parent Directory | Revision Log Revision Log


Links to HEAD: (view) (annotate)
Sticky Revision:

Revision 1142 - (view) (annotate) - [select for diffs]
Modified Tue Jun 10 09:41:57 2003 UTC (21 years, 9 months ago) by bh
File length: 15199 byte(s)
Diff to previous 1117 , to selected 558
* 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


Revision 1117 - (view) (annotate) - [select for diffs]
Modified Fri May 30 18:31:19 2003 UTC (21 years, 9 months ago) by bh
File length: 15160 byte(s)
Diff to previous 1088 , to selected 558
(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.


Revision 1088 - (view) (annotate) - [select for diffs]
Modified Wed May 28 12:42:23 2003 UTC (21 years, 9 months ago) by bh
File length: 15056 byte(s)
Diff to previous 1086 , to selected 558
* 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


Revision 1086 - (view) (annotate) - [select for diffs]
Modified Wed May 28 11:36:05 2003 UTC (21 years, 9 months ago) by jan
File length: 14560 byte(s)
Diff to previous 1012 , to selected 558
(Layer.TreeInfo): Fixed a bug (a layer does not necessarily have a filename).


Revision 1012 - (view) (annotate) - [select for diffs]
Modified Fri May 23 09:13:58 2003 UTC (21 years, 9 months ago) by jan
File length: 14518 byte(s)
Diff to previous 996 , to selected 558
(Layer.TreeInfo): Added filename.


Revision 996 - (view) (annotate) - [select for diffs]
Modified Thu May 22 18:21:10 2003 UTC (21 years, 9 months ago) by bh
File length: 14461 byte(s)
Diff to previous 961 , to selected 558
* 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.


Revision 961 - (view) (annotate) - [select for diffs]
Modified Wed May 21 17:23:25 2003 UTC (21 years, 9 months ago) by jonathan
File length: 14411 byte(s)
Diff to previous 929 , to selected 558
(RasterLayer.__init__): Test if the filename is a valid image file.
        Throw IOError otherwise.


Revision 929 - (view) (annotate) - [select for diffs]
Modified Tue May 20 15:22:42 2003 UTC (21 years, 9 months ago) by jonathan
File length: 13801 byte(s)
Diff to previous 839 , to selected 558
(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.


Revision 839 - (view) (annotate) - [select for diffs]
Modified Tue May 6 15:54:18 2003 UTC (21 years, 10 months ago) by bh
File length: 10770 byte(s)
Diff to previous 828 , to selected 558
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/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


Revision 828 - (view) (annotate) - [select for diffs]
Modified Tue May 6 12:06:12 2003 UTC (21 years, 10 months ago) by jonathan
File length: 10812 byte(s)
Diff to previous 794 , to selected 558
(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.


Revision 794 - (view) (annotate) - [select for diffs]
Modified Wed Apr 30 17:00:52 2003 UTC (21 years, 10 months ago) by jonathan
File length: 9773 byte(s)
Diff to previous 791 , to selected 558
(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.


Revision 791 - (view) (annotate) - [select for diffs]
Modified Wed Apr 30 12:26:33 2003 UTC (21 years, 10 months ago) by jan
File length: 9637 byte(s)
Diff to previous 771 , to selected 558
(Layer.SetShapeStore): Fixed a bug: don't set the Classification to
None if the classfication field is None (ie only a DEFAULT).


Revision 771 - (view) (annotate) - [select for diffs]
Modified Tue Apr 29 14:34:02 2003 UTC (21 years, 10 months ago) by jonathan
File length: 9594 byte(s)
Diff to previous 736 , to selected 558
(BaseLayer.__init__): Change default value of visible from 1 to True.
(Layer.__init__): Change default value of visible from 1 to True.


Revision 736 - (view) (annotate) - [select for diffs]
Modified Fri Apr 25 09:11:57 2003 UTC (21 years, 10 months ago) by jonathan
File length: 9588 byte(s)
Diff to previous 725 , to selected 558
(Layer.TreeInfo): Add an item to the tree for projection information.


Revision 725 - (view) (annotate) - [select for diffs]
Modified Thu Apr 24 16:05:36 2003 UTC (21 years, 10 months ago) by jonathan
File length: 9404 byte(s)
Diff to previous 723 , to selected 558
(Layer.GetProjection): New. Needed to implement the interface that the
        ProjFrame dialog expects.


Revision 723 - (view) (annotate) - [select for diffs]
Modified Thu Apr 24 15:31:53 2003 UTC (21 years, 10 months ago) by bh
File length: 9343 byte(s)
Diff to previous 701 , to selected 558
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


Revision 701 - (view) (annotate) - [select for diffs]
Modified Thu Apr 17 16:18:48 2003 UTC (21 years, 10 months ago) by bh
File length: 9769 byte(s)
Diff to previous 610 , to selected 558
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__


Revision 610 - (view) (annotate) - [select for diffs]
Modified Fri Apr 4 13:56:59 2003 UTC (21 years, 11 months ago) by jonathan
File length: 10095 byte(s)
Diff to previous 558
Rename Color.None to Color.Transparent.


Revision 558 - (view) (annotate) - [selected]
Modified Wed Mar 26 11:05:20 2003 UTC (21 years, 11 months ago) by jonathan
File length: 10040 byte(s)
Diff to previous 545
(Layer.ClassChanged): Send a LAYER_CHANGED message, not a
LAYER_LEGEND_CHANGED message.


Revision 545 - (view) (annotate) - [select for diffs]
Modified Thu Mar 20 09:44:04 2003 UTC (21 years, 11 months ago) by jonathan
File length: 10047 byte(s)
Diff to previous 529 , to selected 558
(Layer.SetClassification): Generate a LAYER_CHANGED event instead of a
LAYER_LEGEND_CHANGED event.


Revision 529 - (view) (annotate) - [select for diffs]
Modified Wed Mar 12 19:55:24 2003 UTC (21 years, 11 months ago) by jonathan
File length: 10039 byte(s)
Diff to previous 492 , to selected 558
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.


Revision 492 - (view) (annotate) - [select for diffs]
Modified Mon Mar 10 10:44:57 2003 UTC (22 years ago) by jonathan
File length: 9698 byte(s)
Diff to previous 481 , to selected 558
 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.


Revision 481 - (view) (annotate) - [select for diffs]
Modified Thu Mar 6 16:46:36 2003 UTC (22 years ago) by jonathan
File length: 9278 byte(s)
Diff to previous 464 , to selected 558
(SetClassification): prevent recursion between this method and
Classification.SetLayer().


Revision 464 - (view) (annotate) - [select for diffs]
Modified Wed Mar 5 18:17:47 2003 UTC (22 years ago) by jonathan
File length: 8912 byte(s)
Diff to previous 437 , to selected 558
(Layer): Add GetFieldType to retreive the kind of data represented by a field.


Revision 437 - (view) (annotate) - [select for diffs]
Modified Thu Feb 27 15:53:21 2003 UTC (22 years ago) by jonathan
File length: 8685 byte(s)
Diff to previous 412 , to selected 558
Fixed name resolution problem.


Revision 412 - (view) (annotate) - [select for diffs]
Modified Wed Feb 19 16:51:50 2003 UTC (22 years ago) by jonathan
File length: 8690 byte(s)
Diff to previous 389 , to selected 558
(Layer): Removed references to fill, stroke,
        stroke_width attributes. Made the 'classification' attribute private.
        New methods for setting/getting the classification.


Revision 389 - (view) (annotate) - [select for diffs]
Modified Mon Feb 10 15:25:30 2003 UTC (22 years ago) by jonathan
File length: 8950 byte(s)
Diff to previous 386 , to selected 558
* 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.


Revision 386 - (view) (annotate) - [select for diffs]
Modified Mon Feb 3 11:44:27 2003 UTC (22 years, 1 month ago) by jonathan
File length: 9681 byte(s)
Diff to previous 382 , to selected 558
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.


Revision 382 - (view) (annotate) - [select for diffs]
Modified Tue Jan 28 18:37:35 2003 UTC (22 years, 1 month ago) by jonathan
File length: 9411 byte(s)
Diff to previous 374 , to selected 558
Added a call to build the tree info for classifications. Commented out
unnecessary lines.


Revision 374 - (view) (annotate) - [select for diffs]
Modified Mon Jan 27 14:20:02 2003 UTC (22 years, 1 month ago) by jan
File length: 9250 byte(s)
Diff to previous 364 , to selected 558
Replace user string by _() for i18n.


Revision 364 - (view) (annotate) - [select for diffs]
Modified Mon Jan 27 11:47:12 2003 UTC (22 years, 1 month ago) by jonathan
File length: 9201 byte(s)
Diff to previous 276 , to selected 558
added classification initializations


Revision 276 - (view) (annotate) - [select for diffs]
Modified Fri Aug 23 15:25:07 2002 UTC (22 years, 6 months ago) by bh
File length: 8999 byte(s)
Diff to previous 260 , to selected 558
(Layer.__init__): Make sure we have an
absolute filename.


Revision 260 - (view) (annotate) - [select for diffs]
Modified Thu Aug 15 17:43:59 2002 UTC (22 years, 6 months ago) by bh
File length: 8741 byte(s)
Diff to previous 258 , to selected 558
* Thuban/Model/layer.py (Layer.Destroy): Call the unboundd method
with self.


Revision 258 - (view) (annotate) - [select for diffs]
Modified Thu Aug 15 12:48:03 2002 UTC (22 years, 6 months ago) by bh
File length: 8737 byte(s)
Diff to previous 217 , to selected 558
(Layer.Destroy): New. Explicitly close the
shapefile and destroy the table.


Revision 217 - (view) (annotate) - [select for diffs]
Modified Wed Jul 17 10:50:40 2002 UTC (22 years, 7 months ago) by bh
File length: 8514 byte(s)
Diff to previous 179 , to selected 558
* 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


Revision 179 - (view) (annotate) - [select for diffs]
Modified Wed May 15 14:02:49 2002 UTC (22 years, 9 months ago) by bh
File length: 7685 byte(s)
Diff to previous 171 , to selected 558
	* 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.


Revision 171 - (view) (annotate) - [select for diffs]
Modified Tue May 14 14:16:24 2002 UTC (22 years, 9 months ago) by bh
File length: 7196 byte(s)
Diff to previous 147 , to selected 558
	* Thuban/Model/layer.py (Layer.open_shapefile): Choose a better
	maximum depth for the tree than shapelib does by default.


Revision 147 - (view) (annotate) - [select for diffs]
Modified Tue May 7 16:39:52 2002 UTC (22 years, 10 months ago) by bh
File length: 6824 byte(s)
Diff to previous 143 , to selected 558
	* Thuban/Model/layer.py (Layer.ShapesInRegion): Remove some debug
	prints.


Revision 143 - (view) (annotate) - [select for diffs]
Modified Tue May 7 14:17:20 2002 UTC (22 years, 10 months ago) by bh
File length: 6942 byte(s)
Diff to previous 82 , to selected 558
	* 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.


Revision 82 - (view) (annotate) - [select for diffs]
Modified Fri Feb 15 17:11:04 2002 UTC (23 years ago) by bh
File length: 6285 byte(s)
Diff to previous 73 , to selected 558
	* Thuban/Model/layer.py (Layer.Shape): list append only takes one
	argument (python <= 1.5.2 erroneously accepted multiuple
	arguments)


Revision 73 - (view) (annotate) - [select for diffs]
Modified Mon Feb 4 19:19:25 2002 UTC (23 years, 1 month ago) by bh
File length: 6283 byte(s)
Diff to previous 21 , to selected 558
	* Thuban/Model/layer.py (Layer.__init__): New parameter and
	instance variable stroke_width
	(Layer.SetStrokeWidth): Set the stroke_width.


Revision 21 - (view) (annotate) - [select for diffs]
Modified Tue Sep 4 16:45:28 2001 UTC (23 years, 6 months ago) by bh
File length: 6053 byte(s)
Diff to previous 6 , to selected 558
Open the shapefile immediately. This will cause an exception in case the
file can't be opened and we can display an appropriate message.


Revision 6 - (view) (annotate) - [select for diffs]
Added Tue Aug 28 15:41:52 2001 UTC (23 years, 6 months ago) by bh
File length: 6023 byte(s)
Diff to selected 558
import all the source files


This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26