proland::EditorHandler Class Reference

An EventHandler to paint on terrains and pass edit events to one or more Editor objects. More...

#include <EditorHandler.h>

List of all members.

Public Member Functions

 EditorHandler (float relativeRadius)
 Creates a new EditorHandler.
bool hasEditors ()
 Returns true if this EditorHandler has associated Editor.
void addEditor (Editor *editor)
 Adds an Editor to this EditorHandler.
void removeEditor (Editor *editor)
 Removes an Editor from this EditorHandler.
void setActive (bool active)
 Activates or deactivates this EditorHandler.
void setActive (string group, bool active)
 Activates or deactivates the Editors that belong to 'group' inside this EditorHandler.
bool isActive (string group)
 True if any of the Editors that belong to 'group' is activated.
void reset ()
 Cancels all editing operations performed on the active Editors.
vec3d getPosition (int x, int y)
 Returns the world space point corresponding to the given screen coordinates.

Public Attributes

float relativeRadius
 Paint brush radius relatively to the screen size.
float brushColor [4]
 Value that will be written by the brush at each stroke.

Private Attributes

vector< Editor * > editors
 The editors associated with this EditorHandler.
float radius
 Paint brush radius in world space.
bool update
 True if the current edition is over and the editors must be updated during redisplay.
bool paint
 True if the user is currently painting.
vector< vec4d > strokes
 The strokes of the currently painted shape.
int newStrokes
 Number of new strokes since last call to redisplay.
vec2i lastPos
 Last position of mouse in screen space.
float * depthBuffer
 A copy of the depth buffer when the user started to paint.

Detailed Description

An EventHandler to paint on terrains and pass edit events to one or more Editor objects.


Constructor & Destructor Documentation

proland::EditorHandler::EditorHandler ( float  relativeRadius  ) 

Creates a new EditorHandler.

Parameters:
relativeRadius size of the paint brush relatively to the screen size.

Member Function Documentation

void proland::EditorHandler::addEditor ( Editor editor  ) 

Adds an Editor to this EditorHandler.

The given Editor will receive edit events via its Editor::edit and Editor::update methods.

Parameters:
editor an abstract Editor.
vec3d proland::EditorHandler::getPosition ( int  x,
int  y 
)

Returns the world space point corresponding to the given screen coordinates.

Parameters:
x horizontal screen coordinate, in pixels.
y vertical screen coordinate, in pixels.
bool proland::EditorHandler::hasEditors (  ) 

Returns true if this EditorHandler has associated Editor.

bool proland::EditorHandler::isActive ( string  group  ) 

True if any of the Editors that belong to 'group' is activated.

void proland::EditorHandler::removeEditor ( Editor editor  ) 

Removes an Editor from this EditorHandler.

The given Editor will no longer receive edit events via its Editor::edit and Editor::update methods.

Parameters:
editor an abstract Editor.
void proland::EditorHandler::reset (  ) 

Cancels all editing operations performed on the active Editors.

void proland::EditorHandler::setActive ( string  group,
bool  active 
)

Activates or deactivates the Editors that belong to 'group' inside this EditorHandler.

void proland::EditorHandler::setActive ( bool  active  ) 

Activates or deactivates this EditorHandler.

This method show or hides the pencil depending on the status of this EditorHandler.


Member Data Documentation

Value that will be written by the brush at each stroke.

A copy of the depth buffer when the user started to paint.

The editors associated with this EditorHandler.

Last position of mouse in screen space.

Number of new strokes since last call to redisplay.

True if the user is currently painting.

Paint brush radius in world space.

Paint brush radius relatively to the screen size.

vector<vec4d> proland::EditorHandler::strokes [private]

The strokes of the currently painted shape.

When the user moves the mouse while in painting mode, strokes are sampled along the drawn path, at minimal distance between each other, and stored in this vector. Each stroke contains a world position and a radius (in world space).

True if the current edition is over and the editors must be updated during redisplay.


Generated on Sat May 12 09:43:15 2012 for proland by  doxygen 1.6.1