FreeCAD
109 строк · 4.1 Кб
1# ***************************************************************************
2# * Copyright (c) 2019, 2020 Carlo Pavan <carlopav@gmail.com> *
3# * *
4# * This program is free software; you can redistribute it and/or modify *
5# * it under the terms of the GNU Lesser General Public License (LGPL) *
6# * as published by the Free Software Foundation; either version 2 of *
7# * the License, or (at your option) any later version. *
8# * for detail see the LICENCE text file. *
9# * *
10# * This program is distributed in the hope that it will be useful, *
11# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13# * GNU Library General Public License for more details. *
14# * *
15# * You should have received a copy of the GNU Library General Public *
16# * License along with this program; if not, write to the Free Software *
17# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
18# * USA *
19# * *
20# ***************************************************************************
21"""Provides support functions to edit Arch objects."""
22## @package gui_edit_arch_objects
23# \ingroup draftguitools
24# \brief Provides support functions to edit Arch objects.
25
26__title__ = "FreeCAD Draft Edit Tool"
27__author__ = ("Carlo Pavan")
28__url__ = "https://www.freecad.org"
29
30## \addtogroup draftguitools
31# @{
32
33
34class GuiTools:
35""" Base class for object editing tools
36"""
37
38def __init__(self):
39pass
40
41def get_edit_points(self, obj):
42"""Return to Draft_Edit a list of vectors for the given object.
43Remember to use object local coordinates system.
44
45Parameters:
46obj: the object
47"""
48pass
49
50def update_object_from_edit_points(self, obj, node_idx, v, alt_edit_mode=0):
51"""Update the object from modified Draft_Edit point.
52No need to recompute at the end.
53
54Parameters:
55obj: the object
56node_idx: number of the edited node
57v: target vector of the node in object local coordinates system
58alt_edit_mode: alternative edit mode to perform different operations
59(usually can be selected from the Draft_Edit context menu)
60default = 0
61"""
62pass
63
64def get_edit_point_context_menu(self, edit_command, obj, node_idx):
65""" Get the context menu associated to edit points (user is over an editpoint)
66
67Return a list of tuples containing menu labels and associated functions:
68return [
69("action label", lambda: self.handle_action_label(edit_command, obj, node_idx)),
70]
71
72Parameters:
73edit_command: running Draft_Edit command
74obj: the edited object
75node_idx: number of the edited node
76"""
77pass
78
79def get_edit_obj_context_menu(self, edit_command, obj, position):
80""" Get the context menu associated to edited object (user is over the object)
81
82Return a list of tuples containing menu labels and associated functions:
83return [
84("action label", lambda: self.handle_action_label(edit_command, obj, position)),
85]
86
87Parameters:
88edit_command: running Draft_Edit command
89obj: the edited object
90position: position of the cursor on the screen (x, y)
91"""
92pass
93
94def get_object_style(self, obj):
95pass
96
97def set_object_editing_style(self, obj):
98pass
99
100def restore_object_style(self, obj, modes):
101pass
102
103def init_preview_object(self, obj):
104pass
105
106def update_preview_object(self, edit_command, obj, node_idx, v):
107pass
108
109## @}
110