-->
var XB = XB || {}; // global used for xblock adapter scripts
Ext.onReady(function() {
var config = {
useCapabilities: false,
tools: [{
ptype: "gxp_wmsgetfeatureinfo",
// uncomment the line below if you want feature info in a grid
format: "grid",
actionTarget: "main.tbar",
outputConfig: {width: 400, height: 200, panIn: false}
}, //***** XBLOCK RELATED SETUP *******
{
ptype: "gxp_coordinatetool",
title: "Map Coordinates - longitude, latitude",
actionTarget: {target: "main.tbar"}
},
{
ptype: "gxp_annotation",
user: "None",
toggleGroup: 'featureGroup',
actionTarget: {target: "main.tbar", index: 6}
}
//***** END - XBLOCK RELATED SETUP ******
],
createTools: function() {
return [new Ext.Button({
tooltip: GeoExplorer.prototype.backgroundContainerText,
iconCls: 'icon-layer-switcher',
menu: new gxp.menu.LayerMenu({
layers: this.mapPanel.layers
})
})]
},
proxy: "/proxy/?url=",
siteUrl: "http://worldmap.harvard.edu/",
/* The URL to a REST map configuration service. This service
* provides listing and, with an authenticated user, saving of
* maps on the server for sharing and editing.
*/
rest: "/maps/"
};
Ext.apply(config, {"map": {"layers": [{"opacity": 1, "args": ["No background"], "group": "background", "name": "No background", "title": "No background", "url": null, "selected": false, "visibility": false, "source": "0", "fixed": true, "type": "OpenLayers.Layer"}, {"opacity": 1, "args": ["OpenStreetMap"], "group": "background", "name": "OpenStreetMap", "title": "OpenStreetMap", "url": null, "selected": false, "visibility": false, "source": "0", "fixed": true, "type": "OpenLayers.Layer.OSM"}, {"opacity": 1, "group": "background", "name": "AerialWithLabels", "title": "Bing Aerial With Labels", "url": null, "selected": false, "visibility": false, "source": "1", "fixed": true}, {"opacity": 1, "group": "background", "name": "watercolor", "title": "Stamen Watercolor", "url": null, "selected": false, "visibility": false, "source": "2", "fixed": true}, {"opacity": 1, "group": "background", "name": "toner", "title": "Stamen Toner", "url": null, "selected": false, "visibility": false, "source": "2", "fixed": true}, {"opacity": 1, "group": "background", "name": "World Shaded Relief", "format": "jpeg", "url": "http://services.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer", "selected": false, "visibility": false, "source": "3", "tiled": false, "title": "ESRI World Shaded Relief", "fixed": true}, {"opacity": 1, "group": "background", "name": "World Street Map", "format": "jpeg", "url": "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer", "selected": false, "visibility": false, "source": "4", "tiled": false, "title": "ESRI World Street Map", "fixed": true}, {"opacity": 1, "group": "background", "name": "World Imagery", "format": "jpeg", "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer", "selected": false, "visibility": false, "source": "5", "tiled": false, "title": "ESRI World Imagery", "fixed": true}, {"opacity": 1, "group": "background", "name": "Light Gray Canvas Base", "format": "jpeg", "url": "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer", "selected": false, "visibility": false, "source": "6", "tiled": false, "title": "ESRI Light Gray Reference", "fixed": true}, {"opacity": 1, "group": "background", "name": "Dark Gray Canvas Base", "format": "jpeg", "url": "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer", "selected": false, "visibility": false, "source": "7", "tiled": false, "title": "ESRI Dark Gray Reference", "fixed": true}, {"opacity": 1, "group": "background", "name": "SATELLITE", "title": "Google Satellite", "url": null, "selected": false, "visibility": false, "source": "8", "fixed": true}, {"opacity": 1, "group": "background", "name": "TERRAIN", "title": "Google Terrain", "url": null, "selected": false, "visibility": true, "source": "8", "fixed": true}, {"opacity": 1, "group": "background", "name": "HYBRID", "title": "Google Hybrid", "url": null, "selected": false, "visibility": false, "source": "8", "fixed": true}, {"opacity": 1, "group": "background", "name": "ROADMAP", "title": "Google Roadmap", "url": null, "selected": false, "visibility": false, "source": "8", "fixed": true}, {"styles": "", "llbbox": [-75.81792226051176, 40.72274000869066, -75.62398348806802, 40.83328478756798], "abstract": "Map scanned and georeferenced in QGIS ", "disabled": true, "detail_url": "http://worldmap.harvard.edu/data/geonode:eastpenn1860_tq0", "group": "Economic Activities & Employment", "title": "EASTPENN1860", "selected": false, "source": "9", "local": true, "opacity": 1, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:eastpenn1860_tq0", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [], "fixed": false, "queryable": [false], "bbox": [-75.81792226051176, 40.72274000869066, -75.62398348806802, 40.83328478756798]}, {"styles": "", "llbbox": [-75.7278310348737, 40.7492616455955, -75.611491004554, 40.7882638193783], "abstract": "These points represent charcoal pits from the 19th century. They were located through by downloading the original LiDAR data from PASDA (for details see http://www.dcnr.state.pa.us/topogeo/pamap/lidar/index.htm) . This data (specifically the points categorized as 2 - land) was then used to build a digital terrain model (DTM) using LASTOOLS. The DTM was used for a slope analysis, which allowed me to identify areas on sloped landscapes that were small (c. 10m) round level areas. ", "disabled": false, "getFeatureInfo": {"fields": ["id"], "propertyNames": {"id": "Id"}}, "detail_url": "http://worldmap.harvard.edu/data/geonode:charcoal_pits_1800s_zr5", "group": "Economic Activities & Employment", "title": "Charcoal pits 1800s", "selected": true, "source": "10", "local": true, "opacity": 1, "format": "image/png", "buffer": 0, "visibility": true, "tiled": true, "transparent": true, "name": "geonode:charcoal_pits_1800s_zr5", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "Id", "id": "id", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-75.7278310348737, 40.7492616455955, -75.611491004554, 40.7882638193783]}], "projection": "EPSG:900913", "center": [-8423508.1320416, 4978294.2376051], "zoom": 14, "groups": [{"expanded": "true", "group": "Economic Activities & Employment"}, {"expanded": "true", "group": "General"}], "units": "m", "maxResolution": 156543.03390625, "numZoomLevels": 22, "maxExtent": [-20037508.34, -20037508.34, 20037508.34, 20037508.34]}, "about": {"urlsuffix": "ironcharcoalblue", "abstract": "At this point, this is just a test. Please do not use this data for anything else. ", "officialurl": "", "introtext": "
", "title": "Test: Charcoal and Iron on the Blue Mountain"}, "topic_categories": [["farming", "Farming & Agriculture"], ["biota", "Ecology & Biota"], ["boundaries", "Boundaries"], ["climatologyMeteorologyAtmosphere", "Climate & Weather"], ["economy", "Economic Activities & Employment"], ["elevation", "Elevation"], ["environment", "Environmental Resources, Conservation"], ["health", "Health & Human Ecology"], ["geoscientificInformation", "Earth Sciences"], ["imageryBaseMapsEarthCover", "Imagery & Base Maps"], ["location", "Place Locations"], ["planningCadastre", "Planning & Cadastral Data"], ["society", "Society & Demographics"], ["structure", "Structures"], ["transportation", "Transportation"], ["utilitiesCommunication", "Utilities & Infrastructure"], ["intelligenceMilitary", "Military Bases & Activities"], ["inlandWaters", "Rivers, Streams, Lakes"], ["oceans", "Oceans"]], "uid": 3507, "edit_map": true, "sources": {"11": {"url": "http://worldmap.harvard.edu/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "projection": "EPSG:900913", "id": "11"}, "10": {"projection": "EPSG:900913", "title": "GeoNode Source", "url": "http://worldmap.harvard.edu/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "id": "10"}, "1": {"ptype": "gxp_bingsource", "apiKey": "ApJK2ZsWHuwy3NWyg7_ThdJDPORXYI01KrZH5GA8tmH0DgUApjcY-GIfHxSkfPNJ", "id": "1", "projection": "EPSG:900913"}, "0": {"ptype": "gx_olsource", "id": "0", "projection": "EPSG:900913"}, "3": {"url": "http://services.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer", "ptype": "gxp_arcgiscachesource", "id": "3", "projection": "EPSG:900913"}, "2": {"ptype": "gxp_stamensource", "id": "2", "projection": "EPSG:900913"}, "5": {"url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer", "ptype": "gxp_arcgiscachesource", "id": "5", "projection": "EPSG:900913"}, "4": {"url": "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer", "ptype": "gxp_arcgiscachesource", "id": "4", "projection": "EPSG:900913"}, "7": {"url": "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer", "ptype": "gxp_arcgiscachesource", "id": "7", "projection": "EPSG:900913"}, "6": {"url": "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer", "ptype": "gxp_arcgiscachesource", "id": "6", "projection": "EPSG:900913"}, "9": {"projection": "EPSG:900913", "title": "GeoNode Source", "url": "http://worldmap.harvard.edu/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "id": "9"}, "8": {"ptype": "gx_googlesource", "id": "8", "projection": "EPSG:900913"}, "csw": {"url": "http://worldmap.harvard.edu/geonetwork/srv/en/csw", "ptype": "gxp_cataloguesource", "projection": "EPSG:900913", "proxyOptions": {"listeners": {}}, "id": "csw"}, "local": {"url": "/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "projection": "EPSG:900913", "id": "local"}}, "proxy": "/proxy/?url=", "social_explorer": [], "defaultSourceType": "gxp_gnsource", "first_visit": false, "id": 12758});
app = new GeoExplorer.Viewer(config);
//********************************************* XBLOCK RELATED CODE ********************************************
//useful for debugging...
window.MESSAGING.getInstance().registerHandler("info", function (m) {
alert("INFO: the slave code received this 'info' message: " + m.getMessage());
});
app.on("ready", function () {
markerLayer = new OpenLayers.Layer.Markers("worldmap-markers");
polygonLayer = new OpenLayers.Layer.Vector("worldmap-polygons", {
styleMap: new OpenLayers.StyleMap({
fillColor: "#ff0000",
fillOpacity: 0.3
})
});
polylineLayer = new OpenLayers.Layer.Vector("worldmap-polyline", {
styleMap: new OpenLayers.StyleMap({
strokeColor: "#000000",
strokeOpacity: 1.0,
strokeWidth: 3
})
});
var polygonControl =
new OpenLayers.Control.DrawFeature(polygonLayer, OpenLayers.Handler.Polygon, {
callbacks: {
done: function (geo) {
var polygon = [];
for (var i = 0; i < geo.components[0].components.length; i++) {
var point = transformToLonLat({lon: geo.components[0].components[i].x, lat: geo.components[0].components[i].y});
polygon.push({lon: point.x, lat: point.y});
}
window.MESSAGING.getInstance().send(
new Message("polygon_response",
{
polygon: polygon,
question: currentQuestion
}
)
);
var feature = new OpenLayers.Feature.Vector(geo, {}, {
fillColor: '#' + currentQuestion.color,
fillOpacity: 0.4
});
var proceed = this.events.triggerEvent("sketchcomplete", {feature: feature});
if (proceed !== false) {
feature.state = OpenLayers.State.INSERT;
if (polygons[currentQuestion.id]) {
polygonLayer.removeFeatures([polygons[currentQuestion.id]]);
}
polygons[currentQuestion.id] = feature;
polygonLayer.addFeatures([feature]);
this.featureAdded(feature);
this.events.triggerEvent("featureadded", {feature: feature});
}
}
}
});
var polylineControl =
new OpenLayers.Control.DrawFeature(polylineLayer, OpenLayers.Handler.Path, {
doubleTouchTolerance: 50,
callbacks: {
done: function (geo) {
var polyline = [];
for (var i = 0; i < geo.components.length; i++) {
var point = transformToLonLat({lon: geo.components[i].x, lat: geo.components[i].y});
polyline.push({lon: point.x, lat: point.y});
}
window.MESSAGING.getInstance().send(
new Message("polyline_response",
{
polyline: polyline,
question: currentQuestion
}
)
);
var feature = new OpenLayers.Feature.Vector(geo, {}, {
strokeColor: '#' + currentQuestion.color,
strokeOpacity: 1,
strokeWidth: 3
});
var proceed = this.events.triggerEvent("sketchcomplete", {feature: feature});
if (proceed !== false) {
feature.state = OpenLayers.State.INSERT;
if (polylines[currentQuestion.id]) {
polylineLayer.removeFeatures([polylines[currentQuestion.id]]);
}
polylines[currentQuestion.id] = feature;
polylineLayer.addFeatures([feature]);
this.featureAdded(feature);
this.events.triggerEvent("featureadded", {feature: feature});
}
}
}
});
app.mapPanel.map.addLayers([markerLayer, polygonLayer, polylineLayer]);
app.mapPanel.map.events.register("moveend", app.mapPanel, function () {
// calculate lat/lon
window.MESSAGING.getInstance().send(new Message("moveend", {center: transformToLonLat(app.mapPanel.map.getCenter()), zoomLevel: app.mapPanel.map.getZoom()}));
});
app.mapPanel.map.events.register("zoomend", app.mapPanel.map, function () {
window.MESSAGING.getInstance().send(new Message("zoomend", app.mapPanel.map.getZoom()));
});
app.mapPanel.map.events.register("changelayer", app.mapPanel.map, function (e) {
var msg = new Message("changelayer", {name: e.layer.name, id: e.layer.id, visibility: e.layer.visibility, opacity: e.layer.opacity, legendData: getLayerLegendInfo(app.config.map.layers, e.layer)});
console.log("sending changelayer back to master. layer: " + JSON.stringify(msg.getMessage()));
window.MESSAGING.getInstance().send(msg);
});
window.MESSAGING.getInstance().registerHandler("setZoomLevel", function (m) {
app.mapPanel.map.zoomTo(m.getMessage());
});
window.MESSAGING.getInstance().registerHandler("setCenter", function (m) {
var data = m.getMessage();
//Ext.example.msg("Info","setCenter: "+data.centerLat+","+data.centerLon+" zoom="+data.zoomLevel);
var pt = transformToXY({lon: data.centerLon, lat: data.centerLat});
app.mapPanel.map.setCenter([pt.x, pt.y], data.zoomLevel, false, false);
});
window.MESSAGING.getInstance().registerHandler("setLayers", function (m) {
console.log("slave recieved setLayers command, data = " + m.getMessage());
var data = JSON.parse(m.getMessage());
for (var id in data) {
try {
if (id !== "OpenLayers_Layer_Vector_132") { //TODO: REMOVE THIS - it causes an exception that we can't seem to handle
var layer = app.mapPanel.map.getLayer(id);
if (layer != null) {
// layer.setVisibility(data[id]['visibility']);
var ctrl = Ext.getCmp("layer_menu_" + layer.id);
layer.setOpacity(data[id]['opacity']);
if ((ctrl.checked && !data[id]['visibility']) || (!ctrl.checked && data[id]['visibility'])) {
console.log("turning layer: " + id + " to " + data[id]['visibility']);
ctrl.setChecked(data[id]['visibility']);
}
else {
console.log("didn't change visibility for layer: " + id + " currently: " + data[id]['visibility']);
console.log("sending changelayer back to master. layer: { name: " + data[id]['name'] + ", id: " + id + ", visibility: " + data[id]['visibility'] + ", opacity: " + data[id]['opacity'] + ", legendData: " + JSON.stringify(getLayerLegendInfo(app.config.map.layers, data[id])) + "}");
window.MESSAGING.getInstance().send(new Message("changelayer", {name: data[id]['name'], id: id, visibility: data[id]['visibility'], opacity: data[id]['opacity'], legendData: getLayerLegendInfo(app.config.map.layers, data[id])}));
}
} else {
console.log("ERROR: could not find layer for id: " + id);
}
} else {
console.log("setLayer was asked to deal with a bad layer: " + id);
}
} catch (e) {
console.log("slave caught exception during setLayers: " + e);
}
}
});
var markerControl = new CLICK_CONTROL();
app.mapPanel.map.addControl(markerControl);
app.mapPanel.map.addControl(polygonControl);
app.mapPanel.map.addControl(polylineControl);
window.MESSAGING.getInstance().registerHandler("reset-answer-tool", function (m) {
$('.olMapViewport').css('cursor', "default");
// if( document.getElementById(id) != undefined ) {
// document.getElementById(id).style.cursor = "default";
// }
markerControl.deactivate();
polygonControl.deactivate();
polylineControl.deactivate();
currentQuestion = null;
});
window.MESSAGING.getInstance().registerHandler("set-answer-tool", function (e) {
var message = JSON.parse(e.message);
currentQuestion = message;
//TODO: fix url - make relative
//should use $('.olMapViewport').style.cursor = "url(http://robertlight.com/tmp/"+currentQuestion.type+"Cursor.png) 16 16, auto";
$('.olMapViewport').css('cursor', "url(/static/geonode/externals/ext/resources/images/default/xblock-images/" + currentQuestion.type + "Cursor.png) 16 16, auto");
//document.getElementById(app.mapPanel.map.id+"_OpenLayers_ViewPort").style.cursor = "url(http://robertlight.com/tmp/"+currentQuestion.type+"Cursor.png) 16 16, auto";
if (currentQuestion.type == 'point') {
Ext.example.msg("Info", "Click the map at the location requested");
markerControl.activate();
} else if (currentQuestion.type == 'polygon') {
// window.alert("color="+currentQuestion.color);
polygonLayer.styleMap = new OpenLayers.StyleMap({
fillColor: '#' + currentQuestion.color,
fillOpacity: 0.3
});
Ext.example.msg("Info", "Please click on the boundaries of a polygon. < br / > Double - click to end drawing."
)
;
polygonControl.activate();
} else if (currentQuestion.type == 'polyline') {
Ext.example.msg("Info", "Please click on the verticies of a polyline. < br / > Double - click to end drawing. ");
polylineControl.activate();
}
});
window.MESSAGING.getInstance().registerHandler("flash-polygon", function (e) {
var data = JSON.parse(e.message);
var features = [];
var bounds = null;
for (var i = 0; i < data.length; i++) {
var points = [];
for (var j = 0; j < data[i].length; j++) {
points.push(transformToXY(data[i][j]));
}
var ring = new OpenLayers.Geometry.LinearRing(points);
var center = ring.getCentroid();
var feature =
new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Polygon(ring),
{},
{
fillColor: '#FF0000',
fillOpacity: 0.05,
strokeColor: '#FF0000',
strokeOpacity: 0.05
}
);
feature.state = OpenLayers.State.INSERT;
var b = ring.getBounds();
if (bounds != null) {
bounds.extend(b);
} else {
bounds = b;
}
features.push(feature);
}
app.mapPanel.map.setCenter(
[center.x, center.y],
Math.min(15, app.mapPanel.map.getZoomForExtent(bounds, false))
);
polygonLayer.addFeatures(features);
polygonLayer.redraw();
setTimeout(function () {
polygonLayer.removeFeatures(features);
polygonLayer.redraw();
}, 3000);
});
window.MESSAGING.getInstance().registerHandler("reset-highlights", function (m) {
try {
polygonLayer.destroyFeatures();
} catch (e) {
}
try {
markerLayer.destroyFeatures();
} catch (e) {
}
try {
polylineLayer.destroyFeatures();
} catch (e) {
}
try {
markerLayer.clearMarkers();
} catch (e) {
}
// try {
// for( var i in markers ) {
// markerLayer.removeMarker(markers[i]);
// }
// } catch (e) {}
});
window.MESSAGING.getInstance().registerHandler("highlight-layer", function (m) {
var data = JSON.parse(m.getMessage());
var layer = app.mapPanel.map.getLayer(data['layer']);
var duration = data['duration'];
if (layer != null) {
var ctrl = Ext.getCmp("layer_menu_" + data['layer']);
if (!ctrl.checked) {
ctrl.setChecked(true);
}
var zoom = app.mapPanel.map.getZoomForExtent(layer.maxExtent, true) + data['relativeZoom'];
app.mapPanel.map.setCenter(layer.maxExtent.getCenterLonLat(), zoom);
if (duration != undefined && duration > 0) {
setTimeout(function () {
ctrl.setChecked(false);
}, duration);
}
} else {
console.log("ERROR: could not find layer for id: " + id);
}
});
window.MESSAGING.getInstance().registerHandler("highlight-geometry", function (e) {
var data = JSON.parse(e.message);
var type = data['type'];
var duration = data['duration']
var features = [];
var relativeZoom = data['relativeZoom'] == undefined ? 0 : data['relativeZoom'];
var bounds = null;
if (type == 'polygon') {
var points = [];
for (var i = 0; i < data['points'].length; i++) {
points.push(transformToXY(data['points'][i]))
}
var ring = new OpenLayers.Geometry.LinearRing(points);
var center = ring.getCentroid();
var feature =
new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Polygon(ring),
{},
{
fillColor: '#FF0000',
fillOpacity: 0.5,
strokeColor: '#FF0000',
strokeOpacity: 0.5
}
);
feature.state = OpenLayers.State.INSERT;
bounds = ring.getBounds();
features.push(feature);
var factor = Math.min(15, relativeZoom + app.mapPanel.map.getZoomForExtent(bounds, false));
console.log("zooming in to (" + center.x + "," + center.y + ") factor=" + factor);
app.mapPanel.map.setCenter([center.x, center.y], factor);
polygonLayer.addFeatures(features);
polygonLayer.redraw();
if (duration != undefined && duration > 0) {
setTimeout(function () {
polygonLayer.removeFeatures(features);
polygonLayer.redraw();
}, duration);
}
} else if (type == 'point') {
// app.mapPanel.map
var size = new OpenLayers.Size(21, 25);
var offset = new OpenLayers.Pixel(-size.w / 2, -size.h);
var xy = transformToXY(data['points'][0]);
var icon = new OpenLayers.Icon('/static/geonode/externals/ext/resources/images/default/xblock-images/marker.png', size, offset);
app.mapPanel.map.setCenter([xy.x, xy.y], 11 + relativeZoom);
marker = new OpenLayers.Marker({lon: xy.x, lat: xy.y}, icon);
markerLayer.addMarker(marker);
if (duration != undefined && duration > 0) {
setTimeout(function () {
markerLayer.removeMarker(marker);
}, duration);
}
} else if (type == 'polyline') {
var points = [];
for (var i = 0; i < data['points'].length; i++) {
points.push(transformToXY(data['points'][i]));
}
var line = new OpenLayers.Geometry.LineString(points);
//var center = line.getCentroid();
var bounds = line.getBounds();
var feature = new OpenLayers.Feature.Vector(line, {}, { strokeColor: '#FF0000', strokeWidth: 4, strokeOpacity: 1.0});
feature.state = OpenLayers.State.INSERT;
features.push(feature);
app.mapPanel.map.setCenter(
bounds.getCenterLonLat(),
Math.min(15, relativeZoom + app.mapPanel.map.getZoomForExtent(bounds, false))
);
polygonLayer.addFeatures(features);
polygonLayer.redraw();
if (duration != undefined && duration > 0) {
setTimeout(function () {
polygonLayer.removeFeatures(features);
polygonLayer.redraw();
}, duration);
}
}
});
console.log("sending portalReady to master from embed.html at end of app.on('ready') processing");
window.MESSAGING.getInstance().send(new Message("portalReady", {}));
var legendInfo = [];
for (var i = 0; i < app.mapPanel.map.layers.length; i++) {
var layer = app.mapPanel.map.layers[i];
legendInfo.push(
{
name: layer.name,
id: layer.id,
visibility: layer.visibility,
opacity: layer.opacity,
legendData: getLayerLegendInfo(app.config.map.layers, layer)
}
);
}
window.MESSAGING.getInstance().send(new Message("postLegends", legendInfo));
//**************************************** END - XBLOCK RELATED CODE ****************************************
});
});