]> dev.renevier.net Git - syp.git/blob - openlayers/tests/manual/clip-features-svg.html
show number of features on cluster markers
[syp.git] / openlayers / tests / manual / clip-features-svg.html
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head>
3 <title>SVG inValidRange Test Case</title><link
4 href="../../theme/default/style.css"
5 rel="stylesheet" type="text/css">
6 <style>
7        #map {
8              width: 512px;
9              height: 512px;
10              border: 1px solid #4B3624;
11              background: White;
12        }
13        .olControlAttribution { bottom: 0px!important }
14 </style>
15 <script src="../../lib/OpenLayers.js"
16 type="text/javascript"></script>
17 <script type="text/javascript">var map;
18
19      // avoid pink tiles
20      OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
21      OpenLayers.Util.onImageLoadErrorColor = "transparent";
22
23       var vectorLayer;
24       var markerLayer, boxes, newPoint;
25
26       function init(){
27               var options = {
28                   projection: new OpenLayers.Projection("EPSG:900913"),
29                   units: "m",
30                   numZoomLevels: 19,
31                   maxResolution: 156543.0339,
32                   maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
33                                                    20037508, 20037508.34)
34               };
35               map = new OpenLayers.Map('map', options);
36
37               map.addControl(new OpenLayers.Control.MousePosition());
38
39               vectorLayer = new OpenLayers.Layer.Vector("Trails", {isBaseLayer: true});
40               markerLayer = new OpenLayers.Layer.Markers("WayPoints");
41
42               map.addLayers([vectorLayer,markerLayer]);
43
44               var style_trail = OpenLayers.Util.extend({},
45                   OpenLayers.Feature.Vector.style['default']);
46               style_trail.strokeColor = "green";
47               style_trail.strokeWidth = 5;
48
49               var pointList = [];
50
51               newPoint = new OpenLayers.Geometry.Point(-13653735.8487833,5726045.3578081);
52               pointList.push(newPoint);
53               newPoint = new OpenLayers.Geometry.Point(-13653731.3960036,5726056.5070679);
54               pointList.push(newPoint);
55               newPoint = new OpenLayers.Geometry.Point(-13653730.8394062,5726044.7207079);
56               pointList.push(newPoint);
57               newPoint = new OpenLayers.Geometry.Point(-13653743.1958697,5726043.9243328);
58               pointList.push(newPoint);
59               newPoint = new OpenLayers.Geometry.Point(-13653754.1051798,5726046.9505586);
60               pointList.push(newPoint);
61               newPoint = new OpenLayers.Geometry.Point(-13653760.4503907,5726056.5070679);
62               pointList.push(newPoint);
63               newPoint = new OpenLayers.Geometry.Point(-13653767.4635187,5726065.5857612);
64               pointList.push(newPoint);
65               newPoint = new OpenLayers.Geometry.Point(-13653830.136392,5726052.2066375);
66               pointList.push(newPoint);
67               newPoint = new OpenLayers.Geometry.Point(-13653846.5003571,5726042.3315828);
68               pointList.push(newPoint);
69
70               var lineFeature = new OpenLayers.Feature.Vector(
71                       new OpenLayers.Geometry.LineString(pointList));
72               lineFeature.fid = 52730;
73               vectorLayer.addFeatures(lineFeature);
74
75               pointList = [];
76               
77               newPoint = new OpenLayers.Geometry.Point(-12250153.3626406,4852001.6114048);
78               pointList.push(newPoint);
79               newPoint = new OpenLayers.Geometry.Point(-12194315.5060664,4800503.5113048);
80               pointList.push(newPoint);
81               newPoint = new OpenLayers.Geometry.Point(-12180445.0975155,4873109.008858);
82               pointList.push(newPoint);
83
84               lineFeature = new OpenLayers.Feature.Vector(
85                   new OpenLayers.Geometry.LineString(pointList),null,style_trail);
86               lineFeature.fid = 52751;
87               vectorLayer.addFeatures([lineFeature]);
88
89               var size = new OpenLayers.Size(15, 15);
90               var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
91               var icon = new OpenLayers.Icon('../../img/marker.png', size, offset);
92               markerLayer.addMarker(new OpenLayers.Marker(
93                   new OpenLayers.LonLat((newPoint.x + 400), (newPoint.y - 400)), icon));
94
95               map.setCenter(new OpenLayers.LonLat(newPoint.x, newPoint.y), 13)
96       }
97
98       function zoomToScale(zoom) {
99          if (zoom == 8) map.zoomToScale(3385.5001275);
100          else if(zoom == 7) map.zoomToScale(6771.000255);
101          else if (zoom == 6) map.zoomToScale(13542);
102          else if (zoom == 5) map.zoomToScale(27084.001020);
103          else if (zoom == 4) map.zoomToScale(54168.001020);
104          else if (zoom == 3) map.zoomToScale(108337);
105          else if (zoom == 2) map.zoomToScale(3466752.1306573446);
106          else if (zoom == 1) map.zoomToScale(13867008.522629378);
107          else if (zoom == 0) map.zoomToScale(55468034.09051751);
108       }
109
110 </script>
111 </head>
112 <body onLoad="init()">
113 <h1 id="title">SVG inValidRange Clipping Test Case</h1>
114 <p>Behavior before fixing #1631: Push Zoom 5.  You see lines.  Push
115 Zoom 6.  No lines.</p>
116     <div id="map">
117     </div>
118     <button onClick="zoomToScale(5);">Zoom 5</button>
119     <button onClick="zoomToScale(6);">Zoom 6</button>
120     <button onClick="zoomToScale(7);">Zoom 7</button>
121     <button onClick="zoomToScale(8);">Zoom 8</button>
122 </body>
123 </html>