Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ToolHelper.cpp
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
2 
25 #ifdef _WIN32
26 #include "wx/msw/wrapwin.h"
27 #endif
28 #include "ToolHelper.h"
29 #include "Tool.h"
30 #include "GLPreviewFrame.h"
31 #include "GLViewer.h"
32 #include "MeshManager.h"
33 
35  VisualizationState *visualization_state_in,
36  GLPreviewFrame *frame_in)
37 {
38  pano = pano_in;
39  visualization_state = visualization_state_in;
40  frame = frame_in;
42  mouse_over_pano = false;
43  mouse_screen_x = 0;
44  mouse_screen_y = 0;
45  mouse_pano_x = 0;
46  mouse_pano_y = 0;
47 }
48 
50 {
51 }
52 
53 std::set<Tool *> ToolHelper::ActivateTool(Tool *tool)
54 {
55  tools_deactivated.clear();
56  tool->Activate();
57  return tools_deactivated;
58 }
59 
61 {
62  tools_deactivated.insert(tool);
63  // To deactivate it we need to give up all of its notifications.
73 }
74 
75 void ToolHelper::MouseMoved(int x, int y, wxMouseEvent & e)
76 {
77  mouse_screen_x = x;
78  mouse_screen_y = y;
79  // now tell tools that want notification.
80  for (auto& tool : mouse_move_notified_tools)
81  {
82  tool->MouseMoveEvent(mouse_screen_x, mouse_screen_y, e);
83  }
84  // If the mouse has moved, then we don't know what is underneath it anoymore
86 }
87 
89 {
91  // if there are tools that want to know when the images under the mouse
92  // pointer change, we better detect the images and notfiy them is applicable
94  {
95  // there are tools that want to know... so find out:
96  std::set<unsigned int> old_images_under_mouse = images_under_mouse;
98  if (old_images_under_mouse != images_under_mouse)
99  {
100  // The list has changed. Notifiy all tools that requested it.
101  for (auto& tool : images_under_mouse_notified_tools)
102  {
103  tool->ImagesUnderMouseChangedEvent();
104  }
105  }
106  }
107 }
108 
110 {
111  // We want to find out which images cover the point underneath the mouse
112  // pointer.
113  images_under_mouse.clear();
114  if (IsMouseOverPano())
115  {
117  };
119 }
120 
122 {
123  HuginBase::UIntSet imgUnderPos;
124  const unsigned int num_images = pano->getNrOfImages();
125  HuginBase::UIntSet displayedImages = pano->getActiveImages();
126  for (unsigned int image_index = 0; image_index < num_images; image_index++)
127  {
128  // don't try any images that are turned off
129  if (set_contains(displayedImages, image_index))
130  {
131  // work out if the image covers the point under the mouse.
133  transform.createTransform(*visualization_state->GetSrcImage(image_index),
135  double image_x, image_y;
136  transform.transformImgCoord(image_x, image_y, pos.x, pos.y);
137  if (visualization_state->getViewState()->GetSrcImage(image_index)->isInside(vigra::Point2D(
138  int(image_x), int(image_y))))
139  {
140  // this image is under the position, add it to the set.
141  imgUnderPos.insert(image_index);
142  };
143  };
144  };
145  return imgUnderPos;
146 }
147 
148 void ToolHelper::MouseButtonEvent(wxMouseEvent &e)
149 {
150  for (auto& tool : mouse_button_notified_tools)
151  {
152  tool->MouseButtonEvent(e);
153  }
154 }
155 
156 void ToolHelper::MouseWheelEvent(wxMouseEvent &e)
157 {
158  for (auto& tool : mouse_wheel_notified_tools)
159  {
160  tool->MouseWheelEvent(e);
161  }
162 }
163 
164 
165 void ToolHelper::KeypressEvent(int keycode, int modifiers, bool pressed)
166 {
167  for (auto& tool : keypress_notified_tools)
168  {
169  tool->KeypressEvent(keycode, modifiers, pressed);
170  }
171 }
172 
174 {
175  // let all tools that want to draw under the images do so.
176  for (auto& tool : draw_under_notified_tools)
177  {
178  tool->BeforeDrawImagesEvent();
179  }
180  // Since we are drawing a new frame, lets assume something has changed,
181  // however we want to keep with no images under the mouse if the mouse is
182  // not on the panorama.
183  if (mouse_over_pano)
184  {
186  }
187 }
188 
190 {
191  // let all tools that want to draw on top of the images do so.
192  for (auto& tool : draw_over_notified_tools)
193  {
194  tool->AfterDrawImagesEvent();
195  }
196  // The overlays are done separetly to avoid errors with blending order.
197  for (auto& tool : really_draw_over_notified_tools)
198  {
199  tool->ReallyAfterDrawImagesEvent();
200  }
201 }
202 
204 {
205  // let all tools that want to draw on top of the images do so.
206  for (auto& tool : m_tools_need_dirty_flag)
207  {
208  tool->MarkDirty();
209  }
210 }
211 
212 bool ToolHelper::BeforeDrawImageNumber(unsigned int image)
213 {
214  if (image_draw_begin_tools.size() > image)
215  {
216  if (!image_draw_begin_tools[image].empty())
217  {
218  bool result = true;
219  // BeforeDrawImageEvent can change image_draw_begin_tools[image]
220  // so we create a copy before to process all dependent tools, also
221  // when the set is modified in the BeforeDrawImageEvent function
222  const auto tools = image_draw_begin_tools[image];
223  for (auto tool : tools)
224  {
225  result &= tool->BeforeDrawImageEvent(image);
226  };
227  return result;
228  }
229  }
230  return true;
231 }
232 
233 void ToolHelper::AfterDrawImageNumber(unsigned int image)
234 {
235  if (image_draw_end_tools.size() > image)
236  {
237  if (!image_draw_end_tools[image].empty())
238  {
239  const auto tools = image_draw_end_tools[image];
240  for (auto tool : tools)
241  {
242  tool->BeforeDrawImageEvent(image);
243  }
244  }
245  }
246 }
247 
248 void ToolHelper::MouseEnter(int x, int y, wxMouseEvent &e)
249 {
250  // You might expect that this is redundant, because any MouseEnter will be
251  // accompanied by a MouseMove, which will achieve the same ends. However,
252  // this is not so. It's possible for the mouse to enter without moving.
253  // Morevover, some environments will trigger a MouseLeave+MouseEnter just
254  // before a MouseButton event; handling this is particularly critical for
255  // such cases.
256  mouse_over_pano = true;
257  mouse_screen_x = x;
258  mouse_screen_y = y;
259  // If the mouse has moved, then we don't know what is underneath it anoymore
261 }
262 
264 {
265  // if the mouse leaves the preview, there are no images under the mouse
266  // pointer anymore.
267  mouse_over_pano = false;
268  images_under_mouse.clear();
271  {
272  // notify tools that the set has changed.
273  for (auto& tool : images_under_mouse_notified_tools)
274  {
275  tool->ImagesUnderMouseChangedEvent();
276  }
277  }
278 }
279 
280 
282 {
284  {
286  }
287  return images_under_mouse;
288 }
289 
291 {
293 }
294 
296 {
298 }
299 
301 {
302  return visualization_state;
303 }
304 
306 {
308 }
309 
311 {
312  return pano;
313 }
314 
315 void ToolHelper::NotifyMe(Event event, Tool *tool)
316 {
317  switch (event)
318  {
319  case MOUSE_MOVE:
321  break;
322  case MOUSE_PRESS:
324  break;
325  case MOUSE_WHEEL:
327  break;
328  case KEY_PRESS:
330  break;
331  case DRAW_UNDER_IMAGES:
333  break;
334  case DRAW_OVER_IMAGES:
336  break;
339  break;
342  break;
343  case MARK_DIRTY:
345  break;
346  }
347 }
348 
349 void ToolHelper::NotifyMeBeforeDrawing(unsigned int image_nr,
350  Tool *tool)
351 {
352  AddTool(tool, &image_draw_begin_tools, image_nr);
353 }
354 
355 void ToolHelper::NotifyMeAfterDrawing(unsigned int image_nr,
356  Tool *tool)
357 {
358  AddTool(tool, &image_draw_end_tools, image_nr);
359 }
360 
362 {
363  // TODO we should probably check that the tools have the notification they
364  // are trying to give up, as misbehaving tools could break another tool.
365  switch (event)
366  {
367  case MOUSE_MOVE:
369  break;
370  case MOUSE_PRESS:
372  break;
373  case MOUSE_WHEEL:
375  break;
376  case KEY_PRESS:
378  break;
379  case DRAW_UNDER_IMAGES:
381  break;
382  case DRAW_OVER_IMAGES:
384  break;
387  break;
390  break;
391  case MARK_DIRTY:
393  break;
394  }
395 }
396 
397 void ToolHelper::DoNotNotifyMeBeforeDrawing(unsigned int image_nr,
398  Tool *tool)
399 {
400  RemoveTool(tool, &image_draw_begin_tools, image_nr);
401 }
402 
403 void ToolHelper::DoNotNotifyMeAfterDrawing(unsigned int image_nr,
404  Tool *tool)
405 {
406  RemoveTool(tool, &image_draw_end_tools, image_nr);
407 }
408 
409 void ToolHelper::SetStatusMessage(wxString message)
410 {
411  // get the GLPreviewFrame to set its status bar's text.
412  frame->SetStatusMessage(message);
413 }
414 
415 
416 // These functions remove tools from various things that keep pointers to them
417 // so that they can be notified. They are called when we don't want to notify
418 // them anymore.
419 
420 void ToolHelper::RemoveTool(Tool *tool, Tool **single)
421 {
422  if (*single == tool)
423  {
424  *single = 0;
425  }
426 }
427 
429  std::set<Tool *> *set)
430 {
431  auto foundTool = set->find(tool);
432  if (foundTool != set->end())
433  {
434  set->erase(foundTool);
435  }
436 }
437 
439  std::vector<std::set<Tool *> > *vector)
440 {
441  // check every item for presence.
442  for (unsigned int image = 0; image < vector->size(); image++)
443  {
444  (*vector)[image].erase(tool);
445  }
446 }
447 
449  std::vector<std::set<Tool *> > *vector,
450  unsigned int index)
451 {
452  if (vector->size() > index)
453  {
454  (*vector)[index].erase(tool);
455  }
456 }
457 
458 void ToolHelper::AddTool(Tool *tool, Tool **single)
459 {
460  if (*single != 0 || *single == tool)
461  {
462  DeactivateTool(*single);
463  }
464  *single = tool;
465 }
466 
467 void ToolHelper::AddTool(Tool *tool, std::set<Tool *> *set)
468 {
469  set->insert(tool);
470 }
471 
473  std::vector<std::set<Tool *> > *vector,
474  unsigned int index)
475 {
476  if (vector->size() < index + 1)
477  {
478  // increase the size of the vector to handle enough elements for index
479  // to exist
480  vector->resize(index + 1, std::set<Tool*>());
481  }
482 // else if ((*vector)[index] && (*vector)[index] != tool)
483 // {
484 // // if a different tool already was doing this, deactivate it.
485 // DeactivateTool((*vector)[index]);
486 // };
487 // (*vector)[index] = tool;
488  (*vector)[index].insert(tool);
489 }
490 
491 
492 void PreviewToolHelper::MouseMoved(int x, int y, wxMouseEvent &e)
493 {
494  mouse_over_pano = true;
495  mouse_screen_x = x;
496  mouse_screen_y = y;
497  // work out where the pointer is in the panorama.
498  vigra::Rect2D visible = visualization_state->GetVisibleArea();
499  mouse_pano_x = (double) x / visualization_state->GetScale() + (double) visible.left();
500  mouse_pano_y = (double) y / visualization_state->GetScale() + (double) visible.top();
501  // now tell tools that want notification.
502  for (auto& tool : mouse_move_notified_tools)
503  {
504  tool->MouseMoveEvent(mouse_pano_x, mouse_pano_y, e);
505  }
506  // If the mouse has moved, then we don't know what is underneath it anoymore
508 }
509 
510 void PanosphereOverviewToolHelper::MouseMoved(int x, int y, wxMouseEvent & e)
511 {
513 
514  double d = panostate->getR();
515  double r = panostate->getSphereRadius();
516 
517  int tcanv_w, tcanv_h;
518  panostate->GetViewer()->GetClientSize(&tcanv_w,&tcanv_h);
519 
520  double canv_w, canv_h;
521  canv_w = tcanv_w;
522  canv_h = tcanv_h;
523 
524  const double fov = panostate->getFOV();
525  double fovScale = 1.0;
526 
527  double fovy, fovx;
528  if (canv_w > canv_h)
529  {
530  fovy = DEG_TO_RAD(fov);
531  fovx = 2 * atan(tan(fovy / 2.0) * canv_w / canv_h);
532  fovScale = tan(fovy / 2.0) / (0.5 * canv_h);
533  }
534  else
535  {
536  fovx = DEG_TO_RAD(fov);
537  fovy = 2 * atan(tan(fovx / 2.0) * canv_h / canv_w);
538  fovScale = tan(fovx / 2.0) / (0.5 * canv_w);
539  };
540 
541  if (panostate->isInsideView())
542  {
543  // we are looking from inside, mouse is always about the panosphere
544  mouse_over_pano = true;
545  const double xSrc = (x - canv_w / 2.0) * fovScale;
546  const double ySrc = (canv_h / 2.0 - y) * fovScale;
547  const double yaw = atan(xSrc) + panostate->getAngX() + M_PI / 2.0;
548  const double pitch = M_PI/2.0 - atan2(ySrc, std::sqrt(1.0 + xSrc * xSrc)) - panostate->getAngY();
549  //if (yaw < 0) yaw += 2 * M_PI;
550  //if (yaw > 2 * M_PI) yaw -= 2 * M_PI;
551  mouse_pano_x = yaw / (2 * M_PI) * panostate->GetOptions()->getWidth();
552  mouse_pano_y = pitch / (M_PI)*panostate->GetOptions()->getHeight();
553  }
554  else
555  {
556  // we are looking from outside, more calculation to find position needed
557  const double ax = tan(fovx / 2.0) * d * (x / (canv_w / 2.0) - 1);
558  const double ay = tan(fovy / 2.0) * d * (y / (canv_h / 2.0) - 1);
559 
560  const double a_limit = r * d / sqrt(d * d - r * r);
561 
562  if (ax * ax + ay * ay < a_limit * a_limit)
563  {
564  mouse_over_pano = true;
565 
566  const double ta = (ax * ax + ay * ay) / (d * d) + 1;
567  const double tb = -2 * (ax * ax + ay * ay) / d;
568  const double tc = ax * ax + ay * ay - r * r;
569 
570  const double pz = (-tb + sqrt(tb * tb - 4 * ta * tc)) / (2 * ta);
571  const double px = ax * (d - pz) / d;
572  const double py = ay * (d - pz) / d;
573 
574  const double pl = sqrt(px * px + py * py + pz * pz);
575 
576  const double pang_yaw = -atan(px / pz);
577  const double pang_pitch = asin(py / pl);
578 
579  const double ang_yaw = panostate->getAngX();
580  const double ang_pitch = panostate->getAngY();
581 
582  const double x = sin(ang_yaw) * cos(ang_pitch);
583  const double z = cos(ang_yaw) * cos(ang_pitch);
584  const double y = sin(ang_pitch);
585 
586  const Vector3 vec(x, y, z);
587 
588  const Vector3 top(0, 1, 0);
589 
590  const Vector3 ptop = vec.Cross(top).Cross(vec).GetNormalized();
591 
592  Vector3 tres;
593  tres.x = ptop.x * (ptop.x * vec.x + ptop.y * vec.y + ptop.z * vec.z) + cos(pang_yaw) * (ptop.x * (-ptop.y * vec.y - ptop.z * vec.z) + vec.x * (ptop.y * ptop.y + ptop.z * ptop.z)) + sin(pang_yaw) * (-ptop.z * vec.y + ptop.y * vec.z);
594  tres.y = ptop.y * (ptop.x * vec.x + ptop.y * vec.y + ptop.z * vec.z) + cos(pang_yaw) * (ptop.y * (-ptop.x * vec.x - ptop.z * vec.z) + vec.y * (ptop.x * ptop.x + ptop.z * ptop.z)) + sin(pang_yaw) * (-ptop.z * vec.x + ptop.x * vec.z);
595  tres.z = ptop.z * (ptop.x * vec.x + ptop.y * vec.y + ptop.z * vec.z) + cos(pang_yaw) * (ptop.z * (-ptop.x * vec.x - ptop.y * vec.y) + vec.z * (ptop.x * ptop.x + ptop.y * ptop.y)) + sin(pang_yaw) * (-ptop.y * vec.x + ptop.x * vec.y);
596 
597  const Vector3 pside = ptop.Cross(tres).GetNormalized();
598  Vector3 res;
599 
600  res.x = pside.x * (pside.x * tres.x + pside.y * tres.y + pside.z * tres.z) + cos(pang_pitch) * (pside.x * (-pside.y * tres.y - pside.z * tres.z) + tres.x * (pside.y * pside.y + pside.z * pside.z)) + sin(pang_pitch) * (-pside.z * tres.y + pside.y * tres.z);
601  res.y = pside.y * (pside.x * tres.x + pside.y * tres.y + pside.z * tres.z) + cos(pang_pitch) * (pside.y * (-pside.x * tres.x - pside.z * tres.z) + tres.y * (pside.x * pside.x + pside.z * pside.z)) + sin(-pang_pitch) * (-pside.z * tres.x + pside.x * tres.z);
602  res.z = pside.z * (pside.x * tres.x + pside.y * tres.y + pside.z * tres.z) + cos(pang_pitch) * (pside.z * (-pside.x * tres.x - pside.y * tres.y) + tres.z * (pside.x * pside.x + pside.y * pside.y)) + sin(pang_pitch) * (-pside.y * tres.x + pside.x * tres.y);
603 
604  double yaw, pitch;
605  pitch = asin(res.y);
606  yaw = atan2(res.x, res.z);
607 
608  yaw += M_PI / 2.0;
609  if (yaw < 0) yaw += 2 * M_PI;
610  if (yaw > 2 * M_PI) yaw -= 2 * M_PI;
611 
612  pitch += M_PI / 2.0;
613  pitch = M_PI - pitch;
614 
615  mouse_pano_x = yaw / (2 * M_PI) * panostate->GetOptions()->getWidth();
616  mouse_pano_y = pitch / (M_PI)*panostate->GetOptions()->getHeight();
617 
619  // cerr << "mouse " << mouse_pano_x << " " << mouse_pano_y << " ; " << canv_w << " " << canv_h);
620  // double t_mouse_pano_x = yaw M
621  }
622  else
623  {
624  mouse_over_pano = false;
625  };
626  };
627 
628  ToolHelper::MouseMoved(x,y,e);
629 }
630 
632  VisualizationState *visualization_state,
633  GLPreviewFrame * frame) : OverviewToolHelper(pano, visualization_state, frame) {}
634 
636 
638  switch (event) {
641  break;
644  break;
647  break;
650  break;
651  }
652 }
653 
655  switch (event) {
658  break;
661  break;
664  break;
667  break;
668  }
669 }
670 
672 {
673  for (auto& tool : draw_under_notified_tools_back)
674  {
675  static_cast<PanosphereOverviewTool*>(tool)->BeforeDrawImagesBackEvent();
676  }
677 }
678 
680 {
681  for (auto& tool : draw_under_notified_tools_front)
682  {
683  static_cast<PanosphereOverviewTool*>(tool)->BeforeDrawImagesFrontEvent();
684  }
685 }
686 
688 {
689  for (auto& tool : draw_over_notified_tools_back)
690  {
691  static_cast<PanosphereOverviewTool*>(tool)->AfterDrawImagesBackEvent();
692  }
693 }
694 
696 {
697  for (auto& tool : draw_over_notified_tools_front)
698  {
699  static_cast<PanosphereOverviewTool*>(tool)->AfterDrawImagesFrontEvent();
700  }
701 }
702 
704 {
706 
711 }
712 
713 
715  VisualizationState *visualization_state,
716  GLPreviewFrame * frame) : OverviewToolHelper(pano, visualization_state, frame) {}
717 
719 
720 void PlaneOverviewToolHelper::MouseMoved(int x, int y, wxMouseEvent & e)
721 {
722 
724 
725  double d = panostate->getR();
726 
727  int tcanv_w, tcanv_h;
728  panostate->GetViewer()->GetClientSize(&tcanv_w,&tcanv_h);
729 
730  double canv_w, canv_h;
731  canv_w = tcanv_w;
732  canv_h = tcanv_h;
733 
734  double fov = panostate->getFOV();
735 
736  double fovy, fovx;
737  if (canv_w > canv_h) {
738  fovy = DEG_TO_RAD(fov);
739  fovx = 2 * atan( tan(fovy / 2.0) * canv_w / canv_h);
740  } else {
741  fovx = DEG_TO_RAD(fov);
742  fovy = 2 * atan( tan(fovx / 2.0) * canv_h / canv_w);
743  }
744 
745  double vis_w, vis_h;
746  vis_w = 2.0 * tan ( fovx / 2.0 ) * d;
747  vis_h = 2.0 * tan ( fovy / 2.0 ) * d;
748 
749  //position of the mouse on the z=0 plane
750  double prim_x, prim_y;
751  prim_x = (double) x / canv_w * vis_w - vis_w / 2.0 + panostate->getX();
752  prim_y = ((double) y / canv_h * vis_h - vis_h / 2.0 - panostate->getY());
753 
754 // std::cout << "mouse ov" << plane_x << " " << plane_y << std::endl;
755  plane_x = prim_x;
756  plane_y = prim_y;
757 
758  double width, height;
759  HuginBase::PanoramaOptions * opts = panostate->GetOptions();
760  width = opts->getWidth();
761  height = opts->getHeight();
762 
763  mouse_pano_x = prim_x / MeshManager::PlaneOverviewMeshInfo::scale * width + width / 2.0;
764  mouse_pano_y = prim_y / MeshManager::PlaneOverviewMeshInfo::scale * width + height / 2.0;
765 
766 // std::cout << "plane mouse " << mouse_pano_x << " " << mouse_pano_y << " ; " << prim_x << " " << prim_y << " ; " << width << " " << height << std::endl;
767 // cerr << "plane mouse " << mouse_pano_x << " " << mouse_pano_y);
768 
769  mouse_over_pano = true;
770 
771  ToolHelper::MouseMoved(x,y,e);
772 }
773 
774 
775 
double y
Definition: Vector3.h:47
hugin_utils::FDiff2D GetMousePanoPosition()
Definition: ToolHelper.cpp:295
void MouseWheelEvent(wxMouseEvent &e)
Definition: ToolHelper.cpp:156
std::set< Tool * > ActivateTool(Tool *tool)
Definition: ToolHelper.cpp:53
std::set< Tool * > m_tools_need_dirty_flag
Definition: ToolHelper.h:159
void AfterDrawImageNumber(unsigned int image)
Definition: ToolHelper.cpp:233
void SetStatusMessage(wxString message)
The OpenGL preview frame.
ViewState * GetViewStatePtr()
Definition: ToolHelper.cpp:305
virtual void Activate()=0
Switch on a tool.
std::set< Tool * > draw_under_notified_tools_back
Definition: ToolHelper.h:231
void NotifyMeBeforeDrawing(unsigned int image_nr, Tool *tool)
Definition: ToolHelper.cpp:349
Vector3 GetNormalized() const
return a normalized vector
Definition: Vector3.cpp:95
void AfterDrawImages()
Definition: ToolHelper.cpp:189
std::vector< std::set< Tool * > > image_draw_begin_tools
Definition: ToolHelper.h:161
HuginBase::Panorama * pano
Definition: ToolHelper.h:143
void RemoveTool(Tool *tool, Tool **single)
Definition: ToolHelper.cpp:420
unsigned int getHeight() const
get panorama height
HuginBase::Panorama * GetPanoramaPtr()
Definition: ToolHelper.cpp:310
void MouseMoved(int x, int y, wxMouseEvent &e)
Definition: ToolHelper.cpp:720
virtual void DeactivateTool(Tool *tool)
Definition: ToolHelper.cpp:60
bool set_contains(const _Container &c, const typename _Container::key_type &key)
Definition: stl_utils.h:74
GLPreviewFrame * frame
Definition: ToolHelper.h:145
void DoNotNotifyMeAfterDrawing(unsigned int image_nr, Tool *tool)
Definition: ToolHelper.cpp:403
void NotifyMe(Event event, Tool *tool)
Definition: ToolHelper.cpp:315
std::set< unsigned int > GetImageNumbersUnderMouse()
Definition: ToolHelper.cpp:281
void UpdateImagesUnderMouse()
Definition: ToolHelper.cpp:109
bool isInside(vigra::Point2D p, bool ignoreMasks=false) const
check if a coordinate is inside the source image
bool mouse_over_pano
Definition: ToolHelper.h:176
VisualizationState * visualization_state
Definition: ToolHelper.h:144
bool images_under_mouse_current
Definition: ToolHelper.h:176
void DeactivateTool(Tool *tool)
Definition: ToolHelper.cpp:703
std::vector< std::set< Tool * > > image_draw_end_tools
Definition: ToolHelper.h:162
ToolHelper(HuginBase::Panorama *pano, VisualizationState *visualization_state, GLPreviewFrame *frame)
Definition: ToolHelper.cpp:34
VisualizationState * GetVisualizationStatePtr()
Definition: ToolHelper.cpp:300
void DoNotNotifyMe(PanosphereOverviewEvent event, PanosphereOverviewTool *tool)
Definition: ToolHelper.cpp:654
hugin_utils::FDiff2D GetMouseScreenPosition()
Definition: ToolHelper.cpp:290
std::set< unsigned int > UIntSet
Definition: PanoramaData.h:51
bool BeforeDrawImageNumber(unsigned int image)
Definition: ToolHelper.cpp:212
double mouse_pano_y
Definition: ToolHelper.h:148
PlaneOverviewToolHelper(HuginBase::Panorama *pano, VisualizationState *visualization_state, GLPreviewFrame *frame)
Definition: ToolHelper.cpp:714
Model for a panorama.
Definition: Panorama.h:152
void DoNotNotifyMeBeforeDrawing(unsigned int image_nr, Tool *tool)
Definition: ToolHelper.cpp:397
void MouseEnter(int x, int y, wxMouseEvent &e)
Definition: ToolHelper.cpp:248
std::set< Tool * > mouse_move_notified_tools
Definition: ToolHelper.h:151
std::set< Tool * > draw_under_notified_tools
Definition: ToolHelper.h:154
Definition: Tool.h:42
virtual HuginBase::SrcPanoImage * GetSrcImage(unsigned int image_nr)
Definition: ViewState.cpp:478
std::size_t getNrOfImages() const
number of images.
Definition: Panorama.h:205
vigra::Rect2D GetVisibleArea()
Definition: ViewState.h:222
bool IsMouseOverPano()
Definition: ToolHelper.h:136
std::set< Tool * > draw_over_notified_tools_front
Definition: ToolHelper.h:234
std::set< Tool * > mouse_wheel_notified_tools
Definition: ToolHelper.h:158
std::set< Tool * > really_draw_over_notified_tools
Definition: ToolHelper.h:156
virtual ~ToolHelper()
Definition: ToolHelper.cpp:49
void NotifyMe(PanosphereOverviewEvent event, PanosphereOverviewTool *tool)
Definition: ToolHelper.cpp:637
double mouse_screen_x
Definition: ToolHelper.h:147
void MouseButtonEvent(wxMouseEvent &e)
Definition: ToolHelper.cpp:148
std::set< Tool * > tools_deactivated
Definition: ToolHelper.h:142
double mouse_screen_y
Definition: ToolHelper.h:147
std::set< Tool * > keypress_notified_tools
Definition: ToolHelper.h:153
std::set< unsigned int > images_under_mouse
Definition: ToolHelper.h:178
TDiff2D< double > FDiff2D
Definition: hugin_math.h:150
Vector3 Cross(const Vector3 &v) const
cross product
Definition: Vector3.h:163
std::set< Tool * > images_under_mouse_notified_tools
Definition: ToolHelper.h:157
void KeypressEvent(int keycode, int modifiers, bool pressed)
Definition: ToolHelper.cpp:165
ViewState * getViewState()
Definition: ViewState.h:239
UIntSet getActiveImages() const
get active images
Definition: Panorama.cpp:1585
std::set< Tool * > draw_over_notified_tools_back
Definition: ToolHelper.h:233
unsigned int getWidth() const
bool transformImgCoord(double &x_dest, double &y_dest, double x_src, double y_src) const
like transform, but return image coordinates, not cartesian coordinates
std::set< Tool * > draw_under_notified_tools_front
Definition: ToolHelper.h:232
void DoNotNotifyMe(Event event, Tool *tool)
Definition: ToolHelper.cpp:361
void NotifyMeAfterDrawing(unsigned int image_nr, Tool *tool)
Definition: ToolHelper.cpp:355
double z
Definition: Vector3.h:47
void MouseMoved(int x, int y, wxMouseEvent &e)
Definition: ToolHelper.cpp:492
virtual HuginBase::PanoramaOptions * GetOptions()
Definition: ViewState.cpp:468
void MouseLeave()
Definition: ToolHelper.cpp:263
Holds transformations for Image -&gt; Pano and the other way.
void InvalidateImagesUnderMouse()
Definition: ToolHelper.cpp:88
GLViewer * GetViewer()
Definition: ViewState.h:251
virtual void MouseMoved(int x, int y, wxMouseEvent &e)
Definition: ToolHelper.cpp:75
void SetStatusMessage(wxString message)
Definition: ToolHelper.cpp:409
HuginBase::PanoramaOptions * GetOptions()
Definition: ViewState.cpp:620
void MouseMoved(int x, int y, wxMouseEvent &e)
Definition: ToolHelper.cpp:510
#define DEG_TO_RAD(x)
Definition: hugin_math.h:44
general : Vector3 is a class for handling 3D Vectors manipulation.
Definition: Vector3.h:43
double mouse_pano_x
Definition: ToolHelper.h:148
double x
x,y,z coordinates, 0 at the initialisation
Definition: Vector3.h:47
HuginBase::SrcPanoImage * GetSrcImage(unsigned int image_nr)
Definition: ViewState.cpp:283
std::set< Tool * > draw_over_notified_tools
Definition: ToolHelper.h:155
Panorama image options.
#define M_PI
Definition: GaborFilter.cpp:34
PanosphereOverviewToolHelper(HuginBase::Panorama *pano, VisualizationState *visualization_state, GLPreviewFrame *frame)
Definition: ToolHelper.cpp:631
void AddTool(Tool *tool, Tool **single)
Definition: ToolHelper.cpp:458
void BeforeDrawImages()
Definition: ToolHelper.cpp:173
std::set< Tool * > mouse_button_notified_tools
Definition: ToolHelper.h:152
void createTransform(const vigra::Diff2D &srcSize, VariableMap srcVars, Lens::LensProjectionFormat srcProj, const vigra::Diff2D &destSize, PanoramaOptions::ProjectionFormat destProj, const std::vector< double > &destProjParam, double destHFOV, const vigra::Diff2D &origSrcSize)
initialize pano-&gt;image transformation
HuginBase::UIntSet GetImagesUnderPos(const hugin_utils::FDiff2D &pos)
Definition: ToolHelper.cpp:121
HuginBase::PanoramaOptions * GetOptions()
Definition: ViewState.cpp:548
void MarkDirty()
Definition: ToolHelper.cpp:203