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

Detailed Description

This component allows user operations to interact with the editor.

All interactions with the editor should go via this component. The user operation will be passed an instance of this component when it is added to an editor.

Public Member Functions

bool activate (const char *name, void *data)
 
bool cancelDialog ()
 
bool cancelText ()
 
bool clearSelectList (bool removeHighlights, bool feedback=true)
 
bool deactivate ()
 
bool deselect (TSLEntity *entity)
 
bool displayError (const char *message)
 
bool displayHighlights (bool display)
 
bool displayPrompt (const char *message)
 
void feedbackAttributesChanged (const TSLEntityReferenceSet *entities)
 
void feedbackCreated (const TSLEntityReferenceSet *entities, bool replacingOtherEntities)
 
void feedbackDeleting (const TSLEntityReferenceSet *entities, bool willBeReplaced)
 
void feedbackDeselected (const TSLEntityReferenceSet *entities)
 
void feedbackGeometryChanged (const TSLEntityReferenceSet *entities)
 
void feedbackReordered (const TSLEntityReferenceSet *entities)
 
void feedbackReparented (const TSLEntityReferenceSet *entities)
 
void feedbackSelected (const TSLEntityReferenceSet *entities)
 
void feedbackUndeleted (const TSLEntityReferenceSet *entities, bool replacingOtherEntities)
 
TSLEntityfindEntity (TSLTMC x, TSLTMC y, TSLDeviceUnits aperture, int depth)
 
bool getChanged ()
 
TSLEditorConstraintType getConstraint (double *parameter)
 
TSLDrawingSurfacegetDrawingSurface ()
 
TSLDataLayergetEditableDataLayer ()
 
TSLEntitySetgetEntitySet ()
 
int getNumSelected ()
 
TSLEntitygetSelection (int n)
 
bool highlightOverride (TSLEntity *entity)
 
int invokeOriginal ()
 
const char * lookupConfiguration (const char *key)
 
const char * lookupMessage (int key)
 
bool redraw (bool clear)
 
bool redraw2Extents (const TSLEnvelope *extent1, const TSLEnvelope *extent2, bool clear)
 
bool redrawEntityExtent (const TSLEntity *entity, bool clear)
 
bool redrawExtent (const TSLEnvelope *extent, bool clear)
 
bool requestDialog (const char *prompt, const char *l1, const char *l2, const char *l3, const char *l4)
 
bool requestText (const char *prompt, const char *initialValue)
 
bool select (TSLEntity *entity)
 
bool setChanged (bool changed)
 
bool setCursor (TSLCursorStyle style)
 
bool setDynamicEcho (TSLDynamicEchoType type, TSLEchoCoord *points, int numPoints, TSLCoord *anchor)
 
bool setFixedEcho (TSLFixedEchoType type, TSLCoord *points, int numPoints)
 
bool snapPoint (TSLLocatorEvent &point)
 
bool snapToPointOrEdge (TSLLocatorEvent &point)
 
bool updateEntityExtent (TSLEntity *entity)
 
bool select (TSLEntity *entity, const TSLCoord &selectionPoint)
 

Member Function Documentation

◆ activate()

bool TSLUserOperationRequest::activate ( const char * name,
void * data )

Activate a different operation.

This method deactivates the current operation and activates the specified operation. It the specified operation is already active, then the operation is reactivated.

After calling this method, the user operation should immediately return control to the editor.

Parameters
nameName of new operation to activate.
dataAny operation specific data to pass to the operations activate method.
Returns
true if successful, false on failure.

◆ cancelDialog()

bool TSLUserOperationRequest::cancelDialog ( )

Cancel the current dialog request.

This method is called by the operation to cancel the current dialog request.

Returns true if successfully cancelled, otherwise false.

◆ cancelText()

bool TSLUserOperationRequest::cancelText ( )

Cancel the current text request.

This method is called to cancel the current text request.

Returns true if successfully cancelled, otherwise false.

◆ clearSelectList()

bool TSLUserOperationRequest::clearSelectList ( bool removeHighlights,
bool feedback = true )

Clears all entities from the select list.

If the removeHighlights flag is set, then the highlights are removed immediately if enabled. This will force a redraw of the combined extent of all selected entities.

Parameters
removeHighlightsFlag to indicate whether highlights should be removed immediately.
Returns
true if successful, false otherwise.

◆ deactivate()

bool TSLUserOperationRequest::deactivate ( )

Deactivate the current operation.

This method deactivates the current operation and activates the default 'select' operation.

After calling this method, the user operation should immediately return control to the editor.

Returns true on success, false on failure.

◆ deselect()

bool TSLUserOperationRequest::deselect ( TSLEntity * entity)

Removes the specified entity from the select list.

If select highlights are enabled, then the entity will be unhighlighted immediately.

Parameters
entityEntity to remove from select list.
Returns
true if successfully removed, false otherwise.

◆ displayError()

bool TSLUserOperationRequest::displayError ( const char * message)

Send error message to client application for display.

This method passes the specified error message onto the client application for display. The manner in which the error message is displayed is up to the client application.

Returns true on success, false on failure.

◆ displayHighlights()

bool TSLUserOperationRequest::displayHighlights ( bool display)

Toggles display of selection highlights.

This method allows an operation to temporarily disable selection highlights without removing objects from the select list. For example, the move operation uses this call - the dynamic echo is used to indicate the extent of the selected objects instead.

Parameters
displayFlag to indicate whether selection highlights should be displayed.
Returns
true if successful, false otherwise.

◆ displayPrompt()

bool TSLUserOperationRequest::displayPrompt ( const char * message)

Send prompt message to client application for display.

This method passes the specified message onto the client application for display. The manner in which the message is displayed is up to the client application.

Parameters
messagemessage to send
Returns
true on success, false on failure.

◆ feedbackAttributesChanged()

void TSLUserOperationRequest::feedbackAttributesChanged ( const TSLEntityReferenceSet * entities)

Call when entities have their attributes changed, typically rendering attributes.

Parameters
entitiesThe reference set of entities being acted upon.

◆ feedbackCreated()

void TSLUserOperationRequest::feedbackCreated ( const TSLEntityReferenceSet * entities,
bool replacingOtherEntities )

Call when entities are created.

Note that this may be triggered even when the entities being created are be replacements for others that have been deleted. This is necessary since the ordering and parenting of entities is important and cannot be maintained using a simple replacing(x with y) call.

Parameters
entitiesThe reference set of entities being acted upon.
replacingOtherEntitiesThis flag indicates whether the entities being created are replacing other entities that have just be deleted.

◆ feedbackDeleting()

void TSLUserOperationRequest::feedbackDeleting ( const TSLEntityReferenceSet * entities,
bool willBeReplaced )

Call just before entities are deleted.

Note that this may be triggered even when the entities being deleted will be replaced by others. This is necessary since the ordering and parenting of entities is important and cannot be maintained using a simple replacing(x with y) call.

Parameters
entitiesThe reference set of entities being acted upon.
willBeReplacedThis flag indicates whether the entities being deleted will subsequently be replaced by new entities. These new entities will be notified using the created or undeleted methods.

◆ feedbackDeselected()

void TSLUserOperationRequest::feedbackDeselected ( const TSLEntityReferenceSet * entities)

Call when entities are removed from the select list.

Parameters
entitiesThe reference set of entities being acted upon.

◆ feedbackGeometryChanged()

void TSLUserOperationRequest::feedbackGeometryChanged ( const TSLEntityReferenceSet * entities)

Call when entities have their geometry changed - e.g. move/scale/addpoint etc.

Parameters
entitiesThe reference set of entities being acted upon.

◆ feedbackReordered()

void TSLUserOperationRequest::feedbackReordered ( const TSLEntityReferenceSet * entities)

Call when entities are reordered beneath their current parent, (back/front)

Parameters
entitiesThe reference set of entities being acted upon.

◆ feedbackReparented()

void TSLUserOperationRequest::feedbackReparented ( const TSLEntityReferenceSet * entities)

Call when objects are moved up or down the entity hierarchy, e.g. grouped/ungrouped.

Parameters
entitiesThe reference set of entities being acted upon.

◆ feedbackSelected()

void TSLUserOperationRequest::feedbackSelected ( const TSLEntityReferenceSet * entities)

Call when entities are added to the select list.

Parameters
entitiesThe reference set of entities being acted upon.

◆ feedbackUndeleted()

void TSLUserOperationRequest::feedbackUndeleted ( const TSLEntityReferenceSet * entities,
bool replacingOtherEntities )

Call when an operation that deletes entities is undone.

Parameters
entitiesThe reference set of entities being acted upon.
replacingOtherEntitiesThis flag indicates whether the entities being created are replacing other entities that have just be deleted.

◆ findEntity()

TSLEntity * TSLUserOperationRequest::findEntity ( TSLTMC x,
TSLTMC y,
TSLDeviceUnits aperture,
int depth )

Find an entity nearest to specified position.

This method searches the current data layer for the nearest entity to the specified position. The search descends down through the hierarchy until the specified depth is reached.

Note that the aperture is in device units. If TMC units are required, then either perform a TMCToDU conversion, or use the findEntity on the TSLDrawing Surface or TSLDataLayer.

Parameters
xX position, in TMC units.
yY position, in TMC units.
apertureSize of search aperture, in device units.
depthDepth to descend into entity set hierarchy.
Returns
nearest entity within aperture, NULL if none found.

◆ getChanged()

bool TSLUserOperationRequest::getChanged ( )

Gets the changed flag in editor.

The changed flag is used to indicate that the editing entity set has been modified by the user.

Returns true if editing entity set has been changed, false otherwise.

◆ getConstraint()

TSLEditorConstraintType TSLUserOperationRequest::getConstraint ( double * parameter)

Query the current constraint setting.

Parameters
parameterStorage for any constraint parameter.
Returns
the current constraint setting.

◆ getDrawingSurface()

TSLDrawingSurface * TSLUserOperationRequest::getDrawingSurface ( )

Query drawing surface that editor is attached to.

This is commonly used to allow user operations to perform coordinate transformations. Note that the TSLUserOperationRequest::redrawXxxx methods should be used to redraw areas, rather than calling the drawing surface methods directly.

Note that since an editor can be attached to a different drawing surface at any time, this handle should not be held across invocations of an operation.

Returns drawing surface currently being edited, NULL if none attached.

◆ getEditableDataLayer()

TSLDataLayer * TSLUserOperationRequest::getEditableDataLayer ( )

Query data layer that editor is attached to.

Note that since an editor can be attached to a different drawing surface at any time, this handle should not be held across invocations of an operation.

Returns data layer currently being edited, NULL if none attached.

◆ getEntitySet()

TSLEntitySet * TSLUserOperationRequest::getEntitySet ( )

Query entity set that editor is editing.

The returned entity set will be the entity set belonging to the top-most visible, editable and selectable TSLStandardDataLayer.

The user operation may create or manipulate objects in the data layer.

Note that since an editor can be attached to a different drawing surface at any time, this handle should not be held across invocations of an operation.

Returns entity set currently being edited, NULL if no data layer attached.

◆ getNumSelected()

int TSLUserOperationRequest::getNumSelected ( )

Query the number of entities currently selected.

Returns the number of entities on the select list.

◆ getSelection()

TSLEntity * TSLUserOperationRequest::getSelection ( int n)

This method returns the Nth item in the select list.

Parameters
nIndex into the select list.
Returns
specified entity on the select list, NULL if index is out of range.

◆ highlightOverride()

bool TSLUserOperationRequest::highlightOverride ( TSLEntity * entity)

Force single entity to be highlighted.

This method forces a single entity be highlighted regardless of how many objects are on the select list. This is typically used when cycling through the select list, with user interaction required at each step - such as the settext operation.

Parameters
entityIndividual entity to highlight.
Returns
true if successful, false otherwise.

◆ invokeOriginal()

int TSLUserOperationRequest::invokeOriginal ( )

Invoke method of overridden operation.

This method invokes the equivalent method in the parent operation. It is used for derived operations to call base operation methods.

For example, say a user-defined operation was required to create a polyline, but then set the entity id to a specific value. The user-defined operation would use this method to invoke all the functionality of the polyline operation that it had overridden but in addition, could set the entity id of objects on the select list in the done method.

The return value is specific to the method in the parent operation. The derived operations should return the value that is returned from this function.

◆ lookupConfiguration()

const char * TSLUserOperationRequest::lookupConfiguration ( const char * key)

Lookup value associated with key in configuration file.

The configuration file supplied to the operation manager contains key/value pairs. This method call will lookup a value from the configuration file according to the specified key. This allows user-defined operations to have configuration information embedded in the configuration file.

Note that the value returned may be overwritten by subsequent calls to this method.

Parameters
keyKey to lookup from the configuration file.
Returns
pointer to associated value, NULL if not found.

◆ lookupMessage()

const char * TSLUserOperationRequest::lookupMessage ( int key)

Lookup message associated with key in message file.

Note that the value returned may be overwritten by subsequent calls this this method.

Parameters
keyKey to lookup from the message file.
Returns
pointer to associated value, NULL if not found.

◆ redraw()

bool TSLUserOperationRequest::redraw ( bool clear)

Redraw entire drawing surface.

Parameters
clearFlag indicating whether drawing surface should be cleared before redrawn.
Returns
true on success, false otherwise.

◆ redraw2Extents()

bool TSLUserOperationRequest::redraw2Extents ( const TSLEnvelope * extent1,
const TSLEnvelope * extent2,
bool clear )

Redraw two extents on drawing surface.

Redraws two extents on drawing surface. If the extents overlap, then they are combined and a single redraw takes place. This method is typically used when moving an entity, to erase the object from its old position and draw it in its new position.

NOTE : The extents will automatically be expanded to include any highlighting that may be around the extents.

Parameters
extent1Extent 1 to redraw.
extent2Extent 2 to redraw.
clearFlag indicating whether drawing surface should be cleared before redrawn.
Returns
true on success, false otherwise.

◆ redrawEntityExtent()

bool TSLUserOperationRequest::redrawEntityExtent ( const TSLEntity * entity,
bool clear )

Redraw the extent of an entity on the drawing surface.

NOTE : The extents will automatically be expanded to include any highlighting that may be around the extents.

Parameters
entityEntity whose extent to redraw.
clearFlag indicating whether drawing surface should be cleared before redrawn.
Returns
true on success, false otherwise.

◆ redrawExtent()

bool TSLUserOperationRequest::redrawExtent ( const TSLEnvelope * extent,
bool clear )

Redraw specified extent of drawing surface.

NOTE : The extent will automatically be expanded to include any highlighting that may be around the extent.

Parameters
extentExtent to redraw.
clearFlag indicating whether drawing surface should be cleared before being redrawn.
Returns
true on success, false otherwise.

◆ requestDialog()

bool TSLUserOperationRequest::requestDialog ( const char * prompt,
const char * l1,
const char * l2,
const char * l3,
const char * l4 )

Request user input from a dialog box.

This method requests that the user select one of the specified choices. An empty string indicates that the button should not be shown.

Parameters
promptThe prompt requesting a user selection.
l1The text label for button 1.
l2The text label for button 2.
l3The text label for button 3.
l4The text label for button 4.
Returns
true on success, otherwise false.

◆ requestText()

bool TSLUserOperationRequest::requestText ( const char * prompt,
const char * initialValue )

Request text input from the user.

This method is called to request that the client application ask the user to enter some text.

The client application should called the textEntered method when the text has been entered by the user.

prompt: The string prompting the user for input.

initialValue: Sets the initial value of the text field.

Returns true on success, otherwise false.

◆ select() [1/2]

bool TSLUserOperationRequest::select ( TSLEntity * entity)

Add the specified entity to the select list.

If select highlights are enabled, then the entity will be highlighted immediately.

Parameters
entityEntity to add to select list.
Returns
true if successfully added, false otherwise.

◆ select() [2/2]

bool TSLUserOperationRequest::select ( TSLEntity * entity,
const TSLCoord & selectionPoint )

Obsolete deprecated methods - redirect to correct ones

◆ setChanged()

bool TSLUserOperationRequest::setChanged ( bool changed)

Sets the changed flag in editor.

The changed flag is used to indicate that the editing entity set has been modified by the user.

Parameters
changedValue to set changed flag to.
Returns
true on success, false on failure.

◆ setCursor()

bool TSLUserOperationRequest::setCursor ( TSLCursorStyle style)

Request a cursor style that is appropriate to the current operation action.

This method should be called to request that the user's application update the cursor. This is not mandatory, but can often give users better feedback.

Parameters
styleAction being performed.
Returns
true if successful, otherwise false.

◆ setDynamicEcho()

bool TSLUserOperationRequest::setDynamicEcho ( TSLDynamicEchoType type,
TSLEchoCoord * points,
int numPoints,
TSLCoord * anchor )

Sets current dynamic echo.

The editor provides support for two kinds of echo, a fixed echo which is a temporary primitive and a dynamic echo which is typically a rubber-banded line with some point attached to the current locator position. As the locator moves, the relevant points of the dynamic echo are updated. Note that all echo modes are cleared before an operation becomes active.

The dynamic echo may be used to provide rubber-banded lines or rectangles, or other more complex echo such as parallels and perpendiculars. See TSLDynamicEchoType documentation for further description of the dynamic echo styles.

Note also that calling this method may result in temporary TSLPoint and TSLPolyline objects being created in an editable layer. As a result, TSLEditor::reset should be called before saving the geometry.

Parameters
typeType of echo required.
pointsPointer to array of points for echo.
numNumber of points in array.
anchorOptional anchor point for dynamic echo.

Return true on success, false on failure.

◆ setFixedEcho()

bool TSLUserOperationRequest::setFixedEcho ( TSLFixedEchoType type,
TSLCoord * points,
int numPoints )

Sets current fixed (primitive) echo.

The editor provides support for two kinds of echo, a fixed echo which is a temporary primitive and a dynamic echo which is typically a rubber-banded line with some point attached to the current locator position. As the locator moves, the relevant points of the dynamic echo are updated. Note that all echo modes are cleared before an operation becomes active.

The fixed echo may be a temporary polyline or a set of temporary symbols. Amongst others, the polyline, polygon and lasso operations use the polyline echo to indicate the current primitive that would be drawn. The movepoint, addpoint and deletepoint operations use the symbol echo to indicate the points that may be chosen by the user.

Note also that calling this method may result in temporary TSLPoint and TSLPolyline objects being created in an editable layer. As a result, TSLEditor::reset should be called before saving the geometry.

Parameters
typeType of echo required, None/Point/Line
pointsPointer to array of points for echo.
numNumber of points in array.

Return true on success, false on failure.

◆ snapPoint()

bool TSLUserOperationRequest::snapPoint ( TSLLocatorEvent & point)

This method snaps the specified point, according to the locator buttons and modifiers.

Parameters
pointLocator event to snap
Returns
true if snapped, false otherwise.

◆ snapToPointOrEdge()

bool TSLUserOperationRequest::snapToPointOrEdge ( TSLLocatorEvent & point)

This method snaps the specified point, according to the locator buttons and modifiers. Unlike snapPoint, this can snap to the closest point on an edge that is valid, even if not an actual vertex.

Parameters
pointLocator event to snap
Returns
true if snapped, false otherwise.

◆ updateEntityExtent()

bool TSLUserOperationRequest::updateEntityExtent ( TSLEntity * entity)

Force update of entity extent.

After changing attributes of some objects, such as symbol style and text font, their extent may change. Since the extent of text and some symbol objects can only be know at rendering time (due to raster fonts etc), their extent may need to be updated by performing a dummy render. This is also necessary after a text objects string has been changed. This is only necessary for text and symbol entities.

Parameters
entityEntity whose extent to update.
Returns
true on success, false otherwise.