Class adf.graphics.Element
Defined in: Element.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Represents a graphics display element which allows drawing various graphical objects.
|
Method Attributes | Method Name and Description |
---|---|
clear()
Clears all graphics from the root graphics container node.
|
|
Removes clipping from the graphics element if present.
|
|
clip(rect)
Clips graphics outside the given adf.Rectangle bounds.
|
|
destroy()
Removes the graphics DOM node hierarchy cleanly from the document
|
|
drawCircle(center, radius, symbol)
Draws a circle graphic with the provided symbol and geometry properties
|
|
drawImage(src, left, top, width, height, symbol)
Draws an image graphic with the provided symbol and geometry properties
|
|
drawLine(point1, point2, symbol)
Draws a line graphic with the provided symbol and geometry properties
|
|
drawOval(bounds, symbol)
Draws an oval graphic with the provided symbol and geometry properties
|
|
drawPoint(point, symbol)
Draws a point graphic with the provided symbol and geometry properties
|
|
drawPolygon(point, symbol)
Draws a polygon graphic with the provided symbol and geometry properties
|
|
drawPolyline(points, symbol)
Draws a polyline graphic with the provided symbol and geometry properties
|
|
drawRectangle(rectangle, symbol)
Draws a rectangle graphic with the provided symbol and geometry properties
|
|
drawText(text, bounds, style, symbol)
Draws a text label graphic with the provided symbol and geometry properties
|
|
hide()
Hides the graphics element.
|
|
remove(element)
Removes the given element from the graphics container cleanly.
|
|
show()
Shows the graphics element.
|
|
updateElement(element, properties)
Updates the specified graphic element geometry with the provided properties
|
|
updateSymbol(element, symbol)
Updates the specified element symbology with the provided adf.GraphicsSymbol properties
|
Class Detail
adf.graphics.Element(id)
Represents a graphics display element which allows drawing various graphical objects.
This class acts as a base class with empty default functions that can be instantiated but will provide no functionality out of the box. Functional out of the box implementations include adf.graphics.SvgElement for Mozilla and Chrome browsers and adf.graphics.VmlElement for Internet Explorer. To draw graphical object, use the pixel coordinates in the DOM element that holds map images and graphics.
adf.Utils.createGraphicsElement provieds a browser independent way of creating a graphics element.- Parameters:
- {String} id
- the id of this graphics element instance
Method Detail
clear()
Clears all graphics from the root graphics container node.
clearClip()
Removes clipping from the graphics element if present.
clip(rect)
Clips graphics outside the given adf.Rectangle bounds.
- Parameters:
- {adf.Rectangle} rect
- the bounds to clip around
destroy()
Removes the graphics DOM node hierarchy cleanly from the document
{Element}
drawCircle(center, radius, symbol)
Draws a circle graphic with the provided symbol and geometry properties
var map = adf.Controls.maps['map1']; var gr = map.graphics; gr.clear(); var circle = {center: new adf.Point(200, 200), radius:100, symbol: {lineWidth:2, lineColor:'#FC0', fillColor:'#CF3', lineOpacity:1, fillOpacity:1}}; gr.drawCircle(circle.center, circle.radius, circle.symbol);
- Parameters:
- {adf.Point} center
- The center point of the circle
- {Integer} radius
- The radius of the circle in pixels
- {adf.GraphicsSymbol} symbol
- Returns:
- {Element} The graphic element drawn on this graphics element
{Element}
drawImage(src, left, top, width, height, symbol)
Draws an image graphic with the provided symbol and geometry properties
- Parameters:
- {String} src
- The URL to the image to draw
- {Integer} left
- The distance from the left of the graphics container
- {Integer} top
- The distance from the top of the graphics container
- {Integer} width
- The width of the image graphic in pixels
- {Integer} height
- The height of the image graphic in pixels
- {adf.GraphicsSymbol} symbol
- Returns:
- {Element} The graphic element drawn on this graphics element
{Element}
drawLine(point1, point2, symbol)
Draws a line graphic with the provided symbol and geometry properties
- Parameters:
- {adf.Point} point1
- The start point of the line
- {adf.Point} point2
- The end point of the line
- {adf.GraphicsSymbol} symbol
- Returns:
- {Element} The graphic element drawn on this graphics element
{Element}
drawOval(bounds, symbol)
Draws an oval graphic with the provided symbol and geometry properties
var map = adf.Controls.maps['map1']; var gr = map.graphics; gr.clear(); gr.drawOval(new adf.Rectangle(100, 100, 200, 100));
- Parameters:
- {adf.Rectangle} bounds
- The rectangle with bounds the oval shape
- {adf.GraphicsSymbol} symbol
- Returns:
- {Element} The graphic element drawn on this graphics element
{Element}
drawPoint(point, symbol)
Draws a point graphic with the provided symbol and geometry properties
- Parameters:
- {adf.Point} point
- {adf.GraphicsSymbol} symbol
- Deprecated:
- use drawCircle instead
- Returns:
- {Element} The graphic element drawn on this graphics element
{Element}
drawPolygon(point, symbol)
Draws a polygon graphic with the provided symbol and geometry properties
- Parameters:
- {adf.Point[]} point
- The set of points to draw
- {adf.GraphicsSymbol} symbol
- Returns:
- {Element} The graphic element drawn on this graphics element
{Element}
drawPolyline(points, symbol)
Draws a polyline graphic with the provided symbol and geometry properties
var map = adf.Controls.maps['map1']; map.graphics.clear(); var pointA = new adf.Point(100,100); var pointB = new adf.Point(100,150); var pointC = new adf.Point(200,100); map.graphics.drawPolyline([pointA, pointB, pointC], {lineWidth:5, lineColor:'#62D',lineOpacity:0.6});
- Parameters:
- {adf.Point[]} points
- The ordered list of points to draw
- {adf.GraphicsSymbol} symbol
- Returns:
- {Element} The graphic element drawn on this graphics element
{Element}
drawRectangle(rectangle, symbol)
Draws a rectangle graphic with the provided symbol and geometry properties
- Parameters:
- {adf.Rectangle} rectangle
- {adf.GraphicsSymbol} symbol
- Returns:
- {Element} The graphic element drawn on this graphics element
{Element}
drawText(text, bounds, style, symbol)
Draws a text label graphic with the provided symbol and geometry properties
- Parameters:
- {String} text
- The string to draw
- {adf.Rectangle} bounds
- The rectangle bounding the text label
- {String} style
- A CSS inline selector to apply to the text
- {adf.GraphicsSymbol} symbol
- Returns:
- {Element} The graphic element drawn on this graphics element
hide()
Hides the graphics element. See adf.Utils.hideElement.
remove(element)
Removes the given element from the graphics container cleanly.
- Parameters:
- {Element} element
- the element to remove
show()
Shows the graphics element. See adf.Utils.showElement.
updateElement(element, properties)
Updates the specified graphic element geometry with the provided properties
- Parameters:
- {Element} element
- The element to update
- {Object} properties
- The new geometry properties to apply to the element
updateSymbol(element, symbol)
Updates the specified element symbology with the provided adf.GraphicsSymbol properties
- Parameters:
- {Element} element
- The element to update
- {adf.GraphicsSymbol} symbol
- The new symbol properties to apply to the element