For documentation on the current version, please check Knowledge Base.
Sample : Zoom to the bounds of an object
This example documents how you can select a number of objects and then zoom to the extent of the selection.
What basically happens is we :
- Execute a startup operation (implies we zoom to the focus rectangle after execution)
- Execute a number of XML Operations inside the startup operation (selecting the objects and returning the right focus to the client).
Sample Setup
zoomToObjects() - zooms to objects with attribute OIDN set to 5681 or 5690.
Overview
Zoom To Extent
var ofm; this.zoomToExtent = function() { ofm.zoomToExtent(); }
We execute the zoomToExtent() function.
Zoom To Object
We use a custom startup operation to make the selection :
var ofm; this.zoomToObjects = function() { var layer = ofm.getSelectionLayer(); var margin = 10; var operation = "\ <Operations>\ <SelectObjects>\ <SelectionGroupName>FocusSelection</SelectionGroupName>\ <DataSetName>"+ layer +"</DataSetName>\ <Restriction>\ <ModelId>1</ModelId>\ <Restriction>\ <AttributeSetName>Attributes</AttributeSetName>\ <AttributeName>OIDN</AttributeName>\ <AllowedValue>5681,5690</AllowedValue>\ <PatternSearch>false</PatternSearch>\ </Restriction>\ </Restriction>\ <AllowedValueSeparator>,</AllowedValueSeparator>\ </SelectObjects>\ <ClearFocus/>\ <AddSelectionToFocus>\ <SelectionGroupName>FocusSelection</SelectionGroupName>\ </AddSelectionToFocus>\ <GetFocus>\ <Margin>"+ margin +"</Margin>\ </GetFocus>\ </Operations>"; ofm.runPlainStartupOperation(operation); }
Overview
We execute the following operations :
- SelectObjects : Select the object in a separate selectiongroup named “FocusSelection”
- ClearFocus : Clear the existing server-side focus rectangle
- AddSelectionToFocus : Add the bounds of the “FocusSelection” selectiongroup to the server-side focus rectangle.
- GetFocus : Get the server-side focus rectangle.
All these operations are executed as a “startup operation” which implies the following :
- A server-side focus rectangle may be returned and will be copied to the client-side focus rectangle.
- The client will automatically zoom to the client-side focus rectangle after execution.
Pattern Searches
The attribute value may contain a unix-style wildcard using filename expansion – also known as “globbing”.
By adding the <PatternSearch>false</PatternSearch> tag of the <Restriction> element, you can use wildcards in your attribute values. Example : [!-]* would match any string not starting with '-'.