9 from python_qt_binding.QtWidgets
import QUndoCommand
11 from constructors_geometry
import FromTransformStamped
18 QUndoCommand.__init__(self,
"Select")
36 QUndoCommand.__init__(self,
"Add")
42 self.editor.frames[self.element.name] = self.
element 43 self.element.hidden =
False 44 self.editor.add_undo_level(1, [self.
element])
47 del self.editor.frames[self.element.name]
48 self.element.hidden =
True 49 self.editor.add_undo_level(1, [self.
element])
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)
70 del self.editor.frames[self.element.name]
71 self.element.hidden =
True 72 self.editor.add_undo_level(1, [self.
element])
75 self.editor.frames[self.element.name] = self.
element 76 self.element.hidden =
False 77 self.editor.add_undo_level(1, [self.
element])
80 self.editor.active_frame = self.
element 81 self.editor.add_undo_level(2)
87 QUndoCommand.__init__(self,
"Clear all")
94 self.editor.active_frame =
None 95 self.editor.frames = {}
96 self.editor.add_undo_level(1+2, self.elements.values())
101 self.editor.add_undo_level(1+2, self.elements.values())
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:
149 self.editor.add_undo_level(4, [self.
element])
154 self.editor.add_undo_level(4, [self.
element])
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
182 self.editor.frames[self.element.name] = self.
element 183 self.element.hidden =
False 184 self.editor.add_undo_level(1, [self.
element])
187 del self.editor.frames[self.element.name]
188 self.element.hidden =
True 189 self.editor.add_undo_level(1, [self.
element])
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
219 self.editor.add_undo_level(4, [self.
element])
225 self.editor.add_undo_level(4, [self.
element])
230 def __init__(self, editor, element, position, orientation):
231 QUndoCommand.__init__(self,
"Position")
246 self.editor.add_undo_level(4, [self.
element])
251 self.editor.add_undo_level(4, [self.
element])
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")
284 self.editor.add_undo_level(4, [self.
element])
288 self.editor.add_undo_level(4, [self.
element])
294 QUndoCommand.__init__(self,
"Orientation")
304 self.editor.add_undo_level(4, [self.
element])
308 self.editor.add_undo_level(4, [self.
element])
313 def __init__(self, editor, element, symbol, value):
314 QUndoCommand.__init__(self,
"Value")
325 self.editor.add_undo_level(4, [self.
element])
329 self.editor.add_undo_level(4, [self.
element])
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)))
361 self.editor.add_undo_level(4, [self.
element])
370 self.editor.add_undo_level(4, [self.
element])
376 QUndoCommand.__init__(self,
"Style")
383 elif style ==
"cube":
385 elif style ==
"sphere":
387 elif style ==
"axis":
389 elif style ==
"mesh":
392 self.
new_element =
Frame(element.name, element.position, element.orientation, element.parent)
394 if editor.active_frame
is element:
400 del self.editor.frames[self.old_element.name]
401 self.old_element.hidden =
True 403 self.editor.frames[self.new_element.name] = self.
new_element 404 self.new_element.hidden =
False 410 self.editor.add_undo_level(2)
413 del self.editor.frames[self.new_element.name]
414 self.new_element.hidden =
True 416 self.editor.frames[self.old_element.name] = self.
old_element 417 self.old_element.hidden =
False 423 self.editor.add_undo_level(2)
429 QUndoCommand.__init__(self,
"Style Color")
438 self.editor.add_undo_level(4, [self.
element])
442 self.editor.add_undo_level(4, [self.
element])
447 def __init__(self, editor, element, parameter, value):
448 QUndoCommand.__init__(self,
"Style Geometry")
458 self.element.update_marker()
459 self.editor.add_undo_level(4, [self.
element])
464 self.element.update_marker()
465 self.editor.add_undo_level(4, [self.
element])
def __init__(self, editor, element, symbol, value)
def __init__(self, editor, element)
new_orientation
Orientation.
def __init__(self, editor, element, source_name, mode)
def __init__(self, editor, element, source_name, new_parent)
def __init__(self, editor, new_name, source_name, parent_name)
def __init__(self, editor, element, orientation)
def __init__(self, editor, element, style)
def __init__(self, editor, element, color_rgba)
def __init__(self, editor)
def __init__(self, editor, element, position)
def __init__(self, editor, element, parent_name, keep_absolute=True)
def __init__(self, editor, element, position, orientation)
def mergeWith(self, command)
def __init__(self, editor, element)
def __init__(self, editor, element)
def FromTransformStamped(msg)
TransformStamped ##.
def __init__(self, editor, element, parameter, value)