MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLUserOperation Class Reference

Detailed Description

This component is the base class for user-defined operations.

All user-defined operations should be derived from this class. All methods of this class are virtual, but only those required by the operation need be overridden. The editor component will trigger methods of the user-defined operation as appropriate. See individual method documentation for further details.

Note that if an operation changes data in the editing data layer, then it should set the changed flag using the TSLUserOperationRequest::setChanged method.

Public Member Functions

 TSLUserOperation ()
 
virtual ~TSLUserOperation ()
 
virtual int activate (void *data)
 
virtual bool activatePossible ()
 
virtual int backup ()
 
virtual bool backupPossible ()
 
virtual void constraintChanged (TSLEditorConstraintType newConstraint, double newParameter)
 
virtual void deactivate ()
 
virtual int dialogEntered (int button)
 
virtual int done ()
 
virtual int locator (TSLTMC x, TSLTMC y, TSLLocatorType type, TSLButtonType button, TSLModifierType modifier)
 
virtual bool query (TSLVariant *value)
 
virtual int reactivate (void *data)
 
virtual void requestHandler (TSLUserOperationRequest *handler)
 
virtual void resetUndoBuffer ()
 
virtual int textEntered (const char *entry, bool cancelled)
 
virtual int undo ()
 
virtual bool undoPossible ()
 

Constructor & Destructor Documentation

◆ TSLUserOperation()

TSLUserOperation::TSLUserOperation ( )

Default constructor for a User Operation.

◆ ~TSLUserOperation()

virtual TSLUserOperation::~TSLUserOperation ( )
virtual

Destructor for User Operation.

Member Function Documentation

◆ activate()

virtual int TSLUserOperation::activate ( void * data)
virtual

This method is invoked when the operation is initiated,

It may be overridden by the User Operation derived class.

Parameters
dataA pointer to some operation specific data. If the User Operation is overriding a standard operation, then the type of this data is described in the standard operation documentation.
Returns
the prompt number to display, 0 to keep current prompt.

◆ activatePossible()

virtual bool TSLUserOperation::activatePossible ( )
virtual

This method is invoked to determine if the current situation allows the operation to be activate e.g. for the delete operation, this would return true if there was anything to delete. Note that this is used to enable or disable GUI elements and should therefore reflect whether activate would a succeed if it was called.

It may be overridden by the User Operation derived class. If not overridden, it is assumed that 'false' would be returned.

Returns the true if the operation can be activated, false otherwise.

◆ backup()

virtual int TSLUserOperation::backup ( )
virtual

This method is invoked when the backup button is pressed whilst the operation is active.

Returns the prompt number to display, 0 to keep current prompt.

◆ backupPossible()

virtual bool TSLUserOperation::backupPossible ( )
virtual

This method is invoked to determine if the current situation allows the operation to be backed up, e.g. the user is in the midst of constructing a polyline. Note that this is used to enable or disable GUI elements and should therefore reflect whether backup would do anything if it was called, not merely whether backup is supported by this operation.

It may be overridden by the User Operation derived class. If not overridden, it is assumed that 'false' would be returned.

Returns the true if the operation can be backed up, false otherwise.

◆ constraintChanged()

virtual void TSLUserOperation::constraintChanged ( TSLEditorConstraintType newConstraint,
double newParameter )
virtual

This method is invoked when the constraint parameters change. This allows the operation to potentially change echo style, or other internal flags.

Parameters
newConstraintThe new value of the constraint.
newParameterAny parameter required for the new constraint

◆ deactivate()

virtual void TSLUserOperation::deactivate ( )
virtual

This method is invoked when the operation is completed.

It may be overridden by the User Operation derived class.

◆ dialogEntered()

virtual int TSLUserOperation::dialogEntered ( int button)
virtual

This method is invoked when the user selects a button from a requested dialog box.

Parameters
buttonThe button selected by the user, indexed from 1.
Returns
the prompt number to display, 0 to keep current prompt.

◆ done()

virtual int TSLUserOperation::done ( )
virtual

This method is invoked when the application calls the 'done' method of the Editor, or when a right button locator event is received by the Editor

Returns the prompt number to display, 0 to keep current prompt.

◆ locator()

virtual int TSLUserOperation::locator ( TSLTMC x,
TSLTMC y,
TSLLocatorType type,
TSLButtonType button,
TSLModifierType modifier )
virtual

This method is invoked when a locator event is received by the Editor.

It may be overridden by the User Operation derived class.

Parameters
xX location of locator event, in TMC units.
yX location of locator event, in TMC units.
typeType of locator event, press, motion or release.
buttonButton that triggered the event, left, centre or right.
modifierModifiers that were selected during the event. Shift, Control, both or none.
Returns
the prompt number to display, 0 to keep current prompt.

◆ query()

virtual bool TSLUserOperation::query ( TSLVariant * value)
virtual

This method is invoked to query the current status of the operation. The actual information returned is operation dependent. For example the attribute operations return the current value that would be applied if the operation were activated.

Individual operations will document what the query will return.

Parameters
valueA ptr to a TSLVariant for the storage of the result of a query.
Returns
true if the value field has been populated, false otherwise.

◆ reactivate()

virtual int TSLUserOperation::reactivate ( void * data)
virtual

If the user invokes an operation whilst it is already active, perhaps with different arguments, then this method is called.

It may be overridden by the User Operation derived class.

If it is not overridden then the deactivate method is called followed by the activate method.

Parameters
dataA pointer to some operation specific data. If the User Operation is overriding a standard operation, then the type of this data is described in the standard operation documentation.
Returns
the prompt number to display, 0 to keep current prompt.

◆ requestHandler()

virtual void TSLUserOperation::requestHandler ( TSLUserOperationRequest * handler)
virtual

This method supplies the User Operation with a request handler.

This method is triggered when the operation is added to an editor. An instance of an operation may only be added to one editor at a time. The handler passed to this method should be remembered by the user operation and used to access such things as the select list, request redraws and gain access to the attached drawing surface and data layer.

Parameters
handlerThe request handler that the operation needs to access the editor functionality.

◆ resetUndoBuffer()

virtual void TSLUserOperation::resetUndoBuffer ( )
virtual

This method is triggered by the Editor when the operation should clear any undo buffer that it may be maintaining.

If the User Operation has implemented the undo feature, then this call informs it that the data is no longer required since another operation has performed some action.

◆ textEntered()

virtual int TSLUserOperation::textEntered ( const char * entry,
bool cancelled )
virtual

This method is invoked when the user has entered some text that was previously requested.

Parameters
entryThis is the string that was entered by the user. It is undefined if the entry was cancelled by the user.
cancelledThis flag is true if the user cancelled the text request.
Returns
the prompt number to display, 0 to keep current prompt.

◆ undo()

virtual int TSLUserOperation::undo ( )
virtual

This method is invoked when the user presses the undo button, when the operation was the last active operation.

Returns the prompt number to display, 0 to keep current prompt.

◆ undoPossible()

virtual bool TSLUserOperation::undoPossible ( )
virtual

This method is invoked to determine if the current situation allows the operation to be undone, e.g. the user has just deleted some objects and calling undo would restore them. Note that this is used to enable or disable GUI elements and should therefore reflect whether undo would do anything if it was called, not merely whether undo is supported by this operation.

It may be overridden by the User Operation derived class. If not overridden, it is assumed that 'false' would be returned.

Returns the true if the operation can be backed up, false otherwise.