OpenLayers. Control. MapCapturer

The MapCapturer control shows a box on the map to illustrate the area that will be captured.  Normally the capture information will be used to print the map.  If the MapCapturer is configured not show the capture box, then the current viewport will be used as the capture area.

The user can move or rotate the capture box to change the area he’d like to capture.  And the user can hold SHIFT key to snapp to a certain angle when he is rotating the capture box

Inherits From

Summary
The MapCapturer control shows a box on the map to illustrate the area that will be captured.
(<OpenLayers.Feature.Vector)
And it’s also the start point of the rotate handle.
{float}
in pixel.
(string)
(int)
Create a new control to drag features.
Called when the feature handler detects a mouse-over on a feature.
Check if it’s currently in dragging to move mode
Check if it’s currently in dragging to rotate mode
Called when the drag handler detects a mouse-down.
Set the cursor according to current action: moving or rotating
Called when the drag handler detects a mouse-move.
Move the feature according to the mouse-move
Called when the drag handler detects a mouse-move.
Draw the snapping line
Clear the snapping line
Calculates the rotate angle, in degree and counterclockwise
Called when the drag handler detects a mouse-up.
Called when the feature handler detects a mouse-out on a feature.
Called when the drag handler detects a mouse-out (from the map viewport).
Set the map property for the control and all handlers.
Set the size of the capture box.
Draw the capture box, rotate handle etc.
Clear the capture box, rotate handle etc.
Create the capture box feature
Create the rotate handle feature
Check if the capture box could display completely on current screen view port.
Get the capture area.
Get the normalized capture box
Get the capture rotation
Enable the capture box to display it on the map
Disable the capture box.

Properties

feature.  The active feature which is repsonding to mouse action

captureBox.  It’s the feature represnting the capture area

rotateHandle.  It’s the feature representing a rotate handle

(<OpenLayers.Feature.Vector)

rotateHandleStart.  It’s the feature representing the center point of capture box.

And it’s also the start point of the rotate handle.  (OpenLayers.Feature.Vector)

rotateHandleEnd.  It’s the feature responding to the rotate command.

snappingLine.  It’s the feature indicating a certain angle to snap to.  It shows up in the rotate process

rotation.  The rotation of the capture box

{float}

rotateHandleLength.  Defines the length of the rotate handle

in pixel. default is 30 pixels {int}

captureBoxStyle.  Style for the capture box

rotateHandleStyle.  Style for the rotate handle

rotateHandlePointStyle.  Style for the snap handle’s start and end points

snappingLineStyle.  Style for the snapping line

warningMessage.  The warning message when the capture box cannot display completely in current zoom level

(string)

rotateSnappingStep.  Defines the rotate snapping angle step.  In degrees

(int)

rotateSnappingTolerance.  Defines the rotate snapping tolerance.  In degress

lastPixel.  The last position the mouse action was responded

Functions

OpenLayers. Control. DragFeature

Create a new control to drag features.

Parameters

mapThe widget map which encapsulates an OpenLayers.Map
options{Object} Optional object whose properties will be set on the control.

overFeature

overFeature: function(feature)

Called when the feature handler detects a mouse-over on a feature.  This enables the drag control if the event target is the outer polygon, and the rotate control will be activated if the event target is the inner polygon

Parameters

feature{OpenLayers.Feature.Vector} The selected feature.

dragging

dragging: function()

Check if it’s currently in dragging to move mode

dragging

Check if it’s currently in dragging to rotate mode

downFeature

downFeature: function(pixel)

Called when the drag handler detects a mouse-down.

Parameters

pixel{OpenLayers.Pixel} Location of the mouse event.

setCursor

setCursor: function()

Set the cursor according to current action: moving or rotating

moveFeature

Called when the drag handler detects a mouse-move.  Also calls the optional onDrag method.

moveFeature

moveFeature: function(evt)

Move the feature according to the mouse-move

moveFeature

Called when the drag handler detects a mouse-move.  Also calls the optional onDrag method.

drawSnappingHint

drawSnappingHint: function(angle)

Draw the snapping line

clearSnappingHint

clearSnappingHint: function()

Clear the snapping line

calculateAngle

calculateAngle: function(pixel,
origin)

Calculates the rotate angle, in degree and counterclockwise

upFeature

upFeature: function(pixel)

Called when the drag handler detects a mouse-up.

Parameters

pixel{OpenLayers.Pixel} Location of the mouse event.

outFeature

outFeature: function(feature)

Called when the feature handler detects a mouse-out on a feature.

Parameters

feature{OpenLayers.Feature.Vector} The feature that the mouse left.

cancel

cancel: function()

Called when the drag handler detects a mouse-out (from the map viewport).

setMap

setMap: function(map)

Set the map property for the control and all handlers.

Parameters

map{OpenLayers.Map} The control’s map.

setRegion

Set the size of the capture box.  Then the box will be redrawn on the map

Parameters

paperSize{OpenLayers.Size} The paper size, in mm
scaleDenominatorThe denominator of target scale

drawFeatures

drawFeatures: function()

Draw the capture box, rotate handle etc. on the map

clearFeatures:

clearFeatures: function()

Clear the capture box, rotate handle etc. from the map

createCaptureBox

createCaptureBox: function()

Create the capture box feature

createRotateHandle

createRotateHandle: function()

Create the rotate handle feature

validateResolution

validateResolution: function()

Check if the capture box could display completely on current screen view port.  If it cannot, then an warning message will show up to warn the user.  Then the user could zoom out to get the box back

Returns

(Boolean) True if the box can display completely, otherwise false.

getCaptureBox

getCaptureBox: function()

Get the capture area.

getNormalizedCapture

getNormalizedCapture: function()

Get the normalized capture box

getCaptureRotation

getCaptureRotation: function()

Get the capture rotation

enable

enable: function()

Enable the capture box to display it on the map

disable

disable: function()

Disable the capture box.  Then the capture box will not show up on the Map, and the current view port is treated as the capture area

Properties

CLASS_NAME.  The class name

Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources.
Vector features use the OpenLayers.Geometry classes as geometry description.
This class represents a UserStyle obtained from a SLD, containing styling rules.
This class represents a screen coordinate, in x and y coordinates
overFeature: function(feature)
Called when the feature handler detects a mouse-over on a feature.
dragging: function()
Check if it’s currently in dragging to move mode
downFeature: function(pixel)
Called when the drag handler detects a mouse-down.
setCursor: function()
Set the cursor according to current action: moving or rotating
moveFeature: function(evt)
Move the feature according to the mouse-move
drawSnappingHint: function(angle)
Draw the snapping line
clearSnappingHint: function()
Clear the snapping line
calculateAngle: function(pixel,
origin)
Calculates the rotate angle, in degree and counterclockwise
upFeature: function(pixel)
Called when the drag handler detects a mouse-up.
outFeature: function(feature)
Called when the feature handler detects a mouse-out on a feature.
cancel: function()
Called when the drag handler detects a mouse-out (from the map viewport).
setMap: function(map)
Set the map property for the control and all handlers.
drawFeatures: function()
Draw the capture box, rotate handle etc.
clearFeatures: function()
Clear the capture box, rotate handle etc.
createCaptureBox: function()
Create the capture box feature
createRotateHandle: function()
Create the rotate handle feature
validateResolution: function()
Check if the capture box could display completely on current screen view port.
getCaptureBox: function()
Get the capture area.
getNormalizedCapture: function()
Get the normalized capture box
getCaptureRotation: function()
Get the capture rotation
enable: function()
Enable the capture box to display it on the map
disable: function()
Disable the capture box.
Controls affect the display or behavior of the map.
Instances of OpenLayers.Map are interactive maps embedded in a web page.
Instances of this class represent a width/height pair