- in Geometry Editor moved the simplification feature in its own Editor Tool (plugin)

- in Geometry Editor the default draw color is now black
This commit is contained in:
Marius Stanciu
2022-04-15 23:14:27 +03:00
committed by Marius
parent f4e800244e
commit d8129c8825
6 changed files with 330 additions and 112 deletions

View File

@@ -7,6 +7,11 @@ CHANGELOG for FlatCAM Evo beta
================================================= =================================================
15.04.2022
- in Geometry Editor moved the simplification feature in its own Editor Tool (plugin)
- in Geometry Editor the default draw color is now black
14.04.2022 14.04.2022
- in Geometry Editor added a new feature. While drawing a 'Path' now the user can project a direction by moving the mouse cursor in a certain direction and after that by typing a number or an arithmetic simple expression, a line segment will be drawn in that direction with the specified length from the last point - in Geometry Editor added a new feature. While drawing a 'Path' now the user can project a direction by moving the mouse cursor in a certain direction and after that by typing a number or an arithmetic simple expression, a line segment will be drawn in that direction with the specified length from the last point

View File

@@ -23,6 +23,7 @@ from appEditors.plugins.GeoPaintPlugin import PaintOptionsTool
from appEditors.plugins.GeoTextPlugin import TextInputTool from appEditors.plugins.GeoTextPlugin import TextInputTool
from appEditors.plugins.GeoTransformationPlugin import TransformEditorTool from appEditors.plugins.GeoTransformationPlugin import TransformEditorTool
from appEditors.plugins.GeoPathPlugin import PathEditorTool from appEditors.plugins.GeoPathPlugin import PathEditorTool
from appEditors.plugins.GeoSimplificationPlugin import SimplificationTool
from vispy.geometry import Rect from vispy.geometry import Rect
@@ -1294,7 +1295,7 @@ class FCSelect(DrawTool):
def click_release(self, point): def click_release(self, point):
""" """
:param point: The point for which to find the neasrest shape :param point: The point for which to find the nearest shape
:return: :return:
""" """
@@ -1350,7 +1351,7 @@ class FCSelect(DrawTool):
if mod_key == self.draw_app.app.options["global_mselect_key"]: if mod_key == self.draw_app.app.options["global_mselect_key"]:
# if modifier key is pressed then we add to the selected list the current shape but if it's already # if modifier key is pressed then we add to the selected list the current shape but if it's already
# in the selected list, we removed it. Therefore first click selects, second deselects. # in the selected list, we removed it. Therefore, first click selects, second deselects.
if obj_to_add in self.draw_app.selected: if obj_to_add in self.draw_app.selected:
self.draw_app.selected.remove(obj_to_add) self.draw_app.selected.remove(obj_to_add)
else: else:
@@ -1620,7 +1621,7 @@ class FCMove(FCShapeTool):
key_modifier = QtWidgets.QApplication.keyboardModifiers() key_modifier = QtWidgets.QApplication.keyboardModifiers()
if self.draw_app.app.options["global_mselect_key"] == 'Control': if self.draw_app.app.options["global_mselect_key"] == 'Control':
# if CONTROL key is pressed then we add to the selected list the current shape but if it's # if CONTROL key is pressed then we add to the selected list the current shape but if it's
# already in the selected list, we removed it. Therefore first click selects, second deselects. # already in the selected list, we removed it. Therefore, first click selects, second deselects.
if key_modifier == Qt.KeyboardModifier.ControlModifier: if key_modifier == Qt.KeyboardModifier.ControlModifier:
if obj_to_add in self.draw_app.selected: if obj_to_add in self.draw_app.selected:
self.draw_app.selected.remove(obj_to_add) self.draw_app.selected.remove(obj_to_add)
@@ -1883,20 +1884,43 @@ class FCBuffer(FCShapeTool):
self.buff_tool.ui.buffer_ext_button.clicked.connect(self.buff_tool.on_buffer_ext) self.buff_tool.ui.buffer_ext_button.clicked.connect(self.buff_tool.on_buffer_ext)
self.complete = True self.complete = True
self.draw_app.select_tool("select") self.draw_app.select_tool("select")
# self.buff_tool.hide_tool()
try:
self.draw_app.app.jump_signal.disconnect()
except (TypeError, AttributeError):
pass
def clean_up(self): def clean_up(self):
self.draw_app.selected = [] self.draw_app.selected = []
self.draw_app.plot_all() self.draw_app.plot_all()
class FCSimplification(FCShapeTool):
def __init__(self, draw_app):
FCShapeTool.__init__(self, draw_app)
self.name = 'simplify'
self.draw_app = draw_app
self.app = draw_app.app
self.storage = self.draw_app.storage
self.draw_app.app.inform.emit(_("Simplify geometry ..."))
self.origin = (0, 0)
self.simp_tool = SimplificationTool(self.app, self.draw_app)
self.simp_tool.run()
if self.draw_app.app.ui.splitter.sizes()[0] == 0:
self.draw_app.app.ui.splitter.setSizes([1, 1])
def click(self, point):
for ____ in self.storage.get_objects():
try: try:
self.draw_app.app.jump_signal.disconnect() __, closest_shape = self.storage.nearest(point)
except (TypeError, AttributeError): self.draw_app.selected.append(closest_shape)
pass except StopIteration:
return ""
last_sel_geo = self.draw_app.selected[-1].geo
self.simp_tool.calculate_coords_vertex(last_sel_geo)
def clean_up(self):
self.draw_app.selected = []
self.draw_app.plot_all()
class FCEraser(FCShapeTool): class FCEraser(FCShapeTool):
@@ -1943,7 +1967,7 @@ class FCEraser(FCShapeTool):
return "" return ""
if len(self.draw_app.get_selected()) == 0: if len(self.draw_app.get_selected()) == 0:
return "Nothing to ersase." return _("Nothing to erase.")
else: else:
self.draw_app.app.inform.emit(_("Click to pick-up the erase shape...")) self.draw_app.app.inform.emit(_("Click to pick-up the erase shape..."))
@@ -2259,47 +2283,6 @@ class AppGeoEditor(QtCore.QObject):
grid0.addWidget(vertex_lbl, 26, 0) grid0.addWidget(vertex_lbl, 26, 0)
grid0.addWidget(self.geo_vertex_entry, 26, 1, 1, 2) grid0.addWidget(self.geo_vertex_entry, 26, 1, 1, 2)
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
grid0.addWidget(separator_line, 28, 0, 1, 3)
# Simplification Title
simplif_lbl = FCLabel('<b>%s</b>:' % _("Simplification"))
simplif_lbl.setToolTip(
_("Simplify a geometry by reducing its vertex points number.")
)
grid0.addWidget(simplif_lbl, 30, 0, 1, 3)
# Simplification Tolerance
simplification_tol_lbl = FCLabel('<b>%s</b>:' % _("Tolerance"))
simplification_tol_lbl.setToolTip(
_("All points in the simplified object will be\n"
"within the tolerance distance of the original geometry.")
)
self.geo_tol_entry = FCDoubleSpinner()
self.geo_tol_entry.set_precision(self.decimals)
self.geo_tol_entry.setSingleStep(10 ** -self.decimals)
self.geo_tol_entry.set_range(0.0000, 10000.0000)
grid0.addWidget(simplification_tol_lbl, 32, 0)
grid0.addWidget(self.geo_tol_entry, 32, 1, 1, 2)
# Simplification button
self.simplification_btn = FCButton(_("Simplify"))
self.simplification_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/simplify32.png'))
self.simplification_btn.setToolTip(
_("Simplify a geometry element by reducing its vertex points number.")
)
self.simplification_btn.setStyleSheet("""
QPushButton
{
font-weight: bold;
}
""")
grid0.addWidget(self.simplification_btn, 34, 0, 1, 3)
layout.addStretch() layout.addStretch()
# Editor # Editor
@@ -2350,7 +2333,7 @@ class AppGeoEditor(QtCore.QObject):
# this var will store the state of the toolbar before starting the editor # this var will store the state of the toolbar before starting the editor
self.toolbar_old_state = False self.toolbar_old_state = False
self.key = None # Currently pressed key self.key = None # Currently, pressed key
self.geo_key_modifiers = None self.geo_key_modifiers = None
self.x = None # Current mouse cursor pos self.x = None # Current mouse cursor pos
self.y = None self.y = None
@@ -2430,8 +2413,9 @@ class AppGeoEditor(QtCore.QObject):
self.app.ui.geo_add_polygon_menuitem.triggered.connect(lambda: self.select_tool('polygon')) self.app.ui.geo_add_polygon_menuitem.triggered.connect(lambda: self.select_tool('polygon'))
self.app.ui.geo_add_path_menuitem.triggered.connect(lambda: self.select_tool('path')) self.app.ui.geo_add_path_menuitem.triggered.connect(lambda: self.select_tool('path'))
self.app.ui.geo_add_text_menuitem.triggered.connect(lambda: self.select_tool('text')) self.app.ui.geo_add_text_menuitem.triggered.connect(lambda: self.select_tool('text'))
self.app.ui.geo_paint_menuitem.triggered.connect(self.on_paint_tool) self.app.ui.geo_paint_menuitem.triggered.connect(lambda: self.select_tool("paint"))
self.app.ui.geo_buffer_menuitem.triggered.connect(self.on_buffer_tool) self.app.ui.geo_buffer_menuitem.triggered.connect(lambda: self.select_tool("buffer"))
self.app.ui.geo_simplification_menuitem.triggered.connect(lambda: self.select_tool("simplification"))
self.app.ui.geo_transform_menuitem.triggered.connect(self.transform_tool.run) self.app.ui.geo_transform_menuitem.triggered.connect(self.transform_tool.run)
self.app.ui.geo_delete_menuitem.triggered.connect(self.on_delete_btn) self.app.ui.geo_delete_menuitem.triggered.connect(self.on_delete_btn)
@@ -2456,7 +2440,6 @@ class AppGeoEditor(QtCore.QObject):
self.transform_complete.connect(self.on_transform_complete) self.transform_complete.connect(self.on_transform_complete)
self.simplification_btn.clicked.connect(self.on_simplification_click)
self.change_orientation_btn.clicked.connect(self.on_change_orientation) self.change_orientation_btn.clicked.connect(self.on_change_orientation)
self.tw.customContextMenuRequested.connect(self.on_menu_request) self.tw.customContextMenuRequested.connect(self.on_menu_request)
@@ -2486,6 +2469,7 @@ class AppGeoEditor(QtCore.QObject):
"polygon": {"button": self.app.ui.geo_add_polygon_btn, "constructor": FCPolygon}, "polygon": {"button": self.app.ui.geo_add_polygon_btn, "constructor": FCPolygon},
"text": {"button": self.app.ui.geo_add_text_btn, "constructor": FCText}, "text": {"button": self.app.ui.geo_add_text_btn, "constructor": FCText},
"buffer": {"button": self.app.ui.geo_add_buffer_btn, "constructor": FCBuffer}, "buffer": {"button": self.app.ui.geo_add_buffer_btn, "constructor": FCBuffer},
"simplification": {"button": self.app.ui.geo_add_simplification_btn, "constructor": FCSimplification},
"paint": {"button": self.app.ui.geo_add_paint_btn, "constructor": FCPaint}, "paint": {"button": self.app.ui.geo_add_paint_btn, "constructor": FCPaint},
"eraser": {"button": self.app.ui.geo_eraser_btn, "constructor": FCEraser}, "eraser": {"button": self.app.ui.geo_eraser_btn, "constructor": FCEraser},
"move": {"button": self.app.ui.geo_move_btn, "constructor": FCMove}, "move": {"button": self.app.ui.geo_move_btn, "constructor": FCMove},
@@ -2575,7 +2559,6 @@ class AppGeoEditor(QtCore.QObject):
self.is_empty_entry.set_value('None') self.is_empty_entry.set_value('None')
self.is_valid_entry.set_value('None') self.is_valid_entry.set_value('None')
self.geo_vertex_entry.set_value(0.0) self.geo_vertex_entry.set_value(0.0)
self.geo_tol_entry.set_value(0.01 if self.units == 'MM' else 0.0004)
self.geo_zoom.set_value(False) self.geo_zoom.set_value(False)
# Show/Hide Advanced Options # Show/Hide Advanced Options
@@ -2792,39 +2775,6 @@ class AppGeoEditor(QtCore.QObject):
# Context Menu section # Context Menu section
# self.tw.setupContextMenu() # self.tw.setupContextMenu()
def on_simplification_click(self):
self.app.log.debug("AppGeoEditor.on_simplification_click()")
selected_shapes = []
selected_shapes_geos = []
tol = self.geo_tol_entry.get_value()
selected_tree_items = self.tw.selectedItems()
def task_job():
with self.app.proc_container.new('%s...' % _("Simplify")):
self.interdict_selection = True
for sel in selected_tree_items:
for obj_shape in self.storage.get_objects():
try:
if id(obj_shape) == int(sel.text(0)):
selected_shapes.append(obj_shape)
selected_shapes_geos.append(obj_shape.geo.simplify(tolerance=tol))
except ValueError:
pass
for shape in selected_shapes:
self.delete_shape(shape=shape)
for geo in selected_shapes_geos:
self.add_shape(DrawToolShape(geo), build_ui=False)
self.plot_all()
self.interdict_selection = False
self.build_ui_sig.emit()
self.app.worker_task.emit({'fcn': task_job, 'params': []})
def on_change_orientation(self): def on_change_orientation(self):
self.app.log.debug("AppGeoEditor.on_change_orientation()") self.app.log.debug("AppGeoEditor.on_change_orientation()")
@@ -3073,6 +3023,7 @@ class AppGeoEditor(QtCore.QObject):
self.app.ui.draw_arc.triggered.connect(lambda: self.select_tool('arc')) self.app.ui.draw_arc.triggered.connect(lambda: self.select_tool('arc'))
self.app.ui.draw_text.triggered.connect(lambda: self.select_tool('text')) self.app.ui.draw_text.triggered.connect(lambda: self.select_tool('text'))
self.app.ui.draw_simplification.triggered.connect(lambda: self.select_tool('simplification'))
self.app.ui.draw_buffer.triggered.connect(lambda: self.select_tool('buffer')) self.app.ui.draw_buffer.triggered.connect(lambda: self.select_tool('buffer'))
self.app.ui.draw_paint.triggered.connect(lambda: self.select_tool('paint')) self.app.ui.draw_paint.triggered.connect(lambda: self.select_tool('paint'))
self.app.ui.draw_eraser.triggered.connect(lambda: self.select_tool('eraser')) self.app.ui.draw_eraser.triggered.connect(lambda: self.select_tool('eraser'))
@@ -3166,6 +3117,11 @@ class AppGeoEditor(QtCore.QObject):
except (TypeError, AttributeError): except (TypeError, AttributeError):
pass pass
try:
self.app.ui.draw_simplification.triggered.disconnect()
except (TypeError, AttributeError):
pass
try: try:
self.app.ui.draw_buffer.triggered.disconnect() self.app.ui.draw_buffer.triggered.disconnect()
except (TypeError, AttributeError): except (TypeError, AttributeError):
@@ -3307,14 +3263,6 @@ class AppGeoEditor(QtCore.QObject):
# self.storage = AppGeoEditor.make_storage() # self.storage = AppGeoEditor.make_storage()
self.plot_all() self.plot_all()
def on_buffer_tool(self):
buff_tool = BufferSelectionTool(self.app, self)
buff_tool.run()
def on_paint_tool(self):
paint_tool = PaintOptionsTool(self.app, self)
paint_tool.run()
def on_tool_select(self, tool): def on_tool_select(self, tool):
""" """
Behavior of the toolbar. Tool initialization. Behavior of the toolbar. Tool initialization.
@@ -3408,10 +3356,6 @@ class AppGeoEditor(QtCore.QObject):
self.select_tool("select") self.select_tool("select")
else: else:
self.select_tool(self.active_tool.name) self.select_tool(self.active_tool.name)
# if isinstance(self.active_tool, FCSelect):
# # self.app.log.debug("plot_allting after click.")
# self.plot_all()
else: else:
self.app.log.debug("No active tool to respond to click!") self.app.log.debug("No active tool to respond to click!")

View File

@@ -338,7 +338,7 @@ class BufferSelectionTool(AppTool):
def hide_tool(self): def hide_tool(self):
self.ui.buffer_tool_frame.hide() self.ui.buffer_tool_frame.hide()
self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab) self.app.ui.notebook.setCurrentWidget(self.app.ui.properties_tab)
class BufferEditorUI: class BufferEditorUI:

View File

@@ -0,0 +1,261 @@
from appTool import *
fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
class SimplificationTool(AppTool):
"""
Do a shape simplification for the selected geometry.
"""
update_ui = pyqtSignal(list, int)
def __init__(self, app, draw_app):
AppTool.__init__(self, app)
self.draw_app = draw_app
self.decimals = app.decimals
self.app = self.draw_app.app
self.ui = SimplificationEditorUI(layout=self.layout, simp_class=self)
self.plugin_name = self.ui.pluginName
self.connect_signals_at_init()
self.set_tool_ui()
def connect_signals_at_init(self):
# Signals
self.ui.simplification_btn.clicked.connect(self.on_simplification_click)
self.update_ui.connect(self.on_update_ui)
def run(self):
self.app.defaults.report_usage("Geo Editor SimplificationTool()")
AppTool.run(self)
# if the splitter us hidden, display it
if self.app.ui.splitter.sizes()[0] == 0:
self.app.ui.splitter.setSizes([1, 1])
# if the Tool Tab is hidden display it, else hide it but only if the objectName is the same
found_idx = None
for idx in range(self.app.ui.notebook.count()):
if self.app.ui.notebook.widget(idx).objectName() == "plugin_tab":
found_idx = idx
break
# show the Tab
if not found_idx:
try:
self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin"))
except RuntimeError:
self.app.ui.plugin_tab = QtWidgets.QWidget()
self.app.ui.plugin_tab.setObjectName("plugin_tab")
self.app.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.app.ui.plugin_tab)
self.app.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2)
self.app.ui.plugin_scroll_area = VerticalScrollArea()
self.app.ui.plugin_tab_layout.addWidget(self.app.ui.plugin_scroll_area)
self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin"))
# focus on Tool Tab
self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab)
# self.app.ui.notebook.callback_on_close = self.on_tab_close
self.app.ui.notebook.setTabText(2, self.plugin_name)
def set_tool_ui(self):
# Init appGUI
self.ui.geo_tol_entry.set_value(0.01 if self.draw_app.units == 'MM' else 0.0004)
selected_shapes_geos = []
selected_tree_items = self.draw_app.tw.selectedItems()
for sel in selected_tree_items:
for obj_shape in self.draw_app.storage.get_objects():
try:
if id(obj_shape) == int(sel.text(0)):
selected_shapes_geos.append(obj_shape.geo)
except ValueError:
pass
if selected_shapes_geos:
# those are displayed by triggering the signal self.update_ui
self.calculate_coords_vertex(selected_shapes_geos[-1])
def on_tab_close(self):
self.draw_app.select_tool("select")
self.app.ui.notebook.callback_on_close = lambda: None
def on_simplification_click(self):
self.app.log.debug("FCSimplification.on_simplification_click()")
selected_shapes_geos = []
tol = self.ui.geo_tol_entry.get_value()
def task_job(self):
with self.app.proc_container.new('%s...' % _("Simplify")):
selected_shapes = self.draw_app.get_selected()
self.draw_app.interdict_selection = True
for obj_shape in selected_shapes:
selected_shapes_geos.append(obj_shape.geo.simplify(tolerance=tol))
if not selected_shapes:
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Failed."))
return
for shape in selected_shapes:
self.draw_app.delete_shape(shape=shape)
for geo in selected_shapes_geos:
self.draw_app.add_shape(geo, build_ui=False)
self.draw_app.selected = []
last_sel_geo = selected_shapes_geos[-1]
self.calculate_coords_vertex(last_sel_geo)
self.draw_app.plot_all()
self.draw_app.interdict_selection = False
self.draw_app.build_ui_sig.emit()
self.app.worker_task.emit({'fcn': task_job, 'params': [self]})
def calculate_coords_vertex(self, last_sel_geo):
if last_sel_geo:
if last_sel_geo.geom_type == 'MultiLineString':
coords = ''
vertex_nr = 0
for idx, line in enumerate(last_sel_geo.geoms):
line_coords = list(line.coords)
vertex_nr += len(line_coords)
coords += 'Line %s\n' % str(idx)
coords += str(line_coords) + '\n'
elif last_sel_geo.geom_type == 'MultiPolygon':
coords = ''
vertex_nr = 0
for idx, poly in enumerate(last_sel_geo.geoms):
poly_coords = list(poly.exterior.coords) + [list(i.coords) for i in poly.interiors]
vertex_nr += len(poly_coords)
coords += 'Polygon %s\n' % str(idx)
coords += str(poly_coords) + '\n'
elif last_sel_geo.geom_type in ['LinearRing', 'LineString']:
coords = list(last_sel_geo.coords)
vertex_nr = len(coords)
elif last_sel_geo.geom_type == 'Polygon':
coords = list(last_sel_geo.exterior.coords)
vertex_nr = len(coords)
else:
coords = 'None'
vertex_nr = 0
self.update_ui.emit(coords, vertex_nr)
def on_update_ui(self, coords, vertex_nr):
self.ui.geo_coords_entry.set_value(str(coords))
self.ui.geo_vertex_entry.set_value(vertex_nr)
def hide_tool(self):
self.ui.simp_frame.hide()
self.app.ui.notebook.setCurrentWidget(self.app.ui.properties_tab)
class SimplificationEditorUI:
pluginName = _("Simplification")
def __init__(self, layout, simp_class):
self.simp_class = simp_class
self.app = self.simp_class.app
self.decimals = self.app.decimals
self.layout = layout
# Title
title_label = FCLabel("%s" % ('Editor ' + self.pluginName))
title_label.setStyleSheet("""
QLabel
{
font-size: 16px;
font-weight: bold;
}
""")
self.layout.addWidget(title_label)
# this way I can hide/show the frame
self.simp_frame = QtWidgets.QFrame()
self.simp_frame.setContentsMargins(0, 0, 0, 0)
self.layout.addWidget(self.simp_frame)
self.simp_tools_box = QtWidgets.QVBoxLayout()
self.simp_tools_box.setContentsMargins(0, 0, 0, 0)
self.simp_frame.setLayout(self.simp_tools_box)
# Grid Layout
grid0 = GLay(v_spacing=5, h_spacing=3)
self.simp_tools_box.addLayout(grid0)
# Coordinates
coords_lbl = FCLabel('<b>%s</b>:' % _("Coordinates"))
coords_lbl.setToolTip(
_("The coordinates of the selected geometry element.")
)
grid0.addWidget(coords_lbl, 22, 0, 1, 3)
self.geo_coords_entry = FCTextEdit()
self.geo_coords_entry.setPlaceholderText(
_("The coordinates of the selected geometry element.")
)
grid0.addWidget(self.geo_coords_entry, 24, 0, 1, 3)
# Vertex Points Number
vertex_lbl = FCLabel('<b>%s</b>:' % _("Vertex Points"))
vertex_lbl.setToolTip(
_("The number of vertex points in the selected geometry element.")
)
self.geo_vertex_entry = FCEntry(decimals=self.decimals)
self.geo_vertex_entry.setReadOnly(True)
grid0.addWidget(vertex_lbl, 26, 0)
grid0.addWidget(self.geo_vertex_entry, 26, 1, 1, 2)
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
grid0.addWidget(separator_line, 28, 0, 1, 3)
# Simplification Title
simplif_lbl = FCLabel('<b>%s</b>:' % _("Simplification"))
simplif_lbl.setToolTip(
_("Simplify a geometry by reducing its vertex points number.")
)
grid0.addWidget(simplif_lbl, 30, 0, 1, 3)
# Simplification Tolerance
simplification_tol_lbl = FCLabel('<b>%s</b>:' % _("Tolerance"))
simplification_tol_lbl.setToolTip(
_("All points in the simplified object will be\n"
"within the tolerance distance of the original geometry.")
)
self.geo_tol_entry = FCDoubleSpinner()
self.geo_tol_entry.set_precision(self.decimals)
self.geo_tol_entry.setSingleStep(10 ** -self.decimals)
self.geo_tol_entry.set_range(0.0000, 10000.0000)
grid0.addWidget(simplification_tol_lbl, 32, 0)
grid0.addWidget(self.geo_tol_entry, 32, 1, 1, 2)
# Simplification button
self.simplification_btn = FCButton(_("Simplify"))
self.simplification_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/simplify32.png'))
self.simplification_btn.setToolTip(
_("Simplify a geometry element by reducing its vertex points number.")
)
self.simplification_btn.setStyleSheet("""
QPushButton
{
font-weight: bold;
}
""")
grid0.addWidget(self.simplification_btn, 34, 0, 1, 3)
self.layout.addStretch(1)

View File

@@ -718,11 +718,15 @@ class MainGUI(QtWidgets.QMainWindow):
'%s\t%s' % (_("Move"), _('M'))) '%s\t%s' % (_("Move"), _('M')))
self.geo_buffer_menuitem = self.geo_editor_menu.addAction( self.geo_buffer_menuitem = self.geo_editor_menu.addAction(
QtGui.QIcon(self.app.resource_location + '/buffer16.png'), QtGui.QIcon(self.app.resource_location + '/buffer16.png'),
'%s\t%s' % (_("Buffer Tool"), _('B')) '%s\t%s' % (_("Buffer"), _('B'))
)
self.geo_simplification_menuitem = self.geo_editor_menu.addAction(
QtGui.QIcon(self.app.resource_location + '/simplify32.png'),
'%s\t%s' % (_("Simplification"), '')
) )
self.geo_paint_menuitem = self.geo_editor_menu.addAction( self.geo_paint_menuitem = self.geo_editor_menu.addAction(
QtGui.QIcon(self.app.resource_location + '/paint20_1.png'), QtGui.QIcon(self.app.resource_location + '/paint20_1.png'),
'%s\t%s' % (_("Paint Tool"), _('I')) '%s\t%s' % (_("Paint"), _('I'))
) )
self.geo_transform_menuitem = self.geo_editor_menu.addAction( self.geo_transform_menuitem = self.geo_editor_menu.addAction(
QtGui.QIcon(self.app.resource_location + '/transform.png'), QtGui.QIcon(self.app.resource_location + '/transform.png'),
@@ -1219,6 +1223,8 @@ class MainGUI(QtWidgets.QMainWindow):
self.geo_edit_toolbar.addSeparator() self.geo_edit_toolbar.addSeparator()
self.geo_add_text_btn = self.geo_edit_toolbar.addAction( self.geo_add_text_btn = self.geo_edit_toolbar.addAction(
QtGui.QIcon(self.app.resource_location + '/text32.png'), _('Add Text')) QtGui.QIcon(self.app.resource_location + '/text32.png'), _('Add Text'))
self.geo_add_simplification_btn = self.geo_edit_toolbar.addAction(
QtGui.QIcon(self.app.resource_location + '/simplify32.png'), _('Simplify'))
self.geo_add_buffer_btn = self.geo_edit_toolbar.addAction( self.geo_add_buffer_btn = self.geo_edit_toolbar.addAction(
QtGui.QIcon(self.app.resource_location + '/buffer16-2.png'), _('Add Buffer')) QtGui.QIcon(self.app.resource_location + '/buffer16-2.png'), _('Add Buffer'))
self.geo_add_paint_btn = self.geo_edit_toolbar.addAction( self.geo_add_paint_btn = self.geo_edit_toolbar.addAction(
@@ -1779,6 +1785,8 @@ class MainGUI(QtWidgets.QMainWindow):
self.draw_text = self.g_editor_cmenu.addAction( self.draw_text = self.g_editor_cmenu.addAction(
QtGui.QIcon(self.app.resource_location + '/text32.png'), _("Text")) QtGui.QIcon(self.app.resource_location + '/text32.png'), _("Text"))
self.draw_simplification = self.g_editor_cmenu.addAction(
QtGui.QIcon(self.app.resource_location + '/simplify32.png'), _("Simplification"))
self.draw_buffer = self.g_editor_cmenu.addAction( self.draw_buffer = self.g_editor_cmenu.addAction(
QtGui.QIcon(self.app.resource_location + '/buffer16-2.png'), _("Buffer")) QtGui.QIcon(self.app.resource_location + '/buffer16-2.png'), _("Buffer"))
self.draw_paint = self.g_editor_cmenu.addAction( self.draw_paint = self.g_editor_cmenu.addAction(

View File

@@ -123,7 +123,7 @@ class AppDefaults:
"global_sel_line": '#0000ffbf', "global_sel_line": '#0000ffbf',
"global_alt_sel_fill": '#BBF268BF', "global_alt_sel_fill": '#BBF268BF',
"global_alt_sel_line": '#006E20BF', "global_alt_sel_line": '#006E20BF',
"global_draw_color": '#FF000080', "global_draw_color": '#00000080',
"global_sel_draw_color": '#0000FF80', "global_sel_draw_color": '#0000FF80',
# Project Items colors # Project Items colors