Cafu Engine
TrafoBoxT Class Reference

This class implements a spatial box that can be used to define a transformation (translation, rotation, scale or shear). More...

#include "TrafoBox.hpp"

Public Types

enum  TrafoModeT { TM_SCALE =0, TM_ROTATE =1, TM_SHEAR =2 }
 
enum  TrafoHandleT {
  TH_NONE =0, TH_BODY =1, TH_TOP =0x10, TH_BOTTOM =0x20,
  TH_LEFT =0x40, TH_RIGHT =0x80, TH_TOP_LEFT =TH_TOP | TH_LEFT, TH_TOP_RIGHT =TH_TOP | TH_RIGHT,
  TH_BOTTOM_LEFT =TH_BOTTOM | TH_LEFT, TH_BOTTOM_RIGHT =TH_BOTTOM | TH_RIGHT
}
 

Public Member Functions

 TrafoBoxT ()
 The constructor. More...
 
const BoundingBox3fTGetBB () const
 Returns the spatial dimensions of this trafo box. More...
 
void SetBB (const BoundingBox3fT &BB, const ArrayT< Vector3fT > &ExtraRefPos)
 Sets new spatial dimensions for this trafo box. Can only be called when no drag is currently in progress (GetDragState() returns TH_NONE). More...
 
void SetTrafoMode (TrafoModeT TM)
 Sets the specified transformation mode. Can only be called when no drag is currently in progress (GetDragState() returns TH_NONE). More...
 
void SetNextTrafoMode ()
 Cycles the transformation modes. Can only be called when no drag is currently in progress (GetDragState() returns TH_NONE). More...
 
TrafoHandleT GetDragState () const
 Returns which of our handles (if any) is currently being dragged by the user. More...
 
TrafoHandleT CheckForHandle (const ViewWindow2DT &ViewWindow, const wxPoint &PointTS) const
 Returns the handle under the given point PointTS in ViewWindow, TH_NONE if there is none (only handles matching the current trafo mode are considered). More...
 
wxCursor SuggestCursor (TrafoHandleT TrafoHandle) const
 For the current trafo mode and the given trafo handle, this method returns the related matching cursor that should be activated in the related view window. More...
 
bool BeginTrafo (const ViewWindow2DT &ViewWindow, const wxPoint &PointTS)
 
bool UpdateTrafo (const ViewWindow2DT &ViewWindow, const wxPoint &PointTS, bool ToggleGrid)
 
CommandTransformTGetTrafoCommand (MapDocumentT &MapDoc, bool LockTexCoords) const
 This method creates a transform command, according to the current state of the box. More...
 
void ApplyTrafo (MapElementT *Elem, bool LockTexCoords) const
 Like GetTrafoCommand(), but applies the transformation to the given element immediately. More...
 
void FinishTrafo ()
 
void Render (Renderer2DT &Renderer, const wxColour &OutlineColor, const wxColour &HandleColor) const
 
void Render (Renderer3DT &Renderer, const wxColour &OutlineColor, const wxColour &HandleColor) const
 
bool UpdateStatusBar (ChildFrameT *ChildFrame) const
 

Detailed Description

This class implements a spatial box that can be used to define a transformation (translation, rotation, scale or shear).

A command for the command history can be created (see method GetTransformCommand()) that actually applies the transformation to a set of map elements.

Constructor & Destructor Documentation

TrafoBoxT::TrafoBoxT ( )

The constructor.

Member Function Documentation

void TrafoBoxT::ApplyTrafo ( MapElementT Elem,
bool  LockTexCoords 
) const

Like GetTrafoCommand(), but applies the transformation to the given element immediately.

TrafoBoxT::TrafoHandleT TrafoBoxT::CheckForHandle ( const ViewWindow2DT ViewWindow,
const wxPoint &  PointTS 
) const

Returns the handle under the given point PointTS in ViewWindow, TH_NONE if there is none (only handles matching the current trafo mode are considered).

Parameters
ViewWindowThe 2D window in which we should search for hits.
PointTSThe coordinate in tool space at which we are to look for a handle.
Returns
the handle that was hit in ViewWindow at Point.
const BoundingBox3fT& TrafoBoxT::GetBB ( ) const
inline

Returns the spatial dimensions of this trafo box.

TrafoHandleT TrafoBoxT::GetDragState ( ) const
inline

Returns which of our handles (if any) is currently being dragged by the user.

CommandTransformT * TrafoBoxT::GetTrafoCommand ( MapDocumentT MapDoc,
bool  LockTexCoords 
) const

This method creates a transform command, according to the current state of the box.

IMPORTANT NOTE: This method must be called after a call to BeginTrafo() and before the matching call to EndTrafo()!

Returns
the generated transform command, or NULL if no command could be generated.
void TrafoBoxT::SetBB ( const BoundingBox3fT BB,
const ArrayT< Vector3fT > &  ExtraRefPos 
)

Sets new spatial dimensions for this trafo box. Can only be called when no drag is currently in progress (GetDragState() returns TH_NONE).

void TrafoBoxT::SetNextTrafoMode ( )

Cycles the transformation modes. Can only be called when no drag is currently in progress (GetDragState() returns TH_NONE).

void TrafoBoxT::SetTrafoMode ( TrafoModeT  TM)

Sets the specified transformation mode. Can only be called when no drag is currently in progress (GetDragState() returns TH_NONE).

wxCursor TrafoBoxT::SuggestCursor ( TrafoHandleT  TrafoHandle) const

For the current trafo mode and the given trafo handle, this method returns the related matching cursor that should be activated in the related view window.


The documentation for this class was generated from the following files: