WME MapRaid MapRaid Houston Overlay

Creates polygons for MapRaid groups in a WME "MapRaid Houston Groups" layer

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name                WME MapRaid MapRaid Houston Overlay
// @namespace           https://greasyfork.org/users/5252
// @description         Creates polygons for MapRaid groups in a WME "MapRaid Houston Groups" layer
// @include             https://www.waze.com/editor/*
// @include             https://www.waze.com/*/editor/*
// @include             https://editor-beta.waze.com/*
// @version             1.6
// @grant               none
// @copyright           2014 davielde
// ==/UserScript==


//---------------------------------------------------------------------------------------


//generated by rickzabel's overlay generator

//RZ RaidName will be replaced by the name of the layer in your KML file
//RZ RaidNameNoSpaces will be replaced by the name of the layer in your KML file
//RZ AreaPoints will be replaced by the names, colors, and area points from your KML file



setTimeout(InitMapRaidOverlay, 1000);


function AddRaidPolygon(raidLayer,groupPoints,groupColor,groupNumber){
    
    var mro_Map = Waze.map;
    var mro_OL = OpenLayers;
    var raidGroupLabel = 'Raid Group ' + groupNumber;
    var groupName = 'RaidGroup' + groupNumber;
    
    var style = {
        strokeColor: groupColor,
        strokeOpacity: .8,
        strokeWidth: 3,
        fillColor: groupColor,
        fillOpacity: 0.15,
        label: raidGroupLabel,
        labelOutlineColor: "black",
        labelOutlineWidth: 3,
        fontSize: 14,
        fontColor: groupColor,
        fontOpacity: .85,
        fontWeight: "bold"  
    };
    
    var attributes = {
        name: groupName,
        number: groupNumber
    };
    
    var pnt= [];
    for(i=0;i<groupPoints.length;i++){
        convPoint = new OpenLayers.Geometry.Point(groupPoints[i].lon,groupPoints[i].lat).transform(new OpenLayers.Projection("EPSG:4326"), mro_Map.getProjectionObject());
        //console.log('MapRaid: ' + JSON.stringify(groupPoints[i]) + ', ' + groupPoints[i].lon + ', ' + groupPoints[i].lat);
        pnt.push(convPoint);
    }
		       
    var ring = new mro_OL.Geometry.LinearRing(pnt);
    var polygon = new mro_OL.Geometry.Polygon([ring]);
    
    var feature = new mro_OL.Feature.Vector(polygon,attributes,style);
    raidLayer.addFeatures([feature]);

}

function CurrentRaidLocation(raid_mapLayer){
    var mro_Map = Waze.map;

    for(i=0;i<raid_mapLayer.features.length;i++){
        var raidMapCenter = mro_Map.getCenter();
        var raidCenterPoint = new OpenLayers.Geometry.Point(raidMapCenter.lon,raidMapCenter.lat);
        var raidCenterCheck = raid_mapLayer.features[i].geometry.components[0].containsPoint(raidCenterPoint);
        //console.log('MapRaid: ' + raid_mapLayer.features[i].attributes.number + ': ' + raidCenterCheck);
        if(raidCenterCheck === true){
        	var raidLocationLabel = 'Raid Group ' + raid_mapLayer.features[i].attributes.number + ' - ' + $('.WazeControlLocationInfo').text();
    		setTimeout(function(){$('.WazeControlLocationInfo').text(raidLocationLabel)},200);
        }
    }
}

function InitMapRaidOverlay(){

    var mro_Map = Waze.map;
    var mro_OL = OpenLayers;

    //if (!mro_Map) return;
	
    //if (!mro_OL) return;

    var mro_mapLayers = mro_Map.getLayersBy("uniqueName","__MapRaidHouston");
        
    var raid_mapLayer = new mro_OL.Layer.Vector("MapRaid Houston", {
        displayInLayerSwitcher: true,
        uniqueName: "__MapRaidHouston"
    });
        
    I18n.translations.en.layers.name["__MapRaidHouston"] = "MapRaid Houston";
    mro_Map.addLayer(raid_mapLayer);
    raid_mapLayer.setVisibility(true);
    

var V01Downtown = [{lon:'-95.5673217',lat:'29.869228799999995'},{lon:'-95.5645726',lat:'29.788197'},{lon:'-95.5632019',lat:'29.653449'},{lon:'-95.4594976',lat:'29.599157700000003'},{lon:'-95.3915405',lat:'29.604506300000004'},{lon:'-95.2075195',lat:'29.609282199999996'},{lon:'-95.151917',lat:'29.6415029'},{lon:'-95.1422882',lat:'29.7136995'},{lon:'-95.1390493',lat:'29.7483578'},{lon:'-95.1543517',lat:'29.7800343'},{lon:'-95.182152',lat:'29.871979799999995'},{lon:'-95.1862665',lat:'29.8956369'},{lon:'-95.2006589',lat:'29.93762359999999'},{lon:'-95.24459840000002',lat:'29.932324899999998'},{lon:'-95.2909049',lat:'29.9415605'},{lon:'-95.3867323',lat:'29.937715500000003'},{lon:'-95.51551020000001',lat:'29.941590300000005'},{lon:'-95.5585908',lat:'29.928029200000005'},{lon:'-95.5622709',lat:'29.9004149'},{lon:'-95.5673217',lat:'29.869228799999995'}];
AddRaidPolygon(raid_mapLayer, V01Downtown,"#62AF44","01-Downtown");

var V04Alvin = [{lon:'-95.2075195',lat:'29.609282199999996'},{lon:'-95.3915405',lat:'29.604506300000004'},{lon:'-95.3942871',lat:'29.504159100000003'},{lon:'-95.4272461',lat:'29.4682966'},{lon:'-95.4272461',lat:'29.322325500000005'},{lon:'-95.4519653',lat:'29.274420500000005'},{lon:'-95.4519653',lat:'29.034559299999998'},{lon:'-95.4052734',lat:'28.842267799999995'},{lon:'-94.7845459',lat:'29.262440800000004'},{lon:'-95.2075195',lat:'29.609282199999996'}];
AddRaidPolygon(raid_mapLayer, V04Alvin,"#93D7E8","04-Alvin");

var V03Galveston = [{lon:'-95.1543517',lat:'29.7800343'},{lon:'-95.1390493',lat:'29.7483578'},{lon:'-95.151917',lat:'29.6415029'},{lon:'-95.2075195',lat:'29.609282199999996'},{lon:'-94.7845459',lat:'29.262440800000004'},{lon:'-94.5263672',lat:'29.453948100000005'},{lon:'-94.6499634',lat:'29.847790900000003'},{lon:'-95.0592041',lat:'29.800134500000002'},{lon:'-95.1543517',lat:'29.7800343'}];
AddRaidPolygon(raid_mapLayer, V03Galveston,"#4186F0","03-Galveston");

var V02LakeHouston = [{lon:'-95.1543517',lat:'29.7800343'},{lon:'-94.6499634',lat:'29.847790900000003'},{lon:'-95.0756836',lat:'30.356286400000002'},{lon:'-95.2349854',lat:'30.1380016'},{lon:'-95.2909049',lat:'29.9415605'},{lon:'-95.24459840000002',lat:'29.932324899999998'},{lon:'-95.2006589',lat:'29.93762359999999'},{lon:'-95.1543517',lat:'29.7800343'}];
AddRaidPolygon(raid_mapLayer, V02LakeHouston,"#D698AD","02-Lake Houston");

var V09Spring = [{lon:'-95.2909049',lat:'29.9415605'},{lon:'-95.2349854',lat:'30.1380016'},{lon:'-95.0756836',lat:'30.356286400000002'},{lon:'-95.3311157',lat:'30.519681300000002'},{lon:'-95.4959106',lat:'30.562260999999996'},{lon:'-95.4272461',lat:'29.935895199999994'},{lon:'-95.2909049',lat:'29.9415605'}];
AddRaidPolygon(raid_mapLayer, V09Spring,"#DB4436","09-Spring");

var V08Montgomery = [{lon:'-95.5673217',lat:'29.869228799999995'},{lon:'-95.5585908',lat:'29.928029200000005'},{lon:'-95.51551020000001',lat:'29.941590300000005'},{lon:'-95.4272461',lat:'29.935895199999994'},{lon:'-95.4959106',lat:'30.562260999999996'},{lon:'-96.0726929',lat:'30.4013065'},{lon:'-96.0424805',lat:'30.270928399999995'},{lon:'-96.0809326',lat:'30.116621600000006'},{lon:'-95.9381104',lat:'30.083354599999996'},{lon:'-95.84198',lat:'30.026299599999998'},{lon:'-95.7019043',lat:'29.9811077'},{lon:'-95.5673217',lat:'29.869228799999995'}];
AddRaidPolygon(raid_mapLayer, V08Montgomery,"#0BA9CC","08-Montgomery");

var V07Katy = [{lon:'-96.0809326',lat:'30.116621600000006'},{lon:'-96.2594604',lat:'29.950175099999996'},{lon:'-96.1495972',lat:'29.769145700000006'},{lon:'-95.5645726',lat:'29.788197'},{lon:'-95.5673217',lat:'29.869228799999995'},{lon:'-95.7019043',lat:'29.9811077'},{lon:'-95.84198',lat:'30.026299599999998'},{lon:'-95.9381104',lat:'30.083354599999996'},{lon:'-96.0809326',lat:'30.116621600000006'}];
AddRaidPolygon(raid_mapLayer, V07Katy,"#CDDC39","07-Katy");

var V06FortBend = [{lon:'-95.5645726',lat:'29.788197'},{lon:'-96.1495972',lat:'29.769145700000006'},{lon:'-96.111145',lat:'29.312746300000008'},{lon:'-95.5632019',lat:'29.653449'},{lon:'-95.5645726',lat:'29.788197'}];
AddRaidPolygon(raid_mapLayer, V06FortBend,"#E6EEA3","06-Fort Bend");

var V05Brazoria = [{lon:'-96.111145',lat:'29.312746300000008'},{lon:'-95.9655762',lat:'28.9672979'},{lon:'-95.4052734',lat:'28.842267799999995'},{lon:'-95.4519653',lat:'29.034559299999998'},{lon:'-95.4519653',lat:'29.274420500000005'},{lon:'-95.4272461',lat:'29.322325500000005'},{lon:'-95.4272461',lat:'29.4682966'},{lon:'-95.3942871',lat:'29.504159100000003'},{lon:'-95.3915405',lat:'29.604506300000004'},{lon:'-95.4594976',lat:'29.599157700000003'},{lon:'-95.5632019',lat:'29.653449'},{lon:'-96.111145',lat:'29.312746300000008'}];
AddRaidPolygon(raid_mapLayer, V05Brazoria,"#FFDD5E","05-Brazoria");


    
	
    setTimeout(function(){CurrentRaidLocation(raid_mapLayer)},3000);
    mro_Map.events.register("moveend", Waze.map, function(){CurrentRaidLocation(raid_mapLayer)});
    mro_Map.events.register("zoomend", Waze.map, function(){CurrentRaidLocation(raid_mapLayer)});
       
}