source:
trunk/workshop-routing-foss4g/web/OpenLayers/lib/OpenLayers/Style2.js
@
76
Revision 76, 2.8 KB checked in by djay, 12 years ago (diff) | |
---|---|
|
Line | |
---|---|
1 | /* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for |
2 | * full list of contributors). Published under the Clear BSD license. |
3 | * See http://svn.openlayers.org/trunk/openlayers/license.txt for the |
4 | * full text of the license. */ |
5 | |
6 | /** |
7 | * @requires OpenLayers/Rule.js |
8 | * @requires OpenLayers/Symbolizer/Point.js |
9 | * @requires OpenLayers/Symbolizer/Line.js |
10 | * @requires OpenLayers/Symbolizer/Polygon.js |
11 | * @requires OpenLayers/Symbolizer/Text.js |
12 | * @requires OpenLayers/Symbolizer/Raster.js |
13 | */ |
14 | |
15 | /** |
16 | * Class: OpenLayers.Style2 |
17 | * This class represents a collection of rules for rendering features. |
18 | */ |
19 | OpenLayers.Style2 = OpenLayers.Class({ |
20 | |
21 | /** |
22 | * Property: id |
23 | * {String} A unique id for this session. |
24 | */ |
25 | id: null, |
26 | |
27 | /** |
28 | * APIProperty: name |
29 | * {String} Style identifier. |
30 | */ |
31 | name: null, |
32 | |
33 | /** |
34 | * APIProperty: title |
35 | * {String} Title of this style. |
36 | */ |
37 | title: null, |
38 | |
39 | /** |
40 | * APIProperty: description |
41 | * {String} Description of this style. |
42 | */ |
43 | description: null, |
44 | |
45 | /** |
46 | * APIProperty: layerName |
47 | * {<String>} Name of the layer that this style belongs to, usually |
48 | * according to the NamedLayer attribute of an SLD document. |
49 | */ |
50 | layerName: null, |
51 | |
52 | /** |
53 | * APIProperty: isDefault |
54 | * {Boolean} |
55 | */ |
56 | isDefault: false, |
57 | |
58 | /** |
59 | * APIProperty: rules |
60 | * {Array(<OpenLayers.Rule>)} Collection of rendering rules. |
61 | */ |
62 | rules: null, |
63 | |
64 | /** |
65 | * Constructor: OpenLayers.Style2 |
66 | * Creates a style representing a collection of rendering rules. |
67 | * |
68 | * Parameters: |
69 | * config - {Object} An object containing properties to be set on the |
70 | * style. Any documented properties may be set at construction. |
71 | * |
72 | * Return: |
73 | * {<OpenLayers.Style2>} A new style object. |
74 | */ |
75 | initialize: function(config) { |
76 | OpenLayers.Util.extend(this, config); |
77 | this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); |
78 | }, |
79 | |
80 | /** |
81 | * APIMethod: destroy |
82 | * nullify references to prevent circular references and memory leaks |
83 | */ |
84 | destroy: function() { |
85 | for (var i=0, len=this.rules.length; i<len; i++) { |
86 | this.rules[i].destroy(); |
87 | } |
88 | delete this.rules; |
89 | }, |
90 | |
91 | /** |
92 | * APIMethod: clone |
93 | * Clones this style. |
94 | * |
95 | * Returns: |
96 | * {<OpenLayers.Style2>} Clone of this style. |
97 | */ |
98 | clone: function() { |
99 | var config = OpenLayers.Util.extend({}, this); |
100 | // clone rules |
101 | if (this.rules) { |
102 | config.rules = []; |
103 | for (var i=0, len=this.rules.length; i<len; ++i) { |
104 | config.rules.push(this.rules[i].clone()); |
105 | } |
106 | } |
107 | return new OpenLayers.Style2(config); |
108 | }, |
109 | |
110 | CLASS_NAME: "OpenLayers.Style2" |
111 | }); |
Note: See TracBrowser
for help on using the repository browser.