Compare commits

..

6 Commits

Author SHA1 Message Date
Schuyler Erle
cbc808c5d0 Tagged release candidate 1.0-rc1 for real this time.
git-svn-id: http://svn.openlayers.org/tags/openlayers/release-1.0-rc1@694 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-06-22 20:15:14 +00:00
Schuyler Erle
8608c16344 Adding cleanup phase to build.sh.
git-svn-id: http://svn.openlayers.org/branches/openlayers/1.0@692 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-06-22 20:14:21 +00:00
Schuyler Erle
86d7fa176e Added some fiddling bits of documentation.
git-svn-id: http://svn.openlayers.org/branches/openlayers/1.0@690 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-06-22 20:10:49 +00:00
Schuyler Erle
fd1fdf2f8e Pulled up r686:r688 test fixes from trunk.
git-svn-id: http://svn.openlayers.org/branches/openlayers/1.0@689 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-06-22 19:58:01 +00:00
Schuyler Erle
24b58b5e0b Pulled up r679:r684 from trunk for the IE performance and bug fixes.
git-svn-id: http://svn.openlayers.org/branches/openlayers/1.0@685 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-06-22 19:28:31 +00:00
Schuyler Erle
83197dc4f2 Branching OpenLayers for 1.0 release.
git-svn-id: http://svn.openlayers.org/branches/openlayers/1.0@678 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-06-22 17:17:50 +00:00
243 changed files with 15157 additions and 16495 deletions

1
.gitignore vendored
View File

@@ -1 +0,0 @@
/bin/plovr.jar

View File

@@ -1,49 +0,0 @@
{
"id": "api",
"output-file": "api.js",
"output-wrapper": [
"// Copyright 2012 ...\n",
"(function(){%output%})();"
],
"inputs": "src/ol.export.js",
"paths": [
"src"
],
"define": {
// "goog.dom.ASSUME_STANDARDS_MODE": true,
// "goog.userAgent.ASSUME_MOBILE_WEBKIT": true,
"goog.DEBUG": false,
"ol.API" : true
},
"mode": "ADVANCED",
"level": "VERBOSE",
// "pretty-print": true,
// "debug": true,
// "experimental-compiler-options": {
// "generateExports": true
// },
"checks": {
// acceptable values are "ERROR", "WARNING", and "OFF"
"accessControls": "WARNING",
"visibility": "WARNING",
"checkTypes": "WARNING",
"checkRegExp": "WARNING",
"checkVars": "WARNING",
"deprecated": "WARNING",
"fileoverviewTags": "WARNING",
"invalidCasts": "WARNING",
"missingProperties": "WARNING",
"nonStandardJsDocs": "WARNING",
"undefinedVars": "WARNING"
},
"jsdoc-html-output-path": "jsdoc"
}

127
art/arrows.svg Normal file
View File

@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="18.000000px"
height="18.000000px"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.42"
sodipodi:docbase="/Users/phil/Documents/work/metacarta/2svn.openlayers.net/follower/code/b-edits-1/openlayers/assets/ui_elements"
sodipodi:docname="pan_icons.svg"
inkscape:export-filename="/Users/phil/Documents/work/metacarta/2svn.openlayers.net/follower/code/b-edits-1/openlayers/assets/ui_elements/zoom-minus-mini.png"
inkscape:export-xdpi="90.000000"
inkscape:export-ydpi="90.000000">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.0000000"
inkscape:cx="9.0000000"
inkscape:cy="9.0000000"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:window-width="1226"
inkscape:window-height="800"
inkscape:window-x="42"
inkscape:window-y="22" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="background"
inkscape:groupmode="layer"
id="layer1">
<g
id="g2110">
<path
transform="matrix(0.000000,-1.003160,1.003160,0.000000,-2.844000e-2,18.02844)"
d="M 17.971654 9.0000000 A 8.9716539 8.9716539 0 1 1 0.028346062,9.0000000 A 8.9716539 8.9716539 0 1 1 17.971654 9.0000000 z"
sodipodi:ry="8.9716539"
sodipodi:rx="8.9716539"
sodipodi:cy="9.0000000"
sodipodi:cx="9.0000000"
id="path2059"
style="fill:#00008b;fill-opacity:1.0000000;stroke:none;stroke-width:39.984146;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
sodipodi:type="arc" />
<rect
transform="matrix(0.000000,-1.000000,1.000000,0.000000,0.000000,0.000000)"
y="4.3599998e-06"
x="-9.0000048"
height="18.000000"
width="9.0000000"
id="rect2061"
style="fill:#00008b;fill-opacity:1.0000000;stroke:none;stroke-width:39.984146;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000" />
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="zoom"
style="display:inline">
<text
xml:space="preserve"
style="font-size:18.000000px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125.00000%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1.0000000;stroke:#ffffff;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1.0000000;font-family:Helvetica"
x="3.7485352"
y="-3.4077148"
id="text2114"
sodipodi:linespacing="125.00000%"
transform="scale(1.000000,-1.000000)"><tspan
sodipodi:role="line"
id="tspan2118"
x="3.7485352"
y="-3.4077148"></tspan></text>
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="overlay"
style="display:none">
<path
style="font-size:12.000000px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125.00000%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Verdana"
d="M 2.9678210,9.0332227 C 2.9678314,9.5015070 3.1752531,9.8938504 3.5900866,10.210254 C 3.6463464,10.254553 3.9451742,10.453889 4.4865710,10.808262 L 8.1568835,13.247754 C 8.2693886,13.323691 8.4240759,13.393300 8.6209460,13.456582 C 8.8107943,13.519862 9.0041535,13.551503 9.2010240,13.551504 C 9.5736843,13.551503 9.8936056,13.431269 10.160789,13.190801 C 10.427980,12.950332 10.561574,12.659238 10.561572,12.317520 C 10.561574,11.861896 10.322511,11.488536 9.8443836,11.197442 L 8.5998522,10.428575 L 14.548408,10.428575 C 15.026535,10.428577 15.406221,10.298849 15.687470,10.039395 C 15.968721,9.7799443 16.109345,9.4318977 16.109345,8.9952540 C 16.109345,8.5396330 15.961690,8.1915865 15.666377,7.9511133 C 15.364034,7.7106494 14.980831,7.5904152 14.516767,7.5904102 L 8.6314928,7.5904102 L 9.9920390,6.7076368 C 10.160793,6.5937365 10.290871,6.4481897 10.382274,6.2709962 C 10.466652,6.0874870 10.508840,5.8913153 10.508837,5.6824805 C 10.508840,5.3281127 10.378761,5.0338552 10.118602,4.7997070 C 9.8584498,4.5655745 9.5279814,4.4485043 9.1271961,4.4484962 C 8.7615757,4.4485043 8.4029823,4.5624104 8.0514147,4.7902149 L 3.9697741,7.5239649 C 3.6393151,7.7454540 3.4002529,7.9542820 3.2525866,8.1504493 C 3.0627532,8.3972503 2.9678314,8.6756875 2.9678210,8.9857618 L 2.9678210,9.0332227"
id="text2082"
sodipodi:nodetypes="csccsssscccssscccssssccscc" />
</g>
<g
inkscape:groupmode="layer"
id="layer3"
inkscape:label="pan triangle"
style="display:none">
<path
sodipodi:type="star"
style="fill:#ffffff;fill-opacity:1.0000000;stroke:none;stroke-width:39.984146;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
id="path2107"
sodipodi:sides="3"
sodipodi:cx="6.8031497"
sodipodi:cy="5.1874018"
sodipodi:r1="5.0880113"
sodipodi:r2="2.5440056"
sodipodi:arg1="1.0471976"
sodipodi:arg2="2.0943951"
inkscape:flatsided="false"
inkscape:rounded="0.0000000"
inkscape:randomized="0.0000000"
d="M 9.3471551,9.5937489 L 5.5311469,7.3905753 L 1.7151384,5.1874015 L 5.5311469,2.9842283 L 9.3471555,0.78105489 L 9.3471553,5.1874018 L 9.3471551,9.5937489 z "
transform="matrix(0.000000,-1.331000,1.331000,0.000000,2.038879,16.92102)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.3 KiB

25
art/marker.svg Normal file
View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
]>
<svg version="1.1" id="Layer_1" xmlns:i="&ns_ai;"
xmlns="&ns_svg;" width="20.5" height="24.5" viewBox="0 0 20.5 24.5"
overflow="visible" enable-background="new 0 0 20.5 24.5" xml:space="preserve">
<g i:extraneous="self">
<rect x="0.25" y="0.25" opacity="0" stroke="#000000" stroke-width="1" width="20" height="24"/>
<g id="XMLID_2_">
<g>
<polygon fill="#FF0000" points="10.12,0.6 19.93,7.71 10.06,24.03 0.6,7.58 "/>
</g>
<g>
<polyline fill="none" stroke="#000000" stroke-width="1" points="9.98,24.16 10.06,24.03 19.93,7.71 20.06,7.49 "/>
<polyline fill="none" stroke="#000000" stroke-width="1" points="10.13,24.16 10.06,24.03 0.6,7.58 0.5,7.41 "/>
<polyline fill="none" stroke="#000000" stroke-width="1" points="0.41,7.72 0.6,7.58 10.12,0.6 10.29,0.47 "/>
<polyline fill="none" stroke="#000000" stroke-width="1" points="9.94,0.47 10.12,0.6 19.93,7.71 20.06,7.8 "/>
</g>
</g>
<ellipse stroke="#000000" stroke-width="1" cx="10.125" cy="9.25" rx="1.5" ry="1.5"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg version="1.1" id="Layer_1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"
xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="28.375" height="28" viewBox="0 0 28.375 28"
overflow="visible" enable-background="new 0 0 28.375 28" xml:space="preserve">
<g i:extraneous="self">
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M27.875,1.375"/>
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M0,1.375"/>
<path fill="none" stroke="#FFFFFF" d="M0,27.475"/>
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M1,27.645"/>
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M1,0.544"/>
<line fill="none" stroke="#00008B" x1="0.875" y1="27.5" x2="27.875" y2="27.475"/>
<rect x="0.875" y="1.045" fill="#00008B" width="27.125" height="26"/>
<line fill="none" stroke="#00008B" x1="27.875" y1="26.925" x2="27.875" y2="0.925"/>
<line fill="none" stroke="#FFFFFF" x1="1.375" y1="0.5" x2="27.375" y2="0.5"/>
<line fill="none" stroke="#FFFFFF" x1="0.875" y1="1" x2="0.875" y2="27"/>
<rect x="5.252" y="11.157" transform="matrix(0.7933 -0.6088 0.6088 0.7933 -5.1621 12.1086)" fill="#FFBF00" width="20" height="5"/>
<line fill="#FFBF00" stroke="#000000" x1="8.376" y1="15.783" x2="10.717" y2="18.766"/>
<line fill="#FFBF00" stroke="#000000" x1="11.946" y1="13.043" x2="14.288" y2="16.027"/>
<line fill="#FFBF00" stroke="#000000" x1="15.342" y1="10.437" x2="17.684" y2="13.42"/>
<line fill="#FFBF00" stroke="#000000" x1="18.69" y1="7.869" x2="21.03" y2="10.852"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg version="1.1" id="Layer_1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"
xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="28.375" height="28" viewBox="0 0 28.375 28"
overflow="visible" enable-background="new 0 0 28.375 28" xml:space="preserve">
<g i:extraneous="self">
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M27.875,1.375"/>
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M0,1.375"/>
<path fill="none" stroke="#FFFFFF" d="M0,27.475"/>
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M1,27.645"/>
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M1,0.544"/>
<line fill="none" stroke="#FFFFFF" x1="0.875" y1="27.5" x2="27.875" y2="27.475"/>
<rect x="0.875" y="1.045" fill="#ADD8E6" width="27.125" height="26"/>
<line fill="none" stroke="#FFFFFF" x1="27.875" y1="26.925" x2="27.875" y2="0.925"/>
<line fill="none" stroke="#00008B" x1="1.375" y1="0.5" x2="27.375" y2="0.5"/>
<line fill="none" stroke="#00008B" x1="0.875" y1="1" x2="0.875" y2="27"/>
<rect x="4.252" y="12.157" transform="matrix(0.7933 -0.6088 0.6088 0.7933 -5.9776 11.7065)" fill="#FFBF00" width="20" height="5"/>
<line fill="#FFBF00" stroke="#000000" x1="7.376" y1="16.783" x2="9.717" y2="19.766"/>
<line fill="#FFBF00" stroke="#000000" x1="10.946" y1="14.043" x2="13.288" y2="17.027"/>
<line fill="#FFBF00" stroke="#000000" x1="14.342" y1="11.437" x2="16.684" y2="14.42"/>
<line fill="#FFBF00" stroke="#000000" x1="17.69" y1="8.869" x2="20.03" y2="11.852"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

44
art/panning-hand-off.svg Normal file
View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg version="1.1" id="Layer_1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"
xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="28.375" height="28" viewBox="0 0 28.375 28"
overflow="visible" enable-background="new 0 0 28.375 28" xml:space="preserve">
<g i:extraneous="self">
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M27.875,1.375"/>
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M0,1.375"/>
<path fill="none" stroke="#FFFFFF" d="M0,27.475"/>
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M1,27.645"/>
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M1,0.544"/>
<line fill="none" stroke="#00008B" x1="0.875" y1="27.5" x2="27.875" y2="27.475"/>
<rect x="0.875" y="1.045" fill="#00008B" width="27.125" height="26"/>
<line fill="none" stroke="#00008B" x1="27.875" y1="26.925" x2="27.875" y2="0.925"/>
<line fill="none" stroke="#FFFFFF" x1="1.375" y1="0.5" x2="27.375" y2="0.5"/>
<line fill="none" stroke="#FFFFFF" x1="0.875" y1="1" x2="0.875" y2="27"/>
<path fill="#FFFFFF" stroke="#000000" d="M9.458,22.458c-0.473-0.168-1.02-1.269-1.363-1.695
c-0.479-0.595-0.894-1.245-1.377-1.829c-0.733-0.887-1.356-1.729-1.854-2.764c-0.375-0.782-0.884-1.997-0.005-2.648
c1.036-0.767,2.095-0.162,2.934,0.479c0.844,0.646,1.729,1.18,2.526,1.869c-0.372-0.305-0.548-0.986-0.778-1.421
c-0.253-0.477-0.565-0.906-0.822-1.375c-0.359-0.657-0.767-1.201-1.21-1.823c-0.544-0.763-1.051-1.74-0.925-2.709
c0.133-1.025,0.972-1.527,1.924-1.207c1.202,0.405,1.969,1.692,2.627,2.698c0.636,0.971,1.201,2.159,1.938,3.042
c-0.222-0.209-0.148-0.508-0.155-0.782c-0.01-0.37-0.097-0.626-0.219-0.967c-0.162-0.455-0.219-0.972-0.24-1.45
c-0.034-0.776-0.25-1.465-0.25-2.247c0-0.988-0.14-1.963,0.71-2.631c0.666-0.523,1.649-0.764,2.381-0.248
c1.385,0.976,1.057,2.999,1.209,4.458c0.079,0.759,0.165,1.489,0.2,2.263c0.022,0.496,0.209,1.067,0.168,1.558
c-0.146-0.269-0.113-0.749-0.127-1.057c-0.022-0.502-0.041-0.982-0.115-1.47c-0.114-0.743-0.188-1.564-0.25-2.324
c-0.152-1.877,2.054-3.17,3.301-1.469c0.884,1.206,0.773,2.643,0.773,4.085c0,0.698-0.034,1.251-0.22,1.91
c-0.13,0.459-0.293,1.222-0.239,1.638c0-0.902,0.334-1.697,0.334-2.588c0-0.678-0.272-2.099,0.581-2.334
c1.065-0.294,2.008,0.875,2.428,1.66c0.458,0.855,0.555,1.901,0.409,2.882c-0.318,2.154-0.845,4.227-2.096,6.072
c-0.268,0.396-0.485,0.838-0.79,1.22c-0.361,0.452-0.923,0.772-1.416,1.071c-0.381,0.232-0.764,0.53-1.176,0.604
c-0.822,0.149-1.725,0.157-2.565,0.157c-1.29,0-2.564-0.068-3.832-0.251c-0.799-0.115-2.12,0.153-2.668-0.54"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

44
art/panning-hand-on.svg Normal file
View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg version="1.1" id="Layer_1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"
xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="28.375" height="28" viewBox="0 0 28.375 28"
overflow="visible" enable-background="new 0 0 28.375 28" xml:space="preserve">
<g i:extraneous="self">
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M27.875,1.375"/>
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M0,1.375"/>
<path fill="none" stroke="#FFFFFF" d="M0,27.475"/>
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M1,27.645"/>
<path fill="none" stroke="#00008B" stroke-width="1.5" d="M1,0.544"/>
<line fill="none" stroke="#FFFFFF" x1="0.875" y1="27.5" x2="27.875" y2="27.475"/>
<rect x="0.875" y="1.045" fill="#ADD8E6" width="27.125" height="26"/>
<line fill="none" stroke="#FFFFFF" x1="27.875" y1="26.925" x2="27.875" y2="0.925"/>
<line fill="none" stroke="#00008B" x1="1.375" y1="0.5" x2="27.375" y2="0.5"/>
<line fill="none" stroke="#00008B" x1="0.875" y1="1" x2="0.875" y2="27"/>
<path fill="#FFFFFF" stroke="#000000" d="M8.458,23.458c-0.473-0.168-1.02-1.269-1.363-1.695
c-0.479-0.595-0.894-1.245-1.377-1.829c-0.733-0.887-1.356-1.729-1.854-2.764c-0.375-0.782-0.884-1.997-0.005-2.648
c1.036-0.767,2.095-0.161,2.934,0.479c0.844,0.646,1.729,1.18,2.526,1.869c-0.372-0.305-0.548-0.986-0.778-1.421
c-0.253-0.477-0.565-0.906-0.822-1.375c-0.359-0.657-0.767-1.201-1.21-1.823c-0.544-0.763-1.051-1.74-0.925-2.709
c0.133-1.025,0.972-1.527,1.924-1.207c1.202,0.405,1.969,1.692,2.627,2.698c0.636,0.971,1.201,2.159,1.938,3.042
c-0.222-0.21-0.148-0.509-0.155-0.783c-0.01-0.37-0.097-0.626-0.219-0.967c-0.162-0.455-0.219-0.972-0.24-1.45
c-0.034-0.776-0.25-1.465-0.25-2.247c0-0.988-0.14-1.963,0.71-2.631c0.666-0.523,1.649-0.764,2.381-0.248
c1.385,0.976,1.057,2.999,1.209,4.458c0.079,0.759,0.165,1.489,0.2,2.263c0.022,0.496,0.209,1.068,0.168,1.558
c-0.146-0.27-0.113-0.75-0.127-1.058c-0.022-0.502-0.041-0.982-0.115-1.47c-0.114-0.743-0.188-1.564-0.25-2.324
c-0.152-1.877,2.054-3.17,3.301-1.469c0.884,1.206,0.773,2.643,0.773,4.085c0,0.698-0.034,1.251-0.22,1.91
c-0.13,0.459-0.293,1.222-0.239,1.639c0-0.902,0.334-1.697,0.334-2.589c0-0.678-0.272-2.099,0.581-2.334
c1.065-0.294,2.008,0.875,2.428,1.66c0.458,0.855,0.555,1.901,0.409,2.883c-0.318,2.153-0.845,4.227-2.096,6.071
c-0.268,0.396-0.485,0.838-0.79,1.22c-0.361,0.452-0.923,0.772-1.416,1.071c-0.381,0.232-0.764,0.53-1.176,0.604
c-0.822,0.149-1.725,0.157-2.565,0.157c-1.29,0-2.564-0.068-3.832-0.251c-0.799-0.115-2.12,0.153-2.668-0.54"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

71
art/slider.svg Normal file
View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.41.1"
sodipodi:docbase="/afs/metacarta.com/user/sderle/public_html/ol.zoombar/art"
sodipodi:docname="slider.svg"
inkscape:export-filename="/afs/metacarta.com/user/sderle/public_html/ol.zoombar/img/slider.png"
inkscape:export-xdpi="90.000000"
inkscape:export-ydpi="90.000000">
<defs
id="defs3" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="39.870978"
inkscape:cx="140.00732"
inkscape:cy="695.49796"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1010"
inkscape:window-height="538"
inkscape:window-x="20"
inkscape:window-y="107" />
<metadata
id="metadata4">
<rdf:RDF
id="RDF5">
<cc:Work
rdf:about=""
id="Work6">
<dc:format
id="format7">image/svg+xml</dc:format>
<dc:type
id="type9"
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#00008b;fill-opacity:1.0000000;stroke:#000080;stroke-width:4.9999957;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
id="rect1291"
x="132.50000"
y="354.86218"
width="15.014628"
height="4.0040474" />
<path
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.0000000;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
d="M 134.08880,356.89603 L 146.00000,356.87002"
id="path2052" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

193
art/zoom-world.svg Normal file
View File

@@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
inkscape:export-ydpi="90.000000"
inkscape:export-xdpi="90.000000"
inkscape:export-filename="/Users/phil/Documents/work/metacarta/2svn.openlayers.net/follower/code/b-edits-1/openlayers/assets/ui_elements/zoom-minus-mini.png"
sodipodi:docname="zoom-world.svg"
sodipodi:docbase="/afs/metacarta.com/user/sderle/OL/openlayers/assets/ui_elements"
inkscape:version="0.41.1"
sodipodi:version="0.32"
id="svg2"
height="18.000000px"
width="18.000000px">
<defs
id="defs4" />
<sodipodi:namedview
inkscape:window-y="26"
inkscape:window-x="42"
inkscape:window-height="800"
inkscape:window-width="1226"
inkscape:current-layer="layer5"
inkscape:document-units="px"
inkscape:cy="9.3025513"
inkscape:cx="9.0000000"
inkscape:zoom="1.0000000"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#ffffff"
id="base" />
<metadata
id="metadata7">
<rdf:RDF
id="RDF1295">
<cc:Work
id="Work1297"
rdf:about="">
<dc:format
id="format1299">image/svg+xml</dc:format>
<dc:type
id="type1301"
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
style="display:inline"
id="layer1"
inkscape:groupmode="layer"
inkscape:label="background">
<rect
style="fill:#00008b;fill-opacity:1.0000000;stroke:none;stroke-width:39.984146;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
id="rect2061"
width="18.014498"
height="18.000000"
x="-18.014502"
y="4.3599998e-06"
transform="matrix(0.000000,-1.000000,1.000000,0.000000,0.000000,0.000000)" />
</g>
<g
inkscape:label="graticule"
id="layer5"
inkscape:groupmode="layer">
<g
transform="translate(0.000000,-4.419417e-2)"
id="g2876">
<path
transform="matrix(1.155321,0.000000,0.000000,1.155321,-2.292065,-1.751761)"
d="M 16.869573 9.3188362 A 7.0579743 7.0579743 0 1 1 2.7536244,9.3188362 A 7.0579743 7.0579743 0 1 1 16.869573 9.3188362 z"
sodipodi:ry="7.0579743"
sodipodi:rx="7.0579743"
sodipodi:cy="9.3188362"
sodipodi:cx="9.8115988"
id="path1321"
style="fill:none;fill-opacity:1.0000000;stroke:#ffffff;stroke-width:0.50000000;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
sodipodi:type="arc" />
<path
sodipodi:nodetypes="cc"
id="path2086"
d="M 8.1145142,1.1289949 C 15.315267,9.5238831 8.3963197,17.101449 8.3963197,17.057255"
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.50000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000" />
<path
sodipodi:nodetypes="cc"
id="path2846"
d="M 11.588885,1.3666059 C 18.922222,9.5405232 11.605526,16.764536 11.605526,16.764536"
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.50000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000" />
<path
sodipodi:nodetypes="cc"
id="path2848"
d="M 5.2258471,2.0593951 C 11.080923,9.7405585 5.3432210,16.278941 5.3432210,16.278941"
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.50000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000" />
<path
sodipodi:nodetypes="cc"
id="path2850"
d="M 2.7388198,3.7571959 C 6.3686281,9.1817837 2.9127331,14.361601 2.9127331,14.361601"
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.50000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000" />
</g>
<g
transform="matrix(-6.269315e-2,0.998033,-0.998033,-6.269315e-2,18.62352,0.612232)"
id="g2883">
<path
transform="matrix(1.155321,0.000000,0.000000,1.155321,-2.292065,-1.751761)"
d="M 16.869573 9.3188362 A 7.0579743 7.0579743 0 1 1 2.7536244,9.3188362 A 7.0579743 7.0579743 0 1 1 16.869573 9.3188362 z"
sodipodi:ry="7.0579743"
sodipodi:rx="7.0579743"
sodipodi:cy="9.3188362"
sodipodi:cx="9.8115988"
id="path2885"
style="fill:none;fill-opacity:1.0000000;stroke:#ffffff;stroke-width:0.50000000;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
sodipodi:type="arc" />
<path
sodipodi:nodetypes="cc"
id="path2887"
d="M 8.1145142,1.1289949 C 15.315267,9.5238831 8.3963197,17.101449 8.3963197,17.057255"
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.50000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000" />
<path
sodipodi:nodetypes="cc"
id="path2889"
d="M 11.588885,1.3666059 C 18.922222,9.5405232 11.605526,16.764536 11.605526,16.764536"
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.50000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000" />
<path
sodipodi:nodetypes="cc"
id="path2891"
d="M 5.2258471,2.0593951 C 11.080923,9.7405585 5.3432210,16.278941 5.3432210,16.278941"
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.50000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000" />
<path
sodipodi:nodetypes="cc"
id="path2893"
d="M 2.7388198,3.7571959 C 6.3686281,9.1817837 2.9127331,14.361601 2.9127331,14.361601"
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.50000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000" />
</g>
</g>
<g
style="display:none"
inkscape:label="zoom"
id="layer4"
inkscape:groupmode="layer">
<text
transform="scale(1.000000,-1.000000)"
sodipodi:linespacing="125.00000%"
id="text2114"
y="-3.4077148"
x="3.7485352"
style="font-size:18.000000;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#ffffff;fill-opacity:1.0000000;stroke:#ffffff;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1.0000000;font-family:Helvetica;text-anchor:start;writing-mode:lr-tb"
xml:space="preserve"><tspan
y="-3.4077148"
x="3.7485352"
id="tspan2118"
sodipodi:role="line"></tspan></text>
</g>
<g
style="display:none"
inkscape:label="overlay"
id="layer2"
inkscape:groupmode="layer">
<path
sodipodi:nodetypes="csccsssscccssscccssssccscc"
id="text2082"
d="M 2.9678210,9.0332227 C 2.9678314,9.5015070 3.1752531,9.8938504 3.5900866,10.210254 C 3.6463464,10.254553 3.9451742,10.453889 4.4865710,10.808262 L 8.1568835,13.247754 C 8.2693886,13.323691 8.4240759,13.393300 8.6209460,13.456582 C 8.8107943,13.519862 9.0041535,13.551503 9.2010240,13.551504 C 9.5736843,13.551503 9.8936056,13.431269 10.160789,13.190801 C 10.427980,12.950332 10.561574,12.659238 10.561572,12.317520 C 10.561574,11.861896 10.322511,11.488536 9.8443836,11.197442 L 8.5998522,10.428575 L 14.548408,10.428575 C 15.026535,10.428577 15.406221,10.298849 15.687470,10.039395 C 15.968721,9.7799443 16.109345,9.4318977 16.109345,8.9952540 C 16.109345,8.5396330 15.961690,8.1915865 15.666377,7.9511133 C 15.364034,7.7106494 14.980831,7.5904152 14.516767,7.5904102 L 8.6314928,7.5904102 L 9.9920390,6.7076368 C 10.160793,6.5937365 10.290871,6.4481897 10.382274,6.2709962 C 10.466652,6.0874870 10.508840,5.8913153 10.508837,5.6824805 C 10.508840,5.3281127 10.378761,5.0338552 10.118602,4.7997070 C 9.8584498,4.5655745 9.5279814,4.4485043 9.1271961,4.4484962 C 8.7615757,4.4485043 8.4029823,4.5624104 8.0514147,4.7902149 L 3.9697741,7.5239649 C 3.6393151,7.7454540 3.4002529,7.9542820 3.2525866,8.1504493 C 3.0627532,8.3972503 2.9678314,8.6756875 2.9678210,8.9857618 L 2.9678210,9.0332227"
style="font-size:12.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#ffffff;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Verdana;text-anchor:start;writing-mode:lr-tb" />
</g>
<g
style="display:none"
inkscape:label="pan triangle"
id="layer3"
inkscape:groupmode="layer">
<path
transform="matrix(0.000000,-1.331000,1.331000,0.000000,2.038879,16.92102)"
d="M 9.3471551,9.5937489 L 5.5311469,7.3905753 L 1.7151384,5.1874015 L 5.5311469,2.9842283 L 9.3471555,0.78105489 L 9.3471553,5.1874018 L 9.3471551,9.5937489 z "
inkscape:randomized="0.0000000"
inkscape:rounded="0.0000000"
inkscape:flatsided="false"
sodipodi:arg2="2.0943951"
sodipodi:arg1="1.0471976"
sodipodi:r2="2.5440056"
sodipodi:r1="5.0880113"
sodipodi:cy="5.1874018"
sodipodi:cx="6.8031497"
sodipodi:sides="3"
id="path2107"
style="fill:#ffffff;fill-opacity:1.0000000;stroke:none;stroke-width:39.984146;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
sodipodi:type="star" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

73
art/zoombar.svg Normal file
View File

@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="18"
height="18"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.43"
version="1.0"
inkscape:export-filename="C:\Documents and Settings\crschmidt\Desktop\zoombar.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
sodipodi:docbase="C:\Documents and Settings\crschmidt\Desktop"
sodipodi:docname="zoombar.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="-117.50597"
inkscape:cy="65.94562"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showguides="false"
showgrid="false"
inkscape:window-width="1024"
inkscape:window-height="721"
inkscape:window-x="-4"
inkscape:window-y="-4" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="opacity:0.5;fill:#808080;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000012;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect1307"
width="16.999998"
height="10.000004"
x="-125.51302"
y="-52.420002" />
<path
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.99999958;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.50196078"
d="M -125.54176,-52.415494 L -125.54176,-42.415495"
id="path8297" />
<path
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.99999982;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.50196078"
d="M -108.48157,-52.418044 L -108.48157,-42.418046"
id="path12667" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -1,56 +0,0 @@
OpenLayers contributors:
Antoine Abt
Mike Adair
Jeff Adams
Seb Benthall
Bruno Binet
Stéphane Brunner
Howard Butler
Bertil Chaupis
John Cole
Tim Coulter
Robert Coup
Jeff Dege
Roald de Wit
Schuyler Erle
Christian López Espínola
John Frank
Sean Gilles
Pierre Giraud
Ivan Grcic
Andreas Hocevar
Marc Jansen
Ian Johnson
Frédéric Junod
Eric Lemoine
Philip Lindsay
Martijn van Oosterhout
David Overstrom
Corey Puffault
Peter William Robins
Gregers Rygg
Tim Schaub
Christopher Schmidt
Cameron Shorter
Pedro Simonetti
Paul Spencer
Paul Smith
Glen Stampoultzis
James Stembridge
Erik Uzureau
Bart van den Eijnden
Ivan Willig
Thomas Wood
Bill Woodall
Steve Woodbridge
David Zwarg
Some portions of OpenLayers are used under the Apache 2.0 license, available
in doc/licenses/APACHE-2.0.txt.
Some portions of OpenLayers are used under the MIT license, availabie in
doc/licenses/MIT-LICENSE.txt.
Some portions of OpenLayers are Copyright 2001 Robert Penner, and are used
under the BSD license, available in doc/licenses/BSD-LICENSE.txt

View File

@@ -1,51 +0,0 @@
# Build Utilities
This directory contains utilities used for building OpenLayers applications,
generating the API docs, and building hosted versions of the library.
## Dependencies
OpenLayers is built using [Closure Compiler][closure]. The [plovr][plovr] build
tool simplifies building with Closure Compiler and comes with a built-in version
of the Closure Library and Compiler. Both the Compiler and plovr require Java
version 1.6 or above. This directory includes a bash/batch script for driving
plovr. For pulling down plovr and accessing it in a cross-platform way,
[Ant][ant] is used.
The instructions below assume that you have added the `ol` bash/batch script to
your path (type `ol` and see usage docs to confirm this is set up).
[closure]: https://developers.google.com/closure/compiler/
[plovr]: http://plovr.com/
[ant]: http://ant.apache.org/
## Building an Application
To compile an application together with OpenLayers, you will provide a build
configuration file for the compiler. See the `demo` folder for example
configuration files (e.g. `map.json`).
Compile your application with the `build` command:
ol build path/to/config.json
Substitute the path to your build configuration file above.
## Building the API Docs
From within the root of the OpenLayers directory, use the `doc` command to build
the API docs:
ol doc
This will generate documentation in the `jsdoc` directory.
## Building the Hosted Library
To compile the full OpenLayers api, use the `build` command from the root of the
OpenLayers directory:
ol build
This will generate an `api.js` script in the same directory. (This is equivalent to `ol build path/to/ol/api.json`.)

View File

@@ -1,65 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="ol" default="usage">
<description>
OpenLayers Dev Utilities
</description>
<property name="ol.home" location=".."/>
<property name="plovr.jar" location="${ol.home}/bin/plovr.jar"/>
<property name="main.json" location="${ol.home}/main.json"/>
<property name="build.json" location="${ol.home}/api.json"/>
<target name="usage">
<echo>
Available commands:
serve - Run the library server
build - Builds a minified version of the library or an application
doc - Generate the reference docs
</echo>
</target>
<condition property="plovr.exists">
<available file="${plovr.jar}" type="file"/>
</condition>
<target name="deps" unless="plovr.exists">
<get src="http://plovr.googlecode.com/files/plovr-4b3caf2b7d84.jar"
dest="${plovr.jar}"/>
</target>
<target name="serve" depends="deps">
<java jar="${plovr.jar}" fork="true">
<arg value="serve"/>
<arg value="${main.json}"/>
</java>
</target>
<target name="checkpath">
<condition property="build.json.set">
<isset property="build.json"/>
</condition>
<fail message="Missing build config." unless="build.json.set"/>
<property name="build.json.fullpath" location="${build.json}"/>
<condition property="build.json.exists">
<available file="${build.json.fullpath}" type="file"/>
</condition>
</target>
<target name="build" depends="deps, checkpath">
<fail message="Build config '${build.json.fullpath}' doesn't exist." unless="build.json.exists"/>
<java jar="${plovr.jar}" fork="true">
<arg value="build"/>
<arg value="${build.json}"/>
</java>
</target>
<target name="doc" depends="deps">
<java jar="${plovr.jar}" fork="true">
<arg value="jsdoc"/>
<arg value="${main.json}"/>
</java>
</target>
</project>

44
bin/ol
View File

@@ -1,44 +0,0 @@
#!/bin/bash
ant -version &> /dev/null
if [ $? -ne 0 ]; then
echo 'Requires Apache Ant (see http://ant.apache.org/)'
exit 1
fi
NAME=$(basename -- "$0")
# find ol home
if [ -z "$0" ]; then
# as a last recourse, use the present working directory
OL_HOME=$(pwd)
else
# save original working directory
ORIG_PWD="$(pwd -P)"
# get the absolute path of the executable
SELF_PATH=$(
cd -P -- "$(dirname -- "$0")" \
&& pwd -P
) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
# resolve symlinks
while [ -h "$SELF_PATH" ]; do
DIR=$(dirname -- "$SELF_PATH")
SYM=$(readlink -- "$SELF_PATH")
SELF_PATH=$(cd -- "$DIR" && cd -- $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
done
OL_HOME=$(dirname -- "$(dirname -- "$SELF_PATH")")
# restore original working directory
cd "$ORIG_PWD"
fi
ANT_ARGS=""
if [ $# -gt 1 ]; then
ANT_ARGS=-Dbuild.json="$2"
fi
ant -e -f "$OL_HOME/bin/build.xml" -Dbasedir=. -Dol.home="$OL_HOME" $1 $ANT_ARGS

View File

@@ -1,21 +0,0 @@
@echo off
:: Check for ant on the path
call ant -version >NUL 2>NUL || (
echo Requires Apache Ant ^(see http://ant.apache.org/^)
exit /b 1
)
:: Find the full path of OL_HOME
pushd "%~dp0.."
set OL_HOME="%cd%"
popd
:: Run the command
set COMMAND="%~1"
if "%~1" == "" set COMMAND="usage"
set ANT_ARGS=
if "%~2" == "" set ANT_ARGS="-Dbuild.json=%~2"
ant -e -f %OL_HOME%\bin\build.xml -Dol.home=%OL_HOME% -Dbasedir=. %COMMAND% %ANT_ARGS%

14
build/README.txt Normal file
View File

@@ -0,0 +1,14 @@
## HowTo: Build & deploy "Shrunk" Single File Library version of OpenLayers ##
* Build:
cd build
./build.sh
cd ..
* Upload the result to the server: e.g.
scp build/OpenLayers.js openlayers@openlayers.org:openlayers.org/htdocs/code/

40
build/build.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/sh
#
# Script to build compressed single file version of OpenLayers library
#
OUTPUT_FILENAME=OpenLayers.js
TMP_OUTPUT_FILENAME=tmp.${OUTPUT_FILENAME}
TOOLS_DIR=../tools
CFG_FILENAME=library.cfg
SRC_DIR=../lib
CMD_MERGE_JS=${TOOLS_DIR}/mergejs.py
CMD_SHRINKSAFE=${TOOLS_DIR}/shrinksafe.py
CMD_JSMIN=${TOOLS_DIR}/jsmin.py
LICENSE_HEADER_FILENAME=license.txt
## Generate "fat" single file library version
${CMD_MERGE_JS} -c ${CFG_FILENAME} ${TMP_OUTPUT_FILENAME} ${SRC_DIR}
## Compress ("shrink") the single file library version
echo
echo Shrinking and post-processing...
# (We also append the license header here.)
cat ${LICENSE_HEADER_FILENAME} > ${OUTPUT_FILENAME}
${CMD_JSMIN} <${TMP_OUTPUT_FILENAME} >> ${OUTPUT_FILENAME}
echo Cleaning up...
rm $TMP_OUTPUT_FILENAME
echo
echo Done.

15
build/library.cfg Normal file
View File

@@ -0,0 +1,15 @@
[first]
Prototype.js
Rico/Corner.js
OpenLayers/SingleFile.js
OpenLayers.js
[last]
[exclude]
OpenLayers/Layer/KaMap.js
OpenLayers/Layer/Google.js
OpenLayers/Layer/Yahoo.js
OpenLayers/Layer/VirtualEarth.js
OpenLayers/Layer/WMS/Untiled.js
OpenLayers/Control/KeyboardDefaults.js

43
build/license.txt Normal file
View File

@@ -0,0 +1,43 @@
/*
OpenLayers.js -- OpenLayers Map Viewer Library
Copyright 2005-2006 MetaCarta, Inc., released under the BSD License.
Please see http://svn.openlayers.org/trunk/openlayers/license.txt
for the full text of the license.
Includes compressed code under the following licenses:
(For uncompressed versions of the code used please see the
OpenLayers SVN repository: <http://openlayers.org/>)
*/
/* Prototype JavaScript framework, version 1.4.0
* (c) 2005 Sam Stephenson <sam@conio.net>
*
* Prototype is freely distributable under the terms of an MIT-style license.
* For details, see the Prototype web site: http://prototype.conio.net/
*
/*--------------------------------------------------------------------------*/
/**
*
* Contains portions of Rico <http://openrico.org/>
*
* Copyright 2005 Sabre Airline Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
**/

View File

@@ -1,177 +0,0 @@
.ol-renderer-webgl-canvas { width:100%; height:100%; }
.olTile {
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
/**
* arrow implementation from http://cssarrowplease.com/ for ol-popup
*/
.ol-popup {
position: absolute;
background: #88b7d5;
border: 4px solid #c2e1f5;
}
/**
* FIXME
*/
.ol-popup-close {
background: url("img/close.gif") no-repeat;
cursor: pointer;
position: absolute;
width: 17px;
height: 17px;
right: 0;
}
.ol-popup-top {}
.ol-popup-top:after, .ol-popup-top:before {
bottom: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup-top:after {
border-bottom-color: #88b7d5;
border-width: 30px;
left: 50%;
margin-left: -30px;
}
.ol-popup-top:before {
border-bottom-color: #c2e1f5;
border-width: 36px;
left: 50%;
margin-left: -36px;
}
.ol-popup-bottom {}
.ol-popup-bottom:after, .ol-popup-bottom:before {
top: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup-bottom:after {
border-top-color: #88b7d5;
border-width: 30px;
left: 50%;
margin-left: -30px;
}
.ol-popup-bottom:before {
border-top-color: #c2e1f5;
border-width: 36px;
left: 50%;
margin-left: -36px;
}
.ol-popup-right {}
.ol-popup-right:after, .ol-popup-right:before {
left: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup-right:after {
border-left-color: #88b7d5;
border-width: 30px;
top: 50%;
margin-top: -30px;
}
.ol-popup-right:before {
border-left-color: #c2e1f5;
border-width: 36px;
top: 50%;
margin-top: -36px;
}
.ol-popup-left {}
.ol-popup-left:after, .ol-popup-left:before {
right: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup-left:after {
border-right-color: #88b7d5;
border-width: 30px;
top: 50%;
margin-top: -30px;
}
.ol-popup-left:before {
border-right-color: #c2e1f5;
border-width: 36px;
top: 50%;
margin-top: -36px;
}
.ol-control-zoom {
position: absolute;
top: 8px;
left: 8px;
background: rgba(255,255,255,0.4);
border-radius: 4px;
padding: 2px;
}
.ol-control-zoom a {
display: block;
margin: 1px;
padding: 0;
color: white;
font-size: 18px;
font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
font-weight: bold;
text-decoration: none;
text-align: center;
height: 22px;
width:22px;
line-height: 19px;
background: #130085; /* fallback for IE - IE6 requires background shorthand*/
background: rgba(0, 60, 136, 0.5);
filter: alpha(opacity=80);
}
.ol-control-zoom a:hover {
background: #130085; /* fallback for IE */
background: rgba(0, 60, 136, 0.7);
filter: alpha(opacity=100);
}
@media only screen and (max-width: 600px) {
.ol-control-zoom a:hover {
background: rgba(0, 60, 136, 0.5);
}
}
.ol-control-zoom-in {
border-radius: 4px 4px 0 0;
}
.ol-control-zoom-out {
border-radius: 0 0 4px 4px;
}
.ol-control-attribution {
position: absolute;
font-size: 10px;
text-align: right;
color: #eeeeee;
bottom: 0;
right: 0;
background: #130085; /* fallback for IE - IE6 requires background shorthand*/
background: rgba(0, 60, 136, 0.3);
filter: alpha(opacity=30);
font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
padding: 2px 4px;
}
.ol-control-attribution a {
color: white;
text-decoration: none;
}

View File

@@ -1,26 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>OL3 Hello World</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<script src="../api.js"></script>
<style type="text/css" media="screen">
html, body, #map { width: 100%; height: 100%; border: 0; margin:0; }
</style>
<script type="text/javascript" charset="utf-8">
var map;
function init() {
map = ol.map()
.renderTo('map')
.layers([ol.layer.osm()])
.center([45, 5])
.zoom(10);
}
</script>
</head>
<body onload="init()">
<div id="map"></div>
</body>
</html>

View File

@@ -1,15 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>OL3 Hello World</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
<script src="hello-compiled.js"></script>
<style type="text/css" media="screen">
html, body, #map { width: 100%; height: 100%; border: 0; margin:0; }
</style>
</head>
<body onload="init()">
<div id="map"></div>
</body>
</html>

View File

@@ -1,42 +0,0 @@
{
"id": "hello",
"output-file": "hello-compiled.js",
"inputs": [
"hello.js",
"../src/ol.js"
],
"paths": [
"../src"
],
"define": {
// "goog.dom.ASSUME_STANDARDS_MODE": true,
"goog.DEBUG": false
},
"mode": "ADVANCED",
"level": "VERBOSE",
// "pretty-print": true,
// "debug": true,
// "experimental-compiler-options": {
// "generateExports": true
// },
"checks": {
// acceptable values are "ERROR", "WARNING", and "OFF"
"accessControls": "WARNING",
"visibility": "WARNING",
"checkTypes": "WARNING",
"checkRegExp": "WARNING",
"checkVars": "WARNING",
"deprecated": "WARNING",
"fileoverviewTags": "WARNING",
"invalidCasts": "WARNING",
"missingProperties": "WARNING",
"nonStandardJsDocs": "WARNING",
"undefinedVars": "WARNING"
}
}

View File

@@ -1,42 +0,0 @@
{
"id": "hello-epi",
"output-file": "hello-epi-compiled.js",
"inputs": [
"hello-epi.js"
],
"paths": [
"../src"
],
"define": {
// "goog.dom.ASSUME_STANDARDS_MODE": true,
"goog.DEBUG": false
},
"mode": "ADVANCED",
"level": "VERBOSE",
// "pretty-print": true,
// "debug": true,
// "experimental-compiler-options": {
// "generateExports": true
// },
"checks": {
// acceptable values are "ERROR", "WARNING", and "OFF"
"accessControls": "WARNING",
"visibility": "WARNING",
"checkTypes": "WARNING",
"checkRegExp": "WARNING",
"checkVars": "WARNING",
"deprecated": "WARNING",
"fileoverviewTags": "WARNING",
"invalidCasts": "WARNING",
"missingProperties": "WARNING",
"nonStandardJsDocs": "WARNING",
"undefinedVars": "WARNING"
}
}

View File

@@ -1,16 +0,0 @@
/* This is a code which is going to be compiled together with the library */
goog.require('ol.Map');
goog.require('ol.layer.OSM');
goog.require('ol.Loc');
goog.require('goog.dom');
function init() {
var map = new ol.Map();
map.setContainer(goog.dom.getElement('map'));
map.setLayers( [ new ol.layer.OSM() ] );
map.setCenter( new ol.Loc(45, 5));
map.setZoom(10);
}
window['init'] = init;

View File

@@ -1,10 +0,0 @@
/* This is a code which is going to be compiled together with the library */
function init() {
var map = ol.map()
.renderTo('map')
.layers([ol.layer.osm()])
.center([45, 5])
.zoom(10);
}
window['init'] = init;

View File

@@ -1,7 +0,0 @@
/**
Adds the plovr generated script to the document.
*/
(function() {
var url = "http://" + window.location.hostname + ":9810/compile?id=ol";
document.write("<script type='text/javascript' src='" + url + "'></script>");
})();

View File

@@ -1,17 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>OL3 Map</title>
<script type="text/javascript" src="loader.js"></script>
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<style type="text/css">
#map {
width: 512px; height: 350px;
}
</style>
</head>
<body>
</body>
<div id="map"></div>
<script type="text/javascript" src="map.js"></script>
</html>

View File

@@ -1,6 +0,0 @@
var map = ol.map({
renderTo: 'map',
layers: [ol.layer.osm()],
center: [0, 0],
zoom: 1
});

View File

@@ -1,39 +0,0 @@
/**
* Build configuration for the map.js example. Use following syntax:
*
* ol build map.json
*
* The output will be named map-compiled.js.
*/
{
"id": "hello",
"output-file": "map-compiled.js",
"inputs": ["../src/ol.js", "map.js"],
"paths": ["../src"],
"define": {
"goog.DEBUG": false
},
"mode": "ADVANCED",
"level": "VERBOSE",
// acceptable values are "ERROR", "WARNING", and "OFF"
"checks": {
"accessControls": "WARNING",
"visibility": "WARNING",
"checkTypes": "WARNING",
"checkRegExp": "WARNING",
"checkVars": "WARNING",
"deprecated": "WARNING",
"fileoverviewTags": "WARNING",
"invalidCasts": "WARNING",
"missingProperties": "WARNING",
"nonStandardJsDocs": "WARNING",
"undefinedVars": "WARNING"
}
}

10
doc/authors.txt Normal file
View File

@@ -0,0 +1,10 @@
OpenLayers core development team
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Erik Uzureau
Christopher R. Schmidt
Philip Lindsay
John Frank
Schuyler Erle
OpenLayers is graciously supported by MetaCarta, Inc.
<http://www.metacarta.com>.

39
examples/ciesin.html Normal file
View File

@@ -0,0 +1,39 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
function init(){
var map = new OpenLayers.Map('map');
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
var jpl_wms = new OpenLayers.Layer.WMS( "Population Density 2000",
"http://beta.sedac.ciesin.columbia.edu/mapserver/wms/gpw2000",
{layers: "gpw"});
var cie_wms = new OpenLayers.Layer.WMS( "Human Footprint",
"http://beta.sedac.ciesin.columbia.edu/mapserver/wms/hfoot",
{layers: "hfoot"});
jpl_wms.setVisibility(false);
map.addLayers([ol_wms, jpl_wms, cie_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>

41
examples/click.html Normal file
View File

@@ -0,0 +1,41 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
function init(){
var map = new OpenLayers.Map('map');
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
"http://wms.jpl.nasa.gov/wms.cgi",
{layers: "modis,global_mosaic"});
jpl_wms.setVisibility(false);
map.addLayers([ol_wms, jpl_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
map.events.register("click", map, function(e) {
var lonlat = map.getLonLatFromViewPortPx(e.xy);
alert("You clicked near " + lonlat.lat + " N, " +
+ lonlat.lon + " E");
});
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>

46
examples/controls.html Normal file
View File

@@ -0,0 +1,46 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
function init(){
var map = new OpenLayers.Map('map', { controls: [] });
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'} );
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
"http://wms.jpl.nasa.gov/wms.cgi",
{layers: "modis,global_mosaic"});
var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo",
"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" });
jpl_wms.setVisibility(false);
dm_wms.setVisibility(false);
map.addLayers([ol_wms, jpl_wms, dm_wms]);
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.MouseToolbar());
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>

43
examples/example.html Normal file
View File

@@ -0,0 +1,43 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
function init(){
var map = new OpenLayers.Map('map');
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
"http://wms.jpl.nasa.gov/wms.cgi",
{layers: "modis,global_mosaic"});
var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo",
"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" });
jpl_wms.setVisibility(false);
dm_wms.setVisibility(false);
map.addLayers([ol_wms, jpl_wms, dm_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>

107
examples/freemap.html Normal file
View File

@@ -0,0 +1,107 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
<style type="text/css">
body { font-family: sans-serif; font-weight: bold; font-size: .8em; }
body {
border: 0px;
margin: 0px;
padding: 0px;
}
#map {
width: 65%;
height: 100%;
border: 0px;
padding: 0px;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var lat = 900863;
var lon = 235829;
var zoom = 6;
var map, layer;
function init(){
// these should be object methods or something
map = new OpenLayers.Map( $('map'), {maxExtent: new OpenLayers.Bounds(33861, 717605, 330846, 1019656), maxResolution: 296985/1024, projection:"EPSG:2805" } );
var basemap = new OpenLayers.Layer.WMS( "Boston",
"http://boston.freemap.in/cgi-bin/mapserv?",
{map: '/www/freemap.in/boston/map/mass.map', layers: 'border,water,roads', format: 'png'} );
var rapid = new OpenLayers.Layer.WMS( "Rapid Transit",
"http://boston.freemap.in/cgi-bin/mapserv?",
{map: '/www/freemap.in/boston/map/mass.map', layers: 'rapid_transit', format: 'png', transparent:'true'} );
var buildings = new OpenLayers.Layer.WMS( "Buildings",
"http://boston.freemap.in/cgi-bin/mapserv?",
{map: '/www/freemap.in/boston/map/mass.map', layers: 'buildings', format: 'png', transparent:'true'} );
map.addLayer(basemap);
map.addLayer(rapid);
map.addLayer(buildings);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
function getaddress() {
if (!document.getElementById('address').value) {return; }
document.getElementById('status').innerHTML = "Finding address...";
var address = document.getElementById('address').value;
address = escape(address);
addr = "/geocode.cgi?address="+address;
var handler = XMLrequest();
if (handler) {
handler.onreadystatechange=function() {
if (handler.readyState == 4 && handler.status == 200) {
var latlon = handler.responseText;
latlon = latlon.split(",");
if (latlon[1]) {
map.setCenter(new OpenLayers.LonLat(parseFloat(latlon[1]), parseFloat(latlon[0])), 15);
document.getElementById('status').innerHTML = "";
} else {
document.getElementById('status').innerHTML = "Could not find address, sorry.";
}
}
}
handler.open("GET", addr, true);
handler.send('');
}
}
function XMLrequest() {
xmlhttp={};
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) { }
}
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {}
return xmlhttp;
}
function setLink() {
var link = document.getElementById("link");
var center = map.getCenter();
var zoom = map.getZoom();
link.innerHTML="http://boston.freemap.in/?zoom="+zoom+"&amp;lat="+center.lat+"&amp;lon="+center.lon;
}
// -->
</script>
</head>
<body onload="init()">
<div id="right" style="float:right;width:30%;padding:10px;" ><h1>Boston Free Map</h1><!--Search: <input type="text" id='address' name="address"><input type="submit" value="Go!" onclick="javascript:getaddress()"/>--><div id="status" style="height:20px;min-height:20px;">&nbsp;</div>
<div>Map powered by <a href="http://www.openlayers.org/">OpenLayers</a>
and <a href="http://mapserver.gis.umn.edu/">MapServer</a>.
Data downloaded from
<a href="http://www.mass.gov/mgis/">Office of Geographic and Environmental Information (MassGIS)</a>.</div>
<!--<a onclick="setLink(); return false" href="#" id="update">Update Link</a>
<div id="link"></div>-->
</div>
<div id="map"></div>
</body>
</html>

38
examples/google.html Normal file
View File

@@ -0,0 +1,38 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
background-color: red;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var lon = 5;
var lat = 40;
var zoom = 5;
var map, layer;
function init(){
map = new OpenLayers.Map( $('map') );
gmap = new OpenLayers.Layer.Google( "Google" );
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addLayer(layer);
map.addLayer(gmap);
map.addControl( new OpenLayers.Control.LayerSwitcher() );
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>

33
examples/kamap.html Normal file
View File

@@ -0,0 +1,33 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
function init(){
var map = new OpenLayers.Map('map', {'maxResolution': 1.40625/4});
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
var ka_wms = new OpenLayers.Layer.KaMap( "KaMap",
"http://www.h2guide.com/my-ka-map/h2tile.php?" , { map: 'h2guide', g: 'background' }, new OpenLayers.LonLat(0,0));
map.addLayers([ol_wms, ka_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>

View File

@@ -0,0 +1,52 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var map, layer;
var size, icon;
function init(){
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
map.addLayer(layer);
var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);
size = new OpenLayers.Size(50,50);
calculateOffset = function(size) {
return new OpenLayers.Pixel(-(size.w/2), -size.h);
};
icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',size,null, calculateOffset);
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(-180,90),
icon));
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
function resize() {
size = new OpenLayers.Size(size.w + 10, size.h + 10);
icon.setSize(size);
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
<div style="background-color:purple" onclick="resize()"> click to resize marker</div>
</body>
</html>

44
examples/markers.html Normal file
View File

@@ -0,0 +1,44 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var map, layer;
function init(){
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
map.addLayer(layer);
var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);
var newl = new OpenLayers.Layer.Text( "text", "./textfile.txt" );
map.addLayer(newl);
var size = new OpenLayers.Size(10,17);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
var icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',size,offset);
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon));
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,45),icon));
marker = new OpenLayers.Marker(new OpenLayers.LonLat(90,10),icon);
marker.events.register('mousedown', marker, function(evt) { alert(this.icon.url); Event.stop(evt); });
markers.addMarker(marker);
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>

View File

@@ -0,0 +1,36 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var map, layer;
function init(){
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
map.addLayer(layer);
var newl = new OpenLayers.Layer.Text( "text", "./textfile.txt" );
map.addLayer(newl);
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>

77
examples/markerss.html Normal file
View File

@@ -0,0 +1,77 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var map, layer, popup;
var marker, markers;
function init(){
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
map.addLayer(
new OpenLayers.Layer.WMS("NASA Mosaic",
"http://wms.jpl.nasa.gov/wms.cgi",
{"EXCEPTIONS" : "application/vnd.ogc.se_inimage",
"format" : "image/jpeg",
layers:"modis,global_mosaic"}
));
map.addLayer(layer);
markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
function changer() {
var lon = map.getLonLatFromLayerPx(new OpenLayers.Pixel(0,0)).lon;
var lat = map.getLonLatFromLayerPx(new OpenLayers.Pixel(0,0)).lat;
var slon = map.getLonLatFromViewPortPx(new OpenLayers.Pixel(0,0)).lon;
var slat = map.getLonLatFromViewPortPx(new OpenLayers.Pixel(0,0)).lat;
alert("lon=" + lon + " lat=" + lat
+ "slon=" + slon + " slat=" + slat);
}
function add() {
var icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',new OpenLayers.Size(10,17));
marker = new OpenLayers.Marker(new OpenLayers.LonLat(0,00), icon);
markers.addMarker(marker);
}
function destroy() {
popup.destroy();
}
function remove() {
map.removePopup(popup);
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
<div style="background-color:purple" onclick="add()"> click to add popup to map</div>
<div style="background-color:blue" onclick="changer()"> click to get lon/lat for pixel point(0,0)</div>
<div style="background-color:red" onclick="destroy()"> click to destroy the popup</div>
<div style="background-color:green" onclick="remove()"> click to remove the popup from map</div>
</body>
</html>

142
examples/mvs.html Normal file
View File

@@ -0,0 +1,142 @@
<html>
<!--
OpenLayers Map Viewer Service
Copyright 2005-2006 MetaCarta, Inc., released under the BSD License.
-->
<!--
This probably needs to be renamed index.html for deployment.
Specifically, it needs to be the default page for whatever
directory it is in.
-->
<head>
<script src="../lib/OpenLayers.js"></script>
<script>
// From:
// <http://www.oreilly.com/catalog/jscript3/chapter/ch13.html#JSCRIPT-CH-WINDOWS-EX-LOC>
/*
* This function parses comma-separated name=value argument pairs from
* the query string of the URL. It stores the name=value pairs in
* properties of an object and returns that object.
*/
// +pjl changed to split on ampersand, not comma.
function getArgs() {
var args = new Object();
var query = location.search.substring(1); // Get query string.
var pairs = query.split("&"); // Break at ampersand. //+pjl
for(var i = 0; i < pairs.length; i++) {
var pos = pairs[i].indexOf('='); // Look for "name=value".
if (pos == -1) continue; // If not found, skip.
var argname = pairs[i].substring(0,pos); // Extract the name.
var value = pairs[i].substring(pos+1); // Extract the value.
args[argname] = unescape(value); // Store as a property.
}
return args; // Return the object.
}
function runMVS() {
if (document.location.protocol != "file:") {
theArgs = getArgs();
} else {
theArgs = {};
theArgs.center = "0,0";
theArgs.zoom = "0";
theArgs.data = "textfile.txt";
theArgs.controls = ['panzoom','mouse'];
theArgs.layers = ['openlayers', 'nasa'];
}
// ----
// TODO: Handle all this parsing better.
var safeArgs = {}
var DEFAULT_LAT = 0;
var DEFAULT_LON = 0;
var DEFAULT_ZOOM_LEVEL = 0;
var DEFAULT_CONTROLS = ['panzoom','mouse'];
var DEFAULT_LAYERS = ['openlayers', 'nasa'];
var IDX_LAT = 0;
var IDX_LON = 1;
safeArgs.centerLat = theArgs.center ?
parseFloat(theArgs.center.split(",")[IDX_LAT]) : DEFAULT_LAT;
safeArgs.centerLon = theArgs.center ?
parseFloat(theArgs.center.split(",")[IDX_LON]) : DEFAULT_LON;
safeArgs.zoom = theArgs.zoom ? parseInt(theArgs.zoom) : DEFAULT_ZOOM_LEVEL;
safeArgs.controls = theArgs.controls ?
theArgs.controls.split(",") : DEFAULT_CONTROLS;
safeArgs.controls = theArgs.controls ?
theArgs.controls.split(",") : DEFAULT_CONTROLS;
safeArgs.layers = theArgs.layers ?
theArgs.layers.split(",") : DEFAULT_LAYERS;
safeArgs.data = theArgs.data; // TODO: Make this "safe".
// -----
var theMVS = new OpenLayers.Map($('map'), {controls: []});
for(var i = 0; i < safeArgs.controls.length; i++) {
switch(safeArgs.controls[i]) {
case 'panzoombar':
theMVS.addControl(new OpenLayers.Control.PanZoomBar());
break;
case 'panzoom':
theMVS.addControl(new OpenLayers.Control.PanZoom());
break;
case 'layerswitcher':
theMVS.addControl(new OpenLayers.Control.LayerSwitcher());
break;
case 'mouse':
theMVS.addControl(new OpenLayers.Control.MouseDefaults());
break;
}
}
for(var i = 0; i < safeArgs.layers.length; i++) {
switch(safeArgs.layers[i]) {
case 'openlayers':
theMVS.addLayer(
new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'} )
);
break;
case 'nasa':
theMVS.addLayer(
new OpenLayers.Layer.WMS("NASA Mosaic",
"http://wms.jpl.nasa.gov/wms.cgi",
{"EXCEPTIONS" : "application/vnd.ogc.se_inimage",
"format" : "image/jpeg",
layers:"modis,global_mosaic"}
));
break;
}
}
theMVS.setCenter(new OpenLayers.LonLat(safeArgs.centerLon, safeArgs.centerLat), safeArgs.zoom);
if (safeArgs.data) {
theMVS.addLayer(new OpenLayers.Layer.Text("Data", safeArgs.data));
}
}
</script>
</head>
<body style="margin:0px;"
onload="runMVS();">
<div id="map"
style="width: 100%; height: 100%;
background: lightyellow;
"></div>
</body>
</html>

30
examples/notile.html Normal file
View File

@@ -0,0 +1,30 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
function init(){
var map = new OpenLayers.Map('map');
var ol_wms = new OpenLayers.Layer.WMS.Untiled( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
map.addLayers([ol_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>

129
examples/popups.html Normal file
View File

@@ -0,0 +1,129 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var map, layer, popup;
var markers, feature, marker;
function init(){
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.WMS( "OpenLayers WMS2",
"http://octo.metacarta.com/cgi-bin/mapserv",
{map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'} );
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
function changer() {
popup.setBackgroundColor("red");
popup.setSize(new OpenLayers.Size(100,600));
// popup.moveTo(new OpenLayers.Pixel(120,120));
// popup.setOpacity(.5);
popup.setBorder("2px solid");
popup.setContentHTML("High Chickens");
}
function add() {
popup = new OpenLayers.Popup("chicken",
new OpenLayers.LonLat(5,40),
new OpenLayers.Size(200,200),
"example popup");
map.addPopup(popup);
}
function addAnchor() {
popup = new OpenLayers.Popup.Anchored("chicken",
new OpenLayers.LonLat(5,40),
new OpenLayers.Size(200,200),
"example popup");
map.addPopup(popup);
}
function addMarker() {
markers = new OpenLayers.Layer.Markers("zibo");
map.addLayer(markers);
feature = new OpenLayers.Feature(layer,
new OpenLayers.LonLat(0,0));
marker = feature.createMarker();
markers.addMarker(marker);
marker.events.register("mousedown", marker, mousedown);
}
function mousedown(evt) {
if (popup == null) {
popup = feature.createPopup();
popup.setBackgroundColor("yellow");
popup.setOpacity(0.7);
popup.events.register("mousedown", popup, onPopupMouseDown);
markers.map.addPopup(popup);
} else {
markers.map.removePopup(popup);
popup.destroy();
popup = null;
}
Event.stop(evt);
}
/**
* @param {Event} evt
*/
function onPopupMouseDown(evt) {
markers.map.removePopup(popup);
popup.destroy();
popup = null;
Event.stop(evt);
}
function destroy() {
popup.destroy();
}
function remove() {
markers.removeMarker(marker);
}
function removelayer() {
layer.destroy();
// map.removeLayer(markers);
}
// -->
</script>
</head>
<body onload="init()">
<div id="map"></div>
<div style="background-color:purple" onclick="add()"> click to add Popup to map</div>
<div style="background-color:green" onclick="addMarker()"> click to add a Marker with an AnchoredBubble popup</div>
<div style="background-color:blue" onclick="changer()"> click to modify popup's attributes</div>
<div style="background-color:red" onclick="remove()"> click to remove the popup from map</div>
<div style="background-color:grey" onclick="removelayer()"> click to remove the markers layer</div>
<div style="background-color:orange" onclick="alert(marker.onScreen())"> marker.onscreen()?</div>
<div style="background-color:yellow" onclick="destroy()"> click to destroy the popup from map</div>
</body>
</html>

54
examples/proxy.cgi Executable file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/env python
"""This is a blind proxy that we use to get around browser
restrictions that prevent the Javascript from loading pages not on the
same server as the Javascript. This has several problems: it's less
efficient, it might break some sites, and it's a security risk because
people can use this proxy to browse the web and possibly do bad stuff
with it. If you can get your code signed (see:
http://trac.openlayers.org/wiki/HowToSignJavascript), then you should
modify Parameters.js so that this isn't used. Otherwise, you're stuck
with it. It only loads pages via http and https, but it can load any
content type. XML and HTML are both currently used by Openlayers."""
import urllib
import cgi
fs = cgi.FieldStorage()
url = fs.getvalue('url', "http://openlayers.org")
# Designed to prevent Open Proxy type stuff.
allowedHosts = ['www.openlayers.org', 'openlayers.org', 'octo.metacarta.com', 'merrimack.metacarta.com', 'labs.metacarta.com']
try:
host = url.split("/")[2]
if allowedHosts and not host in allowedHosts:
print "Status: 502 Bad Gateway"
print "Content-Type: text/plain"
print
print "This proxy does not allow you to access that location."
elif url.startswith("http://") or url.startswith("https://"):
y = urllib.urlopen(url)
headers = str(y.info()).split('\n')
for h in headers:
if h.startswith("Content-Type:"):
print h
print
print y.read()
y.close()
else:
print """Content-Type: text/plain
Illegal request."""
except Exception, E:
print "Status: 500 Unexpected Error"
print "Content-Type: text/plain"
print
print "Some unexpected error occurred. Error text was:", E

4
examples/textfile.txt Normal file
View File

@@ -0,0 +1,4 @@
point title description iconSize
10,20 my orange title my orange description 21,25
2,4 my aqua title my aqua description 21,25
42,-71 my purple title my purple description<br/>is great. 21,25

31
examples/tiger.html Normal file
View File

@@ -0,0 +1,31 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
function init(){
var map = new OpenLayers.Map('map', {'maxResolution': 1.2/4, controls:[]});
var ka_wms = new OpenLayers.Layer.KaMap( "KaMap", "http://maps.dmsolutions.ca/demo/us_streets/tile.php", {map:'tiger04', g:'__base__'}, new OpenLayers.LonLat(0,0));
ka_wms.setTileSize(new OpenLayers.Size(300,300));
map.addLayers([ka_wms]); // , ka_wms, kamap_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.MouseToolbar());
map.addControl(new OpenLayers.Control.PanZoomBar());
map.setCenter(new OpenLayers.LonLat(-70, 30), 2);
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>

38
examples/ve.html Normal file
View File

@@ -0,0 +1,38 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var map, layer, velayer;
function init(){
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
map.addLayer(layer);
velayer = new OpenLayers.Layer.VirtualEarth( "VE");
map.addLayer(velayer);
map.setCenter(new OpenLayers.LonLat(-5, 40), 4);
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>

39
examples/wfs.html Normal file
View File

@@ -0,0 +1,39 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var map, layer;
function init(){
OpenLayers.ProxyHost = '/dev/examples/proxy.cgi?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( "OpenLayers WFS",
"http://labs.metacarta.com/search/WFS?",
{q: 'dolphins', maxfeatures: 10} );
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>

38
examples/yahoo.html Normal file
View File

@@ -0,0 +1,38 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var map, layer, velayer;
function init(){
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
map.addLayer(layer);
yahooLayer = new OpenLayers.Layer.Yahoo( "Yahoo");
map.addLayer(yahooLayer);
map.setCenter(new OpenLayers.LonLat(-5, 40), 4);
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>

View File

@@ -1,105 +0,0 @@
/**
* @fileoverview Externs for GeoJSON.
* @see http://geojson.org/geojson-spec.html
* @externs
*/
/**
* @constructor
*/
var GeoJSONCRS = function() {};
/**
* @type {string}
*/
GeoJSONCRS.prototype.type;
/**
* @type {!Object.<string, *>}
*/
GeoJSONCRS.prototype.properties;
/**
* @constructor
*/
var GeoJSONGeometry = function() {};
/**
* @type {string}
*/
GeoJSONGeometry.prototype.type;
/**
* @type {!Array.<number>|!Array.<!Array.<number>>}
*/
GeoJSONGeometry.prototype.coordinates;
/**
* @constructor
*/
var GeoJSONFeature = function() {};
/**
* @type {string}
*/
GeoJSONFeature.prototype.type;
/**
* @type {GeoJSONGeometry}
*/
GeoJSONFeature.prototype.geometry;
/**
* @type {Object.<string, *>}
*/
GeoJSONFeature.prototype.properties;
/**
* @constructor
*/
var GeoJSONFeatureCollection = function() {};
/**
* @type {string}
*/
GeoJSONFeatureCollection.prototype.type;
/**
* @type {!Array.<GeoJSONFeature>}
*/
GeoJSONFeatureCollection.prototype.features;
/**
* @type {!Array.<number>|undefined}
*/
GeoJSONFeatureCollection.prototype.bbox;
/**
* @type {!GeoJSONCRS|undefined}
*/
GeoJSONFeatureCollection.prototype.crs;
/**
* @type {!Object.<string, *>}
*/
GeoJSONFeatureCollection.prototype.properties;

BIN
img/drag-rectangle-off.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
img/drag-rectangle-on.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
img/east-mini.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

BIN
img/marker.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

BIN
img/measuring-stick-off.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
img/measuring-stick-on.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
img/north-mini.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

BIN
img/panning-hand-off.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
img/panning-hand-on.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
img/slider.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

BIN
img/south-mini.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

BIN
img/west-mini.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

BIN
img/zoom-minus-mini.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

BIN
img/zoom-plus-mini.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

BIN
img/zoom-world-mini.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
img/zoombar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

100
lib/OpenLayers.js Normal file
View File

@@ -0,0 +1,100 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
////
/// This blob sucks in all the files in uncompressed form for ease of use
///
OpenLayers = new Object();
OpenLayers._scriptName = "lib/OpenLayers.js";
OpenLayers._getScriptLocation = function () {
var scriptLocation = "";
var SCRIPT_NAME = OpenLayers._scriptName;
var scripts = document.getElementsByTagName('script');
for (var i = 0; i < scripts.length; i++) {
var src = scripts[i].getAttribute('src');
if (src) {
var index = src.lastIndexOf(SCRIPT_NAME);
// is it found, at the end of the URL?
if ((index > -1) && (index + SCRIPT_NAME.length == src.length)) {
scriptLocation = src.slice(0, -SCRIPT_NAME.length);
break;
}
}
}
return scriptLocation;
}
/*
`_OPENLAYERS_SFL_` is a flag indicating this file is being included
in a Single File Library build of the OpenLayers Library.
When we are *not* part of a SFL build we dynamically include the
OpenLayers library code.
When we *are* part of a SFL build we do not dynamically include the
OpenLayers library code as it will be appended at the end of this file.
*/
if (typeof(_OPENLAYERS_SFL_) == "undefined") {
/*
The original code appeared to use a try/catch block
to avoid polluting the global namespace,
we now use a anonymous function to achieve the same result.
*/
(function() {
var jsfiles=new Array(
"Prototype.js",
"Rico/Corner.js",
"Rico/Color.js",
"OpenLayers/Util.js",
"OpenLayers/Ajax.js",
"OpenLayers/Events.js",
"OpenLayers/Map.js",
"OpenLayers/Layer.js",
"OpenLayers/Icon.js",
"OpenLayers/Marker.js",
"OpenLayers/Popup.js",
"OpenLayers/Tile.js",
"OpenLayers/Feature.js",
"OpenLayers/Feature/WFS.js",
"OpenLayers/Tile/Image.js",
"OpenLayers/Tile/WFS.js",
// "OpenLayers/Layer/Google.js",
// "OpenLayers/Layer/VirtualEarth.js",
// "OpenLayers/Layer/Yahoo.js",
"OpenLayers/Layer/Grid.js",
"OpenLayers/Layer/KaMap.js",
"OpenLayers/Layer/Markers.js",
"OpenLayers/Layer/Text.js",
"OpenLayers/Layer/WMS.js",
"OpenLayers/Layer/WFS.js",
"OpenLayers/Layer/WMS/Untiled.js",
"OpenLayers/Popup/Anchored.js",
"OpenLayers/Popup/AnchoredBubble.js",
"OpenLayers/Control.js",
"OpenLayers/Control/MouseDefaults.js",
"OpenLayers/Control/MouseToolbar.js",
"OpenLayers/Control/KeyboardDefaults.js",
"OpenLayers/Control/PanZoom.js",
"OpenLayers/Control/PanZoomBar.js",
"OpenLayers/Control/LayerSwitcher.js"
); // etc.
var allScriptTags = "";
var host = OpenLayers._getScriptLocation() + "lib/";
// check to see if prototype.js was already loaded
// if so, skip the first dynamic include
//
var start=1;
try { x = Prototype; }
catch (e) { start=0; }
for (var i = start; i < jsfiles.length; i++) {
var currentScriptTag = "<script src='" + host + jsfiles[i] + "'></script>";
allScriptTags += currentScriptTag;
}
document.write(allScriptTags);
})();
}

113
lib/OpenLayers/Ajax.js Normal file
View File

@@ -0,0 +1,113 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
OpenLayers.ProxyHost = "/viewer/Crossbrowser/blindproxy.py?url=";
//OpenLayers.ProxyHost = "examples/proxy.cgi?url=";
/**
* Ajax reader for OpenLayers
*
*@uri url to do remote XML http get
*@param 'get' format params (x=y&a=b...)
*@who object to handle callbacks for this request
*@complete the function to be called on success
*@failure the function to be called on failure
*
* example usage from a caller:
*
* caps: function(request) {
* -blah-
* },
*
* OpenLayers.loadURL(url,params,this,caps);
*
* Notice the above example does not provide an error handler; a default empty
* handler is provided which merely logs the error if a failure handler is not
* supplied
*
*/
/**
* @param {} request
*/
OpenLayers.nullHandler = function(request) {
alert("Unhandled request return " + request.statusText);
};
/** Background load a document
*
* @param {String} uri URI of source doc
* @param {String} params Params on get (doesnt seem to work)
* @param {Object} caller object which gets callbacks
* @param {Function} onComplete callback for success
* @param {Function} onFailure callback for failure
*
* Both callbacks optional (though silly)
*/
OpenLayers.loadURL = function(uri, params, caller,
onComplete, onFailure) {
if (OpenLayers.ProxyHost && uri.startsWith("http")) {
uri = OpenLayers.ProxyHost + escape(uri);
if (!params) {
params="";
}
params += "&cachehack=" + new Date().getTime();
}
var success = (onComplete) ? onComplete.bind(caller)
: OpenLayers.nullHandler;
var failure = (onFailure) ? onFailure.bind(caller)
: OpenLayers.nullHandler;
// from prototype.js
new Ajax.Request(uri,
{ method: 'get',
parameters: params,
onComplete: success,
onFailure: failure
}
);
};
/** Parse XML into a doc structure
* @param {String} text
*
* @returns Parsed Ajax Response ??
* @type ?
*/
OpenLayers.parseXMLString = function(text) {
//MS sucks, if the server is bad it dies
var index = text.indexOf('<');
if (index > 0) {
text = text.substring(index);
}
var ajaxResponse = Try.these(
function() {
var xmldom = new ActiveXObject('Microsoft.XMLDOM');
xmldom.loadXML(text);
return xmldom;
},
function() {
return new DOMParser().parseFromString(text, 'text/xml');
},
function() {
var req = new XMLHttpRequest();
req.open("GET", "data:" + "text/xml" +
";charset=utf-8," + encodeURIComponent(text), false);
if (req.overrideMimeType) {
req.overrideMimeType("text/xml");
}
req.send(null);
return req.responseXML;
}
);
return ajaxResponse;
};

63
lib/OpenLayers/Control.js Normal file
View File

@@ -0,0 +1,63 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/**
* @class
*/
OpenLayers.Control = Class.create();
OpenLayers.Control.prototype = {
/** this gets set in the addControl() function in OpenLayers.Map
* @type OpenLayers.Map */
map: null,
/** @type DOMElement */
div: null,
/** @type OpenLayers.Pixel */
position: null,
/**
* @constructor
*/
initialize: function (options) {
Object.extend(this, options);
},
/**
* @param {OpenLayers.Pixel} px
*
* @returns A reference to the DIV DOMElement containing the control
* @type DOMElement
*/
draw: function (px) {
if (this.div == null) {
this.div = OpenLayers.Util.createDiv();
}
if (px != null) {
this.position = px.copyOf();
}
this.moveTo(this.position);
return this.div;
},
/**
* @param {OpenLayers.Pixel} px
*/
moveTo: function (px) {
if ((px != null) && (this.div != null)) {
this.div.style.left = px.x + "px";
this.div.style.top = px.x + "px";
}
},
/**
*/
destroy: function () {
// eliminate circular references
this.map = null;
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Control"
};

View File

@@ -0,0 +1,65 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Control.js
/**
* @class
*/
OpenLayers.Control.KeyboardDefaults = Class.create();
OpenLayers.Control.KeyboardDefaults.prototype =
Object.extend( new OpenLayers.Control(), {
/** @type int */
slideFactor: 50,
/**
* @constructor
*/
initialize: function() {
OpenLayers.Control.prototype.initialize.apply(this, arguments);
},
/**
*
*/
draw: function() {
Event.observe(document,
'keypress',
this.defaultKeyDown.bind(this));
},
/**
* @param {Event} evt
*/
defaultKeyDown: function (evt) {
var slide = this.map.getResolution() * this.slideFactor;
var center = this.map.getCenter();
var newCenter = center.copyOf();
switch(evt.keyCode) {
case Event.KEY_LEFT:
newCenter = newCenter.add( -slide, 0);
break;
case Event.KEY_RIGHT:
newCenter = newCenter.add( slide, 0);
break;
case Event.KEY_UP:
newCenter = newCenter.add( 0, slide);
break;
case Event.KEY_DOWN:
newCenter = newCenter.add( 0, -slide);
break;
}
if (!newCenter.equals(center)) {
this.map.setCenter(newCenter);
Event.stop(evt);
}
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Control.KeyboardDefaults"
});

View File

@@ -0,0 +1,221 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Control.js
/**
* @class
*/
OpenLayers.Control.LayerSwitcher = Class.create();
/** color used in the UI to show a layer is active/displayed
*
* @final
* @type String
*/
OpenLayers.Control.LayerSwitcher.ACTIVE_COLOR = "darkblue";
/** color used in the UI to show a layer is deactivated/hidden
*
* @final
* @type String
*/
OpenLayers.Control.LayerSwitcher.NONACTIVE_COLOR = "lightblue";
OpenLayers.Control.LayerSwitcher.prototype =
Object.extend( new OpenLayers.Control(), {
/** @type String */
activeColor: "",
/** @type String */
nonActiveColor: "",
/** @type String */
mode: "checkbox",
/**
* @constructor
*/
initialize: function(options) {
this.activeColor = OpenLayers.Control.LayerSwitcher.ACTIVE_COLOR;
this.nonActiveColor = OpenLayers.Control.LayerSwitcher.NONACTIVE_COLOR;
this.backdrops = [];
OpenLayers.Control.prototype.initialize.apply(this, arguments);
},
/**
* @returns A reference to the DIV DOMElement containing the switcher tabs
* @type DOMElement
*/
draw: function() {
// initialize our internal div
OpenLayers.Control.prototype.draw.apply(this);
this.div.style.position = "absolute";
this.div.style.top = "10px";
this.div.style.right = "0px";
this.div.style.left = "";
this.div.style.fontFamily = "sans-serif";
this.div.style.color = "white";
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.width = "10em";
this.map.events.register("addlayer", this, this.redraw);
this.map.events.register("removelayer", this, this.redraw);
return this.redraw();
},
/**
* @returns A reference to the DIV DOMElement containing the switcher tabs
* @type DOMElement
*/
redraw: function() {
//clear out previous incarnation of LayerSwitcher tabs
this.div.innerHTML = "";
var visible = false;
for( var i = 0; i < this.map.layers.length; i++) {
if (visible && this.mode == "radio") {
this.map.layers[i].setVisibility(false);
} else {
visible = this.map.layers[i].getVisibility();
}
this.addTab(this.map.layers[i]);
}
return this.div;
},
/**
* @param {event} evt
*/
singleClick: function(evt) {
var div = Event.element(evt);
// See comment about OL #57 fix below.
// If the click occurred on the corner spans we need
// to make sure we act on the actual label tab instead.
div = div.labelElement || div;
var layer = div.layer;
if (this.mode == "radio") {
for(var i=0; i < this.backdrops.length; i++) {
this.setTabActivation(this.backdrops[i], false);
this.backdrops[i].layer.setVisibility(false);
}
this.setTabActivation(div, true);
layer.setVisibility(true);
} else {
var visible = layer.getVisibility();
this.setTabActivation(div, !visible);
layer.setVisibility(!visible);
}
Event.stop(evt);
},
/**
* @private
*
* @param {event} evt
*/
ignoreEvent: function(evt) {
Event.stop(evt);
return false;
},
/**
* @private
*
* @param {OpenLayers.Layer} layer
*/
addTab: function(layer) {
// Outer DIV - for Rico Corners
//
var backdropLabelOuter = document.createElement('div');
backdropLabelOuter.id = "LayerSwitcher_" + layer.name + "_Tab";
backdropLabelOuter.style.marginTop = "4px";
backdropLabelOuter.style.marginBottom = "4px";
// Inner Label - for Rico Corners
//
var backdropLabel = document.createElement('p');
backdropLabel.innerHTML = layer.name;
backdropLabel.style.marginTop = "0px";
backdropLabel.style.marginBottom = "0px";
backdropLabel.style.paddingLeft = "10px";
backdropLabel.style.paddingRight = "10px";
// add reference to layer onto the div for use in event handlers
backdropLabel.layer = layer;
// set event handlers
this._setEventHandlers(backdropLabel);
// add label to div
backdropLabelOuter.appendChild(backdropLabel);
this.backdrops.append(backdropLabel);
// add div to main LayerSwitcher Div
this.div.appendChild(backdropLabelOuter);
Rico.Corner.round(backdropLabelOuter, {corners: "tl bl",
bgColor: "transparent",
color: "white",
blend: false});
// extend the event handlers to operate on the
// rounded corners as well. (Fixes OL #57.)
var spanElements=backdropLabel.parentNode.getElementsByTagName("span");
for (var currIdx = 0; currIdx < spanElements.length; currIdx++) {
this._setEventHandlers(spanElements[currIdx], backdropLabel);
}
this.setTabActivation(backdropLabel, layer.getVisibility());
},
/*
@private
@param {DOMElement} div
@param {Boolean} activate
*/
_setEventHandlers : function(element, labelDiv) {
// We only want to respond to a mousedown event.
element.onclick = this.ignoreEvent.bindAsEventListener(this);
element.ondblclick = this.ignoreEvent.bindAsEventListener(this);
element.onmousedown = this.singleClick.bindAsEventListener(this);
// If we are operating on a corner span we need to store a
// reference to the actual tab. (See comment about OL #57 fix above.)
if (labelDiv) {
element.labelElement = labelDiv;
}
},
/**
* @private
*
* @param {DOMElement} div
* @param {Boolean} activate
*/
setTabActivation:function(div, activate) {
var color = (activate) ? this.activeColor : this.nonActiveColor;
Rico.Corner.changeColor(div, color);
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Control.LayerSwitcher"
});

View File

@@ -0,0 +1,127 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Control.js
OpenLayers.Control.MouseDefaults = Class.create();
OpenLayers.Control.MouseDefaults.prototype =
Object.extend( new OpenLayers.Control(), {
performedDrag: false,
initialize: function() {
OpenLayers.Control.prototype.initialize.apply(this, arguments);
},
draw: function() {
this.map.events.register( "click", this, this.defaultClick );
this.map.events.register( "dblclick", this, this.defaultDblClick );
this.map.events.register( "mousedown", this, this.defaultMouseDown );
this.map.events.register( "mouseup", this, this.defaultMouseUp );
this.map.events.register( "mousemove", this, this.defaultMouseMove );
this.map.events.register( "mouseout", this, this.defaultMouseOut );
},
defaultClick: function (evt) {
var notAfterDrag = !this.performedDrag;
this.performedDrag = false;
return notAfterDrag;
},
/**
* @param {Event} evt
*/
defaultDblClick: function (evt) {
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
this.map.setCenter(newCenter, this.map.zoom + 1);
},
/**
* @param {Event} evt
*/
defaultMouseDown: function (evt) {
this.mouseDragStart = evt.xy.copyOf();
this.performedDrag = false;
if (evt.shiftKey) {
this.map.div.style.cursor = "crosshair";
this.zoomBox = OpenLayers.Util.createDiv('zoomBox',
this.mouseDragStart,
null,
null,
"absolute",
"2px solid red");
this.zoomBox.style.backgroundColor = "white";
this.zoomBox.style.filter = "alpha(opacity=50)"; // IE
this.zoomBox.style.opacity = "0.50";
this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;
this.map.viewPortDiv.appendChild(this.zoomBox);
}
document.onselectstart=function() { return false; }
Event.stop(evt);
},
/**
* @param {Event} evt
*/
defaultMouseMove: function (evt) {
if (this.mouseDragStart != null) {
if (this.zoomBox) {
var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x);
var deltaY = Math.abs(this.mouseDragStart.y - evt.xy.y);
this.zoomBox.style.width = deltaX+"px";
this.zoomBox.style.height = deltaY+"px";
if (evt.xy.x < this.mouseDragStart.x) {
this.zoomBox.style.left = evt.xy.x+"px";
}
if (evt.xy.y < this.mouseDragStart.y) {
this.zoomBox.style.top = evt.xy.y+"px";
}
} else {
var deltaX = this.mouseDragStart.x - evt.xy.x;
var deltaY = this.mouseDragStart.y - evt.xy.y;
var size = this.map.getSize();
var newXY = new OpenLayers.Pixel(size.w / 2 + deltaX,
size.h / 2 + deltaY);
var newCenter = this.map.getLonLatFromViewPortPx( newXY );
this.map.setCenter(newCenter, null, true);
this.mouseDragStart = evt.xy.copyOf();
this.map.div.style.cursor = "move";
}
this.performedDrag = true;
}
},
/**
* @param {Event} evt
*/
defaultMouseUp: function (evt) {
if (this.zoomBox) {
var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart );
var end = this.map.getLonLatFromViewPortPx( evt.xy );
var top = Math.max(start.lat, end.lat);
var bottom = Math.min(start.lat, end.lat);
var left = Math.min(start.lon, end.lon);
var right = Math.max(start.lon, end.lon);
var bounds = new OpenLayers.Bounds(left, bottom, right, top);
var zoom = this.map.getZoomForExtent(bounds);
this.map.setCenter(new OpenLayers.LonLat(
(start.lon + end.lon) / 2,
(start.lat + end.lat) / 2
), zoom);
this.map.viewPortDiv.removeChild(document.getElementById("zoomBox"));
this.zoomBox = null;
} else {
this.map.setCenter(this.map.center);
}
document.onselectstart=null;
this.mouseDragStart = null;
this.map.div.style.cursor = "default";
},
defaultMouseOut: function (evt) {
if (this.mouseDragStart != null
&& OpenLayers.Util.mouseLeft(evt, this.map.div)) {
this.defaultMouseUp(evt);
}
}
});

View File

@@ -0,0 +1,263 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Control.js
OpenLayers.Control.MouseToolbar = Class.create();
OpenLayers.Control.MouseToolbar.X = 6;
OpenLayers.Control.MouseToolbar.Y = 300;
OpenLayers.Control.MouseToolbar.prototype =
Object.extend( new OpenLayers.Control(), {
mode: null,
buttons: null,
direction: "vertical",
initialize: function(position, direction) {
OpenLayers.Control.prototype.initialize.apply(this, arguments);
this.position = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,
OpenLayers.Control.MouseToolbar.Y);
if (position) {
this.position = position;
}
if (direction) {
this.direction = direction;
}
this.measureDivs = [];
},
draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments);
this.buttons = new Object();
this.map.events.register( "dblclick", this, this.defaultDblClick );
this.map.events.register( "mousedown", this, this.defaultMouseDown );
this.map.events.register( "mouseup", this, this.defaultMouseUp );
this.map.events.register( "mousemove", this, this.defaultMouseMove );
this.map.events.register( "mouseout", this, this.defaultMouseOut );
var sz = new OpenLayers.Size(28,28);
var centered = this.position;
this._addButton("zoombox", "drag-rectangle-off.png", "drag-rectangle-on.png", centered, sz, "Shift->Drag to zoom to area");
centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0));
this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", centered, sz, "Drag the map to pan.");
centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0));
this._addButton("measure", "measuring-stick-off.png", "measuring-stick-on.png", centered, sz, "Hold alt when clicking to show distance between selected points");
this.switchModeTo("pan");
this.map.events.register("zoomend", this, function() { this.switchModeTo("pan"); });
return this.div;
},
_addButton:function(id, img, activeImg, xy, sz, title) {
var imgLocation = OpenLayers.Util.getImagesLocation() + img;
var activeImgLocation = OpenLayers.Util.getImagesLocation() + activeImg;
// var btn = new ol.AlphaImage("_"+id, imgLocation, xy, sz);
var btn = OpenLayers.Util.createAlphaImageDiv(
"OpenLayers_Control_MouseToolbar_" + id,
xy, sz, imgLocation, "absolute");
//we want to add the outer div
this.div.appendChild(btn);
btn.imgLocation = imgLocation;
btn.activeImgLocation = activeImgLocation;
btn.events = new OpenLayers.Events(this, btn);
btn.events.register("mousedown", this, this.buttonClick);
btn.events.register("mouseup", this, this.stopAction);
btn.action = id;
btn.title = title;
btn.alt = title;
btn.map = this.map;
//we want to remember/reference the outer div
this.buttons[id] = btn;
return btn;
},
stopAction: function(evt) {
Event.stop(evt);
},
buttonClick: function(evt) {
this.switchModeTo(evt.div.action);
Event.stop(evt);
},
/**
* @param {Event} evt
*/
defaultDblClick: function (evt) {
this.switchModeTo("pan");
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
this.map.setCenter(newCenter, this.map.zoom + 2);
},
/**
* @param {Event} evt
*/
defaultMouseDown: function (evt) {
this.mouseDragStart = evt.xy.copyOf();
if (evt.shiftKey && this.mode !="zoombox") {
this.switchModeTo("zoombox");
} else if (evt.altKey && this.mode !="measure") {
this.switchModeTo("measure");
} else if (!this.mode) {
this.switchModeTo("pan");
}
switch (this.mode) {
case "zoombox":
this.map.div.style.cursor = "crosshair";
this.zoomBox = OpenLayers.Util.createDiv('zoomBox',
this.mouseDragStart,
null,
null,
"absolute",
"2px solid red");
this.zoomBox.style.backgroundColor = "white";
this.zoomBox.style.filter = "alpha(opacity=50)"; // IE
this.zoomBox.style.opacity = "0.50";
this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;
this.map.viewPortDiv.appendChild(this.zoomBox);
break;
case "measure":
var distance = "";
if (this.measureStart) {
measureEnd = this.map.getLonLatFromViewPortPx(this.mouseDragStart);
distance = OpenLayers.Util.distVincenty(this.measureStart, measureEnd);
distance = Math.round(distance * 100) / 100;
distance = distance + "km";
this.measureStartBox = this.measureBox;
}
this.measureStart = this.map.getLonLatFromViewPortPx(this.mouseDragStart);;
this.measureBox = OpenLayers.Util.createDiv(null,
this.mouseDragStart.add(
-2-parseInt(this.map.layerContainerDiv.style.left),
-2-parseInt(this.map.layerContainerDiv.style.top)),
null,
null,
"absolute");
this.measureBox.style.width="4px";
this.measureBox.style.height="4px";
this.measureBox.style.backgroundColor="red";
this.measureBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;
this.map.layerContainerDiv.appendChild(this.measureBox);
if (distance) {
this.measureBoxDistance = OpenLayers.Util.createDiv(null,
this.mouseDragStart.add(
-2-parseInt(this.map.layerContainerDiv.style.left),
2-parseInt(this.map.layerContainerDiv.style.top)),
null,
null,
"absolute");
this.measureBoxDistance.innerHTML = distance;
this.measureBoxDistance.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;
this.map.layerContainerDiv.appendChild(this.measureBoxDistance);
this.measureDivs.append(this.measureBoxDistance);
}
this.measureBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;
this.map.layerContainerDiv.appendChild(this.measureBox);
this.measureDivs.append(this.measureBox);
break;
default:
this.map.div.style.cursor = "move";
break;
}
document.onselectstart = function() { return false; }
Event.stop(evt);
},
switchModeTo: function(mode) {
if (mode != this.mode) {
if (this.mode) {
this.buttons[this.mode].firstChild.src = this.buttons[this.mode].imgLocation;
}
if (this.mode == "measure" && mode != "measure") {
for(var i = 0; i < this.measureDivs.length; i++) {
if (this.measureDivs[i]) {
this.map.layerContainerDiv.removeChild(this.measureDivs[i]);
}
}
this.measureDivs = [];
this.measureStart = null;
}
this.mode = mode;
this.buttons[mode].firstChild.src = this.buttons[mode].activeImgLocation;
}
},
leaveMode: function() {
this.switchModeTo("pan");
},
/**
* @param {Event} evt
*/
defaultMouseMove: function (evt) {
if (this.mouseDragStart != null) {
switch (this.mode) {
case "zoombox":
var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x);
var deltaY = Math.abs(this.mouseDragStart.y - evt.xy.y);
this.zoomBox.style.width = deltaX+"px";
this.zoomBox.style.height = deltaY+"px";
if (evt.xy.x < this.mouseDragStart.x) {
this.zoomBox.style.left = evt.xy.x+"px";
}
if (evt.xy.y < this.mouseDragStart.y) {
this.zoomBox.style.top = evt.xy.y+"px";
}
break;
default:
var deltaX = this.mouseDragStart.x - evt.xy.x;
var deltaY = this.mouseDragStart.y - evt.xy.y;
var size = this.map.getSize();
var newXY = new OpenLayers.Pixel(size.w / 2 + deltaX,
size.h / 2 + deltaY);
var newCenter = this.map.getLonLatFromViewPortPx( newXY );
this.map.setCenter(newCenter, null, true);
this.mouseDragStart = evt.xy.copyOf();
}
}
},
/**
* @param {Event} evt
*/
defaultMouseUp: function (evt) {
switch (this.mode) {
case "zoombox":
var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart );
var end = this.map.getLonLatFromViewPortPx( evt.xy );
var top = Math.max(start.lat, end.lat);
var bottom = Math.min(start.lat, end.lat);
var left = Math.min(start.lon, end.lon);
var right = Math.max(start.lon, end.lon);
var bounds = new OpenLayers.Bounds(left, bottom, right, top);
var zoom = this.map.getZoomForExtent(bounds);
this.map.setCenter(new OpenLayers.LonLat(
(start.lon + end.lon) / 2,
(start.lat + end.lat) / 2
), zoom);
this.map.viewPortDiv.removeChild(document.getElementById("zoomBox"));
this.zoomBox = null;
this.leaveMode();
break;
case "pan":
this.map.setCenter(this.map.center);
}
document.onselectstart = null;
this.mouseDragStart = null;
this.map.div.style.cursor = "default";
},
defaultMouseOut: function (evt) {
if (this.mouseDragStart != null
&& OpenLayers.Util.mouseLeft(evt, this.map.div)) {
this.defaultMouseUp(evt);
}
}
});

View File

@@ -0,0 +1,163 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Control.js
/**
* @class
*
* default zoom/pan controls
*/
OpenLayers.Control.PanZoom = Class.create();
OpenLayers.Control.PanZoom.X = 4;
OpenLayers.Control.PanZoom.Y = 4;
OpenLayers.Control.PanZoom.prototype =
Object.extend( new OpenLayers.Control(), {
/** @type int */
slideFactor: 50,
/** @type Array of Button Divs */
buttons: null,
/** @type OpenLayers.Pixel */
position: null,
/**
* @constructor
*/
initialize: function() {
OpenLayers.Control.prototype.initialize.apply(this, arguments);
this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,
OpenLayers.Control.PanZoom.Y);
},
/**
* @param {OpenLayers.Pixel} px
*
* @returns A reference to the container div for the PanZoom control
* @type DOMElement
*/
draw: function(px) {
// initialize our internal div
OpenLayers.Control.prototype.draw.apply(this, arguments);
px = this.position;
// place the controls
this.buttons = new Array();
var sz = new OpenLayers.Size(18,18);
var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);
this._addButton("panup", "north-mini.png", centered, sz);
px.y = centered.y+sz.h;
this._addButton("panleft", "west-mini.png", px, sz);
this._addButton("panright", "east-mini.png", px.add(sz.w, 0), sz);
this._addButton("pandown", "south-mini.png",
centered.add(0, sz.h*2), sz);
this._addButton("zoomin", "zoom-plus-mini.png",
centered.add(0, sz.h*3+5), sz);
this._addButton("zoomworld", "zoom-world-mini.png",
centered.add(0, sz.h*4+5), sz);
this._addButton("zoomout", "zoom-minus-mini.png",
centered.add(0, sz.h*5+5), sz);
return this.div;
},
/**
* @param {String} id
* @param {String} img
* @param {OpenLayers.Pixel} xy
* @param {OpenLayers.Size} sz
*
* @returns A Div (an alphaImageDiv, to be precise) that contains the
* image of the button, and has all the proper event handlers
* set.
* @type DOMElement
*/
_addButton:function(id, img, xy, sz) {
var imgLocation = OpenLayers.Util.getImagesLocation() + img;
// var btn = new ol.AlphaImage("_"+id, imgLocation, xy, sz);
var btn = OpenLayers.Util.createAlphaImageDiv(
"OpenLayers_Control_PanZoom_" + id,
xy, sz, imgLocation, "absolute");
//we want to add the outer div
this.div.appendChild(btn);
btn.onmousedown = this.buttonDown.bindAsEventListener(btn);
btn.ondblclick = this.doubleClick.bindAsEventListener(btn);
btn.onclick = this.doubleClick.bindAsEventListener(btn);
btn.action = id;
btn.map = this.map;
btn.slideFactor = this.slideFactor;
//we want to remember/reference the outer div
this.buttons.push(btn);
return btn;
},
/**
* @param {event} evt
*
* @type Boolean
*/
doubleClick: function (evt) {
Event.stop(evt);
return false;
},
/**
* @param {event} evt
*/
buttonDown: function (evt) {
var slide = this.map.getResolution() * this.slideFactor;
var center = this.map.getCenter();
var newCenter = center.copyOf();
switch (this.action) {
case "panup":
newCenter = newCenter.add( 0, slide);
break;
case "pandown":
newCenter = newCenter.add( 0, -slide);
break;
case "panleft":
newCenter = newCenter.add( -slide, 0);
break;
case "panright":
newCenter = newCenter.add( slide, 0);
break;
case "zoomin":
this.map.zoomIn();
break;
case "zoomout":
this.map.zoomOut();
break;
case "zoomworld":
this.map.zoomToFullExtent();
break;
}
if (!newCenter.equals(center)) {
this.map.setCenter(newCenter);
}
Event.stop(evt);
},
/**
*
*/
destroy: function() {
OpenLayers.Control.prototype.destroy.apply(this, arguments);
for(i=0; i<this.buttons.length; i++) {
this.buttons[i].map = null;
}
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Control.PanZoom"
});

View File

@@ -0,0 +1,199 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Control/PanZoom.js
//
// default zoom/pan controls
//
OpenLayers.Control.PanZoomBar = Class.create();
OpenLayers.Control.PanZoomBar.X = 4;
OpenLayers.Control.PanZoomBar.Y = 4;
OpenLayers.Control.PanZoomBar.prototype =
Object.extend( new OpenLayers.Control.PanZoom(), {
/** @type Array(...) */
buttons: null,
/** @type int */
zoomStopWidth: 18,
/** @type int */
zoomStopHeight: 11,
initialize: function() {
OpenLayers.Control.PanZoom.prototype.initialize.apply(this, arguments);
this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoomBar.X,
OpenLayers.Control.PanZoomBar.Y);
},
/**
* @param {OpenLayers.Pixel} px
*/
draw: function(px) {
// initialize our internal div
OpenLayers.Control.prototype.draw.apply(this, arguments);
px = this.position;
// place the controls
this.buttons = new Array();
var sz = new OpenLayers.Size(18,18);
var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);
this._addButton("panup", "north-mini.png", centered, sz);
px.y = centered.y+sz.h;
this._addButton("panleft", "west-mini.png", px, sz);
this._addButton("panright", "east-mini.png", px.add(sz.w, 0), sz);
this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz);
this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz);
centered = this._addZoomBar(centered.add(0, sz.h*4 + 5));
this._addButton("zoomout", "zoom-minus-mini.png", centered, sz);
return this.div;
},
/**
* @param {OpenLayers.Pixel} location where zoombar drawing is to start.
*/
_addZoomBar:function(centered) {
var imgLocation = OpenLayers.Util.getImagesLocation();
var id = "OpenLayers_Control_PanZoomBar_Slider" + this.map.id;
var slider = OpenLayers.Util.createAlphaImageDiv(id,
centered.add(-1,
(this.map.getZoomLevels())*this.zoomStopHeight),
new OpenLayers.Size(20,9),
imgLocation+"slider.png",
"absolute");
this.slider = slider;
this.sliderEvents = new OpenLayers.Events(this, slider);
this.sliderEvents.register("mousedown", this, this.zoomBarDown);
this.sliderEvents.register("mousemove", this, this.zoomBarDrag);
this.sliderEvents.register("mouseup", this, this.zoomBarUp);
this.sliderEvents.register("dblclick", this, this.doubleClick);
this.sliderEvents.register("click", this, this.doubleClick);
sz = new OpenLayers.Size();
sz.h = this.zoomStopHeight*(this.map.getZoomLevels()+1);
sz.w = this.zoomStopWidth;
var div = null
if (OpenLayers.Util.alphaHack()) {
var id = "OpenLayers_Control_PanZoomBar" + this.map.id;
div = OpenLayers.Util.createAlphaImageDiv(id, centered,
new OpenLayers.Size(sz.w,
this.zoomStopHeight),
imgLocation + "zoombar.png",
"absolute", null, "crop");
div.style.height = sz.h;
} else {
div = OpenLayers.Util.createDiv(
'OpenLayers_Control_PanZoomBar_Zoombar' + this.map.id,
centered,
sz,
imgLocation+"zoombar.png");
}
this.zoombarDiv = div;
this.divEvents = new OpenLayers.Events(this, div);
this.divEvents.register("mousedown", this, this.divClick);
this.divEvents.register("mousemove", this, this.passEventToSlider);
this.divEvents.register("dblclick", this, this.doubleClick);
this.divEvents.register("click", this, this.doubleClick);
this.div.appendChild(div);
this.startTop = parseInt(div.style.top);
this.div.appendChild(slider);
this.map.events.register("zoomend", this, this.moveZoomBar);
centered = centered.add(0,
this.zoomStopHeight*(this.map.getZoomLevels()+1));
return centered;
},
/*
* @param evt
* This function is used to pass events that happen on the div, or the map,
* through to the slider, which then does its moving thing.
*/
passEventToSlider:function(evt) {
this.sliderEvents.handleBrowserEvent(evt);
},
/*
* divClick: Picks up on clicks directly on the zoombar div
* and sets the zoom level appropriately.
*/
divClick: function (evt) {
var y = evt.xy.y;
var top = Position.page(evt.object)[1];
var levels = Math.floor((y - top)/this.zoomStopHeight);
this.map.zoomTo(this.map.getZoomLevels() - levels);
Event.stop(evt);
},
/*
* @param evt
* event listener for clicks on the slider
*/
zoomBarDown:function(evt) {
this.map.events.register("mousemove", this, this.passEventToSlider);
this.map.events.register("mouseup", this, this.passEventToSlider);
this.mouseDragStart = evt.xy.copyOf();
this.zoomStart = evt.xy.copyOf();
this.div.style.cursor = "move";
Event.stop(evt);
},
/*
* @param evt
* This is what happens when a click has occurred, and the client is dragging.
* Here we must ensure that the slider doesn't go beyond the bottom/top of the
* zoombar div, as well as moving the slider to its new visual location
*/
zoomBarDrag:function(evt) {
if (this.mouseDragStart != null) {
var deltaY = this.mouseDragStart.y - evt.xy.y
var offsets = Position.page(this.zoombarDiv);
if ((evt.clientY - offsets[1]) > 0 &&
(evt.clientY - offsets[1]) < parseInt(this.zoombarDiv.style.height) - 2) {
var newTop = parseInt(this.slider.style.top) - deltaY;
this.slider.style.top = newTop+"px";
}
this.mouseDragStart = evt.xy.copyOf();
}
Event.stop(evt);
},
/*
* @param evt
* Perform cleanup when a mouseup event is received -- discover new zoom level
* and switch to it.
*/
zoomBarUp:function(evt) {
if (this.zoomStart) {
this.div.style.cursor="default";
this.map.events.remove("mousemove");
this.map.events.remove("mouseup");
var deltaY = this.zoomStart.y - evt.xy.y
this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight));
this.moveZoomBar();
this.mouseDragStart = null;
Event.stop(evt);
}
},
/*
* Change the location of the slider to match the current zoom level.
*/
moveZoomBar:function() {
var newTop =
(this.map.getZoomLevels() - this.map.getZoom()) * this.zoomStopHeight
+ this.startTop + 1;
this.slider.style.top = newTop + "px";
},
CLASS_NAME: "OpenLayers.Control.PanZoomBar"
});

124
lib/OpenLayers/Events.js Normal file
View File

@@ -0,0 +1,124 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
OpenLayers.Events = Class.create();
OpenLayers.Events.prototype = {
// Array: supported events
BROWSER_EVENTS: [
"mouseover", "mouseout",
"mousedown", "mouseup", "mousemove",
"click", "dblclick",
"resize", "focus", "blur"
],
// hash of Array(Function): events listener functions
listeners: null,
// Object: the code object issuing application events
object: null,
// DOMElement: the DOM element receiving browser events
div: null,
// Array: list of support application events
eventTypes: null,
/**
* @param {OpenLayers.Map} map
* @param {DOMElement} div
*/
initialize: function (object, div, eventTypes) {
this.listeners = {};
this.object = object;
this.div = div;
this.eventTypes = eventTypes;
if (eventTypes) {
for (var i = 0; i < this.eventTypes.length; i++) {
// create a listener list for every custom application event
this.listeners[ this.eventTypes[i] ] = [];
}
}
for (var i = 0; i < this.BROWSER_EVENTS.length; i++) {
var eventType = this.BROWSER_EVENTS[i];
// every browser event has a corresponding application event
// (whether it's listened for or not).
this.listeners[ eventType ] = [];
Event.observe(div, eventType,
this.handleBrowserEvent.bindAsEventListener(this));
}
// disable dragstart in IE so that mousedown/move/up works normally
Event.observe(div, "dragstart", Event.stop);
},
/**
* @param {str} type
* @param {Object} obj
* @param {Function} func
*/
register: function (type, obj, func) {
if (func == null) {
obj = this.object;
func = obj;
}
var listeners = this.listeners[type];
listeners.push( {obj: obj, func: func} );
},
unregister: function (type, obj, func) {
var listeners = this.listeners[type];
for (var i = 0; i < listeners.length; i++) {
if (listeners[i].obj == obj && listeners[i].type == type) {
listeners.splice(i, 1);
break;
}
}
},
remove: function(type) {
this.listeners[type].pop();
},
/**
* @param {event} evt
*/
handleBrowserEvent: function (evt) {
evt.xy = this.getMousePosition(evt);
this.triggerEvent(evt.type, evt)
},
/**
* @param {event} evt
*
* @return {OpenLayers.Pixel}
*/
getMousePosition: function (evt) {
if (!this.div.offsets) {
this.div.offsets = Position.page(this.div);
}
return new OpenLayers.Pixel(
evt.clientX - this.div.offsets[0],
evt.clientY - this.div.offsets[1]);
},
/**
* @param {str} type
* @param {event} evt
*/
triggerEvent: function (type, evt) {
if (evt == null) {
evt = {};
}
evt.object = this.object;
evt.div = this.div;
var listeners = this.listeners[type];
for (var i = 0; i < listeners.length; i++) {
var callback = listeners[i];
var continueChain = callback.func.call(callback.obj, evt);
if (continueChain != null && !continueChain) break;
}
}
};

110
lib/OpenLayers/Feature.js Normal file
View File

@@ -0,0 +1,110 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/**
* @class
*/
OpenLayers.Feature = Class.create();
OpenLayers.Feature.prototype= {
/** @type OpenLayers.Events */
events:null,
/** @type OpenLayers.Layer */
layer: null,
/** @type String */
id: null,
/** @type OpenLayers.LonLat */
lonlat:null,
/** @type Object */
data:null,
/** @type OpenLayers.Marker */
marker: null,
/** @type OpenLayers.Popup */
popup: null,
/**
* @constructor
*
* @param {OpenLayers.Layer} layer
* @param {String} id
* @param {OpenLayers.LonLat} lonlat
* @param {Object} data
*/
initialize: function(layer, lonlat, data, id) {
this.layer = layer;
this.lonlat = lonlat;
this.data = (data != null) ? data : new Object();
this.id = (id ? id : 'f' + Math.random());
},
/**
*
*/
destroy: function() {
//remove the popup from the map
if ((this.layer != null) && (this.layer.map != null)) {
if (this.popup != null) {
this.layer.map.removePopup(this.popup);
}
}
this.events = null;
this.layer = null;
this.id = null;
this.lonlat = null;
this.data = null;
if (this.marker != null) {
this.marker.destroy();
this.marker = null;
}
if (this.popup != null) {
this.popup.destroy();
this.popup = null;
}
},
/**
* @returns A Marker Object created from the 'lonlat' and 'icon' properties
* set in this.data. If no 'lonlat' is set, returns null. If no
* 'icon' is set, OpenLayers.Marker() will load the default image
* @type OpenLayers.Marker
*/
createMarker: function() {
var marker = null;
if (this.lonlat != null) {
this.marker = new OpenLayers.Marker(this.lonlat, this.data.icon);
}
return this.marker;
},
/**
*
*/
createPopup: function() {
if (this.lonlat != null) {
var id = this.id + "_popup";
var anchor = (this.marker) ? this.marker.icon : null;
this.popup = new OpenLayers.Popup.AnchoredBubble(id,
this.lonlat,
this.data.popupSize,
this.data.popupContentHTML,
anchor);
}
return this.popup;
},
CLASS_NAME: "OpenLayers.Feature"
};

View File

@@ -0,0 +1,57 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/**
* @class
*/
OpenLayers.Feature.WFS = Class.create();
OpenLayers.Feature.WFS.prototype =
Object.extend( new OpenLayers.Feature(), {
/**
* @constructor
*
* @param {OpenLayers.Layer} layer
* @param {XMLNode} xmlNode
*/
initialize: function(layer, xmlNode) {
var newArguments = arguments;
if (arguments.length > 0) {
var data = this.processXMLNode(xmlNode);
newArguments = new Array(layer, data.lonlat, data, data.id)
}
OpenLayers.Feature.prototype.initialize.apply(this, newArguments);
if (arguments.length > 0) {
this.createMarker();
this.layer.addMarker(this.marker);
}
},
destroy: function() {
if (this.marker != null) {
this.layer.removeMarker(this.marker);
}
OpenLayers.Feature.prototype.destroy.apply(this, arguments);
},
/**
* @param {XMLNode} xmlNode
*
* @returns Data Object with 'id', 'lonlat', and private properties set
* @type Object
*/
processXMLNode: function(xmlNode) {
//this should be overridden by subclasses
// must return an Object with 'id' and 'lonlat' values set
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Feature.WFS"
});

106
lib/OpenLayers/Icon.js Normal file
View File

@@ -0,0 +1,106 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/**
* @class
*/
OpenLayers.Icon = Class.create();
OpenLayers.Icon.prototype = {
/** image url
* @type String */
url: null,
/** @type OpenLayers.Size */
size:null,
/** distance in pixels to offset the image when being rendered
* @type OpenLayers.Pixel */
offset: null,
/** Function to calculate the offset (based on the size)
* @type OpenLayers.Pixel */
calculateOffset: null,
/** @type DOMElement */
imageDiv: null,
/** @type OpenLayers.Pixel */
px: null,
/**
* @constructor
*
* @param {String} url
* @param {OpenLayers.Size} size
* @param {Function} calculateOffset
*/
initialize: function(url, size, offset, calculateOffset) {
this.url = url;
this.size = (size) ? size : new OpenLayers.Size(20,20);
this.offset = (offset) ? offset : new OpenLayers.Pixel(0,0);
this.calculateOffset = calculateOffset;
this.imageDiv = OpenLayers.Util.createAlphaImageDiv();
},
destroy: function() {
this.imageDiv = null;
},
/**
* @returns A fresh copy of the icon.
* @type OpenLayers.Icon
*/
clone: function() {
return new OpenLayers.Icon(this.size, this.url, this.offset);
},
/**
* @param {OpenLayers.Size} size
*/
setSize: function(size) {
if (size != null) {
this.size = size;
}
this.draw();
},
/**
* @param {OpenLayers.Pixel} px
*
* @return A new DOM Image of this icon set at the location passed-in
* @type DOMElement
*/
draw: function(px) {
OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,
null,
null,
this.size,
this.url,
"absolute");
this.moveTo(px);
return this.imageDiv;
},
/**
* @param {OpenLayers.Pixel} px
*/
moveTo: function (px) {
//if no px passed in, use stored location
if (px != null) {
this.px = px;
}
if ((this.px != null) && (this.imageDiv != null)) {
if (this.calculateOffset) {
this.offset = this.calculateOffset(this.size);
}
var offsetPx = this.px.offset(this.offset);
OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, offsetPx);
}
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Icon"
};

92
lib/OpenLayers/Layer.js Normal file
View File

@@ -0,0 +1,92 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/**
* @class
*/
OpenLayers.Layer = Class.create();
OpenLayers.Layer.prototype = {
/** @type String */
name: null,
/** @type DOMElement */
div: null,
/** This variable is set in map.addLayer, not within the layer itself
* @type OpenLayers.Map */
map: null,
/**
* @constructor
*
* @param {String} name
*/
initialize: function(name) {
if (arguments.length > 0) {
this.name = name;
if (this.div == null) {
this.div = OpenLayers.Util.createDiv();
this.div.style.width = "100%";
this.div.style.height = "100%";
}
}
},
/**
* Destroy is a destructor: this is to alleviate cyclic references which
* the Javascript garbage cleaner can not take care of on its own.
*/
destroy: function() {
if (this.map != null) {
this.map.removeLayer(this);
}
this.map = null;
},
/**
* @params {OpenLayers.Bounds} bound
* @params {Boolean} zoomChanged tells when zoom has changed, as layers have to do some init work in that case.
*/
moveTo: function (bound, zoomChanged) {
// not implemented here
return;
},
/**
* @param {OpenLayers.Map} map
*/
setMap: function(map) {
this.map = map;
},
/**
* @returns Whether or not the layer is a base layer. This should be
* determined individually by all subclasses.
* @type Boolean
*/
isBaseLayer: function() {
//this function should be implemented by all subclasses.
},
/**
* @returns Whether or not the layer is visible
* @type Boolean
*/
getVisibility: function() {
return (this.div.style.display != "none");
},
/**
* @param {bool} visible
*/
setVisibility: function(visible) {
this.div.style.display = (visible) ? "block" : "none";
if ((visible) && (this.map != null)) {
this.moveTo(this.map.getExtent());
}
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer"
};

View File

@@ -0,0 +1,152 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Layer.js
// load Google map control script
// this key was generated for: http://openlayers.python-hosting.com/testing/euzuro/
document.write("<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAmQ3udCHPQVB_9T_edFZ7YRRRlP-tOiFgaSzksg_0w1dphL9c5BTfdJMKT91b0UJGibNcWEM0Q5-O1w'></script>");
/**
* @class
*/
OpenLayers.Layer.Google = Class.create();
OpenLayers.Layer.Google.prototype = Object.extend( new OpenLayers.Layer(), {
/** @type Boolean */
viewPortLayer: true,
/** @type GMap2 gmap stores the Google Map element */
gmap:null,
/** @type Boolean */
dragging:false,
/**
* @constructor
*
* @param {String} name
*/
initialize: function(name) {
OpenLayers.Layer.prototype.initialize.apply(this, [name]);
},
/**
* @param {OpenLayers.Map} map
*/
setMap:function(map) {
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
// once our layer has been added to the map, we can create the vemap
this.map.events.register("addlayer", this, this.loadGMap);
},
/** Google layer is always a base class.
* @type Boolean
*/
isBaseLayer: function() {
return true;
},
/**
* @param {OpenLayers.Bounds} bounds
* @param {int} zoomChanged
*/
moveTo:function(bounds,zoomChanged) {
if ((this.gmap != null) && (!this.dragging)) {
var olCenter = this.map.getCenter();
var gCenter = this.getGMapCenter();
var olZoom = this.map.getZoom();
var gZoom = this.gmap.getZoom();
if ((!olCenter.equals(gCenter)) || ((olZoom +1) != gZoom)) {
this.gmap.setCenter(new GLatLng(olCenter.lat, olCenter.lon),
olZoom + 1);
}
}
},
/**
*
*/
loadGMap:function() {
// create div and set to same size as map
var gDiv = OpenLayers.Util.createDiv(this.name);
var sz = this.map.getSize();
gDiv.style.width = sz.w;
gDiv.style.height = sz.h;
this.div.appendChild(gDiv);
// create GMap, hide nav controls
this.gmap = new GMap2(this.div);
this.moveTo();
// catch pans and zooms from GMap
GEvent.addListener(this.gmap,
"moveend",
this.catchPanZoom.bindAsEventListener(this));
// attach to the drag start and end and we<77>ll set a flag so that
// we dont get recursivity. this is because the events fall through
// the gmaps div and into the main layer div
GEvent.addListener(this.gmap,
"dragstart",
this.dragStart.bindAsEventListener(this));
GEvent.addListener(this.gmap,
"dragend",
this.dragEnd.bindAsEventListener(this));
},
/**
* @private
*/
dragStart: function() {
this.dragging = true;
},
/**
* @private
*/
dragEnd: function() {
this.dragging = false;
},
/**
* @private
*
* @param {event} e
*/
catchPanZoom: function(e) {
var olCenter = this.getGMapCenter();
var gZoom = this.gmap.getZoom();
this.map.setCenter(olCenter, gZoom - 1);
},
/**
* @private
*
* @returns An OpenLayers.LonLat with the center of the gmap, or null if
* the GMap has not been centered yet
* @type OpenLayers.LonLat
*/
getGMapCenter:function() {
var olCenter = null;
var gCenter = this.gmap.getCenter();
if (gCenter != null) {
olCenter = new OpenLayers.LonLat(gCenter.lng(), gCenter.lat());
}
return olCenter;
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer.Google"
});

View File

@@ -0,0 +1,296 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Layer.js
// @require: OpenLayers/Util.js
OpenLayers.Layer.Grid = Class.create();
OpenLayers.Layer.Grid.TILE_WIDTH = 256;
OpenLayers.Layer.Grid.TILE_HEIGHT = 256;
OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
// str: url
url: null,
// hash: params
params: null,
// tileSize: OpenLayers.Size
tileSize: null,
// grid: Array(Array())
// this is an array of rows, each row is an array of tiles
grid: null,
/**
* @param {str} name
* @param {str} url
* @param {hash} params
*/
initialize: function(name, url, params) {
var newArguments = arguments;
if (arguments.length > 0) {
newArguments = [name];
}
OpenLayers.Layer.prototype.initialize.apply(this, newArguments);
this.url = url;
this.params = params;
this.tileSize = new OpenLayers.Size(OpenLayers.Layer.Grid.TILE_WIDTH,
OpenLayers.Layer.Grid.TILE_HEIGHT);
},
/**
*
*/
destroy: function() {
this.params = null;
this.clearGrid();
this.grid = null;
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
},
setTileSize: function (size) {
this.tileSize = size.copyOf();
},
/**
* moveTo
* moveTo is a function called whenever the map is moved. All the moving
* of actual 'tiles' is done by the map, but moveTo's role is to accept
* a bounds and make sure the data that that bounds requires is pre-loaded.
* @param {OpenLayers.Bounds}
*/
moveTo:function(bounds,zoomChanged) {
if (!this.getVisibility()) {
if (zoomChanged) {
this.grid = null;
}
return;
}
if (!this.grid || zoomChanged) {
this._initTiles();
} else {
var i = 0;
while (this.getGridBounds().bottom > bounds.bottom) {
this.insertRow(false);
}
while (this.getGridBounds().left > bounds.left) {
this.insertColumn(true);
}
while (this.getGridBounds().top < bounds.top) {
this.insertRow(true);
}
while (this.getGridBounds().right < bounds.right) {
this.insertColumn(false);
}
}
},
getGridBounds:function() {
var topLeftTile = this.grid[0][0];
var bottomRightTile = this.grid[this.grid.length-1][this.grid[0].length-1];
return new OpenLayers.Bounds(topLeftTile.bounds.left,
bottomRightTile.bounds.bottom,
bottomRightTile.bounds.right,
topLeftTile.bounds.top);
},
/**
*/
_initTiles:function() {
//first of all, clear out the main div
this.div.innerHTML = "";
//now clear out the old grid and start a new one
this.clearGrid();
this.grid = new Array();
var viewSize = this.map.getSize();
var bounds = this.map.getExtent();
var extent = this.map.getFullExtent();
var resolution = this.map.getResolution();
var tilelon = resolution*this.tileSize.w;
var tilelat = resolution*this.tileSize.h;
var offsetlon = bounds.left - extent.left;
var tilecol = Math.floor(offsetlon/tilelon);
var tilecolremain = offsetlon/tilelon - tilecol;
var tileoffsetx = -tilecolremain * this.tileSize.w;
var tileoffsetlon = extent.left + tilecol * tilelon;
var offsetlat = bounds.top - (extent.bottom + tilelat);
var tilerow = Math.ceil(offsetlat/tilelat);
var tilerowremain = tilerow - offsetlat/tilelat;
var tileoffsety = -tilerowremain * this.tileSize.h;
var tileoffsetlat = extent.bottom + tilerow * tilelat;
tileoffsetx = Math.round(tileoffsetx); // heaven help us
tileoffsety = Math.round(tileoffsety);
this.origin = new OpenLayers.Pixel(tileoffsetx,tileoffsety);
var startX = tileoffsetx;
var startLon = tileoffsetlon;
do {
var row = new Array();
this.grid.append(row);
tileoffsetlon = startLon;
tileoffsetx = startX;
do {
var tileBounds = new OpenLayers.Bounds(tileoffsetlon,
tileoffsetlat,
tileoffsetlon+tilelon,
tileoffsetlat+tilelat);
var tile = this.addTile(tileBounds,
new OpenLayers.Pixel(tileoffsetx - parseInt(this.map.layerContainerDiv.style.left),
tileoffsety - parseInt(this.map.layerContainerDiv.style.top))
);
tile.draw((this.params.TRANSPARENT == 'true'));
row.append(tile);
tileoffsetlon += tilelon;
tileoffsetx += this.tileSize.w;
} while (tileoffsetlon < bounds.right)
tileoffsetlat -= tilelat;
tileoffsety += this.tileSize.h;
} while(tileoffsetlat > bounds.bottom - tilelat)
},
/**
* @param {bool} prepend - if true, prepend to beginning.
* if false, then append to end
*/
insertRow:function(prepend) {
var modelRowIndex = (prepend) ? 0 : (this.grid.length - 1);
var modelRow = this.grid[modelRowIndex];
var newRow = new Array();
var resolution = this.map.getResolution();
var deltaY = (prepend) ? -this.tileSize.h : this.tileSize.h;
var deltaLat = resolution * -deltaY;
for (var i=0; i < modelRow.length; i++) {
var modelTile = modelRow[i];
var bounds = modelTile.bounds.copyOf();
var position = modelTile.position.copyOf();
bounds.bottom = bounds.bottom + deltaLat;
bounds.top = bounds.top + deltaLat;
position.y = position.y + deltaY;
var newTile = this.addTile(bounds, position);
newTile.draw((this.params.TRANSPARENT == 'true'));
newRow.append(newTile);
}
if (newRow.length>0){
if (prepend) {
this.grid.prepend(newRow);
} else {
this.grid.append(newRow);
}
}
},
/**
* @param {bool} prepend - if true, prepend to beginning.
* if false, then append to end
*/
insertColumn:function(prepend) {
var modelCellIndex;
var deltaX = (prepend) ? -this.tileSize.w : this.tileSize.w;
var resolution = this.map.getResolution();
var deltaLon = resolution * deltaX;
for (var i=0; i<this.grid.length; i++) {
var row = this.grid[i];
modelTileIndex = (prepend) ? 0 : (row.length - 1);
var modelTile = row[modelTileIndex];
var bounds = modelTile.bounds.copyOf();
var position = modelTile.position.copyOf();
bounds.left = bounds.left + deltaLon;
bounds.right = bounds.right + deltaLon;
position.x = position.x + deltaX;
var newTile = this.addTile(bounds, position);
newTile.draw((this.params.TRANSPARENT == 'true'));
if (prepend) {
row = row.prepend(newTile);
} else {
row = row.append(newTile);
}
}
},
/** combine the ds's serverPath with its params and the tile's params.
*
* does checking on the serverPath variable, allowing for cases when it
* is supplied with trailing ? or &, as well as cases where not.
*
* return in formatted string like this:
* "server?key1=value1&key2=value2&key3=value3"
*
* @return {str}
*/
getFullRequestString:function(params) {
var requestString = "";
this.params.SRS = this.map.projection;
// concat tile params with layer params and convert to string
var allParams = Object.extend(this.params, params);
var paramsString = OpenLayers.Util.getParameterString(allParams);
var server = this.url;
var lastServerChar = server.charAt(server.length - 1);
if ((lastServerChar == "&") || (lastServerChar == "?")) {
requestString = server + paramsString;
} else {
if (server.indexOf('?') == -1) {
//serverPath has no ? -- add one
requestString = server + '?' + paramsString;
} else {
//serverPath contains ?, so must already have paramsString at the end
requestString = server + '&' + paramsString;
}
}
return requestString;
},
/** go through and remove all tiles from the grid, calling
* destroy() on each of them to kill circular references
*
* @private
*/
clearGrid:function() {
if (this.grid) {
while(this.grid.length > 0) {
var row = this.grid[0];
while(row.length > 0) {
var tile = row[0];
tile.destroy();
row.remove(tile);
}
this.grid.remove(row);
}
}
},
/**
* addTile gives subclasses of Grid the opportunity to create an
* OpenLayer.Tile of their choosing. The implementer should initialize
* the new tile and take whatever steps necessary to display it.
*
* @param {OpenLayers.Bounds} bounds
*
* @returns The added OpenLayers.Tile
* @type OpenLayers.Tile
*/
addTile:function(bounds,position) {
// Should be implemented by subclasses
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Grid"
});

View File

@@ -0,0 +1,53 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Layer/Grid.js
/**
* @class
*/
OpenLayers.Layer.KaMap = Class.create();
OpenLayers.Layer.KaMap.prototype =
Object.extend( new OpenLayers.Layer.Grid(), {
metaTileHeight: 6,
metaTileWidth: 6,
DEFAULT_PARAMS: {
i: 'jpeg',
map: ''
},
// this.cellSize = newScale/(oMap.resolution * inchesPerUnit[oMap.units]);
// kaMap.prototype.geoToPix = function( gX, gY ) { var pX = gX / this.cellSize; var pY = -1 * gY / this.cellSize; }
initialize: function(name, url, params, origin) {
this.kaOrigin = origin;
var newArguments = new Array();
newArguments.push(name, url, params);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
this.params = (params ? params : {});
if (arguments.length > 0 && params) {
OpenLayers.Util.applyDefaults(
this.params,
this.DEFAULT_PARAMS
);
}
},
addTile:function(bounds,position) {
var zoom = this.map.getZoom();
var resolution = this.map.getResolution();
var scale = 128000000 / Math.pow(2, zoom);
// 1280000 is an empirical value for a specific tile server, not yet figured out the right way to do this in general.
// This will probably be based on map.maxResolution.
var cellSize = new OpenLayers.Size(resolution*this.tileSize.w, resolution*this.tileSize.h);
var pX = Math.floor(((bounds.left + this.kaOrigin.lon) / cellSize.w) * this.tileSize.w);
var pY = -Math.floor(((bounds.top+this.kaOrigin.lat) / cellSize.h) * this.tileSize.h);
var url = this.getFullRequestString(
{ t: pY,
l: pX,
s: scale
});
return new OpenLayers.Tile.Image(this, position, bounds,
url, this.tileSize);
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer.KaMap"
});

View File

@@ -0,0 +1,113 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Layer.js
/**
* @class
*/
OpenLayers.Layer.Markers = Class.create();
OpenLayers.Layer.Markers.prototype =
Object.extend( new OpenLayers.Layer(), {
/** internal marker list
* @type Array(OpenLayers.Marker) */
markers: null,
/**
* @constructor
*
* @param {String} name
*/
initialize: function(name) {
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
this.markers = new Array();
},
/**
*
*/
destroy: function() {
this.clearMarkers();
markers = null;
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
},
/**
* @param {OpenLayers.Bounds} bounds
* @param {Boolean} zoomChanged
*/
moveTo: function(bounds, zoomChanged) {
if (zoomChanged) {
this.redraw();
}
},
/** WFS layer is never a base class.
* @type Boolean
*/
isBaseLayer: function() {
return false;
},
/**
* @param {OpenLayers.Marker} marker
*/
addMarker: function(marker) {
this.markers.append(marker);
if (this.map && this.map.getExtent()) {
marker.map = this.map;
this.drawMarker(marker);
}
},
/**
* @param {OpenLayers.Marker} marker
*/
removeMarker: function(marker) {
this.markers.remove(marker);
if ((marker.icon != null) && (marker.icon.imageDiv != null) &&
(marker.icon.imageDiv.parentNode == this.div) ) {
this.div.removeChild(marker.icon.imageDiv);
}
},
/**
*
*/
clearMarkers: function() {
if (this.markers != null) {
while(this.markers.length > 0) {
this.removeMarker(this.markers[0]);
}
}
},
/** clear all the marker div's from the layer and then redraw all of them.
* Use the map to recalculate new placement of markers.
*/
redraw: function() {
for(i=0; i < this.markers.length; i++) {
this.drawMarker(this.markers[i]);
}
},
/** Calculate the pixel location for the marker, create it, and
* add it to the layer's div
*
* @private
*
* @param {OpenLayers.Marker} marker
*/
drawMarker: function(marker) {
var px = this.map.getLayerPxFromLonLat(marker.lonlat);
var markerImg = marker.draw(px);
if (!marker.drawn) {
this.div.appendChild(markerImg);
marker.drawn = true;
}
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer.Markers"
});

View File

@@ -0,0 +1,172 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Layer/Markers.js
/**
* @class
*/
OpenLayers.Layer.Text = Class.create();
OpenLayers.Layer.Text.prototype =
Object.extend( new OpenLayers.Layer.Markers(), {
/** store url of text file
* @type str */
location:null,
/** @type Array(OpenLayers.Feature) */
features: null,
/** @type OpenLayers.Feature */
selectedFeature: null,
/**
* @constructor
*
* @param {String} name
* @param {String} location
*/
initialize: function(name, location) {
OpenLayers.Layer.Markers.prototype.initialize.apply(this, [name]);
this.location = location;
this.features = new Array();
new Ajax.Request(location,
{ method: 'get', onComplete:this.parseData.bind(this) } );
},
/**
*
*/
destroy: function() {
this.clearFeatures();
this.features = null;
OpenLayers.Layer.Markers.prototype.destroy.apply(this, arguments);
},
/** WFS layer is never a base class.
* @type Boolean
*/
isBaseLayer: function() {
return false;
},
/**
* @param {?} ajaxRequest
*/
parseData: function(ajaxRequest) {
var text = ajaxRequest.responseText;
var lines = text.split('\n');
var columns;
// length - 1 to allow for trailing new line
for (var lcv = 0; lcv < (lines.length - 1); lcv++) {
var currLine = lines[lcv].replace(/^\s*/,'').replace(/\s*$/,'');
if (currLine.charAt(0) != '#') { /* not a comment */
if (!columns) {
//First line is columns
columns = currLine.split('\t');
} else {
var vals = currLine.split('\t');
var location = new OpenLayers.LonLat(0,0);
var title; var url;
var icon, iconSize, iconOffset;
var set = false;
for (var valIndex = 0; valIndex < vals.length; valIndex++) {
if (vals[valIndex]) {
if (columns[valIndex] == 'point') {
var coords = vals[valIndex].split(',');
location.lat = parseFloat(coords[0]);
location.lon = parseFloat(coords[1]);
set = true;
} else if (columns[valIndex] == 'lat') {
location.lat = parseFloat(vals[valIndex]);
set = true;
} else if (columns[valIndex] == 'lon') {
location.lon = parseFloat(vals[valIndex]);
set = true;
} else if (columns[valIndex] == 'title')
title = vals[valIndex];
else if (columns[valIndex] == 'image' ||
columns[valIndex] == 'icon')
url = vals[valIndex];
else if (columns[valIndex] == 'iconSize') {
var size = vals[valIndex].split(',');
iconSize = new OpenLayers.Size(parseFloat(size[0]),
parseFloat(size[1]));
} else if (columns[valIndex] == 'iconOffset') {
var offset = vals[valIndex].split(',');
iconOffset = new OpenLayers.Pixel(parseFloat(offset[0]),
parseFloat(offset[1]));
} else if (columns[valIndex] == 'title') {
title = vals[valIndex];
} else if (columns[valIndex] == 'description') {
description = vals[valIndex];
}
}
}
if (set) {
var data = new Object();
if (url != null) {
data.icon = new OpenLayers.Icon(url,
iconSize,
iconOffset);
} else {
data.icon = OpenLayers.Marker.defaultIcon();
//allows for the case where the image url is not
// specified but the size is. use a default icon
// but change the size
if (iconSize != null) {
data.icon.setSize(iconSize);
}
}
if ((title != null) && (description != null)) {
data['popupContentHTML'] = '<h2>'+title+'</h2><p>'+description+'</p>';
}
var feature = new OpenLayers.Feature(this, location, data);
this.features.append(feature);
var marker = feature.createMarker();
marker.events.register('click', feature, this.markerClick);
this.addMarker(marker);
}
}
}
}
},
/**
* @param {Event} evt
*/
markerClick: function(evt) {
sameMarkerClicked = (this == this.layer.selectedFeature);
this.layer.selectedFeature = (!sameMarkerClicked) ? this : null;
for(var i=0; i < this.layer.map.popups.length; i++) {
this.layer.map.removePopup(this.layer.map.popups[i]);
}
if (!sameMarkerClicked) {
this.layer.map.addPopup(this.createPopup());
}
Event.stop(evt);
},
/**
*
*/
clearFeatures: function() {
if (this.features != null) {
while(this.features.length > 0) {
var feature = this.features[0];
this.features.remove(feature);
feature.destroy();
}
}
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Text"
});

View File

@@ -0,0 +1,107 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Layer.js
// load VE map control script
document.write("<script src='http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js'></script>");
/**
* @class
*/
OpenLayers.Layer.VirtualEarth = Class.create();
OpenLayers.Layer.VirtualEarth.prototype =
Object.extend( new OpenLayers.Layer(), {
/** @type Boolean */
viewPortLayer: true,
/** @type VEMap */
vemap: null,
/**
* @constructor
*
* @param {str} name
*/
initialize:function(name) {
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
},
/**
* @param {OpenLayers.Map} map
*/
setMap:function(map) {
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
// once our layer has been added to the map, we can create the vemap
this.map.events.register("addlayer", this, this.loadVEMap);
},
/** Virtual Earth layer is always a base class.
* @type Boolean
*/
isBaseLayer: function() {
return true;
},
/**
* @param {OpenLayers.Bounds} bounds
* @param {int} zoomChanged
*/
moveTo:function(bounds,zoomChanged) {
if (this.vemap != null) {
var olCenter = this.map.getCenter();
var olZoom = this.map.getZoom();
this.vemap.SetCenterAndZoom(new VELatLong(olCenter.lat, olCenter.lon),
olZoom + 1);
}
},
/**
*
*/
loadVEMap:function() {
// create div and set to same size as map
var veDiv = OpenLayers.Util.createDiv(this.name);
var sz = this.map.getSize();
veDiv.style.width = sz.w;
veDiv.style.height = sz.h;
this.div.appendChild(veDiv);
// create VEMap, hide nav controls
this.vemap = new VEMap(this.name);
this.vemap.LoadMap();
this.vemap.HideDashboard();
// catch pans and zooms from VE Map
this.vemap.AttachEvent("onendcontinuouspan",
this.catchPanZoom.bindAsEventListener(this));
this.vemap.AttachEvent("onendzoom",
this.catchPanZoom.bindAsEventListener(this));
},
/**
* @param {event} e
*/
catchPanZoom: function(e) {
var veCenter = this.vemap.GetCenter();
var veZoom = this.vemap.GetZoomLevel();
var olCenter = new OpenLayers.LonLat(veCenter.Longitude,
veCenter.Latitude);
this.map.setCenter(olCenter, veZoom - 1);
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer.VirtualEarth"
});

116
lib/OpenLayers/Layer/WFS.js Normal file
View File

@@ -0,0 +1,116 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Layer/Grid.js
// @require: OpenLayers/Layer/Markers.js
/**
* @class
*/
OpenLayers.Layer.WFS = Class.create();
OpenLayers.Layer.WFS.prototype =
Object.extend(new OpenLayers.Layer.Grid(),
Object.extend(new OpenLayers.Layer.Markers(), {
/** @type Object */
featureClass: null,
/** @final @type hash */
DEFAULT_PARAMS: { service: "WFS",
version: "1.0.0",
request: "GetFeature",
typename: "docpoint"
},
/**
* @constructor
*
* @param {str} name
* @param {str} url
* @param {hash} params
* @param {Object} featureClass
*/
initialize: function(name, url, params, featureClass) {
this.featureClass = featureClass;
var newArguments = new Array();
if (arguments.length > 0) {
//uppercase params
params = OpenLayers.Util.upperCaseObject(params);
newArguments.push(name, url, params);
}
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
OpenLayers.Layer.Markers.prototype.initialize.apply(this, newArguments);
if (arguments.length > 0) {
OpenLayers.Util.applyDefaults(
this.params,
OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
);
}
},
/**
*
*/
destroy: function() {
OpenLayers.Layer.Grid.prototype.destroy.apply(this, arguments);
OpenLayers.Layer.Markers.prototype.destroy.apply(this, arguments);
},
/**
* @param {OpenLayers.Bounds} bounds
* @param {Boolean} zoomChanged
*/
moveTo: function(bounds, zoomChanged) {
OpenLayers.Layer.Grid.prototype.moveTo.apply(this, arguments);
OpenLayers.Layer.Markers.prototype.moveTo.apply(this, arguments);
},
/** WFS layer is never a base class.
* @type Boolean
*/
isBaseLayer: function() {
return false;
},
/**
* @param {String} name
* @param {hash} params
*
* @returns A clone of this OpenLayers.Layer.WMS, with the passed-in
* parameters merged in.
* @type OpenLayers.Layer.WMS
*/
clone: function (name, params) {
var mergedParams = {}
Object.extend(mergedParams, this.params);
Object.extend(mergedParams, params);
var obj = new OpenLayers.Layer.WFS(name, this.url, mergedParams);
obj.setTileSize(this.tileSize);
return obj;
},
/**
* addTile creates a tile, initializes it (via 'draw' in this case), and
* adds it to the layer div.
*
* @param {OpenLayers.Bounds} bounds
*
* @returns The added OpenLayers.Tile.WFS
* @type OpenLayers.Tile.WFS
*/
addTile:function(bounds, position) {
url = this.getFullRequestString(
{ BBOX:bounds.toBBOX() });
return new OpenLayers.Tile.WFS(this, position, bounds,
url, this.tileSize);
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer.WFS"
}
)
);

View File

@@ -0,0 +1,91 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Layer/Grid.js
/**
* @class
*/
OpenLayers.Layer.WMS = Class.create();
OpenLayers.Layer.WMS.prototype =
Object.extend( new OpenLayers.Layer.Grid(), {
/** @final @type hash */
DEFAULT_PARAMS: { service: "WMS",
version: "1.1.1",
request: "GetMap",
styles: "",
exceptions: "application/vnd.ogc.se_inimage",
format: "image/jpeg"
},
/**
* @constructor
*
* @param {str} name
* @param {str} url
* @param {hash} params
*/
initialize: function(name, url, params) {
var newArguments = new Array();
if (arguments.length > 0) {
//uppercase params
params = OpenLayers.Util.upperCaseObject(params);
newArguments.push(name, url, params);
}
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
if (arguments.length > 0) {
OpenLayers.Util.applyDefaults(
this.params,
OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
);
}
},
/** WFS layer is never a base class.
* @type Boolean
*/
isBaseLayer: function() {
return (this.params.TRANSPARENT != 'true');
},
/**
* @param {String} name
* @param {hash} params
*
* @returns A clone of this OpenLayers.Layer.WMS, with the passed-in
* parameters merged in.
* @type OpenLayers.Layer.WMS
*/
clone: function (name, params) {
var mergedParams = {};
Object.extend(mergedParams, this.params);
Object.extend(mergedParams, params);
var obj = new OpenLayers.Layer.WMS(name, this.url, mergedParams);
obj.setTileSize(this.tileSize);
return obj;
},
/**
* addTile creates a tile, initializes it (via 'draw' in this case), and
* adds it to the layer div.
*
* @param {OpenLayers.Bounds} bounds
*
* @returns The added OpenLayers.Tile.Image
* @type OpenLayers.Tile.Image
*/
addTile:function(bounds,position) {
url = this.getFullRequestString(
{BBOX:bounds.toBBOX(),
WIDTH:this.tileSize.w,
HEIGHT:this.tileSize.h});
return new OpenLayers.Tile.Image(this, position, bounds,
url, this.tileSize);
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer.WMS"
});

View File

@@ -0,0 +1,97 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Layer/Grid.js
/**
* @class
*/
OpenLayers.Layer.WMS.Untiled = Class.create();
OpenLayers.Layer.WMS.Untiled.prototype =
Object.extend( new OpenLayers.Layer.Grid(), {
/** @final @type hash */
DEFAULT_PARAMS: { service: "WMS",
version: "1.1.1",
request: "GetMap",
styles: "",
exceptions: "application/vnd.ogc.se_inimage",
format: "image/jpeg"
},
/**
* @constructor
*
* @param {str} name
* @param {str} url
* @param {hash} params
*/
initialize: function(name, url, params) {
var newArguments = new Array();
if (arguments.length > 0) {
//uppercase params
params = OpenLayers.Util.upperCaseObject(params);
newArguments.push(name, url, params);
}
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
if (arguments.length > 0) {
OpenLayers.Util.applyDefaults(
this.params,
OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
);
}
},
/** WFS layer is never a base class.
* @type Boolean
*/
isBaseLayer: function() {
return (this.params.TRANSPARENT != true);
},
/**
* @param {String} name
* @param {hash} params
*
* @returns A clone of this OpenLayers.Layer.WMS, with the passed-in
* parameters merged in.
* @type OpenLayers.Layer.WMS
*/
clone: function (name, params) {
var mergedParams = {};
Object.extend(mergedParams, this.params);
Object.extend(mergedParams, params);
var obj = new OpenLayers.Layer.WMS(name, this.url, mergedParams);
obj.setTileSize(this.tileSize);
return obj;
},
/**
* addTile creates a tile, initializes it (via 'draw' in this case), and
* adds it to the layer div.
*
* @param {OpenLayers.Bounds} bounds
*
* @returns The added OpenLayers.Tile.Image
* @type OpenLayers.Tile.Image
*/
addTile:function(bounds,position) {
url = this.getFullRequestString(
{BBOX:bounds.toBBOX(),
WIDTH:this.map.getSize().w,
HEIGHT:this.map.getSize().h});
return new OpenLayers.Tile.Image(this, position, bounds,
url, this.map.getSize());
},
moveTo:function(bounds,zoomChanged, minor) {
if (!minor) {
this.div.innerHTML = "";
tile = this.addTile(bounds, new OpenLayers.Pixel(-parseInt(this.map.layerContainerDiv.style.left), -parseInt(this.map.layerContainerDiv.style.top)));
tile.draw();
}
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer.WMS.Untiled"
});

View File

@@ -0,0 +1,149 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Layer.js
// load Yahoo map control script
document.write("<script src='http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers'></script>");
/**
* @class
*/
OpenLayers.Layer.Yahoo = Class.create();
OpenLayers.Layer.Yahoo.prototype = Object.extend( new OpenLayers.Layer(), {
/** @type Boolean */
viewPortLayer: true,
/** @type GMap2 gmap stores the Google Map element */
ymap:null,
/** @type Boolean */
dragging:false,
/**
* @constructor
*
* @param {String} name
*/
initialize: function(name) {
OpenLayers.Layer.prototype.initialize.apply(this, [name]);
},
/**
* @param {OpenLayers.Map} map
*/
setMap:function(map) {
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
// once our layer has been added to the map, we can create the vemap
this.map.events.register("addlayer", this, this.loadYMap);
},
/** Yahoo layer is always a base class.
* @type Boolean
*/
isBaseLayer: function() {
return true;
},
/**
* @param {OpenLayers.Bounds} bounds
* @param {int} zoomChanged
*/
moveTo:function(bounds,zoomChanged) {
if ((this.ymap != null) && (!this.dragging)) {
var olCenter = this.map.getCenter();
var yCenter = this.getYMapCenter();
var olZoom = this.map.getZoom();
var yZoom = this.ymap.getZoomLevel();
if ((!olCenter.equals(yCenter)) || (( 16 - olZoom) != yZoom)) {
this.ymap.drawZoomAndCenter(new YGeoPoint(olCenter.lat, olCenter.lon),
16 - olZoom);
}
}
},
/**
*
*/
loadYMap:function() {
// create div and set to same size as map
var yDiv = OpenLayers.Util.createDiv(this.name);
var sz = this.map.getSize();
yDiv.style.width = sz.w;
yDiv.style.height = sz.h;
this.div.appendChild(yDiv);
// create GMap, hide nav controls
this.ymap = new YMap(this.div);
// catch pans and zooms from GMap
YEvent.Capture(this.ymap,
EventsList.endPan,
this.catchPanZoom,
this);
// catch pans and zooms from GMap
YEvent.Capture(this.ymap,
EventsList.endAutoPan,
this.catchPanZoom,
this);
// attach to the drag start and end and we<77>ll set a flag so that
// we dont get recursivity. this is because the events fall through
// the gmaps div and into the main layer div
YEvent.Capture(this.ymap,
EventsList.startPan,
this.dragStart,
this);
},
/**
* @private
*/
dragStart: function() {
this.dragging = true;
},
/**
* @private
*
* @param {event} e
*/
catchPanZoom: function(e) {
this.dragging = false;
var olCenter = this.getYMapCenter();
var yZoom = this.ymap.getZoomLevel();
this.map.setCenter(olCenter, 16 - yZoom);
},
/**
* @private
*
* @returns An OpenLayers.LonLat with the center of the ymap, or null if
* the YMap has not been centered yet
* @type OpenLayers.LonLat
*/
getYMapCenter:function() {
var olCenter = null;
var yCenter = this.ymap.getCenterLatLon();
if (yCenter != null) {
olCenter = new OpenLayers.LonLat(yCenter.Lon, yCenter.Lat);
}
return olCenter;
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer.Yahoo"
});

575
lib/OpenLayers/Map.js Normal file
View File

@@ -0,0 +1,575 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Util.js
/**
* @class
*
*
*/
OpenLayers.Map = Class.create();
OpenLayers.Map.prototype = {
// Hash: base z-indexes for different classes of thing
Z_INDEX_BASE: { Layer: 100, Popup: 200, Control: 1000 },
// Array: supported application event types
EVENT_TYPES: [
"addlayer", "removelayer", "movestart", "move", "moveend",
"zoomend", "layerchanged", "popupopen", "popupclose",
"addmarker", "removemarker", "clearmarkers", "mouseover",
"mouseout", "mousemove", "dragstart", "drag", "dragend" ],
// int: zoom levels, used to draw zoom dragging control and limit zooming
maxZoomLevel: 16,
// OpenLayers.Bounds
maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
/* projection */
projection: "EPSG:4326",
/** @type OpenLayers.Size */
size: null,
// float
maxResolution: 1.40625, // degrees per pixel
// Default is whole world in 256 pixels, from GMaps
// DOMElement: the div that our map lives in
div: null,
// HTMLDivElement: the map's view port
viewPortDiv: null,
// HTMLDivElement: the map's layer container
layerContainerDiv: null,
// Array(OpenLayers.Layer): ordered list of layers in the map
layers: null,
// Array(OpenLayers.Control)
controls: null,
// Array(OpenLayers.Popup)
popups: null,
// OpenLayers.LonLat
center: null,
// int
zoom: null,
// OpenLayers.Events
events: null,
// OpenLayers.Pixel
mouseDragStart: null,
/** @type OpenLayers.Layer */
baseLayer: null,
/**
* @param {DOMElement} div
*/
initialize: function (div, options) {
Object.extend(this, options);
this.div = div = $(div);
// the viewPortDiv is the outermost div we modify
var id = div.id + "_OpenLayers_ViewPort";
this.viewPortDiv = OpenLayers.Util.createDiv(id, null, null, null,
"relative", null,
"hidden");
this.viewPortDiv.style.width = "100%";
this.viewPortDiv.style.height = "100%";
this.div.appendChild(this.viewPortDiv);
// the layerContainerDiv is the one that holds all the layers
id = div.id + "_OpenLayers_Container";
this.layerContainerDiv = OpenLayers.Util.createDiv(id);
this.viewPortDiv.appendChild(this.layerContainerDiv);
this.events = new OpenLayers.Events(this, div, this.EVENT_TYPES);
this.updateSize();
// make the entire maxExtent fix in zoom level 0 by default
if (this.maxResolution == null || this.maxResolution == "auto") {
this.maxResolution = Math.max(
this.maxExtent.getWidth() / this.size.w,
this.maxExtent.getHeight() / this.size.h );
}
// update the internal size register whenever the div is resized
this.events.register("resize", this, this.updateSize);
this.layers = [];
if (!this.controls) {
this.controls = [];
this.addControl(new OpenLayers.Control.MouseDefaults());
this.addControl(new OpenLayers.Control.PanZoom());
}
this.popups = new Array();
// always call map.destroy()
Event.observe(window, 'unload',
this.destroy.bindAsEventListener(this));
},
/**
* @private
*/
destroy:function() {
if (this.layers != null) {
for(var i=0; i< this.layers.length; i++) {
this.layers[i].destroy();
}
this.layers = null;
}
if (this.controls != null) {
for(var i=0; i< this.controls.length; i++) {
this.controls[i].destroy();
}
this.controls = null;
}
},
/**
* @param {OpenLayers.Layer} layer
*/
addLayer: function (layer) {
layer.setMap(this);
layer.div.style.overflow = "";
layer.div.style.zIndex = this.Z_INDEX_BASE['Layer'] + this.layers.length;
if (layer.viewPortLayer) {
this.viewPortDiv.appendChild(layer.div);
} else {
this.layerContainerDiv.appendChild(layer.div);
}
this.layers.push(layer);
// hack hack hack - until we add a more robust layer switcher,
// which is able to determine which layers are base layers and
// which are not (and put baselayers in a radiobutton group and
// other layers in checkboxes) this seems to be the most straight-
// forward way of dealing with this.
//
if (layer.isBaseLayer()) {
this.baseLayer = layer;
}
this.events.triggerEvent("addlayer");
},
/** Removes a layer from the map by removing its visual element (the
* layer.div property), then removing it from the map's internal list
* of layers, setting the layer's map property to null.
*
* a "removelayer" event is triggered.
*
* very worthy of mention is that simply removing a layer from a map
* will not cause the removal of any popups which may have been created
* by the layer. this is due to the fact that it was decided at some
* point that popups would not belong to layers. thus there is no way
* for us to know here to which layer the popup belongs.
*
* A simple solution to this is simply to call destroy() on the layer.
* the default OpenLayers.Layer class's destroy() function
* automatically takes care to remove itself from whatever map it has
* been attached to.
*
* The correct solution is for the layer itself to register an
* event-handler on "removelayer" and when it is called, if it
* recognizes itself as the layer being removed, then it cycles through
* its own personal list of popups, removing them from the map.
*
* @param {OpenLayers.Layer} layer
*/
removeLayer: function(layer) {
this.layerContainerDiv.removeChild(layer.div);
this.layers.remove(layer);
layer.map = null;
this.events.triggerEvent("removelayer");
},
/**
* @param {Array(OpenLayers.Layer)} layers
*/
addLayers: function (layers) {
for (var i = 0; i < layers.length; i++) {
this.addLayer(layers[i]);
}
},
/**
* @param {OpenLayers.Control} control
* @param {OpenLayers.Pixel} px
*/
addControl: function (control, px) {
control.map = this;
this.controls.push(control);
var div = control.draw(px);
if (div) {
div.style.zIndex = this.Z_INDEX_BASE['Control'] +
this.controls.length;
this.viewPortDiv.appendChild( div );
}
},
/**
* @param {OpenLayers.Popup} popup
*/
addPopup: function(popup) {
popup.map = this;
this.popups.push(popup);
var popupDiv = popup.draw();
if (popupDiv) {
popupDiv.style.zIndex = this.Z_INDEX_BASE['Popup'] +
this.popups.length;
this.layerContainerDiv.appendChild(popupDiv);
}
},
/**
* @param {OpenLayers.Popup} popup
*/
removePopup: function(popup) {
this.popups.remove(popup);
if (popup.div) {
this.layerContainerDiv.removeChild(popup.div);
}
popup.map = null;
},
/**
* @return {float}
*/
getResolution: function () {
// return degrees per pixel
return this.maxResolution / Math.pow(2, this.zoom);
},
/**
* @return {int}
*/
getZoom: function () {
return this.zoom;
},
/**
* @returns {OpenLayers.Size}
*/
getSize: function () {
return this.size;
},
/**
* @private
*/
updateSize: function() {
this.size = new OpenLayers.Size(
this.div.clientWidth, this.div.clientHeight);
this.events.div.offsets = null;
// Workaround for the fact that hidden elements return 0 for size.
if (this.size.w == 0 && this.size.h == 0) {
var dim = Element.getDimensions(this.div);
this.size.w = dim.width;
this.size.h = dim.height;
}
if (this.size.w == 0 && this.size.h == 0) {
this.size.w = parseInt(this.div.style.width);
this.size.h = parseInt(this.div.style.height);
}
},
/**
* @return {OpenLayers.LonLat}
*/
getCenter: function () {
return this.center;
},
/**
* @return {OpenLayers.Bounds}
*/
getExtent: function () {
if (this.center) {
var res = this.getResolution();
var size = this.getSize();
var w_deg = size.w * res;
var h_deg = size.h * res;
return new OpenLayers.Bounds(
this.center.lon - w_deg / 2,
this.center.lat - h_deg / 2,
this.center.lon + w_deg / 2,
this.center.lat + h_deg / 2);
} else {
return null;
}
},
/**
* @return {OpenLayers.Bounds}
*/
getFullExtent: function () {
return this.maxExtent;
},
getZoomLevels: function() {
return this.maxZoomLevel;
},
/**
* @param {OpenLayers.Bounds} bounds
*
* @return {int}
*/
getZoomForExtent: function (bounds) {
var size = this.getSize();
var width = bounds.getWidth();
var height = bounds.getHeight();
var deg_per_pixel = (width > height ? width / size.w : height / size.h);
var zoom = Math.log(this.maxResolution / deg_per_pixel) / Math.log(2);
return Math.floor(Math.min(Math.max(zoom, 0), this.getZoomLevels()));
},
/**
* @param {OpenLayers.Pixel} layerPx
*
* @returns px translated into view port pixel coordinates
* @type OpenLayers.Pixel
* @private
*/
getViewPortPxFromLayerPx:function(layerPx) {
var viewPortPx = layerPx.copyOf();
viewPortPx.x += parseInt(this.layerContainerDiv.style.left);
viewPortPx.y += parseInt(this.layerContainerDiv.style.top);
return viewPortPx;
},
/**
* @param {OpenLayers.Pixel} viewPortPx
*
* @returns px translated into view port pixel coordinates
* @type OpenLayers.Pixel
* @private
*/
getLayerPxFromViewPortPx:function(viewPortPx) {
var layerPx = viewPortPx.copyOf();
layerPx.x -= parseInt(this.layerContainerDiv.style.left);
layerPx.y -= parseInt(this.layerContainerDiv.style.top);
return layerPx;
},
/**
* @param {OpenLayers.Pixel} px
*
* @return {OpenLayers.LonLat}
*/
getLonLatFromLayerPx: function (px) {
//adjust for displacement of layerContainerDiv
px = this.getViewPortPxFromLayerPx(px);
return this.getLonLatFromViewPortPx(px);
},
/**
* @param {OpenLayers.Pixel} viewPortPx
*
* @returns An OpenLayers.LonLat which is the passed-in view port
* OpenLayers.Pixel, translated into lon/lat given the
* current extent and resolution
* @type OpenLayers.LonLat
* @private
*/
getLonLatFromViewPortPx: function (viewPortPx) {
var center = this.getCenter(); //map center lon/lat
var res = this.getResolution();
var size = this.getSize();
var delta_x = viewPortPx.x - (size.w / 2);
var delta_y = viewPortPx.y - (size.h / 2);
return new OpenLayers.LonLat(center.lon + delta_x * res ,
center.lat - delta_y * res);
},
// getLonLatFromPixel is a convenience function for the API
/**
* @param {OpenLayers.Pixel} pixel
*
* @returns An OpenLayers.LonLat corresponding to the given
* OpenLayers.Pixel, translated into lon/lat using the
* current extent and resolution
* @type OpenLayers.LonLat
*/
getLonLatFromPixel: function (px) {
return this.getLonLatFromViewPortPx(px);
},
/**
* @param {OpenLayers.LonLat} lonlat
*
* @returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat,
* translated into layer pixels given the current extent
* and resolution
* @type OpenLayers.Pixel
*/
getLayerPxFromLonLat: function (lonlat) {
//adjust for displacement of layerContainerDiv
var px = this.getViewPortPxFromLonLat(lonlat);
return this.getLayerPxFromViewPortPx(px);
},
/**
* @param {OpenLayers.LonLat} lonlat
*
* @returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat,
* translated into view port pixels given the current extent
* and resolution
* @type OpenLayers.Pixel
* @private
*/
getViewPortPxFromLonLat: function (lonlat) {
var resolution = this.getResolution();
var extent = this.getExtent();
return new OpenLayers.Pixel(
Math.round(1/resolution * (lonlat.lon - extent.left)),
Math.round(1/resolution * (extent.top - lonlat.lat))
);
},
// getLonLatFromPixel is a convenience function for the API
/**
* @param {OpenLayers.LonLat} lonlat
*
* @returns An OpenLayers.Pixel corresponding to the OpenLayers.LonLat
* translated into view port pixels using the current extent
* and resolution
* @type OpenLayers.Pixel
*/
getPixelFromLonLat: function (lonlat) {
return this.getViewPortPxFromLonLat(lonlat);
},
/**
* @param {OpenLayers.LonLat} lonlat
* @param {int} zoom
*/
setCenter: function (lonlat, zoom, minor) {
if (this.center) { // otherwise there's nothing to move yet
this.moveLayerContainer(lonlat);
}
this.center = lonlat.copyOf();
var zoomChanged = null;
if (zoom != null && zoom != this.zoom
&& zoom >= 0 && zoom <= this.getZoomLevels()) {
zoomChanged = (this.zoom == null ? 0 : this.zoom);
this.zoom = zoom;
}
if (!minor) this.events.triggerEvent("movestart");
this.moveToNewExtent(zoomChanged, minor);
if (!minor) this.events.triggerEvent("moveend");
},
/**
* ZOOM TO BOUNDS FUNCTION
* @private
*/
moveToNewExtent: function (zoomChanged, minor) {
if (zoomChanged != null) { // reset the layerContainerDiv's location
this.layerContainerDiv.style.left = "0px";
this.layerContainerDiv.style.top = "0px";
//redraw popups
for (var i = 0; i < this.popups.length; i++) {
this.popups[i].updatePosition();
}
}
var bounds = this.getExtent();
for (var i = 0; i < this.layers.length; i++) {
this.layers[i].moveTo(bounds, (zoomChanged != null), minor);
}
this.events.triggerEvent("move");
if (zoomChanged != null)
this.events.triggerEvent("zoomend",
{oldZoom: zoomChanged, newZoom: this.zoom});
},
/**
* zoomIn
* Increase zoom level by one.
* @param {int} zoom
*/
zoomIn: function() {
if (this.zoom != null && this.zoom <= this.getZoomLevels()) {
this.zoomTo( this.zoom += 1 );
}
},
/**
* zoomTo
* Set Zoom To int
* @param {int} zoom
*/
zoomTo: function(zoom) {
if (zoom >= 0 && zoom <= this.getZoomLevels()) {
var oldZoom = this.zoom;
this.zoom = zoom;
this.moveToNewExtent(oldZoom);
}
},
/**
* zoomOut
* Decrease zoom level by one.
* @param {int} zoom
*/
zoomOut: function() {
if (this.zoom != null && this.zoom > 0) {
this.zoomTo( this.zoom - 1 );
}
},
/**
* zoomToFullExtent
* Zoom to the full extent and recenter.
*/
zoomToFullExtent: function() {
var fullExtent = this.getFullExtent();
var oldZoom = this.zoom;
this.setCenter(
new OpenLayers.LonLat((fullExtent.left+fullExtent.right)/2,
(fullExtent.bottom+fullExtent.top)/2),
0
);
},
/**
* @param {OpenLayers.LonLat} lonlat
* @private
*/
moveLayerContainer: function (lonlat) {
var container = this.layerContainerDiv;
var resolution = this.getResolution();
var deltaX = Math.round((this.center.lon - lonlat.lon) / resolution);
var deltaY = Math.round((this.center.lat - lonlat.lat) / resolution);
var offsetLeft = parseInt(container.style.left);
var offsetTop = parseInt(container.style.top);
container.style.left = (offsetLeft + deltaX) + "px";
container.style.top = (offsetTop - deltaY) + "px";
},
CLASS_NAME: "OpenLayers.Map"
};

109
lib/OpenLayers/Marker.js Normal file
View File

@@ -0,0 +1,109 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/**
* @class
*/
OpenLayers.Marker = Class.create();
OpenLayers.Marker.prototype = {
/** @type OpenLayers.Icon */
icon: null,
/** location of object
* @type OpenLayers.LonLat */
lonlat: null,
/** @type OpenLayers.Events*/
events: null,
/** @type OpenLayers.Map */
map: null,
/**
* @constructor
*
* @param {OpenLayers.Icon} icon
* @param {OpenLayers.LonLat lonlat
*/
initialize: function(lonlat, icon) {
this.lonlat = lonlat;
this.icon = (icon) ? icon : OpenLayers.Marker.defaultIcon();
this.events = new OpenLayers.Events(this, this.icon.imageDiv, null);
},
destroy: function() {
this.map = null;
if (this.icon != null) {
this.icon.destroy();
this.icon = null;
}
},
/**
* @param {OpenLayers.Pixel} px
*
* @return A new DOM Image with this marker<65>s icon set at the
* location passed-in
* @type DOMElement
*/
draw: function(px) {
return this.icon.draw(px);
},
/**
* @param {OpenLayers.Pixel} px
*/
moveTo: function (px) {
if ((px != null) && (this.icon != null)) {
this.icon.moveTo(px);
}
},
/**
* @returns Whether or not the marker is currently visible on screen.
* @type Boolean
*/
onScreen:function() {
var onScreen = false;
if (this.map) {
var screenBounds = this.map.getExtent();
onScreen = screenBounds.contains(this.lonlat.lon, this.lonlat.lat);
}
return onScreen;
},
/**
* @param {float} inflate
*/
inflate: function(inflate) {
if (this.icon) {
var newSize = new OpenLayers.Size(this.icon.size.w * inflate,
this.icon.size.h * inflate);
this.icon.setSize(newSize);
}
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Marker"
};
/**
* @returns A default OpenLayers.Icon to use for a marker
* @type OpenLayers.Icon
*/
OpenLayers.Marker.defaultIcon = function() {
var url = OpenLayers.Util.getImagesLocation() + "marker.png";
var size = new OpenLayers.Size(21, 25);
var calculateOffset = function(size) {
return new OpenLayers.Pixel(-(size.w/2), -size.h);
};
return new OpenLayers.Icon(url, size, null, calculateOffset);
};

232
lib/OpenLayers/Popup.js Normal file
View File

@@ -0,0 +1,232 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/**
* @class
*/
OpenLayers.Popup = Class.create();
OpenLayers.Popup.count = 0;
OpenLayers.Popup.WIDTH = 200;
OpenLayers.Popup.HEIGHT = 200;
OpenLayers.Popup.COLOR = "white";
OpenLayers.Popup.OPACITY = 1;
OpenLayers.Popup.BORDER = "0px";
OpenLayers.Popup.prototype = {
/** @type OpenLayers.Events*/
events: null,
/** @type String */
id: "",
/** @type OpenLayers.LonLat */
lonlat: null,
/** @type DOMElement */
div: null,
/** @type OpenLayers.Size*/
size: null,
/** @type String */
contentHTML: "",
/** @type String */
backgroundColor: "",
/** @type float */
opacity: "",
/** @type String */
border: "",
/** this gets set in Map.js when the popup is added to the map
* @type OpenLayers.Map */
map: null,
/**
* @constructor
*
* @param {String} id
* @param {OpenLayers.LonLat} lonlat
* @param {OpenLayers.Size} size
* @param {String} contentHTML
*/
initialize:function(id, lonlat, size, contentHTML) {
OpenLayers.Popup.count += 1;
this.id = (id != null) ? id : "Popup" + OpenLayers.Popup.count;
this.lonlat = lonlat;
this.size = (size != null) ? size
: new OpenLayers.Size(
OpenLayers.Popup.WIDTH,
OpenLayers.Popup.HEIGHT);
if (contentHTML != null) {
this.contentHTML = contentHTML;
}
this.backgroundColor = OpenLayers.Popup.COLOR;
this.opacity = OpenLayers.Popup.OPACITY;
this.border = OpenLayers.Popup.BORDER;
this.div = OpenLayers.Util.createDiv(this.id + "_div", null, null,
null, null, null, "hidden");
this.events = new OpenLayers.Events(this, this.div, null);
},
/**
*/
destroy: function() {
if (this.map != null) {
this.map.removePopup(this);
}
this.div = null;
this.map = null;
},
/**
* @param {OpenLayers.Pixel} px
*
* @returns Reference to a div that contains the drawn popup
* @type DOMElement
*/
draw: function(px) {
if (px == null) {
if ((this.lonlat != null) && (this.map != null)) {
px = this.map.getLayerPxFromLonLat(this.lonlat);
}
}
this.setSize();
this.setBackgroundColor();
this.setOpacity();
this.setBorder();
this.setContentHTML();
this.moveTo(px);
return this.div;
},
/**
* if the popup has a lonlat and its map members set,
* then have it move itself to its proper position
*/
updatePosition: function() {
if ((this.lonlat) && (this.map)) {
var px = this.map.getLayerPxFromLonLat(this.lonlat);
this.moveTo(px);
}
},
/**
* @param {OpenLayers.Pixel} px
*/
moveTo: function(px) {
if ((px != null) && (this.div != null)) {
this.div.style.left = px.x + "px";
this.div.style.top = px.y + "px";
}
},
/**
* @returns Boolean indicating whether or not the popup is visible
* @type Boolean
*/
visible: function() {
return Element.visible(this.div);
},
/**
*
*/
toggle: function() {
Element.toggle(this.div);
},
/**
*
*/
show: function() {
Element.show(this.div);
},
/**
*
*/
hide: function() {
Element.hide(this.div);
},
/**
* @param {OpenLayers.Size} size
*/
setSize:function(size) {
if (size != undefined) {
this.size = size;
}
if (this.div != null) {
this.div.style.width = this.size.w;
this.div.style.height = this.size.h;
}
},
/**
* @param {String} color
*/
setBackgroundColor:function(color) {
if (color != undefined) {
this.backgroundColor = color;
}
if (this.div != null) {
this.div.style.backgroundColor = this.backgroundColor;
}
},
/**
* @param {float} opacity
*/
setOpacity:function(opacity) {
if (opacity != undefined) {
this.opacity = opacity;
}
if (this.div != null) {
// for Mozilla and Safari
this.div.style.opacity = this.opacity;
// for IE
this.div.style.filter = 'alpha(opacity=' + this.opacity*100 + ')';
}
},
/**
* @param {int} border
*/
setBorder:function(border) {
if (border != undefined) {
this.border = border;
}
if (this.div != null) {
this.div.style.border = this.border;
}
},
/**
* @param {String} contentHTML
*/
setContentHTML:function(contentHTML) {
if (contentHTML != null) {
this.contentHTML = contentHTML;
}
if (this.div != null) {
this.div.innerHTML = this.contentHTML;
}
},
CLASS_NAME: "OpenLayers.Popup"
};

View File

@@ -0,0 +1,125 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Popup.js
/**
* @class
*/
OpenLayers.Popup.Anchored = Class.create();
OpenLayers.Popup.Anchored.prototype =
Object.extend( new OpenLayers.Popup(), {
/** "lr", "ll", "tr", "tl" - relative position of the popup.
* @type String */
relativePosition: null,
/** Object which must have expose a 'size' (OpenLayers.Size) and
* 'offset' (OpenLayers.Pixel)
* @type Object */
anchor: null,
/**
* @constructor
*
* @param {String} id
* @param {OpenLayers.LonLat} lonlat
* @param {OpenLayers.Size} size
* @param {String} contentHTML
* @param {Object} anchor Object which must expose a
* - 'size' (OpenLayers.Size) and
* - 'offset' (OpenLayers.Pixel)
* (this is generally an OpenLayers.Icon)
*/
initialize:function(id, lonlat, size, contentHTML, anchor) {
var newArguments = new Array(id, lonlat, size, contentHTML);
OpenLayers.Popup.prototype.initialize.apply(this, newArguments);
this.anchor = (anchor != null) ? anchor
: { size: new OpenLayers.Size(0,0),
offset: new OpenLayers.Pixel(0,0)};
},
/**
* @param {OpenLayers.Pixel} px
*
* @returns Reference to a div that contains the drawn popup
* @type DOMElement
*/
draw: function(px) {
if (px == null) {
if ((this.lonlat != null) && (this.map != null)) {
px = this.map.getLayerPxFromLonLat(this.lonlat);
}
}
//calculate relative position
this.relativePosition = this.calculateRelativePosition(px);
return OpenLayers.Popup.prototype.draw.apply(this, arguments);
},
/**
* @private
*
* @param {OpenLayers.Pixel} px
*
* @returns The relative position ("br" "tr" "tl "bl") at which the popup
* should be placed
* @type String
*/
calculateRelativePosition:function(px) {
var lonlat = this.map.getLonLatFromLayerPx(px);
var extent = this.map.getExtent();
var quadrant = extent.determineQuadrant(lonlat);
return OpenLayers.Bounds.oppositeQuadrant(quadrant);
},
/**
* @param {OpenLayers.Pixel} px
*/
moveTo: function(px) {
var newPx = this.calculateNewPx(px);
var newArguments = new Array(newPx);
OpenLayers.Popup.prototype.moveTo.apply(this, newArguments);
},
/**
* @param {OpenLayers.Size} size
*/
setSize:function(size) {
OpenLayers.Popup.prototype.setSize.apply(this, arguments);
if ((this.lonlat) && (this.map)) {
var px = this.map.getLayerPxFromLonLat(this.lonlat);
this.moveTo(px);
}
},
/**
* @private
*
* @param {OpenLayers.Pixel} px
*
* @returns The the new px position of the popup on the screen
* relative to the passed-in px
* @type OpenLayers.Pixel
*/
calculateNewPx:function(px) {
var newPx = px.offset(this.anchor.offset);
var top = (this.relativePosition.charAt(0) == 't');
newPx.y += (top) ? -this.size.h : this.anchor.size.h;
var left = (this.relativePosition.charAt(1) == 'l');
newPx.x += (left) ? -this.size.w : this.anchor.size.w;
return newPx;
},
CLASS_NAME: "OpenLayers.Popup.Anchored"
});

View File

@@ -0,0 +1,183 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
// @require: OpenLayers/Popup/Anchored.js
/**
* @class
*/
OpenLayers.Popup.AnchoredBubble = Class.create();
//Border space for the rico corners
OpenLayers.Popup.AnchoredBubble.CORNER_SIZE = 5;
OpenLayers.Popup.AnchoredBubble.prototype =
Object.extend( new OpenLayers.Popup.Anchored(), {
/** @type DOMElement */
contentDiv:null,
/**
* @constructor
*
* @param {String} id
* @param {OpenLayers.LonLat} lonlat
* @param {OpenLayers.Size} size
* @param {String} contentHTML
* @param {Object} anchor Object which must expose a
* - 'size' (OpenLayers.Size) and
* - 'offset' (OpenLayers.Pixel)
* (this is generally an OpenLayers.Icon)
*/
initialize:function(id, lonlat, size, contentHTML, anchor) {
OpenLayers.Popup.Anchored.prototype.initialize.apply(this, arguments);
},
/**
* @param {OpenLayers.Pixel} px
*
* @returns Reference to a div that contains the drawn popup
* @type DOMElement
*/
draw: function(px) {
OpenLayers.Popup.Anchored.prototype.draw.apply(this, arguments);
// make the content Div
var contentSize = this.size.copyOf();
contentSize.h -= (2 * OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);
var id = this.div.id + "-contentDiv";
this.contentDiv = OpenLayers.Util.createDiv(id, null, contentSize,
null, "relative", null,
"none");
this.div.appendChild(this.contentDiv);
this.setContentHTML();
this.setRicoCorners(true);
//set the popup color and opacity
this.setBackgroundColor();
this.setOpacity();
return this.div;
},
/**
* @param {OpenLayers.Size} size
*/
setSize:function(size) {
OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments);
if (this.contentDiv != null) {
var contentSize = this.size.copyOf();
contentSize.h -= (2 * OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);
this.contentDiv.style.height = contentSize.h + "px";
//size has changed - must redo corners
this.setRicoCorners(false);
}
},
/**
* @param {String} color
*/
setBackgroundColor:function(color) {
if (color != undefined) {
this.backgroundColor = color;
}
if (this.div != null) {
if (this.contentDiv != null) {
this.div.style.background = "transparent";
Rico.Corner.changeColor(this.contentDiv, this.backgroundColor);
}
}
},
/**
* @param {float} opacity
*/
setOpacity:function(opacity) {
if (opacity != undefined) {
this.opacity = opacity;
}
if (this.div != null) {
if (this.contentDiv != null) {
Rico.Corner.changeOpacity(this.contentDiv, this.opacity);
}
}
},
/** Bubble Popups can not have a border
*
* @param {int} border
*/
setBorder:function(border) {
this.border = 0;
},
/**
* @param {String} contentHTML
*/
setContentHTML:function(contentHTML) {
if (contentHTML != null) {
this.contentHTML = contentHTML;
}
if (this.contentDiv != null) {
this.contentDiv.innerHTML = this.contentHTML;
}
},
/**
* @private
*
* @param {Boolean} firstTime Is this the first time the corners are being
* rounded?
*
* update the rico corners according to the popup's
* current relative postion
*/
setRicoCorners:function(firstTime) {
var corners = this.getCornersToRound(this.relativePosition);
var options = {corners: corners,
color: this.backgroundColor,
bgColor: "transparent",
blend: false};
if (firstTime) {
Rico.Corner.round(this.div, options);
} else {
Rico.Corner.reRound(this.contentDiv, options);
//set the popup color and opacity
this.setBackgroundColor();
this.setOpacity();
}
},
/**
* @private
*
* @returns The proper corners string ("tr tl bl br") for rico
* to round
* @type String
*/
getCornersToRound:function() {
var corners = ['tl', 'tr', 'bl', 'br'];
//we want to round all the corners _except_ the opposite one.
var corner = OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);
corners.remove(corner);
return corners.join(" ");
},
CLASS_NAME: "OpenLayers.Popup.AnchoredBubble"
});

View File

@@ -0,0 +1,5 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
_OPENLAYERS_SFL_=true

85
lib/OpenLayers/Tile.js Normal file
View File

@@ -0,0 +1,85 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/*
* OpenLayers.Tile
*
* @class This is a class designed to designate a single tile, however
* it is explicitly designed to do relatively little. Tiles store information
* about themselves -- such as the URL that they are related to, and their
* size - but do not add themselves to the layer div automatically, for
* example.
*/
OpenLayers.Tile = Class.create();
OpenLayers.Tile.prototype = {
/** @type OpenLayers.Layer */
layer: null,
/** @type String url of the request */
url:null,
/** @type OpenLayers.Bounds */
bounds:null,
/** @type OpenLayers.Size */
size:null,
/** Top Left pixel of the tile
* @type OpenLayers.Pixel */
position:null,
/**
* @constructor
*
* @param {OpenLayers.Layer} layer
* @param {OpenLayers.Pixel} position
* @param {OpenLayers.Bounds} bounds
* @param {String} url
* @param {OpenLayers.Size} size
*/
initialize: function(layer, position, bounds, url, size) {
if (arguments.length > 0) {
this.layer = layer;
this.position = position;
this.bounds = bounds;
this.url = url;
this.size = size;
}
},
/** nullify references to prevent circular references and memory leaks
*/
destroy:function() {
this.layer = null;
this.bounds = null;
this.size = null;
},
/**
*/
draw:function() {
// HACK HACK - should we make it a standard to put this sort of warning
// message in functions that are supposed to be overridden?
//
// Log.warn(this.CLASS_NAME + ": draw() not implemented");
},
/** remove this tile from the ds
*/
remove:function() {
},
/**
* @type OpenLayers.Pixel
*/
getPosition: function() {
return this.position;
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Tile"
};

Some files were not shown because too many files have changed in this diff Show More