Skip to content

Commit

Permalink
layer properties are now copied to rotated layer
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias47n9e committed May 2, 2015
1 parent 0446a02 commit b8211bf
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 34 deletions.
1 change: 1 addition & 0 deletions innstereo/gui_layout.glade
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ equatorial aspect</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment_rotation_angle">
<property name="lower">-360.02999999932945</property>
<property name="upper">360</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
Expand Down
8 changes: 8 additions & 0 deletions innstereo/layer_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,14 @@ def get_pole_alpha(self):
"""
return self.pole_alpha

def set_pole_alpha(self, new_alpha):
"""
Sets a new transparency for the pole markers.
Expects a float value between 0 and 1.
"""
self.pole_alpha = new_alpha

def get_marker_style(self):
"""
Returns the marker style set for this layer.
Expand Down
38 changes: 17 additions & 21 deletions innstereo/main_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def evaluate_lines():
#Normalize to 1
values = values/np.sum(values)

store = self.add_layer_dataset("eigenvector")
store, new_lyr_obj = self.add_layer_dataset("eigenvector")
self.add_eigenvector_feature(store, dipdir[0], dip[0], values[0])
self.add_eigenvector_feature(store, dipdir[1], dip[1], values[1])
self.add_eigenvector_feature(store, dipdir[2], dip[2], values[2])
Expand Down Expand Up @@ -322,7 +322,7 @@ def iterate_over_data(model, path, itr, n):
return

#n = new datastore
n = self.add_layer_dataset("line")
n, new_lyr_obj = self.add_layer_dataset("line")

for row in row_list:
layer_obj = model[row][3]
Expand Down Expand Up @@ -464,7 +464,7 @@ def on_toolbutton_best_plane_clicked(self, widget):
fit_strike, fit_dip = mplstereonet.fit_girdle(total_dip, total_dipdir,
measurement="lines")

store = self.add_layer_dataset("plane")
store, new_lyr_obj = self.add_layer_dataset("plane")
self.add_planar_feature(store, fit_strike + 90, fit_dip)
self.redraw_plot()

Expand Down Expand Up @@ -510,7 +510,7 @@ def on_toolbutton_plane_intersect_clicked(self, widget):
fit_strike, fit_dip = mplstereonet.fit_girdle(total_dip, total_dipdir,
measurement="lines")

store = self.add_layer_dataset("line")
store, new_lyr_obj = self.add_layer_dataset("line")
self.add_linear_feature(store, fit_strike + 270, 90 - fit_dip)
self.redraw_plot()

Expand Down Expand Up @@ -541,7 +541,7 @@ def on_toolbutton_linears_to_planes_clicked(self, toolbutton):
if only_lines is False:
return

store = self.add_layer_dataset("plane")
store, new_lyr_obj = self.add_layer_dataset("plane")

for row in row_list:
layer_obj = model[row][3]
Expand Down Expand Up @@ -640,33 +640,34 @@ def add_layer_dataset(self, layer_type):
same level as the selection.
"""
store = None
layer_obj_new = None

def add_layer(itr):
if layer_type == "plane":
store = Gtk.ListStore(float, float, str)
view = PlaneDataView(store, self.redraw_plot)
layer_obj = PlaneLayer(store, view)
layer_obj_new = PlaneLayer(store, view)
elif layer_type == "faultplane":
store = Gtk.ListStore(float, float, float, float, str)
view = FaultPlaneDataView(store, self.redraw_plot)
layer_obj = FaultPlaneLayer(store, view)
layer_obj_new = FaultPlaneLayer(store, view)
elif layer_type == "line":
store = Gtk.ListStore(float, float, str)
view = LineDataView(store, self.redraw_plot)
layer_obj = LineLayer(store, view)
layer_obj_new = LineLayer(store, view)
elif layer_type == "smallcircle":
store = Gtk.ListStore(float, float, float)
view = SmallCircleDataView(store, self.redraw_plot)
layer_obj = SmallCircleLayer(store, view)
layer_obj_new = SmallCircleLayer(store, view)
elif layer_type == "eigenvector":
store = Gtk.ListStore(float, float, float)
view = EigenVectorView(store, self.redraw_plot)
layer_obj = EigenVectorLayer(store, view)
layer_obj_new = EigenVectorLayer(store, view)

pixbuf = layer_obj.get_pixbuf()
pixbuf = layer_obj_new.get_pixbuf()
self.layer_store.append(itr,
[True, pixbuf, layer_obj.get_label(), layer_obj])
return store
[True, pixbuf, layer_obj_new.get_label(), layer_obj_new])
return store, layer_obj_new

selection = self.layer_view.get_selection()
model, row_list = selection.get_selected_rows()
Expand All @@ -680,13 +681,13 @@ def add_layer(itr):
layer_obj = model[row][3]
selection_itr = model.get_iter(row_list[0])
if layer_obj is None:
store = add_layer(selection_itr)
store, layer_obj_new = add_layer(selection_itr)
self.layer_view.expand_row(row, True)
else:
parent_itr = model.iter_parent(selection_itr)
store = add_layer(parent_itr)
store, layer_obj_new = add_layer(parent_itr)

return store
return store, layer_obj_new

def on_toolbutton_create_plane_dataset_clicked(self, widget):
# pylint: disable=unused-argument
Expand Down Expand Up @@ -1215,11 +1216,6 @@ def iterate_over_rows(model, path, itr):
line_dir, line_dip, lp_plane_dir,
lp_plane_dip, sense)

if layer_obj.get_render_pole_contours() == True:
self.draw_contours(layer_obj, strike, plane_dip, "poles")
else:
self.draw_contours(layer_obj, line_dip, line_dir, "lines")

if layer_type == "line":
dipdir, dip, sense = self.parse_lines(
layer_obj.get_data_treestore())
Expand Down
149 changes: 136 additions & 13 deletions innstereo/rotation_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ def on_button_apply_rotate_clicked(self, button):
raxis_angle = self.spinbutton_rotation_angle.get_value()

for lyr_obj in self.data:
key = 0
dipdir_lst = []
dips_lst = []
sense = []
third = []
fourth = []
fifth = []
layer_type = lyr_obj.get_layer_type()
layer_data = lyr_obj.get_data_treestore()
for row in layer_data:
Expand All @@ -132,19 +133,78 @@ def on_button_apply_rotate_clicked(self, button):
else:
dipdir_lst.append(dipdir)
dips_lst.append(dip)
sense.append(row[2])
third.append(row[2])
if layer_type == "faultplane":
fourth.append(row[3])
fifth.append(row[4])

if layer_type == "line":
store = self.add_layer_dataset("line")
for dipdir, dip in zip(dipdir_lst, dips_lst):
self.add_feature("line", store, dipdir, dip, sense[key])
key += 1
store, new_lyr_obj = self.add_layer_dataset("line")
for dipdir, dip, sense in zip(dipdir_lst, dips_lst, third):
self.add_feature("line", store, dipdir, dip, sense)

if layer_type == "plane":
store = self.add_layer_dataset("plane")
for dipdir, dip in zip(dipdir_lst, dips_lst):
self.add_feature("plane", store, dipdir, dip, sense[key])
key += 1
store, new_lyr_obj = self.add_layer_dataset("plane")
for dipdir, dip, strat in zip(dipdir_lst, dips_lst, third):
self.add_feature("plane", store, dipdir, dip, strat)

if layer_type == "smallcircle":
store, new_lyr_obj = self.add_layer_dataset("smallcircle")
for dipdir, dip, angle in zip(dipdir_lst, dips_lst, third):
self.add_feature("smallcircle", store, dipdir, dip, angle)

if layer_type == "faultplane":
store, new_lyr_obj = self.add_layer_dataset("faultplane")
for dipdir, dip, ldipdir, ldip, sense in zip(dipdir_lst, dips_lst,
third, fourth, fifth):
self.add_feature("faultplane", store, dipdir, dip, ldipdir, ldip, sense)

new_lyr_obj.set_render_gcircles(lyr_obj.get_render_gcircles())
new_lyr_obj.set_line_color(lyr_obj.get_line_color())
new_lyr_obj.set_line_width(lyr_obj.get_line_width())
new_lyr_obj.set_line_style(lyr_obj.get_line_style())
new_lyr_obj.set_line_alpha(lyr_obj.get_line_alpha())
new_lyr_obj.set_capstyle(lyr_obj.get_capstyle())

new_lyr_obj.set_render_poles(lyr_obj.get_render_poles())
new_lyr_obj.set_pole_style(lyr_obj.get_pole_style())
new_lyr_obj.set_pole_size(lyr_obj.get_pole_size())
new_lyr_obj.set_pole_fill(lyr_obj.get_pole_fill())
new_lyr_obj.set_pole_edge_color(lyr_obj.get_pole_edge_color())
new_lyr_obj.set_pole_edge_width(lyr_obj.get_pole_edge_width())
new_lyr_obj.set_pole_alpha(lyr_obj.get_pole_alpha())

new_lyr_obj.set_render_linears(lyr_obj.get_render_linears())
new_lyr_obj.set_marker_style(lyr_obj.get_marker_style())
new_lyr_obj.set_marker_size(lyr_obj.get_marker_size())
new_lyr_obj.set_marker_fill(lyr_obj.get_marker_fill())
new_lyr_obj.set_marker_edge_color(lyr_obj.get_marker_edge_color())
new_lyr_obj.set_marker_edge_width(lyr_obj.get_marker_edge_width())
new_lyr_obj.set_marker_alpha(lyr_obj.get_marker_alpha())

new_lyr_obj.set_rose_spacing(lyr_obj.get_rose_spacing())
new_lyr_obj.set_rose_bottom(lyr_obj.get_rose_bottom())

new_lyr_obj.set_draw_hoeppener(lyr_obj.get_draw_hoeppener())
new_lyr_obj.set_draw_lp_plane(lyr_obj.get_draw_lp_plane())

#Contours
new_lyr_obj.set_draw_contour_fills(lyr_obj.get_draw_contour_fills())
new_lyr_obj.set_draw_contour_lines(lyr_obj.get_draw_contour_lines())
new_lyr_obj.set_draw_contour_labels(lyr_obj.get_draw_contour_labels())
new_lyr_obj.set_colormap(lyr_obj.get_colormap())
new_lyr_obj.set_contour_resolution(lyr_obj.get_contour_resolution())
new_lyr_obj.set_contour_method(lyr_obj.get_contour_method())
new_lyr_obj.set_contour_sigma(lyr_obj.get_contour_sigma())
new_lyr_obj.set_contour_line_color(lyr_obj.get_contour_line_color())
new_lyr_obj.set_use_line_color(lyr_obj.get_use_line_color())
new_lyr_obj.set_contour_line_width(lyr_obj.get_contour_line_width())
new_lyr_obj.set_contour_line_style(lyr_obj.get_contour_line_style())
new_lyr_obj.set_contour_label_size(lyr_obj.get_contour_label_size())
new_lyr_obj.set_manual_range(lyr_obj.get_manual_range())
new_lyr_obj.set_lower_limit(lyr_obj.get_lower_limit())
new_lyr_obj.set_upper_limit(lyr_obj.get_upper_limit())
new_lyr_obj.set_steps(lyr_obj.get_steps())

self.dialog.hide()
self.redraw_main()
Expand Down Expand Up @@ -300,20 +360,44 @@ def redraw_plot(self):
dips_org = []
dipdir_lst = []
dips_lst = []
ldipdir_org = []
ldips_org = []
ldipdir_lst = []
ldips_lst = []

layer_type = lyr_obj.get_layer_type()
layer_data = lyr_obj.get_data_treestore()
third = []
fourth = []
for row in layer_data:
if layer_type == "plane":
#List of original data
if layer_type == "plane" or layer_type == "faultplane":
dipdir_org.append(row[0] - 90)
else:
dipdir_org.append(row[0])

dips_org.append(row[1])

if layer_type == "faultplane":
ldipdir_org.append(row[2])
ldips_org.append(row[3])

#Rotate data
dipdir, dip = self.rotate_data(raxis, raxis_angle, row[0], row[1])
if layer_type == "plane":
if layer_type == "faultplane":
ldipdir, ldip = self.rotate_data(raxis, raxis_angle, row[2], row[3])

#Add rotated data
if layer_type == "plane" or layer_type == "faultplane":
dipdir_lst.append(dipdir - 90)
else:
dipdir_lst.append(dipdir)
dips_lst.append(dip)
if layer_type == "smallcircle":
third.append(row[2])
if layer_type == "faultplane":
ldipdir_lst.append(ldipdir)
ldips_lst.append(ldip)

if layer_type == "line":
self.original_ax.line(dips_org, dipdir_org,
Expand Down Expand Up @@ -343,6 +427,45 @@ def redraw_plot(self):
dash_capstyle=lyr_obj.get_capstyle(),
alpha=lyr_obj.get_line_alpha(), clip_on=False)

if layer_type == "smallcircle":
self.original_ax.cone(dips_org, dipdir_org, third, facecolor="None",
color=lyr_obj.get_line_color(),
linewidth=lyr_obj.get_line_width(),
label=lyr_obj.get_label(),
linestyle=lyr_obj.get_line_style())
self.rotated_ax.cone(dips_lst, dipdir_lst, third, facecolor="None",
color=lyr_obj.get_line_color(),
linewidth=lyr_obj.get_line_width(),
label=lyr_obj.get_label(),
linestyle=lyr_obj.get_line_style())

if layer_type == "faultplane":
self.original_ax.plane(dipdir_org, dips_org, color=lyr_obj.get_line_color(),
linewidth=lyr_obj.get_line_width(),
linestyle=lyr_obj.get_line_style(),
dash_capstyle=lyr_obj.get_capstyle(),
alpha=lyr_obj.get_line_alpha(), clip_on=False)
self.rotated_ax.plane(dipdir_lst, dips_lst, color=lyr_obj.get_line_color(),
linewidth=lyr_obj.get_line_width(),
linestyle=lyr_obj.get_line_style(),
dash_capstyle=lyr_obj.get_capstyle(),
alpha=lyr_obj.get_line_alpha(), clip_on=False)

self.original_ax.line(ldips_org, ldipdir_org,
marker=lyr_obj.get_marker_style(),
markersize=lyr_obj.get_marker_size(),
color=lyr_obj.get_marker_fill(),
markeredgewidth=lyr_obj.get_marker_edge_width(),
markeredgecolor=lyr_obj.get_marker_edge_color(),
alpha=lyr_obj.get_marker_alpha(), clip_on=False)
self.rotated_ax.line(ldips_lst, ldipdir_lst,
marker=lyr_obj.get_marker_style(),
markersize=lyr_obj.get_marker_size(),
color=lyr_obj.get_marker_fill(),
markeredgewidth=lyr_obj.get_marker_edge_width(),
markeredgecolor=lyr_obj.get_marker_edge_color(),
alpha=lyr_obj.get_marker_alpha(), clip_on=False)

#Plot rotation axis
self.original_ax.line(raxis_dip, raxis_dipdir, marker="o",
markersize=10, color="#ff0000",
Expand Down

0 comments on commit b8211bf

Please sign in to comment.