In file apps/mazed/me_draft.h:

class mzDraftEditor : public csComponent

This is the draft editor class

Inheritance:


Public Methods

virtual void Draw()
Draw the component (only dirty rectangle should be redrawn)
virtual bool HandleEvent(csEvent &Event)
Handle draft editor events
mzDraftEditor(csComponent *iParent)
Create the Draft Editor view
virtual bool SetRect(int xmin, int ymin, int xmax, int ymax)
Call UpdateMatrix () when window size changes
void SetViewAngles(float iPhi, float iTheta)
Set viewing angles

Protected Classes

struct
Equations of four planes that cuts visible space

Protected Fields

static int BodyCreationPhase
3D body creation phase
mz3DVertex clip_corner[4]
Coordinates of four viewport corners in world space
static int ConnVerticeOrd
Ordinal of current vertex that user clicks during "create poly" ops
static bool doCreateBody
Are we creating a 3D body?
static bool doCreatePolygon
Are we creating a polygon?
int dragMouseX
Used when dragging a rectangle
bool dragRect
true if dragging a rectangle
csMenu* menu
The menu that is used to pick vertices
csVector3 ModifyCenter
Modification axis/center for Modify ();
csMatrix3 ModifyDeform
Deformation matrix for Modify ()
int ModifyMode
Current modification mode (move, rotate, scale etc or 0). Used in ::Draw.
csVector3 ModifyMotion
Translation matrix for Modify ();
int oldMouseX
Mouse coordinates in previous frame when dragging etc
float phi
We keep view vector as two angles: phi and theta
static int PolygonVertices
Number of vertices in polygon
csVector3 pos
... and the position of camera
float scale
We also keep the scale of ortogonal projection

The scale is expressed as the medium distance between horizontal and vertical window bounds

csMatrix3 w2c
Current 3D transform matrix resulting from above, and its inverse
float xmin
Minimal and maximal coordinates within view frustum

Protected Methods

void CenterModelInWindow()
Center model in window
bool clip3Dline(csVector3 &v1, csVector3 &v2)
Clip a 3D line by view frustum; return false if line is invisible
void ConnectPolyVertex(int x, int y)
Add a vertex at given window position to polygon that is currently created
void CreateBox(int xl, int yt, int xr, int yb, float depth)
Create a box
void CreatePolygon(int icx, int icy, int irx, int iry, float iz, bool iReverse, int *oVertIdx)
Create a polygon
void CreatePrism(int xc, int yc, int xr, int yr, float depth)
Create a prism
void CreatePyramid(int xc, int yc, int xr, int yr, float depth)
Create a pyramid
void CreateSphere(int xc, int yc, int xr, int yr)
Hmm... its a complex question
void CreateTorus(int xc, int yc, int xr, int yr, float iInnerRadius, float iOuterRadius)
Guess what?
void DrawGadgets()
Draw support gadgets: grid and coordinate axes
void FinishConnectPoly()
Exit from "connect poly vertices" mode
void FitModelInWindow()
Set view parameters so that current model maximally fits in window
void GridInterpolationSteps(mz3DVertex &v1, mz3DVertex &v2, mz3DVertex &step, int &steps)
Calculate interpolation step for moving through the grid points from v1 to v2
int InsertVertexAt(int x, int y)
Insert a 3D vertex into model given its window x,y coordinates
void Modify(csVector3 &v)
Modify a vertex using current modification matrices
int PickVertex(int x, int y)
Pick the vertex that lies at or near the given window position
void PrepareModificationMatrix()
Prepare a csMatrix3 and a csVector3 used for dynamic object modification
void SelectRect(csRect &r)
Select/deselect/invert vertices/polygons within a given window rectangle
void ShowBody(int xc, int yc, int xr, int yr)
Interactively create a 3D body
void ShowPolygon(int xc, int yc, int xr, int yr)
Display an unexisting polygon that user is creating
void SnapToGrid(csVector3 &v)
Snap a vertex to grid
void UpdateMatrix()
Call this routine after changing phi, theta, scale or pos
void win2world(int x, int y, float z, csVector3 &v)
Convert a point from window space to world space
void win2world(float x, float y, float z, csVector3 &v)
Same but given floating-point coordinates
void world2win(csVector3 &v, csVector3 &dest)
Same but without translation
void world2win(csVector3 &v, int &x, int &y)
Convert a point from world space to window space
void world2winM(csVector3 &v, int &x, int &y)
Convert a point from world space to window space with current modification applied
void ZoomInOut(int x, int y, float delta)
Zoom view in or out given mouse click position
void ZoomToRect(csVector3 &o, csVector3 &ha, csVector3 &va, bool iUpdateAngles = false)
Zoom view so that given rectangle will maximally fit in window

Protected

struct
Equations of four planes that cuts visible space

Inherited from csComponent:

Public Fields

csApp* app
csRect bound
csVector clipchildren
csComponent* focused
unsigned int id
csComponent* next
csComponent* parent
csComponent* top

Public Methods

void Box(int xmin, int ymin, int xmax, int ymax, int colindx)
void Center(bool iHoriz = true, bool iVert = true)
virtual void Close()
virtual void Delete(csComponent *comp)
void DeleteAll()
void DeleteClipChild(csComponent *clipchild)
void Drag(int x, int y, int DragMode)
void FindMaxFreeRect(csRect &area)
virtual void FixPosition(int &newX, int &newY)
virtual void FixSize(int &newW, int &newH)
csComponent* ForEach(bool (*func) (csComponent *child, void *param), void *param = NULL, bool Zorder = false)
csComponent* GetChild(int find_id)
csComponent* GetClipParent()
int GetColor(int Index)
csComponent* GetDefault()
int GetDragStyle()
csComponent* GetFocused()
int GetFont()
int GetState(int mask)
virtual char* GetText()
virtual void GetText(char *oText, int iTextSize)
csComponent* GetTop()
void GlobalToLocal(int &x, int &y)
bool HandleDragEvent(csEvent &Event, int BorderW, int BorderH)
virtual void Hide()
virtual void Insert(csComponent *comp)
void InsertClipChild(csComponent *clipchild)
void Invalidate(csRect &area, bool IncludeChildren = false)
void Invalidate(bool IncludeChildren = false)
void Invalidate(int xmin, int ymin, int xmax, int ymax, bool IncludeChildren = false)
void Line(float x1, float y1, float x2, float y2, int colindx)
void LocalToGlobal(int &x, int &y)
virtual bool Maximize()
virtual csComponent* NextChild(csComponent *start = NULL, bool disabled = false)
virtual csComponent* NextControl(csComponent *start = NULL)
virtual csComponent* NextGroup(csComponent *start = NULL)
void ObliqueRect3D(int xmin, int ymin, int xmax, int ymax, int cornersize, int darkindx, int lightindx)
void Pixel(int x, int y, int colindx)
virtual bool PostHandleEvent(csEvent &Event)
virtual bool PreHandleEvent(csEvent &Event)
virtual csComponent* PrevChild(csComponent *start = NULL, bool disabled = false)
virtual csComponent* PrevControl(csComponent *start = NULL)
virtual csComponent* PrevGroup(csComponent *start = NULL)
void Rect3D(int xmin, int ymin, int xmax, int ymax, int darkindx, int lightindx)
void Redraw()
virtual bool Restore()
bool Select()
void* SendCommand(int CommandCode, void *Info = NULL)
void SetApp(csApp *newapp)
void SetClipRect()
void SetClipRect(int xmin, int ymin, int xmax, int ymax)
void SetColor(int Index, int Color)
bool SetDragRect(int xmin, int ymin, int xmax, int ymax)
void SetDragStyle(int iDragStyle)
bool SetFocused(csComponent *comp)
void SetFont(int iFont, bool IncludeChildren = false)
void SetMouse(csMouseCursorID Cursor)
void SetPalette(int *iPalette, int iPaletteSize)
void SetPalette(int iPaletteID)
void SetPos(int x, int y)
void SetSize(int w, int h)
void SetSizingCursor(int dragtype)
virtual void SetState(int mask, bool enable)
virtual void SetSuggestedSize(int dw, int dh)
virtual void SetText(char *iText)
bool SetZorder(csComponent *comp, csComponent *below)
virtual void Show(bool focused = false)
void Sprite2D(csSprite2D *s2d, int x, int y)
void Sprite2D(csSprite2D *s2d, int x, int y, int w, int h)
virtual void SuggestSize(int &w, int &h)
void Text(int x, int y, int fgindx, int bgindx, char *s)
int TextHeight()
int TextWidth(char *text)

Protected Fields

csRect clip
csComponent* clipparent
csRect dirty
static csRect dragBound
int DragStyle
static int dragX
int Font
bool Maximized
csRect OrgBound
bool originalpalette
int* palette
int state
char* text

Protected Methods

void Clip(csObjVector &rect, csComponent *last)
void ClipAlienChildren(csObjVector &rect, csComponent *child)
void DrawUnderline(int iX, int iY, char *iText, int iUnderlinePos, int iColor)
static void PrepareLabel(char *iLabel, char * &oLabel, int &oUnderlinePos)
static int WordLeft(char *iText, int StartPos)
static int WordRight(char *iText, int StartPos)

Inherited from csBase:


Documentation

This is the draft editor class
mzDraftEditor(csComponent *iParent)
Create the Draft Editor view

virtual void Draw()
Draw the component (only dirty rectangle should be redrawn)

virtual bool HandleEvent(csEvent &Event)
Handle draft editor events

virtual bool SetRect(int xmin, int ymin, int xmax, int ymax)
Call UpdateMatrix () when window size changes

void SetViewAngles(float iPhi, float iTheta)
Set viewing angles

float phi
We keep view vector as two angles: phi and theta. They are the dirtection of vector in polar coordinates, phi being the angle of rotation around vertical (Y) axis and theta being the angle of rotation around horizontal axis that is perpendicular to Y.

float scale
We also keep the scale of ortogonal projection

The scale is expressed as the medium distance between horizontal and vertical window bounds. For example, if scale is 1 and we have a square window, and the center point of window (pos) is at (0,0,0), and we have a XOY plane projection matrix this means that we'll see in window the square (-0.5, -0.5, 0)...(+0.5, +0.5, 0)

csMatrix3 w2c
Current 3D transform matrix resulting from above, and its inverse

csVector3 pos
... and the position of camera

csMenu* menu
The menu that is used to pick vertices

int oldMouseX
Mouse coordinates in previous frame when dragging etc

int dragMouseX
Used when dragging a rectangle

bool dragRect
true if dragging a rectangle

struct
Equations of four planes that cuts visible space

float xmin
Minimal and maximal coordinates within view frustum

mz3DVertex clip_corner[4]
Coordinates of four viewport corners in world space

static int ConnVerticeOrd
Ordinal of current vertex that user clicks during "create poly" ops

int ModifyMode
Current modification mode (move, rotate, scale etc or 0). Used in ::Draw.

csMatrix3 ModifyDeform
Deformation matrix for Modify ()

csVector3 ModifyMotion
Translation matrix for Modify ();

csVector3 ModifyCenter
Modification axis/center for Modify ();

static bool doCreatePolygon
Are we creating a polygon?

static int PolygonVertices
Number of vertices in polygon

static bool doCreateBody
Are we creating a 3D body?

static int BodyCreationPhase
3D body creation phase

void UpdateMatrix()
Call this routine after changing phi, theta, scale or pos

void world2win(csVector3 &v, int &x, int &y)
Convert a point from world space to window space

void world2win(csVector3 &v, csVector3 &dest)
Same but without translation

void world2winM(csVector3 &v, int &x, int &y)
Convert a point from world space to window space with current modification applied

void win2world(int x, int y, float z, csVector3 &v)
Convert a point from window space to world space

void win2world(float x, float y, float z, csVector3 &v)
Same but given floating-point coordinates

void PrepareModificationMatrix()
Prepare a csMatrix3 and a csVector3 used for dynamic object modification

void Modify(csVector3 &v)
Modify a vertex using current modification matrices

void ZoomInOut(int x, int y, float delta)
Zoom view in or out given mouse click position

int PickVertex(int x, int y)
Pick the vertex that lies at or near the given window position

void DrawGadgets()
Draw support gadgets: grid and coordinate axes

bool clip3Dline(csVector3 &v1, csVector3 &v2)
Clip a 3D line by view frustum; return false if line is invisible

int InsertVertexAt(int x, int y)
Insert a 3D vertex into model given its window x,y coordinates

void ZoomToRect(csVector3 &o, csVector3 &ha, csVector3 &va, bool iUpdateAngles = false)
Zoom view so that given rectangle will maximally fit in window

void SnapToGrid(csVector3 &v)
Snap a vertex to grid

void ConnectPolyVertex(int x, int y)
Add a vertex at given window position to polygon that is currently created

void FinishConnectPoly()
Exit from "connect poly vertices" mode

void SelectRect(csRect &r)
Select/deselect/invert vertices/polygons within a given window rectangle

void FitModelInWindow()
Set view parameters so that current model maximally fits in window

void CenterModelInWindow()
Center model in window

void GridInterpolationSteps(mz3DVertex &v1, mz3DVertex &v2, mz3DVertex &step, int &steps)
Calculate interpolation step for moving through the grid points from v1 to v2

void ShowPolygon(int xc, int yc, int xr, int yr)
Display an unexisting polygon that user is creating

void ShowBody(int xc, int yc, int xr, int yr)
Interactively create a 3D body

void CreatePolygon(int icx, int icy, int irx, int iry, float iz, bool iReverse, int *oVertIdx)
Create a polygon

void CreateBox(int xl, int yt, int xr, int yb, float depth)
Create a box

void CreatePrism(int xc, int yc, int xr, int yr, float depth)
Create a prism

void CreatePyramid(int xc, int yc, int xr, int yr, float depth)
Create a pyramid

void CreateTorus(int xc, int yc, int xr, int yr, float iInnerRadius, float iOuterRadius)
Guess what?

void CreateSphere(int xc, int yc, int xr, int yr)
Hmm... its a complex question


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de