diff --git a/examples/bing.html b/examples/bing.html index 53ae68f8ce..6f43336ef8 100644 --- a/examples/bing.html +++ b/examples/bing.html @@ -7,35 +7,37 @@ OpenLayers Bing Example - diff --git a/lib/OpenLayers/BaseTypes/Bounds.js b/lib/OpenLayers/BaseTypes/Bounds.js index e33c49667f..4c93029005 100644 --- a/lib/OpenLayers/BaseTypes/Bounds.js +++ b/lib/OpenLayers/BaseTypes/Bounds.js @@ -5,8 +5,6 @@ /** * @requires OpenLayers/BaseTypes/Class.js - * @requires OpenLayers/Console.js - * @requires OpenLayers/Lang.js */ /** @@ -300,9 +298,7 @@ OpenLayers.Bounds = OpenLayers.Class({ */ add:function(x, y) { if ( (x == null) || (y == null) ) { - var msg = OpenLayers.i18n("boundsAddError"); - OpenLayers.Console.error(msg); - return null; + throw new TypeError('Bounds.add cannot receive null values'); } return new OpenLayers.Bounds(this.left + x, this.bottom + y, this.right + x, this.top + y); diff --git a/lib/OpenLayers/BaseTypes/LonLat.js b/lib/OpenLayers/BaseTypes/LonLat.js index 16e3de4965..70c883d4f1 100644 --- a/lib/OpenLayers/BaseTypes/LonLat.js +++ b/lib/OpenLayers/BaseTypes/LonLat.js @@ -5,8 +5,6 @@ /** * @requires OpenLayers/BaseTypes/Class.js - * @requires OpenLayers/Console.js - * @requires OpenLayers/Lang.js */ /** @@ -91,9 +89,7 @@ OpenLayers.LonLat = OpenLayers.Class({ */ add:function(lon, lat) { if ( (lon == null) || (lat == null) ) { - var msg = OpenLayers.i18n("lonlatAddError"); - OpenLayers.Console.error(msg); - return null; + throw new TypeError('LonLat.add cannot receive null values'); } return new OpenLayers.LonLat(this.lon + OpenLayers.Util.toFloat(lon), this.lat + OpenLayers.Util.toFloat(lat)); diff --git a/lib/OpenLayers/BaseTypes/Pixel.js b/lib/OpenLayers/BaseTypes/Pixel.js index 5426bb8d4c..128c247e4d 100644 --- a/lib/OpenLayers/BaseTypes/Pixel.js +++ b/lib/OpenLayers/BaseTypes/Pixel.js @@ -5,8 +5,6 @@ /** * @requires OpenLayers/BaseTypes/Class.js - * @requires OpenLayers/Console.js - * @requires OpenLayers/Lang.js */ /** @@ -116,9 +114,7 @@ OpenLayers.Pixel = OpenLayers.Class({ */ add:function(x, y) { if ( (x == null) || (y == null) ) { - var msg = OpenLayers.i18n("pixelAddError"); - OpenLayers.Console.error(msg); - return null; + throw new TypeError('Pixel.add cannot receive null values'); } return new OpenLayers.Pixel(this.x + x, this.y + y); }, diff --git a/lib/OpenLayers/Control.js b/lib/OpenLayers/Control.js index b79ec2dc73..2b127b991d 100644 --- a/lib/OpenLayers/Control.js +++ b/lib/OpenLayers/Control.js @@ -5,7 +5,6 @@ /** * @requires OpenLayers/BaseTypes/Class.js - * @requires OpenLayers/Console.js */ /** diff --git a/lib/OpenLayers/Control/ArgParser.js b/lib/OpenLayers/Control/ArgParser.js index 3ba0d49adb..170edd299f 100644 --- a/lib/OpenLayers/Control/ArgParser.js +++ b/lib/OpenLayers/Control/ArgParser.js @@ -122,7 +122,7 @@ OpenLayers.Control.ArgParser = OpenLayers.Class(OpenLayers.Control, { this.center = new OpenLayers.LonLat(parseFloat(args.lon), parseFloat(args.lat)); if (args.zoom) { - this.zoom = parseInt(args.zoom); + this.zoom = parseFloat(args.zoom); } // when we add a new baselayer to see when we can set the center diff --git a/lib/OpenLayers/Control/DrawFeature.js b/lib/OpenLayers/Control/DrawFeature.js index 8d4a11136f..e7d4556ed6 100644 --- a/lib/OpenLayers/Control/DrawFeature.js +++ b/lib/OpenLayers/Control/DrawFeature.js @@ -83,6 +83,11 @@ OpenLayers.Control.DrawFeature = OpenLayers.Class(OpenLayers.Control, { ); this.layer = layer; this.handlerOptions = this.handlerOptions || {}; + this.handlerOptions.layerOptions = OpenLayers.Util.applyDefaults( + this.handlerOptions.layerOptions, { + renderers: layer.renderers, rendererOptions: layer.rendererOptions + } + ); if (!("multi" in this.handlerOptions)) { this.handlerOptions.multi = this.multi; } diff --git a/lib/OpenLayers/Filter/Comparison.js b/lib/OpenLayers/Filter/Comparison.js index a707928f0f..efab2c0d8c 100644 --- a/lib/OpenLayers/Filter/Comparison.js +++ b/lib/OpenLayers/Filter/Comparison.js @@ -5,7 +5,6 @@ /** * @requires OpenLayers/Filter.js - * @requires OpenLayers/Console.js */ /** @@ -179,10 +178,8 @@ OpenLayers.Filter.Comparison = OpenLayers.Class(OpenLayers.Filter, { */ value2regex: function(wildCard, singleChar, escapeChar) { if (wildCard == ".") { - var msg = "'.' is an unsupported wildCard character for "+ - "OpenLayers.Filter.Comparison"; - OpenLayers.Console.error(msg); - return null; + throw new Error("'.' is an unsupported wildCard character for " + + "OpenLayers.Filter.Comparison"); } diff --git a/lib/OpenLayers/Filter/Spatial.js b/lib/OpenLayers/Filter/Spatial.js index 5e94ebb4f9..bc78f127ba 100644 --- a/lib/OpenLayers/Filter/Spatial.js +++ b/lib/OpenLayers/Filter/Spatial.js @@ -5,8 +5,6 @@ /** * @requires OpenLayers/Filter.js - * @requires OpenLayers/Console.js - * @requires OpenLayers/Lang.js */ /** @@ -96,9 +94,7 @@ OpenLayers.Filter.Spatial = OpenLayers.Class(OpenLayers.Filter, { } break; default: - OpenLayers.Console.error( - OpenLayers.i18n("filterEvaluateNotImplemented")); - break; + throw new Error('evaluate is not implemented for this filter type.'); } return intersect; }, diff --git a/lib/OpenLayers/Format.js b/lib/OpenLayers/Format.js index 514e8dfba0..4b0787e32f 100644 --- a/lib/OpenLayers/Format.js +++ b/lib/OpenLayers/Format.js @@ -6,8 +6,6 @@ /** * @requires OpenLayers/BaseTypes/Class.js * @requires OpenLayers/Util.js - * @requires OpenLayers/Console.js - * @requires OpenLayers/Lang.js */ /** @@ -104,7 +102,7 @@ OpenLayers.Format = OpenLayers.Class({ * Depends on the subclass */ read: function(data) { - OpenLayers.Console.userError(OpenLayers.i18n("readNotImplemented")); + throw new Error('Read not implemented.'); }, /** @@ -118,7 +116,7 @@ OpenLayers.Format = OpenLayers.Class({ * {String} A string representation of the object. */ write: function(object) { - OpenLayers.Console.userError(OpenLayers.i18n("writeNotImplemented")); + throw new Error('Write not implemented.'); }, CLASS_NAME: "OpenLayers.Format" diff --git a/lib/OpenLayers/Format/GML.js b/lib/OpenLayers/Format/GML.js index bdb3186d0e..691f80aa7a 100644 --- a/lib/OpenLayers/Format/GML.js +++ b/lib/OpenLayers/Format/GML.js @@ -12,8 +12,6 @@ * @requires OpenLayers/Geometry/MultiLineString.js * @requires OpenLayers/Geometry/Polygon.js * @requires OpenLayers/Geometry/MultiPolygon.js - * @requires OpenLayers/Console.js - * @requires OpenLayers/Lang.js */ /** @@ -159,8 +157,7 @@ OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, { this.internalProjection); } } else { - OpenLayers.Console.error(OpenLayers.i18n( - "unsupportedGeometryType", {'geomType':type})); + throw new TypeError("Unsupported geometry type: " + type); } // stop looking for different geometry types break; diff --git a/lib/OpenLayers/Format/KML.js b/lib/OpenLayers/Format/KML.js index 5457cd0a0c..fa5e3605a8 100644 --- a/lib/OpenLayers/Format/KML.js +++ b/lib/OpenLayers/Format/KML.js @@ -12,8 +12,6 @@ * @requires OpenLayers/Geometry/Polygon.js * @requires OpenLayers/Geometry/Collection.js * @requires OpenLayers/Request/XMLHttpRequest.js - * @requires OpenLayers/Console.js - * @requires OpenLayers/Lang.js * @requires OpenLayers/Projection.js */ @@ -693,11 +691,15 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, { } this.readChildNodes(node, obj); if (obj.whens.length !== obj.points.length) { - throw new Error("gx:Track with unequal number of when (" + obj.whens.length + ") and gx:coord (" + obj.points.length + ") elements."); + throw new Error("gx:Track with unequal number of when (" + + obj.whens.length + ") and gx:coord (" + + obj.points.length + ") elements."); } var hasAngles = obj.angles.length > 0; if (hasAngles && obj.whens.length !== obj.angles.length) { - throw new Error("gx:Track with unequal number of when (" + obj.whens.length + ") and gx:angles (" + obj.angles.length + ") elements."); + throw new Error("gx:Track with unequal number of when (" + + obj.whens.length + ") and gx:angles (" + + obj.angles.length + ") elements."); } var feature, point, angles; for (var i=0, ii=obj.whens.length; iSkala 1 : ${scaleDenom}", - // console message - 'layerAlreadyAdded': - "Du forsøkte å legge til laget ${layerName} på kartet, men det er allerede lagt til", - // console message 'reprojectDeprecated': "Du bruker innstillingen 'reproject' på laget ${layerName}. " + @@ -93,18 +76,6 @@ OpenLayers.Lang["nb"] = { "Denne metoden er markert som foreldet og vil bli fjernet i 3.0. " + "Vennligst bruk ${newMethod} i stedet.", - // console message - 'boundsAddError': "Du må gi både x- og y-verdier til funksjonen add.", - - // console message - 'lonlatAddError': "Du må gi både lon- og lat-verdier til funksjonen add.", - - // console message - 'pixelAddError': "Du må gi både x- og y-verdier til funksjonen add.", - - // console message - 'unsupportedGeometryType': "Geometritypen ${geomType} er ikke støttet", - 'end': '' }; diff --git a/lib/OpenLayers/Lang/nds.js b/lib/OpenLayers/Lang/nds.js index 380eba2f11..9be21b9be2 100644 --- a/lib/OpenLayers/Lang/nds.js +++ b/lib/OpenLayers/Lang/nds.js @@ -22,36 +22,16 @@ OpenLayers.Lang["nds"] = OpenLayers.Util.applyDefaults({ 'Base Layer': "Achtergrundkoort", - 'readNotImplemented': "Lesen is nich inricht.", - - 'writeNotImplemented': "Schrieven is nich inricht.", - 'noFID': "En Feature, dat keen FID hett, kann nich aktuell maakt warrn.", - 'errorLoadingGML': "Fehler bi’t Laden vun de GML-Datei ${url}", - 'browserNotSupported': "Dien Browser ünnerstütt keen Vektorbiller. Ünnerstütt Renderers:\n${renderers}", - 'componentShouldBe': "addFeatures : Kumponent schull man den Typ ${geomType} hebben", - - 'getFeatureError': "getFeatureFromEvent is von en Laag ahn Render opropen worrn. Dat bedüüdt normalerwies, dat en Laag wegmaakt worrn is, aver nich de Handler, de dor op verwiest.", - 'commitSuccess': "WFS-Transakschoon: hett klappt ${response}", 'commitFailed': "WFS-Transakschoon: hett nich klappt ${response}", 'Scale = 1 : ${scaleDenom}': "Skaal = 1 : ${scaleDenom}", - 'layerAlreadyAdded': "Du versöchst de Laag „${layerName}“ to de Koort totofögen, man de is al toföögt", - - 'methodDeprecated': "Disse Methood is oold un schall dat in 3.0 nich mehr geven. Bruuk dor man beter ${newMethod} för.", - - 'boundsAddError': "De Weert x un y, de mööt all beid an de add-Funkschoon övergeven warrn.", - - 'lonlatAddError': "De Weert lon un lat, de mööt all beid an de add-Funkschoon övergeven warrn.", - - 'pixelAddError': "De Weert x un y, de mööt all beid an de add-Funkschoon övergeven warrn.", - - 'unsupportedGeometryType': "Nich ünnerstütt Geometrie-Typ: ${geomType}" + 'methodDeprecated': "Disse Methood is oold un schall dat in 3.0 nich mehr geven. Bruuk dor man beter ${newMethod} för." }); diff --git a/lib/OpenLayers/Lang/nl.js b/lib/OpenLayers/Lang/nl.js index eef24c176d..88887165d0 100644 --- a/lib/OpenLayers/Lang/nl.js +++ b/lib/OpenLayers/Lang/nl.js @@ -22,20 +22,10 @@ OpenLayers.Lang["nl"] = OpenLayers.Util.applyDefaults({ 'Base Layer': "Achtergrondkaart", - 'readNotImplemented': "Lezen is niet geïmplementeerd.", - - 'writeNotImplemented': "Schrijven is niet geïmplementeerd.", - 'noFID': "Een optie die geen FID heeft kan niet bijgewerkt worden.", - 'errorLoadingGML': "Er is een fout opgetreden bij het laden van het GML bestand van ${url}", - 'browserNotSupported': "Uw browser ondersteunt het weergeven van vectoren niet.\nMomenteel ondersteunde weergavemogelijkheden:\n${renderers}", - 'componentShouldBe': "addFeatures : component moet van het type ${geomType} zijn", - - 'getFeatureError': "getFeatureFromEvent is aangeroepen op een laag zonder rederer.\nDit betekent meestal dat u een laag hebt verwijderd, maar niet een handler die ermee geassocieerd was.", - 'minZoomLevelError': "De eigenschap minZoomLevel is alleen bedoeld voor gebruik lagen met die afstammen van FixedZoomLevels-lagen.\nDat deze WFS-laag minZoomLevel controleert, is een overblijfsel uit het verleden.\nWe kunnen deze controle echter niet verwijderen zonder op OL gebaseerde applicaties die hervan afhankelijk zijn stuk te maken.\nDaarom heeft deze functionaliteit de eigenschap \'deprecated\' gekregen - de minZoomLevel wordt verwijderd in versie 3.0.\nGebruik in plaats van deze functie de mogelijkheid om min/max voor resolutie in te stellen zoals op de volgende pagina wordt beschreven:\nhttp://trac.openlayers.org/wiki/SettingZoomLevels", 'commitSuccess': "WFS-transactie: succesvol ${response}", @@ -56,20 +46,8 @@ OpenLayers.Lang["nl"] = OpenLayers.Util.applyDefaults({ 'S': "Z", - 'layerAlreadyAdded': "U hebt geprobeerd om de laag ${layerName} aan de kaart toe te voegen, maar deze is al toegevoegd", - 'reprojectDeprecated': "U gebruikt de optie \'reproject\' op de laag ${layerName}.\nDeze optie is vervallen: deze optie was ontwikkeld om gegevens over commerciële basiskaarten weer te geven, maar deze functionaliteit wordt nu bereikt door ondersteuning van Spherical Mercator.\nMeer informatie is beschikbaar op http://trac.openlayers.org/wiki/SphericalMercator.", - 'methodDeprecated': "Deze methode is verouderd en wordt verwijderd in versie 3.0.\nGebruik ${newMethod}.", - - 'boundsAddError': "U moet zowel de x- als de y-waarde doorgeven aan de toevoegfunctie.", - - 'lonlatAddError': "U moet zowel de lengte- als de breedtewaarde doorgeven aan de toevoegfunctie.", - - 'pixelAddError': "U moet zowel de x- als de y-waarde doorgeven aan de toevoegfunctie.", - - 'unsupportedGeometryType': "Dit geometrietype wordt niet ondersteund: ${geomType}", - - 'filterEvaluateNotImplemented': "evalueren is niet geïmplementeerd voor dit filtertype." + 'methodDeprecated': "Deze methode is verouderd en wordt verwijderd in versie 3.0.\nGebruik ${newMethod}." }); diff --git a/lib/OpenLayers/Lang/nn.js b/lib/OpenLayers/Lang/nn.js index b794df2fab..cb47f318f2 100644 --- a/lib/OpenLayers/Lang/nn.js +++ b/lib/OpenLayers/Lang/nn.js @@ -14,14 +14,6 @@ */ OpenLayers.Lang["nn"] = OpenLayers.Util.applyDefaults({ - 'Scale = 1 : ${scaleDenom}': "Skala = 1 : ${scaleDenom}", - - 'layerAlreadyAdded': "Du freista å leggja til laget «${layerName}» på kartet, men det har alt vorte lagt til.", - - 'boundsAddError': "Du er nøydd til å gje både ein x- og ein y-verdi til «add»-funksjonen.", - - 'lonlatAddError': "Du er nøydd til å gje både lon- og lat-verdiar til «add»-funksjonen.", - - 'pixelAddError': "Du er nøydd til å gje både ein x- og ein y-verdi til «add»-funksjonen." + 'Scale = 1 : ${scaleDenom}': "Skala = 1 : ${scaleDenom}" }); diff --git a/lib/OpenLayers/Lang/oc.js b/lib/OpenLayers/Lang/oc.js index d0ed802ba0..244c290696 100644 --- a/lib/OpenLayers/Lang/oc.js +++ b/lib/OpenLayers/Lang/oc.js @@ -22,20 +22,10 @@ OpenLayers.Lang["oc"] = OpenLayers.Util.applyDefaults({ 'Base Layer': "Calc de basa", - 'readNotImplemented': "Lectura pas implementada.", - - 'writeNotImplemented': "Escritura pas implementada.", - 'noFID': "Impossible de metre a jorn un objècte sens identificant (fid).", - 'errorLoadingGML': "Error al cargament del fichièr GML ${url}", - 'browserNotSupported': "Vòstre navegidor supòrta pas lo rendut vectorial. Los renderers actualament suportats son : \n${renderers}", - 'componentShouldBe': "addFeatures : lo compausant deuriá èsser de tipe ${geomType}", - - 'getFeatureError': "getFeatureFromEvent es estat apelat sus un calc sens renderer. Aquò significa generalament qu\'avètz destruch aqueste jaç, mas qu\'avètz conservat un handler que li èra associat.", - 'minZoomLevelError': "La proprietat minZoomLevel deu èsser utilizada solament per de jaces FixedZoomLevels-descendent. Lo fach qu\'aqueste jaç WFS verifique la preséncia de minZoomLevel es una relica del passat. Çaquelà, la podèm suprimir sens copar d\'aplicacions que ne poirián dependre. Es per aquò que la depreciam -- la verificacion del minZoomLevel serà suprimida en version 3.0. A la plaça, mercés d\'utilizar los paramètres de resolucions min/max tal coma descrich sus : http://trac.openlayers.org/wiki/SettingZoomLevels", 'commitSuccess': "Transaccion WFS : SUCCES ${response}", @@ -56,20 +46,8 @@ OpenLayers.Lang["oc"] = OpenLayers.Util.applyDefaults({ 'S': "S", - 'layerAlreadyAdded': "Avètz ensajat d\'apondre a la carta lo calc : ${layerName}, mas ja es present", - 'reprojectDeprecated': "Utilizatz l\'opcion \'reproject\' sul jaç ${layerName}. Aquesta opcion es despreciada : Son usatge permetiá d\'afichar de donadas al dessús de jaces raster comercials. Aquesta foncionalitat ara es suportada en utilizant lo supòrt de la projeccion Mercator Esferica. Mai d\'informacion es disponibla sus http://trac.openlayers.org/wiki/SphericalMercator.", - 'methodDeprecated': "Aqueste metòde es despreciada, e serà suprimida a la version 3.0. Mercés d\'utilizar ${newMethod} a la plaça.", - - 'boundsAddError': "Vos cal passar las doas valors x e y a la foncion add.", - - 'lonlatAddError': "Vos cal passar las doas valors lon e lat a la foncion add.", - - 'pixelAddError': "Vos cal passar las doas valors x e y a la foncion add.", - - 'unsupportedGeometryType': "Tipe de geometria pas suportat : ${geomType}", - - 'filterEvaluateNotImplemented': "evaluar es pas encara estat implementat per aqueste tipe de filtre." + 'methodDeprecated': "Aqueste metòde es despreciada, e serà suprimida a la version 3.0. Mercés d\'utilizar ${newMethod} a la plaça." }); diff --git a/lib/OpenLayers/Lang/pt-BR.js b/lib/OpenLayers/Lang/pt-BR.js index 2e5a55790d..e7e75110eb 100644 --- a/lib/OpenLayers/Lang/pt-BR.js +++ b/lib/OpenLayers/Lang/pt-BR.js @@ -23,20 +23,10 @@ OpenLayers.Lang["pt-br"] = OpenLayers.Util.applyDefaults({ 'Base Layer': "Camada Base", - 'readNotImplemented': "Leitura não implementada.", - - 'writeNotImplemented': "Escrita não implementada.", - 'noFID': "Não é possível atualizar uma feição que não tenha um FID.", - 'errorLoadingGML': "Erro ao carregar o arquivo GML ${url}", - 'browserNotSupported': "Seu navegador não suporta renderização de vetores. Os renderizadores suportados atualmente são:\n${renderers}", - 'componentShouldBe': "addFeatures: o componente deve ser do tipo ${geomType}", - - 'getFeatureError': "getFeatureFromEvent foi executado mas nenhum renderizador foi encontrado. Isso pode indicar que você destruiu uma camana, mas não o handler associado a ela.", - 'minZoomLevelError': "A propriedade minZoomLevel é de uso restrito das camadas descendentes de FixedZoomLevels. A verificação dessa propriedade pelas camadas wfs é um resíduo do passado. Não podemos, entretanto não é possível removê-la sem possívelmente quebrar o funcionamento de aplicações OL que possuem depência com ela. Portanto estamos tornando seu uso obsoleto -- a verificação desse atributo será removida na versão 3.0. Ao invés, use as opções de resolução min/max como descrito em: http://trac.openlayers.org/wiki/SettingZoomLevels", 'commitSuccess': "Transação WFS : SUCESSO ${response}", @@ -57,20 +47,8 @@ OpenLayers.Lang["pt-br"] = OpenLayers.Util.applyDefaults({ 'S': "S", - 'layerAlreadyAdded': "Você tentou adicionar a camada: ${layerName} ao mapa, mas ela já foi adicionada", - 'reprojectDeprecated': "Você está usando a opção \'reproject\' na camada ${layerName}. Essa opção está obsoleta: seu uso foi projetado para suportar a visualização de dados sobre bases de mapas comerciais, entretanto essa funcionalidade deve agora ser alcançada usando o suporte à projeção Mercator. Mais informação está disponível em: http://trac.openlayers.org/wiki/SphericalMercator.", - 'methodDeprecated': "Esse método está obsoleto e será removido na versão 3.0. Ao invés, por favor use ${newMethod}.", - - 'boundsAddError': "Você deve informar ambos os valores x e y para a função add.", - - 'lonlatAddError': "Você deve informar ambos os valores lon e lat para a função add.", - - 'pixelAddError': "Você deve informar ambos os valores x e y para a função add.", - - 'unsupportedGeometryType': "Tipo geométrico não suportado: ${geomType}.", - - 'filterEvaluateNotImplemented': "evaluete não está implementado para este tipo de filtro." + 'methodDeprecated': "Esse método está obsoleto e será removido na versão 3.0. Ao invés, por favor use ${newMethod}." }); diff --git a/lib/OpenLayers/Lang/pt.js b/lib/OpenLayers/Lang/pt.js index 33d0c69315..af8e519c64 100644 --- a/lib/OpenLayers/Lang/pt.js +++ b/lib/OpenLayers/Lang/pt.js @@ -24,20 +24,10 @@ OpenLayers.Lang["pt"] = OpenLayers.Util.applyDefaults({ 'Base Layer': "Camada Base", - 'readNotImplemented': "Leitura não implementada.", - - 'writeNotImplemented': "Escrita não implementada.", - 'noFID': "Não é possível atualizar um elemento para a qual não há FID.", - 'errorLoadingGML': "Erro ao carregar ficheiro GML ${url}", - 'browserNotSupported': "O seu navegador não suporta renderização vetorial. Actualmente os renderizadores suportados são:\n${renderers}", - 'componentShouldBe': "addFeatures: componente deve ser um(a) ${geomType}", - - 'getFeatureError': "getFeatureFromEvent foi chamado numa camada sem renderizador. Isto normalmente significa que destruiu uma camada, mas não um manipulador \'\'(handler)\'\' que lhe está associado.", - 'minZoomLevelError': "A propriedade minZoomLevel só deve ser usada com as camadas descendentes da FixedZoomLevels. A verificação da propriedade por esta camada wfs é uma relíquia do passado. No entanto, não podemos removê-la sem correr o risco de afectar aplicações OL que dependam dela. Portanto, estamos a torná-la obsoleta -- a verificação minZoomLevel será removida na versão 3.0. Em vez dela, por favor, use as opções de resolução min/max descritas aqui: http://trac.openlayers.org/wiki/SettingZoomLevels", 'commitSuccess': "Transacção WFS: SUCESSO ${response}", @@ -58,20 +48,8 @@ OpenLayers.Lang["pt"] = OpenLayers.Util.applyDefaults({ 'S': "S", - 'layerAlreadyAdded': "Você tentou adicionar a camada: ${layerName} ao mapa, mas ela já tinha sido adicionada antes", - 'reprojectDeprecated': "Está usando a opção \'reproject\' na camada ${layerName}. Esta opção é obsoleta: foi concebida para permitir a apresentação de dados sobre mapas-base comerciais, mas esta funcionalidade é agora suportada pelo Mercator Esférico. Mais informação está disponível em http://trac.openlayers.org/wiki/SphericalMercator.", - 'methodDeprecated': "Este método foi declarado obsoleto e será removido na versão 3.0. Por favor, use ${newMethod} em vez disso.", - - 'boundsAddError': "Você deve passar tanto o valor x como o y à função de adição.", - - 'lonlatAddError': "Você deve passar tanto o valor lon como o lat à função de adição.", - - 'pixelAddError': "Você deve passar tanto o valor x como o y à função de adição.", - - 'unsupportedGeometryType': "Tipo de geometria não suportado: ${geomType}", - - 'filterEvaluateNotImplemented': "avaliar não está implementado para este tipo de filtro." + 'methodDeprecated': "Este método foi declarado obsoleto e será removido na versão 3.0. Por favor, use ${newMethod} em vez disso." }); diff --git a/lib/OpenLayers/Lang/ru.js b/lib/OpenLayers/Lang/ru.js index 9c21a92ddd..23ecda8835 100644 --- a/lib/OpenLayers/Lang/ru.js +++ b/lib/OpenLayers/Lang/ru.js @@ -25,20 +25,10 @@ OpenLayers.Lang["ru"] = OpenLayers.Util.applyDefaults({ 'Base Layer': "Основной слой", - 'readNotImplemented': "Чтение не реализовано.", - - 'writeNotImplemented': "Запись не реализована.", - 'noFID': "Невозможно обновить объект, для которого нет FID.", - 'errorLoadingGML': "Ошибка при загрузке файла GML ${url}", - 'browserNotSupported': "Ваш браузер не поддерживает векторную графику. На данный момент поддерживаются:\n${renderers}", - 'componentShouldBe': "addFeatures: компонент должен быть ${geomType}", - - 'getFeatureError': "getFeatureFromEvent вызван для слоя без рендерера. Обычно это говорит о том, что вы уничтожили слой, но оставили связанный с ним обработчик.", - 'minZoomLevelError': "Свойство minZoomLevel предназначено только для использования со слоями, являющимися потомками FixedZoomLevels. То, что этот WFS-слой проверяется на minZoomLevel — реликт прошлого. Однако мы не можем удалить эту функцию, так как, возможно, от неё зависят некоторые основанные на OpenLayers приложения. Функция объявлена устаревшей — проверка minZoomLevel будет удалена в 3.0. Пожалуйста, используйте вместо неё настройку мин/макс разрешения, описанную здесь: http://trac.openlayers.org/wiki/SettingZoomLevels", 'commitSuccess': "Транзакция WFS: УСПЕШНО ${response}", @@ -59,20 +49,8 @@ OpenLayers.Lang["ru"] = OpenLayers.Util.applyDefaults({ 'S': "Ю", - 'layerAlreadyAdded': "Вы попытались добавить слой «${layerName}» на карту, но он уже был добавлен", - 'reprojectDeprecated': "Вы используете опцию \'reproject\' для слоя ${layerName}. Эта опция является устаревшей: ее использование предполагалось для поддержки показа данных поверх коммерческих базовых карт, но теперь этот функционал несёт встроенная поддержка сферической проекции Меркатора. Больше сведений доступно на http://trac.openlayers.org/wiki/SphericalMercator.", - 'methodDeprecated': "Этот метод считается устаревшим и будет удалён в версии 3.0. Пожалуйста, пользуйтесь ${newMethod}.", - - 'boundsAddError': "Функции add надо передавать оба значения, x и y.", - - 'lonlatAddError': "Функции add надо передавать оба значения, lon и lat.", - - 'pixelAddError': "Функции add надо передавать оба значения, x и y.", - - 'unsupportedGeometryType': "Неподдерживаемый тип геометрии: ${geomType}", - - 'filterEvaluateNotImplemented': "evaluate не реализовано для фильтра данного типа." + 'methodDeprecated': "Этот метод считается устаревшим и будет удалён в версии 3.0. Пожалуйста, пользуйтесь ${newMethod}." }); diff --git a/lib/OpenLayers/Lang/sk.js b/lib/OpenLayers/Lang/sk.js index 3cc3043f16..475647f521 100644 --- a/lib/OpenLayers/Lang/sk.js +++ b/lib/OpenLayers/Lang/sk.js @@ -22,20 +22,10 @@ OpenLayers.Lang["sk"] = OpenLayers.Util.applyDefaults({ 'Base Layer': "Základná vrstva", - 'readNotImplemented': "Čítanie nie je implementované.", - - 'writeNotImplemented': "Zápis nie je implementovaný.", - 'noFID': "Nie je možné aktualizovať vlastnosť, pre ktorú neexistuje FID.", - 'errorLoadingGML': "Chyba pri načítaní súboru GML ${url}", - 'browserNotSupported': "Váš prehliadač nepodporuje vykresľovanie vektorov. Momentálne podporované vykresľovače sú:\n${renderers}", - 'componentShouldBe': "addFeatures: komponent by mal byť ${geomType}", - - 'getFeatureError': "getFeatureFromEvent bola zavolaná na vrstve bez vykresľovača. To zvyčajne znamená, že ste odstránili vrstvu, ale nie niektorú z obslúh, ktorá je s ňou asociovaná.", - 'minZoomLevelError': "Vlastnosť minZoomLevel je určený iba na použitie s vrstvami odvodenými od FixedZoomLevels. To, že táto wfs vrstva kontroluje minZoomLevel je pozostatok z minulosti. Nemôžeme ho však odstrániť, aby sme sa vyhli možnému porušeniu aplikácií založených na Open Layers, ktoré na tomto môže závisieť. Preto ho označujeme ako zavrhovaný - dolu uvedená kontrola minZoomLevel bude odstránená vo verzii 3.0. Použite prosím namiesto toho kontrolu min./max. rozlíšenia podľa tu uvedeného popisu: http://trac.openlayers.org/wiki/SettingZoomLevels", 'commitSuccess': "Transakcia WFS: ÚSPEŠNÁ ${response}", @@ -48,20 +38,7 @@ OpenLayers.Lang["sk"] = OpenLayers.Util.applyDefaults({ 'Scale = 1 : ${scaleDenom}': "Mierka = 1 : ${scaleDenom}", - 'layerAlreadyAdded': "Pokúsili ste sa do mapy pridať vrstvu ${layerName}, ale tá už bola pridaná", - 'reprojectDeprecated': "Používate voľby „reproject“ vrstvy ${layerType}. Táto voľba je zzavrhovaná: jej použitie bolo navrhnuté na podporu zobrazovania údajov nad komerčnými základovými mapami, ale túto funkcionalitu je teraz možné dosiahnuť pomocou Spherical Mercator. Ďalšie informácie získate na stránke http://trac.openlayers.org/wiki/SphericalMercator.", - 'methodDeprecated': "Táto metóda je zavrhovaná a bude odstránená vo verzii 3.0. Použite prosím namiesto nej metódu ${newMethod}.", - - 'boundsAddError': "Sčítacej funkcii musíte dať hodnoty x aj y.", - - 'lonlatAddError': "Sčítacej funkcii musíte dať hodnoty lon (zem. dĺžka) aj lat (zem. šírka).", - - 'pixelAddError': "Sčítacej funkcii musíte dať hodnoty x aj y.", - - 'unsupportedGeometryType': "Nepodporovaný typ geometrie: ${geomType}", - - 'filterEvaluateNotImplemented': "evaluate nie je implementovaný pre tento typ filtra" - + 'methodDeprecated': "Táto metóda je zavrhovaná a bude odstránená vo verzii 3.0. Použite prosím namiesto nej metódu ${newMethod}." }); diff --git a/lib/OpenLayers/Lang/sv-SE.js b/lib/OpenLayers/Lang/sv-SE.js index a1b4dee201..21762502b5 100644 --- a/lib/OpenLayers/Lang/sv-SE.js +++ b/lib/OpenLayers/Lang/sv-SE.js @@ -22,20 +22,10 @@ OpenLayers.Lang["sv"] = OpenLayers.Util.applyDefaults({ 'Base Layer': "Bakgrundskarta", - 'readNotImplemented': "Läsning ej implementerad.", - - 'writeNotImplemented': "Skrivning ej implementerad.", - 'noFID': "Kan ej uppdatera feature (objekt) för vilket FID saknas.", - 'errorLoadingGML': "Fel i laddning av GML-fil ${url}", - 'browserNotSupported': "Din webbläsare stöder inte vektorvisning. För närvarande stöds följande visning:\n${renderers}", - 'componentShouldBe': "addFeatures : komponenten skall vara en ${geomType}", - - 'getFeatureError': "getFeatureFromEvent anropad för lager utan utritning. Detta betyder oftast att man raderat ett lager, men inte en hanterare som är knuten till lagret.", - 'minZoomLevelError': "Egenskapen minZoomLevel är endast avsedd att användas med lager med FixedZoomLevels. Att detta WFS-lager kontrollerar minZoomLevel är en relik från äldre versioner. Vi kan dock inte ta bort det utan att riskera att OL-baserade tillämpningar som använder detta slutar fungera. Därför är det satt som deprecated, minZoomLevel kommer att tas bort i version 3.0. Använd i stället inställning av min/max resolution som beskrivs här: http://trac.openlayers.org/wiki/SettingZoomLevels", 'commitSuccess': "WFS-transaktion: LYCKADES ${response}", @@ -48,20 +38,8 @@ OpenLayers.Lang["sv"] = OpenLayers.Util.applyDefaults({ 'Scale = 1 : ${scaleDenom}': "\x3cstrong\x3eSkala\x3c/strong\x3e 1 : ${scaleDenom}", - 'layerAlreadyAdded': "Du försökte lägga till lagret: ${layerName} på kartan, men det har lagts till tidigare", - 'reprojectDeprecated': "Du använder inställningen \'reproject\' på lagret ${layerName}. Denna inställning markerad som deprecated: den var avsedd att användas för att stödja visning av kartdata på kommersiella bakgrundskartor, men nu bör man i stället använda Spherical Mercator-stöd för den funktionaliteten. Mer information finns på http://trac.openlayers.org/wiki/SphericalMercator.", - 'methodDeprecated': "Denna metod är markerad som deprecated och kommer att tas bort i 3.0. Använd ${newMethod} i stället.", - - 'boundsAddError': "Du måste skicka både x- och y-värde till funktionen add.", - - 'lonlatAddError': "Du måste skicka både lon- och lat-värde till funktionen add.", - - 'pixelAddError': "Du måste skicka både x- och y-värde till funktionen add.", - - 'unsupportedGeometryType': "Stöd saknas för geometritypen: ${geomType}", - - 'filterEvaluateNotImplemented': "evaluering har ej implementerats för denna typ av filter." + 'methodDeprecated': "Denna metod är markerad som deprecated och kommer att tas bort i 3.0. Använd ${newMethod} i stället." }); diff --git a/lib/OpenLayers/Lang/vi.js b/lib/OpenLayers/Lang/vi.js index 6c6a4a650a..63b4270831 100644 --- a/lib/OpenLayers/Lang/vi.js +++ b/lib/OpenLayers/Lang/vi.js @@ -22,20 +22,10 @@ OpenLayers.Lang["vi"] = OpenLayers.Util.applyDefaults({ 'Base Layer': "Lớp nền", - 'readNotImplemented': "Chưa hỗ trợ chức năng đọc.", - - 'writeNotImplemented': "Chưa hỗ trợ chức năng viết.", - 'noFID': "Không thể cập nhật tính năng thiếu FID.", - 'errorLoadingGML': "Lỗi tải tập tin GML tại ${url}", - 'browserNotSupported': "Trình duyệt của bạn không hỗ trợ chức năng vẽ bằng vectơ. Hiện hỗ trợ các bộ kết xuất:\n${renderers}", - 'componentShouldBe': "addFeatures: bộ phận cần phải là ${geomType}", - - 'getFeatureError': "getFeatureFromEvent được gọi từ lớp không có bộ kết xuất. Thường thì có lẽ lớp bị xóa nhưng một phần xử lý của nó vẫn còn.", - 'minZoomLevelError': "Chỉ nên sử dụng thuộc tính minZoomLevel với các lớp FixedZoomLevels-descendent. Việc lớp wfs này tìm cho minZoomLevel là di tích còn lại từ xưa. Tuy nhiên, nếu chúng tôi dời nó thì sẽ vỡ các chương trình OpenLayers mà dựa trên nó. Bởi vậy chúng tôi phản đối sử dụng nó\x26nbsp;– bước tìm cho minZoomLevel sẽ được dời vào phiên bản 3.0. Xin sử dụng thiết lập độ phân tích tối thiểu / tối đa thay thế, theo hướng dẫn này: http://trac.openlayers.org/wiki/SettingZoomLevels", 'commitSuccess': "Giao dịch WFS: THÀNH CÔNG ${response}", @@ -56,20 +46,8 @@ OpenLayers.Lang["vi"] = OpenLayers.Util.applyDefaults({ 'S': "N", - 'layerAlreadyAdded': "Bạn muốn thêm lớp ${layerName} vào bản đồ, nhưng lớp này đã được thêm", - 'reprojectDeprecated': "Bạn đang áp dụng chế độ “reproject” vào lớp ${layerName}. Chế độ này đã bị phản đối: nó có mục đích hỗ trợ lấp dữ liệu trên các nền bản đồ thương mại; nên thực hiện hiệu ứng đó dùng tính năng Mercator Hình cầu. Có sẵn thêm chi tiết tại http://trac.openlayers.org/wiki/SphericalMercator .", - 'methodDeprecated': "Phương thức này đã bị phản đối và sẽ bị dời vào phiên bản 3.0. Xin hãy sử dụng ${newMethod} thay thế.", - - 'boundsAddError': "Cần phải cho cả giá trị x và y vào hàm add.", - - 'lonlatAddError': "Cần phải cho cả giá trị lon và lat vào hàm add.", - - 'pixelAddError': "Cần phải cho cả giá trị x và y vào hàm add.", - - 'unsupportedGeometryType': "Không hỗ trợ kiểu địa lý: ${geomType}", - - 'filterEvaluateNotImplemented': "chưa hỗ trợ evaluate cho loại bộ lọc này." + 'methodDeprecated': "Phương thức này đã bị phản đối và sẽ bị dời vào phiên bản 3.0. Xin hãy sử dụng ${newMethod} thay thế." }); diff --git a/lib/OpenLayers/Lang/zh-CN.js b/lib/OpenLayers/Lang/zh-CN.js index 31ecb03397..449dd696f0 100644 --- a/lib/OpenLayers/Lang/zh-CN.js +++ b/lib/OpenLayers/Lang/zh-CN.js @@ -18,24 +18,11 @@ OpenLayers.Lang["zh-CN"] = { 'Base Layer': "基础图层", - 'readNotImplemented': "读取功能没有实现。", - - 'writeNotImplemented': "写入功能没有实现。", - 'noFID': "无法更新feature,缺少FID。", - 'errorLoadingGML': "加载GML文件 ${url} 出现错误。", - 'browserNotSupported': "你使用的浏览器不支持矢量渲染。当前支持的渲染方式包括:\n${renderers}", - 'componentShouldBe': "addFeatures : 组件类型应该是 ${geomType}", - - // console message - 'getFeatureError': - "getFeatureFromEvent方法在一个没有渲染器的图层上被调用。 这通常意味着您" + - "销毁了一个图层,但并未销毁其关联的handler。", - // console message 'minZoomLevelError': "minZoomLevel属性仅适合用于" + @@ -75,10 +62,6 @@ OpenLayers.Lang["zh-CN"] = { 'Scale = 1 : ${scaleDenom}': "比例尺 = 1 : ${scaleDenom}", - // console message - 'layerAlreadyAdded': - "你尝试添加图层: ${layerName} 到地图中,但是它之前就已经被添加。", - // console message 'reprojectDeprecated': "你正在使用 ${layerName} 图层上的'reproject'选项。" + @@ -93,17 +76,5 @@ OpenLayers.Lang["zh-CN"] = { "该方法已经不再被支持,并且将在3.0中被移除。" + "请使用 ${newMethod} 方法来替代。", - // console message - 'boundsAddError': "您必须传递 x 和 y 两个参数值到 add 方法。", - - // console message - 'lonlatAddError': "您必须传递 lon 和 lat 两个参数值到 add 方法。", - - // console message - 'pixelAddError': "您必须传递 x and y 两个参数值到 add 方法。", - - // console message - 'unsupportedGeometryType': "不支持的几何体类型: ${geomType}", - 'end': '' }; diff --git a/lib/OpenLayers/Lang/zh-TW.js b/lib/OpenLayers/Lang/zh-TW.js index 25adefcf13..b70e861cfc 100644 --- a/lib/OpenLayers/Lang/zh-TW.js +++ b/lib/OpenLayers/Lang/zh-TW.js @@ -19,24 +19,11 @@ OpenLayers.Lang["zh-TW"] = { 'Base Layer': "基礎圖層", - 'readNotImplemented': "沒有實作讀取的功能。", - - 'writeNotImplemented': "沒有實作寫入的功能。", - 'noFID': "因為沒有 FID 所以無法更新 feature。", - 'errorLoadingGML': "讀取GML檔案 ${url} 錯誤。", - 'browserNotSupported': "您的瀏覽器未支援向量渲染. 目前支援的渲染方式是:\n${renderers}", - 'componentShouldBe': "addFeatures : 元件應該為 ${geomType}", - - // console message - 'getFeatureError': - "getFeatureFromEvent 在一個沒有被渲染的圖層裡被呼叫。這通常意味著您 " + - "摧毀了一個圖層,但並未摧毀相關的handler。", - // console message 'minZoomLevelError': "minZoomLevel 屬性僅適合用在 " + @@ -76,10 +63,6 @@ OpenLayers.Lang["zh-TW"] = { 'Scale = 1 : ${scaleDenom}': "Scale = 1 : ${scaleDenom}", - // console message - 'layerAlreadyAdded': - "你試著新增圖層: ${layerName} 到地圖上,但圖層之前就已經被新增了。", - // console message 'reprojectDeprecated': "你正使用 'reproject' 這個選項 " + @@ -94,17 +77,5 @@ OpenLayers.Lang["zh-TW"] = { "這個方法已經不再使用且在3.0將會被移除," + "請使用 ${newMethod} 來代替。", - // console message - 'boundsAddError': "您必須傳入 x 跟 y 兩者的值進 add 函數。", - - // console message - 'lonlatAddError': "您必須傳入 lon 跟 lat 兩者的值進 add 函數。", - - // console message - 'pixelAddError': "您必須傳入 x 跟 y 兩者的值進 add 函數。", - - // console message - 'unsupportedGeometryType': "未支援的幾何型別: ${geomType}。", - 'end': '' }; diff --git a/lib/OpenLayers/Layer.js b/lib/OpenLayers/Layer.js index a1b3f98ed6..46ec873be7 100644 --- a/lib/OpenLayers/Layer.js +++ b/lib/OpenLayers/Layer.js @@ -293,7 +293,10 @@ OpenLayers.Layer = OpenLayers.Class({ /** * APIProperty: wrapDateLine - * {Boolean} #487 for more info. + * {Boolean} Wraps the world at the international dateline, so the map can + * be panned infinitely in longitudinal direction. Only use this on the + * base layer, and only if the layer's maxExtent equals the world bounds. + * #487 for more info. */ wrapDateLine: false, diff --git a/lib/OpenLayers/Layer/GML.js b/lib/OpenLayers/Layer/GML.js index ab810165ff..129046769a 100644 --- a/lib/OpenLayers/Layer/GML.js +++ b/lib/OpenLayers/Layer/GML.js @@ -7,7 +7,6 @@ * @requires OpenLayers/Layer/Vector.js * @requires OpenLayers/Request/XMLHttpRequest.js * @requires OpenLayers/Console.js - * @requires OpenLayers/Lang.js */ /** @@ -167,7 +166,7 @@ OpenLayers.Layer.GML = OpenLayers.Class(OpenLayers.Layer.Vector, { * request - {String} */ requestFailure: function(request) { - OpenLayers.Console.userError(OpenLayers.i18n("errorLoadingGML", {'url':this.url})); + OpenLayers.Console.userError('Error in loading GML file ' + this.url); this.events.triggerEvent("loadend"); }, diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index fb82c253f7..babad41b69 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -516,6 +516,18 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { * tileoffsetlat, tileoffsetx, tileoffsety */ calculateGridLayout: function(bounds, origin, resolution) { + bounds = bounds.clone(); + if (this.map.baseLayer.wrapDateLine) { + var maxExtent = this.map.getMaxExtent(), + width = maxExtent.getWidth(); + // move the bounds one world width to the right until the origin is + // within the world extent + while (bounds.left < maxExtent.left) { + bounds.left += width; + bounds.right += width; + } + } + var tilelon = resolution * this.tileSize.w; var tilelat = resolution * this.tileSize.h; diff --git a/lib/OpenLayers/Layer/PointTrack.js b/lib/OpenLayers/Layer/PointTrack.js index e8d5e7d7b7..8e9e639b2d 100644 --- a/lib/OpenLayers/Layer/PointTrack.js +++ b/lib/OpenLayers/Layer/PointTrack.js @@ -5,7 +5,6 @@ /** * @requires OpenLayers/Layer/Vector.js - * @requires OpenLayers/Console.js */ /** @@ -64,10 +63,8 @@ OpenLayers.Layer.PointTrack = OpenLayers.Class(OpenLayers.Layer.Vector, { */ addNodes: function(pointFeatures, options) { if (pointFeatures.length < 2) { - OpenLayers.Console.error( - "At least two point features have to be added to create" + - "a line from"); - return; + throw new Error("At least two point features have to be added to " + + "create a line from"); } var lines = new Array(pointFeatures.length-1); @@ -81,9 +78,7 @@ OpenLayers.Layer.PointTrack = OpenLayers.Class(OpenLayers.Layer.Vector, { var lonlat = pointFeature.lonlat; endPoint = new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat); } else if(endPoint.CLASS_NAME != "OpenLayers.Geometry.Point") { - OpenLayers.Console.error( - "Only features with point geometries are supported."); - return; + throw new TypeError("Only features with point geometries are supported."); } if(i > 0) { diff --git a/lib/OpenLayers/Layer/Vector.js b/lib/OpenLayers/Layer/Vector.js index beb4341dc9..adaac4c297 100644 --- a/lib/OpenLayers/Layer/Vector.js +++ b/lib/OpenLayers/Layer/Vector.js @@ -565,9 +565,8 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, { if (this.geometryType && !(feature.geometry instanceof this.geometryType)) { - var throwStr = OpenLayers.i18n('componentShouldBe', - {'geomType':this.geometryType.prototype.CLASS_NAME}); - throw throwStr; + throw new TypeError('addFeatures: component should be an ' + + this.geometryType.prototype.CLASS_NAME); } //give feature reference to its layer @@ -827,8 +826,10 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, { */ getFeatureFromEvent: function(evt) { if (!this.renderer) { - OpenLayers.Console.error(OpenLayers.i18n("getFeatureError")); - return null; + throw new Error('getFeatureFromEvent called on layer with no ' + + 'renderer. This usually means you destroyed a ' + + 'layer, but not some handler which is associated ' + + 'with it.'); } var feature = null; var featureId = this.renderer.getFeatureIdFromEvent(evt); diff --git a/lib/OpenLayers/Layer/VirtualEarth.js b/lib/OpenLayers/Layer/VirtualEarth.js index 5e090e52c3..6de97c54be 100644 --- a/lib/OpenLayers/Layer/VirtualEarth.js +++ b/lib/OpenLayers/Layer/VirtualEarth.js @@ -13,6 +13,8 @@ /** * Class: OpenLayers.Layer.VirtualEarth + * *Deprecated*. Use instead. + * * Instances of OpenLayers.Layer.VirtualEarth are used to display the data from * the Bing Maps AJAX Control (see e.g. * http://msdn.microsoft.com/library/bb429619.aspx). Create a VirtualEarth diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 3f0f93fe55..3c83d56732 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -8,8 +8,6 @@ * @requires OpenLayers/Util.js * @requires OpenLayers/Events.js * @requires OpenLayers/Tween.js - * @requires OpenLayers/Console.js - * @requires OpenLayers/Lang.js */ /** @@ -238,20 +236,6 @@ OpenLayers.Map = OpenLayers.Class({ */ panRatio: 1.5, - /** - * Property: viewRequestID - * {String} Used to store a unique identifier that changes when the map - * view changes. viewRequestID should be used when adding data - * asynchronously to the map: viewRequestID is incremented when - * you initiate your request (right now during changing of - * baselayers and changing of zooms). It is stored here in the - * map and also in the data that will be coming back - * asynchronously. Before displaying this data on request - * completion, we check that the viewRequestID of the data is - * still the same as that of the map. Fix for #480 - */ - viewRequestID: 0, - // Options /** @@ -948,12 +932,10 @@ OpenLayers.Map = OpenLayers.Class({ * layer - {} */ addLayer: function (layer) { - for(var i=0, len=this.layers.length; i maxX) { - this.maxPx.x -= (maxX - minX); - } - if (this.minPx.x < minX) { - this.minPx.x += (maxX - minX); - } - } } if (dy) { this.layerContainerDiv.style.top = @@ -1829,8 +1798,6 @@ OpenLayers.Map = OpenLayers.Class({ if (zoomChanged) { this.zoom = zoom; this.resolution = res; - // zoom level has changed, increment viewRequestID. - this.viewRequestID++; } var bounds = this.getExtent(); diff --git a/lib/OpenLayers/Style.js b/lib/OpenLayers/Style.js index 302a9f2e15..55ed81e0c9 100644 --- a/lib/OpenLayers/Style.js +++ b/lib/OpenLayers/Style.js @@ -191,7 +191,7 @@ OpenLayers.Style = OpenLayers.Class({ style.display = "none"; } - if (style.label && typeof style.label !== "string") { + if (style.label != null && typeof style.label !== "string") { style.label = String(style.label); } diff --git a/lib/OpenLayers/Tile.js b/lib/OpenLayers/Tile.js index 73c710d16a..1fba9e057f 100644 --- a/lib/OpenLayers/Tile.js +++ b/lib/OpenLayers/Tile.js @@ -103,7 +103,7 @@ OpenLayers.Tile = OpenLayers.Class({ initialize: function(layer, position, bounds, url, size, options) { this.layer = layer; this.position = position.clone(); - this.bounds = bounds.clone(); + this.setBounds(bounds); this.url = url; if (size) { this.size = size.clone(); @@ -171,14 +171,55 @@ OpenLayers.Tile = OpenLayers.Class({ * Returns: * {Boolean} Whether or not the tile should actually be drawn. */ - shouldDraw: function() { - var maxExtent = this.layer.maxExtent; - var withinMaxExtent = (maxExtent && - this.bounds.intersectsBounds(maxExtent, false)); + shouldDraw: function() { + var withinMaxExtent = false, + maxExtent = this.layer.maxExtent; + if (maxExtent) { + // prepare up to 3 versions of the layer's maxExtent, to make sure + // that the intersectsBounds check below catches all cases of + // extents that cross the dateline: + // (1) left bound positive, right bound negative (wrapped) + // (2) left bound positive, right bound positive (exceeding world) + // (3) left bound negative (exceeding world), right bound positive + var maxExtents = [maxExtent]; + if (this.layer.map.baseLayer.wrapDateLine) { + if (maxExtent.left > maxExtent.right) { + var worldWidth = this.layer.map.getMaxExtent().getWidth(); + maxExtent = this.layer.maxExtent.clone(); + maxExtent.left -= worldWidth; + maxExtents.push(maxExtent); + maxExtent = this.layer.maxExtent.clone(); + maxExtent.right += worldWidth; + maxExtents.push(maxExtent); + } + } + for (var i=maxExtents.length-1; i>=0; --i) { + if (this.bounds.intersectsBounds(maxExtents[i], false)) { + withinMaxExtent = true; + break; + } + } + } return withinMaxExtent || this.layer.displayOutsideMaxExtent; }, + /** + * Method: setBounds + * Sets the bounds on this instance + * + * Parameters: + * bounds {} + */ + setBounds: function(bounds) { + bounds = bounds.clone(); + if (this.layer.map && this.layer.map.baseLayer.wrapDateLine) { + var worldExtent = this.layer.map.getMaxExtent(); + bounds = bounds.wrapDateLine(worldExtent); + } + this.bounds = bounds; + }, + /** * Method: moveTo * Reposition the tile. @@ -194,7 +235,7 @@ OpenLayers.Tile = OpenLayers.Class({ redraw = true; } - this.bounds = bounds.clone(); + this.setBounds(bounds); this.position = position.clone(); if (redraw) { this.draw(); diff --git a/lib/OpenLayers/Tween.js b/lib/OpenLayers/Tween.js index 5b16b03b5b..299cc27535 100644 --- a/lib/OpenLayers/Tween.js +++ b/lib/OpenLayers/Tween.js @@ -5,7 +5,6 @@ /** * @requires OpenLayers/BaseTypes/Class.js - * @requires OpenLayers/Console.js */ /** @@ -137,9 +136,9 @@ OpenLayers.Tween = OpenLayers.Class({ var b = this.begin[i]; var f = this.finish[i]; if (b == null || f == null || isNaN(b) || isNaN(f)) { - OpenLayers.Console.error('invalid value for Tween'); + throw new TypeError('invalid value for Tween'); } - + var c = f - b; value[i] = this.easing.apply(this, [this.time, b, c, this.duration]); } diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 77254cddff..729bbce20d 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -279,13 +279,14 @@ OpenLayers.Util.createImage = function(id, px, sz, imgURL, position, border, OpenLayers.Util.modifyDOMElement(image, id, px, sz, position, border, null, opacity); - if(delayDisplay) { + if (delayDisplay) { image.style.display = "none"; - OpenLayers.Event.observe(image, "load", - OpenLayers.Function.bind(OpenLayers.Util.onImageLoad, image)); - OpenLayers.Event.observe(image, "error", - OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError, image)); - + function display() { + image.style.display = ""; + OpenLayers.Event.stopObservingElement(image); + } + OpenLayers.Event.observe(image, "load", display); + OpenLayers.Event.observe(image, "error", display); } //set special properties @@ -294,8 +295,6 @@ OpenLayers.Util.createImage = function(id, px, sz, imgURL, position, border, if (imgURL) { image.src = imgURL; } - - return image; }; @@ -321,33 +320,6 @@ OpenLayers.Util.setOpacity = function(element, opacity) { null, null, null, opacity); }; -/** - * Function: onImageLoad - * Bound to image load events. For all images created with or - * , this function will be bound to the load event. - */ -OpenLayers.Util.onImageLoad = function() { - // The complex check here is to solve issues described in #480. - // Every time a map view changes, it increments the 'viewRequestID' - // property. As the requests for the images for the new map view are sent - // out, they are tagged with this unique viewRequestID. - // - // If an image has no viewRequestID property set, we display it regardless, - // but if it does have a viewRequestID property, we check that it matches - // the viewRequestID set on the map. - // - // If the viewRequestID on the map has changed, that means that the user - // has changed the map view since this specific request was sent out, and - // therefore this tile does not need to be displayed (so we do not execute - // this code that turns its display on). - // - if (!this.viewRequestID || - (this.map && this.viewRequestID == this.map.viewRequestID)) { - this.style.display = ""; - } - OpenLayers.Element.removeClass(this, "olImageLoadError"); -}; - /** * Property: IMAGE_RELOAD_ATTEMPTS * {Integer} How many times should we try to reload an image before giving up? @@ -355,38 +327,6 @@ OpenLayers.Util.onImageLoad = function() { */ OpenLayers.IMAGE_RELOAD_ATTEMPTS = 0; -/** - * Function: onImageLoadError - */ -OpenLayers.Util.onImageLoadError = function() { - this._attempts = (this._attempts) ? (this._attempts + 1) : 1; - if (this._attempts <= OpenLayers.IMAGE_RELOAD_ATTEMPTS) { - var urls = this.urls; - if (urls && OpenLayers.Util.isArray(urls) && urls.length > 1){ - var src = this.src.toString(); - var current_url, k; - for (k = 0; current_url = urls[k]; k++){ - if(src.indexOf(current_url) != -1){ - break; - } - } - var guess = Math.floor(urls.length * Math.random()); - var new_url = urls[guess]; - k = 0; - while(new_url == current_url && k++ < 4){ - guess = Math.floor(urls.length * Math.random()); - new_url = urls[guess]; - } - this.src = src.replace(current_url, new_url); - } else { - this.src = this.src; - } - } else { - OpenLayers.Element.addClass(this, "olImageLoadError"); - } - this.style.display = ""; -}; - /** * Property: alphaHackNeeded * {Boolean} true if the png alpha hack is necessary and possible, false otherwise. @@ -497,17 +437,9 @@ OpenLayers.Util.createAlphaImageDiv = function(id, px, sz, imgURL, var div = OpenLayers.Util.createDiv(); var img = OpenLayers.Util.createImage(null, null, null, null, null, null, - null, false); + null, delayDisplay); div.appendChild(img); - if (delayDisplay) { - img.style.display = "none"; - OpenLayers.Event.observe(img, "load", - OpenLayers.Function.bind(OpenLayers.Util.onImageLoad, div)); - OpenLayers.Event.observe(img, "error", - OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError, div)); - } - OpenLayers.Util.modifyAlphaImageDiv(div, id, px, sz, imgURL, position, border, sizing, opacity); diff --git a/tests/BaseTypes/Bounds.html b/tests/BaseTypes/Bounds.html index f5620af87b..1c607f339a 100644 --- a/tests/BaseTypes/Bounds.html +++ b/tests/BaseTypes/Bounds.html @@ -594,7 +594,7 @@ } function test_Bounds_add(t) { - t.plan( 8 ); + t.plan( 6 ); origBounds = new OpenLayers.Bounds(1,2,3,4); testBounds = origBounds.clone(); @@ -606,19 +606,19 @@ t.ok( bounds.equals(b), "bounds is set correctly"); //null values - OpenLayers.Lang.setCode('en'); - var desiredMsg = "You must pass both x and y values to the add function."; - OpenLayers.Console.error = function(msg) { - t.eq(msg, desiredMsg, "error correctly reported"); + try { + bounds = testBounds.add(null, 50); + } catch(e) { + t.ok("exception thrown when passing null value to add()"); } - - bounds = testBounds.add(null, 50); t.ok( testBounds.equals(origBounds), "testBounds is not modified by erroneous add operation (null x)"); - t.ok(bounds == null, "returns null on erroneous add operation (null x)"); - bounds = testBounds.add(5, null); + try { + bounds = testBounds.add(5, null); + } catch(e) { + t.ok("exception thrown when passing null value to add()"); + } t.ok( testBounds.equals(origBounds), "testBounds is not modified by erroneous add operation (null y)"); - t.ok(bounds == null, "returns null on erroneous add operation (null y)"); } function test_Bounds_scale(t) { diff --git a/tests/BaseTypes/LonLat.html b/tests/BaseTypes/LonLat.html index 009eafec91..3135a41ae3 100644 --- a/tests/BaseTypes/LonLat.html +++ b/tests/BaseTypes/LonLat.html @@ -52,7 +52,7 @@ } function test_LonLat_add(t) { - t.plan(10); + t.plan(8); origLL = new OpenLayers.LonLat(10,100); lonlatA = origLL.clone(); @@ -64,19 +64,19 @@ t.ok( addpx.equals(ll), "addpx is set correctly"); //null values - OpenLayers.Lang.setCode('en'); - var desiredMsg = "You must pass both lon and lat values to the add function."; - OpenLayers.Console.error = function(msg) { - t.eq(msg, desiredMsg, "error correctly reported"); + try { + addpx = lonlatA.add(null, 50); + } catch(e) { + t.ok("exception thrown when passing null value to add()"); } - - addpx = lonlatA.add(null, 50); t.ok( lonlatA.equals(origLL), "lonlatA is not modified by erroneous add operation (null lon)"); - t.ok(addpx == null, "returns null on erroneous add operation (null lon)"); - addpx = lonlatA.add(5, null); + try { + addpx = lonlatA.add(5, null); + } catch(e) { + t.ok("exception thrown when passing null value to add()"); + } t.ok( lonlatA.equals(origLL), "lonlatA is not modified by erroneous add operation (null lat)"); - t.ok(addpx == null, "returns null on erroneous add operation (null lat)"); // string values addpx = origLL.clone().add("5", "50"); diff --git a/tests/BaseTypes/Pixel.html b/tests/BaseTypes/Pixel.html index 1a8bf47303..8f9f5c9897 100644 --- a/tests/BaseTypes/Pixel.html +++ b/tests/BaseTypes/Pixel.html @@ -72,7 +72,7 @@ } function test_Pixel_add(t) { - t.plan( 8 ); + t.plan( 6 ); var origPX = new OpenLayers.Pixel(5,6); var oldPixel = origPX.clone(); @@ -85,19 +85,19 @@ t.ok( pixel.equals(px), "returned pixel is correct"); //null values - OpenLayers.Lang.setCode('en'); - var desiredMsg = "You must pass both x and y values to the add function."; - OpenLayers.Console.error = function(msg) { - t.eq(msg, desiredMsg, "error correctly reported"); + try { + pixel = oldPixel.add(null, 50); + } catch(e) { + t.ok("exception thrown when passing null value to add()"); } - - pixel = oldPixel.add(null, 50); t.ok( oldPixel.equals(origPX), "oldPixel is not modified by erroneous add operation (null x)"); - t.ok(pixel == null, "returns null on erroneous add operation (null x)"); - addpx = oldPixel.add(5, null); + try { + addpx = oldPixel.add(5, null); + } catch(e) { + t.ok("exception thrown when passing null value to add()"); + } t.ok( oldPixel.equals(origPX), "oldPixel is not modified by erroneous add operation (null y)"); - t.ok(pixel == null, "returns null on erroneous add operation (null y)"); } function test_Pixel_offset(t) { diff --git a/tests/Control/DrawFeature.html b/tests/Control/DrawFeature.html index bcaca1c5e4..ef0be5ab64 100644 --- a/tests/Control/DrawFeature.html +++ b/tests/Control/DrawFeature.html @@ -37,6 +37,33 @@ t.ok(!control.handler.multi, "handlerOptions.multi respected"); } + + function test_rendererOptions(t) { + t.plan(2); + + var map = new OpenLayers.Map("map"); + var renderers = ["Canvas", "VML"]; + + var layer = new OpenLayers.Layer.Vector(null, { + renderers: renderers, + rendererOptions: {zIndexing: true}, + isBaseLayer: true + }); + map.addLayer(layer); + + var control = new OpenLayers.Control.DrawFeature( + layer, OpenLayers.Handler.Polygon, {autoActivate: true} + ); + map.addControl(control); + + var sketchLayer = control.handler.layer; + + t.eq(sketchLayer.renderers, renderers, "Preferred renderers"); + t.eq(sketchLayer.rendererOptions.zIndexing, true, "renderer options"); + + map.destroy(); + + } function test_drawFeature(t) { t.plan(3); diff --git a/tests/Format/WFST/v1.html b/tests/Format/WFST/v1.html index 04142b60e0..6cfb1caa9e 100644 --- a/tests/Format/WFST/v1.html +++ b/tests/Format/WFST/v1.html @@ -133,6 +133,28 @@ t.xml_eq(got, expected, snippet + " request without geometry created correctly"); } } + + function test_setFilterProperty(t) { + t.plan(2); + var format = new OpenLayers.Format.WFST({ + geometryName: "foo" + }); + var filter = new OpenLayers.Filter.Logical({ + type: OpenLayers.Filter.Logical.AND, + filters: [new OpenLayers.Filter.Spatial({ + type: OpenLayers.Filter.Spatial.BBOX, + value: new OpenLayers.Bounds(1,2,3,4) + }), new OpenLayers.Filter.Spatial({ + type: OpenLayers.Filter.Spatial.DWITHIN, + property: "bar", + value: new OpenLayers.Geometry.Point(1,2), + distance: 10 + })] + }); + format.setFilterProperty(filter); + t.eq(filter.filters[0].property, "foo", "property set if not set on filter"); + t.eq(filter.filters[1].property, "bar", "property not set if set on filter"); + } function test_update_null_geometry(t) { var format = new OpenLayers.Format.WFST({ diff --git a/tests/Map.html b/tests/Map.html index 39da1928e9..770daec2d6 100644 --- a/tests/Map.html +++ b/tests/Map.html @@ -692,9 +692,12 @@ {map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'} ); - map.addLayers([layer,layer]); - - t.eq( map.layers.length, 1, "Map does not allow double adding of layers." ); + map.addLayers([layer]); + try { + map.addLayers([layer]); + } catch(e) { + t.ok(true, "Map does not allow double adding of layers." ); + } map.destroy(); } diff --git a/tests/Marker.html b/tests/Marker.html index 77abc31285..fa9b598a43 100644 --- a/tests/Marker.html +++ b/tests/Marker.html @@ -94,8 +94,8 @@ var marker = new OpenLayers.Marker(ll); mlayer.addMarker(marker); - t.ok(marker.icon.imageDiv.firstChild.src.contains("img/marker.png"), "Marker.png is default URL"); - + t.ok(OpenLayers.String.contains(marker.icon.imageDiv.firstChild.src, "img/marker.png"), "Marker.png is default URL"); + marker.setUrl("http://example.com/broken.png"); t.eq(marker.icon.imageDiv.firstChild.src, "http://example.com/broken.png", "image source changes correctly."); diff --git a/tests/Style.html b/tests/Style.html index 2c3a18b176..0b8b33b467 100644 --- a/tests/Style.html +++ b/tests/Style.html @@ -176,9 +176,9 @@ // c) test that label in returned symbolizer is a string even if property value is a number var symbolizer = style.createSymbolizer( - new OpenLayers.Feature.Vector(null, {foo: "bar", labelValue: 10}) + new OpenLayers.Feature.Vector(null, {foo: "bar", labelValue: 0}) ); - t.eq(symbolizer.label, "10", "c) feature property cast to string when used as symbolizer label"); + t.eq(symbolizer.label, "0", "c) feature property cast to string when used as symbolizer label"); } diff --git a/tests/Util.html b/tests/Util.html index f70cbb9ddf..d6dcc93def 100644 --- a/tests/Util.html +++ b/tests/Util.html @@ -254,21 +254,6 @@ } - function test_Util_imageLoadError(t) { - t.plan(2); - - var img = OpenLayers.Util.createImage(null, null, null, null, null, null, null, false); - - // mock up image load failure - img._attempts = OpenLayers.IMAGE_RELOAD_ATTEMPTS + 1; - OpenLayers.Util.onImageLoadError.call(img); - t.ok(OpenLayers.Element.hasClass(img, 'olImageLoadError'), 'broken image has class olImageLoadError'); - - // mock up image load success - OpenLayers.Util.onImageLoad.call(img); - t.ok(!OpenLayers.Element.hasClass(img, 'olImageLoadError'), 'good image does not have class olImageLoadError'); - } - function test_Util_applyDefaults(t) { t.plan(12); diff --git a/tests/manual/dateline-sketch.html b/tests/manual/dateline-sketch.html index 62d4391324..f2e4a0a859 100644 --- a/tests/manual/dateline-sketch.html +++ b/tests/manual/dateline-sketch.html @@ -13,8 +13,6 @@ } - - + + + +

OpenLayers overlays crossing the dateline test

+ +

+ The overlay has an extent smaller than the world extent. The base layer + is configured with wrapDateLine set to true. New Zealand and a part of + Australia should always be visible on the map. +

+
+ + diff --git a/theme/default/style.css b/theme/default/style.css index 3aeac29c2e..b622c766c7 100644 --- a/theme/default/style.css +++ b/theme/default/style.css @@ -90,12 +90,7 @@ div.olControlMousePosition { -moz-border-radius: 1em 0 0 0; } -.olControlOverviewMapMinimizeButton { - right: 0; - bottom: 80px; - cursor: pointer; -} - +.olControlOverviewMapMinimizeButton, .olControlOverviewMapMaximizeButton { right: 0; bottom: 80px;