<< Click to Display Table of Contents >>

 

new sg.layers.GraphicsLayer()

 

 

Description

Add a GraphicsLayer object.

 

Position

GraphicLayer.js

 

 

Properties

 

Properties

Type

Description

surface

sg.geometry.Extent

Type of vector graphics surface used to draw graphics.

graphics

Array.<sg.Graphic>

An array of graphics which make up the layer.

maxScale

sg.InfoTemplate

Maximum visible scale of the layer.

minScale

Error

Minimum visible scale of the layer.

opacity

Number

Layer opacity.

renderer

Number

Definition of graphic render.

visible

Boolean

Layer visibility.

extent

Error

layer extent

infoTemplate

DOMNODE

the message shown in the info window of the graphic

loadError

Number

contains value if layer is failed to loaded

mouseEventEnabled

sg.renderers.Render

whether to enable mouse event

node

Object

layer html node

name

DOMNODE

layer name

svgContainer

String

the div of layer

title

Boolean

layer title

 

 

Methods

 

Methods

Type

Description

add(graphic)

sg.Graphic

Add a graphic.

Name

Type

Description

graphic

sg.Graphic

Graphic

clear()


Clear all graphics.

disableMouseEvents()


Disable all mouse events on the graphic layer.

enableMouseEvents()


Enable all mouse events on the graphic layer.

getMap()

Returns:

MapBase

Return the map control that the layer is added to.

Returns:

Type

Description

MapBase

The target mapbase

getName()

Returns:

String

return layer name.

Returns:

Type

Description

String

The layer name

getNode()

Returns:

DOMNODE

Returns the layer's DOM node.

Returns:

Type

Description

DOMNODE

The layer html node

getTitle()

Returns:

String

return layer title.

Returns:

Type

Description

String

The layer title

getVisible()

Returns:

Boolean

return layer visibility.

Returns:

Type

Description

Boolean

True: Visible
False: Invisible

hide()


Hide the layer.

Initialize()


called method when layer is added to MapBase.

isVisibleAtScale(scale)

scale:number

Returns:Boolean

A Boolean value representing the visibility of the layer at the specific scale.

Name

Type

Description

graphic

sg.Graphic

Graphic

Returns:

Type

Description

Boolean

True: Visible
False: Invisible

putName(newVal)

String

set layer name.

Name

Type

Description

newVal

String

The layer name

putTitle(newVal)

String

set layer visibility.

Name

Type

Description

newVal

String

The layer title

putVisible(newVal)

Boolean

set layer visibility.

Name

Type

Description

newVal

Boolean

True: Visible
False: Invisible

RebuildElement()


redraw layer.

redraw()


Redraw all graphics in the specified layer.

remove(graphic)

sg.Graphic

Remove a specified graphic.

Name

Type

Description

graphic

sg.Graphic

The graphic object

RemoveSelf()


remove self.

setInfoTemplate(temp)

sg.InfoTemplate        

Define the layer's info template.

Name

Type

Description

temp

sg.InfoTemplate        

The info template

setMaxScale(maxScale)

Number

Define the maximum scale for the layer.

Name

Type

Description

maxScale

Number

The max scale for visible

setMinScale(minScale)

Number

Define the minimum scale for the layer.

Name

Type

Description

minScale

Number

The min scale for visible

setOpacity(opacity)

Number

Define opacity of the graphic layer.

Name

Type

Description

opacity

Number

0: 100% transparent
1: No transparency

setRenderer(renderer)

sg.renderers.Renderer

Define the renderer for the graphic layer.

Name

Type

Description

renderer

sg.renderers.Renderer        

The render object

setVisibility(newVal)

Boolean

Define the visibility of the layer.

Name

Type

Description

newVal

Boolean

True: Visible
False: Invisible

show()


Show the layer.

UpdateElement()


update layer.

 

 

Events

 

Event

Description

click

triggered when clicked on graphics

dbl-click

triggered when double clicked on graphics

graphic-add

triggered when graphics are added

graphic-clear

triggered when all graphics are cleared

graphic-remove

triggered when a graphic is removed

load

triggered when layers are loaded

mouse-down

triggered when mouse presses down on a graphic

mouse-move

triggered when mouse moves on a graphic

mouse-out

triggered when mouse moves out of a graphic

mouse-over

triggered when mouse moves into a graphic

mouse-up

triggered when mouse-click releases on a graphic

 

 

Example

 

 

<script type="text/javascript" src="scripts/Symbol.js"></script>

<script type="text/javascript" src="scripts/Graphic.js"></script>

<script type="text/javascript" src="scripts/GraphicsLayer.js"></script>

 

var gLayer = new sg.GraphicsLayer();

var graphic = new sg.Graphic();

graphic.symbol = new sg.symbols.SimpleMarkerSymbol();

graphic.symbol.setOutline(new sg.symbols.SimpleLineSymbol());

graphic.symbol.setColor(new sg.Color(200, 255, 200, 1));

gLayer.add(graphic);

 

 

 


©2015 Supergeo Technologies Inc.