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
OpenLayers.Control.MapCapturerThe MapCapturer control shows a box on the map to illustrate the area that will be captured.
Properties
layer{OpenLayers.Layer.Vector}
feature.  The active feature which is repsonding to mouse action{OpenLayers.Feature.Vector}
captureBox.  It’s the feature represnting the capture area{OpenLayers.Feature.Vector}
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.
rotateHandleEnd.  It’s the feature responding to the rotate command.(OpenLayers.Feature.Vector)
snappingLine.  It’s the feature indicating a certain angle to snap to.  It shows up in the rotate process(OpenLayers.Feature.Vector)
rotation.  The rotation of the capture box{float}
rotateHandleLength.  Defines the length of the rotate handlein pixel.
captureBoxStyle.  Style for the capture box{OpenLayers.Style}
rotateHandleStyle.  Style for the rotate handle(OpenLayers.Style)
rotateHandlePointStyle.  Style for the snap handle’s start and end points(OpenLayers.Style)
snappingLineStyle.  Style for the snapping line(OpenLayers.Style)
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{OpenLayers.Pixel}
Functions
OpenLayers.Control.DragFeatureCreate a new control to drag features.
overFeatureCalled when the feature handler detects a mouse-over on a feature.
isDraggingCheck if it’s currently in dragging to move mode
isRotatingCheck if it’s currently in rotatiing mode
downFeatureCalled when the drag handler detects a mouse-down.
setCursorSet the cursor according to current action: moving or rotating
moveFeatureCalled when the drag handler detects a mouse-move.
moveFeatureMove the feature according to the mouse-move
moveFeatureCalled when the drag handler detects a mouse-move.
drawSnappingHintDraw the snapping line
clearSnappingHintClear the snapping line
calculateAngleCalculates the rotate angle, in degree and counterclockwise
upFeatureCalled when the drag handler detects a mouse-up.
outFeatureCalled when the feature handler detects a mouse-out on a feature.
cancelCalled when the drag handler detects a mouse-out (from the map viewport).
setMapSet the map property for the control and all handlers.
setRegionSet the size of the capture box.
drawFeaturesDraw the capture box, rotate handle etc.
clearFeatures:Clear the capture box, rotate handle etc.
createCaptureBoxCreate the capture box feature
createRotateHandleCreate the rotate handle feature
validateResolutionCheck if the capture box could display completely on current screen view port.
getCaptureBoxGet the capture area.
getNormalizedCaptureGet the normalized capture box
getCaptureRotationGet the capture rotation
enableEnable the capture box to display it on the map
disableDisable the capture box.
Properties
CLASS_NAME.  The class name

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.

isDragging

isDragging: function()

Check if it’s currently in dragging to move mode

isRotating

isRotating: function()

Check if it’s currently in rotatiing 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.
isDragging: function()
Check if it’s currently in dragging to move mode
isRotating: function()
Check if it’s currently in rotatiing 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
Close