1
<html xmlns="http://www.w3.org/1999/xhtml">
3
<title>OpenLayers Graphic Names</title>
4
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
5
<link rel="stylesheet" href="style.css" type="text/css" />
6
<script src="../lib/OpenLayers.js"></script>
7
<script type="text/javascript">
11
map = new OpenLayers.Map('map');
13
// list of well-known graphic names
14
var graphics = ["star", "cross", "x", "square", "triangle", "circle"];
16
// Create one feature for each well known graphic.
17
// Give features a type attribute with the graphic name.
18
var num = graphics.length;
19
var slot = map.maxExtent.getWidth() / num;
20
var features = Array(num);
21
for(var i=0; i<graphics.length; ++i) {
22
lon = map.maxExtent.left + (i * slot) + (slot / 2);
23
features[i] = new OpenLayers.Feature.Vector(
24
new OpenLayers.Geometry.Point(
25
map.maxExtent.left + (i * slot) + (slot / 2), 0
32
// Create a style map for painting the features.
33
// The graphicName property of the symbolizer is evaluated using
34
// the type attribute on each feature (set above).
35
var styles = new OpenLayers.StyleMap({
37
graphicName: "${type}",
39
strokeColor: "fuchsia",
50
// Create a vector layer and give it your style map.
51
var layer = new OpenLayers.Layer.Vector(
52
"Graphics", {styleMap: styles, isBaseLayer: true}
54
layer.addFeatures(features);
57
// Create a select feature control and add it to the map.
58
var select = new OpenLayers.Control.SelectFeature(layer, {hover: true});
59
map.addControl(select);
62
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
66
<body onload="init()">
67
<h1 id="title">Named Graphics Example</h1>
72
Shows how to use well-known graphic names.
75
<div id="map" class="smallmap"></div>
78
OpenLayers supports well-known names for a few graphics. You can use
79
the names "star", "cross", "x", "square", "triangle", and "circle" as
80
the value for the graphicName property of a symbolizer.
b'\\ No newline at end of file'