00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef VRS_SG_TRANSFORMEDITOR_H
00010 #define VRS_SG_TRANSFORMEDITOR_H
00011
00012 #include <vrs/bounds.h>
00013 #include <vrs/sg/interactiontechnique.h>
00014
00015 namespace VRS {
00016
00017 class SceneThing;
00018 class MappedVertexAttributeShapeGL;
00019 class Tf;
00020
00035 class VRS_CORE_API TransformEditor :
00036 public InteractionTechnique
00037 {
00038 public:
00039
00040 TransformEditor();
00041
00043 void start(SO<SceneThing> target);
00044
00046 void end();
00047
00048 static const MouseButtonFunctionID HorizontalShiftButton;
00049 static const MouseButtonFunctionID VerticalShiftButton;
00050 static const MouseButtonFunctionID RotationButton;
00051 static const MouseButtonFunctionID ScalingButton;
00052
00054 virtual void onDragStart(int x, int y, SO<ButtonEvent>, MouseButtonFunctionID id);
00055 virtual void onDragMotion(
00056 int x, int y,
00057 SO<MotionEvent>,
00058 MouseButtonFunctionID id,
00059 int startX, int startY
00060 );
00061 virtual void onDragEnd(
00062 int x, int y,
00063 SO<ButtonEvent>,
00064 MouseButtonFunctionID id,
00065 int startX, int startY
00066 );
00067
00072 SO<SceneThing> getGhostCopyScene() const;
00073
00076 SO<Tf> getTransform() const;
00077
00080 void setRotationSensitivity(double degreesPerPixel = 0.3);
00081 double getRotationSensitivity() const;
00082
00083 VRS_TYPEINFO(TransformEditor, InteractionTechnique);
00084
00085
00089 static SO<SceneThing> createGhostCopyScene(SO<SceneThing> scene, SO<MappedVertexAttributeShapeGL>& shape);
00090
00091 private:
00092 Vector m_dragPoint;
00093 bool m_dragging;
00094 SO<SceneThing> m_ghostCopyScene;
00095 SO<Tf> m_currentTf;
00096 SO<Canvas> m_canvas;
00097 SO<MappedVertexAttributeShapeGL> m_ghostCopyShape;
00098
00099 Matrix m_dragStartMatrix;
00100 double m_degreesPerPixel;
00101
00102 MouseButtonFunctionID m_currentOperation;
00103
00104 };
00105
00106 }
00107
00108 #endif // VRS_SG_TRANSFORMEDITOR_H