9 from python_qt_binding.QtWidgets
import QUndoCommand
18 QUndoCommand.__init__(self,
"Select")
36 QUndoCommand.__init__(self,
"Add")
55 QUndoCommand.__init__(self,
"Remove")
60 if editor.active_frame
is element:
67 self.
editor.active_frame =
None
68 self.
editor.add_undo_level(2)
81 self.
editor.add_undo_level(2)
87 QUndoCommand.__init__(self,
"Clear all")
94 self.
editor.active_frame =
None
106 def __init__(self, editor, element, source_name, mode):
107 QUndoCommand.__init__(self,
"Align")
118 element.tf_buffer.lookup_transform(
119 element.parent, source_name, rospy.Time(0)))
122 pos = list(element.position)
132 rpy = list(tf.transformations.euler_from_quaternion(element.orientation))
133 rpy_new = tf.transformations.euler_from_quaternion(orientation)
141 if "a" in mode
or "b" in mode
or "c" in mode:
158 '''Copys a source frame's transformation and sets a new parent
161 def __init__(self, editor, new_name, source_name, parent_name):
162 QUndoCommand.__init__(self,
"Rebase")
165 if source_name
in self.
editor.frames:
166 element = copy.deepcopy(self.
editor.frames[source_name])
167 element.name = new_name
169 element =
Frame(new_name, parent=parent_name)
170 element.parent = parent_name
174 element.tf_buffer.lookup_transform(
175 parent_name, source_name, rospy.Time(0)))
176 element.position = position
177 element.orientation = orientation
194 '''Copys a source frame's transformation and sets a new parent
197 def __init__(self, editor, element, source_name, new_parent):
198 QUndoCommand.__init__(self,
"Rebase")
211 element.tf_buffer.lookup_transform(
212 new_parent, source_name, rospy.Time(0)))
216 self.
element.position = self.new_position
230 def __init__(self, editor, element, position, orientation):
231 QUndoCommand.__init__(self,
"Position")
257 if self.
id() != command.id():
259 if self.
element is not command.element:
261 if time.time() - self.
time > 1.0:
265 self.
time = time.time()
274 QUndoCommand.__init__(self,
"Position")
294 QUndoCommand.__init__(self,
"Orientation")
313 def __init__(self, editor, element, symbol, value):
314 QUndoCommand.__init__(self,
"Value")
334 def __init__(self, editor, element, parent_name, keep_absolute=True):
335 QUndoCommand.__init__(self,
"Parent")
346 element.tf_buffer.lookup_transform(
347 parent_name, element.name, rospy.Time(0)))
376 QUndoCommand.__init__(self,
"Style")
383 elif style ==
"cube":
384 self.
new_element =
Object_Cube(element.name, element.position, element.orientation, element.parent, group=element.group)
385 elif style ==
"sphere":
386 self.
new_element =
Object_Sphere(element.name, element.position, element.orientation, element.parent, group=element.group)
387 elif style ==
"axis":
388 self.
new_element =
Object_Axis(element.name, element.position, element.orientation, element.parent, group=element.group)
389 elif style ==
"mesh":
390 self.
new_element =
Object_Mesh(element.name, element.position, element.orientation, element.parent, group=element.group)
392 self.
new_element =
Frame(element.name, element.position, element.orientation, element.parent, group=element.group)
394 if editor.active_frame
is element:
410 self.
editor.add_undo_level(2)
423 self.
editor.add_undo_level(2)
429 QUndoCommand.__init__(self,
"Style Color")
448 QUndoCommand.__init__(self,
"size")
467 def __init__(self, editor, element, parameter, value):
468 QUndoCommand.__init__(self,
"Style Geometry")
489 def __init__(self, editor, element, group_name:str):
490 QUndoCommand.__init__(self,
"Group")