35 |
import view |
import view |
36 |
import tree |
import tree |
37 |
import tableview, identifyview |
import tableview, identifyview |
|
from Thuban.UI.classifier import Classifier |
|
38 |
import legend |
import legend |
39 |
from menu import Menu |
from menu import Menu |
40 |
|
|
52 |
|
|
53 |
import projdialog |
import projdialog |
54 |
|
|
55 |
|
from Thuban.Lib.classmapper import ClassMapper |
56 |
|
|
57 |
|
layer_properties_dialogs = ClassMapper() |
58 |
|
|
59 |
class MainWindow(DockFrame): |
class MainWindow(DockFrame): |
60 |
|
|
340 |
text = "(%10.10g, %10.10g)" % pos |
text = "(%10.10g, %10.10g)" % pos |
341 |
else: |
else: |
342 |
text = "" |
text = "" |
343 |
|
map = self.canvas.Map() |
344 |
|
for layer in map.layers: |
345 |
|
bbox = layer.LatLongBoundingBox() |
346 |
|
if bbox: |
347 |
|
left, bottom, right, top = bbox |
348 |
|
if not (-180 <= left <= 180 and |
349 |
|
-180 <= right <= 180 and |
350 |
|
-90 <= top <= 90 and |
351 |
|
-90 <= bottom <= 90): |
352 |
|
text = ("Select '"+layer.title+"' and pick a " + |
353 |
|
"projection using Layer/Projection...") |
354 |
|
break |
355 |
|
|
356 |
self.set_position_text(text) |
self.set_position_text(text) |
357 |
|
|
358 |
def set_position_text(self, text): |
def set_position_text(self, text): |
666 |
layer.ShapeStore(), |
layer.ShapeStore(), |
667 |
projection = layer.GetProjection()) |
projection = layer.GetProjection()) |
668 |
new_classification = copy.deepcopy(layer.GetClassification()) |
new_classification = copy.deepcopy(layer.GetClassification()) |
669 |
|
new_layer.SetClassificationColumn( |
670 |
|
layer.GetClassificationColumn()) |
671 |
new_layer.SetClassification(new_classification) |
new_layer.SetClassification(new_classification) |
672 |
self.Map().AddLayer(new_layer) |
self.Map().AddLayer(new_layer) |
673 |
|
|
746 |
currently selected layer if one is defined for this layer |
currently selected layer if one is defined for this layer |
747 |
type. |
type. |
748 |
""" |
""" |
749 |
name = "layer_properties" + str(id(layer)) |
dialog_class = layer_properties_dialogs.get(layer) |
750 |
self.OpenOrRaiseDialog(name, Classifier, layer, group = group) |
|
751 |
|
if dialog_class is not None: |
752 |
|
name = "layer_properties" + str(id(layer)) |
753 |
|
self.OpenOrRaiseDialog(name, dialog_class, layer, group = group) |
754 |
|
|
755 |
def LayerJoinTable(self): |
def LayerJoinTable(self): |
756 |
layer = self.canvas.SelectedLayer() |
layer = self.canvas.SelectedLayer() |
757 |
if layer is not None: |
if layer is not None: |