Class MVRectangleTool
MVRectangleTool defines a rectangle tool that can be used to draw a "rubber-band" style rectangle on the map, by holding down and dragging the mouse.
As soon as the mouse button is released, a rectangle FOI will be displayed on the map. To remove this FOI you must call the tool's clear() method.
Constructor Attributes | Constructor Name and Description |
---|---|
MVRectangleTool(rectStyle, foiServerUrl)
|
Method Attributes | Method Name and Description |
---|---|
addEventListener(event, listener)
This method is deprecated.
|
|
attachEventListener(event, listener)
This method attach an event listener to the rectangle tool.
|
|
clear()
This method clears the rectangle displayed on the map.
|
|
detachEventListener(event, listener)
This method detaches an event listener that has previously been attached to the circle tool
by #attachEventListener.
|
|
getHeight(unit)
This method returns the proximate height of the rectangle.
|
|
This method returns the MVSdoGeometry object that specifies the rectangle on the map.
|
|
This method returns the rectangle DIV after the user finishes drawing
rectangle and releases the mouse left button.
|
|
This method returns the rectangle area FOI after the user finishes drawing
rectangle and releases the mouse left button.
|
|
This method gets the status of the rectangle tool.
|
|
getWidth(unit)
This method returns the proximate width of the rectangle.
|
|
init()
This method activates and initializes the rectangle tool.
|
|
setAreaStyle(areaStyle)
This method sets the rectangle area style used to render the rectangle area FOI after the
user finishes rubber banding and releases the mouse button.
|
|
setDivBorderStyle(color, width, dashedOrSolid)
This method customizes the border style of the rectangle DIV displayed while
the user drags the mouse with the left mouse button being pressed.
|
|
setDivFillColor(color, opacity)
This method customizes the filling color of the rectangle
DIV displayed while the user drags the mouse with the left mouse button being pressed.
|
|
setEventListener(event, listener)
This method is deprecated.
|
Class Detail
MVRectangleTool(rectStyle, foiServerUrl)
- Parameters:
- {String} rectStyle
- a string parameter that specifies the MapViewer area style to be used to render the rectangle area FOI after the user finishes rubber banding and releases the mouse button. The style is specified in the form "data-source-name"."style-name", where "style-name" is the name of the MapViewer area style and "data-source-name" is the name of data source in which the style is defined. If this parameter is omitted or set to null, no rectangle FOI will be generated or displayed after the user releases the mouse button.
- {String} foiServerUrl
- an optional String parameter that specifies the URL of the FOI server, which should be in the form http://host:port/mapviewer/foi. If this parameter is omitted, the URL of the FOI server is derived from MapViewer base URL.
- Returns:
- The newly created MVRectangleTool object.
Method Detail
{void}
addEventListener(event, listener)
This method is deprecated. Please use #setEventListener instead.
- Parameters:
- event
- listener
{void}
attachEventListener(event, listener)
This method attach an event listener to the rectangle tool. One of the following types of event
listener can be associated with the rectangle tool through this method: MVEvent.START, MVEvent.FINISH
and MVEvent.DRAG.
- A MVEvent.START event is fired when the rectangle tool is activated and the user starts the rectangle drawing by clicking the mouse left key on the map.
- A MVEvent.FINISH event is fired when the user finishes the rectangle drawing by releasing the mouse left key.
- A MVEvent.DRAG listener is fired when the user drags the mouse while holding the mouse left key.
No parameter is passed to the listener function when it is invoked.
- Parameters:
- {String} event
- a String that specifies the type of event to be handled by the listener. It can be either MVEvent.START, MVEvent.FINISH and MVEvent.DRAG.
- {Function} listener
- the reference to listener function.
- Returns:
- none
{void}
clear()
This method clears the rectangle displayed on the map.
- Returns:
- none
{void}
detachEventListener(event, listener)
This method detaches an event listener that has previously been attached to the circle tool
by #attachEventListener.
- Parameters:
- {String} event
- a String that specifies the type of event to be handled by the listener. It can be either MVEvent.START, MVEvent.FINISH and MVEvent.DRAG.
- {Function} listener
- the reference to listener function.
- Returns:
- none
{double}
getHeight(unit)
This method returns the proximate height of the rectangle.
- Parameters:
- unit
- a string that specifies the name of the distance unit. If omitted, the height is calculated in the default distance unit of the map coordinate system.
- Returns:
- the rectangle height.
{MVSdoGeometry}
getRectangle()
This method returns the MVSdoGeometry object that specifies the rectangle on the map.
- Returns:
- the MVSdoGeometry object that specifies the rectangle on the map.
- Requires:
- MVSdoGeometry
- See:
- MVSdoGeometry
{DIV}
getRectangleDIV()
This method returns the rectangle DIV after the user finishes drawing
rectangle and releases the mouse left button.
- Returns:
- the rectangle DIV object after the user finishes drawing rectangle and releases the mouse left button.
{MVFOI}
getRectangleFOI()
This method returns the rectangle area FOI after the user finishes drawing
rectangle and releases the mouse left button.
- Returns:
- the MVFOI object that represents the rectangle area FOI after the user finishes drawing rectangle and releases the mouse left button.
- Requires:
- MVFOI
- See:
- MVFOI
{int}
getStatus()
This method gets the status of the rectangle tool. At any give time, the rectangle
tool can be in one of the following statuses:
- 0: Not ready
- 1: Ready and initialized
- 2: Being dragged
- 3: Dragging finished
- Returns:
- the status of the rectangle tool.
{double}
getWidth(unit)
This method returns the proximate width of the rectangle.
- Parameters:
- unit
- a string that specifies the name of the distance unit. If omitted, the width is calculated in the default distance unit of the map coordinate system.
- Returns:
- the rectangle width.
{void}
init()
This method activates and initializes the rectangle tool.
The application must call this method to activate the
rectangle tool before the user can draw rectangle on the map.
- Returns:
- none
{void}
setAreaStyle(areaStyle)
This method sets the rectangle area style used to render the rectangle area FOI after the
user finishes rubber banding and releases the mouse button.
- Parameters:
- {Object} areaStyle
- A string or style object which specifies the area rendering style.
If it is a string, the string should be in the form of
. , where is the name of the style which is defined in the USER_SDO_STYLES view, and is the name of the data source in which the style is defined. If it is a style object, it should be of type MVStyleColor or MVXMLStyle.
- Returns:
- none
{void}
setDivBorderStyle(color, width, dashedOrSolid)
This method customizes the border style of the rectangle DIV displayed while
the user drags the mouse with the left mouse button being pressed.
- Parameters:
- {String} color
- a String that specifies the color of the border, for example, "#FF0000".
- {int} width
- an integer that specifies the width of the border
- {String} dashedOrSolid
- a String that specifies the border style, which can be "dashed" or "solid". The default border style is "dashed".
- Returns:
- none
{void}
setDivFillColor(color, opacity)
This method customizes the filling color of the rectangle
DIV displayed while the user drags the mouse with the left mouse button being pressed.
- Parameters:
- {String} color
- a String that specifies the filling color, e.g. "#FF0000".
- {Number} opacity
- a valid number ranging from 0 to 1, e.g. 0.2
- Returns:
- none
{void}
setEventListener(event, listener)
This method is deprecated. Please use #attachEventListener instead.
- Parameters:
- event
- listener