Compare commits
342 Commits
release-2.
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07dada3e0f | ||
|
|
0a87606285 | ||
|
|
12264fb33a | ||
|
|
91752898e0 | ||
|
|
ac1e566b70 | ||
|
|
9359035324 | ||
|
|
21b5141c09 | ||
|
|
bada3d98a1 | ||
|
|
2150a2c783 | ||
|
|
20cbb95feb | ||
|
|
14ac071f20 | ||
|
|
e7d3e64908 | ||
|
|
3de62b703a | ||
|
|
ff8b356638 | ||
|
|
180eb8485f | ||
|
|
48cc4b138b | ||
|
|
f4fbc96036 | ||
|
|
1f77d278ef | ||
|
|
7632e54a4d | ||
|
|
35168dc219 | ||
|
|
a5bb2b01b3 | ||
|
|
5038090d74 | ||
|
|
fcfb22920b | ||
|
|
d324395de6 | ||
|
|
a1db2ca642 | ||
|
|
1faed26393 | ||
|
|
fe9aa59b91 | ||
|
|
3304c6cb0e | ||
|
|
cca74e7635 | ||
|
|
27234b07ff | ||
|
|
223547e227 | ||
|
|
6ecdf6c1aa | ||
|
|
1c51a13903 | ||
|
|
c1409ee57d | ||
|
|
ba91df7f1b | ||
|
|
48ba06b294 | ||
|
|
4ab6b7ec24 | ||
|
|
76983744da | ||
|
|
37e0c0b4f5 | ||
|
|
c54dc76d15 | ||
|
|
1757d4082e | ||
|
|
fc4e05dd83 | ||
|
|
3e5bd85849 | ||
|
|
dc5fa3c612 | ||
|
|
e7b0857e31 | ||
|
|
1dd852ef09 | ||
|
|
a036ffff1b | ||
|
|
bc1246877e | ||
|
|
e061da04c9 | ||
|
|
1d6c1f437e | ||
|
|
4e2d70b770 | ||
|
|
90c6a020c7 | ||
|
|
891b12160c | ||
|
|
bc84b54343 | ||
|
|
fd768cf170 | ||
|
|
6fa1a14456 | ||
|
|
94c4837475 | ||
|
|
3d4d2de615 | ||
|
|
22f0f933fb | ||
|
|
8adcc155fb | ||
|
|
a27c552554 | ||
|
|
ac60e4fcf6 | ||
|
|
09a858559b | ||
|
|
2eb866658a | ||
|
|
876fdebec9 | ||
|
|
662564957c | ||
|
|
e21dc76468 | ||
|
|
b165d015e1 | ||
|
|
7a546bf5c5 | ||
|
|
5c03ebd729 | ||
|
|
7179166603 | ||
|
|
6b7fd781ee | ||
|
|
e17dc78e1d | ||
|
|
fbc9a6f43a | ||
|
|
50f26e3313 | ||
|
|
83297678ba | ||
|
|
2e47542fbe | ||
|
|
e5e4d49d33 | ||
|
|
5050814fa4 | ||
|
|
15de885540 | ||
|
|
6811dc3745 | ||
|
|
b19261d417 | ||
|
|
74aaf479a5 | ||
|
|
ec8e2146ec | ||
|
|
0af99e0de7 | ||
|
|
777ef007ad | ||
|
|
1b3af5d26d | ||
|
|
07437865db | ||
|
|
2ba1de77f8 | ||
|
|
d14f3c6c31 | ||
|
|
b2a1dee791 | ||
|
|
db153e199a | ||
|
|
2d61186deb | ||
|
|
52f34e0baf | ||
|
|
8521ebb7c0 | ||
|
|
36d96126eb | ||
|
|
06d2b4229d | ||
|
|
929e6b323c | ||
|
|
77ffdf7248 | ||
|
|
37e881bc54 | ||
|
|
ae73ca0679 | ||
|
|
78a2289d6a | ||
|
|
e3561c3ceb | ||
|
|
5c7d3e5632 | ||
|
|
a5848fc84d | ||
|
|
af1e754546 | ||
|
|
ec455e81e1 | ||
|
|
f927d79977 | ||
|
|
c75e16e5f2 | ||
|
|
2100d63846 | ||
|
|
6223d7fd82 | ||
|
|
9b728d048d | ||
|
|
cb0dffc045 | ||
|
|
7a78237bdd | ||
|
|
5edcc97240 | ||
|
|
153cba8147 | ||
|
|
86eb16a208 | ||
|
|
1f481f3d38 | ||
|
|
e5aab2453d | ||
|
|
c1f9945838 | ||
|
|
822e8f5485 | ||
|
|
e562626f87 | ||
|
|
8cbac47177 | ||
|
|
ca8222a13c | ||
|
|
da664350fe | ||
|
|
65bed91e4e | ||
|
|
14749daa74 | ||
|
|
5c397b8d0c | ||
|
|
e8d8aa7d47 | ||
|
|
9911bb55ce | ||
|
|
cca8894b91 | ||
|
|
311f47da78 | ||
|
|
eda2a80187 | ||
|
|
88b05f55a1 | ||
|
|
44ba385429 | ||
|
|
9066c0e960 | ||
|
|
c64c2e4296 | ||
|
|
871a790f3f | ||
|
|
8a74ad8ed5 | ||
|
|
bae2fa59ed | ||
|
|
f6b00d7ced | ||
|
|
2619586558 | ||
|
|
442d760fe5 | ||
|
|
be246326ee | ||
|
|
52e055294f | ||
|
|
fcc2057b42 | ||
|
|
728fcdcda2 | ||
|
|
3a6ac9b83f | ||
|
|
2c23d9ff25 | ||
|
|
e99979ffe5 | ||
|
|
e95b023b5e | ||
|
|
2ddb4c1927 | ||
|
|
7bbacbc7cc | ||
|
|
793396a4cb | ||
|
|
321a237d2f | ||
|
|
f54fd67504 | ||
|
|
2449b7029c | ||
|
|
3ee6c4663c | ||
|
|
cc4b914fff | ||
|
|
b948eb163b | ||
|
|
f5ff990898 | ||
|
|
31189f1e45 | ||
|
|
e9264d89eb | ||
|
|
e6f4a27b93 | ||
|
|
30b936399a | ||
|
|
6770cffdac | ||
|
|
fdb924ebfb | ||
|
|
f28ebc2a02 | ||
|
|
fe126f123f | ||
|
|
11924d0d0f | ||
|
|
711d412f88 | ||
|
|
b655b14f01 | ||
|
|
42f06c259b | ||
|
|
03a6de0fb7 | ||
|
|
e6c6f93477 | ||
|
|
e0be3f2e65 | ||
|
|
e10e39b19c | ||
|
|
a23f2229cf | ||
|
|
4ff1ece2e4 | ||
|
|
610c2b9933 | ||
|
|
ec3d804af4 | ||
|
|
40206dc8cf | ||
|
|
e60dee85b9 | ||
|
|
95055aa457 | ||
|
|
0038def935 | ||
|
|
5018aaa4ba | ||
|
|
7b9de2be30 | ||
|
|
9e81d4d332 | ||
|
|
d9a982f169 | ||
|
|
081ce883fb | ||
|
|
f57e19ae2d | ||
|
|
10920f6f93 | ||
|
|
ebc5d7c021 | ||
|
|
33e39a205a | ||
|
|
12c83b533d | ||
|
|
1b95a25ee1 | ||
|
|
c9df8f4d43 | ||
|
|
01debb1c53 | ||
|
|
e77a804559 | ||
|
|
5fd5085eba | ||
|
|
7907a81ae5 | ||
|
|
e003972959 | ||
|
|
1e87b26029 | ||
|
|
4ca45ced61 | ||
|
|
6f17fa1c9a | ||
|
|
6568eb4d8a | ||
|
|
d9fd39d547 | ||
|
|
cf4c14a1e4 | ||
|
|
5119ffa50e | ||
|
|
6839605b0f | ||
|
|
ab42111aac | ||
|
|
316136b346 | ||
|
|
4e6c3b1f3e | ||
|
|
dbcab22339 | ||
|
|
56382e8e49 | ||
|
|
c67d1f5952 | ||
|
|
ee737577f7 | ||
|
|
f000057659 | ||
|
|
6d43a28da6 | ||
|
|
a864838e96 | ||
|
|
839348a3b2 | ||
|
|
fd514e8435 | ||
|
|
6c213ba86b | ||
|
|
6e508f5cd6 | ||
|
|
caff5d5261 | ||
|
|
4031b304a6 | ||
|
|
5b3f6f68d3 | ||
|
|
13c5f5ac4c | ||
|
|
9711381289 | ||
|
|
e264e8c6c4 | ||
|
|
6dabe0646e | ||
|
|
039618366f | ||
|
|
bff91d251c | ||
|
|
ab2b2356f1 | ||
|
|
3e0b053009 | ||
|
|
0cced02fec | ||
|
|
e13078b64a | ||
|
|
fa324ec7f3 | ||
|
|
5a9e1fe0b4 | ||
|
|
7919d2a314 | ||
|
|
b2056fd141 | ||
|
|
d1cecf3be1 | ||
|
|
11b38e5419 | ||
|
|
10398c5865 | ||
|
|
2c2bf63c3f | ||
|
|
f7143f7e02 | ||
|
|
7e821da0b5 | ||
|
|
a84e06a075 | ||
|
|
8c094a8977 | ||
|
|
79aad5a1b4 | ||
|
|
86bd389152 | ||
|
|
2633f9ba88 | ||
|
|
5fad952e8a | ||
|
|
3fa2971816 | ||
|
|
d7a37c67b7 | ||
|
|
449ea29086 | ||
|
|
8c3562e3ad | ||
|
|
e0167bdeec | ||
|
|
7a9e54afdc | ||
|
|
6c4556666e | ||
|
|
8c3b6cc4b5 | ||
|
|
6088de516c | ||
|
|
507fd0b86d | ||
|
|
3fcda4df56 | ||
|
|
21b680868f | ||
|
|
4102871392 | ||
|
|
93eccfc003 | ||
|
|
7f240d3ba9 | ||
|
|
912a12c0b8 | ||
|
|
361f6065a7 | ||
|
|
f8c2889947 | ||
|
|
bdabaa86f9 | ||
|
|
e6a2c4c7de | ||
|
|
9945381043 | ||
|
|
9970eaff16 | ||
|
|
19057eedd8 | ||
|
|
ef1952e953 | ||
|
|
f3f6974eb6 | ||
|
|
8e73b3f8db | ||
|
|
b9bcc0b7f8 | ||
|
|
f587b05d35 | ||
|
|
d83376de64 | ||
|
|
2b9bd25530 | ||
|
|
c1a0d405e4 | ||
|
|
5964a8db60 | ||
|
|
01d4330c81 | ||
|
|
868f886cad | ||
|
|
0f35a3a434 | ||
|
|
ed6790e652 | ||
|
|
77ea74cc2c | ||
|
|
e5a577b062 | ||
|
|
f0c5e94403 | ||
|
|
6012498ae8 | ||
|
|
6f18a6abd0 | ||
|
|
1f3d495a12 | ||
|
|
8fdd423104 | ||
|
|
7b90863198 | ||
|
|
8b741bc666 | ||
|
|
1afb016408 | ||
|
|
f7a2efe2bf | ||
|
|
1faae2a2a2 | ||
|
|
f838aa3a03 | ||
|
|
2564da4403 | ||
|
|
547371f107 | ||
|
|
82cbb8c7cb | ||
|
|
2c8ec98643 | ||
|
|
f4d60b89a8 | ||
|
|
feb29516b3 | ||
|
|
4e77c9648a | ||
|
|
7c4f85ffd5 | ||
|
|
cb71201350 | ||
|
|
1b4d654ff8 | ||
|
|
ca23e49707 | ||
|
|
d6d824b389 | ||
|
|
1e35173c2b | ||
|
|
9d74c087ce | ||
|
|
253a8bbaf7 | ||
|
|
ef739e42c3 | ||
|
|
3fd553cdf4 | ||
|
|
8765b0199f | ||
|
|
be1d375bf7 | ||
|
|
a20a209f0e | ||
|
|
cad1839201 | ||
|
|
81ea635430 | ||
|
|
d6a3c508a1 | ||
|
|
553f05d293 | ||
|
|
94437d3e5f | ||
|
|
ebaa5066fc | ||
|
|
2bf02bda35 | ||
|
|
52a4d4f8cc | ||
|
|
d178a7675b | ||
|
|
16715f41f6 | ||
|
|
e946b0a7eb | ||
|
|
6b6ca2a125 | ||
|
|
5f0d573ff5 | ||
|
|
51b5095d48 | ||
|
|
b768574d72 | ||
|
|
0ec407ca04 | ||
|
|
5a8b116d10 | ||
|
|
b98dba227e | ||
|
|
6785e06150 | ||
|
|
51b1937aa6 |
@@ -74,6 +74,7 @@ Group: OpenLayers {
|
||||
File: DrawFeature (no auto-title, OpenLayers/Control/DrawFeature.js)
|
||||
File: EditingToolbar (no auto-title, OpenLayers/Control/EditingToolbar.js)
|
||||
File: GetFeature (no auto-title, OpenLayers/Control/GetFeature.js)
|
||||
File: Graticule (OpenLayers/Control/Graticule.js)
|
||||
File: KeyboardDefaults (no auto-title, OpenLayers/Control/KeyboardDefaults.js)
|
||||
File: LayerSwitcher (no auto-title, OpenLayers/Control/LayerSwitcher.js)
|
||||
File: Measure (no auto-title, OpenLayers/Control/Measure.js)
|
||||
@@ -96,6 +97,7 @@ Group: OpenLayers {
|
||||
File: SelectFeature (no auto-title, OpenLayers/Control/SelectFeature.js)
|
||||
File: Snapping (no auto-title, OpenLayers/Control/Snapping.js)
|
||||
File: Split (no auto-title, OpenLayers/Control/Split.js)
|
||||
File: WMSGetFeatureInfo (OpenLayers/Control/WMSGetFeatureInfo.js)
|
||||
File: ZoomBox (no auto-title, OpenLayers/Control/ZoomBox.js)
|
||||
File: ZoomIn (no auto-title, OpenLayers/Control/ZoomIn.js)
|
||||
File: ZoomOut (no auto-title, OpenLayers/Control/ZoomOut.js)
|
||||
@@ -124,6 +126,13 @@ Group: OpenLayers {
|
||||
Group: Format {
|
||||
|
||||
File: Format (no auto-title, OpenLayers/Format.js)
|
||||
File: ArcXML (no auto-title, OpenLayers/Format/ArcXML.js)
|
||||
File: ArcXML.Features (no auto-title, OpenLayers/Format/ArcXML/Features.js)
|
||||
File: Atom (no auto-title, OpenLayers/Format/Atom.js)
|
||||
File: CSWGetDomain.DEFAULTS (no auto-title, OpenLayers/Format/CSWGetDomain.js)
|
||||
File: CSWGetDomain.v2_0_2 (no auto-title, OpenLayers/Format/CSWGetDomain/v2_0_2.js)
|
||||
File: CSWGetRecords.DEFAULTS (no auto-title, OpenLayers/Format/CSWGetRecords.js)
|
||||
File: CSWGetRecords.v2_0_2 (no auto-title, OpenLayers/Format/CSWGetRecords/v2_0_2.js)
|
||||
|
||||
Group: Filter {
|
||||
|
||||
@@ -133,6 +142,9 @@ Group: OpenLayers {
|
||||
File: v1_1_0 (OpenLayers/Format/Filter/v1_1_0.js)
|
||||
} # Group: Filter
|
||||
|
||||
File: GeoJSON (no auto-title, OpenLayers/Format/GeoJSON.js)
|
||||
File: GeoRSS (no auto-title, OpenLayers/Format/GeoRSS.js)
|
||||
|
||||
Group: GML {
|
||||
|
||||
File: GML (no auto-title, OpenLayers/Format/GML.js)
|
||||
@@ -141,6 +153,12 @@ Group: OpenLayers {
|
||||
File: v3 (no auto-title, OpenLayers/Format/GML/v3.js)
|
||||
} # Group: GML
|
||||
|
||||
File: GPX (no auto-title, OpenLayers/Format/GPX.js)
|
||||
File: JSON (no auto-title, OpenLayers/Format/JSON.js)
|
||||
File: KML (no auto-title, OpenLayers/Format/KML.js)
|
||||
File: OSM (no auto-title, OpenLayers/Format/OSM.js)
|
||||
File: OWSCommon.v1_1_0 (OpenLayers/Format/OWSCommon/v1_1_0.js)
|
||||
|
||||
Group: SLD {
|
||||
|
||||
File: SLD (no auto-title, OpenLayers/Format/SLD.js)
|
||||
@@ -148,6 +166,32 @@ Group: OpenLayers {
|
||||
File: v1_0_0 (no auto-title, OpenLayers/Format/SLD/v1_0_0.js)
|
||||
} # Group: SLD
|
||||
|
||||
File: SOSCapabilities (OpenLayers/Format/SOSCapabilities.js)
|
||||
File: SOSCapabilities.v1_0_0 (OpenLayers/Format/SOSCapabilities/v1_0_0.js)
|
||||
File: SOSGetObservation (OpenLayers/Format/SOSGetObservation.js)
|
||||
File: Text (no auto-title, OpenLayers/Format/Text.js)
|
||||
File: WFS (no auto-title, OpenLayers/Format/WFS.js)
|
||||
|
||||
Group: WFSCapabilities {
|
||||
|
||||
File: WFSCapabilities (no auto-title, OpenLayers/Format/WFSCapabilities.js)
|
||||
File: v1 (no auto-title, OpenLayers/Format/WFSCapabilities/v1.js)
|
||||
File: v1_0_0 (no auto-title, OpenLayers/Format/WFSCapabilities/v1_0_0.js)
|
||||
File: v1_1_0 (no auto-title, OpenLayers/Format/WFSCapabilities/v1_1_0.js)
|
||||
} # Group: WFSCapabilities
|
||||
|
||||
File: WFSDescribeFeatureType (no auto-title, OpenLayers/Format/WFSDescribeFeatureType.js)
|
||||
|
||||
Group: WFST {
|
||||
|
||||
File: WFST (no auto-title, OpenLayers/Format/WFST.js)
|
||||
File: v1 (OpenLayers/Format/WFST/v1.js)
|
||||
File: v1_0_0 (OpenLayers/Format/WFST/v1_0_0.js)
|
||||
File: v1_1_0 (OpenLayers/Format/WFST/v1_1_0.js)
|
||||
} # Group: WFST
|
||||
|
||||
File: WKT (no auto-title, OpenLayers/Format/WKT.js)
|
||||
|
||||
Group: WMC {
|
||||
|
||||
File: WMC (no auto-title, OpenLayers/Format/WMC.js)
|
||||
@@ -156,33 +200,25 @@ Group: OpenLayers {
|
||||
File: v1_1_0 (no auto-title, OpenLayers/Format/WMC/v1_1_0.js)
|
||||
} # Group: WMC
|
||||
|
||||
Group: Format {
|
||||
Group: WMSCapabilities {
|
||||
|
||||
File: GeoJSON (no auto-title, OpenLayers/Format/GeoJSON.js)
|
||||
File: GeoRSS (no auto-title, OpenLayers/Format/GeoRSS.js)
|
||||
File: GPX (no auto-title, OpenLayers/Format/GPX.js)
|
||||
File: JSON (no auto-title, OpenLayers/Format/JSON.js)
|
||||
File: KML (no auto-title, OpenLayers/Format/KML.js)
|
||||
File: OSM (no auto-title, OpenLayers/Format/OSM.js)
|
||||
File: Text (no auto-title, OpenLayers/Format/Text.js)
|
||||
File: WFS (no auto-title, OpenLayers/Format/WFS.js)
|
||||
File: WFSDescribeFeatureType (OpenLayers/Format/WFSDescribeFeatureType.js)
|
||||
File: WMSCapabilities (no auto-title, OpenLayers/Format/WMSCapabilities.js)
|
||||
File: v1 (no auto-title, OpenLayers/Format/WMSCapabilities/v1.js)
|
||||
File: v1_1 (no auto-title, OpenLayers/Format/WMSCapabilities/v1_1.js)
|
||||
File: v1_1_0 (no auto-title, OpenLayers/Format/WMSCapabilities/v1_1_0.js)
|
||||
File: v1_1_1 (no auto-title, OpenLayers/Format/WMSCapabilities/v1_1_1.js)
|
||||
File: v1_3 (no auto-title, OpenLayers/Format/WMSCapabilities/v1_3.js)
|
||||
File: v1_3_0 (no auto-title, OpenLayers/Format/WMSCapabilities/v1_3_0.js)
|
||||
} # Group: WMSCapabilities
|
||||
|
||||
Group: WFST {
|
||||
Group: WMSDescribeLayer {
|
||||
|
||||
File: WFST (no auto-title, OpenLayers/Format/WFST.js)
|
||||
File: v1 (OpenLayers/Format/WFST/v1.js)
|
||||
File: v1_0_0 (OpenLayers/Format/WFST/v1_0_0.js)
|
||||
File: v1_1_0 (OpenLayers/Format/WFST/v1_1_0.js)
|
||||
} # Group: WFST
|
||||
|
||||
File: WKT (no auto-title, OpenLayers/Format/WKT.js)
|
||||
File: WMSDescribeLayer (OpenLayers/Format/WMSDescribeLayer.js)
|
||||
File: WMSDescribeLayer.v1_1 (OpenLayers/Format/WMSDescribeLayer/v1_1.js)
|
||||
File: WMSGetFeatureInfo (OpenLayers/Format/WMSGetFeatureInfo.js)
|
||||
File: XML (no auto-title, OpenLayers/Format/XML.js)
|
||||
} # Group: Format
|
||||
File: WMSDescribeLayer (no auto-title, OpenLayers/Format/WMSDescribeLayer.js)
|
||||
File: v1_1 (no auto-title, OpenLayers/Format/WMSDescribeLayer/v1_1.js)
|
||||
} # Group: WMSDescribeLayer
|
||||
|
||||
File: WMSGetFeatureInfo (no auto-title, OpenLayers/Format/WMSGetFeatureInfo.js)
|
||||
File: XML (no auto-title, OpenLayers/Format/XML.js)
|
||||
} # Group: Format
|
||||
|
||||
Group: Geometry {
|
||||
@@ -221,6 +257,10 @@ Group: OpenLayers {
|
||||
Group: Lang {
|
||||
|
||||
File: Lang (no auto-title, OpenLayers/Lang.js)
|
||||
File: ar (no auto-title, OpenLayers/Lang/ar.js)
|
||||
File: be-tarask (no auto-title, OpenLayers/Lang/be-tarask.js)
|
||||
File: bg (no auto-title, OpenLayers/Lang/bg.js)
|
||||
File: br (no auto-title, OpenLayers/Lang/br.js)
|
||||
File: ca (no auto-title, OpenLayers/Lang/ca.js)
|
||||
File: cs-CZ (no auto-title, OpenLayers/Lang/cs-CZ.js)
|
||||
File: da-DK (no auto-title, OpenLayers/Lang/da-DK.js)
|
||||
@@ -228,12 +268,35 @@ Group: OpenLayers {
|
||||
File: en (no auto-title, OpenLayers/Lang/en.js)
|
||||
File: en-CA (no auto-title, OpenLayers/Lang/en-CA.js)
|
||||
File: es (no auto-title, OpenLayers/Lang/es.js)
|
||||
File: el (no auto-title, OpenLayers/Lang/el.js)
|
||||
File: fi (no auto-title, OpenLayers/Lang/fi.js)
|
||||
File: fr (no auto-title, OpenLayers/Lang/fr.js)
|
||||
File: fur (no auto-title, OpenLayers/Lang/fur.js)
|
||||
File: gl (no auto-title, OpenLayers/Lang/gl.js)
|
||||
File: gsw (no auto-title, OpenLayers/Lang/gsw.js)
|
||||
File: hr (no auto-title, OpenLayers/Lang/hr.js)
|
||||
File: hsb (no auto-title, OpenLayers/Lang/hsb.js)
|
||||
File: hu (no auto-title, OpenLayers/Lang/hu.js)
|
||||
File: ia (no auto-title, OpenLayers/Lang/ia.js)
|
||||
File: id (no auto-title, OpenLayers/Lang/id.js)
|
||||
File: io (no auto-title, OpenLayers/Lang/io.js)
|
||||
File: is (no auto-title, OpenLayers/Lang/is.js)
|
||||
File: it (no auto-title, OpenLayers/Lang/it.js)
|
||||
File: ja (no auto-title, OpenLayers/Lang/ja.js)
|
||||
File: km (no auto-title, OpenLayers/Lang/km.js)
|
||||
File: ksh (no auto-title, OpenLayers/Lang/ksh.js)
|
||||
File: nds (no auto-title, OpenLayers/Lang/nds.js)
|
||||
File: nb (no auto-title, OpenLayers/Lang/nb.js)
|
||||
File: nl (no auto-title, OpenLayers/Lang/nl.js)
|
||||
File: nn (no auto-title, OpenLayers/Lang/nn.js)
|
||||
File: oc (no auto-title, OpenLayers/Lang/oc.js)
|
||||
File: pt (no auto-title, OpenLayers/Lang/pt.js)
|
||||
File: pt-BR (no auto-title, OpenLayers/Lang/pt-BR.js)
|
||||
File: ru (no auto-title, OpenLayers/Lang/ru.js)
|
||||
File: sk (no auto-title, OpenLayers/Lang/sk.js)
|
||||
File: sv-SE (no auto-title, OpenLayers/Lang/sv-SE.js)
|
||||
File: te (no auto-title, OpenLayers/Lang/te.js)
|
||||
File: vi (no auto-title, OpenLayers/Lang/vi.js)
|
||||
File: zh-CN (no auto-title, OpenLayers/Lang/zh-CN.js)
|
||||
File: zh-TW (no auto-title, OpenLayers/Lang/zh-TW.js)
|
||||
} # Group: Lang
|
||||
@@ -242,6 +305,7 @@ Group: OpenLayers {
|
||||
|
||||
File: Layer (no auto-title, OpenLayers/Layer.js)
|
||||
File: ArcGIS93Rest (no auto-title, OpenLayers/Layer/ArcGIS93Rest.js)
|
||||
File: ArcIMS (no auto-title, OpenLayers/Layer/ArcIMS.js)
|
||||
File: Boxes (no auto-title, OpenLayers/Layer/Boxes.js)
|
||||
File: EventPane (no auto-title, OpenLayers/Layer/EventPane.js)
|
||||
File: FixedZoomLevels (no auto-title, OpenLayers/Layer/FixedZoomLevels.js)
|
||||
@@ -264,13 +328,15 @@ Group: OpenLayers {
|
||||
File: TileCache (no auto-title, OpenLayers/Layer/TileCache.js)
|
||||
File: TMS (no auto-title, OpenLayers/Layer/TMS.js)
|
||||
File: Vector (no auto-title, OpenLayers/Layer/Vector.js)
|
||||
File: RootContainer (OpenLayers/Layer/Vector/RootContainer.js)
|
||||
File: Vector.RootContainer (no auto-title, OpenLayers/Layer/Vector/RootContainer.js)
|
||||
File: VirtualEarth (no auto-title, OpenLayers/Layer/VirtualEarth.js)
|
||||
File: WFS (no auto-title, OpenLayers/Layer/WFS.js)
|
||||
File: WMS (no auto-title, OpenLayers/Layer/WMS.js)
|
||||
File: WMS.Untiled (no auto-title, OpenLayers/Layer/WMS/Untiled.js)
|
||||
File: WMS.Post (no auto-title, OpenLayers/Layer/WMS/Post.js)
|
||||
File: WorldWind (no auto-title, OpenLayers/Layer/WorldWind.js)
|
||||
File: Yahoo (no auto-title, OpenLayers/Layer/Yahoo.js)
|
||||
File: XYZ (no auto-title, OpenLayers/Layer/XYZ.js)
|
||||
} # Group: Layer
|
||||
|
||||
File: Map (no auto-title, OpenLayers/Map.js)
|
||||
@@ -306,9 +372,9 @@ Group: OpenLayers {
|
||||
Group: WFS {
|
||||
|
||||
File: WFS (no auto-title, OpenLayers/Protocol/WFS.js)
|
||||
File: v1 (OpenLayers/Protocol/WFS/v1.js)
|
||||
File: v1_0_0 (OpenLayers/Protocol/WFS/v1_0_0.js)
|
||||
File: v1_1_0 (OpenLayers/Protocol/WFS/v1_1_0.js)
|
||||
File: v1 (no auto-title, OpenLayers/Protocol/WFS/v1.js)
|
||||
File: v1_0_0 (no auto-title, OpenLayers/Protocol/WFS/v1_0_0.js)
|
||||
File: v1_1_0 (no auto-title, OpenLayers/Protocol/WFS/v1_1_0.js)
|
||||
} # Group: WFS
|
||||
|
||||
} # Group: Protocol
|
||||
@@ -337,6 +403,7 @@ Group: OpenLayers {
|
||||
File: Cluster (no auto-title, OpenLayers/Strategy/Cluster.js)
|
||||
File: Fixed (no auto-title, OpenLayers/Strategy/Fixed.js)
|
||||
File: Paging (no auto-title, OpenLayers/Strategy/Paging.js)
|
||||
File: Refresh (OpenLayers/Strategy/Refresh.js)
|
||||
File: Save (OpenLayers/Strategy/Save.js)
|
||||
} # Group: Strategy
|
||||
|
||||
@@ -348,6 +415,7 @@ Group: OpenLayers {
|
||||
File: Tile (no auto-title, OpenLayers/Tile.js)
|
||||
File: Image (no auto-title, OpenLayers/Tile/Image.js)
|
||||
File: WFS (no auto-title, OpenLayers/Tile/WFS.js)
|
||||
File: IFrame (OpenLayers/Tile/Image/IFrame.js)
|
||||
} # Group: Tile
|
||||
|
||||
File: Tween (no auto-title, OpenLayers/Tween.js)
|
||||
|
||||
@@ -74,6 +74,7 @@ Group: OpenLayers {
|
||||
File: DrawFeature (no auto-title, OpenLayers/Control/DrawFeature.js)
|
||||
File: EditingToolbar (no auto-title, OpenLayers/Control/EditingToolbar.js)
|
||||
File: GetFeature (no auto-title, OpenLayers/Control/GetFeature.js)
|
||||
File: Graticule (OpenLayers/Control/Graticule.js)
|
||||
File: KeyboardDefaults (no auto-title, OpenLayers/Control/KeyboardDefaults.js)
|
||||
File: LayerSwitcher (no auto-title, OpenLayers/Control/LayerSwitcher.js)
|
||||
File: Measure (no auto-title, OpenLayers/Control/Measure.js)
|
||||
@@ -96,6 +97,7 @@ Group: OpenLayers {
|
||||
File: SelectFeature (no auto-title, OpenLayers/Control/SelectFeature.js)
|
||||
File: Snapping (no auto-title, OpenLayers/Control/Snapping.js)
|
||||
File: Split (no auto-title, OpenLayers/Control/Split.js)
|
||||
File: WMSGetFeatureInfo (OpenLayers/Control/WMSGetFeatureInfo.js)
|
||||
File: ZoomBox (no auto-title, OpenLayers/Control/ZoomBox.js)
|
||||
File: ZoomIn (no auto-title, OpenLayers/Control/ZoomIn.js)
|
||||
File: ZoomOut (no auto-title, OpenLayers/Control/ZoomOut.js)
|
||||
@@ -124,6 +126,13 @@ Group: OpenLayers {
|
||||
Group: Format {
|
||||
|
||||
File: Format (no auto-title, OpenLayers/Format.js)
|
||||
File: ArcXML (no auto-title, OpenLayers/Format/ArcXML.js)
|
||||
File: ArcXML.Features (no auto-title, OpenLayers/Format/ArcXML/Features.js)
|
||||
File: Atom (no auto-title, OpenLayers/Format/Atom.js)
|
||||
File: CSWGetDomain.DEFAULTS (no auto-title, OpenLayers/Format/CSWGetDomain.js)
|
||||
File: CSWGetDomain.v2_0_2 (no auto-title, OpenLayers/Format/CSWGetDomain/v2_0_2.js)
|
||||
File: CSWGetRecords.DEFAULTS (no auto-title, OpenLayers/Format/CSWGetRecords.js)
|
||||
File: CSWGetRecords.v2_0_2 (no auto-title, OpenLayers/Format/CSWGetRecords/v2_0_2.js)
|
||||
|
||||
Group: Filter {
|
||||
|
||||
@@ -133,6 +142,9 @@ Group: OpenLayers {
|
||||
File: v1_1_0 (OpenLayers/Format/Filter/v1_1_0.js)
|
||||
} # Group: Filter
|
||||
|
||||
File: GeoJSON (no auto-title, OpenLayers/Format/GeoJSON.js)
|
||||
File: GeoRSS (no auto-title, OpenLayers/Format/GeoRSS.js)
|
||||
|
||||
Group: GML {
|
||||
|
||||
File: GML (no auto-title, OpenLayers/Format/GML.js)
|
||||
@@ -141,6 +153,12 @@ Group: OpenLayers {
|
||||
File: v3 (no auto-title, OpenLayers/Format/GML/v3.js)
|
||||
} # Group: GML
|
||||
|
||||
File: GPX (no auto-title, OpenLayers/Format/GPX.js)
|
||||
File: JSON (no auto-title, OpenLayers/Format/JSON.js)
|
||||
File: KML (no auto-title, OpenLayers/Format/KML.js)
|
||||
File: OSM (no auto-title, OpenLayers/Format/OSM.js)
|
||||
File: OWSCommon.v1_1_0 (OpenLayers/Format/OWSCommon/v1_1_0.js)
|
||||
|
||||
Group: SLD {
|
||||
|
||||
File: SLD (no auto-title, OpenLayers/Format/SLD.js)
|
||||
@@ -148,6 +166,32 @@ Group: OpenLayers {
|
||||
File: v1_0_0 (no auto-title, OpenLayers/Format/SLD/v1_0_0.js)
|
||||
} # Group: SLD
|
||||
|
||||
File: SOSCapabilities (OpenLayers/Format/SOSCapabilities.js)
|
||||
File: SOSCapabilities.v1_0_0 (OpenLayers/Format/SOSCapabilities/v1_0_0.js)
|
||||
File: SOSGetObservation (OpenLayers/Format/SOSGetObservation.js)
|
||||
File: Text (no auto-title, OpenLayers/Format/Text.js)
|
||||
File: WFS (no auto-title, OpenLayers/Format/WFS.js)
|
||||
|
||||
Group: WFSCapabilities {
|
||||
|
||||
File: WFSCapabilities (no auto-title, OpenLayers/Format/WFSCapabilities.js)
|
||||
File: v1 (no auto-title, OpenLayers/Format/WFSCapabilities/v1.js)
|
||||
File: v1_0_0 (no auto-title, OpenLayers/Format/WFSCapabilities/v1_0_0.js)
|
||||
File: v1_1_0 (no auto-title, OpenLayers/Format/WFSCapabilities/v1_1_0.js)
|
||||
} # Group: WFSCapabilities
|
||||
|
||||
File: WFSDescribeFeatureType (no auto-title, OpenLayers/Format/WFSDescribeFeatureType.js)
|
||||
|
||||
Group: WFST {
|
||||
|
||||
File: WFST (no auto-title, OpenLayers/Format/WFST.js)
|
||||
File: v1 (OpenLayers/Format/WFST/v1.js)
|
||||
File: v1_0_0 (OpenLayers/Format/WFST/v1_0_0.js)
|
||||
File: v1_1_0 (OpenLayers/Format/WFST/v1_1_0.js)
|
||||
} # Group: WFST
|
||||
|
||||
File: WKT (no auto-title, OpenLayers/Format/WKT.js)
|
||||
|
||||
Group: WMC {
|
||||
|
||||
File: WMC (no auto-title, OpenLayers/Format/WMC.js)
|
||||
@@ -156,33 +200,25 @@ Group: OpenLayers {
|
||||
File: v1_1_0 (no auto-title, OpenLayers/Format/WMC/v1_1_0.js)
|
||||
} # Group: WMC
|
||||
|
||||
Group: Format {
|
||||
Group: WMSCapabilities {
|
||||
|
||||
File: GeoJSON (no auto-title, OpenLayers/Format/GeoJSON.js)
|
||||
File: GeoRSS (no auto-title, OpenLayers/Format/GeoRSS.js)
|
||||
File: GPX (no auto-title, OpenLayers/Format/GPX.js)
|
||||
File: JSON (no auto-title, OpenLayers/Format/JSON.js)
|
||||
File: KML (no auto-title, OpenLayers/Format/KML.js)
|
||||
File: OSM (no auto-title, OpenLayers/Format/OSM.js)
|
||||
File: Text (no auto-title, OpenLayers/Format/Text.js)
|
||||
File: WFS (no auto-title, OpenLayers/Format/WFS.js)
|
||||
File: WFSDescribeFeatureType.js (OpenLayers/Format/WFSDescribeFeatureType.js)
|
||||
File: WMSCapabilities (no auto-title, OpenLayers/Format/WMSCapabilities.js)
|
||||
File: v1 (no auto-title, OpenLayers/Format/WMSCapabilities/v1.js)
|
||||
File: v1_1 (no auto-title, OpenLayers/Format/WMSCapabilities/v1_1.js)
|
||||
File: v1_1_0 (no auto-title, OpenLayers/Format/WMSCapabilities/v1_1_0.js)
|
||||
File: v1_1_1 (no auto-title, OpenLayers/Format/WMSCapabilities/v1_1_1.js)
|
||||
File: v1_3 (no auto-title, OpenLayers/Format/WMSCapabilities/v1_3.js)
|
||||
File: v1_3_0 (no auto-title, OpenLayers/Format/WMSCapabilities/v1_3_0.js)
|
||||
} # Group: WMSCapabilities
|
||||
|
||||
Group: WFST {
|
||||
Group: WMSDescribeLayer {
|
||||
|
||||
File: WFST (no auto-title, OpenLayers/Format/WFST.js)
|
||||
File: v1 (OpenLayers/Format/WFST/v1.js)
|
||||
File: v1_0_0 (OpenLayers/Format/WFST/v1_0_0.js)
|
||||
File: v1_1_0 (OpenLayers/Format/WFST/v1_1_0.js)
|
||||
} # Group: WFST
|
||||
|
||||
File: WKT (no auto-title, OpenLayers/Format/WKT.js)
|
||||
File: WMSDescribeLayer (OpenLayers/Format/WMSDescribeLayer.js)
|
||||
File: WMSDescribeLayer.v1_1 (OpenLayers/Format/WMSDescribeLayer/v1_1.js)
|
||||
File: WMSGetFeatureInfo (OpenLayers/Format/WMSGetFeatureInfo.js)
|
||||
File: XML (no auto-title, OpenLayers/Format/XML.js)
|
||||
} # Group: Format
|
||||
File: WMSDescribeLayer (no auto-title, OpenLayers/Format/WMSDescribeLayer.js)
|
||||
File: v1_1 (no auto-title, OpenLayers/Format/WMSDescribeLayer/v1_1.js)
|
||||
} # Group: WMSDescribeLayer
|
||||
|
||||
File: WMSGetFeatureInfo (no auto-title, OpenLayers/Format/WMSGetFeatureInfo.js)
|
||||
File: XML (no auto-title, OpenLayers/Format/XML.js)
|
||||
} # Group: Format
|
||||
|
||||
Group: Geometry {
|
||||
@@ -221,6 +257,10 @@ Group: OpenLayers {
|
||||
Group: Lang {
|
||||
|
||||
File: Lang (no auto-title, OpenLayers/Lang.js)
|
||||
File: ar (no auto-title, OpenLayers/Lang/ar.js)
|
||||
File: be-tarask (no auto-title, OpenLayers/Lang/be-tarask.js)
|
||||
File: bg (no auto-title, OpenLayers/Lang/bg.js)
|
||||
File: br (no auto-title, OpenLayers/Lang/br.js)
|
||||
File: ca (no auto-title, OpenLayers/Lang/ca.js)
|
||||
File: cs-CZ (no auto-title, OpenLayers/Lang/cs-CZ.js)
|
||||
File: da-DK (no auto-title, OpenLayers/Lang/da-DK.js)
|
||||
@@ -228,12 +268,35 @@ Group: OpenLayers {
|
||||
File: en (no auto-title, OpenLayers/Lang/en.js)
|
||||
File: en-CA (no auto-title, OpenLayers/Lang/en-CA.js)
|
||||
File: es (no auto-title, OpenLayers/Lang/es.js)
|
||||
File: el (no auto-title, OpenLayers/Lang/el.js)
|
||||
File: fi (no auto-title, OpenLayers/Lang/fi.js)
|
||||
File: fr (no auto-title, OpenLayers/Lang/fr.js)
|
||||
File: fur (no auto-title, OpenLayers/Lang/fur.js)
|
||||
File: gl (no auto-title, OpenLayers/Lang/gl.js)
|
||||
File: gsw (no auto-title, OpenLayers/Lang/gsw.js)
|
||||
File: hr (no auto-title, OpenLayers/Lang/hr.js)
|
||||
File: hsb (no auto-title, OpenLayers/Lang/hsb.js)
|
||||
File: hu (no auto-title, OpenLayers/Lang/hu.js)
|
||||
File: ia (no auto-title, OpenLayers/Lang/ia.js)
|
||||
File: id (no auto-title, OpenLayers/Lang/id.js)
|
||||
File: io (no auto-title, OpenLayers/Lang/io.js)
|
||||
File: is (no auto-title, OpenLayers/Lang/is.js)
|
||||
File: it (no auto-title, OpenLayers/Lang/it.js)
|
||||
File: ja (no auto-title, OpenLayers/Lang/ja.js)
|
||||
File: km (no auto-title, OpenLayers/Lang/km.js)
|
||||
File: ksh (no auto-title, OpenLayers/Lang/ksh.js)
|
||||
File: nds (no auto-title, OpenLayers/Lang/nds.js)
|
||||
File: nb (no auto-title, OpenLayers/Lang/nb.js)
|
||||
File: nl (no auto-title, OpenLayers/Lang/nl.js)
|
||||
File: nn (no auto-title, OpenLayers/Lang/nn.js)
|
||||
File: oc (no auto-title, OpenLayers/Lang/oc.js)
|
||||
File: pt (no auto-title, OpenLayers/Lang/pt.js)
|
||||
File: pt-BR (no auto-title, OpenLayers/Lang/pt-BR.js)
|
||||
File: ru (no auto-title, OpenLayers/Lang/ru.js)
|
||||
File: sk (no auto-title, OpenLayers/Lang/sk.js)
|
||||
File: sv-SE (no auto-title, OpenLayers/Lang/sv-SE.js)
|
||||
File: te (no auto-title, OpenLayers/Lang/te.js)
|
||||
File: vi (no auto-title, OpenLayers/Lang/vi.js)
|
||||
File: zh-CN (no auto-title, OpenLayers/Lang/zh-CN.js)
|
||||
File: zh-TW (no auto-title, OpenLayers/Lang/zh-TW.js)
|
||||
} # Group: Lang
|
||||
@@ -242,6 +305,7 @@ Group: OpenLayers {
|
||||
|
||||
File: Layer (no auto-title, OpenLayers/Layer.js)
|
||||
File: ArcGIS93Rest (no auto-title, OpenLayers/Layer/ArcGIS93Rest.js)
|
||||
File: ArcIMS (no auto-title, OpenLayers/Layer/ArcIMS.js)
|
||||
File: Boxes (no auto-title, OpenLayers/Layer/Boxes.js)
|
||||
File: EventPane (no auto-title, OpenLayers/Layer/EventPane.js)
|
||||
File: FixedZoomLevels (no auto-title, OpenLayers/Layer/FixedZoomLevels.js)
|
||||
@@ -264,13 +328,15 @@ Group: OpenLayers {
|
||||
File: TileCache (no auto-title, OpenLayers/Layer/TileCache.js)
|
||||
File: TMS (no auto-title, OpenLayers/Layer/TMS.js)
|
||||
File: Vector (no auto-title, OpenLayers/Layer/Vector.js)
|
||||
File: RootContainer (OpenLayers/Layer/Vector/RootContainer.js)
|
||||
File: Vector.RootContainer (no auto-title, OpenLayers/Layer/Vector/RootContainer.js)
|
||||
File: VirtualEarth (no auto-title, OpenLayers/Layer/VirtualEarth.js)
|
||||
File: WFS (no auto-title, OpenLayers/Layer/WFS.js)
|
||||
File: WMS (no auto-title, OpenLayers/Layer/WMS.js)
|
||||
File: WMS.Untiled (no auto-title, OpenLayers/Layer/WMS/Untiled.js)
|
||||
File: WMS.Post (no auto-title, OpenLayers/Layer/WMS/Post.js)
|
||||
File: WorldWind (no auto-title, OpenLayers/Layer/WorldWind.js)
|
||||
File: Yahoo (no auto-title, OpenLayers/Layer/Yahoo.js)
|
||||
File: XYZ (no auto-title, OpenLayers/Layer/XYZ.js)
|
||||
} # Group: Layer
|
||||
|
||||
File: Map (no auto-title, OpenLayers/Map.js)
|
||||
@@ -306,9 +372,9 @@ Group: OpenLayers {
|
||||
Group: WFS {
|
||||
|
||||
File: WFS (no auto-title, OpenLayers/Protocol/WFS.js)
|
||||
File: v1 (OpenLayers/Protocol/WFS/v1.js)
|
||||
File: v1_0_0 (OpenLayers/Protocol/WFS/v1_0_0.js)
|
||||
File: v1_1_0 (OpenLayers/Protocol/WFS/v1_1_0.js)
|
||||
File: v1 (no auto-title, OpenLayers/Protocol/WFS/v1.js)
|
||||
File: v1_0_0 (no auto-title, OpenLayers/Protocol/WFS/v1_0_0.js)
|
||||
File: v1_1_0 (no auto-title, OpenLayers/Protocol/WFS/v1_1_0.js)
|
||||
} # Group: WFS
|
||||
|
||||
} # Group: Protocol
|
||||
@@ -337,6 +403,7 @@ Group: OpenLayers {
|
||||
File: Cluster (no auto-title, OpenLayers/Strategy/Cluster.js)
|
||||
File: Fixed (no auto-title, OpenLayers/Strategy/Fixed.js)
|
||||
File: Paging (no auto-title, OpenLayers/Strategy/Paging.js)
|
||||
File: Refresh (OpenLayers/Strategy/Refresh.js)
|
||||
File: Save (OpenLayers/Strategy/Save.js)
|
||||
} # Group: Strategy
|
||||
|
||||
@@ -348,6 +415,7 @@ Group: OpenLayers {
|
||||
File: Tile (no auto-title, OpenLayers/Tile.js)
|
||||
File: Image (no auto-title, OpenLayers/Tile/Image.js)
|
||||
File: WFS (no auto-title, OpenLayers/Tile/WFS.js)
|
||||
File: IFrame (OpenLayers/Tile/Image/IFrame.js)
|
||||
} # Group: Tile
|
||||
|
||||
File: Tween (no auto-title, OpenLayers/Tween.js)
|
||||
|
||||
175
examples/WMSPost.html
Normal file
175
examples/WMSPost.html
Normal file
@@ -0,0 +1,175 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>OpenLayers Basic WMS Example via HTTP-POST protocol</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map;
|
||||
|
||||
function init(){
|
||||
var sld = '<StyledLayerDescriptor version="1.0.0">';
|
||||
sld+= '<NamedLayer>';
|
||||
sld+= '<Name>topp:tasmania_roads</Name>';
|
||||
sld+= '<UserStyle>';
|
||||
sld+= '<IsDefault>1</IsDefault>';
|
||||
sld+= '<FeatureTypeStyle>';
|
||||
sld+= '<Rule>';
|
||||
sld+= '<LineSymbolizer>';
|
||||
sld+= '<Stroke>';
|
||||
sld+= '<CssParameter name="stroke">';
|
||||
sld+= '<Literal>#787878</Literal>';
|
||||
sld+= '</CssParameter>';
|
||||
sld+= '<CssParameter name="stroke-width">';
|
||||
sld+= '<Literal>2</Literal>';
|
||||
sld+= '</CssParameter>';
|
||||
sld+= '</Stroke>';
|
||||
sld+= '</LineSymbolizer>';
|
||||
sld+= '</Rule>';
|
||||
sld+= '</FeatureTypeStyle>';
|
||||
sld+= '</UserStyle>';
|
||||
sld+= '</NamedLayer>';
|
||||
|
||||
sld+= '<NamedLayer>';
|
||||
sld+= '<Name>topp:tasmania_water_bodies</Name>';
|
||||
sld+= '<UserStyle>';
|
||||
sld+= '<IsDefault>1</IsDefault>';
|
||||
sld+= '<FeatureTypeStyle>';
|
||||
sld+= '<Rule>';
|
||||
sld+= '<LineSymbolizer>';
|
||||
sld+= '<Stroke>';
|
||||
sld+= '<CssParameter name="stroke">';
|
||||
sld+= '<Literal>#4F94CD</Literal>';
|
||||
sld+= '</CssParameter>';
|
||||
sld+= '<CssParameter name="stroke-width">';
|
||||
sld+= '<Literal>3</Literal>';
|
||||
sld+= '</CssParameter>';
|
||||
sld+= '</Stroke>';
|
||||
sld+= '</LineSymbolizer>';
|
||||
sld+= '<PolygonSymbolizer>';
|
||||
sld+= '<Fill>';
|
||||
sld+= '<CssParameter name="fill">';
|
||||
sld+= '<Literal>#63B8FF</Literal>';
|
||||
sld+= '</CssParameter>';
|
||||
sld+= '</Fill>';
|
||||
sld+= '</PolygonSymbolizer>';
|
||||
sld+= '</Rule>';
|
||||
sld+= '</FeatureTypeStyle>';
|
||||
sld+= '</UserStyle>';
|
||||
sld+= '</NamedLayer>';
|
||||
|
||||
sld+= '<NamedLayer>';
|
||||
sld+= '<Name>topp:tasmania_cities</Name>';
|
||||
sld+= '<UserStyle>';
|
||||
sld+= '<IsDefault>1</IsDefault>';
|
||||
sld+= '<FeatureTypeStyle>';
|
||||
sld+= '<Rule>';
|
||||
sld+= '<PointSymbolizer>';
|
||||
sld+= '<Graphic>';
|
||||
sld+= '<Mark>';
|
||||
sld+= '<WellKnownName>cross</WellKnownName>';
|
||||
sld+= '<Fill>';
|
||||
sld+= '<CssParameter name="fill">';
|
||||
sld+= '<Literal>#00FF00</Literal>';
|
||||
sld+= '</CssParameter>';
|
||||
sld+= '</Fill>';
|
||||
sld+= '</Mark>';
|
||||
sld+= '<Size>15</Size>';
|
||||
sld+= '</Graphic>';
|
||||
sld+= '</PointSymbolizer>';
|
||||
sld+= '<TextSymbolizer>';
|
||||
sld+= '<Label><PropertyName>CITY_NAME</PropertyName></Label>';
|
||||
sld+= '<Font>';
|
||||
sld+= '<SvgParameter name="font-size">15</SvgParameter>';
|
||||
sld+= '</Font>';
|
||||
sld+= '</TextSymbolizer>';
|
||||
sld+= '</Rule>';
|
||||
sld+= '</FeatureTypeStyle>';
|
||||
sld+= '</UserStyle>';
|
||||
sld+= '</NamedLayer>';
|
||||
|
||||
sld+= '<NamedLayer>';
|
||||
sld+= '<Name>topp:tasmania_state_boundaries</Name>';
|
||||
sld+= '<UserStyle>';
|
||||
sld+= '<IsDefault>1</IsDefault>';
|
||||
sld+= '<FeatureTypeStyle>';
|
||||
sld+= '<Rule>';
|
||||
sld+= '<PolygonSymbolizer>';
|
||||
sld+= '<Fill>';
|
||||
sld+= '<CssParameter name="fill">';
|
||||
sld+= '<Literal>#8B8989</Literal>';
|
||||
sld+= '</CssParameter>';
|
||||
sld+= '<CssParameter name="fill-opacity">';
|
||||
sld+= '<Literal>0.2</Literal>';
|
||||
sld+= '</CssParameter>';
|
||||
sld+= '</Fill>';
|
||||
sld+= '<Stroke>';
|
||||
sld+= '<CssParameter name="stroke">';
|
||||
sld+= '<Literal>#FF4040</Literal>';
|
||||
sld+= '</CssParameter>';
|
||||
sld+= '<CssParameter name="stroke-width">';
|
||||
sld+= '<Literal>2</Literal>';
|
||||
sld+= '</CssParameter>';
|
||||
sld+= '</Stroke>';
|
||||
sld+= '</PolygonSymbolizer>';
|
||||
sld+= '</Rule>';
|
||||
sld+= '</FeatureTypeStyle>';
|
||||
sld+= '</UserStyle>';
|
||||
sld+= '</NamedLayer>';
|
||||
|
||||
sld+= '</StyledLayerDescriptor>';
|
||||
|
||||
map = new OpenLayers.Map('map');
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
|
||||
var layer = new OpenLayers.Layer.WMS(
|
||||
"OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0",
|
||||
{
|
||||
layers: 'basic'
|
||||
}
|
||||
);
|
||||
|
||||
var rcbw = new OpenLayers.Layer.WMS.Post("Roads, Cities, Boundaries, Water",
|
||||
"http://demo.opengeo.org/geoserver/wms",
|
||||
{
|
||||
'layers': 'topp:tasmania_roads,topp:tasmania_water_bodies,topp:tasmania_state_boundaries,topp:tasmania_cities',
|
||||
transparent: true,
|
||||
format: 'image/jpeg',
|
||||
sld_body: sld
|
||||
},
|
||||
{
|
||||
isBaseLayer: false,
|
||||
unsupportedBrowsers: []
|
||||
}
|
||||
);
|
||||
map.addLayers([layer, rcbw]);
|
||||
map.setCenter(new OpenLayers.LonLat(146.65748632815,-42.230763671875), 7);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">Basic WMS Example via HTTP-POST protocol with a large SLD
|
||||
included</h1>
|
||||
|
||||
<div id="tags"></div>
|
||||
|
||||
<div id="shortdesc">Creating a WMS layer with a large SLD in the sld_body</div>
|
||||
|
||||
<div id="map" style="width: 512; height: 256; border: 1px solid red;"></div>
|
||||
|
||||
<div id="docs">
|
||||
This example uses a large SLD created on the client side to style a WMS
|
||||
layer. This example uses a WMS.Post layer which transfers data via the
|
||||
HTTP-POST protocol. <br>
|
||||
NOTE: Opera is not able to display transparent tiles with this layer,
|
||||
and in some Firefox browsers can appear ugly viewport-shaking effects
|
||||
while dragging arround. Use the 'unsupportedBrowsers' property to
|
||||
control which browsers should use plain image tiles (like Layer.WMS)
|
||||
instead. The default setting (["mozilla", "firefox", "opera"])
|
||||
excludes problematic browsers without removing the ability to use long
|
||||
request parameters, because all these browsers support long urls via
|
||||
GET.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
layer = new OpenLayers.Layer.ArcIMS(
|
||||
"Global Sample Map",
|
||||
"http://sample.avencia.com/servlet/com.esri.esrimap.Esrimap",
|
||||
"http://sample.azavea.com/servlet/com.esri.esrimap.Esrimap",
|
||||
options
|
||||
);
|
||||
map.addLayer(layer);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
};
|
||||
|
||||
layer = new OpenLayers.Layer.ArcIMS( "Global Sample Map",
|
||||
"http://sample.avencia.com/servlet/com.esri.esrimap.Esrimap", options );
|
||||
"http://sample.azavea.com/servlet/com.esri.esrimap.Esrimap", options );
|
||||
map.addLayer(layer);
|
||||
|
||||
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
|
||||
|
||||
49
examples/bing.html
Normal file
49
examples/bing.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>OpenLayers Bing Example</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&mkt=en-us"></script>
|
||||
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script>
|
||||
|
||||
var map;
|
||||
|
||||
function init(){
|
||||
map = new OpenLayers.Map("map");
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
|
||||
var shaded = new OpenLayers.Layer.VirtualEarth("Shaded", {
|
||||
type: VEMapStyle.Shaded
|
||||
});
|
||||
var hybrid = new OpenLayers.Layer.VirtualEarth("Hybrid", {
|
||||
type: VEMapStyle.Hybrid
|
||||
});
|
||||
var aerial = new OpenLayers.Layer.VirtualEarth("Aerial", {
|
||||
type: VEMapStyle.Aerial
|
||||
});
|
||||
|
||||
map.addLayers([shaded, hybrid, aerial]);
|
||||
|
||||
map.setCenter(new OpenLayers.LonLat(-110, 45), 3);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">Bing Example</h1>
|
||||
|
||||
<div id="tags"></div>
|
||||
|
||||
<p id="shortdesc">
|
||||
Demonstrates the use of Bing layers.
|
||||
</p>
|
||||
|
||||
<div id="map" class="smallmap"></div>
|
||||
<div id="docs">This example demonstrates the ability to create layers using tiles from Bing maps.</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
28
examples/canvas.html
Normal file
28
examples/canvas.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Canvas Renderer Example</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
|
||||
<script src="canvas.js"></script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">Canvas Renderer Example</h1>
|
||||
<p id="shortdesc">
|
||||
Demonstrates the use of the canvas renderer with a vector layer.
|
||||
</p>
|
||||
<div id="map" class="smallmap"></div>
|
||||
<div id="docs">
|
||||
<p>
|
||||
This example shows a vector layer that uses the Canvas renderer
|
||||
where available. The order of the renderers given in the layer
|
||||
options is used to locate the first available renderer.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="canvas.js" target="_blank">canvas.js source</a>
|
||||
to see how this is done.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
62
examples/canvas.js
Normal file
62
examples/canvas.js
Normal file
@@ -0,0 +1,62 @@
|
||||
var map, layer, styleMap;
|
||||
OpenLayers.ProxyHost = "proxy.cgi?url=";
|
||||
|
||||
function init() {
|
||||
map = new OpenLayers.Map({
|
||||
div: "map",
|
||||
projection: new OpenLayers.Projection("EPSG:900913"),
|
||||
displayProjection: new OpenLayers.Projection("EPSG:4326"),
|
||||
units: "m",
|
||||
maxResolution: 156543.0339,
|
||||
maxExtent: new OpenLayers.Bounds(
|
||||
-20037508, -20037508, 20037508, 20037508
|
||||
)
|
||||
});
|
||||
|
||||
var g = new OpenLayers.Layer.Google("Google Layer", {
|
||||
sphericalMercator: true
|
||||
});
|
||||
map.addLayers([g]);
|
||||
|
||||
// prepare to style the data
|
||||
styleMap = new OpenLayers.StyleMap({
|
||||
strokeColor: "black",
|
||||
strokeWidth: 2,
|
||||
strokeOpacity: 0.5,
|
||||
fillOpacity: 0.2
|
||||
});
|
||||
|
||||
// create a color table for state FIPS code
|
||||
var colors = ["red", "orange", "yellow", "green", "blue", "purple"];
|
||||
var code, fips = {};
|
||||
for(var i=1; i<=66; ++i) {
|
||||
code = "0" + i;
|
||||
code = code.substring(code.length - 2);
|
||||
fips[code] = {fillColor: colors[i % colors.length]};
|
||||
}
|
||||
// add unique value rules with your color lookup
|
||||
styleMap.addUniqueValueRules("default", "STATE_FIPS", fips);
|
||||
|
||||
// create a vector layer using the canvas renderer (where available)
|
||||
var wfs = new OpenLayers.Layer.Vector("States", {
|
||||
strategies: [new OpenLayers.Strategy.BBOX()],
|
||||
protocol: new OpenLayers.Protocol.WFS({
|
||||
version: "1.1.0",
|
||||
srsName: "EPSG:900913",
|
||||
url: "http://demo.opengeo.org/geoserver/wfs",
|
||||
featureType: "states",
|
||||
featureNS: "http://www.openplans.org/topp"
|
||||
}),
|
||||
styleMap: styleMap,
|
||||
renderers: ["Canvas", "SVG", "VML"]
|
||||
});
|
||||
map.addLayer(wfs);
|
||||
|
||||
// if you want to use Geographic coords, transform to ESPG:900913
|
||||
var ddBounds = new OpenLayers.Bounds(
|
||||
-73.839111,40.287907,-68.214111,44.441624
|
||||
);
|
||||
map.zoomToExtent(
|
||||
ddBounds.transform(map.displayProjection, map.getProjectionObject())
|
||||
);
|
||||
}
|
||||
37
examples/document-drag.html
Normal file
37
examples/document-drag.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>OpenLayers Document Drag Example</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map, layer;
|
||||
function init(){
|
||||
map = new OpenLayers.Map( 'map', {controls: [
|
||||
new OpenLayers.Control.Navigation({documentDrag: true}),
|
||||
new OpenLayers.Control.PanZoom(),
|
||||
new OpenLayers.Control.ArgParser(),
|
||||
new OpenLayers.Control.Attribution()
|
||||
]} );
|
||||
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0",
|
||||
{layers: 'basic'} );
|
||||
map.addLayer(layer);
|
||||
map.zoomToMaxExtent();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">OpenLayers Document Drag Example</h1>
|
||||
|
||||
<div id="tags"></div>
|
||||
|
||||
<div id="shortdesc">Keep on dragging even when the mouse cursor moves outside of the map</div>
|
||||
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
<div id="docs">
|
||||
This example shows how to make a map draggable outside of the map itself.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -11,11 +11,15 @@
|
||||
p {
|
||||
width: 512px;
|
||||
}
|
||||
|
||||
/* avoid pink tiles */
|
||||
.olImageLoadError {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map, drawControls;
|
||||
OpenLayers.Util.onImageLoadErrorColor = "transparent";
|
||||
function init(){
|
||||
map = new OpenLayers.Map('map');
|
||||
|
||||
|
||||
90
examples/dynamic-text-layer.html
Normal file
90
examples/dynamic-text-layer.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>OpenLayers Vector Behavior Example</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map;
|
||||
|
||||
function init(){
|
||||
map = new OpenLayers.Map('map');
|
||||
var wms = new OpenLayers.Layer.WMS(
|
||||
"OpenLayers WMS", "http://labs.metacarta.com/wms/vmap0",
|
||||
{layers: 'basic'}
|
||||
);
|
||||
|
||||
var layer = new OpenLayers.Layer.Vector("POIs", {
|
||||
strategies: [new OpenLayers.Strategy.BBOX({resFactor: 1.1})],
|
||||
protocol: new OpenLayers.Protocol.HTTP({
|
||||
url: "textfile.txt",
|
||||
format: new OpenLayers.Format.Text()
|
||||
})
|
||||
});
|
||||
|
||||
map.addLayers([wms, layer]);
|
||||
map.zoomToMaxExtent();
|
||||
|
||||
// Interaction; not needed for initial display.
|
||||
selectControl = new OpenLayers.Control.SelectFeature(layer);
|
||||
map.addControl(selectControl);
|
||||
selectControl.activate();
|
||||
layer.events.on({
|
||||
'featureselected': onFeatureSelect,
|
||||
'featureunselected': onFeatureUnselect
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Needed only for interaction, not for the display.
|
||||
function onPopupClose(evt) {
|
||||
// 'this' is the popup.
|
||||
selectControl.unselect(this.feature);
|
||||
}
|
||||
function onFeatureSelect(evt) {
|
||||
feature = evt.feature;
|
||||
popup = new OpenLayers.Popup.FramedCloud("featurePopup",
|
||||
feature.geometry.getBounds().getCenterLonLat(),
|
||||
new OpenLayers.Size(100,100),
|
||||
"<h2>"+feature.attributes.title + "</h2>" +
|
||||
feature.attributes.description,
|
||||
null, true, onPopupClose);
|
||||
feature.popup = popup;
|
||||
popup.feature = feature;
|
||||
map.addPopup(popup);
|
||||
}
|
||||
function onFeatureUnselect(evt) {
|
||||
feature = evt.feature;
|
||||
if (feature.popup) {
|
||||
popup.feature = null;
|
||||
map.removePopup(feature.popup);
|
||||
feature.popup.destroy();
|
||||
feature.popup = null;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">Dynamic POIs via a Text Layer</h1>
|
||||
<p id="shortdesc">
|
||||
Loading dynamic data from a text file.
|
||||
</p>
|
||||
<div id="map" class="smallmap"></div>
|
||||
<div id="docs">
|
||||
The vector layer shown uses the BBOX strategy, the HTTP protocol,
|
||||
and the Text format.
|
||||
This setup appends "?bbox=west,south,east,north" to every
|
||||
request. This allows you to configure the location as something
|
||||
like 'textfile.php', and take the '?bbox=' parameter to select
|
||||
data from a database or the like.
|
||||
<br /><br />
|
||||
There is nothing about this example that limits it to text files;
|
||||
you can do the same thing with KML, GeoJSON, etc.
|
||||
<br /><br />
|
||||
This is an alternative to something like the <a href="http://wiki.openstreetmap.org/index.php/OpenLayers_Dynamic_POI">OpenStreetMap "Dynamic POI"</a> example. The Layer is a standard vector layer, and interaction can be
|
||||
configured via the SelectFeature control, as you can see in the
|
||||
latter half of the code, which allows you to open a popup when
|
||||
a feature is selected.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -26,16 +26,15 @@
|
||||
);
|
||||
|
||||
var dm_wms = new OpenLayers.Layer.WMS(
|
||||
"DM Solutions Demo",
|
||||
"Canadian Data",
|
||||
"http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
|
||||
{
|
||||
layers: "bathymetry,land_fn,park,drain_fn,drainage," +
|
||||
"prov_bound,fedlimit,rail,road,popplace",
|
||||
transparent: "true", format: "image/png"},
|
||||
{
|
||||
minResolution: 0.17578125,
|
||||
maxResolution: 0.703125
|
||||
}
|
||||
transparent: "true",
|
||||
format: "image/png"
|
||||
},
|
||||
{isBaseLayer: false, visibility: false}
|
||||
);
|
||||
|
||||
map.addLayers([ol_wms, jpl_wms, dm_wms]);
|
||||
|
||||
@@ -60,18 +60,21 @@
|
||||
</div>
|
||||
|
||||
<p id="shortdesc">
|
||||
Shows how to use the GetFeature control to select features from a
|
||||
WMS layer. Click or drag a box to select features, use the Shift key to
|
||||
add features to the selection, use the Ctrl key to toggle a feature's
|
||||
selected status. Note that this control also has a hover option, which is
|
||||
enabled in this example. This gives you a visual feedback by loading the
|
||||
feature underneath the mouse pointer from the WFS, but causes a lot of
|
||||
GetFeature requests to be issued.
|
||||
Shows how to use the GetFeature control to select features from a WMS layer.
|
||||
</p>
|
||||
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
<div id="docs"></div>
|
||||
<div id="docs">
|
||||
<p>
|
||||
Click or drag a box to select features, use the Shift key to add
|
||||
features to the selection, use the Ctrl key to toggle a feature's
|
||||
selected status. Note that this control also has a hover option, which
|
||||
is enabled in this example. This gives you a visual feedback by loading
|
||||
the feature underneath the mouse pointer from the WFS, but causes a lot
|
||||
of GetFeature requests to be issued.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
90
examples/getfeatureinfo-popup.html
Normal file
90
examples/getfeatureinfo-popup.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GetFeatureInfo Popup</title>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script>
|
||||
OpenLayers.ProxyHost = "proxy.cgi?url=";
|
||||
|
||||
var map, info;
|
||||
|
||||
function load() {
|
||||
map = new OpenLayers.Map({
|
||||
div: "map",
|
||||
maxExtent: new OpenLayers.Bounds(143.834,-43.648,148.479,-39.573)
|
||||
});
|
||||
|
||||
var political = new OpenLayers.Layer.WMS("State Boundaries",
|
||||
"http://demo.opengeo.org/geoserver/wms",
|
||||
{'layers': 'topp:tasmania_state_boundaries', transparent: true, format: 'image/gif'},
|
||||
{isBaseLayer: true}
|
||||
);
|
||||
|
||||
var roads = new OpenLayers.Layer.WMS("Roads",
|
||||
"http://demo.opengeo.org/geoserver/wms",
|
||||
{'layers': 'topp:tasmania_roads', transparent: true, format: 'image/gif'},
|
||||
{isBaseLayer: false}
|
||||
);
|
||||
|
||||
var cities = new OpenLayers.Layer.WMS("Cities",
|
||||
"http://demo.opengeo.org/geoserver/wms",
|
||||
{'layers': 'topp:tasmania_cities', transparent: true, format: 'image/gif'},
|
||||
{isBaseLayer: false}
|
||||
);
|
||||
|
||||
var water = new OpenLayers.Layer.WMS("Bodies of Water",
|
||||
"http://demo.opengeo.org/geoserver/wms",
|
||||
{'layers': 'topp:tasmania_water_bodies', transparent: true, format: 'image/gif'},
|
||||
{isBaseLayer: false}
|
||||
);
|
||||
|
||||
var highlight = new OpenLayers.Layer.Vector("Highlighted Features", {
|
||||
displayInLayerSwitcher: false,
|
||||
isBaseLayer: false
|
||||
});
|
||||
|
||||
map.addLayers([political, roads, cities, water, highlight]);
|
||||
|
||||
info = new OpenLayers.Control.WMSGetFeatureInfo({
|
||||
url: 'http://demo.opengeo.org/geoserver/wms',
|
||||
title: 'Identify features by clicking',
|
||||
queryVisible: true,
|
||||
eventListeners: {
|
||||
getfeatureinfo: function(event) {
|
||||
map.addPopup(new OpenLayers.Popup.FramedCloud(
|
||||
"chicken",
|
||||
map.getLonLatFromPixel(event.xy),
|
||||
null,
|
||||
event.text,
|
||||
null,
|
||||
true
|
||||
));
|
||||
}
|
||||
}
|
||||
});
|
||||
map.addControl(info);
|
||||
info.activate();
|
||||
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
map.zoomToMaxExtent();
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="load()">
|
||||
<h1 id="title">Feature Info in Popup</h1>
|
||||
|
||||
<div id="tags"></div>
|
||||
|
||||
<p id="shortdesc">
|
||||
Demonstrates the WMSGetFeatureInfo control for fetching information
|
||||
about a position from WMS (via GetFeatureInfo request). Results
|
||||
are displayed in a popup.
|
||||
</p>
|
||||
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
<div id="docs"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -28,7 +28,7 @@
|
||||
);
|
||||
var gsat = new OpenLayers.Layer.Google(
|
||||
"Google Satellite",
|
||||
{type: G_SATELLITE_MAP, numZoomLevels: 20}
|
||||
{type: G_SATELLITE_MAP, numZoomLevels: 22}
|
||||
);
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
it is best to simply set your application to use the string "v=2" in
|
||||
the request, rather than tying your application to an explicit version.</p>
|
||||
<p>
|
||||
In order to position the Google attribution div in the default ocation,
|
||||
In order to position the Google attribution div in the default location,
|
||||
you must include the extra theme/default/google.css stylesheet.</p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// user custom graphicname
|
||||
|
||||
OpenLayers.Renderer.symbol.lightning = [0,0, 4,2, 6,0, 10,5, 6,3, 4,5, 0,0];
|
||||
OpenLayers.Renderer.symbol.rectangle = [0,0, 10,0, 10,4, 0,4, 0,0];
|
||||
OpenLayers.Renderer.symbol.rectangle = [0,0, 4,0, 4,10, 0,10, 0,0];
|
||||
|
||||
var map;
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
},
|
||||
"select": {
|
||||
pointRadius: 20,
|
||||
fillOpacity: 1
|
||||
fillOpacity: 1,
|
||||
rotation: 45
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
102
examples/graticule.html
Normal file
102
examples/graticule.html
Normal file
@@ -0,0 +1,102 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>OpenLayers Graticule Example</title>
|
||||
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<style type="text/css">
|
||||
#map {
|
||||
width: 600px;
|
||||
height: 300px;
|
||||
border: 1px solid black;
|
||||
float:left;
|
||||
}
|
||||
#map2 {
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
border: 1px solid black;
|
||||
float:left;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script src="http://proj4js.org/lib/proj4js-compressed.js"></script>
|
||||
<script type="text/javascript">
|
||||
Proj4js.defs["EPSG:42304"]="+title=Atlas of Canada, LCC +proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs";
|
||||
|
||||
var map1, map2;
|
||||
function init(){
|
||||
initLonLat();
|
||||
initProjected();
|
||||
}
|
||||
function initLonLat(){
|
||||
map1 = new OpenLayers.Map('map', {
|
||||
controls: [
|
||||
new OpenLayers.Control.Graticule({
|
||||
numPoints: 2,
|
||||
labelled: true,
|
||||
visible: true
|
||||
}),
|
||||
new OpenLayers.Control.LayerSwitcher(),
|
||||
new OpenLayers.Control.PanZoomBar(),
|
||||
new OpenLayers.Control.Navigation()
|
||||
]
|
||||
});
|
||||
|
||||
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0",
|
||||
{layers: 'basic'}, {wrapDateLine: true} );
|
||||
|
||||
map1.addLayers([ol_wms]);
|
||||
if (!map1.getCenter()) map1.zoomToMaxExtent();
|
||||
};
|
||||
|
||||
function initProjected(){
|
||||
var extent = new OpenLayers.Bounds(-2200000,-712631,3072800,3840000);
|
||||
var mapOptions = {
|
||||
controls: [
|
||||
new OpenLayers.Control.Graticule({
|
||||
labelled: true,
|
||||
targetSize: 200
|
||||
}),
|
||||
new OpenLayers.Control.LayerSwitcher(),
|
||||
new OpenLayers.Control.PanZoomBar(),
|
||||
new OpenLayers.Control.Navigation()
|
||||
],
|
||||
//scales: tempScales,
|
||||
maxExtent: extent,
|
||||
maxResolution: 50000,
|
||||
units: 'm',
|
||||
projection: 'EPSG:42304'
|
||||
};
|
||||
map2 = new OpenLayers.Map('map2', mapOptions);
|
||||
|
||||
var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo",
|
||||
"http://www2.dmsolutions.ca/cgi-bin/mswms_gmap", {
|
||||
layers: "bathymetry",
|
||||
format: "image/png"
|
||||
},{
|
||||
singleTile: true
|
||||
});
|
||||
|
||||
map2.addLayers([dm_wms]);
|
||||
if (!map2.getCenter()) map2.zoomToExtent(extent);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">Graticule Example</h1>
|
||||
|
||||
<div id="tags">
|
||||
</div>
|
||||
|
||||
<p id="shortdesc">
|
||||
Adds a Graticule control to the map to display a grid of
|
||||
latitude and longitude.
|
||||
</p>
|
||||
|
||||
<div id="map" class="smallmap"></div>
|
||||
<div id="map2" class="smallmap"></div>
|
||||
|
||||
<div id="docs"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -44,7 +44,7 @@
|
||||
Demonstrates the use of the LayerSwitcher outside of the OpenLayers window.
|
||||
</p>
|
||||
|
||||
<div id="layerswitcher"></div>
|
||||
<div id="layerswitcher" class="olControlLayerSwitcher"></div>
|
||||
<div id="map" class="smallmap"></div>
|
||||
<div id="docs">
|
||||
<p>This demonstrates use of the LayerSwitcher outside the map div. It also shows use
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
|
||||
var options = {
|
||||
isBaseLayer: true,
|
||||
transitionEffect: "resize",
|
||||
buffer: 1,
|
||||
useOverlay: false,
|
||||
useAsyncOverlay: false,
|
||||
@@ -125,7 +126,7 @@
|
||||
layer = new OpenLayers.Layer.MapGuide( "MapGuide OS Overlay layer", url, params, options );
|
||||
map.addLayer(layer);
|
||||
*/
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher({'div':OpenLayers.Util.getElement('layerswitcher')}));
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
map.zoomToMaxExtent();
|
||||
}
|
||||
</script>
|
||||
@@ -144,7 +145,6 @@
|
||||
|
||||
<div id="map" class="smallmap"></div>
|
||||
<div id="map2">
|
||||
<div id="layerswitcher"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<div id="title">MapServer Layer</div>
|
||||
<h1 id="title">MapServer Layer</h1>
|
||||
<div id="tags"></div>
|
||||
<div id="shortdesc">Shows MapServer Layer</div>
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="title">MapServer Single Tile Mode</div>
|
||||
<h1 id="title">MapServer Single Tile Mode</h1>
|
||||
<div id="tags"></div>
|
||||
<div id="shortdesc">Shows single tile MapServer Layer</div>
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<div id="title">Resize a Marker</div>
|
||||
<h1 id="title">Resize a Marker</h1>
|
||||
<div id="tags"></div>
|
||||
<div id="shortdesc">Dynamically resize a marker</div>
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<div id="title">Markers Layer Example</div>
|
||||
<h1 id="title">Markers Layer Example</h1>
|
||||
<div id="tags"></div>
|
||||
<div id="shortdesc">Show markers layer with different markers</div>
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
@@ -16,11 +16,15 @@
|
||||
#output {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* avoid pink tiles */
|
||||
.olImageLoadError {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map, measureControls;
|
||||
OpenLayers.Util.onImageLoadErrorColor = "transparent";
|
||||
function init(){
|
||||
map = new OpenLayers.Map('map');
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h3 id="title">MousePosition Control</h3>
|
||||
<h1 id="title">MousePosition Control</h1>
|
||||
<p id="shortdesc">
|
||||
Use the MousePosition Control to display the coordinates of the cursor
|
||||
inside or outside the map div.
|
||||
|
||||
57
examples/mousewheel-interval.html
Normal file
57
examples/mousewheel-interval.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>OpenLayers Mousewheel Interval Example</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map, layer;
|
||||
|
||||
function setCumulative() {
|
||||
var nav = map.getControlsByClass("OpenLayers.Control.Navigation")[0];
|
||||
var cumulative = document.getElementById("cumulative");
|
||||
nav.handlers.wheel.cumulative = cumulative.checked;
|
||||
}
|
||||
|
||||
function init(){
|
||||
map = new OpenLayers.Map( 'map', {controls: [
|
||||
new OpenLayers.Control.Navigation(
|
||||
{mouseWheelOptions: {interval: 100}}
|
||||
),
|
||||
new OpenLayers.Control.PanZoom(),
|
||||
new OpenLayers.Control.ArgParser(),
|
||||
new OpenLayers.Control.Attribution()
|
||||
]} );
|
||||
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0",
|
||||
{layers: 'basic'} );
|
||||
map.addLayer(layer);
|
||||
map.zoomToMaxExtent();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">OpenLayers Mousewheel Interval Example</h1>
|
||||
|
||||
<div id="tags"></div>
|
||||
|
||||
<div id="shortdesc">Let OpenLayers send less tile requests to the server when wheel-zooming.</div>
|
||||
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
<div id="docs">
|
||||
<p>This example shows how to configure the Navigation control to use
|
||||
the mousewheel in a less server resource consuming way: as long as you
|
||||
spin the mousewheel, no request will be sent to the server. Instead,
|
||||
the zoomlevel delta will be recorded. After a delay (in this example
|
||||
100ms), a zoom action with the cumulated delta will be performed.</p>
|
||||
<div>
|
||||
<input id="cumulative" type="checkbox" checked="checked"
|
||||
onchange="setCumulative()"/>
|
||||
<label for="cumulative">Cumulative mode. If this mode is deactivated,
|
||||
only one zoom event will be performed after the delay.</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -54,7 +54,7 @@
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h3 id="title">MultiMap Mercator Example</h3>
|
||||
<h1 id="title">MultiMap Mercator Example</h1>
|
||||
<p id="shortdesc">
|
||||
This sphericalMercator example using multimap demonstrates that the
|
||||
multimap layer does not fully support the sphericalMercator projection at
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h3 id="title">NavToolbar Demo</h3>
|
||||
<h1 id="title">NavToolbar Demo</h1>
|
||||
<p id="shortdesc">
|
||||
Demo the NavToolbar, a subclass of Control.Panel which shows icons for
|
||||
navigation.
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>OpenLayers: OpenMNND</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map, layer;
|
||||
|
||||
function init(){
|
||||
OpenLayers.ProxyHost="/proxy/?url=";
|
||||
map = new OpenLayers.Map('map', {'maxResolution':'auto', maxExtent: new OpenLayers.Bounds(-203349.72008129774,4816309.33,1154786.8041952979,5472346.5), projection: 'EPSG:26915' } );
|
||||
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
["http://geoint.lmic.state.mn.us/cgi-bin/wms"], {layers: 'fsa'} );
|
||||
map.addLayer(layer);
|
||||
|
||||
|
||||
wfs_url = "http://prototype.openmnnd.org/cgi-bin/mapserv.exe?map=openmnndwfs/openmnndwfs.map";
|
||||
wms = new OpenLayers.Layer.WMS("Minnesota Parcels (WMS)", wfs_url, {'layers':'streams', 'transparent': true, 'format':'image/gif'});
|
||||
|
||||
map.addLayer(wms);
|
||||
|
||||
wfs = new OpenLayers.Layer.WFS("Minnesota Streams (WFS)", wfs_url, {'typename':'streams'}, {ratio:1.25, minZoomLevel:4, style: OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default'])});
|
||||
|
||||
// preFeatureInsert can be used to set style before the feature is drawn
|
||||
wfs.preFeatureInsert= function(feature) { feature.style.strokeWidth="3"; feature.style.strokeColor="blue";
|
||||
}
|
||||
wfs.onFeatureInsert = function(feature) {
|
||||
OpenLayers.Util.getElement('stream_features').innerHTML = feature.layer.features.length;
|
||||
}
|
||||
map.addLayer(wfs);
|
||||
|
||||
// Or a style can be set on the layer.
|
||||
pwfsstyle = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
|
||||
OpenLayers.Util.extend(pwfsstyle, {'fillColor': 'green'});
|
||||
|
||||
pwfs = new OpenLayers.Layer.WFS("Minnesota Plat (WFS)", wfs_url,
|
||||
{'typename':'plat'},
|
||||
{
|
||||
ratio:1.25,
|
||||
minZoomLevel:8,
|
||||
extractAttributes: true,
|
||||
style: pwfsstyle
|
||||
});
|
||||
|
||||
pwfs.onFeatureInsert= function(feature) {
|
||||
OpenLayers.Util.getElement('plat_features').innerHTML = feature.layer.features.length;
|
||||
}
|
||||
map.addLayer(pwfs);
|
||||
|
||||
rstyle = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
|
||||
OpenLayers.Util.extend(rstyle, {'strokeColor': 'white', strokeWidth: "4"});
|
||||
rwfs = new OpenLayers.Layer.WFS("Minnesota Roads (WFS)", wfs_url, {'typename':'roads'},
|
||||
{ratio:1.25, minZoomLevel:7, extractAttributes: true, style:rstyle});
|
||||
|
||||
rwfs.onFeatureInsert= function(feature) {
|
||||
OpenLayers.Util.getElement('road_features').innerHTML = feature.layer.features.length;
|
||||
}
|
||||
|
||||
map.addLayer(rwfs);
|
||||
|
||||
map.events.register('moveend', null, function() {
|
||||
OpenLayers.Util.getElement('stream_features').innerHTML = "0";
|
||||
OpenLayers.Util.getElement('road_features').innerHTML = "0";
|
||||
OpenLayers.Util.getElement('plat_features').innerHTML = "0";
|
||||
});
|
||||
|
||||
var ls = new OpenLayers.Control.LayerSwitcher();
|
||||
map.addControl(ls);
|
||||
|
||||
drawControls = {
|
||||
selectPlat: new OpenLayers.Control.SelectFeature(pwfs, {callbacks: {'up':feature_info,'over':feature_info_hover}}),
|
||||
selectRoad: new OpenLayers.Control.SelectFeature(rwfs, {callbacks: {'up':feature_info,'over':feature_info_hover}})
|
||||
};
|
||||
|
||||
for(var key in drawControls) {
|
||||
map.addControl(drawControls[key]);
|
||||
}
|
||||
drawControls.selectPlat.activate();
|
||||
|
||||
map.zoomToExtent(new OpenLayers.Bounds(303232.550864,5082911.694856,305885.161263,5084486.682281));
|
||||
}
|
||||
|
||||
function toggleControl(element) {
|
||||
for(key in drawControls) {
|
||||
var control = drawControls[key];
|
||||
if(element.value == key && element.checked) {
|
||||
control.activate();
|
||||
} else {
|
||||
control.deactivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
var displayedFeature = null;
|
||||
function feature_info_hover(feature) {
|
||||
if (displayedFeature != feature &&
|
||||
(!feature.layer.selectedFeatures.length ||
|
||||
(feature.layer.selectedFeatures[0] == feature))) {
|
||||
feature_info(feature);
|
||||
displayedFeature = feature;
|
||||
}
|
||||
}
|
||||
function feature_info(feature) {
|
||||
var html = "<ul>";
|
||||
for(var i in feature.attributes)
|
||||
html += "<li><b>" + i + "</b>: "+ feature.attributes[i] + "</li>";
|
||||
html += "</ul>";
|
||||
OpenLayers.Util.getElement('feature_info').innerHTML = html;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">OpenMNND WFS</h1>
|
||||
<p id="shortdesc">This example shows the use of a WFS service rendered using the OpenLayers vector library.</p>
|
||||
<div id="map" class="smallmap"></div>
|
||||
<div id="docs">
|
||||
<p>
|
||||
This is an example that shows rendering a WFS service using OpenLayer vectors in the browser. The OpenLayers code will download the GML
|
||||
from the WFS service for each layer, parse it and create features using the OL vector library to draw the features on the map. For
|
||||
more information on the vector library, please visit <a href="http://trac.openlayers.org/wiki/Documentation/VectorSupport">vector support wiki</a>.
|
||||
In this example there are 4 layers shown on the map. The base layer and parcel layer are created from a WMS service using the OpenLayers.Layer.WMS object.
|
||||
The streams, roads, and plat layers are drawn from a WFS service using the OpenLayers.Layer.WFS object.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Rendering WFS layers into vectors is possible, but you need to be cautions when showing the features on the map. Testing has shown that when
|
||||
you renderer more than 200 vectors in the browser the performance decreases dramatically. Also features that have a lot of vertices
|
||||
can cause performance issues. In this example the parcel layer is rendered as a WMS layer because at the time of developing this example
|
||||
there where a handful of features that had too many vertices to render without killing the browser resources.
|
||||
|
||||
There are a number of properties that can be set for each WFS layer, such color and line weight using style properties such as strokeColor and strokeWidth.
|
||||
You can also get feature attributes from the WFS services using the extractAttribute property. View the source to see the example code.
|
||||
</p>
|
||||
</div>
|
||||
<div id="info">
|
||||
<ul>
|
||||
<li>Streams: Feature Count <span id="stream_features">0</span></li>
|
||||
<li>Plat: Feature Count <span id="plat_features">0</span></li>
|
||||
<li>Roads: Feature Count <span id="road_features">0</span></li>
|
||||
</ul>
|
||||
<div id="feature_info">
|
||||
</div>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="radio" name="type" value="selectRoad" id="selectToggle" onclick="toggleControl(this);" />
|
||||
<label for="selectToggle">select road</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" name="type" value="selectPlat" id="selectToggle" onclick="toggleControl(this);" checked=checked />
|
||||
<label for="selectToggle">select polygon</label>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
30
examples/osm.html
Normal file
30
examples/osm.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>OpenLayers Basic Single WMS Example</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map, layer;
|
||||
function init(){
|
||||
map = new OpenLayers.Map( 'map');
|
||||
layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
|
||||
map.addLayer(layer);
|
||||
map.zoomToMaxExtent();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">Basic OSM Example</h1>
|
||||
|
||||
<div id="tags"></div>
|
||||
|
||||
<div id="shortdesc">Show a Simple OSM Map</div>
|
||||
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
<div id="docs">
|
||||
This example shows a very simple OSM layout with minimal controls.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
|
||||
<body onload="init()">
|
||||
<h3 id="title">Using maxResolution to control overlays</h3>
|
||||
<h1 id="title">Using maxResolution to control overlays</h1>
|
||||
<p id="shortdesc">
|
||||
See how to control the maximum resolution for a markers layer,
|
||||
causing it to not be displayed beyond a certain point.
|
||||
|
||||
@@ -32,13 +32,13 @@
|
||||
<div id="map2"></div>
|
||||
<p>The second map has an overview map control that is created with
|
||||
non-default options. In this case, the mapOptions property of the
|
||||
control has been set to use non-default projection related properties.
|
||||
In addition, any other properties of the overview map control can be
|
||||
control has been set to use non-default projection related properties,
|
||||
and the layers property has been set to use a layer different from the main
|
||||
map. In addition, any other properties of the overview map control can be
|
||||
set in this way.</p>
|
||||
<script defer="defer" type="text/javascript">
|
||||
|
||||
// create the top map (with default overview map control)
|
||||
var map1 = new OpenLayers.Map('map1');
|
||||
// set up some layers
|
||||
|
||||
var ol = new OpenLayers.Layer.WMS(
|
||||
"OpenLayers WMS",
|
||||
@@ -52,6 +52,25 @@
|
||||
{layers: "landsat7"}
|
||||
);
|
||||
|
||||
// A clone of the above layer that we will use as overview for map2.
|
||||
// We need to clone jpl before the it gets added to a map, so the
|
||||
// clone can have its own maxExtent and maxResolution instead of
|
||||
// getting these settings initialized from map1.
|
||||
var jplOverview = jpl.clone();
|
||||
|
||||
// A more detailled layer of Manhattan for map2
|
||||
var ny = new OpenLayers.Layer.WMS(
|
||||
"Manhattan",
|
||||
"http://demo.opengeo.org/geoserver/wms",
|
||||
{
|
||||
layers: 'tiger-ny',
|
||||
format: 'image/png'
|
||||
}
|
||||
);
|
||||
|
||||
// create the top map (with default overview map control)
|
||||
var map1 = new OpenLayers.Map('map1');
|
||||
|
||||
map1.addLayers([ol, jpl]);
|
||||
map1.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
|
||||
@@ -67,35 +86,30 @@
|
||||
|
||||
// create the bottom map (with advanced overview map control)
|
||||
var mapOptions = {
|
||||
maxExtent: new OpenLayers.Bounds(33861, 717605, 330846, 1019656),
|
||||
maxResolution: 296985/1024,
|
||||
projection: "EPSG:2805",
|
||||
maxExtent: new OpenLayers.Bounds(-8242894.927728, 4965204.031195,
|
||||
-8227290.161511, 4994963.723637),
|
||||
maxResolution: 116.24879860156216,
|
||||
projection: "EPSG:900913",
|
||||
units: "m"
|
||||
};
|
||||
|
||||
var map2 = new OpenLayers.Map('map2', mapOptions);
|
||||
|
||||
var bos = new OpenLayers.Layer.WMS(
|
||||
"Boston",
|
||||
"http://boston.freemap.in/cgi-bin/mapserv",
|
||||
{
|
||||
map: '/www/freemap.in/boston/map/gmaps.map',
|
||||
layers: 'border,water,roads,rapid_transit,buildings',
|
||||
format: 'png'
|
||||
}
|
||||
);
|
||||
|
||||
map2.addLayers([bos]);
|
||||
map2.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
map2.addLayers([ny]);
|
||||
|
||||
// create an overview map control with non-default options
|
||||
var controlOptions = {
|
||||
mapOptions: mapOptions
|
||||
mapOptions: OpenLayers.Util.extend(mapOptions, {
|
||||
maxResolution: 156543.0339,
|
||||
maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
|
||||
20037508.34, 20037508.34)
|
||||
}),
|
||||
layers: [jplOverview]
|
||||
}
|
||||
var overview2 = new OpenLayers.Control.OverviewMap(controlOptions);
|
||||
map2.addControl(overview2);
|
||||
|
||||
map2.setCenter(new OpenLayers.LonLat(182500, 868500), 3);
|
||||
map2.setCenter(new OpenLayers.LonLat(-8233165.3575055, 4980298.21113769), 3);
|
||||
|
||||
// expand the overview map control
|
||||
overview2.maximizeControl();
|
||||
|
||||
@@ -40,6 +40,41 @@
|
||||
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
|
||||
}
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.olControlPanPanel {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
.olControlPanPanel .olControlPanNorthItemInactive {
|
||||
left: 50%;
|
||||
margin-left: -9px;
|
||||
top: 0;
|
||||
}
|
||||
.olControlPanPanel .olControlPanSouthItemInactive {
|
||||
left: 50%;
|
||||
margin-left: -9px;
|
||||
top: auto;
|
||||
bottom: 0;
|
||||
}
|
||||
.olControlPanPanel .olControlPanWestItemInactive {
|
||||
top: 50%;
|
||||
margin-top: -9px;
|
||||
left: 0;
|
||||
}
|
||||
.olControlPanPanel .olControlPanEastItemInactive {
|
||||
top: 50%;
|
||||
margin-top: -9px;
|
||||
left: auto;
|
||||
right: 0;
|
||||
}
|
||||
.olControlZoomPanel {
|
||||
left: auto;
|
||||
right: 23px;
|
||||
top: 8px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload='init();'>
|
||||
<h1 id="title">Pan and Zoom Panels</h1>
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h3 id="title">Custom Control.Panel</h3>
|
||||
<h1 id="title">Custom Control.Panel</h1>
|
||||
<p id="shortdesc">
|
||||
Create a custom control.panel, styled entirely with
|
||||
CSS, and add your own controls to it.
|
||||
|
||||
@@ -19,7 +19,8 @@ allowedHosts = ['www.openlayers.org', 'openlayers.org',
|
||||
'labs.metacarta.com', 'world.freemap.in',
|
||||
'prototype.openmnnd.org', 'geo.openplans.org',
|
||||
'sigma.openplans.org', 'demo.opengeo.org',
|
||||
'www.openstreetmap.org', 'sample.avencia.com']
|
||||
'www.openstreetmap.org', 'sample.azavea.com',
|
||||
'v-swe.uni-muenster.de:8080']
|
||||
|
||||
method = os.environ["REQUEST_METHOD"]
|
||||
|
||||
|
||||
@@ -28,11 +28,15 @@
|
||||
margin-left: 15em;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/* avoid pink tiles */
|
||||
.olImageLoadError {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map, polygonControl;
|
||||
OpenLayers.Util.onImageLoadErrorColor = "transparent";
|
||||
function init(){
|
||||
map = new OpenLayers.Map('map');
|
||||
|
||||
@@ -68,7 +72,7 @@
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h2 id="title">OpenLayers Regular Polygon Example</h2>
|
||||
<h1 id="title">OpenLayers Regular Polygon Example</h1>
|
||||
<p id="shortdesc">
|
||||
Shows how to use the RegularPolygon handler to draw features with
|
||||
different numbers of sides.
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h3 id="title">Resize Features Programatically</h3>
|
||||
<h1 id="title">Resize Features Programatically</h1>
|
||||
<p id="shortdesc">
|
||||
Demonstration of how to use the geometry resize methods to
|
||||
change feature sizes programatically.
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h3 id="title">OpenLayers Restricted Extent Example</h3>
|
||||
<h1 id="title">OpenLayers Restricted Extent Example</h1>
|
||||
<p id="shortdesc">
|
||||
Don't let users drag outside the map extent: instead, limit dragging such
|
||||
that the extent of the layer is the maximum viewable area.
|
||||
|
||||
@@ -21,6 +21,15 @@
|
||||
);
|
||||
|
||||
var vectors = new OpenLayers.Layer.Vector("Vector Layer");
|
||||
vectors.events.on({
|
||||
'featureselected': function(feature) {
|
||||
$('counter').innerHTML = this.selectedFeatures.length;
|
||||
},
|
||||
'featureunselected': function(feature) {
|
||||
$('counter').innerHTML = this.selectedFeatures.length;
|
||||
},
|
||||
});
|
||||
|
||||
map.addLayers([wmsLayer, vectors]);
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
|
||||
@@ -74,11 +83,17 @@
|
||||
|
||||
function update() {
|
||||
var clickout = document.getElementById("clickout").checked;
|
||||
drawControls.select.clickout = clickout;
|
||||
drawControls.select.box = document.getElementById("box").checked;
|
||||
if(drawControls.select.active) {
|
||||
drawControls.select.deactivate();
|
||||
drawControls.select.activate();
|
||||
if(clickout != drawControls.select.clickout) {
|
||||
drawControls.select.clickout = clickout;
|
||||
}
|
||||
|
||||
var box = document.getElementById("box").checked;
|
||||
if(box != drawControls.select.box) {
|
||||
drawControls.select.box = box;
|
||||
if(drawControls.select.active) {
|
||||
drawControls.select.deactivate();
|
||||
drawControls.select.activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -119,7 +134,7 @@
|
||||
<li>
|
||||
<input type="radio" name="type" value="select" id="selectToggle"
|
||||
onclick="toggleControl(this);" />
|
||||
<label for="selectToggle">select feature</label>
|
||||
<label for="selectToggle">select feature (<span id="counter">0</span> features selected)</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input id="box" type="checkbox" checked="checked"
|
||||
|
||||
179
examples/sos.html
Normal file
179
examples/sos.html
Normal file
@@ -0,0 +1,179 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<style type="text/css">
|
||||
.sosmap {
|
||||
width: 768px;
|
||||
height: 512px;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map;
|
||||
|
||||
OpenLayers.ProxyHost = "proxy.cgi?url=";
|
||||
OpenLayers.Util.extend(OpenLayers.Lang.en,
|
||||
{
|
||||
'SOSClientType': "Type",
|
||||
'SOSClientTime': "Date/time",
|
||||
'SOSClientLastvalue': "Last value"
|
||||
}
|
||||
);
|
||||
|
||||
// Example class on how to put all the OpenLayers SOS pieces together
|
||||
OpenLayers.SOSClient = OpenLayers.Class({
|
||||
url: null,
|
||||
map: null,
|
||||
capsformat: new OpenLayers.Format.SOSCapabilities(),
|
||||
obsformat: new OpenLayers.Format.SOSGetObservation(),
|
||||
initialize: function (options) {
|
||||
OpenLayers.Util.extend(this, options);
|
||||
var params = {'service': 'SOS', 'request': 'GetCapabilities'};
|
||||
var paramString = OpenLayers.Util.getParameterString(params);
|
||||
url = OpenLayers.Util.urlAppend(this.url, paramString);
|
||||
OpenLayers.Request.GET({url: url,
|
||||
success: this.parseSOSCaps, scope: this});
|
||||
},
|
||||
getFois: function() {
|
||||
var result = [];
|
||||
this.offeringCount = 0;
|
||||
for (var name in this.SOSCapabilities.contents.offeringList) {
|
||||
var offering = this.SOSCapabilities.contents.offeringList[name];
|
||||
this.offeringCount++;
|
||||
for (var i=0, len=offering.featureOfInterestIds.length; i<len; i++) {
|
||||
var foi = offering.featureOfInterestIds[i];
|
||||
if (OpenLayers.Util.indexOf(result, foi) === -1) {
|
||||
result.push(foi);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
parseSOSCaps: function(response) {
|
||||
// cache capabilities for future use
|
||||
this.SOSCapabilities = this.capsformat.read(response.responseXML || response.responseText);
|
||||
this.layer = new OpenLayers.Layer.Vector("Stations", {
|
||||
strategies: [new OpenLayers.Strategy.Fixed()],
|
||||
protocol: new OpenLayers.Protocol.SOS({
|
||||
formatOptions: {internalProjection: map.getProjectionObject()},
|
||||
url: this.url,
|
||||
fois: this.getFois()
|
||||
})
|
||||
});
|
||||
this.map.addLayer(this.layer);
|
||||
this.ctrl = new OpenLayers.Control.SelectFeature(this.layer,
|
||||
{scope: this, onSelect: this.onFeatureSelect});
|
||||
this.map.addControl(this.ctrl);
|
||||
this.ctrl.activate();
|
||||
},
|
||||
getTitleForObservedProperty: function(property) {
|
||||
for (var name in this.SOSCapabilities.contents.offeringList) {
|
||||
var offering = this.SOSCapabilities.contents.offeringList[name];
|
||||
if (offering.observedProperty === property) {
|
||||
return offering.name;
|
||||
}
|
||||
}
|
||||
},
|
||||
showPopup: function(response) {
|
||||
this.count++;
|
||||
var output = this.obsformat.read(response.responseXML || response.responseText);
|
||||
this.html += '<tr>';
|
||||
this.html += '<td width="100">'+this.getTitleForObservedProperty(output.measurements[0].observedProperty)+'</td>';
|
||||
this.html += '<td>'+output.measurements[0].samplingTime.timeInstant.timePosition+'</td>';
|
||||
this.html += '<td>'+output.measurements[0].result.value + ' ' + output.measurements[0].result.uom + '</td>';
|
||||
this.html += '</tr>';
|
||||
// check if we are done
|
||||
if (this.count === this.numRequests) {
|
||||
var html = '<table cellspacing="10"><tbody>';
|
||||
html += '<tr>';
|
||||
html += '<th><b>'+OpenLayers.i18n('SOSClientType')+'</b></th>';
|
||||
html += '<th><b>'+OpenLayers.i18n('SOSClientTime')+'</b></th>';
|
||||
html += '<th><b>'+OpenLayers.i18n('SOSClientLastvalue')+'</b></th>';
|
||||
html += '</tr>';
|
||||
html += this.html;
|
||||
html += '</tbody></table>';
|
||||
var popup = new OpenLayers.Popup.FramedCloud("sensor",
|
||||
this.feature.geometry.getBounds().getCenterLonLat(),
|
||||
null,
|
||||
html,
|
||||
null,
|
||||
true,
|
||||
function(e) {
|
||||
this.hide();
|
||||
OpenLayers.Event.stop(e);
|
||||
// unselect so popup can be shown again
|
||||
this.map.getControlsByClass('OpenLayers.Control.SelectFeature')[0].unselectAll();
|
||||
}
|
||||
);
|
||||
this.feature.popup = popup;
|
||||
this.map.addPopup(popup);
|
||||
}
|
||||
},
|
||||
onFeatureSelect: function(feature) {
|
||||
this.feature = feature;
|
||||
this.count = 0;
|
||||
this.html = '';
|
||||
this.numRequests = this.offeringCount;
|
||||
if (!this.responseFormat) {
|
||||
for (format in this.SOSCapabilities.operationsMetadata.GetObservation.parameters.responseFormat.allowedValues) {
|
||||
// look for a text/xml type of format
|
||||
if (format.indexOf('text/xml') >= 0) {
|
||||
this.responseFormat = format;
|
||||
}
|
||||
}
|
||||
}
|
||||
// do a GetObservation request to get the latest values
|
||||
for (var name in this.SOSCapabilities.contents.offeringList) {
|
||||
var offering = this.SOSCapabilities.contents.offeringList[name];
|
||||
var xml = this.obsformat.write({
|
||||
eventTime: 'latest',
|
||||
resultModel: 'measurement',
|
||||
responseMode: 'inline',
|
||||
procedure: feature.attributes.id,
|
||||
offering: name,
|
||||
observedProperty: offering.observedProperty,
|
||||
responseFormat: this.responseFormat
|
||||
});
|
||||
OpenLayers.Request.POST({
|
||||
url: this.url,
|
||||
scope: this,
|
||||
success: this.showPopup,
|
||||
data: xml
|
||||
});
|
||||
}
|
||||
},
|
||||
destroy: function () {
|
||||
},
|
||||
CLASS_NAME: "OpenLayers.SOSClient"
|
||||
});
|
||||
|
||||
function init(){
|
||||
map = new OpenLayers.Map( 'map' );
|
||||
var baseLayer = new OpenLayers.Layer.WMS("Test Layer", "http://labs.metacarta.com/wms/vmap0?", {
|
||||
layers: "basic"}, {singleTile: true});
|
||||
|
||||
var sos = new OpenLayers.SOSClient({map: map, url: 'http://v-swe.uni-muenster.de:8080/WeatherSOS/sos?'});
|
||||
|
||||
map.addLayers([baseLayer]);
|
||||
map.setCenter(new OpenLayers.LonLat(5, 45), 4);
|
||||
map.addControl( new OpenLayers.Control.LayerSwitcher() );
|
||||
map.addControl( new OpenLayers.Control.MousePosition() );
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">SOS client example</h1>
|
||||
|
||||
<div id="tags">
|
||||
</div>
|
||||
<p id="shortdesc">
|
||||
Shows how to connect OpenLayers to a Sensor Observation Service (SOS)
|
||||
</p>
|
||||
<div id="map" class="sosmap"></div>
|
||||
<div id="docs">
|
||||
<p>This example uses a vector layer with a Protocol.SOS and a fixed Strategy.
|
||||
</p><p>When clicking on a point feature (the weather stations offered by the SOS), the
|
||||
latest values for all offerings are displayed in a popup.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -8,6 +8,11 @@
|
||||
#map {
|
||||
height: 512px;
|
||||
}
|
||||
|
||||
/* avoid pink tiles */
|
||||
.olImageLoadError {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src='http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1'></script>
|
||||
@@ -20,9 +25,8 @@
|
||||
// make map available for easy debugging
|
||||
var map;
|
||||
|
||||
// avoid pink tiles
|
||||
// increase reload attempts
|
||||
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
|
||||
OpenLayers.Util.onImageLoadErrorColor = "transparent";
|
||||
|
||||
function init(){
|
||||
var options = {
|
||||
@@ -102,7 +106,7 @@
|
||||
"http://world.freemap.in/tiles/",
|
||||
{'layers': 'factbook-overlay', 'format':'png'},
|
||||
{
|
||||
'opacity': 0.4,
|
||||
'opacity': 0.4, visibility: false,
|
||||
'isBaseLayer': false,'wrapDateLine': true
|
||||
}
|
||||
);
|
||||
|
||||
@@ -4,10 +4,15 @@
|
||||
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<style>
|
||||
/* avoid pink tiles */
|
||||
.olImageLoadError {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map, vectors, split;
|
||||
OpenLayers.Util.onImageLoadErrorColor = "transparent";
|
||||
function init(){
|
||||
map = new OpenLayers.Map('map');
|
||||
|
||||
|
||||
43
examples/style-rules.html
Normal file
43
examples/style-rules.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>OpenLayers Rule Based Style</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script src="style-rules.js"></script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">Rule Based Style</h1>
|
||||
|
||||
<p id="shortdesc">
|
||||
Use rule based styling to use different symbolizers for different
|
||||
feature groups.
|
||||
</p>
|
||||
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
<div id="docs">
|
||||
<p>
|
||||
This example uses four rules to render features. Rules are
|
||||
based on a feature attribute and determine which symbolizer
|
||||
is applied when rendering a feature. The rules in this example
|
||||
change which marker is used by providing an externalGraphic
|
||||
property in the symbolizer.
|
||||
</p>
|
||||
The features are labeled with the same attribute that determines
|
||||
the symbolizer used. You should be able to confirm that the
|
||||
graphic color corresponds to the range of numbers given below.
|
||||
</p>
|
||||
<ul>
|
||||
<li>0 <= blue < 25
|
||||
<li>25 <= green < 50
|
||||
<li>50 <= gold <= 75
|
||||
<li>75 < red <= 100
|
||||
</ul>
|
||||
<p>
|
||||
See the <a href="style-rules.js" target="_blank">
|
||||
style-rules.js source</a> to see how this is done.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
99
examples/style-rules.js
Normal file
99
examples/style-rules.js
Normal file
@@ -0,0 +1,99 @@
|
||||
var map;
|
||||
|
||||
function init() {
|
||||
map = new OpenLayers.Map("map");
|
||||
|
||||
var wms = new OpenLayers.Layer.WMS(
|
||||
"OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0",
|
||||
{layers: "basic"}
|
||||
);
|
||||
|
||||
/**
|
||||
* Create 50 vector features. Your features would typically be fetched
|
||||
* from the server. These are created here to demonstrate a rule based
|
||||
* style. The features are given an attribute named "foo". The value
|
||||
* of this attribute is an integer that ranges from 0 to 100.
|
||||
*/
|
||||
var features = new Array(25);
|
||||
for (var i=0; i<features.length; i++) {
|
||||
features[i] = new OpenLayers.Feature.Vector(
|
||||
new OpenLayers.Geometry.Point(
|
||||
(340 * Math.random()) - 170,
|
||||
(160 * Math.random()) - 80
|
||||
), {
|
||||
foo: 100 * Math.random() | 0
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Here we create a new style object with rules that determine
|
||||
* which symbolizer will be used to render each feature.
|
||||
*/
|
||||
var style = new OpenLayers.Style(
|
||||
// the first argument is a base symbolizer
|
||||
// all other symbolizers in rules will extend this one
|
||||
{
|
||||
graphicWidth: 21,
|
||||
graphicHeight: 25,
|
||||
graphicYOffset: -28, // shift graphic up 28 pixels
|
||||
label: "${foo}" // label will be foo attribute value
|
||||
},
|
||||
// the second argument will include all rules
|
||||
{
|
||||
rules: [
|
||||
new OpenLayers.Rule({
|
||||
// a rule contains an optional filter
|
||||
filter: new OpenLayers.Filter.Comparison({
|
||||
type: OpenLayers.Filter.Comparison.LESS_THAN,
|
||||
property: "foo", // the "foo" feature attribute
|
||||
value: 25
|
||||
}),
|
||||
// if a feature matches the above filter, use this symbolizer
|
||||
symbolizer: {
|
||||
externalGraphic: "../img/marker-blue.png"
|
||||
}
|
||||
}),
|
||||
new OpenLayers.Rule({
|
||||
filter: new OpenLayers.Filter.Comparison({
|
||||
type: OpenLayers.Filter.Comparison.BETWEEN,
|
||||
property: "foo",
|
||||
lowerBoundary: 25,
|
||||
upperBoundary: 50
|
||||
}),
|
||||
symbolizer: {
|
||||
externalGraphic: "../img/marker-green.png"
|
||||
}
|
||||
}),
|
||||
new OpenLayers.Rule({
|
||||
filter: new OpenLayers.Filter.Comparison({
|
||||
type: OpenLayers.Filter.Comparison.BETWEEN,
|
||||
property: "foo",
|
||||
lowerBoundary: 50,
|
||||
upperBoundary: 75
|
||||
}),
|
||||
symbolizer: {
|
||||
externalGraphic: "../img/marker-gold.png"
|
||||
}
|
||||
}),
|
||||
new OpenLayers.Rule({
|
||||
// apply this rule if no others apply
|
||||
elseFilter: true,
|
||||
symbolizer: {
|
||||
externalGraphic: "../img/marker.png"
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
// create the layer styleMap that uses the above style for all render intents
|
||||
var vector = new OpenLayers.Layer.Vector("Points", {
|
||||
styleMap: new OpenLayers.StyleMap(style)
|
||||
});
|
||||
vector.addFeatures(features);
|
||||
|
||||
map.addLayers([wms, vector]);
|
||||
map.setCenter(new OpenLayers.LonLat(0, 0), 1);
|
||||
}
|
||||
@@ -79,4 +79,8 @@ h6 {
|
||||
}
|
||||
#tags {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
#docs p {
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
@@ -38,18 +38,21 @@
|
||||
pointRadius: "${type}", // sized according to type attribute
|
||||
fillColor: "#ffcc66",
|
||||
strokeColor: "#ff9933",
|
||||
strokeWidth: 2
|
||||
strokeWidth: 2,
|
||||
graphicZIndex: 1
|
||||
}),
|
||||
"select": new OpenLayers.Style({
|
||||
fillColor: "#66ccff",
|
||||
strokeColor: "#3399ff"
|
||||
strokeColor: "#3399ff",
|
||||
graphicZIndex: 2
|
||||
})
|
||||
});
|
||||
|
||||
// Create a vector layer and give it your style map.
|
||||
var points = new OpenLayers.Layer.Vector(
|
||||
'Points', {styleMap: myStyles}
|
||||
);
|
||||
var points = new OpenLayers.Layer.Vector("Points", {
|
||||
styleMap: myStyles,
|
||||
rendererOptions: {zIndexing: true}
|
||||
});
|
||||
points.addFeatures(features);
|
||||
map.addLayers([wms, points]);
|
||||
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>OpenLayers Styles Rotation Example</title>
|
||||
<style type="text/css">
|
||||
#map {
|
||||
width: 800px;
|
||||
height: 475px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -76,10 +71,16 @@
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">Rotation Style Example</h1>
|
||||
<p id="shortdesc">To style point features with rotation, use the rotation
|
||||
property of the symbolizer. The center of the rotation is the point of the
|
||||
image specified by graphicXOffset and graphicYOffset.</p>
|
||||
<div id="map"></div>
|
||||
<div id="docs"/>
|
||||
<p id="shortdesc">
|
||||
Use the rotation property of a point symbolizer to rotate
|
||||
point symbolizers.
|
||||
</p>
|
||||
<div id="map" class="smallmap"></div>
|
||||
<div id="docs">
|
||||
To style point features with rotation, use the rotation property of the
|
||||
symbolizer. The center of the rotation is the point of the image
|
||||
specified by graphicXOffset and graphicYOffset. The rotation is
|
||||
specified in degrees clockwise.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
new OpenLayers.Rule({
|
||||
symbolizer: {
|
||||
graphic: false,
|
||||
label: "Label for invisible point"
|
||||
label: "Label for invisible point",
|
||||
labelSelect: true
|
||||
},
|
||||
filter: new OpenLayers.Filter.Comparison({
|
||||
type: "==",
|
||||
@@ -50,7 +51,9 @@
|
||||
stroke: true,
|
||||
fill: false,
|
||||
label: "Point without fill",
|
||||
labelAlign: "rb"
|
||||
labelAlign: "rb",
|
||||
fontColor: "#ff0000",
|
||||
fontOpacity: 0.4
|
||||
},
|
||||
filter: new OpenLayers.Filter.Comparison({
|
||||
type: "==",
|
||||
@@ -105,6 +108,13 @@
|
||||
vectorLayer.drawFeature(multiFeature);
|
||||
map.setCenter(new OpenLayers.LonLat(point.x, point.y), 4);
|
||||
vectorLayer.addFeatures([pointFeature, polygonFeature, multiFeature]);
|
||||
var select = new OpenLayers.Control.SelectFeature(vectorLayer, {
|
||||
selectStyle: OpenLayers.Util.extend(
|
||||
{fill: true, stroke: true},
|
||||
OpenLayers.Feature.Vector.style["select"])
|
||||
});
|
||||
map.addControl(select);
|
||||
select.activate();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
@@ -117,6 +127,8 @@
|
||||
<div id="map" class="smallmap"></div>
|
||||
<div id="docs">
|
||||
This example shows how to use symbolizers with defaults for stroke, fill, and graphic.
|
||||
This also allows to create labels for a feature without the feature rendered. Click on
|
||||
the label in the middle to see selection of features with labelSelect set to true.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
105
examples/transform-feature.html
Normal file
105
examples/transform-feature.html
Normal file
@@ -0,0 +1,105 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>OpenLayers: Transformation Box</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var map, control;
|
||||
|
||||
function init(){
|
||||
map = new OpenLayers.Map('map', {allOverlays: true});
|
||||
|
||||
// context for appropriate scale/resize cursors
|
||||
var cursors = ["sw-resize", "s-resize", "se-resize",
|
||||
"e-resize", "ne-resize", "n-resize", "nw-resize", "w-resize"];
|
||||
var context = {
|
||||
getCursor: function(feature){
|
||||
var i = OpenLayers.Util.indexOf(control.handles, feature);
|
||||
var cursor = "inherit";
|
||||
if(i !== -1) {
|
||||
i = (i + 8 + Math.round(control.rotation / 90) * 2) % 8;
|
||||
cursor = cursors[i];
|
||||
}
|
||||
return cursor;
|
||||
}
|
||||
};
|
||||
|
||||
// a nice style for the transformation box
|
||||
var style = new OpenLayers.Style({
|
||||
cursor: "${getCursor}",
|
||||
pointRadius: 5,
|
||||
fillColor: "white",
|
||||
fillOpacity: 1,
|
||||
strokeColor: "black"
|
||||
}, {context: context});
|
||||
|
||||
// the layer that we want to transform features on
|
||||
var vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry", {
|
||||
styleMap: new OpenLayers.StyleMap({
|
||||
"transform": style
|
||||
})
|
||||
});
|
||||
|
||||
// create the TransformFeature control, using the renderIntent
|
||||
// from above
|
||||
control = new OpenLayers.Control.TransformFeature(vectorLayer, {
|
||||
renderIntent: "transform"
|
||||
});
|
||||
map.addControl(control);
|
||||
|
||||
// create a polygon feature from a linear ring of points
|
||||
var point = new OpenLayers.Geometry.Point(-111.04, 45.68);
|
||||
var pointList = [];
|
||||
for(var p=0; p<6; ++p) {
|
||||
var a = p * (2 * Math.PI) / 7;
|
||||
var r = Math.random(1) + 2;
|
||||
var newPoint = new OpenLayers.Geometry.Point(point.x + (r * Math.cos(a)),
|
||||
point.y + (r * Math.sin(a)));
|
||||
pointList.push(newPoint);
|
||||
}
|
||||
pointList.push(pointList[0]);
|
||||
|
||||
var linearRing = new OpenLayers.Geometry.LinearRing(pointList);
|
||||
var polygonFeature = new OpenLayers.Feature.Vector(
|
||||
new OpenLayers.Geometry.Polygon([linearRing]));
|
||||
|
||||
|
||||
map.addLayer(vectorLayer);
|
||||
map.setCenter(new OpenLayers.LonLat(point.x, point.y), 5);
|
||||
var anotherFeature = polygonFeature.clone();
|
||||
polygonFeature.geometry.move(-3, 0);
|
||||
anotherFeature.geometry.move(3, 0);
|
||||
vectorLayer.addFeatures([polygonFeature, anotherFeature]);
|
||||
|
||||
// start with the transformation box on polygonFeature
|
||||
control.setFeature(polygonFeature, {rotation: 45, scale: 0.5, ratio: 1.5});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">Vector Feature Transformation Box Example</h1>
|
||||
|
||||
<div id="tags">
|
||||
</div>
|
||||
<p id="shortdesc">
|
||||
Shows the use of the TransformFeature control.
|
||||
</p>
|
||||
<div style="text-align: right">
|
||||
<div dir="rtl" id="map" class="smallmap"></div>
|
||||
</div>
|
||||
<div id="docs">
|
||||
<p>This example shows transformation of vector features with a
|
||||
tranformation box. Grab one of the handles to resize the feature.
|
||||
Holding the SHIFT key will preserve the aspect ratio. Position the
|
||||
mouse right outside one of the corner handles to rotate the feature,
|
||||
and hold the SHIFT key to only rotate in 45° increments.</p>
|
||||
<p>In this example, the transformation box has been set on the left
|
||||
feature, with a rotation preset of 45°. Clicking on the right feature
|
||||
will set it for transformation, starting with an unrotated box.
|
||||
Dragging a feature or the box edges will move it around.</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -8,28 +8,24 @@
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var lon = 5;
|
||||
var lat = 40;
|
||||
var lon = 12;
|
||||
var lat = 41;
|
||||
var zoom = 15;
|
||||
var map, velayer, layer;
|
||||
var map, velayer, layer, marker;
|
||||
|
||||
function init(){
|
||||
map = new OpenLayers.Map( 'map' ,
|
||||
{controls:[new OpenLayers.Control.MouseDefaults()]});
|
||||
|
||||
velayer = new OpenLayers.Layer.VirtualEarth( "VE",
|
||||
{ minZoomLevel: 4, maxZoomLevel: 6, 'type': VEMapStyle.Aerial});
|
||||
velayer = new OpenLayers.Layer.VirtualEarth( "VE", {
|
||||
// turn off animated zooming
|
||||
animationEnabled: false,
|
||||
minZoomLevel: 4,
|
||||
maxZoomLevel: 6,
|
||||
'type': VEMapStyle.Aerial
|
||||
});
|
||||
map.addLayer(velayer);
|
||||
|
||||
var twms = new OpenLayers.Layer.WMS( "World Map",
|
||||
"http://world.freemap.in/cgi-bin/mapserv?",
|
||||
{ map: '/www/freemap.in/world/map/factbooktrans.map',
|
||||
transparent:'true',
|
||||
layers: 'factbook',
|
||||
'format':'png'},
|
||||
{'reproject': true});
|
||||
map.addLayer(twms);
|
||||
|
||||
markers = new OpenLayers.Layer.Markers("markers");
|
||||
map.addLayer(markers);
|
||||
|
||||
@@ -39,13 +35,17 @@
|
||||
}
|
||||
|
||||
function add() {
|
||||
|
||||
marker = new OpenLayers.Marker(new OpenLayers.LonLat(2, 41));
|
||||
markers.addMarker(marker);
|
||||
if(!marker) {
|
||||
marker = new OpenLayers.Marker(new OpenLayers.LonLat(15, 47));
|
||||
markers.addMarker(marker);
|
||||
}
|
||||
}
|
||||
|
||||
function remove() {
|
||||
markers.removeMarker(marker);
|
||||
if(marker) {
|
||||
markers.removeMarker(marker);
|
||||
marker = null;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
@@ -59,7 +59,7 @@
|
||||
</p>
|
||||
|
||||
<div id="map" class="smallmap"></div>
|
||||
<input type="button" onClick="javascript:add()"value="Add the marker from the map">
|
||||
<input type="button" onClick="javascript:add()"value="Add the marker to the map">
|
||||
<input type="button" onClick="javascript:remove()" value="Remove the marker from the map">
|
||||
<div id="docs">This example demonstrates the ability to add VirtualEarth and the and remove markers.</div>
|
||||
</body>
|
||||
|
||||
@@ -33,7 +33,9 @@
|
||||
fontSize: "12px",
|
||||
fontFamily: "Courier New, monospace",
|
||||
fontWeight: "bold",
|
||||
labelAlign: "${align}"
|
||||
labelAlign: "${align}",
|
||||
labelXOffset: "${xOffset}",
|
||||
labelYOffset: "${yOffset}"
|
||||
}}),
|
||||
renderers: renderer
|
||||
});
|
||||
@@ -83,6 +85,22 @@
|
||||
favColor: 'black',
|
||||
align: 'rt'
|
||||
});
|
||||
|
||||
// Create a point feature to show the label offset options
|
||||
var labelOffsetPoint = new OpenLayers.Geometry.Point(-101.04, 35.68);
|
||||
var labelOffsetFeature = new OpenLayers.Feature.Vector(labelOffsetPoint);
|
||||
labelOffsetFeature.attributes = {
|
||||
name: "offset",
|
||||
age: 22,
|
||||
favColor: 'blue',
|
||||
align: "cm",
|
||||
// positive value moves the label to the right
|
||||
xOffset: 50,
|
||||
// negative value moves the label down
|
||||
yOffset: -15
|
||||
};
|
||||
|
||||
|
||||
var nullFeature = new OpenLayers.Feature.Vector(null);
|
||||
nullFeature.attributes = {
|
||||
name: "toto is some text about the world",
|
||||
@@ -94,7 +112,7 @@
|
||||
map.addLayer(vectorLayer);
|
||||
vectorLayer.drawFeature(multiFeature);
|
||||
map.setCenter(new OpenLayers.LonLat(point.x, point.y), 3);
|
||||
vectorLayer.addFeatures([pointFeature, polygonFeature, multiFeature, nullFeature ]);
|
||||
vectorLayer.addFeatures([pointFeature, polygonFeature, multiFeature, labelOffsetFeature, nullFeature ]);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
// of the image will be ignored
|
||||
style_mark.graphicWidth = 24;
|
||||
style_mark.graphicHeight = 20;
|
||||
style_mark.graphicXOffset = -(style_mark.graphicWidth/2); // this is the default value
|
||||
style_mark.graphicXOffset = 10; // default is -(style_mark.graphicWidth/2);
|
||||
style_mark.graphicYOffset = -style_mark.graphicHeight;
|
||||
style_mark.externalGraphic = "../img/marker.png";
|
||||
// graphicTitle only works in Firefox and Internet Explorer
|
||||
@@ -116,9 +116,7 @@
|
||||
<p id="shortdesc">
|
||||
Shows the use of the shows drawing simple vector features, in different styles.
|
||||
</p>
|
||||
<div style="text-align: right">
|
||||
<div dir="rtl" id="map" class="smallmap"></div>
|
||||
</div>
|
||||
<div id="map" class="smallmap"></div>
|
||||
<div id="docs">
|
||||
<p>This example shows drawing simple vector features -- point, line, polygon
|
||||
in different styles, created 'manually', by constructing the entire style
|
||||
|
||||
@@ -69,6 +69,8 @@
|
||||
OpenLayers.Util.extend({}, gmlOptions),
|
||||
out_options
|
||||
);
|
||||
var kmlOptionsIn = OpenLayers.Util.extend(
|
||||
{extractStyles: true}, in_options);
|
||||
formats = {
|
||||
'in': {
|
||||
wkt: new OpenLayers.Format.WKT(in_options),
|
||||
@@ -76,7 +78,8 @@
|
||||
georss: new OpenLayers.Format.GeoRSS(in_options),
|
||||
gml2: new OpenLayers.Format.GML.v2(gmlOptionsIn),
|
||||
gml3: new OpenLayers.Format.GML.v3(gmlOptionsIn),
|
||||
kml: new OpenLayers.Format.KML(in_options)
|
||||
kml: new OpenLayers.Format.KML(kmlOptionsIn),
|
||||
atom: new OpenLayers.Format.Atom(in_options)
|
||||
},
|
||||
'out': {
|
||||
wkt: new OpenLayers.Format.WKT(out_options),
|
||||
@@ -84,7 +87,8 @@
|
||||
georss: new OpenLayers.Format.GeoRSS(out_options),
|
||||
gml2: new OpenLayers.Format.GML.v2(gmlOptionsOut),
|
||||
gml3: new OpenLayers.Format.GML.v3(gmlOptionsOut),
|
||||
kml: new OpenLayers.Format.KML(out_options)
|
||||
kml: new OpenLayers.Format.KML(out_options),
|
||||
atom: new OpenLayers.Format.Atom(out_options)
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -142,7 +146,7 @@
|
||||
vectors.addFeatures(features);
|
||||
map.zoomToExtent(bounds);
|
||||
var plural = (features.length > 1) ? 's' : '';
|
||||
element.value = features.length + ' feature' + plural + ' added'
|
||||
element.value = features.length + ' feature' + plural + ' added';
|
||||
} else {
|
||||
element.value = 'Bad input ' + type;
|
||||
}
|
||||
@@ -181,6 +185,7 @@
|
||||
<label for="formatType">Format</label>
|
||||
<select name="formatType" id="formatType">
|
||||
<option value="geojson" selected="selected">GeoJSON</option>
|
||||
<option value="atom">Atom</option>
|
||||
<option value="kml">KML</option>
|
||||
<option value="georss">GeoRSS</option>
|
||||
<option value="gml2">GML (v2)</option>
|
||||
|
||||
@@ -58,140 +58,32 @@
|
||||
background-position: 0px 1px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
var map, wfs;
|
||||
|
||||
var DeleteFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
initialize: function(layer, options) {
|
||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||
this.layer = layer;
|
||||
this.handler = new OpenLayers.Handler.Feature(
|
||||
this, layer, {click: this.clickFeature}
|
||||
);
|
||||
},
|
||||
clickFeature: function(feature) {
|
||||
// if feature doesn't have a fid, destroy it
|
||||
if(feature.fid == undefined) {
|
||||
this.layer.destroyFeatures([feature]);
|
||||
} else {
|
||||
feature.state = OpenLayers.State.DELETE;
|
||||
this.layer.events.triggerEvent("afterfeaturemodified",
|
||||
{feature: feature});
|
||||
feature.renderIntent = "select";
|
||||
this.layer.drawFeature(feature);
|
||||
}
|
||||
},
|
||||
setMap: function(map) {
|
||||
this.handler.setMap(map);
|
||||
OpenLayers.Control.prototype.setMap.apply(this, arguments);
|
||||
},
|
||||
CLASS_NAME: "OpenLayers.Control.DeleteFeature"
|
||||
});
|
||||
|
||||
function init() {
|
||||
OpenLayers.ProxyHost= "proxy.cgi?url=";
|
||||
map = new OpenLayers.Map('map', {
|
||||
projection: new OpenLayers.Projection("EPSG:900913"),
|
||||
displayProjection: new OpenLayers.Projection("EPSG:4326"),
|
||||
units: "m",
|
||||
maxResolution: 156543.0339,
|
||||
maxExtent: new OpenLayers.Bounds(
|
||||
-11593508, 5509847, -11505759, 5557774
|
||||
),
|
||||
controls: [
|
||||
new OpenLayers.Control.PanZoom()
|
||||
]
|
||||
});
|
||||
var gphy = new OpenLayers.Layer.Google(
|
||||
"Google Physical",
|
||||
{type: G_PHYSICAL_MAP, sphericalMercator: true}
|
||||
);
|
||||
|
||||
var saveStrategy = new OpenLayers.Strategy.Save();
|
||||
|
||||
wfs = new OpenLayers.Layer.Vector("Editable Features", {
|
||||
strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
|
||||
projection: new OpenLayers.Projection("EPSG:4326"),
|
||||
protocol: new OpenLayers.Protocol.WFS({
|
||||
version: "1.1.0",
|
||||
srsName: "EPSG:4326",
|
||||
url: "http://demo.opengeo.org/geoserver/wfs",
|
||||
featureNS : "http://opengeo.org",
|
||||
featureType: "restricted",
|
||||
geometryName: "the_geom",
|
||||
schema: "http://demo.opengeo.org/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=og:restricted"
|
||||
})
|
||||
});
|
||||
|
||||
map.addLayers([gphy, wfs]);
|
||||
|
||||
var panel = new OpenLayers.Control.Panel(
|
||||
{'displayClass': 'customEditingToolbar'}
|
||||
);
|
||||
|
||||
var navigate = new OpenLayers.Control.Navigation({
|
||||
title: "Pan Map",
|
||||
});
|
||||
|
||||
var draw = new OpenLayers.Control.DrawFeature(
|
||||
wfs, OpenLayers.Handler.Polygon,
|
||||
{
|
||||
title: "Draw Feature",
|
||||
displayClass: "olControlDrawFeaturePolygon",
|
||||
handlerOptions: {multi: true}
|
||||
}
|
||||
);
|
||||
|
||||
var edit = new OpenLayers.Control.ModifyFeature(wfs, {
|
||||
title: "Modify Feature",
|
||||
displayClass: "olControlModifyFeature",
|
||||
});
|
||||
|
||||
var del = new DeleteFeature(wfs, {title: "Delete Feature"});
|
||||
|
||||
var save = new OpenLayers.Control.Button({
|
||||
title: "Save Changes",
|
||||
trigger: function() {
|
||||
if(edit.feature) {
|
||||
edit.selectControl.unselectAll();
|
||||
}
|
||||
saveStrategy.save();
|
||||
},
|
||||
displayClass: "olControlSaveFeatures"
|
||||
});
|
||||
|
||||
panel.addControls([navigate, save, del, edit, draw]);
|
||||
panel.defaultControl = navigate;
|
||||
map.addControl(panel);
|
||||
map.zoomToMaxExtent();
|
||||
}
|
||||
|
||||
</script>
|
||||
<script src="wfs-protocol-transactions.js"></script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
|
||||
<h1 id="title">WFS Transaction Example</h1>
|
||||
|
||||
<div id="tags">
|
||||
</div>
|
||||
<p id="shortdesc">
|
||||
Shows the use of the WFS Transactions (WFS-T).
|
||||
</p>
|
||||
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
<div id="docs">
|
||||
<p>The WFS protocol allows for creation of new features and reading,
|
||||
updating, or deleting of existing features.</p>
|
||||
<p>Use the tools to create, modify, and delete (in order from left
|
||||
to right) features. Use the save tool (picture of a disk) to
|
||||
save your changes. Use the navigation tool (hand) to stop editing
|
||||
and use the mouse for map navigation.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
<h1 id="title">WFS Transaction Example</h1>
|
||||
<div id="tags"></div>
|
||||
<p id="shortdesc">
|
||||
Shows the use of the WFS Transactions (WFS-T).
|
||||
</p>
|
||||
<div id="map" class="smallmap"></div>
|
||||
<div id="docs">
|
||||
<p>
|
||||
The WFS protocol allows for creation of new features and
|
||||
reading, updating, or deleting of existing features.
|
||||
</p>
|
||||
<p>
|
||||
Use the tools to create, modify, and delete (in order from left
|
||||
to right) features. Use the save tool (picture of a disk) to
|
||||
save your changes. Use the navigation tool (hand) to stop
|
||||
editing and use the mouse for map navigation.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="wfs-protocol-transactions.js" target="_blank">
|
||||
wfs-protocol-transactions.js source</a> to see how this is done.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
107
examples/wfs-protocol-transactions.js
Normal file
107
examples/wfs-protocol-transactions.js
Normal file
@@ -0,0 +1,107 @@
|
||||
var map, wfs;
|
||||
OpenLayers.ProxyHost = "proxy.cgi?url=";
|
||||
|
||||
var DeleteFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
initialize: function(layer, options) {
|
||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||
this.layer = layer;
|
||||
this.handler = new OpenLayers.Handler.Feature(
|
||||
this, layer, {click: this.clickFeature}
|
||||
);
|
||||
},
|
||||
clickFeature: function(feature) {
|
||||
// if feature doesn't have a fid, destroy it
|
||||
if(feature.fid == undefined) {
|
||||
this.layer.destroyFeatures([feature]);
|
||||
} else {
|
||||
feature.state = OpenLayers.State.DELETE;
|
||||
this.layer.events.triggerEvent("afterfeaturemodified",
|
||||
{feature: feature});
|
||||
feature.renderIntent = "select";
|
||||
this.layer.drawFeature(feature);
|
||||
}
|
||||
},
|
||||
setMap: function(map) {
|
||||
this.handler.setMap(map);
|
||||
OpenLayers.Control.prototype.setMap.apply(this, arguments);
|
||||
},
|
||||
CLASS_NAME: "OpenLayers.Control.DeleteFeature"
|
||||
});
|
||||
|
||||
function init() {
|
||||
map = new OpenLayers.Map('map', {
|
||||
projection: new OpenLayers.Projection("EPSG:900913"),
|
||||
displayProjection: new OpenLayers.Projection("EPSG:4326"),
|
||||
units: "m",
|
||||
maxResolution: 156543.0339,
|
||||
maxExtent: new OpenLayers.Bounds(
|
||||
-11593508, 5509847, -11505759, 5557774
|
||||
),
|
||||
controls: [
|
||||
new OpenLayers.Control.PanZoom()
|
||||
]
|
||||
});
|
||||
var gphy = new OpenLayers.Layer.Google(
|
||||
"Google Physical",
|
||||
{type: G_PHYSICAL_MAP, sphericalMercator: true}
|
||||
);
|
||||
|
||||
var saveStrategy = new OpenLayers.Strategy.Save();
|
||||
|
||||
wfs = new OpenLayers.Layer.Vector("Editable Features", {
|
||||
strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
|
||||
projection: new OpenLayers.Projection("EPSG:4326"),
|
||||
protocol: new OpenLayers.Protocol.WFS({
|
||||
version: "1.1.0",
|
||||
srsName: "EPSG:4326",
|
||||
url: "http://demo.opengeo.org/geoserver/wfs",
|
||||
featureNS : "http://opengeo.org",
|
||||
featureType: "restricted",
|
||||
geometryName: "the_geom",
|
||||
schema: "http://demo.opengeo.org/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=og:restricted"
|
||||
})
|
||||
});
|
||||
|
||||
map.addLayers([gphy, wfs]);
|
||||
|
||||
var panel = new OpenLayers.Control.Panel(
|
||||
{'displayClass': 'customEditingToolbar'}
|
||||
);
|
||||
|
||||
var navigate = new OpenLayers.Control.Navigation({
|
||||
title: "Pan Map"
|
||||
});
|
||||
|
||||
var draw = new OpenLayers.Control.DrawFeature(
|
||||
wfs, OpenLayers.Handler.Polygon,
|
||||
{
|
||||
title: "Draw Feature",
|
||||
displayClass: "olControlDrawFeaturePolygon",
|
||||
multi: true
|
||||
}
|
||||
);
|
||||
|
||||
var edit = new OpenLayers.Control.ModifyFeature(wfs, {
|
||||
title: "Modify Feature",
|
||||
displayClass: "olControlModifyFeature"
|
||||
});
|
||||
|
||||
var del = new DeleteFeature(wfs, {title: "Delete Feature"});
|
||||
|
||||
var save = new OpenLayers.Control.Button({
|
||||
title: "Save Changes",
|
||||
trigger: function() {
|
||||
if(edit.feature) {
|
||||
edit.selectControl.unselectAll();
|
||||
}
|
||||
saveStrategy.save();
|
||||
},
|
||||
displayClass: "olControlSaveFeatures"
|
||||
});
|
||||
|
||||
panel.addControls([navigate, save, del, edit, draw]);
|
||||
panel.defaultControl = navigate;
|
||||
map.addControl(panel);
|
||||
map.zoomToMaxExtent();
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
var layer = new OpenLayers.Layer.Vector("WFS", {
|
||||
strategies: [new OpenLayers.Strategy.BBOX()],
|
||||
protocol: new OpenLayers.Protocol.WFS({
|
||||
url: "http://publicus.opengeo.org/geoserver/wfs",
|
||||
url: "http://demo.opengeo.org/geoserver/wfs",
|
||||
featureType: "tasmania_roads",
|
||||
featureNS: "http://www.openplans.org/topp"
|
||||
}),
|
||||
})
|
||||
});
|
||||
|
||||
map.addLayers([wms, layer]);
|
||||
|
||||
@@ -1,114 +1,37 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>WFS Reprojection + Canvas Renderer Example</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var map, layer, styleMap;
|
||||
OpenLayers.ProxyHost = "/proxy/?url=";
|
||||
function init(){
|
||||
|
||||
map = new OpenLayers.Map('map', {
|
||||
projection: new OpenLayers.Projection("EPSG:900913"),
|
||||
displayProjection: new OpenLayers.Projection("EPSG:4326"),
|
||||
units: "m",
|
||||
maxResolution: 156543.0339,
|
||||
maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
|
||||
20037508.34, 20037508.34)
|
||||
});
|
||||
|
||||
var g = new OpenLayers.Layer.Google("G", {sphericalMercator: true});
|
||||
map.addLayers([g]);
|
||||
|
||||
// prepare to style the data
|
||||
styleMap = new OpenLayers.StyleMap({
|
||||
strokeColor: "black",
|
||||
strokeWidth: 2,
|
||||
strokeOpacity: 0.5,
|
||||
fillOpacity: 0.2
|
||||
});
|
||||
// create a color table for state FIPS code
|
||||
var colors = ["red", "orange", "yellow", "green", "blue", "purple"];
|
||||
var code, fips = {};
|
||||
for(var i=1; i<=66; ++i) {
|
||||
code = "0" + i;
|
||||
code = code.substring(code.length - 2);
|
||||
fips[code] = {fillColor: colors[i % colors.length]};
|
||||
}
|
||||
// add unique value rules with your color lookup
|
||||
styleMap.addUniqueValueRules("default", "STATE_FIPS", fips);
|
||||
|
||||
// create a wfs layer with a projection different than the map
|
||||
// (only if your wfs doens't support your map projection)
|
||||
var wfs = layer = new OpenLayers.Layer.WFS(
|
||||
"States (SVG)",
|
||||
"http://sigma.openplans.org/geoserver/ows",
|
||||
{typename: 'topp:states'},
|
||||
{
|
||||
typename: 'states',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
projection: new OpenLayers.Projection("EPSG:4326"),
|
||||
extractAttributes: true,
|
||||
ratio: 1.2,
|
||||
styleMap: styleMap
|
||||
}
|
||||
);
|
||||
map.addLayer(wfs);
|
||||
|
||||
var wfs = layer = new OpenLayers.Layer.WFS(
|
||||
"States (Canvas)",
|
||||
"http://sigma.openplans.org/geoserver/ows",
|
||||
{typename: 'topp:states'},
|
||||
{
|
||||
typename: 'states',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
projection: new OpenLayers.Projection("EPSG:4326"),
|
||||
extractAttributes: true,
|
||||
ratio: 1.2,
|
||||
styleMap: styleMap,
|
||||
renderers: ['Canvas', 'SVG', 'VML']
|
||||
}
|
||||
);
|
||||
map.addLayer(wfs);
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
|
||||
// if you want to use Geographic coords, transform to ESPG:900913
|
||||
var ddBounds = new OpenLayers.Bounds(
|
||||
-73.839111,40.287907,-68.214111,44.441624
|
||||
);
|
||||
map.zoomToExtent(
|
||||
ddBounds.transform(map.displayProjection, map.getProjectionObject())
|
||||
);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
|
||||
<h1 id="title">WFS Reprojection + Canvas Renderer Example</h1>
|
||||
|
||||
<div id="tags">
|
||||
</div>
|
||||
<p id="shortdesc">
|
||||
Shows the use of the WFS layer reprojection support
|
||||
</p>
|
||||
|
||||
<head>
|
||||
<title>WFS Reprojection Example</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ"></script>
|
||||
<script src="wfs-reprojection.js"></script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">WFS Reprojection Example</h1>
|
||||
<div id="tags">
|
||||
</div>
|
||||
<p id="shortdesc">
|
||||
Shows the use of the client side reprojection support.
|
||||
</p>
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
<div id="docs">
|
||||
<p>This example shows automatic WFS reprojection, displaying an 'unprojected'
|
||||
WFS layer projected on the client side over Google Maps. The key configuration
|
||||
here is the 'projection' option on the WFS layer.</p>
|
||||
<p>Also shown is styleMap for the layer with unique value rules. Colors
|
||||
are assigned based on the STATE_FIPS attribute.</p>
|
||||
<p>Additionally, this map demonstrates the Canvas/SVG renderers in browsers
|
||||
which support both. See the two different layers in the
|
||||
LayerSwitcher.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
<div id="docs">
|
||||
<p>
|
||||
This example shows client side reprojection. In the case where
|
||||
the projection of a vector layer differs from the projection of
|
||||
the map, features are requested in the layer projection and
|
||||
transformed during parsing. It is assumed that the layer
|
||||
projection is "native" projection of the data (the coordinate
|
||||
reference system of the data on the server).
|
||||
</p>
|
||||
<p>
|
||||
Also shown is styleMap for the layer with unique value rules.
|
||||
Colors are assigned based on the STATE_FIPS attribute.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="wfs-reprojection.js" target="_blank">
|
||||
wfs-reprojection.js source</a> to see how this is done.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
65
examples/wfs-reprojection.js
Normal file
65
examples/wfs-reprojection.js
Normal file
@@ -0,0 +1,65 @@
|
||||
var map, layer, styleMap;
|
||||
OpenLayers.ProxyHost = "proxy.cgi?url=";
|
||||
|
||||
function init() {
|
||||
|
||||
var geographic = new OpenLayers.Projection("EPSG:4326");
|
||||
var mercator = new OpenLayers.Projection("EPSG:900913");
|
||||
|
||||
map = new OpenLayers.Map('map', {
|
||||
projection: mercator,
|
||||
units: "m",
|
||||
maxResolution: 156543.0339,
|
||||
maxExtent: new OpenLayers.Bounds(
|
||||
-20037508, -20037508, 20037508, 20037508
|
||||
)
|
||||
});
|
||||
|
||||
var g = new OpenLayers.Layer.Google("Google Layer", {
|
||||
sphericalMercator: true
|
||||
});
|
||||
map.addLayers([g]);
|
||||
|
||||
// prepare to style the data
|
||||
styleMap = new OpenLayers.StyleMap({
|
||||
strokeColor: "black",
|
||||
strokeWidth: 2,
|
||||
strokeOpacity: 0.5,
|
||||
fillOpacity: 0.2
|
||||
});
|
||||
// create a color table for state FIPS code
|
||||
var colors = ["red", "orange", "yellow", "green", "blue", "purple"];
|
||||
var code, fips = {};
|
||||
for(var i=1; i<=66; ++i) {
|
||||
code = "0" + i;
|
||||
code = code.substring(code.length - 2);
|
||||
fips[code] = {fillColor: colors[i % colors.length]};
|
||||
}
|
||||
// add unique value rules with your color lookup
|
||||
styleMap.addUniqueValueRules("default", "STATE_FIPS", fips);
|
||||
|
||||
// This server supports server-side reprojection, but we're using WFS 1.0
|
||||
// here (which doesn't support reprojection) to illustrate client-side
|
||||
// reprojection.
|
||||
var wfs = new OpenLayers.Layer.Vector("States", {
|
||||
strategies: [new OpenLayers.Strategy.BBOX()],
|
||||
protocol: new OpenLayers.Protocol.WFS({
|
||||
version: "1.0.0",
|
||||
srsName: "EPSG:4326", // this is the default
|
||||
url: "http://demo.opengeo.org/geoserver/wfs",
|
||||
featureType: "states",
|
||||
featureNS: "http://www.openplans.org/topp"
|
||||
}),
|
||||
projection: geographic, // specified because it is different than the map
|
||||
styleMap: styleMap
|
||||
});
|
||||
map.addLayer(wfs);
|
||||
|
||||
// if you want to use Geographic coords, transform to ESPG:900913
|
||||
var ddBounds = new OpenLayers.Bounds(
|
||||
-73.839111,40.287907,-68.214111,44.441624
|
||||
);
|
||||
map.zoomToExtent(
|
||||
ddBounds.transform(geographic, mercator)
|
||||
);
|
||||
}
|
||||
@@ -1,45 +1,27 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<title>WFS: United States (GeoServer)</title>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map, layer;
|
||||
|
||||
function init(){
|
||||
OpenLayers.ProxyHost="proxy.cgi?url=";
|
||||
map = new OpenLayers.Map('map', {controls: [ new OpenLayers.Control.PanZoom(), new OpenLayers.Control.Permalink(), new OpenLayers.Control.MouseDefaults() ]} );
|
||||
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms-c/Basic.py",
|
||||
{layers: 'basic'} );
|
||||
map.addLayer(layer);
|
||||
|
||||
layer = new OpenLayers.Layer.WFS( "States WFS",
|
||||
"http://sigma.openplans.org/geoserver/ows",
|
||||
{ typename: 'topp:states' } );
|
||||
map.addLayer(layer);
|
||||
|
||||
map.zoomToExtent(new OpenLayers.Bounds(-140.444336,25.115234,-44.438477,50.580078));
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">WFS United States (GeoServer) Example</h1>
|
||||
|
||||
<div id="tags">
|
||||
</div>
|
||||
|
||||
<p id="shortdesc">
|
||||
Shows the use of the WFS United States (GeoServer)
|
||||
</p>
|
||||
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
<div id="docs"></div>
|
||||
</body>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<title>WFS: United States (GeoServer)</title>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script src="wfs-states.js"></script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">WFS United States (GeoServer) Example</h1>
|
||||
<div id="tags"></div>
|
||||
<p id="shortdesc">
|
||||
Shows the use of the WFS United States (GeoServer).
|
||||
</p>
|
||||
<div id="map" class="smallmap"></div>
|
||||
<div id="docs">
|
||||
<p>
|
||||
This example shows the basic use of a vector layer with the
|
||||
WFS protocol.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="wfs-states.js" target="_blank">wfs-states.js
|
||||
source</a> to see how this is done.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
24
examples/wfs-states.js
Normal file
24
examples/wfs-states.js
Normal file
@@ -0,0 +1,24 @@
|
||||
var map;
|
||||
OpenLayers.ProxyHost = "proxy.cgi?url=";
|
||||
|
||||
function init() {
|
||||
map = new OpenLayers.Map("map");
|
||||
|
||||
var base = new OpenLayers.Layer.WMS("OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms-c/Basic.py",
|
||||
{layers: "basic"}
|
||||
);
|
||||
map.addLayer(base);
|
||||
|
||||
var wfs = new OpenLayers.Layer.Vector("States", {
|
||||
strategies: [new OpenLayers.Strategy.BBOX()],
|
||||
protocol: new OpenLayers.Protocol.WFS({
|
||||
url: "http://demo.opengeo.org/geoserver/wfs",
|
||||
featureType: "states",
|
||||
featureNS: "http://www.openplans.org/topp"
|
||||
})
|
||||
});
|
||||
map.addLayer(wfs);
|
||||
|
||||
map.zoomToExtent(new OpenLayers.Bounds(-140.4, 25.1, -44.4, 50.5));
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>OpenLayers: WFS-T</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/Firebug/firebug.js"></script>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map, wfs;
|
||||
OpenLayers.ProxyHost = "proxy.cgi?url=";
|
||||
|
||||
function init() {
|
||||
map = new OpenLayers.Map('map');
|
||||
var wms = new OpenLayers.Layer.WMS(
|
||||
"State",
|
||||
"http://sigma.openplans.org/geoserver/wms",
|
||||
{layers: 'topp:tasmania_state_boundaries'}
|
||||
);
|
||||
|
||||
//
|
||||
// Word to the Wise from an anonymous OpenLayers hacker:
|
||||
//
|
||||
// The typename in the options list when adding/loading a wfs
|
||||
// layer not should contain the namespace before, (as in the
|
||||
// first typename parameter to the wfs consctructor).
|
||||
//
|
||||
// Specifically, in the first parameter you write typename:
|
||||
// 'topp:myLayerName', and in the following option list
|
||||
// typeName: 'myLayerName'.
|
||||
//
|
||||
// If you have topp included in the second one you will get
|
||||
// namespace 14 errors when trying to insert features.
|
||||
//
|
||||
wfs = new OpenLayers.Layer.WFS(
|
||||
"Cities",
|
||||
"http://sigma.openplans.org/geoserver/wfs",
|
||||
{typename: 'topp:tasmania_cities'},
|
||||
{
|
||||
typename: "tasmania_cities",
|
||||
featureNS: "http://www.openplans.org/topp",
|
||||
extractAttributes: false,
|
||||
commitReport: function(str) {
|
||||
OpenLayers.Console.log(str);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
map.addLayers([wms, wfs]);
|
||||
|
||||
var panel = new OpenLayers.Control.Panel({
|
||||
displayClass: "olControlEditingToolbar"
|
||||
});
|
||||
|
||||
var draw = new OpenLayers.Control.DrawFeature(
|
||||
wfs, OpenLayers.Handler.Point,
|
||||
{
|
||||
handlerOptions: {freehand: false, multi: true},
|
||||
displayClass: "olControlDrawFeaturePoint"
|
||||
}
|
||||
);
|
||||
|
||||
var save = new OpenLayers.Control.Button({
|
||||
trigger: OpenLayers.Function.bind(wfs.commit, wfs),
|
||||
displayClass: "olControlSaveFeatures"
|
||||
});
|
||||
|
||||
panel.addControls([
|
||||
new OpenLayers.Control.Navigation(),
|
||||
save, draw
|
||||
]);
|
||||
|
||||
map.addControl(panel);
|
||||
|
||||
map.zoomToExtent(new OpenLayers.Bounds(140.64,-44.42,151.89,-38.80));
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
|
||||
<h1 id="title">WFS Transaction Example</h1>
|
||||
|
||||
<div id="tags">
|
||||
</div>
|
||||
<p id="shortdesc">
|
||||
Shows the use the WFS layer for transactions.
|
||||
</p>
|
||||
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
<p id="docs">
|
||||
This is an example of using a WFS layer type. Note that it requires a
|
||||
working GeoServer install, which the OpenLayers project does not maintain;
|
||||
however, if you're interested, you should be able to point this against
|
||||
a default GeoServer setup without too much trouble.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map, layer;
|
||||
|
||||
function init(){
|
||||
OpenLayers.ProxyHost="/proxy/?url=";
|
||||
map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
||||
map.addLayer(layer);
|
||||
|
||||
layer = new OpenLayers.Layer.WFS( "Owl Survey",
|
||||
"http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?",
|
||||
{typename: "OWLS", maxfeatures: 10},
|
||||
{ featureClass: OpenLayers.Feature.WFS});
|
||||
map.addLayer(layer);
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
map.setCenter(new OpenLayers.LonLat(-100, 60), 3);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">WFS Points</h1>
|
||||
<p id='shortdesc'>
|
||||
Using a Layer.WFS with a featureClass, one can take in XML data
|
||||
from a WFS class and display it any way you like.
|
||||
</p>
|
||||
<div id="map" class="smallmap"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -7,14 +7,18 @@
|
||||
width: 90%;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
/* avoid pink tiles */
|
||||
.olImageLoadError {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/Firebug/firebug.js"></script>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
// no pink please
|
||||
// increase reload attempts
|
||||
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 2;
|
||||
OpenLayers.Util.onImageLoadErrorColor = "transparent";
|
||||
|
||||
var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}});
|
||||
var doc, context, map;
|
||||
@@ -101,7 +105,9 @@
|
||||
} else {
|
||||
map.destroy();
|
||||
try {
|
||||
map = format.read(text, {map: "map"});
|
||||
var jsonFormat = new OpenLayers.Format.JSON();
|
||||
var mapOptions = jsonFormat.read(OpenLayers.Util.getElement('mapOptions').value);
|
||||
map = format.read(text, {map: mapOptions});
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
} catch(err) {
|
||||
document.getElementById("wmc").value = err;
|
||||
@@ -129,9 +135,10 @@
|
||||
Shows parsing of Web Map Context documents.
|
||||
</p>
|
||||
<div id="map" class="smallmap"></div>
|
||||
<button onclick="writeWMC();">write</button>
|
||||
<button onclick="readWMC();">read as new map</button>
|
||||
<button onclick="readWMC(true);">read and merge</button>
|
||||
<button onclick="writeWMC();">write</button><br />
|
||||
<button onclick="readWMC();">read as new map</button> with the following extra map options : <input type="text" id="mapOptions" value='{"div": "map", "allOverlays": true}'/><br />
|
||||
<button onclick="readWMC(true);">read and merge</button><br />
|
||||
<button onclick="pasteWMC();">try with another WMC document</button><br />
|
||||
<textarea id="wmc">paste WMC doc here</textarea>
|
||||
<div id="docs">
|
||||
This is an example of parsing WMC documents. <br />
|
||||
|
||||
52
examples/wms-v13.html
Normal file
52
examples/wms-v13.html
Normal file
@@ -0,0 +1,52 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map, map2;
|
||||
|
||||
function init(){
|
||||
// clear array to simulate a wrong axis order request
|
||||
map = new OpenLayers.Map( 'map' );
|
||||
var layer = new OpenLayers.Layer.WMS(
|
||||
"OpenLayers WMS",
|
||||
"http://demo.cubewerx.com/demo/cubeserv/cubeserv.cgi?",
|
||||
{layers: 'Foundation.GTOPO30', version: '1.3.0'},
|
||||
{singleTile: true, yx: []}
|
||||
);
|
||||
map.addLayer(layer);
|
||||
|
||||
map.zoomToMaxExtent();
|
||||
|
||||
map2 = new OpenLayers.Map( 'map2' );
|
||||
var layer2 = new OpenLayers.Layer.WMS(
|
||||
"OpenLayers WMS",
|
||||
"http://demo.cubewerx.com/demo/cubeserv/cubeserv.cgi?",
|
||||
{layers: 'Foundation.GTOPO30', version: '1.3.0'},
|
||||
{singleTile: true}
|
||||
);
|
||||
map2.addLayer(layer2);
|
||||
|
||||
map2.zoomToMaxExtent();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title"> WMS version 1.3 (axis order) Example</h1>
|
||||
|
||||
<div id="tags">
|
||||
</div>
|
||||
<p id="shortdesc">
|
||||
Shows an example of the influence of axis order on WMS 1.3 GetMap requests.
|
||||
</p>
|
||||
<div id="map" class="smallmap"></div>
|
||||
<div id="map2" class="smallmap"></div>
|
||||
<div id="docs">
|
||||
WMS version 1.3 introduced the axis order sequence, so that for e.g. EPSG:4326 the bbox coordinate
|
||||
values need to be flipped (LatLon instead of LonLat). The first map uses the incorrect (WMS 1.1) axis
|
||||
order against a WMS 1.3 service, resulting in corrupted maps. The second map shows how to correctly
|
||||
request a map in EPSG:4326 against a WMS 1.3 service.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -16,7 +16,7 @@
|
||||
"http://t1.hypercube.telascience.org/cgi-bin/landsat7",
|
||||
{layers: "landsat7"});
|
||||
|
||||
ia_wms = new OpenLayers.Layer.WMS("Nexrad","http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?",{layers:"nexrad-n0r-wmst",transparent:true,format:'image/png',time:"2005-08-29T13:00:00Z"});
|
||||
ia_wms = new OpenLayers.Layer.WMS("Nexrad","http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi?",{layers:"nexrad-n0r-wmst",transparent:true,format:'image/png',time:"2005-08-29T13:00:00Z"});
|
||||
|
||||
jpl_wms.setVisibility(false);
|
||||
|
||||
|
||||
70
examples/zoomify.html
Normal file
70
examples/zoomify.html
Normal file
@@ -0,0 +1,70 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>OpenLayers Zoomify Example</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var zoomify_width = 8001;
|
||||
var zoomify_height = 6943;
|
||||
var zoomify_url = "http://almor.mzk.cz/moll/AA22/0103/";
|
||||
|
||||
var map, zoomify;
|
||||
|
||||
function init(){
|
||||
/* First we initialize the zoomify pyramid (to get number of tiers) */
|
||||
var zoomify = new OpenLayers.Layer.Zoomify( "Zoomify", zoomify_url,
|
||||
new OpenLayers.Size( zoomify_width, zoomify_height ) );
|
||||
|
||||
/* Map with raster coordinates (pixels) from Zoomify image */
|
||||
var options = {
|
||||
controls: [],
|
||||
maxExtent: new OpenLayers.Bounds(0, 0, zoomify_width, zoomify_height),
|
||||
maxResolution: Math.pow(2, zoomify.numberOfTiers-1 ),
|
||||
numZoomLevels: zoomify.numberOfTiers,
|
||||
units: 'pixels'
|
||||
};
|
||||
|
||||
map = new OpenLayers.Map("map", options);
|
||||
map.addLayer(zoomify);
|
||||
|
||||
map.addControl(new OpenLayers.Control.MousePosition());
|
||||
map.addControl(new OpenLayers.Control.PanZoomBar());
|
||||
map.addControl(new OpenLayers.Control.MouseDefaults());
|
||||
map.addControl(new OpenLayers.Control.KeyboardDefaults());
|
||||
|
||||
map.setBaseLayer(zoomify);
|
||||
map.zoomToMaxExtent();
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">Zoomify Layer Example</h1>
|
||||
|
||||
<div id="tags"></div>
|
||||
|
||||
<p id="shortdesc">
|
||||
Demo of a layer with Zoomify tiles.
|
||||
</p>
|
||||
|
||||
<div id="map" class="smallmap"></div>
|
||||
|
||||
<div id="docs">
|
||||
<p>
|
||||
Demonstration of the Zoomify layer in OpenLayers.<br />
|
||||
You can have a look at <a href="http://almor.mzk.cz/moll/AA22/103.html">Zoomify viewer for this picture</a>, which is using the same <a href="http://almor.mzk.cz/moll/AA22/0103/">tiles</a>.
|
||||
</p>
|
||||
<p>
|
||||
For change to our own image you have to specify 'url' (zoomifyImagePath in Zoomify terminology) and 'size' ('width' and 'height' from ImageProperty.xml file).<br />
|
||||
Custom tiles can be easily generated with original <a href="http://www.zoomify.com/">Zoomify software</a> like with freely available <a href="http://www.zoomify.com/express.htm">ZoomifyerEZ</a> or with Adobe PhotoShop CS3 (it has built in support for export into Zoomify tiles).<br />
|
||||
There is also a <a href="http://sourceforge.net/projects/zoomifyimage/">ZoomifyImage SourceForge Project</a>, a tile cutter available under GPL license.<br />
|
||||
Zoomify tiles can be also served dynamically on the server side from JPEG2000 masters using <a href="http://dltj.org/article/introducing-j2ktilerenderer/">J2KTileRender</a> with available integration for DSpace and soon for Fedora Digital Repository.<br/>
|
||||
<a href="http://iipimage.sourceforge.net/">IIPImage server</a> can serve Zoomify tiles dynamically from TIFF files.
|
||||
</p>
|
||||
<p>
|
||||
Development of the Zoomify support for OpenLayers was supported from the grant <a href="http://www.oldmapsonline.org/">Old Maps Online</a>.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -17,6 +17,12 @@
|
||||
*/
|
||||
var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile);
|
||||
|
||||
/**
|
||||
* Cache for the script location returned from
|
||||
* OpenLayers._getScriptLocation
|
||||
*/
|
||||
var scriptLocation;
|
||||
|
||||
/**
|
||||
* Namespace: OpenLayers
|
||||
* The OpenLayers object provides a namespace for all things OpenLayers
|
||||
@@ -37,7 +43,10 @@
|
||||
* {String} Path to this script
|
||||
*/
|
||||
_getScriptLocation: function () {
|
||||
var scriptLocation = "";
|
||||
if (scriptLocation != undefined) {
|
||||
return scriptLocation;
|
||||
}
|
||||
scriptLocation = "";
|
||||
var isOL = new RegExp("(^|(.*?\\/))(" + OpenLayers._scriptName + ")(\\?|$)");
|
||||
|
||||
var scripts = document.getElementsByTagName('script');
|
||||
@@ -91,6 +100,7 @@
|
||||
"OpenLayers/Popup.js",
|
||||
"OpenLayers/Tile.js",
|
||||
"OpenLayers/Tile/Image.js",
|
||||
"OpenLayers/Tile/Image/IFrame.js",
|
||||
"OpenLayers/Tile/WFS.js",
|
||||
"OpenLayers/Layer/Image.js",
|
||||
"OpenLayers/Layer/SphericalMercator.js",
|
||||
@@ -113,12 +123,14 @@
|
||||
"OpenLayers/Layer/ArcGIS93Rest.js",
|
||||
"OpenLayers/Layer/WMS.js",
|
||||
"OpenLayers/Layer/WMS/Untiled.js",
|
||||
"OpenLayers/Layer/WMS/Post.js",
|
||||
"OpenLayers/Layer/ArcIMS.js",
|
||||
"OpenLayers/Layer/GeoRSS.js",
|
||||
"OpenLayers/Layer/Boxes.js",
|
||||
"OpenLayers/Layer/XYZ.js",
|
||||
"OpenLayers/Layer/TMS.js",
|
||||
"OpenLayers/Layer/TileCache.js",
|
||||
"OpenLayers/Layer/Zoomify.js",
|
||||
"OpenLayers/Popup/Anchored.js",
|
||||
"OpenLayers/Popup/AnchoredBubble.js",
|
||||
"OpenLayers/Popup/Framed.js",
|
||||
@@ -166,6 +178,8 @@
|
||||
"OpenLayers/Control/NavigationHistory.js",
|
||||
"OpenLayers/Control/Measure.js",
|
||||
"OpenLayers/Control/WMSGetFeatureInfo.js",
|
||||
"OpenLayers/Control/Graticule.js",
|
||||
"OpenLayers/Control/TransformFeature.js",
|
||||
"OpenLayers/Geometry.js",
|
||||
"OpenLayers/Geometry/Rectangle.js",
|
||||
"OpenLayers/Geometry/Collection.js",
|
||||
@@ -191,6 +205,12 @@
|
||||
"OpenLayers/Strategy/Paging.js",
|
||||
"OpenLayers/Strategy/BBOX.js",
|
||||
"OpenLayers/Strategy/Save.js",
|
||||
"OpenLayers/Strategy/Refresh.js",
|
||||
"OpenLayers/Filter.js",
|
||||
"OpenLayers/Filter/FeatureId.js",
|
||||
"OpenLayers/Filter/Logical.js",
|
||||
"OpenLayers/Filter/Comparison.js",
|
||||
"OpenLayers/Filter/Spatial.js",
|
||||
"OpenLayers/Protocol.js",
|
||||
"OpenLayers/Protocol/HTTP.js",
|
||||
"OpenLayers/Protocol/SQL.js",
|
||||
@@ -199,16 +219,13 @@
|
||||
"OpenLayers/Protocol/WFS/v1.js",
|
||||
"OpenLayers/Protocol/WFS/v1_0_0.js",
|
||||
"OpenLayers/Protocol/WFS/v1_1_0.js",
|
||||
"OpenLayers/Protocol/SOS.js",
|
||||
"OpenLayers/Protocol/SOS/v1_0_0.js",
|
||||
"OpenLayers/Layer/PointTrack.js",
|
||||
"OpenLayers/Layer/GML.js",
|
||||
"OpenLayers/Style.js",
|
||||
"OpenLayers/StyleMap.js",
|
||||
"OpenLayers/Rule.js",
|
||||
"OpenLayers/Filter.js",
|
||||
"OpenLayers/Filter/FeatureId.js",
|
||||
"OpenLayers/Filter/Logical.js",
|
||||
"OpenLayers/Filter/Comparison.js",
|
||||
"OpenLayers/Filter/Spatial.js",
|
||||
"OpenLayers/Format.js",
|
||||
"OpenLayers/Format/XML.js",
|
||||
"OpenLayers/Format/ArcXML.js",
|
||||
@@ -217,6 +234,7 @@
|
||||
"OpenLayers/Format/GML/Base.js",
|
||||
"OpenLayers/Format/GML/v2.js",
|
||||
"OpenLayers/Format/GML/v3.js",
|
||||
"OpenLayers/Format/Atom.js",
|
||||
"OpenLayers/Format/KML.js",
|
||||
"OpenLayers/Format/GeoRSS.js",
|
||||
"OpenLayers/Format/WFS.js",
|
||||
@@ -237,7 +255,10 @@
|
||||
"OpenLayers/Format/SLD.js",
|
||||
"OpenLayers/Format/SLD/v1.js",
|
||||
"OpenLayers/Format/SLD/v1_0_0.js",
|
||||
"OpenLayers/Format/SLD/v1.js",
|
||||
"OpenLayers/Format/CSWGetDomain.js",
|
||||
"OpenLayers/Format/CSWGetDomain/v2_0_2.js",
|
||||
"OpenLayers/Format/CSWGetRecords.js",
|
||||
"OpenLayers/Format/CSWGetRecords/v2_0_2.js",
|
||||
"OpenLayers/Format/WFST.js",
|
||||
"OpenLayers/Format/WFST/v1.js",
|
||||
"OpenLayers/Format/WFST/v1_0_0.js",
|
||||
@@ -250,10 +271,18 @@
|
||||
"OpenLayers/Format/WMC/v1_0_0.js",
|
||||
"OpenLayers/Format/WMC/v1_1_0.js",
|
||||
"OpenLayers/Format/WMSCapabilities.js",
|
||||
"OpenLayers/Format/WMSCapabilities/v1.js",
|
||||
"OpenLayers/Format/WMSCapabilities/v1_1.js",
|
||||
"OpenLayers/Format/WMSCapabilities/v1_1_0.js",
|
||||
"OpenLayers/Format/WMSCapabilities/v1_1_1.js",
|
||||
"OpenLayers/Format/WMSCapabilities/v1_3.js",
|
||||
"OpenLayers/Format/WMSCapabilities/v1_3_0.js",
|
||||
"OpenLayers/Format/WMSGetFeatureInfo.js",
|
||||
"OpenLayers/Format/OWSCommon/v1_1_0.js",
|
||||
"OpenLayers/Format/SOSCapabilities.js",
|
||||
"OpenLayers/Format/SOSCapabilities/v1_0_0.js",
|
||||
"OpenLayers/Format/SOSGetObservation.js",
|
||||
"OpenLayers/Format/SOSGetFeatureOfInterest.js",
|
||||
"OpenLayers/Layer/WFS.js",
|
||||
"OpenLayers/Control/GetFeature.js",
|
||||
"OpenLayers/Control/MouseToolbar.js",
|
||||
|
||||
@@ -43,7 +43,7 @@ OpenLayers.nullHandler = function(request) {
|
||||
};
|
||||
|
||||
/**
|
||||
* APIFunction: loadURL
|
||||
* APIFunction: OpenLayers.loadURL
|
||||
* Background load a document. For more flexibility in using XMLHttpRequest,
|
||||
* see the <OpenLayers.Request> methods.
|
||||
*
|
||||
@@ -84,7 +84,7 @@ OpenLayers.loadURL = function(uri, params, caller,
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: parseXMLString
|
||||
* Function: OpenLayers.parseXMLString
|
||||
* Parse XML into a doc structure
|
||||
*
|
||||
* Parameters:
|
||||
|
||||
@@ -162,7 +162,7 @@ OpenLayers.String = {
|
||||
* Used to find tokens in a string.
|
||||
* Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
|
||||
*/
|
||||
tokenRegEx: /\${([\w.]+?)}/g,
|
||||
tokenRegEx: /\$\{([\w.]+?)\}/g,
|
||||
|
||||
/**
|
||||
* Property: OpenLayers.String.numberRegEx
|
||||
@@ -431,6 +431,38 @@ OpenLayers.Function = {
|
||||
return function(event) {
|
||||
return func.call(object, event || window.event);
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* APIFunction: False
|
||||
* A simple function to that just does "return false". We use this to
|
||||
* avoid attaching anonymous functions to DOM event handlers, which
|
||||
* causes "issues" on IE<8.
|
||||
*
|
||||
* Usage:
|
||||
* document.onclick = OpenLayers.Function.False;
|
||||
*
|
||||
* Returns:
|
||||
* {Boolean}
|
||||
*/
|
||||
False : function() {
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* APIFunction: True
|
||||
* A simple function to that just does "return true". We use this to
|
||||
* avoid attaching anonymous functions to DOM event handlers, which
|
||||
* causes "issues" on IE<8.
|
||||
*
|
||||
* Usage:
|
||||
* document.onclick = OpenLayers.Function.True;
|
||||
*
|
||||
* Returns:
|
||||
* {Boolean}
|
||||
*/
|
||||
True : function() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -128,11 +128,18 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||
/**
|
||||
* APIMethod: toArray
|
||||
*
|
||||
* Parameters:
|
||||
* reverseAxisOrder - {Boolean} Should we reverse the axis order?
|
||||
*
|
||||
* Returns:
|
||||
* {Array} array of left, bottom, right, top
|
||||
*/
|
||||
toArray: function() {
|
||||
return [this.left, this.bottom, this.right, this.top];
|
||||
toArray: function(reverseAxisOrder) {
|
||||
if (reverseAxisOrder === true) {
|
||||
return [this.bottom, this.left, this.top, this.right];
|
||||
} else {
|
||||
return [this.left, this.bottom, this.right, this.top];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -141,22 +148,26 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||
* Parameters:
|
||||
* decimal - {Integer} How many significant digits in the bbox coords?
|
||||
* Default is 6
|
||||
* reverseAxisOrder - {Boolean} Should we reverse the axis order?
|
||||
*
|
||||
* Returns:
|
||||
* {String} Simple String representation of bounds object.
|
||||
* (ex. <i>"5,42,10,45"</i>)
|
||||
*/
|
||||
toBBOX:function(decimal) {
|
||||
toBBOX:function(decimal, reverseAxisOrder) {
|
||||
if (decimal== null) {
|
||||
decimal = 6;
|
||||
}
|
||||
var mult = Math.pow(10, decimal);
|
||||
var bbox = Math.round(this.left * mult) / mult + "," +
|
||||
Math.round(this.bottom * mult) / mult + "," +
|
||||
Math.round(this.right * mult) / mult + "," +
|
||||
Math.round(this.top * mult) / mult;
|
||||
|
||||
return bbox;
|
||||
var xmin = Math.round(this.left * mult) / mult;
|
||||
var ymin = Math.round(this.bottom * mult) / mult;
|
||||
var xmax = Math.round(this.right * mult) / mult;
|
||||
var ymax = Math.round(this.top * mult) / mult;
|
||||
if (reverseAxisOrder === true) {
|
||||
return ymin + "," + xmin + "," + ymax + "," + xmax;
|
||||
} else {
|
||||
return xmin + "," + ymin + "," + xmax + "," + ymax;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -254,8 +265,6 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||
if(origin == null){
|
||||
origin = this.getCenterLonLat();
|
||||
}
|
||||
|
||||
var bounds = [];
|
||||
|
||||
var origx,origy;
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ OpenLayers.Element = {
|
||||
|
||||
/**
|
||||
* APIFunction: getDimensions
|
||||
* *Deprecated*. Returns dimensions of the element passed in.
|
||||
*
|
||||
* Parameters:
|
||||
* element - {DOMElement}
|
||||
@@ -112,12 +113,13 @@ OpenLayers.Element = {
|
||||
var els = element.style;
|
||||
var originalVisibility = els.visibility;
|
||||
var originalPosition = els.position;
|
||||
var originalDisplay = els.display;
|
||||
els.visibility = 'hidden';
|
||||
els.position = 'absolute';
|
||||
els.display = '';
|
||||
var originalWidth = element.clientWidth;
|
||||
var originalHeight = element.clientHeight;
|
||||
els.display = 'none';
|
||||
els.display = originalDisplay;
|
||||
els.position = originalPosition;
|
||||
els.visibility = originalVisibility;
|
||||
return {width: originalWidth, height: originalHeight};
|
||||
|
||||
@@ -105,6 +105,13 @@ OpenLayers.Control = OpenLayers.Class({
|
||||
*/
|
||||
title: "",
|
||||
|
||||
/**
|
||||
* APIProperty: autoActivate
|
||||
* {Boolean} Activate the control when it is added to a map. Default is
|
||||
* false.
|
||||
*/
|
||||
autoActivate: false,
|
||||
|
||||
/**
|
||||
* Property: active
|
||||
* {Boolean} The control is active.
|
||||
@@ -258,7 +265,7 @@ OpenLayers.Control = OpenLayers.Class({
|
||||
if (!this.allowSelection) {
|
||||
this.div.className += " olControlNoSelect";
|
||||
this.div.setAttribute("unselectable", "on", 0);
|
||||
this.div.onselectstart = function() { return(false); };
|
||||
this.div.onselectstart = OpenLayers.Function.False;
|
||||
}
|
||||
if (this.title != "") {
|
||||
this.div.title = this.title;
|
||||
|
||||
@@ -22,7 +22,7 @@ OpenLayers.Control.Attribution =
|
||||
* {String} String used to seperate layers.
|
||||
*/
|
||||
separator: ", ",
|
||||
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Control.Attribution
|
||||
*
|
||||
@@ -81,9 +81,13 @@ OpenLayers.Control.Attribution =
|
||||
for(var i=0, len=this.map.layers.length; i<len; i++) {
|
||||
var layer = this.map.layers[i];
|
||||
if (layer.attribution && layer.getVisibility()) {
|
||||
attributions.push( layer.attribution );
|
||||
// add attribution only if attribution text is unique
|
||||
if (OpenLayers.Util.indexOf(
|
||||
attributions, layer.attribution) === -1) {
|
||||
attributions.push( layer.attribution );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.div.innerHTML = attributions.join(this.separator);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -64,6 +64,13 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
onComplete: function(feature, pixel) {},
|
||||
|
||||
/**
|
||||
* APIProperty: documentDrag
|
||||
* {Boolean} If set to true, mouse dragging will continue even if the
|
||||
* mouse cursor leaves the map viewport. Default is false.
|
||||
*/
|
||||
documentDrag: false,
|
||||
|
||||
/**
|
||||
* Property: layer
|
||||
* {<OpenLayers.Layer.Vector>}
|
||||
@@ -115,7 +122,9 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
up: this.upFeature,
|
||||
out: this.cancel,
|
||||
done: this.doneDragging
|
||||
}, this.dragCallbacks)
|
||||
}, this.dragCallbacks), {
|
||||
documentDrag: this.documentDrag
|
||||
}
|
||||
),
|
||||
feature: new OpenLayers.Handler.Feature(
|
||||
this, this.layer, OpenLayers.Util.extend({
|
||||
|
||||
@@ -34,7 +34,14 @@ OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
|
||||
* panning the map again. Set this to increase dragging performance.
|
||||
* Defaults to 25 milliseconds.
|
||||
*/
|
||||
interval: 25,
|
||||
interval: 25,
|
||||
|
||||
/**
|
||||
* APIProperty: documentDrag
|
||||
* {Boolean} If set to true, mouse dragging will continue even if the
|
||||
* mouse cursor leaves the map viewport. Default is false.
|
||||
*/
|
||||
documentDrag: false,
|
||||
|
||||
/**
|
||||
* Method: draw
|
||||
@@ -46,7 +53,8 @@ OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
|
||||
"move": this.panMap,
|
||||
"done": this.panMapDone
|
||||
}, {
|
||||
interval: this.interval
|
||||
interval: this.interval,
|
||||
documentDrag: this.documentDrag
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
@@ -38,6 +38,13 @@ OpenLayers.Control.DrawFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
EVENT_TYPES: ["featureadded"],
|
||||
|
||||
/**
|
||||
* APIProperty: multi
|
||||
* {Boolean} Cast features to multi-part geometries before passing to the
|
||||
* layer. Default is false.
|
||||
*/
|
||||
multi: false,
|
||||
|
||||
/**
|
||||
* APIProperty: featureAdded
|
||||
* {Function} Called after each feature is added
|
||||
@@ -84,9 +91,12 @@ OpenLayers.Control.DrawFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.callbacks
|
||||
);
|
||||
this.layer = layer;
|
||||
this.handlerOptions = this.handlerOptions || {};
|
||||
if (!("multi" in this.handlerOptions)) {
|
||||
this.handlerOptions.multi = this.multi;
|
||||
}
|
||||
var sketchStyle = this.layer.styleMap && this.layer.styleMap.styles.temporary;
|
||||
if(sketchStyle) {
|
||||
this.handlerOptions = this.handlerOptions || {};
|
||||
this.handlerOptions.layerOptions = OpenLayers.Util.applyDefaults(
|
||||
this.handlerOptions.layerOptions,
|
||||
{styleMap: new OpenLayers.StyleMap({"default": sketchStyle})}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* Class: OpenLayers.Control.GetFeature
|
||||
* Gets vector features for locations underneath the mouse cursor. Can be
|
||||
* configured to act on click, hover or dragged boxes. Uses an
|
||||
* <OpenLayers.Protocol> that supports spatial filters (BBOX) to retrieve
|
||||
* <OpenLayers.Protocol> that supports spatial filters to retrieve
|
||||
* features from a server and fires events that notify applications of the
|
||||
* selected features.
|
||||
*
|
||||
@@ -59,8 +59,10 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
/**
|
||||
* APIProperty: click
|
||||
* {Boolean} Use a click handler for selecting/unselecting features.
|
||||
* Default is true.
|
||||
* {Boolean} Use a click handler for selecting/unselecting features. If
|
||||
* both <click> and <box> are set to true, the click handler takes
|
||||
* precedence over the box handler if a box with zero extent was
|
||||
* selected. Default is true.
|
||||
*/
|
||||
click: true,
|
||||
|
||||
@@ -80,10 +82,11 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
/**
|
||||
* APIProperty: clickTolerance
|
||||
* {Integer} Tolerance for the BBOX query in pixels. This has the
|
||||
* {Integer} Tolerance for the filter query in pixels. This has the
|
||||
* same effect as the tolerance parameter on WMS GetFeatureInfo
|
||||
* requests. Will be ignored for box selections. Applies only if
|
||||
* <click> is true. Default is 5.
|
||||
* <click> or <hover> is true. Default is 5. Note that this not
|
||||
* only affects requests on click, but also on hover.
|
||||
*/
|
||||
clickTolerance: 5,
|
||||
|
||||
@@ -101,8 +104,9 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
/**
|
||||
* APIProperty: maxFeatures
|
||||
* {Integer} Maximum number of features to return from a query, if
|
||||
* supported by the <protocol>. Default is 10.
|
||||
* {Integer} Maximum number of features to return from a query in single mode
|
||||
* if supported by the <protocol>. This set of features is then used to
|
||||
* determine the best match client-side. Default is 10.
|
||||
*/
|
||||
maxFeatures: 10,
|
||||
|
||||
@@ -141,6 +145,15 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
hoverResponse: null,
|
||||
|
||||
/**
|
||||
* Property: filterType
|
||||
* {<String>} The type of filter to use when sending off a request.
|
||||
* Possible values:
|
||||
* OpenLayers.Filter.Spatial.<BBOX|INTERSECTS|WITHIN|CONTAINS>
|
||||
* Defaults to: OpenLayers.Filter.Spatial.BBOX
|
||||
*/
|
||||
filterType: OpenLayers.Filter.Spatial.BBOX,
|
||||
|
||||
/**
|
||||
* Constant: EVENT_TYPES
|
||||
*
|
||||
@@ -151,6 +164,14 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* featureselected - Triggered when <click> is true and a feature is
|
||||
* selected. The event object has a feature property with the
|
||||
* selected feature
|
||||
* beforefeaturesselected - Triggered when <click> is true before a
|
||||
* set of features is selected. The event object is an array of
|
||||
* feature properties with the features about to be selected.
|
||||
* Return false after receiving this event to discontinue processing
|
||||
* of all featureselected events and the featuresselected event.
|
||||
* featuresselected - Triggered when <click> is true and a set of
|
||||
* features is selected. The event object is an array of feature
|
||||
* properties of the selected features
|
||||
* featureunselected - Triggered when <click> is true and a feature is
|
||||
* unselected. The event object has a feature property with the
|
||||
* unselected feature
|
||||
@@ -161,8 +182,9 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* outfeature - Triggered when <hover> is true and the mouse moves
|
||||
* moved away from a hover-selected feature
|
||||
*/
|
||||
EVENT_TYPES: ["featureselected", "featureunselected", "clickout",
|
||||
"beforefeatureselected", "hoverfeature", "outfeature"],
|
||||
EVENT_TYPES: ["featureselected", "featuresselected", "featureunselected",
|
||||
"clickout", "beforefeatureselected", "beforefeaturesselected",
|
||||
"hoverfeature", "outfeature"],
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Control.GetFeature
|
||||
@@ -189,8 +211,8 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
if(this.click) {
|
||||
this.handlers.click = new OpenLayers.Handler.Click(this,
|
||||
{click: this.selectSingle}, this.handlerOptions.click || {})
|
||||
};
|
||||
{click: this.selectSingle}, this.handlerOptions.click || {});
|
||||
}
|
||||
|
||||
if(this.box) {
|
||||
this.handlers.box = new OpenLayers.Handler.Box(
|
||||
@@ -247,25 +269,6 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: unselectAll
|
||||
* Unselect all selected features. To unselect all except for a single
|
||||
* feature, set the options.except property to the feature.
|
||||
*
|
||||
* Parameters:
|
||||
* options - {Object} Optional configuration object.
|
||||
*/
|
||||
unselectAll: function(options) {
|
||||
// we'll want an option to supress notification here
|
||||
var feature;
|
||||
for(var i=this.features.length-1; i>=0; --i) {
|
||||
feature = this.features[i];
|
||||
if(!options || options.except != feature) {
|
||||
this.unselect(feature);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: selectSingle
|
||||
* Called on click
|
||||
@@ -291,6 +294,7 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* position - {<OpenLayers.Bounds>}
|
||||
*/
|
||||
selectBox: function(position) {
|
||||
var bounds;
|
||||
if (position instanceof OpenLayers.Bounds) {
|
||||
var minXY = this.map.getLonLatFromPixel(
|
||||
new OpenLayers.Pixel(position.left, position.bottom)
|
||||
@@ -298,13 +302,19 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
var maxXY = this.map.getLonLatFromPixel(
|
||||
new OpenLayers.Pixel(position.right, position.top)
|
||||
);
|
||||
var bounds = new OpenLayers.Bounds(
|
||||
bounds = new OpenLayers.Bounds(
|
||||
minXY.lon, minXY.lat, maxXY.lon, maxXY.lat
|
||||
);
|
||||
|
||||
this.setModifiers(this.handlers.box.dragHandler.evt);
|
||||
this.request(bounds);
|
||||
} else {
|
||||
if(this.click) {
|
||||
// box without extent - let the click handler take care of it
|
||||
return;
|
||||
}
|
||||
bounds = this.pixelToBounds(position);
|
||||
}
|
||||
this.setModifiers(this.handlers.box.dragHandler.evt);
|
||||
this.request(bounds);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -347,7 +357,7 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
request: function(bounds, options) {
|
||||
options = options || {};
|
||||
var filter = new OpenLayers.Filter.Spatial({
|
||||
type: OpenLayers.Filter.Spatial.BBOX,
|
||||
type: this.filterType,
|
||||
value: bounds
|
||||
});
|
||||
|
||||
@@ -355,7 +365,7 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
maxFeatures: options.single == true ? this.maxFeatures : undefined,
|
||||
filter: filter,
|
||||
callback: function(result) {
|
||||
if(result.code == 1) {
|
||||
if(result.success()) {
|
||||
if(result.features.length) {
|
||||
if(options.single == true) {
|
||||
this.selectBestFeature(result.features,
|
||||
@@ -421,7 +431,7 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
} else {
|
||||
this.select(resultFeature || features);
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -435,13 +445,13 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.modifiers = {
|
||||
multiple: this.multiple || (this.multipleKey && evt[this.multipleKey]),
|
||||
toggle: this.toggle || (this.toggleKey && evt[this.toggleKey])
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: select
|
||||
* Add feature to the hash of selected features and trigger the
|
||||
* featureselected event.
|
||||
* featureselected and featuresselected events.
|
||||
*
|
||||
* Parameters:
|
||||
* features - {<OpenLayers.Feature.Vector>} or an array of features
|
||||
@@ -454,24 +464,34 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
features = [features];
|
||||
}
|
||||
|
||||
var feature;
|
||||
for(var i=0, len=features.length; i<len; ++i) {
|
||||
feature = features[i];
|
||||
if(this.features[feature.fid || feature.id]) {
|
||||
if(this.modifiers.toggle) {
|
||||
this.unselect(this.features[feature.fid || feature.id]);
|
||||
}
|
||||
} else {
|
||||
cont = this.events.triggerEvent("beforefeatureselected", {
|
||||
feature: feature
|
||||
});
|
||||
if(cont !== false) {
|
||||
this.features[feature.fid || feature.id] = feature;
|
||||
|
||||
this.events.triggerEvent("featureselected",
|
||||
{feature: feature});
|
||||
var cont = this.events.triggerEvent("beforefeaturesselected", {
|
||||
features: features
|
||||
});
|
||||
if(cont !== false) {
|
||||
var selectedFeatures = [];
|
||||
var feature;
|
||||
for(var i=0, len=features.length; i<len; ++i) {
|
||||
feature = features[i];
|
||||
if(this.features[feature.fid || feature.id]) {
|
||||
if(this.modifiers.toggle) {
|
||||
this.unselect(this.features[feature.fid || feature.id]);
|
||||
}
|
||||
} else {
|
||||
cont = this.events.triggerEvent("beforefeatureselected", {
|
||||
feature: feature
|
||||
});
|
||||
if(cont !== false) {
|
||||
this.features[feature.fid || feature.id] = feature;
|
||||
selectedFeatures.push(feature);
|
||||
|
||||
this.events.triggerEvent("featureselected",
|
||||
{feature: feature});
|
||||
}
|
||||
}
|
||||
}
|
||||
this.events.triggerEvent("featuresselected", {
|
||||
features: selectedFeatures
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
327
lib/OpenLayers/Control/Graticule.js
Normal file
327
lib/OpenLayers/Control/Graticule.js
Normal file
@@ -0,0 +1,327 @@
|
||||
/* Copyright (c) 2006-2009 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @requires OpenLayers/Control.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Control.Graticule
|
||||
* The Graticule displays a grid of latitude/longitude lines reprojected on
|
||||
* the map.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Control>
|
||||
*
|
||||
*/
|
||||
OpenLayers.Control.Graticule = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
/**
|
||||
* APIProperty: intervals
|
||||
* {Array(Float)} A list of possible graticule widths in degrees.
|
||||
*/
|
||||
intervals: [ 45, 30, 20, 10, 5, 2, 1,
|
||||
0.5, 0.2, 0.1, 0.05, 0.01,
|
||||
0.005, 0.002, 0.001 ],
|
||||
|
||||
/**
|
||||
* APIProperty: displayInLayerSwitcher
|
||||
* {Boolean} Allows the Graticule control to be switched on and off.
|
||||
* defaults to true.
|
||||
*/
|
||||
displayInLayerSwitcher: true,
|
||||
|
||||
/**
|
||||
* APIProperty: visible
|
||||
* {Boolean} should the graticule be initially visible (default=true)
|
||||
*/
|
||||
visible: true,
|
||||
|
||||
/**
|
||||
* APIProperty: numPoints
|
||||
* {Integer} The number of points to use in each graticule line. Higher
|
||||
* numbers result in a smoother curve for projected maps
|
||||
*/
|
||||
numPoints: 50,
|
||||
|
||||
/**
|
||||
* APIProperty: targetSize
|
||||
* {Integer} The maximum size of the grid in pixels on the map
|
||||
*/
|
||||
targetSize: 200,
|
||||
|
||||
/**
|
||||
* APIProperty: layerName
|
||||
* {String} the name to be displayed in the layer switcher
|
||||
*/
|
||||
layerName: "Graticule",
|
||||
|
||||
/**
|
||||
* APIProperty: labelled
|
||||
* {Boolean} Should the graticule lines be labelled?. default=true
|
||||
*/
|
||||
labelled: true,
|
||||
|
||||
/**
|
||||
* APIProperty: labelFormat
|
||||
* {String} the format of the labels, default = 'dm'. See
|
||||
* <OpenLayers.Util.getFormattedLonLat> for other options.
|
||||
*/
|
||||
labelFormat: 'dm',
|
||||
|
||||
/**
|
||||
* APIProperty: lineSymbolizer
|
||||
* {symbolizer} the symbolizer used to render lines
|
||||
*/
|
||||
lineSymbolizer: {
|
||||
strokeColor: "#333",
|
||||
strokeWidth: 1,
|
||||
strokeOpacity: 0.5
|
||||
},
|
||||
|
||||
/**
|
||||
* APIProperty: labelSymbolizer
|
||||
* {symbolizer} the symbolizer used to render labels
|
||||
*/
|
||||
labelSymbolizer: {},
|
||||
|
||||
/**
|
||||
* Property: gratLayer
|
||||
* {OpenLayers.Layer.Vector} vector layer used to draw the graticule on
|
||||
*/
|
||||
gratLayer: null,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Control.Graticule
|
||||
* Create a new graticule control to display a grid of latitude longitude
|
||||
* lines.
|
||||
*
|
||||
* Parameters:
|
||||
* options - {Object} An optional object whose properties will be used
|
||||
* to extend the control.
|
||||
*/
|
||||
initialize: function(options) {
|
||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||
|
||||
this.labelSymbolizer.stroke = false;
|
||||
this.labelSymbolizer.fill = false;
|
||||
this.labelSymbolizer.label = "${label}";
|
||||
this.labelSymbolizer.labelAlign = "${labelAlign}";
|
||||
this.labelSymbolizer.labelXOffset = "${xOffset}";
|
||||
this.labelSymbolizer.labelYOffset = "${yOffset}";
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: draw
|
||||
*
|
||||
* initializes the graticule layer and does the initial update
|
||||
*
|
||||
* Returns:
|
||||
* {DOMElement}
|
||||
*/
|
||||
draw: function() {
|
||||
OpenLayers.Control.prototype.draw.apply(this, arguments);
|
||||
if (!this.gratLayer) {
|
||||
var gratStyle = new OpenLayers.Style({},{
|
||||
rules: [new OpenLayers.Rule({'symbolizer':
|
||||
{"Point":this.labelSymbolizer,
|
||||
"Line":this.lineSymbolizer}
|
||||
})]
|
||||
});
|
||||
this.gratLayer = new OpenLayers.Layer.Vector(this.layerName, {
|
||||
styleMap: new OpenLayers.StyleMap({'default':gratStyle}),
|
||||
visibility: this.visible,
|
||||
displayInLayerSwitcher: this.displayInLayerSwitcher
|
||||
});
|
||||
this.map.addLayer(this.gratLayer);
|
||||
}
|
||||
this.map.events.register('moveend', this, this.update);
|
||||
this.update();
|
||||
return this.div;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: update
|
||||
*
|
||||
* calculates the grid to be displayed and actually draws it
|
||||
*
|
||||
* Returns:
|
||||
* {DOMElement}
|
||||
*/
|
||||
update: function() {
|
||||
//wait for the map to be initialized before proceeding
|
||||
var mapBounds = this.map.getExtent();
|
||||
if (!mapBounds) {
|
||||
return;
|
||||
}
|
||||
|
||||
//clear out the old grid
|
||||
this.gratLayer.destroyFeatures();
|
||||
|
||||
//get the projection objects required
|
||||
var llProj = new OpenLayers.Projection("EPSG:4326");
|
||||
var mapProj = this.map.getProjectionObject();
|
||||
var mapRes = this.map.getResolution();
|
||||
|
||||
//if the map is in lon/lat, then the lines are straight and only one
|
||||
//point is required
|
||||
if (mapProj.proj && mapProj.proj.projName == "longlat") {
|
||||
this.numPoints = 1;
|
||||
}
|
||||
|
||||
//get the map center in EPSG:4326
|
||||
var mapCenter = this.map.getCenter(); //lon and lat here are really map x and y
|
||||
var mapCenterLL = new OpenLayers.Pixel(mapCenter.lon, mapCenter.lat);
|
||||
OpenLayers.Projection.transform(mapCenterLL, mapProj, llProj);
|
||||
|
||||
/* This block of code determines the lon/lat interval to use for the
|
||||
* grid by calculating the diagonal size of one grid cell at the map
|
||||
* center. Iterates through the intervals array until the diagonal
|
||||
* length is less than the targetSize option.
|
||||
*/
|
||||
//find lat/lon interval that results in a grid of less than the target size
|
||||
var testSq = this.targetSize*mapRes;
|
||||
testSq *= testSq; //compare squares rather than doing a square root to save time
|
||||
var llInterval;
|
||||
for (var i=0; i<this.intervals.length; ++i) {
|
||||
llInterval = this.intervals[i]; //could do this for both x and y??
|
||||
var delta = llInterval/2;
|
||||
var p1 = mapCenterLL.offset(new OpenLayers.Pixel(-delta, -delta)); //test coords in EPSG:4326 space
|
||||
var p2 = mapCenterLL.offset(new OpenLayers.Pixel( delta, delta));
|
||||
OpenLayers.Projection.transform(p1, llProj, mapProj); // convert them back to map projection
|
||||
OpenLayers.Projection.transform(p2, llProj, mapProj);
|
||||
var distSq = (p1.x-p2.x)*(p1.x-p2.x) + (p1.y-p2.y)*(p1.y-p2.y);
|
||||
if (distSq <= testSq) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//alert(llInterval);
|
||||
|
||||
//round the LL center to an even number based on the interval
|
||||
mapCenterLL.x = Math.floor(mapCenterLL.x/llInterval)*llInterval;
|
||||
mapCenterLL.y = Math.floor(mapCenterLL.y/llInterval)*llInterval;
|
||||
//TODO adjust for minutses/seconds?
|
||||
|
||||
/* The following 2 blocks calculate the nodes of the grid along a
|
||||
* line of constant longitude (then latitiude) running through the
|
||||
* center of the map until it reaches the map edge. The calculation
|
||||
* goes from the center in both directions to the edge.
|
||||
*/
|
||||
//get the central longitude line, increment the latitude
|
||||
var iter = 0;
|
||||
var centerLonPoints = [mapCenterLL.clone()];
|
||||
var newPoint = mapCenterLL.clone();
|
||||
var mapXY;
|
||||
do {
|
||||
newPoint = newPoint.offset(new OpenLayers.Pixel(0,llInterval));
|
||||
mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj);
|
||||
centerLonPoints.unshift(newPoint);
|
||||
} while (mapBounds.containsPixel(mapXY) && ++iter<1000);
|
||||
newPoint = mapCenterLL.clone();
|
||||
do {
|
||||
newPoint = newPoint.offset(new OpenLayers.Pixel(0,-llInterval));
|
||||
mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj);
|
||||
centerLonPoints.push(newPoint);
|
||||
} while (mapBounds.containsPixel(mapXY) && ++iter<1000);
|
||||
|
||||
//get the central latitude line, increment the longitude
|
||||
iter = 0;
|
||||
var centerLatPoints = [mapCenterLL.clone()];
|
||||
newPoint = mapCenterLL.clone();
|
||||
do {
|
||||
newPoint = newPoint.offset(new OpenLayers.Pixel(-llInterval, 0));
|
||||
mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj);
|
||||
centerLatPoints.unshift(newPoint);
|
||||
} while (mapBounds.containsPixel(mapXY) && ++iter<1000);
|
||||
newPoint = mapCenterLL.clone();
|
||||
do {
|
||||
newPoint = newPoint.offset(new OpenLayers.Pixel(llInterval, 0));
|
||||
mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj);
|
||||
centerLatPoints.push(newPoint);
|
||||
} while (mapBounds.containsPixel(mapXY) && ++iter<1000);
|
||||
|
||||
//now generate a line for each node in the central lat and lon lines
|
||||
//first loop over constant longitude
|
||||
var lines = [];
|
||||
for(var i=0; i < centerLatPoints.length; ++i) {
|
||||
var lon = centerLatPoints[i].x;
|
||||
var pointList = [];
|
||||
var labelPoint = null;
|
||||
var latEnd = Math.min(centerLonPoints[0].y, 90);
|
||||
var latStart = Math.max(centerLonPoints[centerLonPoints.length - 1].y, -90);
|
||||
var latDelta = (latEnd - latStart)/this.numPoints;
|
||||
var lat = latStart;
|
||||
for(var j=0; j<= this.numPoints; ++j) {
|
||||
var gridPoint = new OpenLayers.Geometry.Point(lon,lat);
|
||||
gridPoint.transform(llProj, mapProj);
|
||||
pointList.push(gridPoint);
|
||||
lat += latDelta;
|
||||
if (gridPoint.y >= mapBounds.bottom && !labelPoint) {
|
||||
labelPoint = gridPoint;
|
||||
}
|
||||
}
|
||||
if (this.labelled) {
|
||||
//keep track of when this grid line crosses the map bounds to set
|
||||
//the label position
|
||||
//labels along the bottom, add 10 pixel offset up into the map
|
||||
//TODO add option for labels on top
|
||||
var labelPos = new OpenLayers.Geometry.Point(labelPoint.x,mapBounds.bottom);
|
||||
var labelAttrs = {
|
||||
value: lon,
|
||||
label: this.labelled?OpenLayers.Util.getFormattedLonLat(lon, "lon", this.labelFormat):"",
|
||||
labelAlign: "cb",
|
||||
xOffset: 0,
|
||||
yOffset: 2
|
||||
};
|
||||
this.gratLayer.addFeatures(new OpenLayers.Feature.Vector(labelPos,labelAttrs));
|
||||
}
|
||||
var geom = new OpenLayers.Geometry.LineString(pointList);
|
||||
lines.push(new OpenLayers.Feature.Vector(geom));
|
||||
}
|
||||
|
||||
//now draw the lines of constant latitude
|
||||
for (var j=0; j < centerLonPoints.length; ++j) {
|
||||
lat = centerLonPoints[j].y;
|
||||
if (lat<-90 || lat>90) { //latitudes only valid between -90 and 90
|
||||
continue;
|
||||
}
|
||||
var pointList = [];
|
||||
var lonStart = centerLatPoints[0].x;
|
||||
var lonEnd = centerLatPoints[centerLatPoints.length - 1].x;
|
||||
var lonDelta = (lonEnd - lonStart)/this.numPoints;
|
||||
var lon = lonStart;
|
||||
var labelPoint = null;
|
||||
for(var i=0; i <= this.numPoints ; ++i) {
|
||||
var gridPoint = new OpenLayers.Geometry.Point(lon,lat);
|
||||
gridPoint.transform(llProj, mapProj);
|
||||
pointList.push(gridPoint);
|
||||
lon += lonDelta;
|
||||
if (gridPoint.x < mapBounds.right) {
|
||||
labelPoint = gridPoint;
|
||||
}
|
||||
}
|
||||
if (this.labelled) {
|
||||
//keep track of when this grid line crosses the map bounds to set
|
||||
//the label position
|
||||
//labels along the right, 30 pixel offset left into the map
|
||||
//TODO add option for labels on left
|
||||
var labelPos = new OpenLayers.Geometry.Point(mapBounds.right, labelPoint.y);
|
||||
var labelAttrs = {
|
||||
value: lat,
|
||||
label: this.labelled?OpenLayers.Util.getFormattedLonLat(lat, "lat", this.labelFormat):"",
|
||||
labelAlign: "rb",
|
||||
xOffset: -2,
|
||||
yOffset: 2
|
||||
};
|
||||
this.gratLayer.addFeatures(new OpenLayers.Feature.Vector(labelPos,labelAttrs));
|
||||
}
|
||||
var geom = new OpenLayers.Geometry.LineString(pointList);
|
||||
lines.push(new OpenLayers.Feature.Vector(geom));
|
||||
}
|
||||
this.gratLayer.addFeatures(lines);
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Control.Graticule"
|
||||
});
|
||||
|
||||
@@ -21,6 +21,13 @@
|
||||
*/
|
||||
OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
/**
|
||||
* APIProperty: autoActivate
|
||||
* {Boolean} Activate the control when it is added to a map. Default is
|
||||
* true.
|
||||
*/
|
||||
autoActivate: true,
|
||||
|
||||
/**
|
||||
* APIProperty: slideFactor
|
||||
* Pixels to slide by.
|
||||
@@ -53,7 +60,6 @@ OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
|
||||
draw: function() {
|
||||
this.handler = new OpenLayers.Handler.Keyboard( this, {
|
||||
"keydown": this.defaultKeyPress });
|
||||
this.activate();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,11 +22,19 @@
|
||||
OpenLayers.Control.LayerSwitcher =
|
||||
OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
/**
|
||||
* Property: activeColor
|
||||
* {String}
|
||||
/**
|
||||
* APIProperty: roundedCorner
|
||||
* {Boolean} If true the Rico library is used for rounding the corners
|
||||
* of the layer switcher div, defaults to true.
|
||||
*/
|
||||
activeColor: "darkblue",
|
||||
roundedCorner: true,
|
||||
|
||||
/**
|
||||
* APIProperty: roundedCornerColor
|
||||
* {String} The color of the rounded corners, only applies if roundedCorner
|
||||
* is true, defaults to "darkblue".
|
||||
*/
|
||||
roundedCornerColor: "darkblue",
|
||||
|
||||
/**
|
||||
* Property: layerStates
|
||||
@@ -284,7 +292,7 @@ OpenLayers.Control.LayerSwitcher =
|
||||
// create input element
|
||||
var inputElem = document.createElement("input");
|
||||
inputElem.id = this.id + "_input_" + layer.name;
|
||||
inputElem.name = (baseLayer) ? "baseLayers" : layer.name;
|
||||
inputElem.name = (baseLayer) ? this.id + "_baseLayers" : layer.name;
|
||||
inputElem.type = (baseLayer) ? "radio" : "checkbox";
|
||||
inputElem.value = layer.name;
|
||||
inputElem.checked = checked;
|
||||
@@ -305,6 +313,7 @@ OpenLayers.Control.LayerSwitcher =
|
||||
|
||||
// create span
|
||||
var labelSpan = document.createElement("span");
|
||||
OpenLayers.Element.addClass(labelSpan, "labelSpan")
|
||||
if (!baseLayer && !layer.inRange) {
|
||||
labelSpan.style.color = "gray";
|
||||
}
|
||||
@@ -419,8 +428,9 @@ OpenLayers.Control.LayerSwitcher =
|
||||
*/
|
||||
maximizeControl: function(e) {
|
||||
|
||||
//HACK HACK HACK - find a way to auto-size this layerswitcher
|
||||
this.div.style.width = "20em";
|
||||
// set the div's width and height to empty values, so
|
||||
// the div dimensions can be controlled by CSS
|
||||
this.div.style.width = "";
|
||||
this.div.style.height = "";
|
||||
|
||||
this.showControls(false);
|
||||
@@ -440,6 +450,10 @@ OpenLayers.Control.LayerSwitcher =
|
||||
*/
|
||||
minimizeControl: function(e) {
|
||||
|
||||
// to minimize the control we set its div's width
|
||||
// and height to 0px, we cannot just set "display"
|
||||
// to "none" because it would hide the maximize
|
||||
// div
|
||||
this.div.style.width = "0px";
|
||||
this.div.style.height = "0px";
|
||||
|
||||
@@ -473,19 +487,7 @@ OpenLayers.Control.LayerSwitcher =
|
||||
loadContents: function() {
|
||||
|
||||
//configure main div
|
||||
this.div.style.position = "absolute";
|
||||
this.div.style.top = "25px";
|
||||
this.div.style.right = "0px";
|
||||
this.div.style.left = "";
|
||||
this.div.style.fontFamily = "sans-serif";
|
||||
this.div.style.fontWeight = "bold";
|
||||
this.div.style.marginTop = "3px";
|
||||
this.div.style.marginLeft = "3px";
|
||||
this.div.style.marginBottom = "3px";
|
||||
this.div.style.fontSize = "smaller";
|
||||
this.div.style.color = "white";
|
||||
this.div.style.backgroundColor = "transparent";
|
||||
|
||||
|
||||
OpenLayers.Event.observe(this.div, "mouseup",
|
||||
OpenLayers.Function.bindAsEventListener(this.mouseUp, this));
|
||||
OpenLayers.Event.observe(this.div, "click",
|
||||
@@ -494,44 +496,24 @@ OpenLayers.Control.LayerSwitcher =
|
||||
OpenLayers.Function.bindAsEventListener(this.mouseDown, this));
|
||||
OpenLayers.Event.observe(this.div, "dblclick", this.ignoreEvent);
|
||||
|
||||
|
||||
// layers list div
|
||||
this.layersDiv = document.createElement("div");
|
||||
this.layersDiv.id = this.id + "_layersDiv";
|
||||
this.layersDiv.style.paddingTop = "5px";
|
||||
this.layersDiv.style.paddingLeft = "10px";
|
||||
this.layersDiv.style.paddingBottom = "5px";
|
||||
this.layersDiv.style.paddingRight = "75px";
|
||||
this.layersDiv.style.backgroundColor = this.activeColor;
|
||||
|
||||
// had to set width/height to get transparency in IE to work.
|
||||
// thanks -- http://jszen.blogspot.com/2005/04/ie6-opacity-filter-caveat.html
|
||||
//
|
||||
this.layersDiv.style.width = "100%";
|
||||
this.layersDiv.style.height = "100%";
|
||||
|
||||
OpenLayers.Element.addClass(this.layersDiv, "layersDiv");
|
||||
|
||||
this.baseLbl = document.createElement("div");
|
||||
this.baseLbl.innerHTML = OpenLayers.i18n("baseLayer");
|
||||
this.baseLbl.style.marginTop = "3px";
|
||||
this.baseLbl.style.marginLeft = "3px";
|
||||
this.baseLbl.style.marginBottom = "3px";
|
||||
OpenLayers.Element.addClass(this.baseLbl, "baseLbl");
|
||||
|
||||
this.baseLayersDiv = document.createElement("div");
|
||||
this.baseLayersDiv.style.paddingLeft = "10px";
|
||||
/*OpenLayers.Event.observe(this.baseLayersDiv, "click",
|
||||
OpenLayers.Function.bindAsEventListener(this.onLayerClick, this));
|
||||
*/
|
||||
|
||||
OpenLayers.Element.addClass(this.baseLayersDiv, "baseLayersDiv");
|
||||
|
||||
this.dataLbl = document.createElement("div");
|
||||
this.dataLbl.innerHTML = OpenLayers.i18n("overlays");
|
||||
this.dataLbl.style.marginTop = "3px";
|
||||
this.dataLbl.style.marginLeft = "3px";
|
||||
this.dataLbl.style.marginBottom = "3px";
|
||||
OpenLayers.Element.addClass(this.dataLbl, "dataLbl");
|
||||
|
||||
this.dataLayersDiv = document.createElement("div");
|
||||
this.dataLayersDiv.style.paddingLeft = "10px";
|
||||
OpenLayers.Element.addClass(this.dataLayersDiv, "dataLayersDiv");
|
||||
|
||||
if (this.ascending) {
|
||||
this.layersDiv.appendChild(this.baseLbl);
|
||||
@@ -547,12 +529,15 @@ OpenLayers.Control.LayerSwitcher =
|
||||
|
||||
this.div.appendChild(this.layersDiv);
|
||||
|
||||
OpenLayers.Rico.Corner.round(this.div, {corners: "tl bl",
|
||||
bgColor: "transparent",
|
||||
color: this.activeColor,
|
||||
blend: false});
|
||||
|
||||
OpenLayers.Rico.Corner.changeOpacity(this.layersDiv, 0.75);
|
||||
if(this.roundedCorner) {
|
||||
OpenLayers.Rico.Corner.round(this.div, {
|
||||
corners: "tl bl",
|
||||
bgColor: "transparent",
|
||||
color: this.roundedCornerColor,
|
||||
blend: false
|
||||
});
|
||||
OpenLayers.Rico.Corner.changeOpacity(this.layersDiv, 0.75);
|
||||
}
|
||||
|
||||
var imgLocation = OpenLayers.Util.getImagesLocation();
|
||||
var sz = new OpenLayers.Size(18,18);
|
||||
@@ -565,9 +550,7 @@ OpenLayers.Control.LayerSwitcher =
|
||||
sz,
|
||||
img,
|
||||
"absolute");
|
||||
this.maximizeDiv.style.top = "5px";
|
||||
this.maximizeDiv.style.right = "0px";
|
||||
this.maximizeDiv.style.left = "";
|
||||
OpenLayers.Element.addClass(this.maximizeDiv, "maximizeDiv");
|
||||
this.maximizeDiv.style.display = "none";
|
||||
OpenLayers.Event.observe(this.maximizeDiv, "click",
|
||||
OpenLayers.Function.bindAsEventListener(this.maximizeControl, this)
|
||||
@@ -584,9 +567,7 @@ OpenLayers.Control.LayerSwitcher =
|
||||
sz,
|
||||
img,
|
||||
"absolute");
|
||||
this.minimizeDiv.style.top = "5px";
|
||||
this.minimizeDiv.style.right = "0px";
|
||||
this.minimizeDiv.style.left = "";
|
||||
OpenLayers.Element.addClass(this.minimizeDiv, "minimizeDiv");
|
||||
this.minimizeDiv.style.display = "none";
|
||||
OpenLayers.Event.observe(this.minimizeDiv, "click",
|
||||
OpenLayers.Function.bindAsEventListener(this.minimizeControl, this)
|
||||
|
||||
@@ -43,6 +43,17 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* Default is true.
|
||||
*/
|
||||
toggle: true,
|
||||
|
||||
/**
|
||||
* APIProperty: standalone
|
||||
* {Boolean} Set to true to create a control without SelectFeature
|
||||
* capabilities. Default is false. If standalone is true, to modify
|
||||
* a feature, call the <selectFeature> method with the target feature.
|
||||
* Note that you must call the <unselectFeature> method to finish
|
||||
* feature modification in standalone mode (before starting to modify
|
||||
* another feature).
|
||||
*/
|
||||
standalone: false,
|
||||
|
||||
/**
|
||||
* Property: layer
|
||||
@@ -207,9 +218,11 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
onUnselect: this.unselectFeature,
|
||||
scope: this
|
||||
};
|
||||
this.selectControl = new OpenLayers.Control.SelectFeature(
|
||||
layer, selectOptions
|
||||
);
|
||||
if(this.standalone === false) {
|
||||
this.selectControl = new OpenLayers.Control.SelectFeature(
|
||||
layer, selectOptions
|
||||
);
|
||||
}
|
||||
|
||||
// configure the drag control
|
||||
var dragOptions = {
|
||||
@@ -223,6 +236,22 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
},
|
||||
onComplete: function(feature) {
|
||||
control.dragComplete.apply(control, [feature]);
|
||||
},
|
||||
featureCallbacks: {
|
||||
over: function(feature) {
|
||||
/**
|
||||
* In normal mode, the feature handler is set up to allow
|
||||
* dragging of all points. In standalone mode, we only
|
||||
* want to allow dragging of sketch vertices and virtual
|
||||
* vertices - or, in the case of a modifiable point, the
|
||||
* point itself.
|
||||
*/
|
||||
if(control.standalone !== true || feature._sketch ||
|
||||
control.feature === feature) {
|
||||
control.dragControl.overFeature.apply(
|
||||
control.dragControl, [feature]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
this.dragControl = new OpenLayers.Control.DragFeature(
|
||||
@@ -244,7 +273,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
destroy: function() {
|
||||
this.layer = null;
|
||||
this.selectControl.destroy();
|
||||
this.standalone || this.selectControl.destroy();
|
||||
this.dragControl.destroy();
|
||||
OpenLayers.Control.prototype.destroy.apply(this, []);
|
||||
},
|
||||
@@ -257,7 +286,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* {Boolean} Successfully activated the control.
|
||||
*/
|
||||
activate: function() {
|
||||
return (this.selectControl.activate() &&
|
||||
return ((this.standalone || this.selectControl.activate()) &&
|
||||
this.handlers.keyboard.activate() &&
|
||||
OpenLayers.Control.prototype.activate.apply(this, arguments));
|
||||
},
|
||||
@@ -277,11 +306,19 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.layer.removeFeatures(this.virtualVertices, {silent: true});
|
||||
this.vertices = [];
|
||||
this.dragControl.deactivate();
|
||||
if(this.feature && this.feature.geometry && this.feature.layer) {
|
||||
this.selectControl.unselect.apply(this.selectControl,
|
||||
[this.feature]);
|
||||
var feature = this.feature;
|
||||
var valid = feature && feature.geometry && feature.layer;
|
||||
if(this.standalone === false) {
|
||||
if(valid) {
|
||||
this.selectControl.unselect.apply(this.selectControl,
|
||||
[feature]);
|
||||
}
|
||||
this.selectControl.deactivate();
|
||||
} else {
|
||||
if(valid) {
|
||||
this.unselectFeature(feature);
|
||||
}
|
||||
}
|
||||
this.selectControl.deactivate();
|
||||
this.handlers.keyboard.deactivate();
|
||||
deactivated = true;
|
||||
}
|
||||
@@ -364,7 +401,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
// only change behavior if the feature is not in the vertices array
|
||||
if(feature != this.feature && !feature.geometry.parent &&
|
||||
feature != this.dragHandle && feature != this.radiusHandle) {
|
||||
if(this.feature) {
|
||||
if(this.standalone === false && this.feature) {
|
||||
// unselect the currently selected feature
|
||||
this.selectControl.clickFeature.apply(this.selectControl,
|
||||
[this.feature]);
|
||||
@@ -374,8 +411,8 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
OpenLayers.Util.indexOf(this.geometryTypes,
|
||||
feature.geometry.CLASS_NAME) != -1) {
|
||||
// select the point
|
||||
this.selectControl.clickFeature.apply(this.selectControl,
|
||||
[feature]);
|
||||
this.standalone || this.selectControl.clickFeature.apply(
|
||||
this.selectControl, [feature]);
|
||||
/**
|
||||
* TBD: These lines improve workflow by letting the user
|
||||
* immediately start dragging after the mouse down.
|
||||
@@ -452,7 +489,8 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.layer.destroyFeatures(this.virtualVertices, {silent: true});
|
||||
this.virtualVertices = [];
|
||||
}
|
||||
this.layer.drawFeature(this.feature, this.selectControl.renderIntent);
|
||||
this.layer.drawFeature(this.feature, this.standalone ? undefined :
|
||||
this.selectControl.renderIntent);
|
||||
}
|
||||
// keep the vertex on top so it gets the mouseout after dragging
|
||||
// this should be removed in favor of an option to draw under or
|
||||
@@ -558,7 +596,8 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
vertex.geometry.parent) {
|
||||
// remove the vertex
|
||||
vertex.geometry.parent.removeComponent(vertex.geometry);
|
||||
this.layer.drawFeature(this.feature,
|
||||
this.layer.drawFeature(this.feature, this.standalone ?
|
||||
undefined :
|
||||
this.selectControl.renderIntent);
|
||||
this.resetVertices();
|
||||
this.setFeatureState();
|
||||
@@ -708,7 +747,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* map - {<OpenLayers.Map>} The control's map.
|
||||
*/
|
||||
setMap: function(map) {
|
||||
this.selectControl.setMap(map);
|
||||
this.standalone || this.selectControl.setMap(map);
|
||||
this.dragControl.setMap(map);
|
||||
OpenLayers.Control.prototype.setMap.apply(this, arguments);
|
||||
},
|
||||
|
||||
@@ -166,7 +166,7 @@ OpenLayers.Control.MouseDefaults = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;
|
||||
this.map.viewPortDiv.appendChild(this.zoomBox);
|
||||
}
|
||||
document.onselectstart=function() { return false; };
|
||||
document.onselectstart = OpenLayers.Function.False;
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
|
||||
@@ -52,6 +52,13 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
|
||||
* {Integer}
|
||||
*/
|
||||
granularity: 10,
|
||||
|
||||
/**
|
||||
* APIProperty: emptyString
|
||||
* {String} Set this to some value to set when the mouse is outside the
|
||||
* map.
|
||||
*/
|
||||
emptyString: null,
|
||||
|
||||
/**
|
||||
* Property: lastXy
|
||||
@@ -111,7 +118,8 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
|
||||
var lonLat;
|
||||
|
||||
if (evt == null) {
|
||||
lonLat = new OpenLayers.LonLat(0, 0);
|
||||
this.reset();
|
||||
return;
|
||||
} else {
|
||||
if (this.lastXy == null ||
|
||||
Math.abs(evt.xy.x - this.lastXy.x) > this.granularity ||
|
||||
@@ -141,6 +149,15 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: reset
|
||||
*/
|
||||
reset: function(evt) {
|
||||
if (this.emptyString != null) {
|
||||
this.element.innerHTML = this.emptyString;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: formatOutput
|
||||
* Override to provide custom display output
|
||||
@@ -165,6 +182,7 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
|
||||
setMap: function() {
|
||||
OpenLayers.Control.prototype.setMap.apply(this, arguments);
|
||||
this.map.events.register( 'mousemove', this, this.redraw);
|
||||
this.map.events.register( 'mouseout', this, this.reset);
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Control.MousePosition"
|
||||
|
||||
@@ -254,7 +254,7 @@ OpenLayers.Control.MouseToolbar = OpenLayers.Class(
|
||||
this.map.div.style.cursor = "move";
|
||||
break;
|
||||
}
|
||||
document.onselectstart = function() { return false; };
|
||||
document.onselectstart = OpenLayers.Function.False;
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
|
||||
@@ -36,17 +36,37 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
dragPanOptions: null,
|
||||
|
||||
/**
|
||||
* APIProperty: documentDrag
|
||||
* {Boolean} Allow panning of the map by dragging outside map viewport.
|
||||
* Default is false.
|
||||
*/
|
||||
documentDrag: false,
|
||||
|
||||
/**
|
||||
* Property: zoomBox
|
||||
* {<OpenLayers.Control.ZoomBox>}
|
||||
*/
|
||||
zoomBox: null,
|
||||
|
||||
/**
|
||||
* APIProperty: zoomBoxEnabled
|
||||
* {Boolean} Whether the user can draw a box to zoom
|
||||
*/
|
||||
zoomBoxEnabled: true,
|
||||
|
||||
/**
|
||||
* APIProperty: zoomWheelEnabled
|
||||
* {Boolean} Whether the mousewheel should zoom the map
|
||||
*/
|
||||
zoomWheelEnabled: true,
|
||||
zoomWheelEnabled: true,
|
||||
|
||||
/**
|
||||
* Property: mouseWheelOptions
|
||||
* {Object} Options passed to the MouseWheel control (only useful if
|
||||
* <zoomWheelEnabled> is set to true)
|
||||
*/
|
||||
mouseWheelOptions: null,
|
||||
|
||||
/**
|
||||
* APIProperty: handleRightClicks
|
||||
@@ -65,6 +85,13 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
zoomBoxKeyMask: OpenLayers.Handler.MOD_SHIFT,
|
||||
|
||||
/**
|
||||
* APIProperty: autoActivate
|
||||
* {Boolean} Activate the control when it is added to a map. Default is
|
||||
* true.
|
||||
*/
|
||||
autoActivate: true,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Control.Navigation
|
||||
* Create a new navigation control
|
||||
@@ -108,7 +135,9 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.handlers.wheel.activate();
|
||||
}
|
||||
this.handlers.click.activate();
|
||||
this.zoomBox.activate();
|
||||
if (this.zoomBoxEnabled) {
|
||||
this.zoomBox.activate();
|
||||
}
|
||||
return OpenLayers.Control.prototype.activate.apply(this,arguments);
|
||||
},
|
||||
|
||||
@@ -129,7 +158,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
draw: function() {
|
||||
// disable right mouse context menu for support of right click events
|
||||
if (this.handleRightClicks) {
|
||||
this.map.viewPortDiv.oncontextmenu = function () { return false;};
|
||||
this.map.viewPortDiv.oncontextmenu = OpenLayers.Function.False;
|
||||
}
|
||||
|
||||
var clickCallbacks = {
|
||||
@@ -144,7 +173,10 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
this, clickCallbacks, clickOptions
|
||||
);
|
||||
this.dragPan = new OpenLayers.Control.DragPan(
|
||||
OpenLayers.Util.extend({map: this.map}, this.dragPanOptions)
|
||||
OpenLayers.Util.extend({
|
||||
map: this.map,
|
||||
documentDrag: this.documentDrag
|
||||
}, this.dragPanOptions)
|
||||
);
|
||||
this.zoomBox = new OpenLayers.Control.ZoomBox(
|
||||
{map: this.map, keyMask: this.zoomBoxKeyMask});
|
||||
@@ -152,8 +184,8 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.zoomBox.draw();
|
||||
this.handlers.wheel = new OpenLayers.Handler.MouseWheel(
|
||||
this, {"up" : this.wheelUp,
|
||||
"down": this.wheelDown} );
|
||||
this.activate();
|
||||
"down": this.wheelDown},
|
||||
this.mouseWheelOptions );
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -186,8 +218,11 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
* deltaZ - {Integer}
|
||||
*/
|
||||
wheelChange: function(evt, deltaZ) {
|
||||
var newZoom = this.map.getZoom() + deltaZ;
|
||||
if (!this.map.isValidZoomLevel(newZoom)) {
|
||||
var currentZoom = this.map.getZoom();
|
||||
var newZoom = this.map.getZoom() + Math.round(deltaZ);
|
||||
newZoom = Math.max(newZoom, 0);
|
||||
newZoom = Math.min(newZoom, this.map.getNumZoomLevels());
|
||||
if (newZoom === currentZoom) {
|
||||
return;
|
||||
}
|
||||
var size = this.map.getSize();
|
||||
@@ -207,9 +242,10 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
* delta - {Integer}
|
||||
*/
|
||||
wheelUp: function(evt) {
|
||||
this.wheelChange(evt, 1);
|
||||
wheelUp: function(evt, delta) {
|
||||
this.wheelChange(evt, delta || 1);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -218,9 +254,28 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
* delta - {Integer}
|
||||
*/
|
||||
wheelDown: function(evt) {
|
||||
this.wheelChange(evt, -1);
|
||||
wheelDown: function(evt, delta) {
|
||||
this.wheelChange(evt, delta || -1);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: disableZoomBox
|
||||
*/
|
||||
disableZoomBox : function() {
|
||||
this.zoomBoxEnabled = false;
|
||||
this.zoomBox.deactivate();
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: enableZoomBox
|
||||
*/
|
||||
enableZoomBox : function() {
|
||||
this.zoomBoxEnabled = true;
|
||||
if (this.active) {
|
||||
this.zoomBox.activate();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -67,11 +67,11 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, {
|
||||
limit: 50,
|
||||
|
||||
/**
|
||||
* Property: activateOnDraw
|
||||
* {Boolean} Activate the control when it is first added to the map.
|
||||
* Default is true.
|
||||
* APIProperty: autoActivate
|
||||
* {Boolean} Activate the control when it is added to a map. Default is
|
||||
* true.
|
||||
*/
|
||||
activateOnDraw: true,
|
||||
autoActivate: true,
|
||||
|
||||
/**
|
||||
* Property: clearOnDeactivate
|
||||
@@ -126,16 +126,9 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, {
|
||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||
|
||||
this.registry = OpenLayers.Util.extend({
|
||||
"moveend": function() {
|
||||
return {
|
||||
center: this.map.getCenter(),
|
||||
resolution: this.map.getResolution()
|
||||
};
|
||||
}
|
||||
"moveend": this.getState
|
||||
}, this.registry);
|
||||
|
||||
this.clear();
|
||||
|
||||
var previousOptions = {
|
||||
trigger: OpenLayers.Function.bind(this.previousTrigger, this),
|
||||
displayClass: this.displayClass + " " + this.displayClass + "Previous"
|
||||
@@ -150,6 +143,7 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, {
|
||||
OpenLayers.Util.extend(nextOptions, this.nextOptions);
|
||||
this.next = new OpenLayers.Control.Button(nextOptions);
|
||||
|
||||
this.clear();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -224,9 +218,6 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, {
|
||||
OpenLayers.Control.prototype.draw.apply(this, arguments);
|
||||
this.next.draw();
|
||||
this.previous.draw();
|
||||
if(this.activateOnDraw) {
|
||||
this.activate();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -288,7 +279,23 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
clear: function() {
|
||||
this.previousStack = [];
|
||||
this.previous.deactivate();
|
||||
this.nextStack = [];
|
||||
this.next.deactivate();
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: getState
|
||||
* Get the current state and return it.
|
||||
*
|
||||
* Returns:
|
||||
* {Object} An object representing the current state.
|
||||
*/
|
||||
getState: function() {
|
||||
return {
|
||||
center: this.map.getCenter(),
|
||||
resolution: this.map.getResolution()
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -143,15 +143,25 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||
if (!this.mapDiv) { // we've already been destroyed
|
||||
return;
|
||||
}
|
||||
this.handlers.click.destroy();
|
||||
if (this.handlers.click) {
|
||||
this.handlers.click.destroy();
|
||||
}
|
||||
if (this.handlers.drag) {
|
||||
this.handlers.drag.destroy();
|
||||
}
|
||||
|
||||
this.mapDiv.removeChild(this.extentRectangle);
|
||||
this.extentRectangle = null;
|
||||
this.rectEvents.destroy();
|
||||
this.rectEvents = null;
|
||||
|
||||
this.ovmap.destroy();
|
||||
this.ovmap = null;
|
||||
if (this.rectEvents) {
|
||||
this.rectEvents.destroy();
|
||||
this.rectEvents = null;
|
||||
}
|
||||
|
||||
if (this.ovmap) {
|
||||
this.ovmap.destroy();
|
||||
this.ovmap = null;
|
||||
}
|
||||
|
||||
this.element.removeChild(this.mapDiv);
|
||||
this.mapDiv = null;
|
||||
@@ -170,7 +180,7 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.div.removeChild(this.minimizeDiv);
|
||||
this.minimizeDiv = null;
|
||||
}
|
||||
|
||||
|
||||
this.map.events.un({
|
||||
"moveend": this.update,
|
||||
"changebaselayer": this.baseLayerDraw,
|
||||
|
||||
@@ -19,7 +19,7 @@ OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {
|
||||
/**
|
||||
* APIProperty: slideFactor
|
||||
* {Integer} Number of pixels by which we'll pan the map in any direction
|
||||
* on clicking the arrow buttons.
|
||||
* on clicking the arrow buttons, defaults to 50.
|
||||
*/
|
||||
slideFactor: 50,
|
||||
|
||||
|
||||
@@ -25,6 +25,13 @@
|
||||
*/
|
||||
OpenLayers.Control.PanPanel = OpenLayers.Class(OpenLayers.Control.Panel, {
|
||||
|
||||
/**
|
||||
* APIProperty: slideFactor
|
||||
* {Integer} Number of pixels by which we'll pan the map in any direction
|
||||
* on clicking the arrow buttons, defaults to 50.
|
||||
*/
|
||||
slideFactor: 50,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Control.PanPanel
|
||||
* Add the four directional pan buttons.
|
||||
@@ -36,10 +43,14 @@ OpenLayers.Control.PanPanel = OpenLayers.Class(OpenLayers.Control.Panel, {
|
||||
initialize: function(options) {
|
||||
OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);
|
||||
this.addControls([
|
||||
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.NORTH),
|
||||
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.SOUTH),
|
||||
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.EAST),
|
||||
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.WEST)
|
||||
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.NORTH,
|
||||
{slideFactor: this.slideFactor}),
|
||||
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.SOUTH,
|
||||
{slideFactor: this.slideFactor}),
|
||||
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.EAST,
|
||||
{slideFactor: this.slideFactor}),
|
||||
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.WEST,
|
||||
{slideFactor: this.slideFactor})
|
||||
]);
|
||||
},
|
||||
|
||||
|
||||
@@ -163,6 +163,7 @@ OpenLayers.Control.PanZoom = OpenLayers.Class(OpenLayers.Control, {
|
||||
_removeButton: function(btn) {
|
||||
OpenLayers.Event.stopObservingElement(btn);
|
||||
btn.map = null;
|
||||
btn.getSlideFactor = null;
|
||||
this.div.removeChild(btn);
|
||||
OpenLayers.Util.removeItem(this.buttons, btn);
|
||||
},
|
||||
|
||||
@@ -41,10 +41,10 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
sliderEvents: null,
|
||||
|
||||
/**
|
||||
* Property: zoomBarDiv
|
||||
* Property: zoombarDiv
|
||||
* {DOMElement}
|
||||
*/
|
||||
zoomBarDiv: null,
|
||||
zoombarDiv: null,
|
||||
|
||||
/**
|
||||
* Property: divEvents
|
||||
@@ -58,6 +58,25 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
*/
|
||||
zoomWorldIcon: false,
|
||||
|
||||
/**
|
||||
* APIProperty: forceFixedZoomLevel
|
||||
* {Boolean} Force a fixed zoom level even though the map has
|
||||
* fractionalZoom
|
||||
*/
|
||||
forceFixedZoomLevel: false,
|
||||
|
||||
/**
|
||||
* Property: mouseDragStart
|
||||
* {<OpenLayers.Pixel>}
|
||||
*/
|
||||
mouseDragStart: null,
|
||||
|
||||
/**
|
||||
* Property: zoomStart
|
||||
* {<OpenLayers.Pixel>}
|
||||
*/
|
||||
zoomStart: null,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Control.PanZoomBar
|
||||
*/
|
||||
@@ -78,6 +97,9 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
});
|
||||
|
||||
OpenLayers.Control.PanZoom.prototype.destroy.apply(this, arguments);
|
||||
|
||||
delete this.mouseDragStart;
|
||||
delete this.zoomStart;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -266,7 +288,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
var y = evt.xy.y;
|
||||
var top = OpenLayers.Util.pagePosition(evt.object)[1];
|
||||
var levels = (y - top)/this.zoomStopHeight;
|
||||
if(!this.map.fractionalZoom) {
|
||||
if(this.forceFixedZoomLevel || !this.map.fractionalZoom) {
|
||||
levels = Math.floor(levels);
|
||||
}
|
||||
var zoom = (this.map.getNumZoomLevels() - 1) - levels;
|
||||
@@ -335,7 +357,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) {
|
||||
return;
|
||||
}
|
||||
if (this.zoomStart) {
|
||||
if (this.mouseDragStart) {
|
||||
this.div.style.cursor="";
|
||||
this.map.events.un({
|
||||
"mouseup": this.passEventToSlider,
|
||||
@@ -344,7 +366,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
});
|
||||
var deltaY = this.zoomStart.y - evt.xy.y;
|
||||
var zoomLevel = this.map.zoom;
|
||||
if (this.map.fractionalZoom) {
|
||||
if (!this.forceFixedZoomLevel && this.map.fractionalZoom) {
|
||||
zoomLevel += deltaY/this.zoomStopHeight;
|
||||
zoomLevel = Math.min(Math.max(zoomLevel, 0),
|
||||
this.map.getNumZoomLevels() - 1);
|
||||
@@ -352,8 +374,8 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
zoomLevel += Math.round(deltaY/this.zoomStopHeight);
|
||||
}
|
||||
this.map.zoomTo(zoomLevel);
|
||||
this.moveZoomBar();
|
||||
this.mouseDragStart = null;
|
||||
this.zoomStart = null;
|
||||
OpenLayers.Event.stop(evt);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -21,6 +21,13 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
controls: null,
|
||||
|
||||
/**
|
||||
* APIProperty: autoActivate
|
||||
* {Boolean} Activate the control when it is added to a map. Default is
|
||||
* true.
|
||||
*/
|
||||
autoActivate: true,
|
||||
|
||||
/**
|
||||
* APIProperty: defaultControl
|
||||
* {<OpenLayers.Control>} The control which is activated when the control is
|
||||
@@ -107,7 +114,6 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, {
|
||||
scope: this
|
||||
});
|
||||
}
|
||||
this.activate();
|
||||
return this.div;
|
||||
},
|
||||
|
||||
@@ -183,13 +189,14 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, {
|
||||
// since they need to pass through.
|
||||
for (var i=0, len=controls.length; i<len; i++) {
|
||||
var element = document.createElement("div");
|
||||
var textNode = document.createTextNode(" ");
|
||||
controls[i].panel_div = element;
|
||||
if (controls[i].title != "") {
|
||||
controls[i].panel_div.title = controls[i].title;
|
||||
}
|
||||
OpenLayers.Event.observe(controls[i].panel_div, "click",
|
||||
OpenLayers.Function.bind(this.onClick, this, controls[i]));
|
||||
OpenLayers.Event.observe(controls[i].panel_div, "dblclick",
|
||||
OpenLayers.Function.bind(this.onDoubleClick, this, controls[i]));
|
||||
OpenLayers.Event.observe(controls[i].panel_div, "mousedown",
|
||||
OpenLayers.Function.bindAsEventListener(OpenLayers.Event.stop));
|
||||
}
|
||||
@@ -216,6 +223,13 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.activateControl(ctrl);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: onDoubleClick
|
||||
*/
|
||||
onDoubleClick: function(ctrl, evt) {
|
||||
OpenLayers.Event.stop(evt ? evt : window.event);
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: getControlsBy
|
||||
* Get a list of controls with properties matching the given criteria.
|
||||
|
||||
@@ -61,6 +61,12 @@ OpenLayers.Control.ScaleLine = OpenLayers.Class(OpenLayers.Control, {
|
||||
* {DOMElement}
|
||||
*/
|
||||
eBottom:null,
|
||||
|
||||
/**
|
||||
* APIProperty: geodesic
|
||||
* {Boolean} Use geodesic measurement. Default is false.
|
||||
*/
|
||||
geodesic: false,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Control.ScaleLine
|
||||
@@ -83,9 +89,6 @@ OpenLayers.Control.ScaleLine = OpenLayers.Class(OpenLayers.Control, {
|
||||
draw: function() {
|
||||
OpenLayers.Control.prototype.draw.apply(this, arguments);
|
||||
if (!this.eTop) {
|
||||
this.div.style.display = "block";
|
||||
this.div.style.position = "absolute";
|
||||
|
||||
// stick in the top bar
|
||||
this.eTop = document.createElement("div");
|
||||
this.eTop.className = this.displayClass + "Top";
|
||||
@@ -159,7 +162,14 @@ OpenLayers.Control.ScaleLine = OpenLayers.Class(OpenLayers.Control, {
|
||||
var inches = OpenLayers.INCHES_PER_UNIT;
|
||||
|
||||
// convert maxWidth to map units
|
||||
var maxSizeData = this.maxWidth * res * inches[curMapUnits];
|
||||
var maxSizeData = this.maxWidth * res * inches[curMapUnits];
|
||||
var geodesicRatio = 1;
|
||||
if(this.geodesic === true) {
|
||||
var maxSizeGeodesic = this.getGeodesicLength(this.maxWidth);
|
||||
var maxSizeKilometers = maxSizeData / inches["km"];
|
||||
geodesicRatio = maxSizeGeodesic / maxSizeKilometers;
|
||||
maxSizeData *= geodesicRatio;
|
||||
}
|
||||
|
||||
// decide whether to use large or small scale units
|
||||
var topUnits;
|
||||
@@ -185,8 +195,8 @@ OpenLayers.Control.ScaleLine = OpenLayers.Class(OpenLayers.Control, {
|
||||
bottomMax = bottomRounded / inches[curMapUnits] * inches[bottomUnits];
|
||||
|
||||
// and to pixel units
|
||||
var topPx = topMax / res;
|
||||
var bottomPx = bottomMax / res;
|
||||
var topPx = topMax / res / geodesicRatio;
|
||||
var bottomPx = bottomMax / res / geodesicRatio;
|
||||
|
||||
// now set the pixel widths
|
||||
// and the values inside them
|
||||
@@ -203,6 +213,26 @@ OpenLayers.Control.ScaleLine = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: getGeodesicLength
|
||||
*
|
||||
* Parameters:
|
||||
* pixels - {Number} the pixels to get the geodesic length in meters for.
|
||||
*/
|
||||
getGeodesicLength: function(pixels) {
|
||||
var map = this.map;
|
||||
var centerPx = map.getPixelFromLonLat(map.getCenter());
|
||||
var bottom = map.getLonLatFromPixel(centerPx.add(0, -pixels / 2));
|
||||
var top = map.getLonLatFromPixel(centerPx.add(0, pixels / 2));
|
||||
var source = map.getProjectionObject();
|
||||
var dest = new OpenLayers.Projection("EPSG:4326");
|
||||
if(!source.equals(dest)) {
|
||||
bottom.transform(source, dest);
|
||||
top.transform(source, dest);
|
||||
}
|
||||
return OpenLayers.Util.distVincenty(bottom, top);
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Control.ScaleLine"
|
||||
});
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* {Object} The scope to use with the onBeforeSelect, onSelect, onUnselect
|
||||
* callbacks. If null the scope will be this control.
|
||||
*/
|
||||
scope: this,
|
||||
scope: null,
|
||||
|
||||
/**
|
||||
* APIProperty: geometryTypes
|
||||
@@ -178,16 +178,11 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
OpenLayers.Control.prototype.EVENT_TYPES
|
||||
);
|
||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||
if(layers instanceof Array) {
|
||||
this.layers = layers;
|
||||
this.layer = new OpenLayers.Layer.Vector.RootContainer(
|
||||
this.id + "_container", {
|
||||
layers: layers
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.layer = layers;
|
||||
|
||||
if(this.scope === null) {
|
||||
this.scope = this;
|
||||
}
|
||||
this.initLayer(layers);
|
||||
var callbacks = {
|
||||
click: this.clickFeature,
|
||||
clickout: this.clickoutFeature
|
||||
@@ -212,11 +207,35 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: initLayer
|
||||
* Assign the layer property. If layers is an array, we need to use
|
||||
* a RootContainer.
|
||||
*
|
||||
* Parameters:
|
||||
* layers - {<OpenLayers.Layer.Vector>}, or an array of vector layers.
|
||||
*/
|
||||
initLayer: function(layers) {
|
||||
if(layers instanceof Array) {
|
||||
this.layers = layers;
|
||||
this.layer = new OpenLayers.Layer.Vector.RootContainer(
|
||||
this.id + "_container", {
|
||||
layers: layers
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.layer = layers;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
if(this.active && this.layers) {
|
||||
this.map.removeLayer(this.layer);
|
||||
}
|
||||
OpenLayers.Control.prototype.destroy.apply(this, arguments);
|
||||
if(this.layers) {
|
||||
this.layer.destroy();
|
||||
@@ -468,6 +487,13 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
if(cont !== false) {
|
||||
layer.selectedFeatures.push(feature);
|
||||
this.highlight(feature);
|
||||
// if the feature handler isn't involved in the feature
|
||||
// selection (because the box handler is used or the
|
||||
// feature is selected programatically) we fake the
|
||||
// feature handler to allow unselecting on click
|
||||
if(!this.handlers.feature.lastFeature) {
|
||||
this.handlers.feature.lastFeature = layer.selectedFeatures[0];
|
||||
}
|
||||
layer.events.triggerEvent("featureselected", {feature: feature});
|
||||
this.onSelect.call(this.scope, feature);
|
||||
}
|
||||
@@ -525,6 +551,11 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
layer = layers[l];
|
||||
for(var i=0, len = layer.features.length; i<len; ++i) {
|
||||
var feature = layer.features[i];
|
||||
// check if the feature is displayed
|
||||
if (!feature.getVisibility()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.geometryTypes == null || OpenLayers.Util.indexOf(
|
||||
this.geometryTypes, feature.geometry.CLASS_NAME) > -1) {
|
||||
if (bounds.toGeometry().intersects(feature.geometry)) {
|
||||
@@ -554,5 +585,28 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
OpenLayers.Control.prototype.setMap.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: setLayer
|
||||
* Attach a new layer to the control, overriding any existing layers.
|
||||
*
|
||||
* Parameters:
|
||||
* layers - Array of {<OpenLayers.Layer.Vector>} or a single
|
||||
* {<OpenLayers.Layer.Vector>}
|
||||
*/
|
||||
setLayer: function(layers) {
|
||||
var isActive = this.active;
|
||||
this.unselectAll();
|
||||
this.deactivate();
|
||||
if(this.layers) {
|
||||
this.layer.destroy();
|
||||
this.layers = null;
|
||||
}
|
||||
this.initLayer(layers);
|
||||
this.handlers.feature.layer = this.layer;
|
||||
if (isActive) {
|
||||
this.activate();
|
||||
}
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Control.SelectFeature"
|
||||
});
|
||||
|
||||
579
lib/OpenLayers/Control/TransformFeature.js
Normal file
579
lib/OpenLayers/Control/TransformFeature.js
Normal file
@@ -0,0 +1,579 @@
|
||||
/* Copyright (c) 2009 MetaCarta, Inc., published under the Clear BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
/**
|
||||
* @requires OpenLayers/Control.js
|
||||
* @requires OpenLayers/Control/DragFeature.js
|
||||
* @requires OpenLayers/Feature/Vector.js
|
||||
* @requires OpenLayers/Geometry/LineString.js
|
||||
* @requires OpenLayers/Geometry/Point.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Control.TransformFeature
|
||||
* Control to transform features with a standard transformation box.
|
||||
*
|
||||
* Inherits From:
|
||||
* - <OpenLayers.Control>
|
||||
*/
|
||||
OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
/**
|
||||
* Constant: EVENT_TYPES
|
||||
*
|
||||
* Supported event types:
|
||||
* - *beforesetfeature* Triggered before a feature is set for
|
||||
* tranformation. The feature will not be set if a listener returns
|
||||
* false. Listeners receive a *feature* property, with the feature
|
||||
* that will be set for transformation. Listeners are allowed to
|
||||
* set the control's *scale*, *ratio* and *rotation* properties,
|
||||
* which will set the initial scale, ratio and rotation of the
|
||||
* feature, like the <setFeature> method's initialParams argument.
|
||||
* - *setfeature* Triggered when a feature is set for tranformation.
|
||||
* Listeners receive a *feature* property, with the feature that
|
||||
* is now set for transformation.
|
||||
* - *beforetransform* Triggered while dragging, before a feature is
|
||||
* transformed. The feature will not be transformed if a listener
|
||||
* returns false (but the box still will). Listeners receive one or
|
||||
* more of *center*, *scale*, *ratio* and *rotation*. The *center*
|
||||
* property is an <OpenLayers.Geometry.Point> object with the new
|
||||
* center of the transformed feature, the others are Floats with the
|
||||
* scale, ratio or rotation change since the last transformation.
|
||||
* - *transform* Triggered while dragging, when a feature is transformed.
|
||||
* Listeners receive an event object with one or more of *center*,
|
||||
* *scale*, *ratio* and *rotation*. The *center* property is an
|
||||
* <OpenLayers.Geometry.Point> object with the new center of the
|
||||
* transformed feature, the others are Floats with the scale, ratio
|
||||
* or rotation change of the feature since the last transformation.
|
||||
* - *transformcomplete" Triggered after dragging. Listeners receive
|
||||
* an event object with the transformed *feature*.
|
||||
*/
|
||||
EVENT_TYPES: ["beforesetfeature", "setfeature", "beforetransform",
|
||||
"transform", "transformcomplete"],
|
||||
|
||||
/**
|
||||
* APIProperty: geometryTypes
|
||||
* {Array(String)} To restrict transformation to a limited set of geometry
|
||||
* types, send a list of strings corresponding to the geometry class
|
||||
* names.
|
||||
*/
|
||||
geometryTypes: null,
|
||||
|
||||
/**
|
||||
* Property: layer
|
||||
* {<OpenLayers.Layer.Vector>}
|
||||
*/
|
||||
layer: null,
|
||||
|
||||
/**
|
||||
* APIProperty: preserveAspectRatio
|
||||
* {Boolean} set to true to not change the feature's aspect ratio.
|
||||
*/
|
||||
preserveAspectRatio: false,
|
||||
|
||||
/**
|
||||
* APIProperty: rotate
|
||||
* {Boolean} set to false if rotation should be disabled. Default is true.
|
||||
* To be passed with the constructor or set when the control is not
|
||||
* active.
|
||||
*/
|
||||
rotate: true,
|
||||
|
||||
/**
|
||||
* APIProperty: feature
|
||||
* {<OpenLayers.Feature.Vector>} Feature currently available for
|
||||
* transformation. Read-only, use <setFeature> to set it manually.
|
||||
*/
|
||||
feature: null,
|
||||
|
||||
/**
|
||||
* APIProperty: renderIntent
|
||||
* {String|Object} Render intent for the transformation box and
|
||||
* handles. A symbolizer object can also be provided here.
|
||||
*/
|
||||
renderIntent: "temporary",
|
||||
|
||||
/**
|
||||
* APIProperty: rotationHandleSymbolizer
|
||||
* {Object|String} Optional. A custom symbolizer for the rotation handles.
|
||||
* A render intent can also be provided here. Defaults to
|
||||
* (code)
|
||||
* {
|
||||
* stroke: false,
|
||||
* pointRadius: 10,
|
||||
* fillOpacity: 0,
|
||||
* cursor: "pointer"
|
||||
* }
|
||||
* (end)
|
||||
*/
|
||||
rotationHandleSymbolizer: null,
|
||||
|
||||
/**
|
||||
* APIProperty: box
|
||||
* {<OpenLayers.Feature.Vector>} The transformation box rectangle.
|
||||
* Read-only.
|
||||
*/
|
||||
box: null,
|
||||
|
||||
/**
|
||||
* APIProperty: center
|
||||
* {<OpenLayers.Geometry.Point>} The center of the feature bounds.
|
||||
* Read-only.
|
||||
*/
|
||||
center: null,
|
||||
|
||||
/**
|
||||
* APIProperty: scale
|
||||
* {Float} The scale of the feature, relative to the scale the time the
|
||||
* feature was set. Read-only, except for *beforesetfeature*
|
||||
* listeners.
|
||||
*/
|
||||
scale: 1,
|
||||
|
||||
/**
|
||||
* APIProperty: ratio
|
||||
* {Float} The ratio of the feature relative to the ratio the time the
|
||||
* feature was set. Read-only, except for *beforesetfeature*
|
||||
* listeners.
|
||||
*/
|
||||
ratio: 1,
|
||||
|
||||
/**
|
||||
* Property: rotation
|
||||
* {Integer} the current rotation angle of the box. Read-only, except for
|
||||
* *beforesetfeature* listeners.
|
||||
*/
|
||||
rotation: 0,
|
||||
|
||||
/**
|
||||
* APIProperty: handles
|
||||
* {Array(<OpenLayers.Feature.Vector>)} The 8 handles currently available
|
||||
* for scaling/resizing. Numbered counterclockwise, starting from the
|
||||
* southwest corner. Read-only.
|
||||
*/
|
||||
handles: null,
|
||||
|
||||
/**
|
||||
* APIProperty: rotationHandles
|
||||
* {Array(<OpenLayers.Feature.Vector>)} The 4 rotation handles currently
|
||||
* available for rotating. Numbered counterclockwise, starting from
|
||||
* the southwest corner. Read-only.
|
||||
*/
|
||||
rotationHandles: null,
|
||||
|
||||
/**
|
||||
* Property: dragControl
|
||||
* {<OpenLayers.Control.DragFeature>}
|
||||
*/
|
||||
dragControl: null,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Control.TransformFeature
|
||||
* Create a new transform feature control.
|
||||
*
|
||||
* Parameters:
|
||||
* layer - {<OpenLayers.Layer.Vector>} Layer that contains features that
|
||||
* will be transformed.
|
||||
* options - {Object} Optional object whose properties will be set on the
|
||||
* control.
|
||||
*/
|
||||
initialize: function(layer, options) {
|
||||
// concatenate events specific to this control with those from the base
|
||||
this.EVENT_TYPES =
|
||||
OpenLayers.Control.TransformFeature.prototype.EVENT_TYPES.concat(
|
||||
OpenLayers.Control.prototype.EVENT_TYPES
|
||||
);
|
||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||
|
||||
this.layer = layer;
|
||||
|
||||
if(!this.rotationHandleSymbolizer) {
|
||||
this.rotationHandleSymbolizer = {
|
||||
stroke: false,
|
||||
pointRadius: 10,
|
||||
fillOpacity: 0,
|
||||
cursor: "pointer"
|
||||
};
|
||||
}
|
||||
|
||||
this.createBox();
|
||||
this.createControl();
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: activate
|
||||
* Activates the control.
|
||||
*/
|
||||
activate: function() {
|
||||
var activated = false;
|
||||
if(OpenLayers.Control.prototype.activate.apply(this, arguments)) {
|
||||
this.dragControl.activate();
|
||||
this.layer.addFeatures([this.box]);
|
||||
this.rotate && this.layer.addFeatures(this.rotationHandles);
|
||||
this.layer.addFeatures(this.handles);
|
||||
activated = true;
|
||||
}
|
||||
return activated;
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: deactivate
|
||||
* Deactivates the control.
|
||||
*/
|
||||
deactivate: function() {
|
||||
var deactivated = false;
|
||||
if(OpenLayers.Control.prototype.deactivate.apply(this, arguments)) {
|
||||
this.layer.removeFeatures(this.handles);
|
||||
this.rotate && this.layer.removeFeatures(this.rotationHandles);
|
||||
this.layer.removeFeatures([this.box]);
|
||||
this.dragControl.deactivate();
|
||||
deactivated = true;
|
||||
}
|
||||
return deactivated;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: setMap
|
||||
*
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
setMap: function(map) {
|
||||
this.dragControl.setMap(map);
|
||||
OpenLayers.Control.prototype.setMap.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: setFeature
|
||||
* Place the transformation box on a feature and start transforming it.
|
||||
* If the control is not active, it will be activated.
|
||||
*
|
||||
* Parameters:
|
||||
* feature - {<OpenLayers.Feature.Vector>}
|
||||
* initialParams - {Object} Initial values for rotation, scale or ratio.
|
||||
* Setting a rotation value here will cause the transformation box to
|
||||
* start rotated. Setting a scale or ratio will not affect the
|
||||
* transormation box, but applications may use this to keep track of
|
||||
* scale and ratio of a feature across multiple transforms.
|
||||
*/
|
||||
setFeature: function(feature, initialParams) {
|
||||
initialParams = OpenLayers.Util.applyDefaults(initialParams, {
|
||||
rotation: 0,
|
||||
scale: 1,
|
||||
ratio: 1
|
||||
});
|
||||
var evt = {feature: feature};
|
||||
|
||||
var oldRotation = this.rotation;
|
||||
var oldCenter = this.center;
|
||||
OpenLayers.Util.extend(this, initialParams);
|
||||
|
||||
if(this.events.triggerEvent("beforesetfeature", evt) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.feature = feature;
|
||||
this.activate();
|
||||
|
||||
this._setfeature = true;
|
||||
|
||||
var featureBounds = this.feature.geometry.getBounds();
|
||||
this.box.move(featureBounds.getCenterLonLat());
|
||||
this.box.geometry.rotate(-oldRotation, oldCenter);
|
||||
this._angle = 0;
|
||||
|
||||
var ll;
|
||||
if(this.rotation) {
|
||||
var geom = feature.geometry.clone();
|
||||
geom.rotate(-this.rotation, this.center);
|
||||
var box = new OpenLayers.Feature.Vector(
|
||||
geom.getBounds().toGeometry());
|
||||
box.geometry.rotate(this.rotation, this.center);
|
||||
this.box.geometry.rotate(this.rotation, this.center);
|
||||
this.box.move(box.geometry.getBounds().getCenterLonLat());
|
||||
var llGeom = box.geometry.components[0].components[0];
|
||||
ll = llGeom.getBounds().getCenterLonLat();
|
||||
} else {
|
||||
ll = new OpenLayers.LonLat(featureBounds.left, featureBounds.bottom);
|
||||
}
|
||||
this.handles[0].move(ll);
|
||||
|
||||
delete this._setfeature;
|
||||
|
||||
this.events.triggerEvent("setfeature", evt);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: createBox
|
||||
* Creates the box with all handles and transformation handles.
|
||||
*/
|
||||
createBox: function() {
|
||||
var control = this;
|
||||
|
||||
this.center = new OpenLayers.Geometry.Point(0, 0);
|
||||
var box = new OpenLayers.Feature.Vector(
|
||||
new OpenLayers.Geometry.LineString([
|
||||
new OpenLayers.Geometry.Point(-1, -1),
|
||||
new OpenLayers.Geometry.Point(0, -1),
|
||||
new OpenLayers.Geometry.Point(1, -1),
|
||||
new OpenLayers.Geometry.Point(1, 0),
|
||||
new OpenLayers.Geometry.Point(1, 1),
|
||||
new OpenLayers.Geometry.Point(0, 1),
|
||||
new OpenLayers.Geometry.Point(-1, 1),
|
||||
new OpenLayers.Geometry.Point(-1, 0),
|
||||
new OpenLayers.Geometry.Point(-1, -1)
|
||||
]), null,
|
||||
typeof this.renderIntent == "string" ? null : this.renderIntent
|
||||
);
|
||||
|
||||
// Override for box move - make sure that the center gets updated
|
||||
box.geometry.move = function(x, y) {
|
||||
control._moving = true;
|
||||
OpenLayers.Geometry.LineString.prototype.move.apply(this, arguments);
|
||||
control.center.move(x, y);
|
||||
delete control._moving;
|
||||
};
|
||||
|
||||
// Overrides for vertex move, resize and rotate - make sure that
|
||||
// handle and rotationHandle geometries are also moved, resized and
|
||||
// rotated.
|
||||
var vertexMoveFn = function(x, y) {
|
||||
OpenLayers.Geometry.Point.prototype.move.apply(this, arguments);
|
||||
this._rotationHandle && this._rotationHandle.geometry.move(x, y);
|
||||
this._handle.geometry.move(x, y);
|
||||
};
|
||||
var vertexResizeFn = function(scale, center, ratio) {
|
||||
OpenLayers.Geometry.Point.prototype.resize.apply(this, arguments);
|
||||
this._rotationHandle && this._rotationHandle.geometry.resize(
|
||||
scale, center, ratio);
|
||||
this._handle.geometry.resize(scale, center, ratio);
|
||||
};
|
||||
var vertexRotateFn = function(angle, center) {
|
||||
OpenLayers.Geometry.Point.prototype.rotate.apply(this, arguments);
|
||||
this._rotationHandle && this._rotationHandle.geometry.rotate(
|
||||
angle, center);
|
||||
this._handle.geometry.rotate(angle, center);
|
||||
};
|
||||
|
||||
// Override for handle move - make sure that the box and other handles
|
||||
// are updated, and finally transform the feature.
|
||||
var handleMoveFn = function(x, y) {
|
||||
var oldX = this.x, oldY = this.y;
|
||||
OpenLayers.Geometry.Point.prototype.move.call(this, x, y);
|
||||
if(control._moving) {
|
||||
return;
|
||||
}
|
||||
var evt = control.dragControl.handlers.drag.evt;
|
||||
var preserveAspectRatio = !control._setfeature &&
|
||||
control.preserveAspectRatio;
|
||||
var reshape = !preserveAspectRatio && !(evt && evt.shiftKey);
|
||||
var oldGeom = new OpenLayers.Geometry.Point(oldX, oldY);
|
||||
var centerGeometry = control.center;
|
||||
this.rotate(-control.rotation, centerGeometry);
|
||||
oldGeom.rotate(-control.rotation, centerGeometry);
|
||||
var dx1 = this.x - centerGeometry.x;
|
||||
var dy1 = this.y - centerGeometry.y;
|
||||
var dx0 = dx1 - (this.x - oldGeom.x);
|
||||
var dy0 = dy1 - (this.y - oldGeom.y);
|
||||
this.x = oldX;
|
||||
this.y = oldY;
|
||||
var scale, ratio = 1;
|
||||
if (reshape) {
|
||||
scale = Math.abs(dy0) < 0.00001 ? 1 : dy1 / dy0;
|
||||
ratio = (Math.abs(dx0) < 0.00001 ? 1 : (dx1 / dx0)) / scale;
|
||||
} else {
|
||||
var l0 = Math.sqrt((dx0 * dx0) + (dy0 * dy0));
|
||||
var l1 = Math.sqrt((dx1 * dx1) + (dy1 * dy1));
|
||||
scale = l1 / l0;
|
||||
}
|
||||
|
||||
// rotate the box to 0 before resizing - saves us some
|
||||
// calculations and is inexpensive because we don't drawFeature.
|
||||
control._moving = true;
|
||||
control.box.geometry.rotate(-control.rotation, centerGeometry);
|
||||
delete control._moving;
|
||||
|
||||
control.box.geometry.resize(scale, centerGeometry, ratio);
|
||||
control.box.geometry.rotate(control.rotation, centerGeometry);
|
||||
control.transformFeature({scale: scale, ratio: ratio});
|
||||
};
|
||||
|
||||
// Override for rotation handle move - make sure that the box and
|
||||
// other handles are updated, and finally transform the feature.
|
||||
var rotationHandleMoveFn = function(x, y){
|
||||
var oldX = this.x, oldY = this.y;
|
||||
OpenLayers.Geometry.Point.prototype.move.call(this, x, y);
|
||||
if(control._moving) {
|
||||
return;
|
||||
}
|
||||
var evt = control.dragControl.handlers.drag.evt;
|
||||
var constrain = (evt && evt.shiftKey) ? 45 : 1;
|
||||
var centerGeometry = control.center;
|
||||
var dx1 = this.x - centerGeometry.x;
|
||||
var dy1 = this.y - centerGeometry.y;
|
||||
var dx0 = dx1 - x;
|
||||
var dy0 = dy1 - y;
|
||||
this.x = oldX;
|
||||
this.y = oldY;
|
||||
var a0 = Math.atan2(dy0, dx0);
|
||||
var a1 = Math.atan2(dy1, dx1);
|
||||
var angle = a1 - a0;
|
||||
angle *= 180 / Math.PI;
|
||||
control._angle = (control._angle + angle) % 360;
|
||||
var diff = control.rotation % constrain;
|
||||
if(Math.abs(control._angle) >= constrain || diff !== 0) {
|
||||
angle = Math.round(control._angle / constrain) * constrain -
|
||||
diff;
|
||||
control._angle = 0;
|
||||
control.box.geometry.rotate(angle, centerGeometry);
|
||||
control.transformFeature({rotation: angle});
|
||||
}
|
||||
};
|
||||
|
||||
var handles = new Array(8);
|
||||
var rotationHandles = new Array(4);
|
||||
var geom, handle, rotationHandle;
|
||||
for(var i=0; i<8; ++i) {
|
||||
geom = box.geometry.components[i];
|
||||
handle = new OpenLayers.Feature.Vector(geom.clone(), null,
|
||||
typeof this.renderIntent == "string" ? null :
|
||||
this.renderIntent);
|
||||
if(i % 2 == 0) {
|
||||
rotationHandle = new OpenLayers.Feature.Vector(geom.clone(),
|
||||
null, typeof this.rotationHandleSymbolizer == "string" ?
|
||||
null : this.rotationHandleSymbolizer);
|
||||
rotationHandle.geometry.move = rotationHandleMoveFn;
|
||||
geom._rotationHandle = rotationHandle;
|
||||
rotationHandles[i/2] = rotationHandle;
|
||||
}
|
||||
geom.move = vertexMoveFn;
|
||||
geom.resize = vertexResizeFn;
|
||||
geom.rotate = vertexRotateFn;
|
||||
handle.geometry.move = handleMoveFn;
|
||||
geom._handle = handle;
|
||||
handles[i] = handle;
|
||||
}
|
||||
|
||||
this.box = box;
|
||||
this.rotationHandles = rotationHandles;
|
||||
this.handles = handles;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: createControl
|
||||
* Creates a DragFeature control for this control.
|
||||
*/
|
||||
createControl: function() {
|
||||
var control = this;
|
||||
this.dragControl = new OpenLayers.Control.DragFeature(this.layer, {
|
||||
documentDrag: true,
|
||||
// avoid moving the feature itself - move the box instead
|
||||
moveFeature: function(pixel) {
|
||||
if(this.feature === control.feature) {
|
||||
this.feature = control.box;
|
||||
}
|
||||
OpenLayers.Control.DragFeature.prototype.moveFeature.apply(this,
|
||||
arguments);
|
||||
},
|
||||
// transform while dragging
|
||||
onDrag: function(feature, pixel) {
|
||||
var geom = feature.geometry;
|
||||
if(feature === control.box) {
|
||||
control.transformFeature({center: control.center});
|
||||
control.drawHandles();
|
||||
}
|
||||
},
|
||||
// set a new feature
|
||||
onStart: function(feature, pixel) {
|
||||
var eligible = !control.geometryTypes ||
|
||||
OpenLayers.Util.indexOf(control.geometryTypes,
|
||||
feature.geometry.CLASS_NAME) !== -1;
|
||||
var i = OpenLayers.Util.indexOf(control.handles, feature);
|
||||
i += OpenLayers.Util.indexOf(control.rotationHandles,
|
||||
feature);
|
||||
if(feature !== control.feature && feature !== control.box &&
|
||||
i == -2 && eligible) {
|
||||
control.setFeature(feature);
|
||||
}
|
||||
},
|
||||
onComplete: function(feature, pixel) {
|
||||
control.events.triggerEvent("transformcomplete",
|
||||
{feature: feature});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: drawHandles
|
||||
* Draws the handles to match the box.
|
||||
*/
|
||||
drawHandles: function() {
|
||||
var layer = this.layer;
|
||||
for(var i=0; i<8; ++i) {
|
||||
if(this.rotate && i % 2 === 0) {
|
||||
layer.drawFeature(this.rotationHandles[i/2],
|
||||
this.rotationHandleSymbolizer);
|
||||
}
|
||||
layer.drawFeature(this.handles[i], this.renderIntent);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: transformFeature
|
||||
* Transforms the feature.
|
||||
*
|
||||
* Parameters:
|
||||
* mods - {Object} An object with optional scale, ratio, rotation and
|
||||
* center properties.
|
||||
*/
|
||||
transformFeature: function(mods) {
|
||||
if(!this._setfeature) {
|
||||
this.scale *= (mods.scale || 1);
|
||||
this.ratio *= (mods.ratio || 1);
|
||||
var oldRotation = this.rotation;
|
||||
this.rotation = (this.rotation + (mods.rotation || 0)) % 360;
|
||||
|
||||
if(this.events.triggerEvent("beforetransform", mods) !== false) {
|
||||
var feature = this.feature;
|
||||
var geom = feature.geometry;
|
||||
var center = this.center;
|
||||
geom.rotate(-oldRotation, center);
|
||||
if(mods.scale || mods.ratio) {
|
||||
geom.resize(mods.scale, center, mods.ratio);
|
||||
} else if(mods.center) {
|
||||
feature.move(mods.center.getBounds().getCenterLonLat());
|
||||
}
|
||||
geom.rotate(this.rotation, center);
|
||||
this.layer.drawFeature(feature);
|
||||
feature.toState(OpenLayers.State.UPDATE);
|
||||
this.events.triggerEvent("transform", mods);
|
||||
}
|
||||
}
|
||||
this.layer.drawFeature(this.box, this.renderIntent);
|
||||
this.drawHandles();
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: destroy
|
||||
* Take care of things that are not handled in superclass.
|
||||
*/
|
||||
destroy: function() {
|
||||
var geom;
|
||||
for(var i=0; i<8; ++i) {
|
||||
geom = this.box.geometry.components[i];
|
||||
geom._handle.destroy();
|
||||
geom._handle = null;
|
||||
geom._rotationHandle && geom._rotationHandle.destroy();
|
||||
geom._rotationHandle = null;
|
||||
};
|
||||
this.box.destroy();
|
||||
this.box = null;
|
||||
this.layer = null;
|
||||
this.dragControl.destroy();
|
||||
OpenLayers.Control.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Control.TransformFeature"
|
||||
});
|
||||
@@ -23,7 +23,7 @@
|
||||
* - <OpenLayers.Control>
|
||||
*/
|
||||
OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
|
||||
/**
|
||||
* APIProperty: hover
|
||||
* {Boolean} Send GetFeatureInfo requests when mouse stops moving.
|
||||
@@ -31,6 +31,14 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
hover: false,
|
||||
|
||||
/**
|
||||
* APIProperty: drillDown
|
||||
* {Boolean} Drill down over all WMS layers in the map. When
|
||||
* using drillDown mode, hover is not possible, and an infoFormat that
|
||||
* returns parseable features is required. Default is false.
|
||||
*/
|
||||
drillDown: false,
|
||||
|
||||
/**
|
||||
* APIProperty: maxFeatures
|
||||
* {Integer} Maximum number of features to return from a WMS query. This
|
||||
@@ -38,12 +46,19 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
* requests.
|
||||
*/
|
||||
maxFeatures: 10,
|
||||
|
||||
/** APIProperty: clickCallback
|
||||
* {String} The click callback to register in the
|
||||
* {<OpenLayers.Handler.Click>} object created when the hover
|
||||
* option is set to false. Default is "click".
|
||||
*/
|
||||
clickCallback: "click",
|
||||
|
||||
/**
|
||||
* Property: layers
|
||||
* {Array(<OpenLayers.Layer.WMS>)} The layers to query for feature info.
|
||||
* If omitted, all map WMS layers with a url that matches this <url> or
|
||||
* <layerUrl> will be considered.
|
||||
* <layerUrls> will be considered.
|
||||
*/
|
||||
layers: null,
|
||||
|
||||
@@ -131,14 +146,20 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
* Constant: EVENT_TYPES
|
||||
*
|
||||
* Supported event types (in addition to those from <OpenLayers.Control>):
|
||||
* beforegetfeatureinfo - Triggered before the request is sent.
|
||||
* The event object has an *xy* property with the position of the
|
||||
* mouse click or hover event that triggers the request.
|
||||
* getfeatureinfo - Triggered when a GetFeatureInfo response is received.
|
||||
* The event object has a *text* property with the body of the
|
||||
* response (String), a *features* property with an array of the
|
||||
* parsed features, an *xy* property with the position of the mouse
|
||||
* click or hover event that triggered the request, and a *request*
|
||||
* property with the request itself.
|
||||
* property with the request itself. If drillDown is set to true and
|
||||
* multiple requests were issued to collect feature info from all
|
||||
* layers, *text* and *request* will only contain the response body
|
||||
* and request object of the last request.
|
||||
*/
|
||||
EVENT_TYPES: ["getfeatureinfo"],
|
||||
EVENT_TYPES: ["beforegetfeatureinfo", "getfeatureinfo"],
|
||||
|
||||
/**
|
||||
* Constructor: <OpenLayers.Control.WMSGetFeatureInfo>
|
||||
@@ -163,8 +184,12 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
options.formatOptions
|
||||
);
|
||||
}
|
||||
|
||||
if(this.drillDown === true) {
|
||||
this.hover = false;
|
||||
}
|
||||
|
||||
if (this.hover) {
|
||||
if(this.hover) {
|
||||
this.handler = new OpenLayers.Handler.Hover(
|
||||
this, {
|
||||
'move': this.cancelHover,
|
||||
@@ -174,8 +199,10 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
'delay': 250
|
||||
}));
|
||||
} else {
|
||||
this.handler = new OpenLayers.Handler.Click(this,
|
||||
{click: this.getInfoForClick}, this.handlerOptions.click || {});
|
||||
var callbacks = {};
|
||||
callbacks[this.clickCallback] = this.getInfoForClick;
|
||||
this.handler = new OpenLayers.Handler.Click(
|
||||
this, callbacks, this.handlerOptions.click || {});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -216,6 +243,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
* evt - {<OpenLayers.Event>}
|
||||
*/
|
||||
getInfoForClick: function(evt) {
|
||||
this.events.triggerEvent("beforegetfeatureinfo", {xy: evt.xy});
|
||||
// Set the cursor to "wait" to tell the user we're working on their
|
||||
// click.
|
||||
OpenLayers.Element.addClass(this.map.viewPortDiv, "olCursorWait");
|
||||
@@ -230,6 +258,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
* evt - {Object}
|
||||
*/
|
||||
getInfoForHover: function(evt) {
|
||||
this.events.triggerEvent("beforegetfeatureinfo", {xy: evt.xy});
|
||||
this.request(evt.xy, {hover: true});
|
||||
},
|
||||
|
||||
@@ -251,9 +280,8 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
findLayers: function() {
|
||||
|
||||
var layers = [];
|
||||
|
||||
var candidates = this.layers || this.map.layers;
|
||||
var layers = [];
|
||||
var layer, url;
|
||||
for(var i=0, len=candidates.length; i<len; ++i) {
|
||||
layer = candidates[i];
|
||||
@@ -262,15 +290,14 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
url = layer.url instanceof Array ? layer.url[0] : layer.url;
|
||||
// if the control was not configured with a url, set it
|
||||
// to the first layer url
|
||||
if(!this.url) {
|
||||
if(this.drillDown === false && !this.url) {
|
||||
this.url = url;
|
||||
}
|
||||
if(this.urlMatches(url)) {
|
||||
if(this.drillDown === true || this.urlMatches(url)) {
|
||||
layers.push(layer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return layers;
|
||||
},
|
||||
|
||||
@@ -299,6 +326,89 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
return matches;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: buildWMSOptions
|
||||
* Build an object with the relevant WMS options for the GetFeatureInfo request
|
||||
*
|
||||
* Parameters:
|
||||
* url - {String} The url to be used for sending the request
|
||||
* layers - {Array(<OpenLayers.Layer.WMS)} An array of layers
|
||||
* clickPosition - {<OpenLayers.Pixel>} The position on the map where the mouse
|
||||
* event occurred.
|
||||
* format - {String} The format from the corresponding GetMap request
|
||||
*/
|
||||
buildWMSOptions: function(url, layers, clickPosition, format) {
|
||||
var layerNames = [], styleNames = [];
|
||||
for (var i = 0, len = layers.length; i < len; i++) {
|
||||
layerNames = layerNames.concat(layers[i].params.LAYERS);
|
||||
styleNames = styleNames.concat(this.getStyleNames(layers[i]));
|
||||
}
|
||||
var params = OpenLayers.Util.extend({
|
||||
service: "WMS",
|
||||
version: layers[0].params.VERSION,
|
||||
request: "GetFeatureInfo",
|
||||
layers: layerNames,
|
||||
query_layers: layerNames,
|
||||
styles: styleNames,
|
||||
bbox: this.map.getExtent().toBBOX(null,
|
||||
layers[0].reverseAxisOrder()),
|
||||
feature_count: this.maxFeatures,
|
||||
height: this.map.getSize().h,
|
||||
width: this.map.getSize().w,
|
||||
format: format,
|
||||
info_format: this.infoFormat
|
||||
}, (parseFloat(layers[0].params.VERSION) >= 1.3) ?
|
||||
{
|
||||
crs: this.map.getProjection(),
|
||||
i: clickPosition.x,
|
||||
j: clickPosition.y
|
||||
} :
|
||||
{
|
||||
srs: this.map.getProjection(),
|
||||
x: clickPosition.x,
|
||||
y: clickPosition.y
|
||||
}
|
||||
);
|
||||
OpenLayers.Util.applyDefaults(params, this.vendorParams);
|
||||
return {
|
||||
url: url,
|
||||
params: OpenLayers.Util.upperCaseObject(params),
|
||||
callback: function(request) {
|
||||
this.handleResponse(clickPosition, request);
|
||||
},
|
||||
scope: this
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: getStyleNames
|
||||
* Gets the STYLES parameter for the layer. Make sure the STYLES parameter
|
||||
* matches the LAYERS parameter
|
||||
*
|
||||
* Parameters:
|
||||
* layer - {<OpenLayers.Layer.WMS>}
|
||||
*
|
||||
* Returns:
|
||||
* {Array(String)} The STYLES parameter
|
||||
*/
|
||||
getStyleNames: function(layer) {
|
||||
// in the event of a WMS layer bundling multiple layers but not
|
||||
// specifying styles,we need the same number of commas to specify
|
||||
// the default style for each of the layers. We can't just leave it
|
||||
// blank as we may be including other layers that do specify styles.
|
||||
var styleNames;
|
||||
if (layer.params.STYLES) {
|
||||
styleNames = layer.params.STYLES;
|
||||
} else {
|
||||
if (layer.params.LAYERS instanceof Array) {
|
||||
styleNames = new Array(layer.params.LAYERS.length);
|
||||
} else { // Assume it's a String
|
||||
styleNames = layer.params.LAYERS.replace(/[^,]/g, "");
|
||||
}
|
||||
}
|
||||
return styleNames;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: request
|
||||
* Sends a GetFeatureInfo request to the WMS
|
||||
@@ -312,64 +422,70 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
* - *hover* {Boolean} true if we do the request for the hover handler
|
||||
*/
|
||||
request: function(clickPosition, options) {
|
||||
options = options || {};
|
||||
var layerNames = [];
|
||||
var styleNames = [];
|
||||
|
||||
var layers = this.findLayers();
|
||||
if(layers.length > 0) {
|
||||
|
||||
for (var i = 0, len = layers.length; i < len; i++) {
|
||||
layerNames = layerNames.concat(layers[i].params.LAYERS);
|
||||
// in the event of a WMS layer bundling multiple layers but not
|
||||
// specifying styles,we need the same number of commas to specify
|
||||
// the default style for each of the layers. We can't just leave it
|
||||
// blank as we may be including other layers that do specify styles.
|
||||
if (layers[i].params.STYLES) {
|
||||
styleNames = styleNames.concat(layers[i].params.STYLES);
|
||||
} else {
|
||||
if (layers[i].params.LAYERS instanceof Array) {
|
||||
styleNames = styleNames.concat(new Array(layers[i].params.LAYERS.length));
|
||||
} else { // Assume it's a String
|
||||
styleNames = styleNames.concat(layers[i].params.LAYERS.replace(/[^,]/g, ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var wmsOptions = {
|
||||
url: this.url,
|
||||
params: OpenLayers.Util.applyDefaults({
|
||||
service: "WMS",
|
||||
version: "1.1.0",
|
||||
request: "GetFeatureInfo",
|
||||
layers: layerNames,
|
||||
query_layers: layerNames,
|
||||
styles: styleNames,
|
||||
bbox: this.map.getExtent().toBBOX(),
|
||||
srs: this.map.getProjection(),
|
||||
feature_count: this.maxFeatures,
|
||||
x: clickPosition.x,
|
||||
y: clickPosition.y,
|
||||
height: this.map.getSize().h,
|
||||
width: this.map.getSize().w,
|
||||
info_format: this.infoFormat
|
||||
}, this.vendorParams),
|
||||
callback: function(request) {
|
||||
this.handleResponse(clickPosition, request);
|
||||
},
|
||||
scope: this
|
||||
};
|
||||
|
||||
if(layers.length == 0) {
|
||||
// Reset the cursor.
|
||||
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");
|
||||
return;
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
if(this.drillDown === false) {
|
||||
var wmsOptions = this.buildWMSOptions(this.url, layers,
|
||||
clickPosition, layers[0].params.FORMAT);
|
||||
var response = OpenLayers.Request.GET(wmsOptions);
|
||||
|
||||
if (options.hover === true) {
|
||||
this.hoverRequest = response.priv;
|
||||
}
|
||||
} else {
|
||||
// Reset the cursor.
|
||||
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");
|
||||
this._requestCount = 0;
|
||||
this._numRequests = 0;
|
||||
this.features = [];
|
||||
// group according to service url to combine requests
|
||||
var services = {}, url;
|
||||
for(var i=0, len=layers.length; i<len; i++) {
|
||||
var layer = layers[i];
|
||||
var service, found = false;
|
||||
url = layer.url instanceof Array ? layer.url[0] : layer.url;
|
||||
if(url in services) {
|
||||
services[url].push(layer);
|
||||
} else {
|
||||
this._numRequests++;
|
||||
services[url] = [layer];
|
||||
}
|
||||
}
|
||||
var layers;
|
||||
for (var url in services) {
|
||||
layers = services[url];
|
||||
var wmsOptions = this.buildWMSOptions(url, layers,
|
||||
clickPosition, layers[0].params.FORMAT);
|
||||
OpenLayers.Request.GET(wmsOptions);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: triggerGetFeatureInfo
|
||||
* Trigger the getfeatureinfo event when all is done
|
||||
*
|
||||
* Parameters:
|
||||
* request - {XMLHttpRequest} The request object
|
||||
* xy - {<OpenLayers.Pixel>} The position on the map where the
|
||||
* mouse event occurred.
|
||||
* features - {Array(<OpenLayers.Feature.Vector>)}
|
||||
*/
|
||||
triggerGetFeatureInfo: function(request, xy, features) {
|
||||
this.events.triggerEvent("getfeatureinfo", {
|
||||
text: request.responseText,
|
||||
features: features,
|
||||
request: request,
|
||||
xy: xy
|
||||
});
|
||||
|
||||
// Reset the cursor.
|
||||
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: handleResponse
|
||||
@@ -387,16 +503,18 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
doc = request.responseText;
|
||||
}
|
||||
var features = this.format.read(doc);
|
||||
|
||||
this.events.triggerEvent("getfeatureinfo", {
|
||||
text: request.responseText,
|
||||
features: features,
|
||||
request: request,
|
||||
xy: xy
|
||||
});
|
||||
|
||||
// Reset the cursor.
|
||||
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");
|
||||
if (this.drillDown === false) {
|
||||
this.triggerGetFeatureInfo(request, xy, features);
|
||||
} else {
|
||||
this._requestCount++;
|
||||
this._features = (this._features || []).concat(features);
|
||||
if (this._requestCount === this._numRequests) {
|
||||
this.triggerGetFeatureInfo(request, xy, this._features.concat());
|
||||
delete this._features;
|
||||
delete this._requestCount;
|
||||
delete this._numRequests;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,12 +51,13 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
zoomBox: function (position) {
|
||||
if (position instanceof OpenLayers.Bounds) {
|
||||
var bounds;
|
||||
if (!this.out) {
|
||||
var minXY = this.map.getLonLatFromPixel(
|
||||
new OpenLayers.Pixel(position.left, position.bottom));
|
||||
var maxXY = this.map.getLonLatFromPixel(
|
||||
new OpenLayers.Pixel(position.right, position.top));
|
||||
var bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat,
|
||||
bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat,
|
||||
maxXY.lon, maxXY.lat);
|
||||
} else {
|
||||
var pixWidth = Math.abs(position.right-position.left);
|
||||
@@ -70,7 +71,7 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
|
||||
var xmax = center.lon + (extent.getWidth()/2)*zoomFactor;
|
||||
var ymin = center.lat - (extent.getHeight()/2)*zoomFactor;
|
||||
var ymax = center.lat + (extent.getHeight()/2)*zoomFactor;
|
||||
var bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax);
|
||||
bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax);
|
||||
}
|
||||
// always zoom in/out
|
||||
var lastZoom = this.map.getZoom();
|
||||
|
||||
@@ -435,6 +435,14 @@ OpenLayers.Events = OpenLayers.Class({
|
||||
*/
|
||||
includeXY: false,
|
||||
|
||||
/**
|
||||
* Method: clearMouseListener
|
||||
* A version of <clearMouseCache> that is bound to this instance so that
|
||||
* it can be used with <OpenLayers.Event.observe> and
|
||||
* <OpenLayers.Event.stopObserving>.
|
||||
*/
|
||||
clearMouseListener: null,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Events
|
||||
* Construct an OpenLayers.Events object.
|
||||
@@ -458,6 +466,11 @@ OpenLayers.Events = OpenLayers.Class({
|
||||
this.eventHandler = OpenLayers.Function.bindAsEventListener(
|
||||
this.handleBrowserEvent, this
|
||||
);
|
||||
|
||||
// to be used with observe and stopObserving
|
||||
this.clearMouseListener = OpenLayers.Function.bind(
|
||||
this.clearMouseCache, this
|
||||
);
|
||||
|
||||
// if eventTypes is specified, create a listeners list for each
|
||||
// custom application event.
|
||||
@@ -481,6 +494,11 @@ OpenLayers.Events = OpenLayers.Class({
|
||||
destroy: function () {
|
||||
if (this.element) {
|
||||
OpenLayers.Event.stopObservingElement(this.element);
|
||||
if(this.element.hasScrollEvent) {
|
||||
OpenLayers.Event.stopObserving(
|
||||
window, "scroll", this.clearMouseListener
|
||||
);
|
||||
}
|
||||
}
|
||||
this.element = null;
|
||||
|
||||
@@ -532,16 +550,29 @@ OpenLayers.Events = OpenLayers.Class({
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: on
|
||||
* APIMethod: on
|
||||
* Convenience method for registering listeners with a common scope.
|
||||
* Internally, this method calls <register> as shown in the examples
|
||||
* below.
|
||||
*
|
||||
* Example use:
|
||||
* (code)
|
||||
* // register a single listener for the "loadstart" event
|
||||
* events.on({"loadstart", loadStartListener});
|
||||
*
|
||||
* // this is equivalent to the following
|
||||
* events.register("loadstart", undefined, loadStartListener);
|
||||
*
|
||||
* // register multiple listeners to be called with the same `this` object
|
||||
* events.on({
|
||||
* "loadstart": loadStartListener,
|
||||
* "loadend": loadEndListener,
|
||||
* scope: object
|
||||
* });
|
||||
*
|
||||
* // this is equivalent to the following
|
||||
* events.register("loadstart", object, loadStartListener);
|
||||
* events.register("loadstart", object, loadEndListener);
|
||||
* (end)
|
||||
*/
|
||||
on: function(object) {
|
||||
@@ -623,16 +654,29 @@ OpenLayers.Events = OpenLayers.Class({
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: un
|
||||
* APIMethod: un
|
||||
* Convenience method for unregistering listeners with a common scope.
|
||||
* Internally, this method calls <unregister> as shown in the examples
|
||||
* below.
|
||||
*
|
||||
* Example use:
|
||||
* (code)
|
||||
* // unregister a single listener for the "loadstart" event
|
||||
* events.un({"loadstart", loadStartListener});
|
||||
*
|
||||
* // this is equivalent to the following
|
||||
* events.unregister("loadstart", undefined, loadStartListener);
|
||||
*
|
||||
* // unregister multiple listeners with the same `this` object
|
||||
* events.un({
|
||||
* "loadstart": loadStartListener,
|
||||
* "loadend": loadEndListener,
|
||||
* scope: object
|
||||
* });
|
||||
*
|
||||
* // this is equivalent to the following
|
||||
* events.unregister("loadstart", object, loadStartListener);
|
||||
* events.unregister("loadstart", object, loadEndListener);
|
||||
* (end)
|
||||
*/
|
||||
un: function(object) {
|
||||
@@ -773,8 +817,7 @@ OpenLayers.Events = OpenLayers.Class({
|
||||
if (!this.includeXY) {
|
||||
this.clearMouseCache();
|
||||
} else if (!this.element.hasScrollEvent) {
|
||||
OpenLayers.Event.observe(window, 'scroll',
|
||||
OpenLayers.Function.bind(this.clearMouseCache, this));
|
||||
OpenLayers.Event.observe(window, "scroll", this.clearMouseListener);
|
||||
this.element.hasScrollEvent = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,6 +90,10 @@ OpenLayers.Feature = OpenLayers.Class({
|
||||
this.layer.map.removePopup(this.popup);
|
||||
}
|
||||
}
|
||||
// remove the marker from the layer
|
||||
if (this.layer != null && this.marker != null) {
|
||||
this.layer.removeMarker(this.marker);
|
||||
}
|
||||
|
||||
this.layer = null;
|
||||
this.id = null;
|
||||
|
||||
@@ -67,6 +67,13 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
|
||||
* {Object}
|
||||
*/
|
||||
style: null,
|
||||
|
||||
/**
|
||||
* APIProperty: url
|
||||
* {String} If this property is set it will be taken into account by
|
||||
* {<OpenLayers.HTTP>} when upadting or deleting the feature.
|
||||
*/
|
||||
url: null,
|
||||
|
||||
/**
|
||||
* Property: renderIntent
|
||||
@@ -159,6 +166,27 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
|
||||
}
|
||||
return onScreen;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: getVisibility
|
||||
* Determine whether the feature is displayed or not. It may not displayed
|
||||
* because:
|
||||
* - its style display property is set to 'none',
|
||||
* - it doesn't belong to any layer,
|
||||
* - the styleMap creates a symbolizer with display property set to 'none'
|
||||
* for it,
|
||||
* - the layer which it belongs to is not visible.
|
||||
*
|
||||
* Returns:
|
||||
* {Boolean} The feature is currently displayed.
|
||||
*/
|
||||
getVisibility: function() {
|
||||
return !(this.style && this.style.display == 'none' ||
|
||||
!this.layer ||
|
||||
this.layer && this.layer.styleMap &&
|
||||
this.layer.styleMap.createSymbolizer(this, this.renderIntent).display == 'none' ||
|
||||
this.layer && !this.layer.getVisibility());
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: createMarker
|
||||
@@ -332,6 +360,7 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
|
||||
* graphicOpacity - {Number} Opacity (0-1) for an external graphic.
|
||||
* graphicXOffset - {Number} Pixel offset along the positive x axis for displacing an external graphic.
|
||||
* graphicYOffset - {Number} Pixel offset along the positive y axis for displacing an external graphic.
|
||||
* rotation - {Number} For point symbolizers, this is the rotation of a graphic in the clockwise direction about its center point (or any point off center as specified by graphicXOffset and graphicYOffset).
|
||||
* graphicZIndex - {Number} The integer z-index value to use in rendering.
|
||||
* graphicName - {String} Named graphic to use when rendering points. Supported values include "circle" (default),
|
||||
* "square", "star", "x", "cross", "triangle".
|
||||
@@ -349,7 +378,12 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
|
||||
* alignment. Valid values for horizontal alignment: "l"=left, "c"=center, "r"=right. Valid values for vertical
|
||||
* alignment: "t"=top, "m"=middle, "b"=bottom. Example values: "lt", "cm", "rb". The canvas renderer does not
|
||||
* support vertical alignment, it will always use "b".
|
||||
* labelXOffset - {Number} Pixel offset along the positive x axis for displacing the label.
|
||||
* labelYOffset - {Number} Pixel offset along the positive y axis for displacing the label.
|
||||
* labelSelect - {Boolean} If set to true, labels will be selectable using SelectFeature or similar controls.
|
||||
* Default is false.
|
||||
* fontColor - {String} The font color for the label, to be provided like CSS.
|
||||
* fontOpacity - {Number} Opacity (0-1) for the label
|
||||
* fontFamily - {String} The font family for the label, to be provided like in CSS.
|
||||
* fontSize - {String} The font size for the label, to be provided like in CSS.
|
||||
* fontWeight - {String} The font weight for the label, to be provided like in CSS.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user