23 #include "hugin_config.h"
35 #include <OpenGL/gl.h>
43 :
Tool(helper), drag_mode(drag_mode_normal)
64 delta_x = shiftx - startx;
65 delta_y = shifty - starty;
78 helper->
SetStatusMessage(_(
"Drag to move images (optionally use shift to constrain), or roll with right-drag or Ctrl-drag"));
99 shift = e.m_shiftDown;
106 helper->
SetStatusMessage(_(
"Currently constrained to moving only pitch. Make a larger movement in the opposite direction to constrain to yaw."));
110 helper->
SetStatusMessage(_(
"Currently constrained to moving only yaw. Make a larger movement in the opposite direction to constrain to pitch."));
130 std::map<unsigned int, ParamStore>::iterator i;
134 GetSrcImage(i->first);
135 double new_yaw, new_pitch, new_roll, new_TrX, new_TrY, new_TrZ, new_Tpy, new_Tpp;
139 double shift_x, shift_y;
141 i->second.TrX = img.getX() + shift_x;
142 i->second.TrY = img.getY() + shift_y;
144 i->second.Move(&
rotation_matrix, new_yaw, new_pitch, new_roll, new_TrX, new_TrY, new_TrZ, new_Tpy, new_Tpp);
148 img.setTranslationPlaneYaw(new_Tpy);
149 img.setTranslationPlanePitch(new_Tpp);
151 img.setPitch(new_pitch);
152 img.setRoll(new_roll);
169 shift = e.m_shiftDown;
174 std::set<unsigned int>::iterator it;
175 for(it = images_under_mouse.begin() ; it != images_under_mouse.end() ; ++it) {
186 switch (e.GetButton())
189 case wxMOUSE_BTN_LEFT:
197 case wxMOUSE_BTN_RIGHT:
230 pitch, mouse_pos.
x, mouse_pos.
y);
235 helper->
SetStatusMessage(_(
"Constrained drag: make a movement and it will be snapped to the yaw or pitch"));
259 if (customDragging) {
261 std::set<unsigned int>::iterator i, end;
274 const size_t n = components.size();
284 for (
unsigned int i = 0; i < imgs; i++)
300 for (
size_t component_index = 0;
301 component_index < n; component_index ++)
303 if (components[component_index].count(img))
307 std::set<unsigned int>::iterator i, end;
332 std::vector<HuginBase::SrcPanoImage> src_images(
draging_images.size() + 1);
333 std::map<unsigned int, ParamStore>::iterator i;
334 unsigned int count = 0;
337 double nyaw, npitch, nroll, nx, ny, nz, npy, npp;
338 i->second.Move(&
rotation_matrix, nyaw, npitch, nroll, nx, ny, nz, npy, npp);
340 src_images[count].setX(nx);
341 src_images[count].setY(ny);
342 src_images[count].setZ(nz);
343 src_images[count].setTranslationPlaneYaw(npy);
344 src_images[count].setTranslationPlanePitch(npp);
345 src_images[count].setYaw(nyaw);
346 src_images[count].setPitch(npitch);
347 src_images[count].setRoll(nroll);
358 helper->
SetStatusMessage(_(
"Drag to move images (optionally use shift to constrain), or roll with right-drag or Ctrl-drag"));
367 pitch = img->getPitch();
368 roll = img->getRoll();
372 Tpy = img->getTranslationPlaneYaw();
373 Tpp = img->getTranslationPlanePitch();
377 double &yaw_out,
double &pitch_out,
double &roll_out,
378 double &TrX_out,
double &TrY_out,
double &TrZ_out,
379 double &Tpy_out,
double &Tpp_out)
385 output_matrix = *matrix * start;
392 if(TrX != 0.0 || TrY != 0.0 || TrZ != 0.0)
401 output_matrix = (*matrix) * start;
419 double yaw_start,
double pitch_start,
422 Matrix3 y1_mat, r_mat, y2_mat, p1_mat, p2_mat;
439 double width = (double) opts->
getSize().width(),
440 height = (double) opts->
getSize().height();
443 glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
445 glColor3f(1.0, 1.0, 1.0);
447 glTranslatef(-0.5, -0.5, -0.5);
449 glVertex2f(width / 2.0, 0.0);
450 glVertex2f(width / 2.0, height);
451 glVertex2f(0.0, height / 2.0);
452 glVertex2f(width, height / 2.0);
459 double distance = width * width + height * height,
465 glVertex2d(0.0, 0.0);
466 glVertex2f(distance * cos(angle), distance * sin(angle));
469 glVertex2d(0.0, 0.0);
470 glVertex2f(distance * cos(angle), distance * sin(angle));
479 glBegin(GL_LINE_STRIP);
480 for (
double t = 0.0; t <= 1.0; t+= 0.005)
482 double x, y, ti = 1.0 - t;
493 glEnable(GL_TEXTURE_2D);
HuginBase::UIntSet GetDragGroupImages()
SrcPanoImage getSrcImage(unsigned imgNr) const
get a description of a source image
OutputProjectionInfo * GetProjectionInfo()
void DisableTexture(bool maskOnly=false)
void AddImageToDragGroup(unsigned int image_nr, bool update_check_box=true)
general : Matrix3 is a class for handling 3x3 Matrix manipulation.
include file for the hugin project
void GetRotationPT(double &Yaw, double &Pitch, double &Roll)
GetRotation in panotools style.
Vector3 TransformVector(const Vector3 &V) const
transforms a vector
void SetRotationPT(double yaw, double pitch, double roll)
set rotation in panotools style, code adapted from Panotools-Script by Bruno Postle ...
void RemoveImageFromDragGroup(unsigned int image_nr, bool update_check_box=true)
std::vector< HuginBase::UIntSet > Components
stores the components of the graph
HuginBase::PanoramaOptions * GetOptions()
bool individualDragging()
void SetSrcImage(unsigned int image_nr, HuginBase::SrcPanoImage *new_img)
std::size_t getNrOfImages() const
number of images.
bool AngularToImage(double &image_x, double &image_y, double yaw, double pitch)
TextureManager * GetTextureManager()
static GlobalCmdHist & getInstance()
void addCommand(PanoCommand *command, bool execute=true)
Adds a command to the history.
virtual OutputProjectionInfo * GetProjectionInfo()
include file for the hugin project
Components GetComponents()
find all connected components
Matrix3 Inverse() const
return inverse if it exists, otherwise identity
general : Vector3 is a class for handling 3D Vectors manipulation.
void fill_set(_Container &c, typename _Container::key_type begin, typename _Container::key_type end)
double x
x,y,z coordinates, 0 at the initialisation
HuginBase::SrcPanoImage * GetSrcImage(unsigned int image_nr)
All variables of a source image.
vigra::Size2D getSize() const
get size of output image
bool ImageToAngular(double &yaw, double &pitch, double image_x, double image_y)
class to work with images graphs created from a HuginBase::Panorama class it creates a graph based on...