Control to transform features with a standard transformation box.
ALKMaps. | Control to transform features with a standard transformation box. |
Properties | |
events | {ALKMaps.Events} Events instance for listeners and triggering control specific events. |
geometryTypes | {Array(String)} To restrict transformation to a limited set of geometry types, send a list of strings corresponding to the geometry class names. |
layer | {ALKMaps.Layer.Vector} |
preserveAspectRatio | {Boolean} set to true to not change the feature’s aspect ratio. |
rotate | {Boolean} set to false if rotation should be disabled. |
feature | {ALKMaps.Feature.Vector} Feature currently available for transformation. |
renderIntent | {String|Object} Render intent for the transformation box and handles. |
rotationHandleSymbolizer | {Object|String} Optional. |
box | {ALKMaps.Feature.Vector} The transformation box rectangle. |
center | {ALKMaps.Geometry.Point} The center of the feature bounds. |
scale | {Float} The scale of the feature, relative to the scale the time the feature was set. |
ratio | {Float} The ratio of the feature relative to the ratio the time the feature was set. |
rotation | {Integer} the current rotation angle of the box. |
handles | {Array(ALKMaps.Feature.Vector)} The 8 handles currently available for scaling/resizing. |
rotationHandles | {Array(ALKMaps.Feature.Vector)} The 4 rotation handles currently available for rotating. |
dragControl | {ALKMaps.Control.DragFeature} |
irregular | {Boolean} Make scaling/resizing work irregularly. |
Constructor | |
ALKMaps. | Create a new transform feature control. |
Functions | |
activate | Activates the control. |
deactivate | Deactivates the control. |
setMap | |
setFeature | Place the transformation box on a feature and start transforming it. |
unsetFeature | Remove the transformation box off any feature. |
createBox | Creates the box with all handles and transformation handles. |
createControl | Creates a DragFeature control for this control. |
drawHandles | Draws the handles to match the box. |
transformFeature | Transforms the feature. |
destroy | Take care of things that are not handled in superclass. |
{ALKMaps.Events} Events instance for listeners and triggering control specific events.
control.events.register(type, obj, listener);
beforesetfeature | Triggered before a feature is set for tranformation. The feature will not be set if a listener returns false. Listeners receive a feature property, with the feature that will be set for transformation. Listeners are allowed to set the control’s scale, ratio and rotation properties, which will set the initial scale, ratio and rotation of the feature, like the setFeature method’s initialParams argument. |
setfeature | Triggered when a feature is set for tranformation. Listeners receive a feature property, with the feature that is now set for transformation. |
beforetransform | Triggered while dragging, before a feature is transformed. The feature will not be transformed if a listener returns false (but the box still will). Listeners receive one or more of center, scale, ratio and rotation. The center property is an ALKMaps.Geometry.Point object with the new center of the transformed feature, the others are Floats with the scale, ratio or rotation change since the last transformation. |
transform | Triggered while dragging, when a feature is transformed. Listeners receive an event object with one or more of center, scale*, ratio and rotation. The center property is an ALKMaps.Geometry.Point object with the new center of the transformed feature, the others are Floats with the scale, ratio or rotation change of the feature since the last transformation. |
transformcomplete | Triggered after dragging. Listeners receive an event object with the transformed feature. |
{ALKMaps.Feature.Vector} Feature currently available for transformation. Read-only, use setFeature to set it manually.
{ALKMaps.Feature.Vector} The transformation box rectangle. Read-only.
{ALKMaps.Geometry.Point} The center of the feature bounds. Read-only.
{Array(ALKMaps.Feature.Vector)} The 8 handles currently available for scaling/resizing. Numbered counterclockwise, starting from the southwest corner. Read-only.
{Array(ALKMaps.Feature.Vector)} The 4 rotation handles currently available for rotating. Numbered counterclockwise, starting from the southwest corner. Read-only.
Create a new transform feature control.
layer | {ALKMaps.Layer.Vector} Layer that contains features that will be transformed. |
options | {Object} Optional object whose properties will be set on the control. |
setFeature: function( feature, initialParams )
Place the transformation box on a feature and start transforming it. If the control is not active, it will be activated.
feature | {ALKMaps.Feature.Vector} |
initialParams | {Object} Initial values for rotation, scale or ratio. Setting a rotation value here will cause the transformation box to start rotated. Setting a scale or ratio will not affect the transormation box, but applications may use this to keep track of scale and ratio of a feature across multiple transforms. |
Activates the control.
activate: function()
Deactivates the control.
deactivate: function()
setMap: function( map )
Place the transformation box on a feature and start transforming it.
setFeature: function( feature, initialParams )
Remove the transformation box off any feature.
unsetFeature: function()
Creates the box with all handles and transformation handles.
createBox: function()
Creates a DragFeature control for this control.
createControl: function()
Draws the handles to match the box.
drawHandles: function()
Transforms the feature.
transformFeature: function( mods )
Take care of things that are not handled in superclass.
destroy: function()