File size: 4,236 Bytes
985c397
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# SPDX-License-Identifier: LGPL-2.1-or-later

# ***************************************************************************
# *   Copyright (c) 2019, 2020 Carlo Pavan <carlopav@gmail.com>             *
# *                                                                         *
# *   This program is free software; you can redistribute it and/or modify  *
# *   it under the terms of the GNU Lesser General Public License (LGPL)    *
# *   as published by the Free Software Foundation; either version 2 of     *
# *   the License, or (at your option) any later version.                   *
# *   for detail see the LICENCE text file.                                 *
# *                                                                         *
# *   This program is distributed in the hope that it will be useful,       *
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
# *   GNU Library General Public License for more details.                  *
# *                                                                         *
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with this program; if not, write to the Free Software   *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# ***************************************************************************
"""Provides support functions to edit Arch objects."""
## @package gui_edit_arch_objects
# \ingroup draftguitools
# \brief Provides support functions to edit Arch objects.

__title__ = "FreeCAD Draft Edit Tool"
__author__ = "Carlo Pavan"
__url__ = "https://www.freecad.org"

## \addtogroup draftguitools
# @{


class GuiTools:
    """Base class for object editing tools"""

    def __init__(self):
        pass

    def get_edit_points(self, obj):
        """Return to Draft_Edit a list of vectors for the given object.
        Remember to use object local coordinates system.

        Parameters:
        obj: the object
        """
        pass

    def update_object_from_edit_points(self, obj, node_idx, v, alt_edit_mode=0):
        """Update the object from modified Draft_Edit point.
        No need to recompute at the end.

        Parameters:
        obj: the object
        node_idx: number of the edited node
        v: target vector of the node in object local coordinates system
        alt_edit_mode: alternative edit mode to perform different operations
                       (usually can be selected from the Draft_Edit context menu)
                       default = 0
        """
        pass

    def get_edit_point_context_menu(self, edit_command, obj, node_idx):
        """Get the context menu associated to edit points (user is over an editpoint)

        Return a list of tuples containing menu labels and associated functions:
            return [
                ("action label", lambda: self.handle_action_label(edit_command, obj, node_idx)),
            ]

        Parameters:
        edit_command: running Draft_Edit command
        obj: the edited object
        node_idx: number of the edited node
        """
        pass

    def get_edit_obj_context_menu(self, edit_command, obj, position):
        """Get the context menu associated to edited object (user is over the object)

        Return a list of tuples containing menu labels and associated functions:
            return [
                ("action label", lambda: self.handle_action_label(edit_command, obj, position)),
            ]

        Parameters:
        edit_command: running Draft_Edit command
        obj: the edited object
        position: position of the cursor on the screen (x, y)
        """
        pass

    def get_object_style(self, obj):
        pass

    def set_object_editing_style(self, obj):
        pass

    def restore_object_style(self, obj, modes):
        pass

    def init_preview_object(self, obj):
        pass

    def update_preview_object(self, edit_command, obj, node_idx, v):
        pass


## @}