aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/reports.t
diff options
context:
space:
mode:
Diffstat (limited to 't/app/controller/reports.t')
0 files changed, 0 insertions, 0 deletions
#n60'>60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
/* 
 * Maps for FMZ using Zurich council's WMTS tile server 
 */

function fixmystreet_zurich_admin_drag() {
    var admin_drag = new OpenLayers.Control.DragFeature( fixmystreet.markers, {
        onComplete: function(feature, e) {
            var lonlat = feature.geometry.clone();
            lonlat.transform(
                fixmystreet.map.getProjectionObject(),
                new OpenLayers.Projection("EPSG:4326")
            );
            if (window.confirm( 'Richtiger Ort?' ) ) {
                // Store new co-ordinates
                document.getElementById('fixmystreet.latitude').value = lonlat.y;
                document.getElementById('fixmystreet.longitude').value = lonlat.x;
            } else {
                // Put it back
                var lat = document.getElementById('fixmystreet.latitude').value;
                var lon = document.getElementById('fixmystreet.longitude').value;
                lonlat = new OpenLayers.LonLat(lon, lat).transform(
                    new OpenLayers.Projection("EPSG:4326"),
                    fixmystreet.map.getProjectionObject()
                );
                fixmystreet.markers.features[0].move(lonlat);
            }
        }
    } );
    fixmystreet.map.addControl( admin_drag );
    admin_drag.activate();
}

$(function(){
    $('#map_layer_toggle').toggle(function(){
        $(this).text('Luftbild');
        fixmystreet.map.setBaseLayer(fixmystreet.map.layers[1]);
    }, function(){
        $(this).text('Stadtplan');
        fixmystreet.map.setBaseLayer(fixmystreet.map.layers[0]);
    });

    /* Admin dragging of pin */
    if (fixmystreet.page == 'admin') {
        if ($.browser.msie) {
            $(window).load(fixmystreet_zurich_admin_drag);
        } else {
            fixmystreet_zurich_admin_drag();
        }
    }
});

/* 
 * set_map_config() is called on dom ready in map-OpenLayers.js
 * to setup the way the map should operate.
 */
 function set_map_config(perm) {
    // This stuff is copied from js/map-bing-ol.js

    fixmystreet.controls = [
        new OpenLayers.Control.ArgParser(),
        new OpenLayers.Control.Navigation()
    ];
    if ( fixmystreet.page != 'report' || !$('html').hasClass('mobile') ) {
        fixmystreet.controls.push( new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' }) );
    }

    /* Linking back to around from report page, keeping track of map moves */
    if ( fixmystreet.page == 'report' ) {
        fixmystreet.controls.push( new OpenLayers.Control.PermalinkFMS('key-tool-problems-nearby', '/around') );
    }

    fixmystreet.map_type = OpenLayers.Layer.WMTS;

    // Set DPI - default is 72
    OpenLayers.DOTS_PER_INCH = 96;

    fixmystreet.map_options = {
        maxExtent: new OpenLayers.Bounds(676000, 241402, 689896, 254596),
        units: 'm',
        scales: [ '64000', '32000', '16000', '8000', '4000', '2000', '1000', '500', '250' ]
    };

    var layer_options = {
        projection: new OpenLayers.Projection("EPSG:21781"),
        name: "tiled_LuftbildHybrid",
        layer: "tiled_LuftbildHybrid",
        matrixSet: "default028mm",
        requestEncoding: "REST",
        url: "//www.gis.stadt-zuerich.ch/maps/rest/services/tiled/LuftbildHybrid/MapServer/WMTS/tile/",
        style: "default",
        matrixIds: [
            // {
            //     "identifier": "0",
            //     "matrixHeight": 903,
            //     "matrixWidth": 889,
            //     "scaleDenominator": 236235.59151877242,
            //     "supportedCRS": "urn:ogc:def:crs:EPSG::21781",
            //     "tileHeight": 512,
            //     "tileWidth": 512,
            //     "topLeftCorner": {
            //         "lat": 30814423,
            //         "lon": -29386322
            //     }
            // },
            // {
            //     "identifier": "1",
            //     "matrixHeight": 1806,
            //     "matrixWidth": 1777,
            //     "scaleDenominator": 118117.79575938621,
            //     "supportedCRS": "urn:ogc:def:crs:EPSG::21781",
            //     "tileHeight": 512,
            //     "tileWidth": 512,
            //     "topLeftCorner": {
            //         "lat": 30814423,
            //         "lon": -29386322
            //     }
            // },
            {
                "identifier": "2",
                "matrixHeight": 3527,
                "matrixWidth": 3470,
                "scaleDenominator": 60476.31142880573,
                "supportedCRS": "urn:ogc:def:crs:EPSG::21781",
                "tileHeight": 512,
                "tileWidth": 512,
                "topLeftCorner": {
                    "lat": 30814423,
                    "lon": -29386322
                }
            },
            {
                "identifier": "3",
                "matrixHeight": 7053,
                "matrixWidth": 6939,
                "scaleDenominator": 30238.155714402867,
                "supportedCRS": "urn:ogc:def:crs:EPSG::21781",
                "tileHeight": 512,
                "tileWidth": 512,
                "topLeftCorner": {
                    "lat": 30814423,
                    "lon": -29386322
                }
            },
            {
                "identifier": "4",
                "matrixHeight": 14106,
                "matrixWidth": 13877,
                "scaleDenominator": 15119.077857201433,
                "supportedCRS": "urn:ogc:def:crs:EPSG::21781",
                "tileHeight": 512,
                "tileWidth": 512,
                "topLeftCorner": {
                    "lat": 30814423,
                    "lon": -29386322
                }
            },
            {
                "identifier": "5",
                "matrixHeight": 28211,
                "matrixWidth": 27753,
                "scaleDenominator": 7559.538928600717,
                "supportedCRS": "urn:ogc:def:crs:EPSG::21781",
                "tileHeight": 512,
                "tileWidth": 512,
                "topLeftCorner": {
                    "lat": 30814423,
                    "lon": -29386322
                }
            },
            {
                "identifier": "6",
                "matrixHeight": 56422,
                "matrixWidth": 55505,
                "scaleDenominator": 3779.7694643003583,
                "supportedCRS": "urn:ogc:def:crs:EPSG::21781",
                "tileHeight": 512,
                "tileWidth": 512,
                "topLeftCorner": {
                    "lat": 30814423,
                    "lon": -29386322
                }
            },
            {
                "identifier": "7",
                "matrixHeight": 112844,
                "matrixWidth": 111010,
                "scaleDenominator": 1889.8847321501792,
                "supportedCRS": "urn:ogc:def:crs:EPSG::21781",
                "tileHeight": 512,
                "tileWidth": 512,
                "topLeftCorner": {
                    "lat": 30814423,
                    "lon": -29386322
                }
            },
            {
                "identifier": "8",
                "matrixHeight": 225687,
                "matrixWidth": 222020,
                "scaleDenominator": 944.9423660750896,
                "supportedCRS": "urn:ogc:def:crs:EPSG::21781",
                "tileHeight": 512,
                "tileWidth": 512,
                "topLeftCorner": {
                    "lat": 30814423,
                    "lon": -29386322
                }
            },
            {
                "identifier": "9",
                "matrixHeight": 451374,
                "matrixWidth": 444039,
                "scaleDenominator": 472.4711830375448,
                "supportedCRS": "urn:ogc:def:crs:EPSG::21781",
                "tileHeight": 512,
                "tileWidth": 512,
                "topLeftCorner": {
                    "lat": 30814423,
                    "lon": -29386322
                }
            },
            {
                "identifier": "10",
                "matrixHeight": 902748,
                "matrixWidth": 888078,
                "scaleDenominator": 236.2355915187724,
                "supportedCRS": "urn:ogc:def:crs:EPSG::21781",
                "tileHeight": 512,
                "tileWidth": 512,
                "topLeftCorner": {
                    "lat": 30814423,
                    "lon": -29386322
                }
            }
        ]
    };
    fixmystreet.layer_options = [
        layer_options, OpenLayers.Util.applyDefaults({
            name: "Stadtplan3D",
            layer: "Stadtplan3D",
            url:  "//www.gis.stadt-zuerich.ch/maps/rest/services/tiled/Stadtplan3D/MapServer/WMTS/tile/"
        }, layer_options)
    ];

    // Give main code a new bbox_strategy that translates between
    // lat/lon and our swiss coordinates
    fixmystreet.bbox_strategy = new OpenLayers.Strategy.ZurichBBOX({ratio: 1});

    fixmystreet.area_format = { fillColor: 'none', strokeWidth: 4, strokeColor: 'black' };
}

OpenLayers.Strategy.ZurichBBOX = OpenLayers.Class(OpenLayers.Strategy.BBOX, {
    getMapBounds: function() {
        // Get the map bounds but return them in lat/lon, not
        // Swiss coordinates
        if (this.layer.map === null) {
            return null;
        }

        var swissBounds = this.layer.map.getExtent();
        // Transform bound corners into WGS84
        swissBounds.transform( new OpenLayers.Projection("EPSG:21781"), new OpenLayers.Projection("EPSG:4326") );
        return swissBounds;
    },

    CLASS_NAME: "OpenLayers.Strategy.ZurichBBOX"
});