70 , m_ReferenceImage(new
CGlTexture(img.GetNCPointer()) )
71 , m_ReferenceSubImage(
NULL)
73 , m_AspectRatio(-1.0
f)
83 m_ReferenceImage->SetTexEnv(GL_REPLACE);
85 m_RefImageSize =
CVect2<int>(
static_cast<int>(img->GetWidth()),
static_cast<int>(img->GetHeight()));
124 float w = image_width;
125 float h = image_height;
150 if (aspect_ratio >
r) {
259 wxCommandEvent evt(wxEVT_TILE_PREVIEW);
261 float x = (float)event.GetPosition().x;
262 float y = (float)(this->GetSize().GetY()-
event.GetPosition().y);
273 this->GetParent()->GetEventHandler()->ProcessEvent(evt);
283 wxCommandEvent evt(wxEVT_TILE_PREVIEW);
285 float x = (float)event.GetPosition().x;
286 float y = (float)(this->GetSize().GetY()-
event.GetPosition().y);
297 this->GetParent()->GetEventHandler()->ProcessEvent(evt);
316 glEnable(GL_TEXTURE_2D);
317 glDisable(GL_LIGHTING);
320 glViewport(0, 0, w, h);
321 float image_aspect = ((float)w)/(float)h;
323 glClearColor(0.5f, 0.5f, 0.5f, 0.0f);
324 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
325 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
327 glMatrixMode(GL_MODELVIEW);
331 glMatrixMode(GL_PROJECTION);
334 gluOrtho2D(0.0, (GLdouble)w, 0.0, (GLdouble)h);
354 if (partitioned_aspect > image_aspect) {
356 float single_tile_height = ((float)h)/(float)(
m_PartitionsY + 1);
358 scale = ((float)w)/(single_tile_width*(float)(
m_PartitionsX+1));
361 tiled_h = scale*(float)h;
362 tiled_w = tiled_h*partitioned_aspect;
367 float single_tile_width = ((float)w)/(float)(
m_PartitionsX + 1);
368 float single_tile_height = (1.0f/
m_AspectRatio)*single_tile_width;
369 scale = ((float)h)/(single_tile_height*(float)(
m_PartitionsY+1));
372 tiled_w = scale*(float)w;
373 tiled_h = tiled_w*(1.0f/partitioned_aspect);
387 int image_w = tiled_w;
388 int image_h = tiled_h;
389 float bottom_offset = h-(float)image_h;
396 glTexCoord2f(0.0f, 0.0f);
397 glVertex3f(0.0f, bottom_offset, 0.0f);
399 glTexCoord2f(1.0f, 0.0f);
400 glVertex3f((
float)image_w, bottom_offset, 0.0f);
402 glTexCoord2f(1.0f, 1.0f);
403 glVertex3f((
float)image_w, bottom_offset + (
float)image_h, 0.0f);
405 glTexCoord2f(0.0f, 1.0f);
406 glVertex3f(0.0f, bottom_offset + (
float)image_h, 0.0f);
411 glTexCoord2f(1.0f, 0.0f);
412 glVertex3f(0.0f, bottom_offset, 0.0f);
414 glTexCoord2f(1.0f, 1.0f);
415 glVertex3f((
float)image_w, bottom_offset, 0.0f);
417 glTexCoord2f(0.0f, 1.0f);
418 glVertex3f((
float)image_w, bottom_offset + (
float)image_h, 0.0f);
420 glTexCoord2f(0.0f, 0.0f);
421 glVertex3f(0.0f, bottom_offset + (
float)image_h, 0.0f);
425 glDisable(GL_TEXTURE_2D);
427 glColor3f(1.0f, 0.0f, 0.0f);
460 float font_width = (float)name_font.
TextWidth(img_name.c_str());
465 for (fsize=10; fsize<36; fsize+=2) {
467 font_width = (float)name_font.
TextWidth(img_name.c_str());
477 font_width = (float)name_font.
TextWidth(img_name.c_str());
489 font_width = (float)name_font.
TextWidth(
"Saved");
492 for (fsize=10; fsize<36; fsize+=2) {
494 font_width = (float)saved_font.
TextWidth(
"Saved");
505 float saved_font_xdelta = saved_font_xpos - pos.
X();
508 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
536 glColor4f(0.0f, 0.0f, 1.0f, 0.5f);
537 name_font.
TextOut(pos.
X(), pos.
Y(), img_name.c_str());
542 glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
545 glBegin(GL_LINE_LOOP);
546 glVertex2f(rect_pos.
X(), rect_pos.
Y());
557 glColor4f(1.0f, 0.1f, 0.1f, 1.0f);
558 float posy = pos.
Y() - (saved_font.
TextHeight() + 3);
559 float posx = pos.
X() + saved_font_xdelta;
560 saved_font.
TextOut(posx, posy,
"Saved");
561 glColor4f(0.0f, 0.0f, 1.0f, 0.5f);
563 glColor4f(0.1f, 0.1f, 0.1f, 0.2f);
565 glVertex2f(rect_pos.
X(), rect_pos.
Y());
571 glColor4f(0.0f, 0.0f, 1.0f, 0.5f);
588 float rwidth, rheight;
589 float ref_image_aspect = rw/rh;
591 if (ref_image_aspect > image_aspect) {
603 float originx = (((float)w)-rwidth)/2.0f;
604 float originy = (((float)h)-rheight)/2.0f;
606 glEnable(GL_TEXTURE_2D);
608 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
611 glTexCoord2f(0.0f, 0.0f);
612 glVertex3f(originx, originy, 0);
614 glTexCoord2f(1.0f, 0.0f);
615 glVertex3f(originx+rwidth, originy, 0);
617 glTexCoord2f(1.0f, 1.0f);
618 glVertex3f(originx+rwidth, originy+rheight, 0);
620 glTexCoord2f(0.0f, 1.0f);
621 glVertex3f(originx, originy+rheight, 0);
624 glColor4f(0.0f, 0.0f, 1.0f, 1.0f);
626 glDisable(GL_TEXTURE_2D);
628 glBegin(GL_LINE_LOOP);
629 glVertex3f(originx, originy, 0);
630 glVertex3f(originx+rwidth, originy, 0);
631 glVertex3f(originx+rwidth, originy+rheight, 0);
632 glVertex3f(originx, originy+rheight, 0);
635 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
639 glMatrixMode(GL_PROJECTION);
642 glMatrixMode(GL_MODELVIEW);
645 glDisable(GL_TEXTURE_2D);
size_t GetWidth(void) const
size_t GetHeight(void) const
GUI command routing and handling framework.
virtual void MakeCurrent()
virtual void SetFilterMag(GLenum f)
void SetFontFace(EFontFace face, bool use_bitmap_overrides=true)
const CImage * GetImage(void) const
static bool CheckGlError()
Check if there are any OpenGL errors.
virtual TModelUnit TextWidth(const char *text) const
Compute and return font metrics.
virtual TModelUnit TextHeight(void) const
virtual void SetFilterMin(GLenum f)
virtual void TextOut(const char *text) const
TextOut interface Write the specified text and set up state and transformation as needed.
void SetFontSize(unsigned int size)
Set/get font size in points.
void Swallow(CImage *image)
TObjectType * GetNCPointer(void) const THROWS_NONE
Get pointer,.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
const struct ncbi::grid::netcache::search::fields::SIZE size
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
double f(double x_, const double &y_)