00001
00022 #include "PreviewPanoMaskTool.h"
00023 #include <wx/platform.h>
00024 #ifdef __WXMAC__
00025 #include <OpenGL/gl.h>
00026 #else
00027 #include <GL/gl.h>
00028 #endif
00029
00030 PreviewPanoMaskTool::PreviewPanoMaskTool(PreviewToolHelper *helper)
00031 : PreviewTool(helper)
00032 {
00033 }
00034
00035 void PreviewPanoMaskTool::Activate()
00036 {
00037
00038
00039
00040 helper->NotifyMe(PreviewToolHelper::REALLY_DRAW_OVER_IMAGES, this);
00041 }
00042
00043 void PreviewPanoMaskTool::BeforeDrawImagesEvent()
00044 {
00045 }
00046
00047 void PreviewPanoMaskTool::ReallyAfterDrawImagesEvent()
00048 {
00049 switch (helper->GetViewStatePtr()->GetOptions()->getProjection())
00050 {
00051 case HuginBase::PanoramaOptions::SINUSOIDAL:
00052 helper->GetViewStatePtr()->GetTextureManager()->DisableTexture();
00053 glColor3f(0.0, 0.0, 0.0);
00054 {
00055
00056 OutputProjectionInfo *info = helper->GetViewStatePtr()->
00057 GetProjectionInfo();
00058 double x, y;
00059 glBegin(GL_QUAD_STRIP);
00060 for (double p = -90; p < 90; p += 1.0)
00061 {
00062 info->AngularToImage(x, y, -180.0, p);
00063 glVertex2d(x, y); glVertex2d(0.0, y);
00064 }
00065 glEnd();
00066 double width = helper->GetViewStatePtr()->GetOptions()->
00067 getSize().width();
00068 glBegin(GL_QUAD_STRIP);
00069 for (double p = -90; p < 90; p += 1.0)
00070 {
00071 info->AngularToImage(x, y, -180.0, p);
00072 glVertex2d(width - x, y); glVertex2d(width, y);
00073 }
00074 glEnd();
00075 }
00076 glEnable(GL_TEXTURE_2D);
00077 glColor3f(1.0, 1.0, 1.0);
00078 break;
00079 case HuginBase::PanoramaOptions::ALBERS_EQUAL_AREA_CONIC:
00080
00081
00082
00083 helper->GetViewStatePtr()->GetTextureManager()->DisableTexture();
00084 glColor3f(0.0, 0.0, 0.0);
00085 glStencilFunc(GL_EQUAL, 1, 1);
00086 glEnable(GL_TEXTURE_2D);
00087 glColor3f(1.0, 1.0, 1.0);
00088 break;
00089 default:
00090
00091
00092 glStencilFunc(GL_ALWAYS, 1, 1);
00093 break;
00094 }
00095 }
00096