var theMap = Ext.getCmp('map').map;
var airportsChkboxObj = document.getElementById("airports");
var airport_layer = theMap.getLayersByName('SUA airports');
var centersChkboxObj = document.getElementById("thecenters");
var center_layer = theMap.getLayersByName('Centers');
var latlongChkboxObj = document.getElementById("latlong");
var latlong_layer = theMap.getLayersByName('LatLong');
var citiesChkboxObj = document.getElementById("cities");
var cities_layer = theMap.getLayersByName('Cities');
var waypointsChkboxObj = document.getElementById("waypoints");
var waypoints_layer = theMap.getLayersByName('Waypoints');
var shapes_layer = theMap.getLayersByName('Shapes');
var theMLS = theMap.getControl("OpenLayers.Control.MapLayerSwitcher_5");
if (theMLS.minimizeDiv != null){
theMLS.minimizeControl();
}
//************
//* Airports
//************
if (airportsChkboxObj.checked){
if (airport_layer == "") {
// need to add the airport layer
// create WMS layer, let's try airports
var suaairport = new OpenLayers.Layer.WMS(
"SUA airports",
wmsURL,
{
layers: 'SUA:airports',
styles: '',
srs: 'EPSG:4326',
format: 'image/png8',
tiled: 'true',
transparent: true
},
{
'opacity': 0.75, 'isBaseLayer': false, 'wrapDateLine': true
}
);
theMap.addLayers([suaairport]);
} else {
// need to change the visibility to true
airport_layer[0].setVisibility(true);
}
} else {
if (airport_layer != "") {
// need to change the visibility to false
airport_layer[0].setVisibility(false);
}
}
//************
//* Centers
//************
if (centersChkboxObj.checked){
if (center_layer == "") {
// need to add the center layer
// create WMS layer, let's try centers
var suacenter = new OpenLayers.Layer.WMS(
"Centers",
wmsURL,
{
layers: 'SUA:center',
styles: '',
srs: 'EPSG:4326',
format: 'image/png8',
tiled: 'true',
transparent: true
},
{
'opacity': 0.75, 'isBaseLayer': false, 'wrapDateLine': true
}
);
theMap.addLayers([suacenter]);
} else {
// need to change the visibility to true
center_layer[0].setVisibility(true);
}
} else {
if (center_layer != "") {
// need to change the visibility to false
center_layer[0].setVisibility(false);
}
}
//************
//* Lon/Lat
//************
if (latlongChkboxObj.checked){
if (latlong_layer == "") {
// need to add the latlong layer
// create WMS layer, let's try latlong
var sualatlong = new OpenLayers.Layer.WMS(
"LatLong",
wmsURL,
{
layers: 'SUA:world_latlong',
styles: '',
srs: 'EPSG:4326',
format: 'image/png8',
tiled: 'true',
transparent: true
},
{
'opacity': 0.75, 'isBaseLayer': false, 'wrapDateLine': true
}
);
theMap.addLayers([sualatlong]);
} else {
// need to change the visibility to true
latlong_layer[0].setVisibility(true);
}
} else {
if (latlong_layer != "") {
// need to change the visibility to false
latlong_layer[0].setVisibility(false);
}
}
//************
// * Cities
//************
if (citiesChkboxObj.checked){
if (cities_layer == "") {
// need to add the cities layer
// create WMS layer, let's try cities
var suacities = new OpenLayers.Layer.WMS(
"Cities",
wmsURL,
{
layers: 'SUA:major_cities',
styles: '',
srs: 'EPSG:4326',
format: 'image/png8',
tiled: 'true',
transparent: true
},
{
'opacity': 0.75, 'isBaseLayer': false, 'wrapDateLine': true
}
);
theMap.addLayers([suacities]);
} else {
// need to change the visibility to true
cities_layer[0].setVisibility(true);
}
} else {
if (cities_layer != "") {
// need to change the visibility to false
cities_layer[0].setVisibility(false);
}
}
//************
//* Waypoints
//************
if (waypointsChkboxObj.checked){
if (waypoints_layer == "") {
// need to add the waypoints layer
// create WMS layer, let's try waypoints
var suawaypoints = new OpenLayers.Layer.WMS(
"Waypoints",
wmsURL,
{
layers: 'SUA:sua_wpt',
styles: '',
srs: 'EPSG:4326',
format: 'image/png8',
tiled: 'true',
transparent: true
},
{
'opacity': 0.75, 'isBaseLayer': false, 'wrapDateLine': true
}
);
theMap.addLayers([suawaypoints]);
} else {
// need to change the visibility to true
waypoints_layer[0].setVisibility(true);
}
} else {
if (waypoints_layer != "") {
// need to change the visibility to false
waypoints_layer[0].setVisibility(false);
}
}
//****************
//* Shapes Logic
//****************
// Build URL
var myUrl = 'schedshp.json';
// Atcaa checkbox
if (document.getElementById("atcaa").checked) {
if (myUrl.indexOf("?") == -1) {
myUrl += ("?astype=atcaa");
} else {
myUrl += ("&astype=atcaa");
}
}
// Aerial Refueling Route checkbox
if (document.getElementById("aerial_rr").checked) {
if (myUrl.indexOf("?") == -1) {
myUrl += ("?astype=aerial_rr");
} else {
myUrl += ("&astype=aerial_rr");
}
}
// Alert checkbox
if (document.getElementById("alert").checked) {
if (myUrl.indexOf("?") == -1) {
myUrl += ("?astype=alert");
} else {
myUrl += ("&astype=alert");
}
}
// Moa checkbox
if (document.getElementById("moa").checked) {
if (myUrl.indexOf("?") == -1) {
myUrl += ("?astype=moa");
} else {
myUrl += ("&astype=moa");
}
}
// Other checkbox
if (document.getElementById("other").checked) {
if (myUrl.indexOf("?") == -1) {
myUrl += ("?astype=other");
} else {
myUrl += ("&astype=other");
}
}
// Prohibited checkbox
if (document.getElementById("prohibited").checked) {
if (myUrl.indexOf("?") == -1) {
myUrl += ("?astype=prohibited");
} else {
myUrl += ("&astype=prohibited");
}
}
// Restricted checkbox
if (document.getElementById("restricted").checked) {
if (myUrl.indexOf("?") == -1) {
myUrl += ("?astype=restricted");
} else {
myUrl += ("&astype=restricted");
}
}
// Warning checkbox
if (document.getElementById("warning").checked) {
if (myUrl.indexOf("?") == -1) {
myUrl += ("?astype=warning");
} else {
myUrl += ("&astype=warning");
}
}
// Instrument Route checkbox
if (document.getElementById("inst_rte").checked) {
if (myUrl.indexOf("?") == -1) {
myUrl += ("?astype=inst_rte");
} else {
myUrl += ("&astype=inst_rte");
}
}
// Slow Route checkbox
if (document.getElementById("slow_rte").checked) {
if (myUrl.indexOf("?") == -1) {
myUrl += ("?astype=slow_rte");
} else {
myUrl += ("&astype=slow_rte");
}
}
// Visual Route checkbox
if (document.getElementById("visual_rte").checked) {
if (myUrl.indexOf("?") == -1) {
myUrl += ("?astype=visual_rte");
} else {
myUrl += ("&astype=visual_rte");
}
}
// Space Flight checkbox
if (document.getElementById("spaceflight").checked) {
if (myUrl.indexOf("?") == -1) {
myUrl += ("?astype=spaceflight");
} else {
myUrl += ("&astype=spaceflight");
}
}
Thanks,
Jim
To: [email protected]
From: Alexandre Dube <[email protected]>
Sent by: [email protected]
Date: 09/30/2010 09:45AM
Subject: Re: [OpenLayers-Users] OpenLayers - Performance Tuning - Firebug shows 10+ seconds in "blocking" time
Hi Jim,
What kind of layer object are you using ? WMS ? TileCache ? Are the layers coming from the same service (for example, do you have 5 WMS layer objects pointing to 5 layers from the same WMS server) ? If so, you could group them in a single layer object. You could also use 'singleTile' mode to have less requests.
Tell us more (by code sharing, live demo, etc.).
Regards,
Alexandre
On 10-09-30 09:40 AM, [email protected] wrote:Hi,
The Firebug Net Profile for my website, after a few requests, shows significant time "blocking". Has anyone else seen this? What can be done about it?
My sense is that our site is serving up too many tiled images. Functionally, we are coloring airspaces based upon when they'll become "active". So, we have 5+ layers with around 50 tiled images that must be downloaded. The reason we are creating the various layers is that they are styled using different colors. Is there a way to have different styles applied to various airspaces all within one layer so that we can drastically limit the number of images we are serving?
Thanks,
Jim
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
Alexandre Dubé
Mapgears
www.mapgears.com
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
