Welcome to the NetCologne GmbH open source mirroring service!

This machine mirrors various open-source projects. 20 Gbit/s uplink.

If there are any issues or you want another project mirrored, please contact mirror-service -=AT=- netcologne DOT de !

ZoomGraphicContext class Reference
Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ZoomGraphicContext Class Reference

#include <zoom_graphic_context.hxx>

Inheritance diagram for ZoomGraphicContext:

Inheritance graph
[legend]
Collaboration diagram for ZoomGraphicContext:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ZoomGraphicContext ()
 ZoomGraphicContext (int x1_, int y1_, int x2_, int y2_)
void set_clip_rect (int x1_, int y1_, int x2_, int y2_)
void lock ()
void unlock ()
void draw_lines (std::vector< Line > &lines, Color color, int wide=0)
void draw_line (float x1, float y1, float x2, float y2, Color color, int wide=0)
void draw_rect (float x1, float y1, float x2, float y2, Color color)
void draw_circle (float x, float y, float r, Color color)
void draw_circles (std::vector< Circle > &circles, Color color)
void draw_fill_circle (float x, float y, float r, Color color)
void draw_fill_rect (float x1, float y1, float x2, float y2, Color color)
void draw_string (float x, float y, const std::string &str, Color color=Color(0xFFFFFFFF))
void draw_string_centered (float x, float y, const std::string &str, Color color=Color(0xFFFFFFFF))
int get_width ()
int get_height ()
void clear ()
void flip ()
void set_parent_gc (GraphicContext *gc)
bool zoom_in (int x, int y)
bool zoom_out (int x, int y)
void zoom_to (int x1, int y1, int x2, int y2)
GraphicContextget_parent_gc ()
void translate_offset (int x, int y)
void set_offset (float x, float y)
void move_to (float x, float y)
float get_x_offset ()
float get_y_offset ()
float get_zoom () const
bool set_zoom (const float &z)
float screen_to_world_x (float)
float screen_to_world_y (float)
float world_to_screen_x (float)
float world_to_screen_y (float)
Vector2d screen_to_world (const Vector2d &)
Vector2d world_to_screen (const Vector2d &)
void flip (int x1, int y1, int x2, int y2)

Detailed Description

A GraphicContext, that wraps another GraphicContext and adds coordinate translation like zoom and scrolling

Definition at line 28 of file zoom_graphic_context.hxx.


Constructor & Destructor Documentation

ZoomGraphicContext::ZoomGraphicContext  
 

Definition at line 26 of file zoom_graphic_context.cxx.

References GraphicContext::get_height(), GraphicContext::get_width(), and graphic_context.

ZoomGraphicContext::ZoomGraphicContext int    x1_,
int    y1_,
int    x2_,
int    y2_
 

Definition at line 38 of file zoom_graphic_context.cxx.


Member Function Documentation

void ZoomGraphicContext::clear   [inline, virtual]
 

Implements GraphicContext.

Definition at line 69 of file zoom_graphic_context.hxx.

References GraphicContext::clear().

void ZoomGraphicContext::draw_circle float    x,
float    y,
float    r,
Color    color
[virtual]
 

Implements GraphicContext.

Definition at line 153 of file zoom_graphic_context.cxx.

References GraphicContext::draw_circle(), world_to_screen_x(), and world_to_screen_y().

void ZoomGraphicContext::draw_circles std::vector< Circle > &    circles,
Color    color
[virtual]
 

Implements GraphicContext.

Definition at line 140 of file zoom_graphic_context.cxx.

References GraphicContext::draw_circles(), Math::max(), and world_to_screen_x().

void ZoomGraphicContext::draw_fill_circle float    x,
float    y,
float    r,
Color    color
[virtual]
 

Implements GraphicContext.

Definition at line 162 of file zoom_graphic_context.cxx.

References GraphicContext::draw_fill_circle(), world_to_screen_x(), and world_to_screen_y().

void ZoomGraphicContext::draw_fill_rect float    x1,
float    y1,
float    x2,
float    y2,
Color    color
[virtual]
 

Implements GraphicContext.

Definition at line 171 of file zoom_graphic_context.cxx.

References GraphicContext::draw_fill_rect(), world_to_screen_x(), and world_to_screen_y().

Referenced by WorldViewSelectTool::draw_foreground().

void ZoomGraphicContext::draw_line float    x1,
float    y1,
float    x2,
float    y2,
Color    color,
int    wide = 0
[virtual]
 

Implements GraphicContext.

Definition at line 120 of file zoom_graphic_context.cxx.

References GraphicContext::draw_line(), world_to_screen_x(), and world_to_screen_y().

Referenced by WorldViewComponent::draw(), WorldButton::draw(), and Particle::draw_velocity_vector().

void ZoomGraphicContext::draw_lines std::vector< Line > &    lines,
Color    color,
int    wide = 0
[virtual]
 

Implements GraphicContext.

Definition at line 107 of file zoom_graphic_context.cxx.

References GraphicContext::draw_lines(), world_to_screen_x(), and world_to_screen_y().

Referenced by World::draw_springs().

void ZoomGraphicContext::draw_rect float    x1,
float    y1,
float    x2,
float    y2,
Color    color
[virtual]
 

Implements GraphicContext.

Definition at line 130 of file zoom_graphic_context.cxx.

References GraphicContext::draw_rect(), world_to_screen_x(), and world_to_screen_y().

Referenced by WorldViewZoomTool::draw_foreground(), and WorldViewSelectTool::draw_foreground().

void ZoomGraphicContext::draw_string float    x,
float    y,
const std::string &    str,
Color    color = Color(0xFFFFFFFF)
[virtual]
 

Implements GraphicContext.

Definition at line 190 of file zoom_graphic_context.cxx.

References GraphicContext::draw_string(), world_to_screen_x(), and world_to_screen_y().

void ZoomGraphicContext::draw_string_centered float    x,
float    y,
const std::string &    str,
Color    color = Color(0xFFFFFFFF)
[virtual]
 

Implements GraphicContext.

Definition at line 181 of file zoom_graphic_context.cxx.

References GraphicContext::draw_string_centered(), world_to_screen_x(), and world_to_screen_y().

void ZoomGraphicContext::flip int    x1,
int    y1,
int    x2,
int    y2
[virtual]
 

Implements GraphicContext.

Definition at line 276 of file zoom_graphic_context.cxx.

void ZoomGraphicContext::flip   [inline, virtual]
 

FIXME: flip should be handled outsite of GraphicContext

Implements GraphicContext.

Definition at line 72 of file zoom_graphic_context.hxx.

References GraphicContext::flip().

int ZoomGraphicContext::get_height   [virtual]
 

Implements GraphicContext.

Definition at line 343 of file zoom_graphic_context.cxx.

Referenced by WorldButton::draw(), move_to(), and zoom_to().

GraphicContext* ZoomGraphicContext::get_parent_gc   [inline]
 

Allows a client application to make use of the partent GC in case it wants to draw elements which should not get scaled

Definition at line 82 of file zoom_graphic_context.hxx.

Referenced by Particle::draw(), WorldViewSelectTool::draw_foreground(), Particle::draw_highlight(), and Particle::draw_infos().

int ZoomGraphicContext::get_width   [virtual]
 

Implements GraphicContext.

Definition at line 337 of file zoom_graphic_context.cxx.

Referenced by WorldButton::draw(), move_to(), and zoom_to().

float ZoomGraphicContext::get_x_offset   [inline]
 

Definition at line 92 of file zoom_graphic_context.hxx.

Referenced by WorldViewComponent::on_tertiary_button_press().

float ZoomGraphicContext::get_y_offset   [inline]
 

Definition at line 93 of file zoom_graphic_context.hxx.

Referenced by WorldViewComponent::on_tertiary_button_press().

float ZoomGraphicContext::get_zoom   const [inline]
 

Definition at line 95 of file zoom_graphic_context.hxx.

Referenced by WorldViewSelectTool::draw_foreground(), WorldViewComponent::get_zoom(), WorldViewSelectTool::on_mouse_move(), and WorldViewComponent::on_mouse_move().

void ZoomGraphicContext::lock  
 

Sets the clipping rectangles needed for the GC

Definition at line 57 of file zoom_graphic_context.cxx.

References GraphicContext::set_clip_rect().

Referenced by WorldButton::draw().

void ZoomGraphicContext::move_to float    x,
float    y
 

Move to the given x and y world coordinates

Definition at line 255 of file zoom_graphic_context.cxx.

References get_height(), and get_width().

Vector2d ZoomGraphicContext::screen_to_world const Vector2d  
 

Definition at line 69 of file zoom_graphic_context.cxx.

References Vector2d::x, and Vector2d::y.

Referenced by WorldViewColliderTool::draw_background(), WorldViewInsertTool::draw_foreground(), WorldViewColliderTool::draw_foreground(), WorldViewSelectTool::on_button_press(), WorldViewColliderTool::on_mouse_move(), WorldViewColliderTool::on_primary_button_press(), WorldViewColliderTool::on_primary_button_release(), and WorldViewSelectTool::on_secondary_button_press().

float ZoomGraphicContext::screen_to_world_x float   
 

Definition at line 83 of file zoom_graphic_context.cxx.

Referenced by WorldViewInsertTool::draw_background(), WorldViewZoomTool::draw_foreground(), WorldViewSelectTool::draw_foreground(), WorldViewInsertTool::draw_foreground(), WorldViewInsertTool::on_delete_press(), WorldViewInsertTool::on_fix_press(), WorldViewZoomTool::on_primary_button_press(), WorldViewSelectTool::on_primary_button_press(), WorldViewInsertTool::on_primary_button_press(), WorldViewZoomTool::on_primary_button_release(), WorldViewComponent::on_tertiary_button_press(), zoom_in(), and zoom_out().

float ZoomGraphicContext::screen_to_world_y float   
 

Definition at line 89 of file zoom_graphic_context.cxx.

Referenced by WorldViewInsertTool::draw_background(), WorldViewZoomTool::draw_foreground(), WorldViewSelectTool::draw_foreground(), WorldViewInsertTool::draw_foreground(), WorldViewInsertTool::on_delete_press(), WorldViewInsertTool::on_fix_press(), WorldViewZoomTool::on_primary_button_press(), WorldViewSelectTool::on_primary_button_press(), WorldViewInsertTool::on_primary_button_press(), WorldViewZoomTool::on_primary_button_release(), WorldViewComponent::on_tertiary_button_press(), zoom_in(), and zoom_out().

void ZoomGraphicContext::set_clip_rect int    x1_,
int    y1_,
int    x2_,
int    y2_
[virtual]
 

Implements GraphicContext.

Definition at line 51 of file zoom_graphic_context.cxx.

References GraphicContext::set_clip_rect().

void ZoomGraphicContext::set_offset float    x,
float    y
 

Definition at line 269 of file zoom_graphic_context.cxx.

Referenced by GUIChildManager::draw(), and WorldViewComponent::on_mouse_move().

void ZoomGraphicContext::set_parent_gc GraphicContext   gc
 

Definition at line 199 of file zoom_graphic_context.cxx.

Referenced by WorldViewComponent::draw(), WorldButton::draw(), and GUIChildManager::draw().

bool ZoomGraphicContext::set_zoom const float &    z
 

Set the zoom factor, if zoom is to large/small false will returned and zoom will be set to lowest/highest possible value

Definition at line 286 of file zoom_graphic_context.cxx.

Referenced by zoom_in(), zoom_out(), and zoom_to().

void ZoomGraphicContext::translate_offset int    x,
int    y
 

Move the current position relativly x/y width

Definition at line 262 of file zoom_graphic_context.cxx.

Referenced by WorldViewComponent::scroll_down(), WorldViewComponent::scroll_left(), WorldViewComponent::scroll_right(), and WorldViewComponent::scroll_up().

void ZoomGraphicContext::unlock  
 

Resets the clipping to the old state

Definition at line 63 of file zoom_graphic_context.cxx.

References GraphicContext::get_height(), GraphicContext::get_width(), and GraphicContext::set_clip_rect().

Referenced by WorldButton::draw().

Vector2d ZoomGraphicContext::world_to_screen const Vector2d  
 

Definition at line 76 of file zoom_graphic_context.cxx.

References Vector2d::x, and Vector2d::y.

Referenced by Particle::draw(), WorldViewSelectTool::draw_foreground(), Particle::draw_highlight(), and Particle::draw_infos().

float ZoomGraphicContext::world_to_screen_x float   
 

Definition at line 95 of file zoom_graphic_context.cxx.

Referenced by draw_circle(), draw_circles(), draw_fill_circle(), draw_fill_rect(), draw_line(), draw_lines(), draw_rect(), draw_string(), and draw_string_centered().

float ZoomGraphicContext::world_to_screen_y float   
 

Definition at line 101 of file zoom_graphic_context.cxx.

Referenced by draw_circle(), draw_fill_circle(), draw_fill_rect(), draw_line(), draw_lines(), draw_rect(), draw_string(), and draw_string_centered().

bool ZoomGraphicContext::zoom_in int    x,
int    y
 

Definition at line 205 of file zoom_graphic_context.cxx.

References screen_to_world_x(), screen_to_world_y(), and set_zoom().

Referenced by WorldViewComponent::wheel_up().

bool ZoomGraphicContext::zoom_out int    x,
int    y
 

Definition at line 231 of file zoom_graphic_context.cxx.

References screen_to_world_x(), screen_to_world_y(), and set_zoom().

Referenced by WorldViewComponent::draw(), and WorldViewComponent::wheel_down().

void ZoomGraphicContext::zoom_to int    x1,
int    y1,
int    x2,
int    y2
 

Definition at line 309 of file zoom_graphic_context.cxx.

References get_height(), get_width(), and set_zoom().

Referenced by WorldViewComponent::draw(), WorldButton::draw(), and WorldViewZoomTool::on_primary_button_release().


The documentation for this class was generated from the following files:
Generated on Thu Jul 24 10:25:31 2003 for Construo by doxygen1.3-rc3