![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
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) |
TSLEntity * | findEntity (TSLTMC x, TSLTMC y, TSLDeviceUnits aperture, int depth) |
bool | getChanged () |
TSLEditorConstraintType | getConstraint (double *parameter) |
TSLDrawingSurface * | getDrawingSurface () |
TSLDataLayer * | getEditableDataLayer () |
TSLEntitySet * | getEntitySet () |
int | getNumSelected () |
TSLEntity * | getSelection (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) |
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.
name | Name of new operation to activate. |
data | Any operation specific data to pass to the operations activate method. |
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.
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.
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.
removeHighlights | Flag to indicate whether highlights should be removed immediately. |
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.
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.
entity | Entity to remove from select list. |
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.
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.
display | Flag to indicate whether selection highlights should be displayed. |
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.
message | message to send |
void TSLUserOperationRequest::feedbackAttributesChanged | ( | const TSLEntityReferenceSet * | entities | ) |
Call when entities have their attributes changed, typically rendering attributes.
entities | The reference set of entities being acted upon. |
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.
entities | The reference set of entities being acted upon. |
replacingOtherEntities | This flag indicates whether the entities being created are replacing other entities that have just be deleted. |
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.
entities | The reference set of entities being acted upon. |
willBeReplaced | This 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. |
void TSLUserOperationRequest::feedbackDeselected | ( | const TSLEntityReferenceSet * | entities | ) |
Call when entities are removed from the select list.
entities | The reference set of entities being acted upon. |
void TSLUserOperationRequest::feedbackGeometryChanged | ( | const TSLEntityReferenceSet * | entities | ) |
Call when entities have their geometry changed - e.g. move/scale/addpoint etc.
entities | The reference set of entities being acted upon. |
void TSLUserOperationRequest::feedbackReordered | ( | const TSLEntityReferenceSet * | entities | ) |
Call when entities are reordered beneath their current parent, (back/front)
entities | The reference set of entities being acted upon. |
void TSLUserOperationRequest::feedbackReparented | ( | const TSLEntityReferenceSet * | entities | ) |
Call when objects are moved up or down the entity hierarchy, e.g. grouped/ungrouped.
entities | The reference set of entities being acted upon. |
void TSLUserOperationRequest::feedbackSelected | ( | const TSLEntityReferenceSet * | entities | ) |
Call when entities are added to the select list.
entities | The reference set of entities being acted upon. |
void TSLUserOperationRequest::feedbackUndeleted | ( | const TSLEntityReferenceSet * | entities, |
bool | replacingOtherEntities ) |
Call when an operation that deletes entities is undone.
entities | The reference set of entities being acted upon. |
replacingOtherEntities | This flag indicates whether the entities being created are replacing other entities that have just be deleted. |
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.
x | X position, in TMC units. |
y | Y position, in TMC units. |
aperture | Size of search aperture, in device units. |
depth | Depth to descend into entity set hierarchy. |
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.
TSLEditorConstraintType TSLUserOperationRequest::getConstraint | ( | double * | parameter | ) |
Query the current constraint setting.
parameter | Storage for any constraint parameter. |
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.
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.
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.
int TSLUserOperationRequest::getNumSelected | ( | ) |
Query the number of entities currently selected.
Returns the number of entities on the select list.
TSLEntity * TSLUserOperationRequest::getSelection | ( | int | n | ) |
This method returns the Nth item in the select list.
n | Index into the select list. |
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.
entity | Individual entity to highlight. |
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.
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.
key | Key to lookup from the configuration file. |
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.
key | Key to lookup from the message file. |
bool TSLUserOperationRequest::redraw | ( | bool | clear | ) |
Redraw entire drawing surface.
clear | Flag indicating whether drawing surface should be cleared before redrawn. |
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.
extent1 | Extent 1 to redraw. |
extent2 | Extent 2 to redraw. |
clear | Flag indicating whether drawing surface should be cleared before redrawn. |
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.
entity | Entity whose extent to redraw. |
clear | Flag indicating whether drawing surface should be cleared before redrawn. |
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.
extent | Extent to redraw. |
clear | Flag indicating whether drawing surface should be cleared before being redrawn. |
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.
prompt | The prompt requesting a user selection. |
l1 | The text label for button 1. |
l2 | The text label for button 2. |
l3 | The text label for button 3. |
l4 | The text label for button 4. |
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.
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.
entity | Entity to add to select list. |
Obsolete deprecated methods - redirect to correct ones
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.
changed | Value to set changed flag to. |
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.
style | Action being performed. |
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.
type | Type of echo required. |
points | Pointer to array of points for echo. |
num | Number of points in array. |
anchor | Optional anchor point for dynamic echo. |
Return true on success, false on failure.
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.
type | Type of echo required, None/Point/Line |
points | Pointer to array of points for echo. |
num | Number of points in array. |
Return true on success, false on failure.
bool TSLUserOperationRequest::snapPoint | ( | TSLLocatorEvent & | point | ) |
This method snaps the specified point, according to the locator buttons and modifiers.
point | Locator event to snap |
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.
point | Locator event to snap |
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.
entity | Entity whose extent to update. |