fCraft  0.638
Custom Minecraft Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events
fCraft.Drawing.DrawOperation Class Referenceabstract

Abstract class representing a drawing operation. More...

+ Inheritance diagram for fCraft.Drawing.DrawOperation:
+ Collaboration diagram for fCraft.Drawing.DrawOperation:

Public Member Functions

virtual bool Prepare ([NotNull] Vector3I[] marks)
 Prepares DrawOperation to start. Called after the player made a selection, usually on player's I/O thread. Brush property must be set before calling Prepare.
 
virtual bool Begin ()
 Begins the execution of this DrawOperation. Raises DrawOperation.Beginning (cancelable) and DrawOperation.Began events.
 
abstract int DrawBatch (int maxBlocksToDraw)
 
void Cancel ()
 Asynchronously cancels this draw operation.
 

Public Attributes

readonly Player Player
 Player who is executing this command. Used for both permission checks and messaging.
 
readonly Map Map
 Map to draw blocks to.
 
Vector3I Coords
 Coordinates that are currently being processed.
 

Protected Member Functions

 DrawOperation ([NotNull] Player player)
 
bool DrawOneBlock ()
 

Static Protected Member Functions

static IEnumerable< Vector3ILineEnumerator (Vector3I a, Vector3I b)
 
static bool RaiseBeginningEvent (DrawOperation op)
 
static void RaiseBeganEvent (DrawOperation op)
 
static void RaiseEndedEvent (DrawOperation op)
 

Protected Attributes

UndoState UndoState
 Undo state associated with this operation. Created by DrawOperation.Begin().
 

Properties

abstract int ExpectedMarks [get]
 Expected number of marks to pass to DrawOperation.Prepare()
 
IBrushInstance Brush [get, set]
 Brush used to determine which blocks to place. Must be assigned before DrawOperation.Prepare() is called.
 
BlockChangeContext Context [get, set]
 Block change context, to be reported to BlockDB and Player.PlacingBlock/PlacedBlock events. Should include BlockChangeContext.Drawn flag.
 
Vector3I[] Marks [get, set]
 Marks given by the player to this command. Marks could come from either clicks or /Mark command. Set by DrawOperation.Prepare()
 
DateTime StartTime [get, set]
 Time when the draw operatation began. Set by DrawOperation.Begin()
 
BoundingBox Bounds [get, set]
 Area that bounds the DrawOperation's extent, if possible to estimate in advance. Used for logging. Should be assigned, as accurately as possible, before DrawOp finishes.
 
bool HasBegun [get, set]
 Whether this operation has been started (queued for processing on the Map).
 
bool IsDone [get, set]
 Whether this operation is done (has finished or had been cancelled).
 
bool IsCancelled [get, set]
 Whether this operation has been cancelled (e.g. by /Undo or /WLock).
 
int BlocksProcessed [get, set]
 Number of blocks/coordinates that were considered for drawing.
 
int BlocksUpdated [get, set]
 Number of blocks/coordinates that ended up being changed/updated.
 
int BlocksDenied [get, set]
 Number of blocks/coordinates that were supposed to be changed/updated, but were left untouched due to permission issues.
 
int BlocksSkipped [get, set]
 Number of blocks/coordinates that were processed, and left untouched: either because the Brush decided to skip it, or because map's current block matched the desired blocktype.
 
int BlocksTotalEstimate [get, set]
 Estimate of total number of blocks that will be processed by this command. Should be as accurate as reasonably possible by DrawOperation.Prepare(). Used for volume permission checks. Must not be negative.
 
int BlocksLeftToProcess [get]
 Estimated total blocks left to process.
 
int PercentDone [get]
 Approximate completion percentage of this command.
 
int AlternateBlockIndex [get, set]
 Whether the brush should use alternate block (if available) for filling insides of hollow DrawOps. Currently only supported by NormalBrush. Used with CuboidH/CuboidW/EllipsoidH drawops.
 
abstract string Name [get]
 General name of this type of draw operation. Should be same for all instances.
 
virtual string Description [get]
 Compact description of this specific draw operation, with any instance-specific parameters, and the brush's instance description.
 
bool AnnounceCompletion [get, set]
 Whether completion or cancellation of this DrawOperation should be announced to Player.
 
bool LogCompletion [get, set]
 Whether completion or cancellation of this DrawOperation should be logged.
 
bool TimeToEndBatch [get]
 

Events

static EventHandler
< DrawOperationBeginningEventArgs
Beginning
 
static EventHandler
< DrawOperationEventArgs
Began
 
static EventHandler
< DrawOperationEventArgs
Ended
 

Detailed Description

Abstract class representing a drawing operation.

Constructor & Destructor Documentation

fCraft.Drawing.DrawOperation.DrawOperation ( [NotNull] Player  player)
protected

Member Function Documentation

virtual bool fCraft.Drawing.DrawOperation.Begin ( )
virtual

Begins the execution of this DrawOperation. Raises DrawOperation.Beginning (cancelable) and DrawOperation.Began events.

Returns
True if operation started succesfully. False if operation was canceled by an event callback.

Reimplemented in fCraft.Drawing.UndoDrawOperation, and fCraft.Drawing.CutDrawOperation.

void fCraft.Drawing.DrawOperation.Cancel ( )

Asynchronously cancels this draw operation.

bool fCraft.Drawing.DrawOperation.DrawOneBlock ( )
protected
static IEnumerable<Vector3I> fCraft.Drawing.DrawOperation.LineEnumerator ( Vector3I  a,
Vector3I  b 
)
staticprotected
virtual bool fCraft.Drawing.DrawOperation.Prepare ( [NotNull] Vector3I[]  marks)
virtual

Prepares DrawOperation to start. Called after the player made a selection, usually on player's I/O thread. Brush property must be set before calling Prepare.

Parameters
marksArray of marks given by the player.
Returns
True if both DrawOperation and Brush have been prepared succesfully. False if either of them failed.
Exceptions
ArgumentNullExceptionmarks is null.
ArgumentExceptionWrong number of marks is given.
NullReferenceExceptionDrawOperation's Brush property is not set before calling Prepare.

Reimplemented in fCraft.Drawing.Fill2DDrawOperation, fCraft.Drawing.BlockDBDrawOperation, fCraft.Drawing.PasteDrawOperation, fCraft.Drawing.UndoDrawOperation, fCraft.Drawing.CutDrawOperation, fCraft.Drawing.TriangleDrawOperation, fCraft.Drawing.TorusDrawOperation, fCraft.Drawing.CuboidWireframeDrawOperation, fCraft.Drawing.CuboidHollowDrawOperation, fCraft.Drawing.EllipsoidDrawOperation, fCraft.Drawing.EllipsoidHollowDrawOperation, fCraft.Drawing.LineDrawOperation, fCraft.Drawing.TriangleWireframeDrawOperation, fCraft.Drawing.CuboidDrawOperation, fCraft.Drawing.QuickPasteDrawOperation, fCraft.Drawing.SphereHollowDrawOperation, and fCraft.Drawing.SphereDrawOperation.

static void fCraft.Drawing.DrawOperation.RaiseBeganEvent ( DrawOperation  op)
staticprotected
static bool fCraft.Drawing.DrawOperation.RaiseBeginningEvent ( DrawOperation  op)
staticprotected
static void fCraft.Drawing.DrawOperation.RaiseEndedEvent ( DrawOperation  op)
staticprotected

Member Data Documentation

Vector3I fCraft.Drawing.DrawOperation.Coords

Coordinates that are currently being processed.

readonly Map fCraft.Drawing.DrawOperation.Map

Map to draw blocks to.

readonly Player fCraft.Drawing.DrawOperation.Player

Player who is executing this command. Used for both permission checks and messaging.

UndoState fCraft.Drawing.DrawOperation.UndoState
protected

Undo state associated with this operation. Created by DrawOperation.Begin().

Property Documentation

int fCraft.Drawing.DrawOperation.AlternateBlockIndex
getset

Whether the brush should use alternate block (if available) for filling insides of hollow DrawOps. Currently only supported by NormalBrush. Used with CuboidH/CuboidW/EllipsoidH drawops.

bool fCraft.Drawing.DrawOperation.AnnounceCompletion
getset

Whether completion or cancellation of this DrawOperation should be announced to Player.

int fCraft.Drawing.DrawOperation.BlocksDenied
getset

Number of blocks/coordinates that were supposed to be changed/updated, but were left untouched due to permission issues.

int fCraft.Drawing.DrawOperation.BlocksLeftToProcess
get

Estimated total blocks left to process.

int fCraft.Drawing.DrawOperation.BlocksProcessed
getset

Number of blocks/coordinates that were considered for drawing.

int fCraft.Drawing.DrawOperation.BlocksSkipped
getset

Number of blocks/coordinates that were processed, and left untouched: either because the Brush decided to skip it, or because map's current block matched the desired blocktype.

int fCraft.Drawing.DrawOperation.BlocksTotalEstimate
getset

Estimate of total number of blocks that will be processed by this command. Should be as accurate as reasonably possible by DrawOperation.Prepare(). Used for volume permission checks. Must not be negative.

int fCraft.Drawing.DrawOperation.BlocksUpdated
getset

Number of blocks/coordinates that ended up being changed/updated.

BoundingBox fCraft.Drawing.DrawOperation.Bounds
getset

Area that bounds the DrawOperation's extent, if possible to estimate in advance. Used for logging. Should be assigned, as accurately as possible, before DrawOp finishes.

IBrushInstance fCraft.Drawing.DrawOperation.Brush
getset

Brush used to determine which blocks to place. Must be assigned before DrawOperation.Prepare() is called.

BlockChangeContext fCraft.Drawing.DrawOperation.Context
getset

Block change context, to be reported to BlockDB and Player.PlacingBlock/PlacedBlock events. Should include BlockChangeContext.Drawn flag.

virtual string fCraft.Drawing.DrawOperation.Description
get

Compact description of this specific draw operation, with any instance-specific parameters, and the brush's instance description.

abstract int fCraft.Drawing.DrawOperation.ExpectedMarks
get

Expected number of marks to pass to DrawOperation.Prepare()

bool fCraft.Drawing.DrawOperation.HasBegun
getset

Whether this operation has been started (queued for processing on the Map).

bool fCraft.Drawing.DrawOperation.IsCancelled
getset

Whether this operation has been cancelled (e.g. by /Undo or /WLock).

bool fCraft.Drawing.DrawOperation.IsDone
getset

Whether this operation is done (has finished or had been cancelled).

bool fCraft.Drawing.DrawOperation.LogCompletion
getset

Whether completion or cancellation of this DrawOperation should be logged.

Vector3I [] fCraft.Drawing.DrawOperation.Marks
getset

Marks given by the player to this command. Marks could come from either clicks or /Mark command. Set by DrawOperation.Prepare()

abstract string fCraft.Drawing.DrawOperation.Name
get

General name of this type of draw operation. Should be same for all instances.

int fCraft.Drawing.DrawOperation.PercentDone
get

Approximate completion percentage of this command.

DateTime fCraft.Drawing.DrawOperation.StartTime
getset

Time when the draw operatation began. Set by DrawOperation.Begin()

bool fCraft.Drawing.DrawOperation.TimeToEndBatch
getprotected

Event Documentation

EventHandler<DrawOperationEventArgs> fCraft.Drawing.DrawOperation.Began
static
EventHandler<DrawOperationBeginningEventArgs> fCraft.Drawing.DrawOperation.Beginning
static
EventHandler<DrawOperationEventArgs> fCraft.Drawing.DrawOperation.Ended
static

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